pub struct GeminiTts { /* private fields */ }Available on crate feature
audio only.Expand description
Gemini TTS provider using generateContent with audio response modality.
§Example
ⓘ
use adk_audio::GeminiTts;
// Default: gemini-3.1-flash-tts-preview
let tts = GeminiTts::from_env()?;
// Specific model
let tts = GeminiTts::from_env()?.with_model("gemini-2.5-pro-preview-tts");
// Multi-speaker
let tts = GeminiTts::from_env()?.with_speakers(vec![
SpeakerConfig::new("Alice", "Kore"),
SpeakerConfig::new("Bob", "Puck"),
]);Implementations§
Source§impl GeminiTts
impl GeminiTts
Sourcepub fn from_env() -> Result<GeminiTts, AudioError>
Available on crate features tts or qwen3-tts only.
pub fn from_env() -> Result<GeminiTts, AudioError>
tts or qwen3-tts only.Create from environment variable GEMINI_API_KEY.
Sourcepub fn new(config: CloudTtsConfig) -> GeminiTts
Available on crate features tts or qwen3-tts only.
pub fn new(config: CloudTtsConfig) -> GeminiTts
tts or qwen3-tts only.Create with explicit config.
Sourcepub fn with_model(self, model: impl Into<String>) -> GeminiTts
Available on crate features tts or qwen3-tts only.
pub fn with_model(self, model: impl Into<String>) -> GeminiTts
tts or qwen3-tts only.Set the TTS model.
Sourcepub fn with_speakers(self, speakers: Vec<SpeakerConfig>) -> GeminiTts
Available on crate features tts or qwen3-tts only.
pub fn with_speakers(self, speakers: Vec<SpeakerConfig>) -> GeminiTts
tts or qwen3-tts only.Configure multi-speaker synthesis.
Speaker names must match the names used in the transcript text. Up to 2 speakers are supported.
Trait Implementations§
Source§impl TtsProvider for GeminiTts
impl TtsProvider for GeminiTts
Source§fn synthesize<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 TtsRequest,
) -> Pin<Box<dyn Future<Output = Result<AudioFrame, AudioError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GeminiTts: 'async_trait,
fn synthesize<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 TtsRequest,
) -> Pin<Box<dyn Future<Output = Result<AudioFrame, AudioError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GeminiTts: 'async_trait,
Synthesize text to a single audio frame (batch mode).
Source§fn synthesize_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 TtsRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<AudioFrame, AudioError>> + Send>>, AudioError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GeminiTts: 'async_trait,
fn synthesize_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 TtsRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<AudioFrame, AudioError>> + Send>>, AudioError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GeminiTts: 'async_trait,
Synthesize text as a stream of audio frames (streaming mode).
Source§fn voice_catalog(&self) -> &[Voice]
fn voice_catalog(&self) -> &[Voice]
List available voices for this provider.
Auto Trait Implementations§
impl Freeze for GeminiTts
impl !RefUnwindSafe for GeminiTts
impl Send for GeminiTts
impl Sync for GeminiTts
impl Unpin for GeminiTts
impl UnsafeUnpin for GeminiTts
impl !UnwindSafe for GeminiTts
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