From bf28e51c0f0bc5a11d8d9bac15d5e5f7e5f68f76 Mon Sep 17 00:00:00 2001 From: AssemblyAI Date: Wed, 4 Mar 2026 16:34:17 -0500 Subject: [PATCH] Project import generated by Copybara. GitOrigin-RevId: 5eb0c6e27ef41a25504443eb3ec77096b1164104 --- CHANGELOG.md | 2 +- package.json | 2 +- src/services/streaming/service.ts | 12 +++++------- src/types/streaming/index.ts | 2 +- tests/unit/streaming.test.ts | 9 ++++++--- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10c09f3..f423c72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ - Add `language_confidence_threshold` to `Transcript`, `TranscriptParams`, and `TranscriptOptionalParams`. > The confidence threshold for the automatically detected language. - > An error will be returned if the langauge confidence is below this threshold. + > An error will be returned if the language confidence is below this threshold. - Add `language_confidence` to `Transcript` > The confidence score for the detected language, between 0.0 (low confidence) and 1.0 (high confidence) diff --git a/package.json b/package.json index bb52c44..5b772b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "assemblyai", - "version": "4.25.1", + "version": "4.26.0", "description": "The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, as well as the latest LeMUR models.", "engines": { "node": ">=18" diff --git a/src/services/streaming/service.ts b/src/services/streaming/service.ts index 8012915..e332186 100644 --- a/src/services/streaming/service.ts +++ b/src/services/streaming/service.ts @@ -142,14 +142,12 @@ export class StreamingTranscriber { ); } - if (this.params.speechModel) { - if (this.params.speechModel === "u3-pro") { - console.warn( - "[Deprecation Warning] The speech model `u3-pro` is deprecated and will be removed in a future release. Please use `u3-rt-pro` instead.", - ); - } - searchParams.set("speech_model", this.params.speechModel.toString()); + if (this.params.speechModel === "u3-pro") { + console.warn( + "[Deprecation Warning] The speech model `u3-pro` is deprecated and will be removed in a future release. Please use `u3-rt-pro` instead.", + ); } + searchParams.set("speech_model", this.params.speechModel.toString()); if (this.params.languageDetection !== undefined) { searchParams.set( diff --git a/src/types/streaming/index.ts b/src/types/streaming/index.ts index 953ef28..31a13de 100644 --- a/src/types/streaming/index.ts +++ b/src/types/streaming/index.ts @@ -19,7 +19,7 @@ export type StreamingTranscriberParams = { keyterms?: string[]; keytermsPrompt?: string[]; prompt?: string; - speechModel?: StreamingSpeechModel; + speechModel: StreamingSpeechModel; languageDetection?: boolean; inactivityTimeout?: number; speakerLabels?: boolean; diff --git a/tests/unit/streaming.test.ts b/tests/unit/streaming.test.ts index 01a498d..f0a2885 100644 --- a/tests/unit/streaming.test.ts +++ b/tests/unit/streaming.test.ts @@ -46,6 +46,7 @@ describe("streaming", () => { websocketBaseUrl: websocketBaseUrl, apiKey: "123", sampleRate: 16_000, + speechModel: "universal-streaming-english", }); onOpen = jest.fn(); rt.on("open", onOpen); @@ -64,12 +65,13 @@ describe("streaming", () => { await cleanup(); WS.clean(); - const wsUrl = `${websocketBaseUrl}?token=123&sample_rate=16000&speaker_labels=true`; + const wsUrl = `${websocketBaseUrl}?token=123&sample_rate=16000&speech_model=universal-streaming-english&speaker_labels=true`; server = new WS(wsUrl); rt = new StreamingTranscriber({ websocketBaseUrl, token: "123", sampleRate: 16_000, + speechModel: "universal-streaming-english", speakerLabels: true, }); onOpen = jest.fn(); @@ -81,12 +83,13 @@ describe("streaming", () => { await cleanup(); WS.clean(); - const wsUrl = `${websocketBaseUrl}?token=123&sample_rate=16000&speaker_labels=true&max_speakers=4`; + const wsUrl = `${websocketBaseUrl}?token=123&sample_rate=16000&speech_model=universal-streaming-english&speaker_labels=true&max_speakers=4`; server = new WS(wsUrl); rt = new StreamingTranscriber({ websocketBaseUrl, token: "123", sampleRate: 16_000, + speechModel: "universal-streaming-english", speakerLabels: true, maxSpeakers: 4, }); @@ -105,7 +108,7 @@ describe("streaming", () => { websocketBaseUrl, token: "123", sampleRate: 16_000, - speechModel: "whisper-rt", + speechModel: "whisper-rt" as const, }); onOpen = jest.fn(); rt.on("open", onOpen);