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

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_tei_rerank-0.4.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.4.1.tar.gz
Algorithm Hash digest
SHA256 c9a88733b2c0e96686d258d126935a3c2f5885c9dac6466e293c8f50d7f46458
MD5 d31da605a3dd64cc037e41e9d310af49
BLAKE2b-256 bb2665623fbbbcbe1fe6042444ee71a977d997d1a5e21fbc926fc284bb66e576

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 08b0b12f84dddd5e7f7f6388ae0d32a848064d439d7f6f3f1ff97296a030ebb1
MD5 10bdbabd5e5b5ae9e27b05ac28196a8f
BLAKE2b-256 f39711fefb41346df79b947930771ad588f9d8e3b1d43a37ad1879609cc11bdf

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