pub trait Provider:
Send
+ Sync
+ Debug {
// Required methods
fn complete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 ModelRequest,
auth: &'life2 Auth,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn id(&self) -> &str;
// Provided method
fn carries_structured_verbatim(&self, _inbound: Dialect) -> bool { ... }
}Expand description
A normalized model backend. Implementations translate ModelRequest/ModelResponse
to/from one wire API.
Required Methods§
Sourcefn complete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 ModelRequest,
auth: &'life2 Auth,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn complete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 ModelRequest,
auth: &'life2 Auth,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Call the model and normalize the result.
§Errors
Returns ProviderError on transport failure, a non-2xx response, or a response
that doesn’t decode into the expected shape.
Provided Methods§
Sourcefn carries_structured_verbatim(&self, _inbound: Dialect) -> bool
fn carries_structured_verbatim(&self, _inbound: Dialect) -> bool
Whether this provider carries structured content (tool_use / tool_result / image blocks
and top-level tools) verbatim on the wire for the given inbound dialect.
- Anthropic-dialect providers (Anthropic / Bedrock / Vertex) return
trueiffinbound == Dialect::Anthropic: the raw inbound body is forwarded with only the model swapped, so every caller field —tools,tool_choice,thinking, … — survives intact (ADR 0005 P4). OpenAiProviderreturnstrueiffinbound == Dialect::Openai: same verbatim-carry rule for all-OpenAI-dialect ladders.- All other providers (Gemini, unknown) return
false— no verbatim-carry built yet.
The enforce path’s fidelity guard uses this to decide: verbatim-carry path (all rungs
return true for the inbound dialect), translation path (OpenAI → Anthropic when
content is translatable), or transparent observe passthrough (safe fallback).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".