Hi everyone,
I’m having trouble loading previous messages into the Realtime API. Has anyone successfully managed to do this?
Here’s the sequence of events I’m sending:
{
"type": "session.update",
"session": {
"modalities": ["text", "audio"],
"instructions": "Assist the user.",
"voice": "ash",
"input_audio_format": "pcm16",
"output_audio_format": "pcm16",
"input_audio_transcription": {"model": "whisper-1"},
"turn_detection": null,
"temperature": 0.8
}
}
{
"type": "conversation.item.create",
"item": {
"type": "message",
"status": "completed",
"role": "system",
"content": [{"type": "input_text", "text": "Say hi to the user."}]
}
}
{
"type": "conversation.item.create",
"item": {
"type": "message",
"status": "completed",
"role": "assistant",
"content": [{"type": "text", "text": "Hello, how can I assist you today?"}]
}
}
{
"type": "conversation.item.create",
"item": {
"type": "message",
"status": "completed",
"role": "user",
"content": [{"type": "text", "input_text": "Hello, can you tell me a joke?"}]
}
}
{
"type": "conversation.item.create",
"item": {
"type": "message",
"status": "completed",
"role": "system",
"content": [{"type": "input_text", "text": "The user interupted the conversation, continue from where you stopped."}]
}
}
After this I send a response.create
message:
{
"type": "response.create", "response": {"modalities": ["text", "audio"]},
}
The issue I’m experiencing is that sometimes I only get text responses without audio, or I encounter errors for some messages. I’ve been unable to get it working reliably.
If anyone has insights, tips, or a working example, I’d greatly appreciate your help!
Thanks in advance!