struct

Fm::GenerationOptions

Inherits Struct < Value < Object

Options that control how the model generates its response.

options = Fm::GenerationOptions.new(temperature: 0.7, max_response_tokens: 500_u32)
options = Fm::GenerationOptions.new(seed: 42_u64) # reproducible output
options = Fm::GenerationOptions.new(sampling_mode: Fm::SamplingMode.random(top: 40))

Constructors

default

Returns the default options.

Source
new(temperature : Float64 | Nil = nil, sampling : Sampling | Nil = nil, sampling_mode : SamplingMode | Nil = nil, max_response_tokens : UInt32 | Nil = nil, seed : UInt64 | Nil = nil)
Source

Instance methods

effective_sampling_mode

Returns the effective sampling mode, preferring sampling_mode over sampling.

Source
max_response_tokens

Maximum number of tokens in the response.

Source
sampling

Sampling strategy (simple enum, for backward compatibility).

Source
sampling_mode

Advanced sampling mode with top-k/top-p support.

Source
seed

Seed for reproducible generation. When set, the same prompt with the same seed produces deterministic output.

Source
temperature

Temperature for sampling (0.0-2.0). Higher = more random.

Source
to_json

Serializes options to JSON for FFI.

Source