Sample Code
A sample code using FastAPI websocket and asyncio. Make sure to use theAsyncOpenAI
client to prevent OpenAI from blocking the asyncio thread during token streaming. This ensures messages are sent immediately via websocket.
Step-by-step guide on how to set up a custom LLM for your Millis AI voice agent
AsyncOpenAI
client to prevent OpenAI from blocking the asyncio thread during token streaming. This ensures messages are sent immediately via websocket.