mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-10 22:45:59 +05:45
Add SpeechMetadata (public preview) so requests to Gemini text-to-speech models can attach turn-level instructions to a TextPart: - speaker assigns the turn to a voice configured in MultiSpeakerVoiceConfig. Multi-speaker requests require it on every part. - style describes sustained delivery, such as emotion, pacing, or volume, so it isn't read aloud as part of the transcript. Momentary sounds and pauses stay inline as vocal tags, such as <laugh> or <short pause>. Set metadata with the new TextPart.init(_:speechMetadata:). The existing init(_:) is kept so references like [String].map(TextPart.init) still compile. TextPart.speechMetadata and the SpeechMetadata properties are internal while the API is in preview. InternalPart encodes and decodes speechMetadata on the wire. History doesn't merge streamed text parts that carry speech metadata, so speaker turns stay separate. Document the multi-speaker requirements on SpeechConfig, MultiSpeakerVoiceConfig, and SpeakerVoiceConfig. Replace the gemini-3.1-flash-tts-preview integration tests with a TextToSpeechTests suite covering gemini-3.8-flash-tts and gemini-3.8-flash-lite-tts in unary and streaming, single- and multi-speaker requests.