@livekit/agents-plugin-silero 0.4.6 → 0.5.0
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.
- package/README.md +17 -0
- package/dist/index.cjs +31 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/onnx_model.cjs +95 -0
- package/dist/onnx_model.cjs.map +1 -0
- package/dist/onnx_model.d.ts.map +1 -1
- package/dist/onnx_model.js +64 -65
- package/dist/onnx_model.js.map +1 -1
- package/dist/onnxruntime.d.cjs +2 -0
- package/dist/onnxruntime.d.cjs.map +1 -0
- package/dist/onnxruntime.d.js +1 -0
- package/dist/onnxruntime.d.js.map +1 -0
- package/dist/vad.cjs +285 -0
- package/dist/vad.cjs.map +1 -0
- package/dist/vad.d.ts +1 -1
- package/dist/vad.d.ts.map +1 -1
- package/dist/vad.js +261 -244
- package/dist/vad.js.map +1 -1
- package/package.json +18 -8
- package/src/onnx_model.ts +2 -1
- package/src/vad.ts +4 -3
package/package.json
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livekit/agents-plugin-silero",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Silero voice activity detection LiveKit Node Agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"require": "dist/index.cjs",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
7
15
|
"author": "LiveKit",
|
|
8
16
|
"type": "module",
|
|
9
17
|
"repository": "git@github.com:livekit/agents-js.git",
|
|
10
18
|
"license": "Apache-2.0",
|
|
11
19
|
"files": [
|
|
12
20
|
"dist",
|
|
13
|
-
"src"
|
|
21
|
+
"src",
|
|
22
|
+
"README.md"
|
|
14
23
|
],
|
|
15
24
|
"devDependencies": {
|
|
25
|
+
"@livekit/agents": "^x",
|
|
26
|
+
"@livekit/rtc-node": "^0.12.1",
|
|
16
27
|
"@microsoft/api-extractor": "^7.35.0",
|
|
17
|
-
"@livekit/rtc-node": "^0.11.1",
|
|
18
28
|
"@types/ws": "^8.5.10",
|
|
19
29
|
"onnxruntime-common": "^1.19.2",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
30
|
+
"tsup": "^8.3.5",
|
|
31
|
+
"typescript": "^5.0.0"
|
|
22
32
|
},
|
|
23
33
|
"dependencies": {
|
|
24
34
|
"onnxruntime-node": "^1.19.2",
|
|
25
35
|
"ws": "^8.16.0"
|
|
26
36
|
},
|
|
27
37
|
"peerDependencies": {
|
|
28
|
-
"@livekit/rtc-node": "^0.
|
|
29
|
-
"@livekit/agents": "^0.
|
|
38
|
+
"@livekit/rtc-node": "^0.12.1",
|
|
39
|
+
"@livekit/agents": "^0.5.0x"
|
|
30
40
|
},
|
|
31
41
|
"scripts": {
|
|
32
|
-
"build": "tsc && cp src
|
|
42
|
+
"build": "tsup --onSuccess \"tsc --declaration --emitDeclarationOnly\" && cp src/silero_vad.onnx dist/",
|
|
33
43
|
"clean": "rm -rf dist",
|
|
34
44
|
"clean:build": "pnpm clean && pnpm build",
|
|
35
45
|
"lint": "eslint -f unix \"src/**/*.{ts,js}\"",
|
package/src/onnx_model.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
4
5
|
import { InferenceSession, Tensor } from 'onnxruntime-node';
|
|
5
6
|
|
|
6
7
|
export type SampleRate = 8000 | 16000;
|
|
7
8
|
|
|
8
9
|
export const newInferenceSession = (forceCPU: boolean) => {
|
|
9
|
-
return InferenceSession.create(new URL('silero_vad.onnx', import.meta.url).
|
|
10
|
+
return InferenceSession.create(fileURLToPath(new URL('silero_vad.onnx', import.meta.url).href), {
|
|
10
11
|
interOpNumThreads: 1,
|
|
11
12
|
intraOpNumThreads: 1,
|
|
12
13
|
executionMode: 'sequential',
|
package/src/vad.ts
CHANGED
|
@@ -79,9 +79,10 @@ export class VAD extends baseVAD {
|
|
|
79
79
|
* @param options -
|
|
80
80
|
* @returns Promise\<{@link VAD}\>: An instance of the VAD class ready for streaming.
|
|
81
81
|
*/
|
|
82
|
-
static async load(opts =
|
|
83
|
-
const
|
|
84
|
-
|
|
82
|
+
static async load(opts: Partial<VADOptions> = {}): Promise<VAD> {
|
|
83
|
+
const mergedOpts: VADOptions = { ...defaultVADOptions, ...opts };
|
|
84
|
+
const session = await newInferenceSession(mergedOpts.forceCPU);
|
|
85
|
+
return new VAD(session, mergedOpts);
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
stream(): VADStream {
|