-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(soniox): support stt-rt-v5 with endpoint_sensitivity option #6126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,7 +107,7 @@ def __post_init__(self) -> None: | |
| class STTOptions: | ||
| """Configuration options for Soniox Speech-to-Text service.""" | ||
|
|
||
| model: str = "stt-rt-v4" | ||
| model: str = "stt-rt-v5" | ||
|
|
||
| language_hints: list[str] | None = None | ||
| language_hints_strict: bool = False | ||
|
|
@@ -119,17 +119,25 @@ class STTOptions: | |
| enable_speaker_diarization: bool = False | ||
| enable_language_identification: bool = True | ||
|
|
||
| max_endpoint_delay_ms: int = 500 | ||
| max_endpoint_delay_ms: int = 2000 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mihafabcic-soniox could you provide more context on why you changed the default here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some context is in the PR description. The change came from a real customer who hit transcription issues from endpoints firing too aggressively at 500ms (e.g. extra digits added to phone numbers). Bumping to 2000ms (the Soniox API's own default) resolved them. |
||
| """Maximum delay in milliseconds between speech cessation and endpoint detection. | ||
| Range: 500–3000. | ||
| See: https://soniox.com/docs/stt/rt/endpoint-detection""" | ||
|
|
||
| endpoint_sensitivity: float | None = None | ||
| """How readily the model emits speech endpoints. Range: -1.0 to 1.0. | ||
| Higher values make endpoints more likely (finalize sooner); lower values make them | ||
| less likely. Leave as None to use the server-side default. | ||
| Introduced in the Soniox v5 model; earlier models reject it.""" | ||
|
|
||
| client_reference_id: str | None = None | ||
| translation: TranslationConfig | None = None | ||
|
|
||
| def __post_init__(self) -> None: | ||
| if not (500 <= self.max_endpoint_delay_ms <= 3000): | ||
| raise ValueError("max_endpoint_delay_ms must be between 500 and 3000") | ||
| if self.endpoint_sensitivity is not None and not (-1.0 <= self.endpoint_sensitivity <= 1.0): | ||
| raise ValueError("endpoint_sensitivity must be between -1.0 and 1.0") | ||
|
|
||
|
|
||
| class STT(stt.STT): | ||
|
|
@@ -261,6 +269,8 @@ async def _connect_ws(self) -> aiohttp.ClientWebSocketResponse: | |
| "client_reference_id": self._stt._params.client_reference_id, | ||
| } | ||
| config["max_endpoint_delay_ms"] = self._stt._params.max_endpoint_delay_ms | ||
| if self._stt._params.endpoint_sensitivity is not None: | ||
| config["endpoint_sensitivity"] = self._stt._params.endpoint_sensitivity | ||
| if self._stt._params.translation is not None: | ||
| tr = self._stt._params.translation | ||
| translation_dict: dict[str, Any] = {"type": tr.type} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚩 Breaking default change: max_endpoint_delay_ms 500 → 2000
The default
max_endpoint_delay_mschanged from 500 to 2000. This is a 4× increase in the maximum endpoint detection delay, meaning existing users who rely on the default will experience noticeably later speech finalization. While this appears intentional for the v5 model, it is a behavioral breaking change for any caller that constructsSTTOptions()without explicitly setting this field. Thelivekit-plugins-inworldplugin referencessoniox/stt-rt-v4in comments (livekit-plugins/livekit-plugins-inworld/livekit/plugins/inworld/stt.py:55) — that plugin may also need updating if it depends on these defaults.Was this helpful? React with 👍 or 👎 to provide feedback.