something is up with transcription, trying to figure it out
This commit is contained in:
@@ -5,10 +5,9 @@ from asyncio.queues import Queue
|
||||
import re
|
||||
|
||||
from dailyai.output_queue import OutputQueueFrame, FrameType
|
||||
from dailyai.services.azure_ai_services import AzureLLMService, AzureTTSService
|
||||
from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService
|
||||
from dailyai.services.open_ai_services import OpenAILLMService, OpenAIImageGenService
|
||||
from dailyai.services.azure_ai_services import AzureLLMService
|
||||
from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService
|
||||
from dailyai.services.open_ai_services import OpenAIImageGenService
|
||||
from dailyai.services.daily_transport_service import DailyTransportService
|
||||
|
||||
async def main(room_url):
|
||||
@@ -89,6 +88,9 @@ async def main(room_url):
|
||||
if participant["id"] == transport.my_participant_id:
|
||||
return
|
||||
|
||||
# This will play the months in the order they're completed. The benefit
|
||||
# is we'll have as little delay as possible before the first month, and
|
||||
# likely no delay between months, but the months won't display in order.
|
||||
for month_data_task in asyncio.as_completed(month_tasks):
|
||||
data = await month_data_task
|
||||
transport.output_queue.put(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import argparse
|
||||
import asyncio
|
||||
import requests
|
||||
import time
|
||||
import urllib.parse
|
||||
|
||||
from dailyai.services.daily_transport_service import DailyTransportService
|
||||
from dailyai.services.azure_ai_services import AzureLLMService, AzureTTSService
|
||||
@@ -14,7 +16,7 @@ async def main(room_url:str, token):
|
||||
transport = DailyTransportService(
|
||||
room_url,
|
||||
token,
|
||||
"Say Two Things Bot",
|
||||
"Respond bot",
|
||||
1,
|
||||
)
|
||||
transport.mic_enabled = True
|
||||
@@ -24,34 +26,37 @@ async def main(room_url:str, token):
|
||||
llm = AzureLLMService()
|
||||
tts = AzureTTSService()
|
||||
|
||||
transcribed_message = ""
|
||||
transcription_timeout = None
|
||||
"""
|
||||
@transport.event_handler("on_participant_joined")
|
||||
async def on_joined(transport, participant):
|
||||
if participant["id"] == transport.my_participant_id:
|
||||
return
|
||||
|
||||
# queue two pieces of speech: one specified as a text literal,
|
||||
# and one generated by an llm. We'll kick off the llm first, and let
|
||||
# it generate a response while we're speaking the literal string.
|
||||
llm_response_task = asyncio.create_task(llm.run_llm(
|
||||
[{"role": "system", "content": "tell the user a joke about llamas"}]
|
||||
))
|
||||
|
||||
async for audio_chunk in tts.run_tts("My friend the LLM is now going to tell a joke about llamas."):
|
||||
async for audio_chunk in tts.run_tts("If you say something, I will respond."):
|
||||
transport.output_queue.put(OutputQueueFrame(FrameType.AUDIO_FRAME, audio_chunk))
|
||||
|
||||
llm_response = await llm_response_task
|
||||
async for audio_chunk in tts.run_tts(llm_response):
|
||||
transport.output_queue.put(OutputQueueFrame(FrameType.AUDIO_FRAME, audio_chunk))
|
||||
|
||||
# wait for the output queue to be empty, then leave the meeting
|
||||
transport.output_queue.join()
|
||||
transport.stop()
|
||||
|
||||
@transport.event_handler("on_transcription_message")
|
||||
async def on_transcription_message(transport, message) -> None:
|
||||
print("message received", message)
|
||||
nonlocal transcribed_message
|
||||
nonlocal transcription_timeout
|
||||
print(message)
|
||||
if message["session_id"] != transport.my_participant_id:
|
||||
transcribed_message += message['text']
|
||||
|
||||
await transport.run()
|
||||
print("message received", transcribed_message)
|
||||
|
||||
@transport.event_handler("on_transcription_error")
|
||||
def on_transcription_error(transport, status) -> None:
|
||||
print("transcription error", status)
|
||||
|
||||
@transport.event_handler("on_transcription_started")
|
||||
def on_transcription_started(transport, status) -> None:
|
||||
print("transcription started", status)
|
||||
"""
|
||||
#await transport.run()
|
||||
transport.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user