I’m looking for a way to store the history of a conversation that uses the new multi-function “tools” system instead of the old “function” system.
I can properly re-inject the history and answer functions with the python client but it involves adding the “ChatCompletionMessageToolCall” object from the answer directly to the messages.
If I want to stringify it or just manually add a message of the type { ‘role’ : ‘tool’, … } I don’t know what to insert here.
No problem for responses to multiple functions, only for the assistant message (with finishReason == ‘tool_calls’ and content == None).
Thank you very much if you can help!
Have a nice day.
You can’t modify existing thread message structures, you can only build a new one and make the required modifications by selectively taking the old threads messages and introducing new ones/making edits prior to adding them.
This may get added as functionality in the future, but for now it’s a fixed structure once created.
If you just want to add new messages to the chain, I don’t see an issue though.
Thank you for your reply but that’s exactly what I do, you can add the python object directly or simply add a list of type { ‘role’ : ‘…’, ‘content’ : ‘…’ }.
For example, I add this :
And it works just fine in the thread and in response to GPT.
My problem comes from the previous message. The one sent by GPT as an assistant for calling one or more functions.
I add the python object, which works fine, but if I want to save this object to rebuild the history later, I don’t know how to get the corresponding “list” (to have it in JSON then in str…).
In other words, how does the python client transform the “ChatCompletionMessageToolCall” object and pass it to the API?