Use more flexibile aggregator

This commit is contained in:
Moishe Lettvin
2024-01-22 16:02:35 -05:00
parent 95c92e5304
commit 3fda9b0ecb
3 changed files with 32 additions and 35 deletions

View File

@@ -6,10 +6,7 @@ import urllib.parse
from dailyai.services.daily_transport_service import DailyTransportService
from dailyai.services.azure_ai_services import AzureLLMService, AzureTTSService
from dailyai.queue_aggregators import (
TranscriptionToLLMMessageAggregator,
LLMResponseToLLMMessageAggregator,
)
from dailyai.queue_aggregators import LLMContextAggregator
async def main(room_url:str, token):
global transport
@@ -38,8 +35,12 @@ async def main(room_url:str, token):
{"role": "system", "content": "You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be converted to audio. Respond to what the user said in a creative and helpful way."},
]
tma_in = TranscriptionToLLMMessageAggregator(messages, transport.my_participant_id)
tma_out = LLMResponseToLLMMessageAggregator(messages)
tma_in = LLMContextAggregator(
messages, "user", transport.my_participant_id
)
tma_out = LLMContextAggregator(
messages, "assistant", transport.my_participant_id
)
await tts.run_to_queue(
transport.send_queue,
tma_out.run(