Skip to main content

build_gemini_request

Function build_gemini_request 

Source
pub fn build_gemini_request(
    text: &str,
    voice: &str,
    rate: f32,
    pitch: f32,
    volume: f32,
    model: Option<&str>,
    style_override: Option<&str>,
) -> Value
Expand description

Build the Interactions API request body for Gemini TTS.

The transcript is sent verbatim — the model performs the text as written (the SpeechMarkdown gemini dialect has already rendered angle-bracket vocal bursts, pause tags and CAPS emphasis into it). Turn-level delivery rides in speech_metadata.style: an explicit credential style wins outright; otherwise the rate/pitch/volume multipliers map onto the documented style vocabulary. The voice may be a prebuilt name (“Kore”), an Extended Voice Library ID, a voice design ID (voice_...) or a stateless replication key (voicekey_...) — all pass through in speech_config.