Embedding generation abstraction over multiple providers.
Provides a unified embed/2 that dispatches to the correct provider
(ollama, local llama.cpp, OpenAI-compatible API). Used as a lower-level
embedding backend independent from Candil.Llm — this module accepts
raw provider parameters (URL, model, api_key) rather than Candil structs.
Summary
Types
Embedding vector
Functions
Generates an embedding vector for a single text string.
Generates embeddings for multiple texts in a single batch request.
Types
@type embedding() :: [float()]
Embedding vector
Functions
Generates an embedding vector for a single text string.
Provider-specific behaviour
"ollama"— POST /api/embed withmodelandinput"local"— POST /v1/embeddings withmodelandinput"openai"— POST /v1/embeddings withmodel,input, auth header
Options
:provider— provider type (default: "local"):url— base URL:model— model name:api_key— API key for authenticated providers:timeout— request timeout in ms (default: 30_000)
Generates embeddings for multiple texts in a single batch request.
Falls back to individual requests if batching is not supported by the provider.