Skip to content

local_client

module wittgenstein_embeddings.providers.local_client

Classes

  • LocalEmbedder — Sentence-transformers embedder — auto-downloads from HuggingFace, CPU by default.

wittgenstein_embeddings.providers.local_client.LocalEmbedder

class LocalEmbedder(model_name: str = 'intfloat/multilingual-e5-base', device: str = 'cpu', query_prefix: str = 'query: ', passage_prefix: str = 'passage: ', dtype: str | None = None)

Bases : EmbeddingClient

Sentence-transformers embedder — auto-downloads from HuggingFace, CPU by default.

No new caching layer: relies on sentence-transformers' own reuse of HF's default cache dir (~/.cache/huggingface), same as this platform's GPU worker (apps/_platform/workers/python_gpu/worker.py) already does.

device defaults to "cpu" and is never auto-detected here — this is a generic shared lib, not a GPU-provisioned worker; a caller who wants CUDA computes "cuda" if torch.cuda.is_available() else "cpu" and passes it.

dtype defaults to None (framework default, float32). Pass "bfloat16" to roughly halve resident memory — NOT "float16": plain fp16 has poor native CPU support in PyTorch and can be slower than fp32 there, while bfloat16 is well-supported on CPU since PyTorch 1.10+. GPU callers may still want float16 explicitly; this default just avoids the CPU footgun.

Methods

wittgenstein_embeddings.providers.local_client.LocalEmbedder.query

method LocalEmbedder.query(text: str) → list[float]

wittgenstein_embeddings.providers.local_client.LocalEmbedder.passage

method LocalEmbedder.passage(text: str) → list[float]

wittgenstein_embeddings.providers.local_client.LocalEmbedder.query_batch

method LocalEmbedder.query_batch(texts: list[str]) → list[list[float]]

wittgenstein_embeddings.providers.local_client.LocalEmbedder.passage_batch

method LocalEmbedder.passage_batch(texts: list[str]) → list[list[float]]

wittgenstein_embeddings.providers.local_client.LocalEmbedder.dimension

property LocalEmbedder.dimension: int