Skip to main content

llama-index postprocessor text embedding inference rerank integration

Project description

LlamaIndex Postprocessor Integration: TEI Rerank

Re-Rankers hosted on Text Embedding Inference Serve by Huggingface.

Install TEI Rerank package with: pip install llama-index-postprocessor-tei-rerank

text-embeddings-inference v0.4.0 added support for CamemBERT, RoBERTa and XLM-RoBERTa Sequence Classification models. Please refer to their repo for any further clarrification : https://github.com/huggingface/text-embeddings-inference

Docker start-up for TEI:

model=BAAI/bge-reranker-large
volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run

docker run --gpus all -p 8080:80 -v $volume:/data --pull always ghcr.io/huggingface/text-embeddings-inference:1.5 --model-id $model --auto-truncate

Post successful startup of the docker image, the re-ranker can be initialised as follows:

from llama_index.postprocessor.tei_rerank import TextEmbeddingInference as TEIR

query_bundle = QueryBundle(prompt)
retrieved_nodes = retriever.retrieve(query_bundle)

postprocessor = TEIR(
    "BAAI/bge-reranker-large", "http://0.0.0.0/8080"
)  # Name of the model used in the docker server and base url (ip:port)

reranked_nodes = postprocessor.postprocess_nodes(
    nodes=retrieved_nodes, query_bundle=query_bundle
)

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

File details

Details for the file llama_index_postprocessor_tei_rerank-0.3.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b9627ebd7eaff39242b7c5c10c27ad9edefa1cf595ac10ebd5571d7d1037d075
MD5 6ee15443cad3c00635230d01dc1b9513
BLAKE2b-256 53cfce2d66670d69853d0fbeebfb5e3710b1195c205109d2f555581fe58f0487

See more details on using hashes here.

File details

Details for the file llama_index_postprocessor_tei_rerank-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d30876175afeae3504b73aa1402758572bdf060fd954708795674a985fcb9352
MD5 750dc411039bfa38765c9974ba8f1f03
BLAKE2b-256 c4e81f0d1d44ca9f8d63ae95074c5ebc513be29cf48b3dae054b00b13413b9b3

See more details on using hashes here.

Supported by

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