Isolated changes to add VAD (#32)

* added VAD

* added separate 'vad enabled' property
This commit is contained in:
chadbailey59
2024-02-28 15:16:44 -06:00
committed by GitHub
parent f710aeae95
commit d90fdb1cae
5 changed files with 157 additions and 10 deletions

View File

@@ -3,8 +3,9 @@ import os
from dailyai.services.daily_transport_service import DailyTransportService
from dailyai.services.azure_ai_services import AzureLLMService, AzureTTSService
from dailyai.services.ai_services import FrameLogger
from dailyai.queue_aggregators import LLMAssistantContextAggregator, LLMContextAggregator, LLMUserContextAggregator
from examples.foundational.support.runner import configure
from support.runner import configure
async def main(room_url: str, token):
@@ -16,7 +17,8 @@ async def main(room_url: str, token):
start_transcription=True,
mic_enabled=True,
mic_sample_rate=16000,
camera_enabled=False
camera_enabled=False,
vad_enabled=True
)
llm = AzureLLMService(
@@ -26,7 +28,8 @@ async def main(room_url: str, token):
tts = AzureTTSService(
api_key=os.getenv("AZURE_SPEECH_API_KEY"),
region=os.getenv("AZURE_SPEECH_REGION"))
fl = FrameLogger("Inner")
fl2 = FrameLogger("Outer")
@transport.event_handler("on_first_other_participant_joined")
async def on_first_other_participant_joined(transport):
await tts.say("Hi, I'm listening!", transport.send_queue)
@@ -44,14 +47,20 @@ async def main(room_url: str, token):
await tts.run_to_queue(
transport.send_queue,
tma_out.run(
llm.run(
fl2.run(
llm.run(
tma_in.run(
transport.get_receive_frames()
fl.run(
transport.get_receive_frames()
)
)
)
)
)
)
)
)
transport.transcription_settings["extra"]["endpointing"] = True
transport.transcription_settings["extra"]["punctuate"] = True
await asyncio.gather(transport.run(), handle_transcriptions())