pub struct GenerationConfig {Show 13 fields
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub top_k: Option<i32>,
pub max_output_tokens: Option<i32>,
pub candidate_count: Option<i32>,
pub stop_sequences: Option<Vec<String>>,
pub response_mime_type: Option<String>,
pub response_schema: Option<Value>,
pub response_modalities: Option<Vec<String>>,
pub image_config: Option<ImageConfig>,
pub speech_config: Option<SpeechConfig>,
pub thinking_config: Option<ThinkingConfig>,
pub media_resolution: Option<MediaResolutionLevel>,
}Expand description
Configuration for generation
Fields§
§temperature: Option<f32>The temperature for the model (0.0 to 1.0)
Controls the randomness of the output. Higher values (e.g., 0.9) make output more random, lower values (e.g., 0.1) make output more deterministic.
top_p: Option<f32>The top-p value for the model (0.0 to 1.0)
For each token generation step, the model considers the top_p percentage of probability mass for potential token choices. Lower values are more selective, higher values allow more variety.
top_k: Option<i32>The top-k value for the model
For each token generation step, the model considers the top_k most likely tokens. Lower values are more selective, higher values allow more variety.
max_output_tokens: Option<i32>The maximum number of tokens to generate
Limits the length of the generated content. One token is roughly 4 characters.
candidate_count: Option<i32>The candidate count
Number of alternative responses to generate.
stop_sequences: Option<Vec<String>>Whether to stop on specific sequences
The model will stop generating content when it encounters any of these sequences.
response_mime_type: Option<String>The response mime type
Specifies the format of the model’s response.
response_schema: Option<Value>The response schema
Specifies the JSON schema for structured responses.
response_modalities: Option<Vec<String>>Response modalities (for TTS and other multimodal outputs)
image_config: Option<ImageConfig>Optional. Config for image generation. An error will be returned if this field is set for models that don’t support these config options.
speech_config: Option<SpeechConfig>Speech configuration for text-to-speech generation
thinking_config: Option<ThinkingConfig>The thinking configuration
Configuration for the model’s thinking process (Gemini 2.5 and Gemini 3 series).
media_resolution: Option<MediaResolutionLevel>Global media resolution for all images and PDFs. Controls the resolution used for inline image and PDF data, affecting token usage. Can be overridden per-part using the Part::InlineData media_resolution field.
Trait Implementations§
Source§impl Clone for GenerationConfig
impl Clone for GenerationConfig
Source§fn clone(&self) -> GenerationConfig
fn clone(&self) -> GenerationConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more