pub trait LLMProvider: Send + Sync {
// Required method
fn stream<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
context: &'life1 RenderedContext,
tools: &'life2 [ToolSchema],
extensions: Option<&'life3 Value>,
state: Option<&'life4 ProviderRunState>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<StreamEvent>> + Send + Unpin>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
// Provided methods
fn create_run_state(&self) -> Option<ProviderRunState> { ... }
fn runtime_policy(&self) -> RuntimePolicy { ... }
fn peek_provider_replay(
&self,
_content: &str,
_tool_calls: &[ToolCall],
) -> Option<ProviderReplay> { ... }
fn seed_provider_replay(
&self,
_content: &str,
_tool_calls: &[ToolCall],
_replay: &ProviderReplay,
) { ... }
fn commit_stream_replay(&self, _content: &str, _tool_calls: &[ToolCall]) { ... }
fn complete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context: &'life1 RenderedContext,
tools: &'life2 [ToolSchema],
extensions: Option<&'life3 Value>,
) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
}Required Methods§
fn stream<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
context: &'life1 RenderedContext,
tools: &'life2 [ToolSchema],
extensions: Option<&'life3 Value>,
state: Option<&'life4 ProviderRunState>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<StreamEvent>> + Send + Unpin>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Provided Methods§
Sourcefn create_run_state(&self) -> Option<ProviderRunState>
fn create_run_state(&self) -> Option<ProviderRunState>
Optional per-run state for protocol-native continuation (e.g. Responses API).
Sourcefn runtime_policy(&self) -> RuntimePolicy
fn runtime_policy(&self) -> RuntimePolicy
Per-model runtime policy. Overridden by RuntimeOptions fields when set.
fn peek_provider_replay( &self, _content: &str, _tool_calls: &[ToolCall], ) -> Option<ProviderReplay>
fn seed_provider_replay( &self, _content: &str, _tool_calls: &[ToolCall], _replay: &ProviderReplay, )
fn commit_stream_replay(&self, _content: &str, _tool_calls: &[ToolCall])
Sourcefn complete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context: &'life1 RenderedContext,
tools: &'life2 [ToolSchema],
extensions: Option<&'life3 Value>,
) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn complete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context: &'life1 RenderedContext,
tools: &'life2 [ToolSchema],
extensions: Option<&'life3 Value>,
) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Non-streaming completion — default collects from stream.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".