# ragas-reranker

A lightweight cross-encoder reranker for LangChain `Document` objects.

## Installation

```bash
pip install ragas-reranker
```

## Usage

```python
from langchain_core.documents import Document
from ragas_reranker import CrossEncoderReranker

docs = [
    Document(page_content="Paris is the capital of France."),
    Document(page_content="Berlin is the capital of Germany."),
]

reranker = CrossEncoderReranker()
results = reranker.rerank("what is the capital of france?", docs, top_k=1)

print(results[0].document.page_content, results[0].score)
```

## Development

Build locally:

```bash
python -m pip install --upgrade build
python -m build
```

This produces distributable files in the `dist/` folder.

## Publish to PyPI

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

You can use TestPyPI first:

```bash
python -m twine upload --repository testpypi dist/*
```
