Skip to content

feat(xai): expose STT turn options - #2155

Open
rosetta-livekit-bot[bot] wants to merge 1 commit into
mainfrom
cathode-dazzled-headiest
Open

feat(xai): expose STT turn options#2155
rosetta-livekit-bot[bot] wants to merge 1 commit into
mainfrom
cathode-dazzled-headiest

Conversation

@rosetta-livekit-bot

@rosetta-livekit-bot rosetta-livekit-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Exposes xAI STT vadThreshold, smartTurn, smartTurnTimeout, and keyterm options in the JS plugin.
  • Sends the corresponding xAI websocket query params, preserving repeated keyterm params with URLSearchParams.append().
  • Adds a minor changeset for @livekit/agents-plugin-xai because this is new public API.

Source diff coverage

Coverage for livekit/agents PR #6587
Source file Classification Target handling
livekit-plugins/livekit-plugins-xai/livekit/plugins/xai/stt.py Ported plugins/xai/src/stt.ts: added public STT option fields, relied on existing constructor/updateOptions stream propagation, and added websocket query params. Python NotGiven maps to optional TS fields omitted when undefined; 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). keyterm uses repeated URLSearchParams.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... build
  • pnpm --filter @livekit/agents-plugin-xai lint (passes with existing warnings in plugins/xai/src/_utils.ts)
  • pnpm test plugins/xai

Additional check attempted:

  • pnpm --filter @livekit/agents-plugin-xai api:check currently fails before analyzing this change because API Extractor does not support the existing export * as realtime declaration emitted in plugins/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_options on xai.STT:

  • vad_threshold (0.0–1.0) — built-in VAD sensitivity; xAI's websocket default is 0.08
  • smart_turn (0.0–1.0) — confidence threshold for xAI's ML end-of-turn ("Smart Turn") prediction
  • smart_turn_timeout (1–5000 ms) — silence backstop when Smart Turn predicts the speaker is continuing
  • keyterm (list, max 100 terms) — vocabulary biasing; sent as repeated query params, so the websocket params dict became a list of pairs

All four are NotGivenOr and omitted from the query string when unset, so existing behavior is unchanged — the default connection sends the identical query as before. Verified with ruff 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's xai.ExtraSettings, which rejects these keys) only exposes endpointing, so smart-turn thresholds and keyword boosting are unreachable without patching the plugin.

🤖 Generated with Claude Code

@rosetta-livekit-bot
rosetta-livekit-bot Bot requested a review from a team as a code owner July 29, 2026 05:05
@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a470630

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 39 packages
Name Type
@livekit/agents-plugin-xai Major
@livekit/agents Major
@livekit/agents-plugin-anam Major
@livekit/agents-plugin-anthropic Major
@livekit/agents-plugin-assemblyai Major
@livekit/agents-plugin-azure Major
@livekit/agents-plugin-baseten Major
@livekit/agents-plugin-bey Major
@livekit/agents-plugin-cartesia Major
@livekit/agents-plugin-cerebras Major
@livekit/agents-plugin-deepgram Major
@livekit/agents-plugin-did Major
@livekit/agents-plugin-elevenlabs Major
@livekit/agents-plugin-fishaudio Major
@livekit/agents-plugin-google Major
@livekit/agents-plugin-hedra Major
@livekit/agents-plugin-hume Major
@livekit/agents-plugin-inworld Major
@livekit/agents-plugin-krisp Major
@livekit/agents-plugin-lemonslice Major
@livekit/agents-plugin-liveavatar Major
@livekit/agents-plugin-livekit Major
@livekit/agents-plugin-minimax Major
@livekit/agents-plugin-mistral Major
@livekit/agents-plugin-mistralai Major
@livekit/agents-plugin-neuphonic Major
@livekit/agents-plugin-openai Major
@livekit/agents-plugin-perplexity Major
@livekit/agents-plugin-phonic Major
@livekit/agents-plugin-protoface Major
@livekit/agents-plugin-resemble Major
@livekit/agents-plugin-rime Major
@livekit/agents-plugin-runway Major
@livekit/agents-plugin-sarvam Major
@livekit/agents-plugin-silero Major
@livekit/agents-plugin-soniox Major
@livekit/agents-plugin-tavus Major
@livekit/agents-plugin-trugen Major
@livekit/agents-plugins-test Major

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants