Speechmatics

Updated

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

Preview documentation

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

Speechmatics provides real-time automatic speech recognition (ASR) with flexible language support and reliable performance for conversational AI applications.

Sample configuration

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

Speechmatics supports BYOK only. It isn't available in managed mode. Store your Speechmatics API key in a secret set, and refer to it from the agent. For details, see Use your own provider keys.

from agora_agent import Agent, SpeechmaticsSTT, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(
        SpeechmaticsSTT(
            api_key=secret_ref("support_prod", "speechmatics"),
            language="en",
        )
    )
    .with_llm(...)  # configure your LLM vendor
    .with_tts(...)  # configure your TTS vendor
)
import { Agent, SpeechmaticsSTT, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(
    new SpeechmaticsSTT({
      apiKey: secretRef('support_prod', 'speechmatics'),
      language: 'en',
    }),
  )
  .withLlm(/* configure your LLM vendor */)
  .withTts(/* configure your TTS vendor */);
// client is your configured Agora client
agent := agentkit.NewAgent(client).
	WithStt(vendors.NewSpeechmaticsSTT(vendors.SpeechmaticsSTTOptions{
		APIKey:   agentkit.SecretRef("support_prod", "speechmatics"),
		Language: "en",
	})).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts( /* configure your TTS vendor */ )

Set credential.mode to byok and credential.fields.key to a reference to your Speechmatics API key in a secret set. In the following example, the key is stored as speechmatics in the support_prod set:

"asr": {
  "credential": {
    "mode": "byok",
    "fields": {
      "key": "$secrets.support_prod.speechmatics"
    }
  },
  "vendor": "speechmatics",
  "language": "en",
  "url": "wss://eu2.rt.speechmatics.com/v2",
  "params": {
    "language": "en"
  }
}

Key parameters

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

asrrequired
vendorstring
required

Set to speechmatics.

credentialobject
required

How the agent authenticates with Speechmatics. Set mode to byok and fields.key to a $secrets.<set>.<key> reference to your Speechmatics API key.

languagestring
required

The language code to use for transcription. For example, use en for English.

urlstring
optional

The WebSocket URL for the Speechmatics streaming API. Specify this to target a particular region, for example, wss://eu2.rt.speechmatics.com/v2. Omit it to use the default endpoint.

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 Speechmatics without validation. For a full list of supported options, refer to the Speechmatics documentation.