FirebaseAILogic Framework Reference

SpeechMetadata

public struct SpeechMetadata : Sendable, Equatable, Hashable
extension SpeechMetadata: Codable

[Public Preview] Turn-level speech synthesis metadata for text content in a model request.

Warning

This API is a public preview and may be subject to change.

When generating audio, Gemini text-to-speech (TTS) models treat the input text in a TextPart strictly as a verbatim transcript. SpeechMetadata attaches structured turn-level instructions to control speaker assignment and speech delivery.

For more details on speech generation, see the Text-to-speech guide.

  • Creates speech metadata with an optional speaker identifier and delivery style.

    Declaration

    Swift

    public init(speaker: String? = nil, style: String? = nil)

    Parameters

    speaker

    The unique name or identifier of the speaker for multi-speaker synthesis (for example, "Joe"). Must match a speaker name configured in SpeakerVoiceConfig.

    style

    A natural-language description of the sustained delivery style, emotion, prosody, pacing, or volume across the entire turn (for example, "cheerful and friendly" or "whispering urgently").