Merge pull request #21 from daily-co/cleanup_constructor_args

Cleanup constructor args in examples
This commit is contained in:
Moishe Lettvin
2024-02-08 09:44:51 -05:00
committed by GitHub
10 changed files with 34 additions and 53 deletions

View File

@@ -23,8 +23,8 @@ async def main(room_url):
None, None,
"Say One Thing", "Say One Thing",
meeting_duration_minutes, meeting_duration_minutes,
mic_enabled=True
) )
transport._mic_enabled = True
tts = ElevenLabsTTSService(aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), voice_id=os.getenv("ELEVENLABS_VOICE_ID")) tts = ElevenLabsTTSService(aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), voice_id=os.getenv("ELEVENLABS_VOICE_ID"))
# Register an event handler so we can play the audio when the participant joins. # Register an event handler so we can play the audio when the participant joins.

View File

@@ -1,4 +1,3 @@
import argparse
import asyncio import asyncio
import os import os
@@ -20,8 +19,8 @@ async def main(room_url):
None, None,
"Say One Thing From an LLM", "Say One Thing From an LLM",
duration_minutes=meeting_duration_minutes, duration_minutes=meeting_duration_minutes,
mic_enabled=True
) )
transport._mic_enabled = True
tts = ElevenLabsTTSService(aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), voice_id=os.getenv("ELEVENLABS_VOICE_ID")) tts = ElevenLabsTTSService(aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), voice_id=os.getenv("ELEVENLABS_VOICE_ID"))
# tts = AzureTTSService(api_key=os.getenv("AZURE_SPEECH_API_KEY"), region=os.getenv("AZURE_SPEECH_REGION")) # tts = AzureTTSService(api_key=os.getenv("AZURE_SPEECH_API_KEY"), region=os.getenv("AZURE_SPEECH_REGION"))

View File

@@ -1,4 +1,3 @@
import argparse
import asyncio import asyncio
import aiohttp import aiohttp
import os import os
@@ -23,11 +22,11 @@ async def main(room_url):
None, None,
"Show a still frame image", "Show a still frame image",
duration_minutes=meeting_duration_minutes, duration_minutes=meeting_duration_minutes,
mic_enabled=False,
camera_enabled=True,
camera_width=1024,
camera_height=1024
) )
transport._mic_enabled = False
transport._camera_enabled = True
transport._camera_width = 1024
transport._camera_height = 1024
imagegen = FalImageGenService(image_size="1024x1024", aiohttp_session=session, key_id=os.getenv("FAL_KEY_ID"), key_secret=os.getenv("FAL_KEY_SECRET")) imagegen = FalImageGenService(image_size="1024x1024", aiohttp_session=session, key_id=os.getenv("FAL_KEY_ID"), key_secret=os.getenv("FAL_KEY_SECRET"))
# imagegen = OpenAIImageGenService(aiohttp_session=session, api_key=os.getenv("OPENAI_DALLE_API_KEY"), image_size="1024x1024") # imagegen = OpenAIImageGenService(aiohttp_session=session, api_key=os.getenv("OPENAI_DALLE_API_KEY"), image_size="1024x1024")

View File

@@ -1,7 +1,5 @@
import argparse
import asyncio import asyncio
import os import os
import re
import aiohttp import aiohttp
@@ -19,10 +17,10 @@ async def main(room_url: str):
None, None,
"Static And Dynamic Speech", "Static And Dynamic Speech",
duration_minutes=1, duration_minutes=1,
mic_enabled=True,
mic_sample_rate=16000,
camera_enabled=False
) )
transport._mic_enabled = True
transport._mic_sample_rate = 16000
transport._camera_enabled = False
llm = AzureLLMService(api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), model=os.getenv("AZURE_CHATGPT_MODEL")) llm = AzureLLMService(api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), model=os.getenv("AZURE_CHATGPT_MODEL"))
azure_tts = AzureTTSService(api_key=os.getenv("AZURE_SPEECH_API_KEY"), region=os.getenv("AZURE_SPEECH_REGION")) azure_tts = AzureTTSService(api_key=os.getenv("AZURE_SPEECH_API_KEY"), region=os.getenv("AZURE_SPEECH_REGION"))

View File

