Cross-encoder reranker utility for LangChain documents
Project description
rag-reranker
A lightweight cross-encoder reranker for LangChain Document objects.
Installation
pip install rag-reranker
Usage
from langchain_core.documents import Document
from rag_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:
python -m pip install --upgrade build
python -m build
This produces distributable files in the dist/ folder.
Publish to PyPI
python -m pip install --upgrade twine
python -m twine check dist/*
python -m twine upload dist/*
You can use TestPyPI first:
python -m twine upload --repository testpypi dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rag_reranker-0.1.1.tar.gz
(3.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rag_reranker-0.1.1.tar.gz.
File metadata
- Download URL: rag_reranker-0.1.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40f165dcf4a38c50fee5361bfffe526b7e6cd1a0113ca922249c63f896d6f8c7
|
|
| MD5 |
fcafcba4afee4e86b5847a008a6aeb9d
|
|
| BLAKE2b-256 |
4be16182f8ae2633f95c760b007446a0bbc5459ef63b59021e4b8d459def7bd4
|
File details
Details for the file rag_reranker-0.1.1-py3-none-any.whl.
File metadata
- Download URL: rag_reranker-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
868ddefdd9a661f41d3a208bed8e2aba8e3cefe0b79d734abb53ec8b3e02ac46
|
|
| MD5 |
0cbb53269d14726dc8fcee9b7785da5e
|
|
| BLAKE2b-256 |
c42f50442b785c902a897cfc7d45cae2db1772e921c1d03b5f87ab3a32c5f0f5
|