fix(sarvam): saaras:v3 does not support the config/prompt message - #6617
Open
biztex wants to merge 1 commit into
Open
fix(sarvam): saaras:v3 does not support the config/prompt message#6617biztex wants to merge 1 commit into
biztex wants to merge 1 commit into
Conversation
saaras:v3 connects to wss://api.sarvam.ai/speech-to-text/ws, whose AsyncAPI schema documents only audio-data and flush client messages. The config/prompt message the plugin sent on connect is documented only for the legacy translate endpoint (/speech-to-text-translate/ws), which is used exclusively by saaras:v2.5 - so the prompt was silently dropped server-side and hotword biasing built on it never had any effect. Mark saaras:v3 as supports_prompt=False, stop assuming prompt support for unknown models (they are routed to the non-translate endpoint too), and warn when a caller supplies a prompt that will not be sent, instead of failing silently. Adds hermetic tests pinning prompt support to the translate endpoint. Fixes livekit#6606
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.
Fixes #6606
Problem
saaras:v3routes towss://api.sarvam.ai/speech-to-text/ws(use_translate_endpoint=False), butMODEL_CONFIGSmarked itsupports_prompt=True, so the streaming client sent an initial{"type": "config", "prompt": ...}message on connect. Sarvam's AsyncAPI spec for that endpoint documents only audio-data and flush client messages — the config/prompt message exists only on the legacy translate endpoint (/speech-to-text-translate/ws), used exclusively bysaaras:v2.5. The prompt was therefore silently dropped server-side, and hotword/contextual-biasing built on it (as in the issue's telephony repro) never had any effect.Change
MODEL_CONFIGS["saaras:v3"].supports_prompt→False, with a comment pointing at the endpoint schema._model_supports_prompt()no longer assumes prompt support for unknownsaaras*models:_get_urls_for_model()routes unknown models to the non-translate endpoint, which has no config message either.promptthat will not be sent now logs a warning (at options construction and in the stream'supdate_options) instead of failing silently.saaras:v2.5only.Tests
New hermetic
tests/test_sarvam_stt_options.py(unit-marked, no network/credentials): prompt-support table assertions, endpoint routing, an invariant test that any model claiming prompt support must connect to the translate endpoint, and warning behavior.If Sarvam has an undocumented prompt mechanism for
/speech-to-text/ws, happy to rework — but as-is the client should not claim support its endpoint's schema doesn't document.