Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fresh-otters-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/agents-plugin-soniox": minor
---

Support Soniox stt-rt-v5 and endpointSensitivity.
1 change: 1 addition & 0 deletions plugins/soniox/etc/agents-plugin-soniox.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export interface STTOptions {
enableLanguageIdentification: boolean;
// (undocumented)
enableSpeakerDiarization: boolean;
endpointSensitivity?: number;
// (undocumented)
languageHints?: string[];
// (undocumented)
Expand Down
12 changes: 10 additions & 2 deletions plugins/soniox/src/stt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,22 @@ export interface STTOptions {
enableLanguageIdentification: boolean;
/** Maximum delay in milliseconds between speech cessation and endpoint detection. */
maxEndpointDelayMs: number;
/** How readily the model emits speech endpoints. Range: -1.0 to 1.0. */
endpointSensitivity?: number;
clientReferenceId?: string;
translation?: TranslationConfig;
}

const defaultSTTOptions: STTOptions = {
apiKey: process.env.SONIOX_API_KEY,
baseUrl: BASE_URL,
model: 'stt-rt-v4',
model: 'stt-rt-v5',
languageHintsStrict: false,
numChannels: 1,
sampleRate: 16000,
enableSpeakerDiarization: false,
enableLanguageIdentification: true,
maxEndpointDelayMs: 500,
maxEndpointDelayMs: 2000,
Comment on lines +86 to +92

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.

🚩 Breaking default changes: model and maxEndpointDelayMs

The default model changes from stt-rt-v4 to stt-rt-v5 and maxEndpointDelayMs changes from 500 to 2000 (a 4x increase). These are significant behavioral changes for existing users relying on defaults — the endpoint detection delay will be much longer, which affects perceived latency in voice applications. Since the changeset marks this as minor, users upgrading without reading the changelog may be surprised by the different endpointing behavior. Consider whether this warrants a callout in the changeset description or whether users of stt-rt-v4 should be guided to pin their model explicitly.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

};

/** @public */
Expand All @@ -103,6 +105,11 @@ export class STT extends stt.STT {
if (merged.maxEndpointDelayMs < 500 || merged.maxEndpointDelayMs > 3000) {
throw new Error('maxEndpointDelayMs must be between 500 and 3000');
}
if (merged.endpointSensitivity !== undefined) {
if (merged.endpointSensitivity < -1.0 || merged.endpointSensitivity > 1.0) {
throw new Error('endpointSensitivity must be between -1.0 and 1.0');
}
}

super({
streaming: true,
Expand Down Expand Up @@ -207,6 +214,7 @@ export class SpeechStream extends stt.SpeechStream {
enable_language_identification: this.#opts.enableLanguageIdentification,
client_reference_id: this.#opts.clientReferenceId,
max_endpoint_delay_ms: this.#opts.maxEndpointDelayMs,
endpoint_sensitivity: this.#opts.endpointSensitivity,
};

if (this.#opts.translation) {
Expand Down