pub struct ModelOptions {
pub seed: Option<i64>,
pub temperature: Option<f32>,
pub top_k: Option<i32>,
pub top_p: Option<f32>,
pub min_p: Option<f32>,
pub num_ctx: Option<i32>,
pub num_predict: Option<i32>,
pub stop: Option<StopSetting>,
}Expand description
Runtime options that control model behavior
These options can be used to customize embedding generation. All fields are optional and will use model defaults if not specified.
§Example
use ollama_oxide::ModelOptions;
let options = ModelOptions::default()
.with_temperature(0.7)
.with_num_ctx(4096);Fields§
§seed: Option<i64>Random seed for reproducible outputs
temperature: Option<f32>Controls randomness in generation (higher = more random)
top_k: Option<i32>Limits next token selection to the K most likely
top_p: Option<f32>Cumulative probability threshold for nucleus sampling
min_p: Option<f32>Minimum probability threshold for token selection
num_ctx: Option<i32>Context length size (number of tokens)
num_predict: Option<i32>Maximum number of tokens to generate
stop: Option<StopSetting>Stop sequences that will halt generation
Implementations§
Source§impl ModelOptions
impl ModelOptions
Sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Set the temperature
Sourcepub fn with_top_k(self, top_k: i32) -> Self
pub fn with_top_k(self, top_k: i32) -> Self
Set the top_k value
Sourcepub fn with_top_p(self, top_p: f32) -> Self
pub fn with_top_p(self, top_p: f32) -> Self
Set the top_p value
Sourcepub fn with_min_p(self, min_p: f32) -> Self
pub fn with_min_p(self, min_p: f32) -> Self
Set the min_p value
Sourcepub fn with_num_ctx(self, num_ctx: i32) -> Self
pub fn with_num_ctx(self, num_ctx: i32) -> Self
Set the context length
Sourcepub fn with_num_predict(self, num_predict: i32) -> Self
pub fn with_num_predict(self, num_predict: i32) -> Self
Set the max tokens to generate
Sourcepub fn with_stop(self, stop: impl Into<StopSetting>) -> Self
pub fn with_stop(self, stop: impl Into<StopSetting>) -> Self
Set stop sequences
Trait Implementations§
Source§impl Clone for ModelOptions
impl Clone for ModelOptions
Source§fn clone(&self) -> ModelOptions
fn clone(&self) -> ModelOptions
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 ModelOptions
impl Debug for ModelOptions
Source§impl Default for ModelOptions
impl Default for ModelOptions
Source§fn default() -> ModelOptions
fn default() -> ModelOptions
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ModelOptions
impl<'de> Deserialize<'de> for ModelOptions
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
Source§impl PartialEq for ModelOptions
impl PartialEq for ModelOptions
Source§impl Serialize for ModelOptions
impl Serialize for ModelOptions
impl StructuralPartialEq for ModelOptions
Auto Trait Implementations§
impl Freeze for ModelOptions
impl RefUnwindSafe for ModelOptions
impl Send for ModelOptions
impl Sync for ModelOptions
impl Unpin for ModelOptions
impl UnsafeUnpin for ModelOptions
impl UnwindSafe for ModelOptions
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