Hello,
I’ve just got started with the realtime API so my apology if this is a stupid question.
I was wondering if there’s a way to retrieve the conversation history (in terms of messages) of the current session.
Thank you in advance for your help!
Hello,
I’ve just got started with the realtime API so my apology if this is a stupid question.
I was wondering if there’s a way to retrieve the conversation history (in terms of messages) of the current session.
Thank you in advance for your help!
The API doesn’t provide this mechanism, so you have to save the info you need yourself in the code
Thanks for your reply. Then comes my second question. As I understand from the logs, if an assistant message is responding to a user message, then the two messages have the same item ID, is that correct?
Conversation item created: {'type': 'conversation.item.created', 'event_id': 'event_AT1riuAwVCnaQsZEh9ACu', 'previous_item_id': 'item_AT1rbsQHYNbarVY0TQ2rd', 'item': {'id': 'item_AT1rh5zxLdEgbvrrrezGm', 'object': 'realtime.item', 'type': 'message', 'status': 'completed', 'role': 'user', 'content': [{'type': 'input_audio', 'transcript': None}]}}
Conversation item created: {'type': 'conversation.item.created', 'event_id': 'event_AT1rcRvlkhPBqWPZArP3t', 'previous_item_id': 'item_AT1rZbX8n88zPOOZzFyp4', 'item': {'id': 'item_AT1rbsQHYNbarVY0TQ2rd', 'object': 'realtime.item', 'type': 'message', 'status': 'in_progress', 'role': 'assistant', 'content': []}}
Unfortunately I don’t know, but I think you can easily figure that out by reading the API reference docs thoroughly and some experimenting
Thanks. It seems that my guess was wrong.
What I wanted to know is how to determine which user message an assistant message is responding to. I’m posting this question in a separate topic and hopefully somebody could answer.
If you use an assistant:
https://platform.openai.com/docs/assistants/overview
Then you can create a thread, then a run.
Then you can see the messages in a thread:
https://platform.openai.com/docs/api-reference/messages/listMessages
Hope that helps.
The conversation.item.created event you receive has a previous_item_id field pointing to the previous item in the conversation. More info here:
https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/created
Thanks. Unfortunately the realtime model is not available for Assistant (openai.BadRequestError: Error code: 400 - {'error': {'message': "The requested model 'gpt-4o-realtime-preview-2024-10-01' cannot be used with the Assistants API.", 'type': 'invalid_request_error', 'param': 'model', 'code': 'unsupported_model'}}).
Thanks a lot. I had figured that out too.
Hello sorry I still can not understand
I want to see this conversation panel and the player for recording……
What should I do? Thanks
I