feat(assemblyai): add u3-rt-pro model plus mid-stream updates, SpeechStarted, and ForceEndpoint support#4965
Merged
davidzhao merged 10 commits intolivekit:mainfrom Mar 2, 2026
Conversation
…eEndpoint - Rename model from u3-pro to u3-rt-pro - Replace reconnect-based update_options with UpdateConfiguration websocket messages - Add SpeechStarted event handler (maps to START_OF_SPEECH) - Add force_endpoint() to immediately finalize turns - Add keyterms_prompt to update_options/UpdateConfiguration - Fix interim_results capability (True, not False)
Move queue drain into a separate send_config_task coroutine so ForceEndpoint and UpdateConfiguration messages are sent immediately, even when no audio frames are flowing.
… u3-rt-pro Separate send_config_task from gather so it is cancelled in finally instead of blocking shutdown. Default language_detection to True for u3-rt-pro model.
Accept 'u3-pro' as a deprecated model name that remaps to 'u3-rt-pro' with a warning. For u3-rt-pro, default min_end_of_turn_silence_when_confident and max_turn_silence to 100ms (max follows min if only min is set) to minimize latency for external turn detectors.
Adds support for the new streaming diarization params (speaker_labels bool, max_speakers 1-10) as connection-level query params on the WebSocket URL.
The API accepts both names (via AliasChoices). This promotes min_turn_silence as the primary parameter while keeping backward compatibility: the old name is still accepted but logs a deprecation warning, and min_turn_silence takes precedence when both are provided.
davidzhao
approved these changes
Mar 2, 2026
Member
davidzhao
left a comment
There was a problem hiding this comment.
lg. a couple of clarifying questions
| await ws.close() | ||
|
|
||
| async def _connect_ws(self) -> aiohttp.ClientWebSocketResponse: | ||
| # u3-rt-pro defaults: min=100, max=min (so both 100 unless overridden) |
Member
There was a problem hiding this comment.
why does u3-rt-pro work differently here?
| ) | ||
| else: | ||
| min_silence = ( | ||
| self._opts.min_turn_silence if is_given(self._opts.min_turn_silence) else None |
Member
There was a problem hiding this comment.
setting it to None would lead to min_turn_silence: null to be sent to your end. is that desired/supported?
if not, I would recommend only setting these fields when given
Contributor
Author
There was a problem hiding this comment.
None values are filtered out (via filtered_config) before building the query string, so they're never sent to the API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Universal-3-Pro (
u3-rt-pro) model support to the AssemblyAI streaming plugin with several improvements to the existing streaming implementation.New model
u3-rt-proto the supportedmodelliteralsu3-proname with a warning, remapped tou3-rt-propromptparameter (u3-rt-pro only) for custom transcription instructions, validated at initlanguage_detectiontoTrueforu3-rt-promodel (previously only defaulted formultilingualmodels)min_end_of_turn_silence_when_confidentandmax_turn_silenceto 100ms foru3-rt-profor optimal out-of-the-box performance/latency across most LiveKit configurations. This provides finals quickly for third-party turn detection models while still working well with built-in turn detection.min=100msandmax=1000ms.We will clearly document the plugin's defaults and how to override them.Speaker diarization support
speaker_labelsparameter (bool) to enable speaker diarization on the streaming connectionmax_speakersparameter (int, 1-10) to set the maximum number of speakers when diarization is enabledUpdateConfiguration)Mid-stream configuration updates
prompt,keyterms_prompt,max_turn_silence,min_end_of_turn_silence_when_confident,end_of_turn_confidence_threshold,vad_thresholdkeyterms_prompttoupdate_options()(previously only available at connection time)Rename
min_end_of_turn_silence_when_confident→min_turn_silenceThe AssemblyAI API accepts both names via
AliasChoices. This promotesmin_turn_silenceas the primary parameter — shorter and consistent withmax_turn_silence. The old name is still accepted but logs a deprecation warning. If both are provided,min_turn_silencetakes precedence.New websocket message support
SpeechStarted: Handle new server event, mapped toSpeechEventType.START_OF_SPEECHfor barge-in detectionForceEndpoint: Addforce_endpoint()method to immediately finalize the current turn via{"type": "ForceEndpoint"}Fixes
interim_results=TrueinSTTCapabilities(was incorrectlyFalsedespite emittingINTERIM_TRANSCRIPTevents)send_config_taskshutdown hang by separating it fromasyncio.gatherso it is cancelled infinallyinstead of blocking graceful shutdown