Added async OpenAI services (#1)

* added async openai services

* added async openai services

* added Deepgram service with 05 example

* modernized the 'say one thing' example

* async all the things

* cleanup and user greeting

* more cleanup
This commit is contained in:
chadbailey59
2024-01-08 16:07:21 -06:00
committed by GitHub
parent d95bca479d
commit 290c1e7efa
7 changed files with 130 additions and 27 deletions

View File

@@ -1,7 +1,9 @@
import asyncio
from dailyai.output_queue import OutputQueueFrame, FrameType
from dailyai.services.azure_ai_services import AzureLLMService, AzureTTSService, AzureImageGenServiceREST
from dailyai.services.azure_ai_services import AzureTTSService
from dailyai.services.open_ai_services import OpenAILLMService, OpenAIImageGenService
from dailyai.services.deepgram_ai_services import DeepgramTTSService
from dailyai.services.daily_transport_service import DailyTransportService
async def main(room_url, token):
@@ -23,9 +25,9 @@ async def main(room_url, token):
transport.camera_width = 1024
transport.camera_height = 1024
llm = AzureLLMService()
tts = AzureTTSService()
dalle = AzureImageGenServiceREST()
llm = OpenAILLMService()
tts = DeepgramTTSService()
dalle = OpenAIImageGenService()
async def get_all_audio(text):
all_audio = bytearray()
@@ -44,7 +46,7 @@ async def main(room_url, token):
}
]
)
print(f"got llm for {month}")
print(f"got llm for {month}, {inference_text}")
(image, audio) = await asyncio.gather(
*[dalle.run_image_gen(inference_text, "1024x1024"), get_all_audio(inference_text)]
@@ -90,4 +92,4 @@ async def main(room_url, token):
print("Done")
if __name__=="__main__":
asyncio.run(main("https://moishe.daily.co/Lettvins", None))
asyncio.run(main("https://chad-hq.daily.co/howdy", None))