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

llama_index_postprocessor_tei_rerank-0.4.0.tar.gz (4.2 kB view details)

Uploaded Source

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

File metadata

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.4.0.tar.gz
Algorithm Hash digest
SHA256 15ea8585abf0624974324c49740bfd13c80613e6c999c6ebb64caaef8ea5065d
MD5 6376975035a8283ba90e0819062188d7
BLAKE2b-256 01dad20f2eb402bbe430a97bb98f026ff171fe74dbc1ebc0b13f1ff9d37a66cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1082e578406716f5b341e0cac58b494709d476d2d4a12444fcc793b4edc2423e
MD5 f09e428d658ef1c85f249e4575861586
BLAKE2b-256 d5dbcb998477336dcb186744f9229407c992a8b40bcfd472eefb9675a0ebdd15

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