pub trait BaseLLM: BaseLanguageModel {
// Required method
fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<LLMResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn generate_batch<'life0, 'async_trait>(
&'life0 self,
prompts: Vec<String>,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Vec<LLMResult>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn stream_generate<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Generation>> + Send>>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}
Expand description
Trait for language models that generate text from text input
Required Methods§
Sourcefn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<LLMResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<LLMResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate text from a prompt
Provided Methods§
Sourcefn generate_batch<'life0, 'async_trait>(
&'life0 self,
prompts: Vec<String>,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Vec<LLMResult>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn generate_batch<'life0, 'async_trait>(
&'life0 self,
prompts: Vec<String>,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Vec<LLMResult>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Generate text from multiple prompts
Sourcefn stream_generate<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Generation>> + Send>>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stream_generate<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: Option<GenerationConfig>,
runnable_config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Generation>> + Send>>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stream text generation