pub trait Provider:
Send
+ Sync
+ Debug {
// Required methods
fn kind(&self) -> &'static str;
fn options(&self) -> ProviderOptions;
fn set_options(&mut self, options: ProviderOptions);
fn serialize_config(&self) -> Value;
fn complete<'life0, 'async_trait>(
&'life0 mut self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, LlmTransportError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn clone_boxed(&self) -> Box<dyn Provider>;
// Provided method
fn requires_streaming(&self) -> bool { ... }
}Expand description
A configured LLM backend: its identity, host-config serialization, its generation options, and the request transport.
Required Methods§
fn kind(&self) -> &'static str
fn options(&self) -> ProviderOptions
fn set_options(&mut self, options: ProviderOptions)
Sourcefn serialize_config(&self) -> Value
fn serialize_config(&self) -> Value
Emit the provider-specific JSON body used by ProviderSpec. The
object must NOT contain a type field — [ProviderSpec::Serialize]
layers that on top.
fn complete<'life0, 'async_trait>(
&'life0 mut self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, LlmTransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clone_boxed(&self) -> Box<dyn Provider>
Provided Methods§
fn requires_streaming(&self) -> bool
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".