Skip to main content

Automatic Speech Recognition (ASR)

This section describes the supported integrations with Automatic Speech Recognition (ASR) or speech-to-text (STT) services. Configure an ASR engine under asr in a Voice Stream channel in credentials.yml. Each engine accepts keep_alive_interval (seconds, default 5) and a language_map that maps the assistant language keys from config.yml to provider settings. The top-level language and model options are deprecated; set provider-specific language and model values inside language_map instead.

Deepgram

Use the environment variable DEEPGRAM_API_KEY for Deepgram API Key. You can request a key from Deepgram. It can be configured in a Voice Stream channel as follows:
credentials.yml

Deepgram v1 models (Nova)

Deepgram v1 models, including Nova models, use Deepgram’s /v1/listen endpoint.
Turn DetectionDeepgram v1 models use two mechanisms to detect when a speaker has finished talking:
  1. Endpointing: Uses Voice Activity Detection (VAD) to detect silence after speech
  2. UtteranceEnd: Looks at word timings to detect gaps between words
The configuration parameters endpointing and utterance_end_ms control these features respectively. For noisy environments, utterance_end_ms may be more reliable as it ignores non-speech audio. Read more on Deepgram Documentation
Configuration parameters
  • endpoint: Optional, defaults to api.deepgram.com - The endpoint URL for the Deepgram API.
  • endpointing: Optional, defaults to 400 - Number of milliseconds of silence to determine the end of speech.
  • smart_format: Optional, defaults to true - Boolean value to enable or disable Deepgram’s smart formatting.
  • utterance_end_ms: Optional, defaults to 1000 - Time in milliseconds to wait before considering an utterance complete.
  • language_map: Optional. By default, Rasa maps the assistant language to Deepgram language en and model nova-3. Use each entry’s language and model fields to configure another provider language or model.
Language and Model ConfigurationThe deprecated top-level language and model options cannot be combined with language_map. Put those values inside each language_map entry instead.
Deepgram v1 multilingual support
To configure Deepgram v1 for multilingual agent use language_map property. Keys listed in the map must match languages (language and additional_languages) mentioned in config.yml. Deepgram v1 supports language and model as configuration parameters inside language_map.
config.yml
credentials.yml
To see the full list of supported languages and models for Deepgram visit Models & Languages Overview.

Deepgram Flux (v2)

Use the separate deepgram_flux engine for Deepgram Flux models. Flux uses Deepgram’s /v2/listen endpoint and model-integrated end-of-turn detection.
Turn DetectionDeepgram v2 models use model-integrated end-of-turn detection.
Configuration parameters
  • endpoint: Optional, defaults to api.deepgram.com - The endpoint URL for the Deepgram API.
  • eot_threshold: Optional - Confidence threshold for end-of-turn detection. When omitted, Deepgram uses its default.
  • eot_timeout_ms: Optional - Maximum silence before forcing end-of-turn detection. When omitted, Deepgram uses its default.
  • language_map: Optional. By default, Rasa maps the assistant language to model flux-general-en. Each entry supports model and an optional language hint.
Deepgram Flux multilingual support
To configure Deepgram Flux for a multilingual agent, use the language_map property. Keys in the map must match the languages (language and additional_languages) defined in config.yml. Rasa’s Deepgram Flux integration supports model and an optional language inside language_map. When language is set, Rasa passes it to Deepgram as a language_hint.
Omit language for single-language modelsOnly set language for the multilingual flux-general-multi model. For single-language models such as flux-general-en, omit language, as the model is already English-only.
To use Deepgram Flux, set a flux-* model inside language_map:
credentials.yml
For multilingual agents, use the flux-general-multi model and set language on each entry to pass a Deepgram language_hint:
credentials.yml
For more on configuring Flux, see Flux Configuration.

Azure

Requires the python library azure-cognitiveservices-speech. The API Key can be set with the environment variable AZURE_SPEECH_API_KEY. Sample configuration looks as follows:
credentials.yml

