FirebaseAILogic Framework Reference

SpeechConfig

public struct SpeechConfig : Sendable

[Public Preview] Configuration for model speech and audio generation behaviors.

Warning

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

Configures voice properties (single-speaker or multi-speaker setup) and language preferences when requesting the model to generate spoken responses.

For turn-level speech delivery control (such as emotion, pacing, and whispering), attach SpeechMetadata to individual TextPart instances in your request prompt.

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

  • Creates a new SpeechConfig value for a single voice.

    Declaration

    Swift

    public init(voiceName: String, languageCode: String? = nil)

    Parameters

    voiceName

    The name of the prebuilt voice to be used for the model's speech response.

    languageCode

    BCP-47 language code to use when parsing text sent from the client, instead of audio. By default, the model will attempt to detect the input language automatically.

  • Creates a new SpeechConfig value for a multi-speaker setup.

    Warning

    Multi-speaker configurations are not currently supported by the Live API, such as LiveGenerationConfig.

    Declaration

    Swift

    public init(multiSpeakerVoiceConfig: MultiSpeakerVoiceConfig, languageCode: String? = nil)

    Parameters

    multiSpeakerVoiceConfig

    The configuration detailing multiple speakers and their corresponding voices.

    languageCode

    BCP-47 language code to use when parsing text sent from the client.