@@ -14,14 +14,11 @@ import {
1414} from '@livekit/agents' ;
1515import * as livekit from '@livekit/agents-plugin-livekit' ;
1616import * as silero from '@livekit/agents-plugin-silero' ;
17- import { BackgroundVoiceCancellation } from '@livekit/noise-cancellation-node ' ;
17+ import * as aic from '@livekit/plugins-ai-coustics ' ;
1818import { fileURLToPath } from 'node:url' ;
1919import { z } from 'zod' ;
2020
2121export 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