@@ -1,4 +1,3 @@
import argparse
import asyncio import asyncio
import aiohttp import aiohttp
import os import os
@@ -20,12 +19,12 @@ async def main(room_url):
None, None,
"Month Narration Bot", "Month Narration Bot",
duration_minutes=meeting_duration_minutes, duration_minutes=meeting_duration_minutes,
mic_enabled=True,
camera_enabled=True,
mic_sample_rate=16000,
camera_width=1024,
camera_height=1024
) )
transport._mic_enabled = True
transport._camera_enabled = True
transport._mic_sample_rate = 16000
transport._camera_width = 1024
transport._camera_height = 1024
llm = AzureLLMService(api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), model=os.getenv("AZURE_CHATGPT_MODEL")) llm = AzureLLMService(api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), model=os.getenv("AZURE_CHATGPT_MODEL"))
tts = ElevenLabsTTSService(aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), voice_id="ErXwobaYiN019PkySvjV") tts = ElevenLabsTTSService(aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), voice_id="ErXwobaYiN019PkySvjV")

View File

@@ -7,10 +7,6 @@ from dailyai.queue_aggregators import LLMAssistantContextAggregator, LLMContextA
from samples.foundational.support.runner import configure from samples.foundational.support.runner import configure
async def main(room_url: str, token): async def main(room_url: str, token):
global transport
global llm
global tts
transport = DailyTransportService( transport = DailyTransportService(
room_url, room_url,
token, token,

View File

@@ -12,21 +12,17 @@ from samples.foundational.support.runner import configure
async def main(room_url:str): async def main(room_url:str):
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
global transport
global llm
global tts
transport = DailyTransportService( transport = DailyTransportService(
room_url, room_url,
None, None,
"Respond bot", "Respond bot",
duration_minutes=10 duration_minutes=10,
mic_enabled=True,
mic_sample_rate=16000,
camera_enabled=True,
camera_width=1024,
camera_height=1024
) )
transport._mic_enabled = True
transport._mic_sample_rate = 16000
transport._camera_enabled = True
transport._camera_width = 1024
transport._camera_height = 1024
llm = AzureLLMService(api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), model=os.getenv("AZURE_CHATGPT_MODEL")) llm = AzureLLMService(api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), model=os.getenv("AZURE_CHATGPT_MODEL"))
tts1 = AzureTTSService(api_key=os.getenv("AZURE_SPEECH_API_KEY"), region=os.getenv("AZURE_SPEECH_REGION")) tts1 = AzureTTSService(api_key=os.getenv("AZURE_SPEECH_API_KEY"), region=os.getenv("AZURE_SPEECH_REGION"))

View File

@@ -105,16 +105,17 @@ class ImageSyncAggregator(AIService):
async def main(room_url: str, token): async def main(room_url: str, token):
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
global transport
global llm
global tts
transport = DailyTransportService( transport = DailyTransportService(
room_url, room_url,
token, token,
"Santa Cat", "Santa Cat",
duration_minutes=3, duration_minutes=3,
start_transcription=True start_transcription=True,
mic_enabled=True,
mic_sample_rate=16000,
camera_enabled=True,
camera_width=720,
camera_height=1280
) )
transport._mic_enabled = True transport._mic_enabled = True
transport._mic_sample_rate = 16000 transport._mic_sample_rate = 16000

View File

@@ -65,20 +65,15 @@ class InboundSoundEffectWrapper(AIService):
async def main(room_url: str, token): async def main(room_url: str, token):
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
global transport
global llm
global tts
transport = DailyTransportService( transport = DailyTransportService(
room_url, room_url,
token, token,
"Respond bot", "Respond bot",
duration_minutes=5, duration_minutes=5,
mic_enabled=True,
mic_sample_rate=16000,
camera_enabled=False
) )
transport._mic_enabled = True
transport._mic_sample_rate = 16000
transport._camera_enabled = False
llm = AzureLLMService(api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), model=os.getenv("AZURE_CHATGPT_MODEL")) llm = AzureLLMService(api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), model=os.getenv("AZURE_CHATGPT_MODEL"))
tts = ElevenLabsTTSService(aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), voice_id="ErXwobaYiN019PkySvjV") tts = ElevenLabsTTSService(aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), voice_id="ErXwobaYiN019PkySvjV")

View File

@@ -6,18 +6,16 @@ from dailyai.services.whisper_ai_services import WhisperSTTService
from samples.foundational.support.runner import configure from samples.foundational.support.runner import configure
async def main(room_url: str): async def main(room_url: str):
global transport
global stt
transport = DailyTransportService( transport = DailyTransportService(
room_url, room_url,
None, None,
"Transcription bot", "Transcription bot",
start_transcription=True start_transcription=True,
mic_enabled=False,
camera_enabled=False,
speaker_enabled=True
) )
transport._mic_enabled = False
transport._camera_enabled = False
transport._speaker_enabled = True
stt = WhisperSTTService() stt = WhisperSTTService()
transcription_output_queue = asyncio.Queue() transcription_output_queue = asyncio.Queue()