Registry / search / llama-index-postprocessor-bedrock-rerank

llama-index-postprocessor-bedrock-rerank

JSON →
library0.6.0pypypi✓ verified 84d ago

LlamaIndex integration for Amazon Bedrock's reranker model. Allows reranking of retrieved documents using Bedrock's built-in rerank capability. Version 0.6.0, updated regularly with LlamaIndex releases.

pip install llama-index-postprocessor-bedrock-rerank
INSTALL
IMPORT
SIG · LLAMA-INDEX-POSTPR
L
llama-index-postprocessor-bedrock-rerank
searchpythonv0.6.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BedrockRerank
from llama_index.postprocessor.bedrock_rerank import BedrockRerank
from llama_index.postprocessor import BedrockRerank
Must include full dotted path; postprocessor is a subpackage.

Basic usage: load documents, create index, and query with Bedrock reranker as a node postprocessor.

import os from llama_index.core import VectorStoreIndex, SimpleDirectoryReader from llama_index.postprocessor.bedrock_rerank import BedrockRerank # Load documents documents = SimpleDirectoryReader("./data").load_data() # Create index with a retriever index = VectorStoreIndex.from_documents(documents) retriever = index.as_retriever(similarity_top_k=10) # Set up reranker (uses AWS default profile or env vars) os.environ["AWS_ACCESS_KEY_ID"] = os.environ.get("AWS_ACCESS_KEY_ID", "") os.environ["AWS_SECRET_ACCESS_KEY"] = os.environ.get("AWS_SECRET_ACCESS_KEY", "") os.environ["AWS_DEFAULT_REGION"] = os.environ.get("AWS_DEFAULT_REGION", "us-east-1") reranker = BedrockRerank( model="cohere.rerank-v3-5:0", top_k=3, ) # Query with reranker query_engine = index.as_query_engine( node_postprocessors=[reranker], similarity_top_k=10, ) response = query_engine.query("What is the capital of France?") print(response)
Debug
Known issues
breakingIn v0.6.0 the import path changed: must use 'from llama_index.postprocessor.bedrock_rerank import BedrockRerank' instead of the old 'from llama_index.postprocessor.bedrock_rerank' (which still works but is deprecated).
fix
Update your import to 'from llama_index.postprocessor.bedrock_rerank import BedrockRerank'.
affects: >=0.6.0
deprecatedThe 'model' parameter default changed; previously defaulted to 'cohere.rerank-v2:0', now defaults to 'cohere.rerank-v3-5:0'. Relying on default may break if you expected the old model.
fix
Explicitly set the model parameter to the version you need.
affects: >=0.6.0
gotchaAWS credentials must be configured (via env vars, IAM role, or AWS CLI). The postprocessor does not provide helpful error messages for missing credentials.
fix
Set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_DEFAULT_REGION before using the reranker.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'llama_index.postprocessor.bedrock_rerank'
Missing installation of the optional package.
fix
Install with 'pip install llama-index-postprocessor-bedrock-rerank'.
botocore.exceptions.NoCredentialsError: Unable to locate credentials
AWS credentials not configured.
fix
Set environment variables: export AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... AWS_DEFAULT_REGION=us-east-1 (or use IAM role).
Upgrade
Version history
0.6.0latest on PyPI · released Mar 12, 2026
Audit
Dependencies
llama-index-corerequiredCore LlamaIndex classes
boto3requiredAWS SDK for Bedrock API calls
Agent activity
36 hits · last 30 days
node
34
Resources

No resource links recorded.

llama-index-postprocessor-bedrock-rerank — pip install llama-index-postprocessor-bedrock-rerank · libregistry