Where the wire layer stands, what it deliberately leaves out, and the order in which
further operation families would arrive. docs/design.md is the canonical spec; this
page is the plan, and it changes more often.
1. Delivered in 0.1
The implementation order the release followed, kept because it shows how the layers depend on each other:
- Canonical structs and types, including reasoning.
- Codec behaviour, encoded request, error, capabilities.
- OpenAI Chat codec with request/response/stream fixtures.
- Anthropic Messages codec.
- Gemini GenerateContent codec.
- Generic OpenAI-compatible configuration.
LlmCall.HTTPon Finch and the default pool.LlmCall.JSONas a behaviour, threaded through the codecs and resolved (withhttp_opts,timeout) from call option, provider, application environment and default. There is no configurable HTTP behaviour.LlmCall.Client,LlmCall.Provider, andcomplete/3,execute/2,fetch/2.LlmCall.SSE,LlmCall.Streamandstream/3.- The media IR (design §23):
Content.Video,Request.modalities,Capabilities.modalities,LlmCall.Media.Request,LlmCall.Media.Response,LlmCall.Operation,LlmCall.Media.Capabilities, theLlmCall.Media.Codecbehaviour, and the public media API. generate/3andpoll/3for the media IR.- The conformance suites published from
lib/, the ban on@moduledoc false, and the adapter-authoring contract. - Provider-hosted tools: the builtin envelope, the
builtin_toolscapability, and the codec branches. - The media adapters under
LlmCall.Media.Dialect.*: OpenAI Images, Gemini Imagenpredict, Seedance, MiniMax Hailuo. - The OpenAI Responses codec (
POST /v1/responses) on the HTTP/SSE transport. - The
LlmCall.WSbehaviour andLlmCall.WS.Mint, and the test servers that exercise them.
2. Delivered in 0.2
0.2 turned the streaming and validation edges into contract:
- A stream that ends without its protocol terminator is an error, not a synthesized stop.
- Header values must be printable ASCII with no leading or trailing whitespace, and
an offending
api_keynever reaches the error message. :pool_strategyvalidates against Finch's own contract instead of accepting values Finch does not dispatch on.Request.toolsaccepts atool_callmodule, andLlmCall.StreamAssemblerbounds streamed tool-call arguments withmax_argument_bytes.
3. Delivered in 0.3
Three kinds of change, none of them a new operation family: an authentication family (a provider can sign what it sends), a fifth reference adapter together with the binary framing it streams in, and observability for every call.
auth: {:sigv4, service: ..., region: ...}withcredentials:(a map or a 0-arity function) andregion:client options. The signer runs in the transport, after the body is serialized, because the signature covers the bytes that go on the wire. It reproduces AWS's publishedListUsersvector and replays eight request shapes signed by botocore — the canonicalisation the published vector cannot reach — and adds no runtime dependency.LlmCall.Dialect.Bedrock.Converse, the fifth reference adapter: text, tool use and tool results, with consecutive tool results merged into one user turn because Bedrock requires alternating roles.- The capability boundary is explicit, and now per source:
image_inputandfile_inputareLlmCall.Capabilities.Inputrecords naming the kinds a codec accepts (inline,url,uri,file), so a codec that takes bytes but not a URL can say so. Conformance derives its sample part from the declaration instead of a hard-coded URL image, which is what makes the declaration checkable. {:uri, uri}is a canonical source for a location only the provider can resolve, distinct from a URL the provider fetches. It is what makes Converse'ss3Locationreachable.- Converse carries images and documents inline (
source.bytes) and from S3 (s3Location), with the media type mapped to Converse'sformatenum and a document'sfilenamesent asname. Anhttps://source is refused locally, because the service would answer400. - Gemini's media source follows the same rule:
{:uri, _}reachesfileData.fileUrifor ags://object or a Files API URI, and a URL or bare string is refused. ItsfileUriwas never a fetchable URL, so the old acceptance only moved the failure to the provider. - A
{:sigv4, _}client is refused by the WebSocket connection instead of handshaking unsigned. Usagecarries Bedrock's prompt-cache token counters.provider_options.bedrocklands at the top level of the Converse request instead of insideadditionalModelRequestFields, and the canonical envelope keys are reserved. That is what makesguardrailConfig,performanceConfig,requestMetadataandpromptVariablesreachable;additionalModelRequestFieldsis written nested, as it appears on the wire.LlmCall.EventStreamdecodesapplication/vnd.amazon.eventstream, the framingConverseStreamanswers with: length prefixes, typed headers, CRC-32 over both the prelude and the message, and a truncation check at end of body. The test frames are generated by@smithy/eventstream-codecrather than by hand, so the decoder is checked against an implementation it shares no code with.ConverseStream: the same codec serves/converseand/converse-stream, mapsmessageStart,contentBlock*,messageStopandmetadataonto the IR stream events, and reports anexceptionframe as a provider error. Usage arrives aftermessageStop, so the terminator is flushed at end of body and a stream that never reachesmessageStopis an:invalid_response.
Not in it, and deliberately: signed WebSocket or bidirectional streaming, credential resolution (still a non-goal, design §4), and internationalised hosts (refused with a punycode hint).
4. Further operation families
0.1 ships two operation families — completion (LlmCall.Codec) and media generation
with its long-running operations (LlmCall.Media.Codec) — plus the Responses
WebSocket transport. Further families follow the same rule as design §25.3.1: a new
operation is a new IR plus a codec behaviour, and never a new field on Request.
Adding one is therefore additive and does not disturb the IR contract.
4.1 What a family costs
A codec is small; the fixed cost per family is what surrounds it, and it multiplies per provider:
- the canonical request/response/capabilities structs;
- a codec behaviour, an adapter macro and a conformance suite;
- one adapter, fixture set and wire-fact verification per provider;
- client entry points, documentation and CHANGELOG surface.
The suite cost scales with the family's wire surface, not with its importance. An embedding suite covers shapes, vector dimensions, usage and errors — no stream, no operation state machine, no asset hop — so it is a fraction of the media suite. The Bedrock codec is the recent data point: about 300 lines of codec, one fixture set and one conformance line, against a signer that took as long as the codec itself — which is why it is an auth family and not an operation family.
That cost model is the reason the order below exists: breadth is the wrong thing to buy first. The library's claim is a verifiable wire contract, not "every model in every modality"; a full-client library already occupies that ground.
4.2 Prerequisite: parameterise the family
Completion and media are currently two hand-written pipelines: two behaviours, two adapter macros, two conformance skeletons, two client surfaces. Writing a third and fourth family by hand multiplies that plumbing. Before family #3, one refactor turns "a family" into a parameterised mechanism — codec behaviour, adapter macro, conformance skeleton, client entry points — with media as its first instance. That is a reorganisation, not a feature, and it belongs in a 0.x minor.
4.3 Order and verdict
| Operation | Canonical shape | New family | Demand | Plan |
|---|---|---|---|---|
| Embeddings | {model, input, dimensions?} → vectors + usage | yes, small | highest: a conversation library is almost always paired with a vector store | next minor, with rerank |
| Rerank | {model, query, documents, top_n?} → ordered scores | shares the vector family | medium, narrow vendor set | next minor |
| Speech | text in, media bytes out | media-shaped | medium-low | 0.3 |
| Transcription | bytes in, text and segments out; needs the multipart boundary the transport deliberately does not own (design §23.7) | yes | medium | 0.3, once that boundary has a design |
| OCR | image or file in, text out | no: Content.Image and Content.File in a chat request already express it for every multimodal codec | low | documentation; a dedicated endpoint only on demand |
| Evaluation | "answer named questions about this text/JSON" | no: it is an upper-layer abstraction built on chat or structured output, not a provider endpoint | low | never in core |
Rerank is the first family the signing work pays for twice: Bedrock's rerank endpoint
takes the same {:sigv4, ...} declaration and the same client, so the family's cost
there is the codec alone. That is the concrete argument for the auth seam having been
the right one to build before a third operation family.
4.4 Criteria for adding a family
A family enters the core only when all three hold:
- its canonical shape is expressible without
provider_options; - at least two providers need it — a single-vendor endpoint belongs in the application, not in a protocol library;
- someone carries the per-provider adapter and verification cost, and the conformance suite for the family is written in the same change.