Google

Updated

Use Google for speech recognition (ASR) in a Conversational AI Platform agent.

Preview documentation

You're reading the Conversational AI Platform (Preview) docs. Switch to Main.

Google provides advanced automatic speech recognition with high accuracy and support for multiple languages, designed for real-time conversational AI applications.

Sample configuration

The following example shows how to configure Google as the agent's ASR when you create or update an agent. For a complete example, see Create an agent and start a session.

Google supports BYOK only. It isn't available in managed mode. Store your Google Cloud service account credentials in a secret set, and refer to them from the agent. For details, see Use your own provider keys.

from agora_agent import Agent, GoogleSTT, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(
        GoogleSTT(
            adc_credentials_string=secret_ref("support_prod", "google"),
            project_id="<GOOGLE_ASR_PROJECT_ID>",
            location="global",
            language="en-US",
            model="long",
        )
    )
    .with_llm(...)  # configure your LLM vendor
    .with_tts(...)  # configure your TTS vendor
)
import { Agent, GoogleSTT, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(
    new GoogleSTT({
      adcCredentialsString: secretRef('support_prod', 'google'),
      projectId: '<GOOGLE_ASR_PROJECT_ID>',
      location: 'global',
      language: 'en-US',
      model: 'long',
    }),
  )
  .withLlm(/* configure your LLM vendor */)
  .withTts(/* configure your TTS vendor */);
// client is your configured Agora client
agent := agentkit.NewAgent(client).
	WithStt(vendors.NewGoogleSTT(vendors.GoogleSTTOptions{
		ADCCredentialsString: agentkit.SecretRef("support_prod", "google"),
		ProjectID:            "<GOOGLE_ASR_PROJECT_ID>",
		Location:             "global",
		Language:             "en-US",
		Model:                "long",
	})).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts( /* configure your TTS vendor */ )

Set credential.mode to byok and credential.fields.adc_credentials_string to a reference to your service account credentials in a secret set. In the following example, the credentials are stored as google in the support_prod set:

"asr": {
  "credential": {
    "mode": "byok",
    "fields": {
      "adc_credentials_string": "$secrets.support_prod.google"
    }
  },
  "vendor": "google",
  "model": "long",
  "language": "en-US",
  "params": {
    "language": "en-US",
    "project_id": "<GOOGLE_ASR_PROJECT_ID>",
    "location": "global"
  }
}

Key parameters

The asr block takes the following fields. In the SDKs, GoogleSTT sets them from its options, and passes any other Google parameters from its additional parameters option to params.

asrrequired
vendorstring
required

Set to google.

credentialobject
required

How the agent authenticates with Google. Set mode to byok and fields.adc_credentials_string to a $secrets.<set>.<key> reference to your Google Cloud service account credentials JSON string. Get your credentials from the Google Cloud Console.

modelstring
optional

The recognition model to use.

languagestring
required

The language code for speech recognition, for example, en-US, es-ES, or fr-FR. See supported languages for available language codes.

paramsobject
required
project_idstring
required

The Google Cloud project ID where the Speech-to-Text API is enabled. Get your project ID from the Google Cloud Console.

locationstring
required

The Google Cloud region where the speech service is hosted, for example, global, us-central1, or europe-west1.

Caution

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

This integration is fully supported for use with the Conversational AI Platform. 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.