Skip to content

Commit 03caaa3

Browse files
committed
use ai-coustics vad and audio enhancer!
1 parent 7ff548f commit 03caaa3

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

examples/src/basic_agent.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@ import {
1414
} from '@livekit/agents';
1515
import * as livekit from '@livekit/agents-plugin-livekit';
1616
import * as silero from '@livekit/agents-plugin-silero';
17-
import { BackgroundVoiceCancellation } from '@livekit/noise-cancellation-node';
17+
import * as aic from '@livekit/plugins-ai-coustics';
1818
import { fileURLToPath } from 'node:url';
1919
import { z } from 'zod';
2020

2121
export default defineAgent({
22-
prewarm: async (proc: JobProcess) => {
23-
proc.userData.vad = await silero.VAD.load();
24-
},
2522
entry: async (ctx: JobContext) => {
2623
const agent = new voice.Agent({
2724
instructions:
@@ -63,7 +60,7 @@ export default defineAgent({
6360
}),
6461
// VAD and turn detection are used to determine when the user is speaking and when the agent should respond
6562
// See more at https://docs.livekit.io/agents/build/turns
66-
vad: ctx.proc.userData.vad! as silero.VAD,
63+
vad: aic.vad(),
6764
turnDetection: new livekit.turnDetector.MultilingualModel(),
6865
// to use realtime model, replace the stt, llm, tts and vad with the following
6966
// llm: new openai.realtime.RealtimeModel(),
@@ -93,7 +90,7 @@ export default defineAgent({
9390
agent,
9491
room: ctx.room,
9592
inputOptions: {
96-
noiseCancellation: BackgroundVoiceCancellation(),
93+
noiseCancellation: aic.audioEnhancement(),
9794
},
9895
});
9996

0 commit comments

Comments
 (0)