Google

Updated

Integrate Google TTS with the Conversational AI Engine.

Google provides fast, reliable text-to-speech (TTS) with customizable voices.

Info

This integration is fully supported for use with Conversational AI Engine. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads.

Sample configuration

The following examples show how to configure Google TTS when starting a conversational AI agent.

from agora_agent import Agent
from agora_agent.agentkit.vendors import GoogleTTS

# client is your configured Agora client
agent = (
    Agent(client)
    .with_stt(...)  # configure your STT vendor
    .with_llm(...)  # configure your LLM vendor
    .with_tts(GoogleTTS(
        key='<google_application_credentials_string>',
        voice_name='en-US-Chirp3-HD-Charon',
    ))
)
import { Agent, GoogleTTS } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your STT vendor */)
  .withLlm(/* configure your LLM vendor */)
  .withTts(new GoogleTTS({
    key: '<google_application_credentials_string>',
    voiceName: 'en-US-Chirp3-HD-Charon',
  }));
import "github.com/AgoraIO/agora-agents-go/v2/agentkit/vendors"

// client is your configured Agora client
agent := agentkit.NewAgent(client).WithStt(/* configure your STT vendor */).
  WithLlm(/* configure your LLM vendor */).
  WithTts(
    vendors.NewGoogleTTS(vendors.GoogleTTSOptions{
        Key:       "<google_application_credentials_string>",
        VoiceName: "en-US-Chirp3-HD-Charon",
    }),
)

Use the following tts configuration in your request:

"tts": {
    "vendor": "google",
    "params": {
        "credentials": "<GOOGLE_APPLICATION_CREDENTIALS_STRING>",
        "VoiceSelectionParams": {
            "name": "en-US-Chirp3-HD-Charon"
        },
        "AudioConfig": {
            "speaking_rate": 1.0,
            "sample_rate_hertz": 24000
        }
    }
}

Caution

The parameters listed on this page are validated for use with Conversational AI Engine. Required parameters must be provided as documented. Any additional parameters are passed through directly to the underlying vendor without validation. For a full list of supported options, refer to the Google documentation.

Key parameters

paramsrequired
credentialsstring
required

The Google Cloud service account credentials JSON string used for authentication. Get your credentials from the Google Cloud Console.

VoiceSelectionParamsobject
required
namestring
required

The name of the voice to use, for example, en-US-Chirp3-HD-Charon or en-US-Neural2-A. See supported voices for available voice names.

AudioConfigobject
optional
speaking_ratenumber
optional

The speed of speech. Valid range is 0.25 to 2.0, where 1.0 is the normal speed. Values less than 1.0 slow down the speech, while values greater than 1.0 speed it up.

sample_rate_hertzinteger
optional

The sample rate in Hertz for the audio output, for example, 24000 or 16000. The default value depends on the selected voice.