LlamaIndex Postprocessor Integration: AWS Bedrock Rerankers
Sample Usage
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
from llama_index.postprocessor.bedrock_rerank import BedrockRerank
documents = SimpleDirectoryReader("./data/paul_graham/").load_data()
index = VectorStoreIndex.from_documents(documents=documents)
reranker = BedrockRerank(
top_n=3,
rerank_model_name="cohere.rerank-v3-5:0",
region_name="us-west-2",
)
query_engine = index.as_query_engine(
similarity_top_k=10,
node_postprocessors=[reranker],
)
response = query_engine.query(
"What did Sam Altman do in this essay?",
)
print(response)
print(response.source_nodes)
Release files for llama-index-postprocessor-bedrock-rerank 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llama_index_postprocessor_bedrock_rerank-0.7.0.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_index_postprocessor_bedrock_rerank-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / llama_index_postprocessor_bedrock_rerank-0.7.0.tar.gz
| Download URL | llama_index_postprocessor_bedrock_rerank-0.7.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d63ddc454e35544fc21b181d00800b6c94a65c0a9d437a8e0aeafebc3b2d846
|
|
BLAKE2b-256 checksum How to use checksums |
2180522776912e44f8ab6ae51b27bde6325128f5313dc3fdaa9a9e91fb430d11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / llama_index_postprocessor_bedrock_rerank-0.7.0-py3-none-any.whl
| Download URL | llama_index_postprocessor_bedrock_rerank-0.7.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
818cf7b492d56605e314f3832c6c79bbb5dfb5a59ad84e77d6f94590575fd8b8
|
|
BLAKE2b-256 checksum How to use checksums |
10e1e19e7c58904fbc8c3dd4110d4e75191df445ff6883aadb4b4f050d874a75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|