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

File metadata

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0118f3d43a934c4690fbf9b9157b2b9e9acb69842f23d98f5a2f55ca5ef211a3
MD5 1ca37d391654fdeb3eeed5f5e451c443
BLAKE2b-256 d7b5cdc107acd9ffd24d75337e19c64f7f9b5abd3155431c4ac1490008ee92a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0cd510c0cfcf1152b95829ebfabc6cad132473b16c9f9b71e2b97e8586ea9374
MD5 a21a3c1507fb44e385c634276670248c
BLAKE2b-256 c5eacb7a4224980d44c95441dfcfe3aa0700af81365f0da957c25605ae908a3b

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