pub struct GenerationOptions {
pub temperature: Option<f64>,
pub sampling: Option<Sampling>,
pub max_response_tokens: Option<u32>,
pub seed: Option<u64>,
pub tool_calling_mode: Option<ToolCallingMode>,
}Expand description
Options that control how the model generates its response.
Use the builder pattern to configure options:
use fm_rs::GenerationOptions;
let options = GenerationOptions::builder()
.temperature(0.7)
.max_response_tokens(500)
.build();Fields§
§temperature: Option<f64>Temperature for sampling (0.0-2.0). Higher values produce more random outputs.
sampling: Option<Sampling>Sampling strategy.
max_response_tokens: Option<u32>Maximum number of tokens in the response.
seed: Option<u64>Random seed for reproducible generation.
Note: This field is currently not supported by Apple’s GenerationOptions API
and is ignored. It is included for potential future use.
tool_calling_mode: Option<ToolCallingMode>Tool-calling mode (Foundation Models 27).
Ignored on pre-27 build SDKs and runtimes, where the framework
behaves as ToolCallingMode::Allowed.
Implementations§
Trait Implementations§
Source§impl Clone for GenerationOptions
impl Clone for GenerationOptions
Source§impl Debug for GenerationOptions
impl Debug for GenerationOptions
Source§impl Default for GenerationOptions
impl Default for GenerationOptions
Source§impl<'de> Deserialize<'de> for GenerationOptions
impl<'de> Deserialize<'de> for GenerationOptions
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 GenerationOptions
impl RefUnwindSafe for GenerationOptions
impl Send for GenerationOptions
impl Sync for GenerationOptions
impl Unpin for GenerationOptions
impl UnsafeUnpin for GenerationOptions
impl UnwindSafe for GenerationOptions
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