ai-call-agent
ai-call-agent copied to clipboard
Call speach does not work due to Turn detection not being set
In the code here:
async def send_session_update(openai_ws):
"""Send session update to OpenAI WebSocket."""
session_update = {
"type": "session.update",
"session": {
"input_audio_format": "g711_ulaw",
"output_audio_format": "g711_ulaw",
"voice": VOICE,
"instructions": SYSTEM_MESSAGE,
"modalities": ["text", "audio"],
"temperature": 0.8,
},
}
print('Sending session update:', json.dumps(session_update))
await openai_ws.send(json.dumps(session_update))
the setting "turn_detection": {"type": "server_vad"}, is not present and therefore no conversation can be made.
The final code shall be:
async def send_session_update(openai_ws):
"""Send session update to OpenAI WebSocket."""
session_update = {
"type": "session.update",
"session": {
"turn_detection": {"type": "server_vad"},
"input_audio_format": "g711_ulaw",
"output_audio_format": "g711_ulaw",
"voice": VOICE,
"instructions": SYSTEM_MESSAGE,
"modalities": ["text", "audio"],
"temperature": 0.8,
}
}
print('Sending session update:', json.dumps(session_update))
await openai_ws.send(json.dumps(session_update))
@tropxy thanks for sharing this, will update after test.