pub trait ModelProvider: Send + Sync {
// Required methods
fn generate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: &'life2 GenerationConfig,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: &'life2 GenerationConfig,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<String>> + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn metadata(&self) -> ProviderMetadata;
fn kind(&self) -> ProviderKind;
}Expand description
Core trait that all model providers must implement
Required Methods§
Sourcefn generate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: &'life2 GenerationConfig,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn generate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: &'life2 GenerationConfig,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Generate a response to the given prompt
Sourcefn stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: &'life2 GenerationConfig,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<String>> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: &'life2 GenerationConfig,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<String>> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stream a response to the given prompt
Sourcefn metadata(&self) -> ProviderMetadata
fn metadata(&self) -> ProviderMetadata
Get provider metadata
Sourcefn kind(&self) -> ProviderKind
fn kind(&self) -> ProviderKind
Get the provider kind