Skip to main content

langchain-zeroentropy

LangChain document compressor that reranks retrieved results using ZeroEntropy zerank models.

Installation

pip install langchain-zeroentropy

Usage

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:

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 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

Metadata

Release files for langchain-zerank 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-zerank 0.1.0
File Size Uploaded
langchain_zerank-0.1.0.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-zerank 0.1.0
File Interpreter ABI Platform
langchain_zerank-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / langchain_zerank-0.1.0.tar.gz

Download URL langchain_zerank-0.1.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fdd043006debbedcf7b5993679e382fa2393495ab732fcae3ffcbf8ce2fb0ef3
BLAKE2b-256 checksum
How to use checksums
361a82ed98549288764b76739961000504e9a3b493b3f22e10f8ed662ada5c78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release files / langchain_zerank-0.1.0-py3-none-any.whl

Download URL langchain_zerank-0.1.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
840e29ff0949c91007af95bc3f1874502400ee4357a933762773d952d2e25a02
BLAKE2b-256 checksum
How to use checksums
a9647e6788955baf356350594bcf158779073fee6a3cef91dd765fced5da4885
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page