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.2.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e5cd341a6ee0738567c3041467ca6b9f783a0138fbd49f5de20e314583fb9da1
MD5 07709b074ba6a57fd1769391d0cddb71
BLAKE2b-256 c3e957dbc01d3cd53fa15466935c728688e61cc51eb44256c728fc48aebacee5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b879599b03e59d7d46abcefeb98880ccb486ba613c8954de4e0ae3e97119bfff
MD5 32fec4989e9a0664eb0440e170350a0f
BLAKE2b-256 3f823b0ee8a3b547990a2fef5e854e0df53e19dc6c65d8adfb155f040ac1cc69

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