pub trait BaseChatModel: BaseLanguageModel {
// Required method
fn generate_chat<'life0, 'async_trait>(
&'life0 self,
messages: Vec<AnyMessage>,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<AnyMessage>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn generate_chat_batch<'life0, 'async_trait>(
&'life0 self,
conversations: Vec<Vec<AnyMessage>>,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Vec<AnyMessage>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn stream_chat<'life0, 'async_trait>(
&'life0 self,
messages: Vec<AnyMessage>,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<AnyMessage>> + Send>>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
Trait for language models that work with chat messages
Required Methods§
Sourcefn generate_chat<'life0, 'async_trait>(
&'life0 self,
messages: Vec<AnyMessage>,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<AnyMessage>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generate_chat<'life0, 'async_trait>(
&'life0 self,
messages: Vec<AnyMessage>,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<AnyMessage>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate a response from chat messages
Provided Methods§
Sourcefn generate_chat_batch<'life0, 'async_trait>(
&'life0 self,
conversations: Vec<Vec<AnyMessage>>,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Vec<AnyMessage>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn generate_chat_batch<'life0, 'async_trait>(
&'life0 self,
conversations: Vec<Vec<AnyMessage>>,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Vec<AnyMessage>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Generate responses from multiple chat conversations
Sourcefn stream_chat<'life0, 'async_trait>(
&'life0 self,
messages: Vec<AnyMessage>,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<AnyMessage>> + Send>>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn stream_chat<'life0, 'async_trait>(
&'life0 self,
messages: Vec<AnyMessage>,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<AnyMessage>> + Send>>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Stream chat generation