class

Engram::Embedder

Inherits Reference < Object

Computes text embeddings via an OpenAI-compatible /v1/embeddings HTTP endpoint (Ollama, OpenAI, etc). Embeddings are entirely optional: sync only ever gets one when the caller loaded an EmbedderConfig, and any transport failure is warned once and swallowed so a dead endpoint never blocks sync.

Constructors

new(config : EmbedderConfig, &transport : Transport)

Builds an embedder for config using transport to actually fetch vectors.

Source
new(config : EmbedderConfig) : Embedder

Builds an embedder that calls the real OpenAI-compatible HTTP endpoint in config.

Source

Class methods

http_transport(config : EmbedderConfig, text : String) : Array(Float32)

POSTs {model, input} to config.url and returns the first embedding vector from an OpenAI-shaped response. Public so callers outside sync (e.g. the CLI's one-shot query embedding for search) can reuse the same transport.

Source

Instance methods

dimension
Source
embed(text : String) : Bytes | Nil

Embeds text into a packed Float32 BLOB, or nil if embedding is unavailable this sync (either the transport already failed once, or it fails now). Never raises: a dead endpoint must never block sync.

Source
warned?
Source

Nested types