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

File metadata

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2f9b82eb83bd1287041edf07bc48c771f786e2228afa7a00614fdf6a25493125
MD5 1cc9477c986f839b32b7209085bc9eb9
BLAKE2b-256 38341d5fc48c720b597f0a3250b153a0b222dcb50fa126c230a05aaf8791e600

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20562f4940a17f6f3b4fa34192954c27a2d52f486b91d3a73434df6bd3eb9490
MD5 4b72846c2995fc9da7d36b41b65da7aa
BLAKE2b-256 91665d876eee8e03ab71d1337850fcc33483c1018c74d944b4713ec7b2290c01

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