Expand description
locode-provider — the Provider trait over an API-agnostic ConversationRequest
(ADR-0007), the normalized Completion response, the ProviderError taxonomy,
a scripted MockProvider, and the streaming ToolCallAssembler.
One Provider impl = one wire schema (Anthropic Messages, OpenAI Chat/Responses,
or mock); gateways (OpenRouter/Bedrock/proxy) are configuration pointed at a
schema, not separate impls. v0 ships mock here; the live Anthropic wire is Task 12.
Re-exports§
pub use anthropic::AnthropicProvider;pub use anthropic::AuthRefresh;pub use http::HttpFailure;pub use http::RetryPolicy;pub use openai::responses::OpenAiResponsesProvider;pub use openai::OpenAiBackend;pub use openai::OpenAiModelConfig;pub use openai::SystemPlacement;
Modules§
- anthropic
- The Anthropic Messages wire — the one live
Provider(Task 12, ADR-0007). - http
- The shared HTTP transport layer (hoisted from
anthropic/at Task 18): retry policy + backoff, theHttpFailurecarrier,Retry-Afterparsing, client construction, and schema normalization. Per-wire error classification stays wire-local (body shapes and terminal heuristics genuinely differ). - openai
- The OpenAI wire family (Task 18): shared config record, backend detection, and error classification for the Responses wire (and the deferred Chat Completions wire, Task 17).
Structs§
- Completion
- One normalized completion: the parsed result of a single model call (ADR-0007).
- Conversation
Request - One provider-neutral sampling request (ADR-0007).
- Mock
Provider - A provider that replays a fixed script of results, one per
complete()call. - Repair
Stats - What a
repair_pairingpass changed. - Sampling
Args - Provider-neutral sampling knobs — the common core only.
- Tool
Call Assembler - Accumulates streamed tool-call fragments by content-block index.
Enums§
- Assemble
Error - A failure assembling streamed tool-call arguments.
- Cache
Hint - Where the wire should place prompt-cache breakpoints (ADR-0007).
- Completion
Delta - One incremental piece of a streaming completion (ADR-0021), normalized across
wires — the display-oriented side channel of
crate::Provider::stream. - Effort
- One rung of the locode effort ladder.
- Provider
Error - Why a model call failed (ADR-0007).
- Reasoning
Effort - A neutral reasoning-effort level, mapped per-wire (ADR-0007).
- Stop
Reason - Why the model stopped generating (Anthropic-shaped, provider-neutral).
Constants§
- DEFAULT_
MAX_ TOKENS - The default output-token budget for one sample.
Traits§
- Provider
- A model-sampling wire: builds a request, calls the model, normalizes the response.
Functions§
- repair_
pairing - Make
messagesvalid to send: dedup duplicatetool_results, then synthesizeis_errorresults for any danglingtool_use. Idempotent — a valid transcript passes through unchanged.