pub trait BaseLanguageModel<Input: Send + Sync + 'static, Output: Send + Sync + 'static>: Runnable<Input, Output> {
// Required methods
fn model_name(&self) -> &str;
fn get_num_tokens(&self, text: &str) -> usize;
fn with_temperature(self, temp: f32) -> Self
where Self: Sized;
fn with_max_tokens(self, max: usize) -> Self
where Self: Sized;
// Provided methods
fn temperature(&self) -> Option<f32> { ... }
fn max_tokens(&self) -> Option<usize> { ... }
}Expand description
Base trait for all language models.
All LLM wrappers inherit from this base class. It extends the Runnable interface for unified invocation.
Required Methods§
Sourcefn model_name(&self) -> &str
fn model_name(&self) -> &str
Returns the model name.
Sourcefn get_num_tokens(&self, text: &str) -> usize
fn get_num_tokens(&self, text: &str) -> usize
Sourcefn with_temperature(self, temp: f32) -> Selfwhere
Self: Sized,
fn with_temperature(self, temp: f32) -> Selfwhere
Self: Sized,
Sets the temperature parameter.
Sourcefn with_max_tokens(self, max: usize) -> Selfwhere
Self: Sized,
fn with_max_tokens(self, max: usize) -> Selfwhere
Self: Sized,
Sets the max tokens limit.
Provided Methods§
Sourcefn temperature(&self) -> Option<f32>
fn temperature(&self) -> Option<f32>
Returns the temperature parameter.
Sourcefn max_tokens(&self) -> Option<usize>
fn max_tokens(&self) -> Option<usize>
Returns the max tokens limit.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".