Using OpenAI realtime API with Livekit, And I've ...
# ask-ai
m
Using OpenAI realtime API with Livekit, And I've been getting the following error: "OpenAI Realtime API response done but not complete with status: cancelled" after this happens the Livekit session bugs out and I have to cancel the call as I no longer get any response.
t
Thanks for reaching out, Zakariye. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm sorry to hear you're encountering the error "OpenAI Realtime API response done but not complete with status: cancelled." This usually happens when the AI assistant's response gets cut off early, maybe because the user interrupted or explicitly cancelled it. It's actually a normal part of how the conversation flow works, signaling the end of a turn. To help smooth things out and avoid any disruptions in your session, here are a couple of friendly tips: • Adjust Turn Detection Parameters: You might want to tweak the server-based voice activity detection (VAD) settings a bit to make it less sensitive to background noise or accidental triggers. For example, try increasing the
silence_duration_ms
and fine-tuning the
threshold
to better suit your environment. • Use Text-Only Responses with Separate TTS: Another approach is to set up the Realtime API to deliver text-only responses and then use a separate Text-to-Speech (TTS) plugin. This setup helps avoid any feedback audio issues and reduces the chance of the assistant interrupting itself. Also, it’s a good idea to make sure your application gracefully handles the "response.done" event when the status is "cancelled." This way, you can update your UI or move on to the next step smoothly without trying to resend the request unnecessarily. If you’d like, I’m here to help you walk through implementing these solutions or answer any other questions you might have! Sources: livekit-plugins/livekit-plugins-google/livekit/plugins/google/beta/realtime... | plugins/openai/src/realtime/realtime_model.ts | OpenAI Realtime API integration guide | LiveKit Docs | OpenAI Realtime API integration guide | LiveKit Docs | agent/main.py