@livekit/agents-plugin-assemblyai 0.0.0-next-20260624041820

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/stt.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { VAD } from '@livekit/agents-plugin-silero';\nimport { stt } from '@livekit/agents-plugins-test';\nimport { describe, expect, it } from 'vitest';\nimport { STT } from './stt.js';\n\ndescribe('AssemblyAI options', () => {\n it('accepts u3-rt-pro-beta-1', () => {\n const stt = new STT({ apiKey: 'test-key', speechModel: 'u3-rt-pro-beta-1' });\n\n expect(stt.model).toBe('u3-rt-pro-beta-1');\n });\n\n it('accepts u3-pro parameters for u3-rt-pro-beta-1', () => {\n expect(\n () =>\n new STT({\n apiKey: 'test-key',\n speechModel: 'u3-rt-pro-beta-1',\n prompt: 'medical dictation',\n agentContext: \"The agent asked for the patient's name.\",\n previousContextNTurns: 10,\n }),\n ).not.toThrow();\n });\n\n it('requires a u3-rt-pro model for agentContext', () => {\n expect(\n () =>\n new STT({\n apiKey: 'test-key',\n speechModel: 'universal-streaming-english',\n agentContext: 'hello',\n }),\n ).toThrow(/agentContext/);\n });\n\n it('requires a u3-rt-pro model for previousContextNTurns', () => {\n expect(\n () =>\n new STT({\n apiKey: 'test-key',\n speechModel: 'universal-streaming-english',\n previousContextNTurns: 5,\n }),\n ).toThrow(/previousContextNTurns/);\n });\n});\n\nconst hasAssemblyAIApiKey = Boolean(process.env.ASSEMBLYAI_API_KEY);\n\nif (hasAssemblyAIApiKey) {\n describe('AssemblyAI', async () => {\n await stt(new STT(), await VAD.load(), { nonStreaming: false });\n });\n} else {\n describe('AssemblyAI', () => {\n it.skip('requires ASSEMBLYAI_API_KEY', () => {});\n });\n}\n"],"mappings":";AAGA,kCAAoB;AACpB,iCAAoB;AACpB,oBAAqC;AACrC,i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.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stt.test.d.ts","sourceRoot":"","sources":["../src/stt.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,51 @@
1
+ import { VAD } from "@livekit/agents-plugin-silero";
2
+ import { stt } from "@livekit/agents-plugins-test";
3
+ import { describe, expect, it } from "vitest";
4
+ import { STT } from "./stt.js";
5
+ describe("AssemblyAI options", () => {
6
+ it("accepts u3-rt-pro-beta-1", () => {
7
+ const stt2 = new STT({ apiKey: "test-key", speechModel: "u3-rt-pro-beta-1" });
8
+ expect(stt2.model).toBe("u3-rt-pro-beta-1");
9
+ });
10
+ it("accepts u3-pro parameters for u3-rt-pro-beta-1", () => {
11
+ expect(
12
+ () => new STT({
13
+ apiKey: "test-key",
14
+ speechModel: "u3-rt-pro-beta-1",
15
+ prompt: "medical dictation",
16
+ agentContext: "The agent asked for the patient's name.",
17
+ previousContextNTurns: 10
18
+ })
19
+ ).not.toThrow();
20
+ });
21
+ it("requires a u3-rt-pro model for agentContext", () => {
22
+ expect(
23
+ () => new STT({
24
+ apiKey: "test-key",
25
+ speechModel: "universal-streaming-english",
26
+ agentContext: "hello"
27
+ })
28
+ ).toThrow(/agentContext/);
29
+ });
30
+ it("requires a u3-rt-pro model for previousContextNTurns", () => {
31
+ expect(
32
+ () => new STT({
33
+ apiKey: "test-key",
34
+ speechModel: "universal-streaming-english",
35
+ previousContextNTurns: 5
36
+ })
37
+ ).toThrow(/previousContextNTurns/);
38
+ });
39
+ });
40
+ const hasAssemblyAIApiKey = Boolean(process.env.ASSEMBLYAI_API_KEY);
41
+ if (hasAssemblyAIApiKey) {
42
+ describe("AssemblyAI", async () => {
43
+ await stt(new STT(), await VAD.load(), { nonStreaming: false });
44
+ });
45
+ } else {
46
+ describe("AssemblyAI", () => {
47
+ it.skip("requires ASSEMBLYAI_API_KEY", () => {
48
+ });
49
+ });
50
+ }
51
+ //# sourceMappingURL=stt.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/stt.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { VAD } from '@livekit/agents-plugin-silero';\nimport { stt } from '@livekit/agents-plugins-test';\nimport { describe, expect, it } from 'vitest';\nimport { STT } from './stt.js';\n\ndescribe('AssemblyAI options', () => {\n it('accepts u3-rt-pro-beta-1', () => {\n const stt = new STT({ apiKey: 'test-key', speechModel: 'u3-rt-pro-beta-1' });\n\n expect(stt.model).toBe('u3-rt-pro-beta-1');\n });\n\n it('accepts u3-pro parameters for u3-rt-pro-beta-1', () => {\n expect(\n () =>\n new STT({\n apiKey: 'test-key',\n speechModel: 'u3-rt-pro-beta-1',\n prompt: 'medical dictation',\n agentContext: \"The agent asked for the patient's name.\",\n previousContextNTurns: 10,\n }),\n ).not.toThrow();\n });\n\n it('requires a u3-rt-pro model for agentContext', () => {\n expect(\n () =>\n new STT({\n apiKey: 'test-key',\n speechModel: 'universal-streaming-english',\n agentContext: 'hello',\n }),\n ).toThrow(/agentContext/);\n });\n\n it('requires a u3-rt-pro model for previousContextNTurns', () => {\n expect(\n () =>\n new STT({\n apiKey: 'test-key',\n speechModel: 'universal-streaming-english',\n previousContextNTurns: 5,\n }),\n ).toThrow(/previousContextNTurns/);\n });\n});\n\nconst hasAssemblyAIApiKey = Boolean(process.env.ASSEMBLYAI_API_KEY);\n\nif (hasAssemblyAIApiKey) {\n describe('AssemblyAI', async () => {\n await stt(new STT(), await VAD.load(), { nonStreaming: false });\n });\n} else {\n describe('AssemblyAI', () => {\n it.skip('requires ASSEMBLYAI_API_KEY', () => {});\n });\n}\n"],"mappings":"AAGA,SAAS,WAAW;AACpB,SAAS,WAAW;AACpB,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,WAAW;AAEpB,SAAS,sBAAsB,MAAM;AACnC,KAAG,4BAA4B,MAAM;AACnC,UAAMA,OAAM,IAAI,IAAI,EAAE,QAAQ,YAAY,aAAa,mBAAmB,CAAC;AAE3E,WAAOA,KAAI,KAAK,EAAE,KAAK,kBAAkB;AAAA,EAC3C,CAAC;AAED,KAAG,kDAAkD,MAAM;AACzD;AAAA,MACE,MACE,IAAI,IAAI;AAAA,QACN,QAAQ;AAAA,QACR,aAAa;AAAA,QACb,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,uBAAuB;AAAA,MACzB,CAAC;AAAA,IACL,EAAE,IAAI,QAAQ;AAAA,EAChB,CAAC;AAED,KAAG,+CAA+C,MAAM;AACtD;AAAA,MACE,MACE,IAAI,IAAI;AAAA,QACN,QAAQ;AAAA,QACR,aAAa;AAAA,QACb,cAAc;AAAA,MAChB,CAAC;AAAA,IACL,EAAE,QAAQ,cAAc;AAAA,EAC1B,CAAC;AAED,KAAG,wDAAwD,MAAM;AAC/D;AAAA,MACE,MACE,IAAI,IAAI;AAAA,QACN,QAAQ;AAAA,QACR,aAAa;AAAA,QACb,uBAAuB;AAAA,MACzB,CAAC;AAAA,IACL,EAAE,QAAQ,uBAAuB;AAAA,EACnC,CAAC;AACH,CAAC;AAED,MAAM,sBAAsB,QAAQ,QAAQ,IAAI,kBAAkB;AAElE,IAAI,qBAAqB;AACvB,WAAS,cAAc,YAAY;AACjC,UAAM,IAAI,IAAI,IAAI,GAAG,MAAM,IAAI,KAAK,GAAG,EAAE,cAAc,MAAM,CAAC;AAAA,EAChE,CAAC;AACH,OAAO;AACL,WAAS,cAAc,MAAM;AAC3B,OAAG,KAAK,+BAA+B,MAAM;AAAA,IAAC,CAAC;AAAA,EACjD,CAAC;AACH;","names":["stt"]}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@livekit/agents-plugin-assemblyai",
3
+ "version": "0.0.0-next-20260624041820",
4
+ "description": "AssemblyAI plugin for LiveKit Agents for Node.js",
5
+ "main": "dist/index.js",
6
+ "require": "dist/index.cjs",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ "import": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "require": {
14
+ "types": "./dist/index.d.cts",
15
+ "default": "./dist/index.cjs"
16
+ }
17
+ },
18
+ "author": "LiveKit",
19
+ "type": "module",
20
+ "repository": "git@github.com:livekit/agents-js.git",
21
+ "license": "Apache-2.0",
22
+ "files": [
23
+ "dist",
24
+ "src",
25
+ "README.md"
26
+ ],
27
+ "devDependencies": {
28
+ "@livekit/rtc-node": "^0.13.29",
29
+ "@microsoft/api-extractor": "^7.35.0",
30
+ "@types/ws": "^8.5.10",
31
+ "tsup": "^8.3.5",
32
+ "typescript": "^5.0.0",
33
+ "@livekit/agents": "0.0.0-next-20260624041820",
34
+ "@livekit/agents-plugins-test": "0.0.0-next-20260624041820",
35
+ "@livekit/agents-plugin-silero": "0.0.0-next-20260624041820"
36
+ },
37
+ "dependencies": {
38
+ "ws": "^8.16.0"
39
+ },
40
+ "peerDependencies": {
41
+ "@livekit/rtc-node": "^0.13.29",
42
+ "@livekit/agents": "0.0.0-next-20260624041820"
43
+ },
44
+ "scripts": {
45
+ "build": "tsup --onSuccess \"pnpm build:types\"",
46
+ "build:types": "tsc --declaration --emitDeclarationOnly && node ../../scripts/copyDeclarationOutput.js",
47
+ "clean": "rm -rf dist",
48
+ "clean:build": "pnpm clean && pnpm build",
49
+ "lint": "eslint -f unix \"src/**/*.{ts,js}\"",
50
+ "api:check": "api-extractor run --typescript-compiler-folder ../../node_modules/typescript",
51
+ "api:update": "api-extractor run --local --typescript-compiler-folder ../../node_modules/typescript --verbose"
52
+ }
53
+ }
package/src/index.ts ADDED
@@ -0,0 +1,19 @@
1
+ // SPDX-FileCopyrightText: 2026 LiveKit, Inc.
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ import { Plugin } from '@livekit/agents';
5
+
6
+ export * from './models.js';
7
+ export * from './stt.js';
8
+
9
+ class AssemblyAIPlugin extends Plugin {
10
+ constructor() {
11
+ super({
12
+ title: 'assemblyai',
13
+ version: __PACKAGE_VERSION__,
14
+ package: __PACKAGE_NAME__,
15
+ });
16
+ }
17
+ }
18
+
19
+ Plugin.registerPlugin(new AssemblyAIPlugin());
package/src/models.ts ADDED
@@ -0,0 +1,18 @@
1
+ // SPDX-FileCopyrightText: 2026 LiveKit, Inc.
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+
5
+ export type STTModels =
6
+ | 'universal-streaming-english'
7
+ | 'universal-streaming-multilingual'
8
+ | 'u3-rt-pro'
9
+ | 'u3-rt-pro-beta-1'
10
+ | 'universal-3-5-pro'
11
+ // Deprecated alias — AssemblyAI maps this to `u3-rt-pro` server-side, but the
12
+ // Python plugin emits a warning and rewrites it. Kept here so TS users don't
13
+ // break if they already pass it.
14
+ | 'u3-pro';
15
+
16
+ export type STTEncoding = 'pcm_s16le' | 'pcm_mulaw';
17
+
18
+ export type VoiceFocus = 'near-field' | 'far-field';
@@ -0,0 +1,62 @@
1
+ // SPDX-FileCopyrightText: 2026 LiveKit, Inc.
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ import { VAD } from '@livekit/agents-plugin-silero';
5
+ import { stt } from '@livekit/agents-plugins-test';
6
+ import { describe, expect, it } from 'vitest';
7
+ import { STT } from './stt.js';
8
+
9
+ describe('AssemblyAI options', () => {
10
+ it('accepts u3-rt-pro-beta-1', () => {
11
+ const stt = new STT({ apiKey: 'test-key', speechModel: 'u3-rt-pro-beta-1' });
12
+
13
+ expect(stt.model).toBe('u3-rt-pro-beta-1');
14
+ });
15
+
16
+ it('accepts u3-pro parameters for u3-rt-pro-beta-1', () => {
17
+ expect(
18
+ () =>
19
+ new STT({
20
+ apiKey: 'test-key',
21
+ speechModel: 'u3-rt-pro-beta-1',
22
+ prompt: 'medical dictation',
23
+ agentContext: "The agent asked for the patient's name.",
24
+ previousContextNTurns: 10,
25
+ }),
26
+ ).not.toThrow();
27
+ });
28
+
29
+ it('requires a u3-rt-pro model for agentContext', () => {
30
+ expect(
31
+ () =>
32
+ new STT({
33
+ apiKey: 'test-key',
34
+ speechModel: 'universal-streaming-english',
35
+ agentContext: 'hello',
36
+ }),
37
+ ).toThrow(/agentContext/);
38
+ });
39
+
40
+ it('requires a u3-rt-pro model for previousContextNTurns', () => {
41
+ expect(
42
+ () =>
43
+ new STT({
44
+ apiKey: 'test-key',
45
+ speechModel: 'universal-streaming-english',
46
+ previousContextNTurns: 5,
47
+ }),
48
+ ).toThrow(/previousContextNTurns/);
49
+ });
50
+ });
51
+
52
+ const hasAssemblyAIApiKey = Boolean(process.env.ASSEMBLYAI_API_KEY);
53
+
54
+ if (hasAssemblyAIApiKey) {
55
+ describe('AssemblyAI', async () => {
56
+ await stt(new STT(), await VAD.load(), { nonStreaming: false });
57
+ });
58
+ } else {
59
+ describe('AssemblyAI', () => {
60
+ it.skip('requires ASSEMBLYAI_API_KEY', () => {});
61
+ });
62
+ }