feat(xai): expose STT turn options - #2155
Open
rosetta-livekit-bot[bot] wants to merge 1 commit into
Open
Conversation
🦋 Changeset detectedLatest commit: a470630 The changes in this PR will be included in the next version bump. This PR includes changesets to release 39 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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
vadThreshold,smartTurn,smartTurnTimeout, andkeytermoptions in the JS plugin.keytermparams withURLSearchParams.append().@livekit/agents-plugin-xaibecause this is new public API.Source diff coverage
Coverage for livekit/agents PR #6587
livekit-plugins/livekit-plugins-xai/livekit/plugins/xai/stt.pyplugins/xai/src/stt.ts: added public STT option fields, relied on existing constructor/updateOptions stream propagation, and added websocket query params. PythonNotGivenmaps to optional TS fields omitted whenundefined; Python snake_case option names are adapted to existing TS camelCase (vadThreshold,smartTurn,smartTurnTimeout) while preserving xAI wire param names (vad_threshold,smart_turn,smart_turn_timeout).keytermuses repeatedURLSearchParams.append()calls to match the source list-of-pairs behavior.No source test files were added or modified in PR #6587, so no tests were ported.
Validation
pnpm --filter @livekit/agents-plugin-xai... buildpnpm --filter @livekit/agents-plugin-xai lint(passes with existing warnings inplugins/xai/src/_utils.ts)pnpm test plugins/xaiAdditional check attempted:
pnpm --filter @livekit/agents-plugin-xai api:checkcurrently fails before analyzing this change because API Extractor does not support the existingexport * as realtimedeclaration emitted inplugins/xai/dist/index.d.ts.cue-cli runtime validation was not run because this PR only changes xAI STT provider websocket option plumbing and does not alter core voice pipeline behavior; running a LiveKit agent with this provider would also require external service credentials.
Ported from livekit/agents#6587
Original PR description
Fixes #6588.
Follows the pattern of #5493 (which exposed
endpointing): adds the remaining xAI STT websocket parameters documented at https://docs.x.ai/developers/model-capabilities/audio/speech-to-text as constructor args /update_optionsonxai.STT:vad_threshold(0.0–1.0) — built-in VAD sensitivity; xAI's websocket default is 0.08smart_turn(0.0–1.0) — confidence threshold for xAI's ML end-of-turn ("Smart Turn") predictionsmart_turn_timeout(1–5000 ms) — silence backstop when Smart Turn predicts the speaker is continuingkeyterm(list, max 100 terms) — vocabulary biasing; sent as repeated query params, so the websocketparamsdict became a list of pairsAll four are
NotGivenOrand omitted from the query string when unset, so existing behavior is unchanged — the default connection sends the identical query as before. Verified withruff check/ruff format; param names/ranges are taken from the xAI docs above.Motivation: these are the main turn-taking tunables for using xai/stt-1 with
turn_detection="stt"in an AgentSession — today the plugin (and the Inference gateway'sxai.ExtraSettings, which rejects these keys) only exposesendpointing, so smart-turn thresholds and keyword boosting are unreachable without patching the plugin.🤖 Generated with Claude Code