Skip to main content

PyTEI

PyTEI is a minimal python interface for Hugging Face's Text Embeddings Inference.

PyTEI supports in-memory and persistent caching for text embeddings.

Installation

First, clone the git repository by running:

git clone https://github.com/daniel-gomm/PyTEI.git

Next, install this repository as python package using pip by running the following command from the root directory of this repository:

pip install .

Add the -e-flag in case you want to modify the code.

Usage

Prerequisite for using PyTEI is a running Text Embeddings Inference instance, for example a local docker container running TEI. Such a docker contain can be spun-up by running:

docker run --gpus all -p 8080:80 \
  -v $PWD/data:/data \
  --pull always ghcr.io/huggingface/text-embeddings-inference:1.6 \
  --model-id Alibaba-NLP/gte-Qwen2-1.5B-instruct

TEI Client

For more details check out the Documentation.

Establish a connection to TEI through a TEIClient. The client gives you access to the text-embedding API of the TEI instance:

from pytei import TEIClient

client = TEIClient(url="127.0.0.1:8080/embed")

text_embedding = client.embed("Lorem Ipsum")

The default configuration uses in-memory caching of embeddings. For persistent caching use the DuckDBDataStore or implement your own caching solution by extending the DataStore base-class.

from pytei import TEIClient
from pytei.store import DuckDBEmbeddingStore

persistent_data_store = DuckDBEmbeddingStore(db_path="data/embedding_database.duckdb")
client = TEIClient(embedding_store=persistent_data_store, url="127.0.0.1:8080/embed")

text_embedding = client.embed("Lorem Ipsum")

For a more detailed description and the full description of the API check out the Documentation

Metadata

Release files for pytei-client 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytei-client 0.1.0
File Size Uploaded Provenance
pytei_client-0.1.0.tar.gz 7.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytei-client 0.1.0
File Interpreter ABI Platform
pytei_client-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / pytei_client-0.1.0.tar.gz

Download URL pytei_client-0.1.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0dfdc77ad7c3f27448e8ea9f3271f605f48c55bfb334fde4365760ff54ab1537
BLAKE2b-256 checksum
How to use checksums
0645986c54fcb93c9701d8c73259c444644f7a8f380fe4bc0df07e25bc575f75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2025.

Transparency log

Release files / pytei_client-0.1.0-py3-none-any.whl

Download URL pytei_client-0.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0947cb33a0ccf1f516691c667cc3b8424b3f1dee70575e4c82925431a386091b
BLAKE2b-256 checksum
How to use checksums
f2ebbc581ab09da3ac3660dd3a93bbbf1d1fecca21beba087bbe0167a4fb3e22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2025.

Transparency log

Security for pytei-client 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pytei_client-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page