Configuration parameters

  • speech_region: Optional. The region identifier for the Azure Speech service, such as westus. If you omit all connection fields, Rasa uses eastus.
  • speech_endpoint: Optional. A custom Azure Speech service endpoint, such as an endpoint behind a reverse proxy.
  • speech_host: Optional. A custom service host in protocol://host:port format. The port is optional.
  • language_map: Optional. Each entry must set Azure’s language code. By default, Rasa maps the assistant language to en-US.
If you set speech_region, speech_endpoint, or speech_host, make sure the value matches your Azure Speech resource. If you omit all three, Rasa uses the eastus region. When connecting to Azure Cloud, speech_region is enough. For example:
credentials.yml
Language ConfigurationUse language_map for language selection. The top-level language option is deprecated and cannot be combined with language_map.

Azure ASR Multilingual Support

New in Rasa 3.16.0
To configure Azure ASR for multilingual agent use language_map property. Keys listed in the map must match languages (language and additional_languages) mentioned in config.yml. Azure ASR supports language as configuration parameter inside language_map.
config.yml
credentials.yml
To see the full list of supported languages and models for Azure ASR visit Azure ASR Languages.

ElevenLabs

ElevenLabs Scribe v2 Realtime transcribes streamed voice audio. Set the ELEVENLABS_API_KEY environment variable. The default endpoint is wss://api.elevenlabs.io/v1/speech-to-text/realtime.
credentials.yml

Configuration parameters

  • endpoint: Optional. The ElevenLabs WebSocket endpoint. Defaults to wss://api.elevenlabs.io/v1/speech-to-text/realtime.
  • commit_strategy: Optional. Use vad (default) to commit transcripts based on voice activity detection, or manual to commit when the audio turn ends.
  • include_timestamps: Optional, defaults to false. Ask ElevenLabs to include word timestamps.
  • include_language_detection: Optional, defaults to false. Ask ElevenLabs to detect the language from audio. When enabled, Rasa does not send the configured language code.
  • language_map: Optional. Each entry supports language and model. The default model is scribe_v2_realtime.

Others

Looking for integration with a different ASR service? You can create your own custom ASR component.

Custom ASR

Create Custom ASR with SkillsRasa MCP Tools includes AI Skills to scaffold and audit your custom ASR component with your IDE copilot. Run rasa tools init in your project root to install the agent skills.
You can implement your own custom ASR component as a Python class to integrate with any third-party speech recognition service. A custom ASR component must subclass the ASREngine class from rasa.core.channels.voice_stream.asr.asr_engine. Your custom ASR component receives audio in the RasaAudioBytes format and may need to convert it to your service’s expected format.

Required Methods

Your custom ASR component must implement the following methods:
  • open_websocket_connection(): Establish a websocket connection to your ASR service
  • from_config_dict(config: Dict): Class method to create an instance from configuration dictionary
  • signal_audio_done(): Signal to the ASR service that audio input has ended
  • rasa_audio_bytes_to_engine_bytes(chunk: RasaAudioBytes): Convert Rasa audio format to your engine’s expected format
  • engine_event_to_asr_event(event: Any): Convert your engine’s events to Rasa’s ASREvent format
  • get_default_config(): Static method that returns the default configuration for your component

Optional Methods

You may also override these methods as needed:
  • send_keep_alive(): Send keep-alive messages to maintain the connection. The default implementation is only a pass statement.
  • close_connection(): Custom cleanup when closing the connection. Default implementation is as follows,

ASR Events

Your engine_event_to_asr_event method should return appropriate ASREvent objects:
  • UserIsSpeaking(transcript): For interim/partial transcripts while the user is speaking
  • NewTranscript(transcript): For final transcripts when the user has finished speaking
See Configure a custom ASR component for the credentials configuration.

Example Implementation

Here’s an example based on the Deepgram implementation structure:
custom_asr.py
This structure allows you to integrate any speech recognition service with Rasa’s voice capabilities while maintaining compatibility with the existing voice stream infrastructure.

Configure a custom ASR component

To use a custom ASR component, configure its module path and settings in your credentials.yml file. The configuration should contain the module path of your custom class and any required configuration parameters. The module path follows the format path.to.module.ClassName. For example, a class MyASR in addons/custom_asr.py has module path addons.custom_asr.MyASR.

Custom ASR Configuration Example

credentials.yml