Speechmatics

Updated

Integrate Speechmatics ASR with the Conversational AI Engine.

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 ASR when starting a conversational AI agent.

from agora_agent import Agent, SpeechmaticsSTT

# client is your configured Agora client
agent = (
    Agent(client)
    .with_stt(SpeechmaticsSTT(
        api_key='your-speechmatics-key',
        language='en',
        uri='wss://eu2.rt.speechmatics.com/v2',
    ))
    .with_llm(...)  # configure your LLM vendor
    .with_tts(...)  # configure your TTS vendor
)
import { Agent, SpeechmaticsSTT } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(new SpeechmaticsSTT({
    apiKey: 'your-speechmatics-key',
    language: 'en',
    uri: 'wss://eu2.rt.speechmatics.com/v2',
  }))
  .withLlm(/* configure your LLM vendor */)
  .withTts(/* configure your TTS vendor */);
import "github.com/AgoraIO/agora-agents-go/v2/agentkit/vendors"

// client is your configured Agora client
agent := agentkit.NewAgent(client).WithStt(
    vendors.NewSpeechmaticsSTT(vendors.SpeechmaticsSTTOptions{
        APIKey:   "your-speechmatics-key",
        Language: "en",
        URI:      "wss://eu2.rt.speechmatics.com/v2",
    }),
).WithLlm(/* configure your LLM vendor */).
  WithTts(/* configure your TTS vendor */)

Use the following asr configuration in your request:

"asr": {
  "vendor": "speechmatics",
  "language": "en-US",
  "params": {
    "key": "<speechmatics_key>",
    "language": "en",
    "uri": "wss://eu2.rt.speechmatics.com/v2"
  }
}

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 Speechmatics documentation.

Key parameters

paramsrequired
keystring
required

The Speechmatics API key used to authenticate requests. You must provide a valid key for the service to function.

languagestring
required

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

uristring
optional

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