Metadata-Version: 2.4
Name: langchain-zerank
Version: 0.1.0
Summary: LangChain integration for ZeroEntropy zerank rerankers
Author-email: Raju Singh <rajuslaw@gmail.com>
License: MIT
License-File: LICENSE
Requires-Python: >=3.9
Requires-Dist: langchain-core>=0.3
Requires-Dist: zeroentropy>=0.1.0a11
Provides-Extra: test
Requires-Dist: langchain-tests; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-asyncio; extra == 'test'
Description-Content-Type: text/markdown

# langchain-zeroentropy

LangChain document compressor that reranks retrieved results using [ZeroEntropy](https://zeroentropy.dev) `zerank` models.

## Installation

```bash
pip install langchain-zeroentropy
```

## Usage

```python
from langchain_zeroentropy import ZeroEntropyRerank
from langchain.retrievers import ContextualCompressionRetriever

compressor = ZeroEntropyRerank(model="zerank-1-small", top_n=3)

compression_retriever = ContextualCompressionRetriever(
    base_compressor=compressor,
    base_retriever=your_retriever,
)

docs = compression_retriever.invoke("what is the rebate on electronics?")
```

Set your API key via the `ZEROENTROPY_API_KEY` environment variable, or pass it directly:

```python
compressor = ZeroEntropyRerank(api_key="ze-...", model="zerank-1-small", top_n=3)
```

## Supported models

| Model | Notes |
|---|---|
| `zerank-1-small` | Fast, Apache-2.0 licensed |
| `zerank-1` | Higher accuracy |

See the [ZeroEntropy docs](https://docs.zeroentropy.dev) for the full model list and free-tier limits.

## Parameters

| Parameter | Default | Description |
|---|---|---|
| `model` | `zerank-1-small` | ZeroEntropy reranker model |
| `top_n` | `3` | Number of top documents to return |
| `api_key` | `None` | API key (falls back to `ZEROENTROPY_API_KEY` env var) |

## License

MIT
