embeddings
embeddings
¶
Dense embedding clients for the IngestionPipeline.
A thin HTTP wrapper around a local Ollama <https://ollama.com>_ daemon
running an embedding model (default nomic-embed-text, 768-dim). Embeddings
are serialised as float32 bytes for storage in the embedding BLOB
column of knowledge_chunks.
The client degrades gracefully when the daemon is unreachable: embed
returns None and is_available() reports False instead of raising,
so ingestion never fails because a sidecar service is down.
Classes¶
OllamaEmbedder
¶
OllamaEmbedder(*, model: str = DEFAULT_EMBED_MODEL, host: str = DEFAULT_OLLAMA_HOST, timeout: float = 30.0)
Embed text via a local Ollama daemon.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
Ollama model tag (e.g.
TYPE:
|
host
|
Base URL for the Ollama HTTP API. Defaults to
TYPE:
|
timeout
|
Per-request timeout in seconds.
TYPE:
|
Source code in src/openjarvis/connectors/embeddings.py
Attributes¶
model_version
property
¶
Stable identifier persisted alongside each embedding row.
dim
property
¶
Embedding dimensionality, learned after the first successful call.
Functions¶
is_available
¶
Return True iff the daemon answers and the model is installed.
Source code in src/openjarvis/connectors/embeddings.py
embed
¶
Embed a single string. Returns float32 bytes or None on failure.
Source code in src/openjarvis/connectors/embeddings.py
embed_batch
¶
Embed a list of strings sequentially.
Ollama's HTTP API serves one prompt per call; on the same host the round-trip overhead is negligible relative to model inference.
Source code in src/openjarvis/connectors/embeddings.py
Functions¶
decode_embedding
¶
Reconstruct a 1-D vector from a BLOB written by OllamaEmbedder.embed.
Returns None when the input is missing or zero-length so callers can
treat absent embeddings uniformly.