feat(endpointing): expose dynamic endpointing alpha parameter#1325
Open
toubatbrian wants to merge 3 commits intomainfrom
Open
feat(endpointing): expose dynamic endpointing alpha parameter#1325toubatbrian wants to merge 3 commits intomainfrom
toubatbrian wants to merge 3 commits intomainfrom
Conversation
Port of livekit/agents#5491. Adds the `alpha` EMA coefficient to the EndpointingOptions config surface so that, when the dynamic endpointing runtime lands in agents-js, it is already configurable through the public API (matches Python config shape).
🦋 Changeset detectedLatest commit: 74bae29 The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 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 |
Contributor
|
should this be based on top of #1316? |
Per CLAUDE.md "Porting from Python" rule, every JS change that corresponds to a Python change must carry an inline reference comment above the relevant lines. Adds refs above the `alpha` field declaration and the `alpha: 0.9` default, pointing at turn.py lines 63-66 and 73 respectively (livekit/agents#5491).
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
Port of livekit/agents#5491 (Python) — exposes the
alphaEMA (exponential moving average) coefficient for dynamic endpointing on the publicEndpointingOptionsconfig surface.What changed in Python (upstream)
The upstream PR adds a new
alphafield toEndpointingOptions:EndpointingOptionsTypedDict and_ENDPOINTING_DEFAULTS(default0.9).DynamicEndpointing.__init__acceptsalphaand forwards it to both internal EMA filters (_utterance_pause,_turn_pause).DynamicEndpointing.update_options(...)acceptsalphaand updates the EMA filters in place without resetting their learned state.create_endpointing(options)readsoptions["alpha"]when constructing aDynamicEndpointing.AgentSession.update_options(...)andagent_activity.endpointing_optsplumbalphathrough from session-level → agent-level overrides.The
alphacontrols how much weight is given to historical end-of-utterance pauses versus the latest sample (higher → more inertia, more smoothing).What this JS PR does
alpha: numberfield to theEndpointingOptionsinterface inagents/src/voice/turn_config/endpointing.ts.alpha: 0.9todefaultEndpointingOptions.Implementation nuances / parity gap
agents-js does not currently ship a
DynamicEndpointingruntime — only the fixed-delay path is wired throughAudioRecognitionviaminEndpointingDelay/maxEndpointingDelay. There is no JS counterpart yet for:DynamicEndpointingclass with EMA filters (_utterance_pause,_turn_pause)create_endpointing(options)factory selecting between fixed and dynamic modesAgentSession.update_options(...)/AgentActivity.endpointing_optsruntime plumbing for endpointing fieldsBecause of that, this port stops at the config-surface level: it makes
alphaa first-class option onEndpointingOptionsso:turnHandling.endpointing.alphatoday will not get a TypeScript error and the value is plumbed throughmergeWithDefaultslike the other endpointing fields.The Python
update_options(alpha=...)runtime path and theDynamicEndpointingtest coverage (test_endpointing.pyadditions) are intentionally not ported here — they would be dead code without the underlying class, and porting the full dynamic endpointing implementation is out of scope for this small config-parity PR.Files touched
agents/src/voice/turn_config/endpointing.ts— addedalphato interface + default.Test plan
pnpm -w buildsucceeds (type-only addition, optional field with default).turnHandling: { endpointing: { alpha: 0.7 } }accepted byAgentSessionOptionswithout TS errors.Reviewers
cc @toubatbrian @livekit/agent-devs
Linked Python PR: livekit/agents#5491
Generated by Claude Code