Struct GenerationConfig
pub struct GenerationConfig {
pub response_modalities: Option<Vec<Modality>>,
pub speech_config: Option<SpeechConfig>,
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub top_k: Option<u32>,
pub max_output_tokens: Option<u32>,
pub thinking_config: Option<ThinkingConfig>,
pub enable_affective_dialog: Option<bool>,
pub media_resolution: Option<MediaResolution>,
pub seed: Option<u32>,
pub response_mime_type: Option<String>,
pub response_json_schema: Option<Value>,
}Expand description
Generation config sent in the setup message.
Fields§
§response_modalities: Option<Vec<Modality>>Output modalities (Text, Audio, Image).
speech_config: Option<SpeechConfig>Speech/voice configuration for audio output.
temperature: Option<f32>Sampling temperature (0.0 = deterministic, 2.0 = max randomness).
top_p: Option<f32>Top-p (nucleus) sampling threshold.
top_k: Option<u32>Top-k sampling: number of top tokens to consider.
max_output_tokens: Option<u32>Maximum number of output tokens.
thinking_config: Option<ThinkingConfig>Thinking/reasoning configuration (Gemini 2.5+).
enable_affective_dialog: Option<bool>Enable emotionally expressive dialog.
media_resolution: Option<MediaResolution>Resolution for image/video inputs.
seed: Option<u32>Random seed for deterministic generation.
response_mime_type: Option<String>MIME type for structured output (e.g., "application/json", "text/x.enum").
response_json_schema: Option<Value>JSON Schema for structured output. Requires response_mime_type = "application/json".
Trait Implementations§
§impl Clone for GenerationConfig
impl Clone for GenerationConfig
§fn clone(&self) -> GenerationConfig
fn clone(&self) -> GenerationConfig
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 more§impl Debug for GenerationConfig
impl Debug for GenerationConfig
§impl Default for GenerationConfig
impl Default for GenerationConfig
§fn default() -> GenerationConfig
fn default() -> GenerationConfig
Returns the “default value” for a type. Read more
§impl<'de> Deserialize<'de> for GenerationConfig
impl<'de> Deserialize<'de> for GenerationConfig
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<GenerationConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<GenerationConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl PartialEq for GenerationConfig
impl PartialEq for GenerationConfig
§impl Serialize for GenerationConfig
impl Serialize for GenerationConfig
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for GenerationConfig
Auto Trait Implementations§
impl Freeze for GenerationConfig
impl RefUnwindSafe for GenerationConfig
impl Send for GenerationConfig
impl Sync for GenerationConfig
impl Unpin for GenerationConfig
impl UnwindSafe for GenerationConfig
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