diff --git a/CHANGELOG.md b/CHANGELOG.md index d67417b..059466b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [4.43.4] + +- Add `assemblyai-stt-3-7-realtime` (note taking) and `assemblyai-stt-3-7-realtime-agent` (voice agents) to the streaming `speechModel` options (`StreamingSpeechModel`) +- Add `"manual"` to the streaming `StreamingMode` type: the client ends each turn with `forceEndpoint()`. Only `assemblyai-stt-3-7-realtime-agent` supports it + ## [4.43.3] - `StreamingTranscriber` emits a `termination` event with the server's `Termination` message (`TerminationEvent`: `audio_duration_seconds`, `session_duration_seconds`), and `close()` resolves with it, or with `undefined` when it did not wait for the message or the message did not arrive before the timeout or the socket closed. `close()` now calls the `close` listener for a client-initiated close (code `1000`, reason `"Session ended"` or `"Closed by the client"`) before it clears the listeners; it is called once per session. Code that types `close()`'s result as `Promise` must widen it to `Promise` diff --git a/package.json b/package.json index 4d8c9b2..392e231 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "assemblyai", - "version": "4.43.3", + "version": "4.43.4", "description": "The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription and text-to-speech.", "engines": { "node": ">=18" diff --git a/src/types/streaming/index.ts b/src/types/streaming/index.ts index 93b7951..1827f16 100644 --- a/src/types/streaming/index.ts +++ b/src/types/streaming/index.ts @@ -234,11 +234,17 @@ export type StreamingSpeechModel = | "universal-3-5-pro" | "universal-3-6" | "universal-3-6-pro" + | "assemblyai-stt-3-7-realtime" + | "assemblyai-stt-3-7-realtime-agent" | "u3-pro"; export type StreamingDomain = "medical-v1" | "veterinary-v1"; -export type StreamingMode = "max_accuracy" | "min_latency" | "balanced"; +export type StreamingMode = + | "max_accuracy" + | "min_latency" + | "balanced" + | "manual"; export type VoiceFocusModel = "near-field" | "far-field"; diff --git a/tests/unit/streaming.test.ts b/tests/unit/streaming.test.ts index 77f20e4..5eee242 100644 --- a/tests/unit/streaming.test.ts +++ b/tests/unit/streaming.test.ts @@ -399,6 +399,24 @@ describe("streaming", () => { await connect(rt, server); }); + it("should include mode=manual in connection URL", async () => { + await cleanup(); + WS.clean(); + + const wsUrl = `${websocketBaseUrl}?token=123&sample_rate=16000&speech_model=assemblyai-stt-3-7-realtime-agent&mode=manual`; + server = new WS(wsUrl); + rt = new StreamingTranscriber({ + websocketBaseUrl, + token: "123", + sampleRate: 16_000, + speechModel: "assemblyai-stt-3-7-realtime-agent", + mode: "manual", + }); + onOpen = jest.fn(); + rt.on("open", onOpen); + await connect(rt, server); + }); + it.each(["medical-v1", "veterinary-v1"] as const)( "should include domain=%s in connection URL", async (domain) => { @@ -597,6 +615,40 @@ describe("streaming", () => { await connect(rt, server); }); + it("should include assemblyai-stt-3-7-realtime speech model in connection URL", async () => { + await cleanup(); + WS.clean(); + + const wsUrl = `${websocketBaseUrl}?token=123&sample_rate=16000&speech_model=assemblyai-stt-3-7-realtime`; + server = new WS(wsUrl); + rt = new StreamingTranscriber({ + websocketBaseUrl, + token: "123", + sampleRate: 16_000, + speechModel: "assemblyai-stt-3-7-realtime" as const, + }); + onOpen = jest.fn(); + rt.on("open", onOpen); + await connect(rt, server); + }); + + it("should include assemblyai-stt-3-7-realtime-agent speech model in connection URL", async () => { + await cleanup(); + WS.clean(); + + const wsUrl = `${websocketBaseUrl}?token=123&sample_rate=16000&speech_model=assemblyai-stt-3-7-realtime-agent`; + server = new WS(wsUrl); + rt = new StreamingTranscriber({ + websocketBaseUrl, + token: "123", + sampleRate: 16_000, + speechModel: "assemblyai-stt-3-7-realtime-agent" as const, + }); + onOpen = jest.fn(); + rt.on("open", onOpen); + await connect(rt, server); + }); + it("should parse speaker_label from turn event", async () => { const turnPromise = new Promise<{ speaker_label?: string }>((resolve) => { rt.on("turn", (event) => resolve(event));