Expand description
Shared voice/audio inbound transcription used by channel adapters.
Each platform exposes audio bytes differently (Telegram voice, Discord attachment, Slack file, Feishu audio message), but once we have raw bytes the dispatch into the configured STT provider — OpenAI Whisper or a local command — is the same. This module owns that dispatch and the format used when injecting transcription into the inbound text the agent sees.
Also exposes the inverse path: when a turn was triggered by an inbound
voice message and voice_round_trip is enabled, channels call
synth_speech_to_temp to render the bot’s reply as audio so the user
can listen to it on the same surface they spoke into.
Functions§
- can_
transcribe - Returns true if a transcription provider is configured. Channels can use this to decide between transcribing or surfacing a “voice not supported” notice to the sender.
- format_
voice_ inbound - Standard inbound formatting so the agent always sees voice messages with the same shape regardless of platform.
- format_
voice_ inbound_ error - Standard error shape when transcription was attempted but failed.
- round_
trip_ enabled - True when this deployment should reply with audio to voice-inbound turns.
Requires both the operator opt-in (
voice_round_trip: true) and the TTS layer to be enabled inmedia.tts. - synth_
speech_ to_ temp - Synthesize
textto a temporary audio file using the configured TTS provider, returning the on-disk path. Caller is responsible for sending it to the user and removing the file when done. - transcribe_
audio - Run audio bytes through the configured STT provider.