Skip to main content

llama-index postprocessor bedrock rerank integration

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file llama_index_postprocessor_bedrock_rerank-0.6.0.tar.gz.

File metadata

  • Download URL: llama_index_postprocessor_bedrock_rerank-0.6.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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}

File hashes

Hashes for llama_index_postprocessor_bedrock_rerank-0.6.0.tar.gz
Algorithm Hash digest
SHA256 3eed7299573b0ec295a1032f7b6dafbc16a6c2605dbed1c79f6e0c3e2c94cbe4
MD5 6af8308ec976d85e374c7f1ba1e4513f
BLAKE2b-256 200727dc69e892d0ad214f8805e078634a4cdd2887e2d924649ee6e7731fd64e

See more details on using hashes here.

File details

Details for the file llama_index_postprocessor_bedrock_rerank-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_postprocessor_bedrock_rerank-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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}

File hashes

Hashes for llama_index_postprocessor_bedrock_rerank-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9adaede59c1a6fb3713296fbe76be4e34ef2ef6149769f840242a6f78f3829e7
MD5 5db41f986c03ff0b82cd496fbd251f4a
BLAKE2b-256 4f172e5ce04779912c19f4ba76da7b110bcd53e99d887bf0e3b5a234d01601ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page