Skip to content

feat(assemblyai): surface end-of-turn confidence metadata - #2418

Open
rosetta-livekit-bot[bot] wants to merge 1 commit into
mainfrom
mineral-beasts-surfaced
Open

feat(assemblyai): surface end-of-turn confidence metadata#2418
rosetta-livekit-bot[bot] wants to merge 1 commit into
mainfrom
mineral-beasts-surfaced

Conversation

@rosetta-livekit-bot

@rosetta-livekit-bot rosetta-livekit-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Surface AssemblyAI streaming end-of-turn confidence on SpeechData.metadata for interim, preflight, and final transcripts.
  • Preserve 0 as a meaningful confidence value while leaving metadata unset when the server omits the field.
  • Add a patch changeset for @livekit/agents-plugin-assemblyai.

Port of livekit/agents#7107.

Source diff coverage
  • Adapted: livekit-plugins/livekit-plugins-assemblyai/livekit/plugins/assemblyai/stt.pyplugins/assemblyai/src/stt.ts. Extended the existing target metadata mapper so end_of_turn_confidence is exposed as metadata.assemblyai.endOfTurnConfidence, following target provider namespacing and camelCase conventions. Existing event construction already applies this mapper to interim, preflight, and final transcripts.
  • Adapted: tests/test_plugin_assemblyai_stt.pyplugins/assemblyai/src/stt-metadata.test.ts. Ported all four source cases through the target local WebSocket harness: interim confidence, final confidence, zero confidence, and absent confidence.
  • Not applicable: None. Every source diff file has a target counterpart and was ported.

Testing

  • pnpm exec vitest run plugins/assemblyai (10 passed, 1 credential-gated test skipped)
  • pnpm exec turbo run build --filter=@livekit/agents-plugin-assemblyai
  • pnpm --filter @livekit/agents-plugin-assemblyai lint
  • pnpm exec prettier --check plugins/assemblyai/src/stt.ts plugins/assemblyai/src/stt-metadata.test.ts .changeset/surface-assemblyai-turn-confidence.md
  • git diff --check

Ported from livekit/agents#7107

Original PR description

Summary

Surfaces the AssemblyAI streaming end_of_turn_confidence on SpeechData.metadata so callers can read it off the SpeechEvent (e.g. in an stt_node override) and threshold it for preemptive / eager LLM generation. The plugin already parsed the field from each Turn message but only logged it, so it never reached SpeechData. It's now attached to the interim, preflight, and final events, guarded on is not None (an early-partial 0.0 still surfaces; models that don't emit the field are unaffected).

Value semantics are model-defined:

  • universal-3-5-pro / universal-3-6-pro / u3-rt-pro — rises from 0 toward 1 across the partials held between min_turn_silence and max_turn_silence, and is 1.0 on the final.
  • universal-streaming-english / universal-streaming-multilingual — a per-partial end-of-turn probability on every partial, with the model's own score on the final.

Testing

  • tests/test_plugin_assemblyai_stt.py: 4 new tests (interim, final, the 0.0-still-surfaces case, and the absent-field case). Full file: 115 passed; ruff and strict mypy clean.
  • Verified against the production AssemblyAI streaming API on an ambiguous-ending clip: universal-3-5-pro and universal-3-6-pro surface the held-turn ramp (0.0 → 0.4 → 0.75 → 1.0), and universal-streaming-english / universal-streaming-multilingual surface their per-partial EOT probability — all readable off SpeechData.metadata.

@rosetta-livekit-bot
rosetta-livekit-bot Bot requested a review from a team as a code owner September 3, 2026 19:54
@changeset-bot

changeset-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 286683f

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

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

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 bugs or issues to report.

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