Metadata-Version: 2.4
Name: krira-embed
Version: 0.1.0
Summary: Modal-powered embedding pipeline for Krira chunks with Pinecone upsert.
Author: Krira
License: MIT License
        
        Copyright (c) 2026 Krira
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Keywords: embeddings,modal,pinecone,vector-db,nlp
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: <3.13,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: krira-augment>=2.1.13
Requires-Dist: modal>=1.3.5
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Provides-Extra: release
Requires-Dist: build>=1.2.2; extra == "release"
Requires-Dist: twine>=5.0.0; extra == "release"
Dynamic: license-file

# krira-embed

`krira-embed` provides a Modal-powered embedding pipeline for chunked text and upserts vectors to Pinecone.

## Features

- Batch chunk ingestion from JSONL (`text`, optional `metadata`, optional `id`)
- Distributed embedding jobs with Modal
- Pinecone upsert with deterministic ID fallback
- Simple Python client API: `KriraEmbedding`

## Requirements

- Python `>=3.10,<3.13`
- Modal account and token (`MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET`)
- Pinecone API key (`PINECONE_API_KEY`)
- Chunked JSONL file (for example, `chunks.jsonl`)

## Installation

```bash
pip install krira-embed
```

## Quickstart

```python
from krira_embed import KriraEmbedding

client = KriraEmbedding(
    chunk_file_path="chunks.jsonl",
    pinecone_api_key="YOUR_PINECONE_API_KEY",
    pinecone_index_name="YOUR_INDEX_NAME",
    namespace="default",
)

result = client.embed(
    worker_batch_size=12000,
    parallel_jobs=6,
    model_batch_size=768,
    upsert_batch_size=200,
)

print(result)
```

## Credentials model

- End users provide Pinecone credentials explicitly in code (`pinecone_api_key`, `pinecone_index_name`).
- The package does not read local `.env` for Pinecone credentials.
- Modal credentials can still be supplied via environment variables (`MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET`) or existing Modal auth setup.

## Modal CLI usage

When using the Modal entrypoint directly, pass both values explicitly:

```bash
modal run main.py --index-name YOUR_INDEX_NAME --pinecone-api-key YOUR_PINECONE_API_KEY
```

Use `.env` only for your local Modal tokens if needed (see `.env.example`).

## Local validation (maintainers)

```bash
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
```

## License

MIT License. See `LICENSE`.
