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.2.tar.gz (4.4 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.2.tar.gz.

File metadata

  • Download URL: llama_index_postprocessor_tei_rerank-0.4.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.4.2.tar.gz
Algorithm Hash digest
SHA256 0c5153f455097bf0fd86e16305713e6958778a1745e176b58a59842dc379fc2f
MD5 881f96bae08c0e601f2ecd0935183562
BLAKE2b-256 814c5457c536efe399fea80649025b15b0672f3b7aa2492f4c6b4069740aee26

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llama_index_postprocessor_tei_rerank-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_postprocessor_tei_rerank-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 96b0647b7937cd850af46b53434bfb3a4d0fc92487f5d0fd46a9cfacacd86ef6
MD5 e9cc5ce2461583879292466e78258e0d
BLAKE2b-256 e5ba3152b83ea2b76971b0d78412a4f4a4c88d0b4047519b137cd1ad8b60943b

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