Modules
Top-level facade for the ALLM library — provider-neutral LLM execution with first-class streaming and serializable conversation state.
Non-streaming provider adapter contract. See spec §7.1.
Layer B — optional model-catalog integration via the LLMDB Hex package.
Internal — use ALLM.step/3 / ALLM.stream_step/3 / ALLM.chat/3 /
ALLM.stream/3 instead. See spec §17.
The result of a full chat loop. See spec §5.9.
Layer B runtime engine — see spec §6.
Errors returned by ALLM.Adapter / ALLM.StreamAdapter implementations.
Errors raised by engine-level operations before any adapter call.
Errors returned by ALLM.ImageAdapter implementations.
Session-state error. Returned (or raised) by Phase 8's ALLM.Session
operations.
Errors that surface mid-stream.
Errors from tool handler execution.
Errors returned by ALLM.Validate functions.
Closed tagged-tuple union emitted by stream runners. See spec §8.
A serializable image value used by image generation, editing, and vision inputs. See spec §35.2.1.
Image-generation provider adapter contract. See spec §35.3.
An image content part used in multimodal ALLM.Message{:content} lists.
See spec §35.6.
A request for image generation, editing, or variation. See spec §35.2.2.
An image generation/edit/variation response. See spec §35.2.3.
Image-side usage and cost summary. See spec §35.2.4.
API key resolution per spec §6.4. Keys never appear on the engine.
A chat message. See spec §5.1 and §35.6.
Layer A — model reference returned by the optional LLMDB catalog.
Anthropic provider adapter — Layer B. See spec §6.4, §7.1, §20, §32.1.
Deterministic, scripted adapter for testing. Implements both ALLM.Adapter
and ALLM.StreamAdapter. See spec §31, §7.1, §7.2, §8.
Script shape detection, validation, and interpretation for
ALLM.Providers.Fake. See spec §31.
Deterministic, scripted adapter for image-generation testing. Implements
ALLM.ImageAdapter. See spec §35.8.
Google Gemini provider adapter — Layer B. See spec §6.4, §7.1, §20, §32.1 (bundled adapters).
Google Gemini native image-out adapter — implements ALLM.ImageAdapter
against generateContent with responseModalities: ["TEXT", "IMAGE"]
on the Gemini-native image preview models (gemini-3.1-flash-image-preview
/ "Nano Banana 2", gemini-3-pro-image-preview / "Nano Banana Pro").
See spec §35.3, §35.7 and steering/GEMINI_DESIGN.md Phase 16.5.
OpenAI provider adapter — Layer B. See spec §6.4, §7.1, §20, §32.1.
OpenAI Images provider adapter — implements ALLM.ImageAdapter against
OpenAI's /v1/images/generations, /v1/images/edits, and
/v1/images/variations endpoints. See spec §35.7.
Shared HTTP-header builder for Gemini provider adapters. See spec §32.1 (bundled adapters) and the Phase 16 design's Decision #2.
Per-provider MIME and size validation for ALLM.ImagePart content.
Shared HTTP-header builder for OpenAI provider adapters. See spec §35.7 Decision #11.
Stateless line-buffered Server-Sent Events (SSE) decoder.
A single LLM request. See spec §5.4.
A single LLM response. See spec §5.5.
Internal — Layer B retry helper consumed by adapters.
Internal — use ALLM.generate/3 instead. See spec §17.
Tagged JSON encoding and decoding for Layer A structs.
A stateful, serializable chat session. See spec §5.7 and §11.
Folds an ALLM.Chat.stream/3 (or ALLM.Chat.stream_step/3) event
stream into both an updated %ALLM.Session{} and a terminal
%ALLM.ChatResult{} (or %ALLM.StepResult{}) in one pass. See spec
§13.2 and steering/PHASE_8_DESIGN.md Decision #15.
The result of a single chat step. See spec §5.8.
Streaming provider adapter contract. See spec §7.2.
Reduce a stream of ALLM.Event values into a collected %ALLM.Response{},
%ALLM.StepResult{}, or %ALLM.ChatResult{}. See spec §13.1.
Internal — use ALLM.stream_generate/3 instead. See spec §17.
Internal — Layer B helper that wraps :telemetry.span/3 with
ALLM-specific metadata defaults.
A text content part used in multimodal ALLM.Message{:content} lists. See
spec §35.6.
An ordered message log. See spec §5.6 and §14.
A tool the model may call. See spec §5.2 and §15.
A provider-emitted tool call. See spec §5.3.
Tool-handler invocation contract. See spec §7.3 and §5.2.
Default ALLM.ToolExecutor — invokes the tool's :handler function
directly, dispatching on arity (1 or 2). Converts raises / exits /
throws / invalid returns / nil handlers to %ALLM.Error.ToolError{};
passes handler-returned values ({:ok, _}, {:error, _},
{:ask_user, _}, {:ask_user, _, _}, {:halt, _, _}) through
unchanged.
Serialize a tool's return value into a string the model can consume. See spec §7.4 and §18.
Default ALLM.ToolResultEncoder — JSON-encodes the tool return value
via Jason.encode!/1, with targeted passthrough / unwrap shortcuts so
handlers that pre-format a string for the model aren't double-encoded.
Internal — use ALLM.step/3 / ALLM.stream_step/3 instead. See spec §17.
Token and cost usage for a single response. See spec §5.9a.
Pure validators for Layer A input shapes. See spec §16 and Phase 1 design sub-phase 1.4.