pub trait Provider:
Send
+ Sync
+ 'static {
// Required methods
fn stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model: &'life1 Model,
context: &'life2 Context,
options: Option<StreamOptions>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = ProviderEvent> + Send>>, ProviderError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn name(&self) -> &str;
}Expand description
LLM provider trait
Implement this trait to add support for new LLM providers.
Required Methods§
Sourcefn stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model: &'life1 Model,
context: &'life2 Context,
options: Option<StreamOptions>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = ProviderEvent> + Send>>, ProviderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model: &'life1 Model,
context: &'life2 Context,
options: Option<StreamOptions>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = ProviderEvent> + Send>>, ProviderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Stream assistant message events
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".