pub struct InferenceConfig {
pub temperature: f32,
pub max_tokens: Option<usize>,
pub num_candidates: usize,
pub stop_sequences: Vec<String>,
pub extra_params: HashMap<String, Value>,
}
Expand description
Inference configuration parameters
Fields§
§temperature: f32
Sampling temperature (0.0 to 1.0)
max_tokens: Option<usize>
Maximum number of tokens to generate
num_candidates: usize
Number of candidate outputs to generate
stop_sequences: Vec<String>
Stop sequences to halt generation
extra_params: HashMap<String, Value>
Additional provider-specific parameters
Implementations§
Source§impl InferenceConfig
impl InferenceConfig
Sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Set the temperature
Sourcepub fn with_max_tokens(self, max_tokens: usize) -> Self
pub fn with_max_tokens(self, max_tokens: usize) -> Self
Set the maximum number of tokens
Sourcepub fn with_num_candidates(self, num_candidates: usize) -> Self
pub fn with_num_candidates(self, num_candidates: usize) -> Self
Set the number of candidate outputs
Sourcepub fn with_stop_sequence(self, stop_sequence: String) -> Self
pub fn with_stop_sequence(self, stop_sequence: String) -> Self
Add a stop sequence
Sourcepub fn with_extra_param(self, key: String, value: Value) -> Self
pub fn with_extra_param(self, key: String, value: Value) -> Self
Add an extra parameter
Sourcepub fn to_hashmap(&self) -> HashMap<String, Value>
pub fn to_hashmap(&self) -> HashMap<String, Value>
Convert to a HashMap for passing to inference methods
Trait Implementations§
Source§impl Clone for InferenceConfig
impl Clone for InferenceConfig
Source§fn clone(&self) -> InferenceConfig
fn clone(&self) -> InferenceConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for InferenceConfig
impl Debug for InferenceConfig
Source§impl Default for InferenceConfig
impl Default for InferenceConfig
Source§impl<'de> Deserialize<'de> for InferenceConfig
impl<'de> Deserialize<'de> for InferenceConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for InferenceConfig
impl RefUnwindSafe for InferenceConfig
impl Send for InferenceConfig
impl Sync for InferenceConfig
impl Unpin for InferenceConfig
impl UnwindSafe for InferenceConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more