I have the same issue here.
There is no documentation of what a valid JSON tool response might look like
If you simply send without the tool execution response, it works
{
"role": "user",
"content": "remember that I am 52 years old "
},
{
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{\"argument_1\":\"[{\\\"key_name\\\": \\\"age\\\", \\\"key_value\\\":\\\"52\\\", \\\"key_description\\\": \\\"The age of the user\\\", \\\"key_namespace\\\": \\\"personal_data\\\"}]\",\"argument_2\":\"False\"}",
"name": "set_in_user_memory"
},
"id": "",
"type": "function"
}
]
},
but this doesn’t
{
"role": "user",
"content": "remember that I am 52 years old "
},
{
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{\"argument_1\":\"[{\\\"key_name\\\": \\\"age\\\", \\\"key_value\\\":\\\"52\\\", \\\"key_description\\\": \\\"The age of the user\\\", \\\"key_namespace\\\": \\\"personal_data\\\"}]\",\"argument_2\":\"False\"}",
"name": "set_in_user_memory"
},
"id": "",
"type": "function"
}
]
},
{
"tool_call_id": "",
"role": "tool",
"name": "set_in_user_memory",
"content": "The parameters were successfully saved or updated in the user memory."
}
The tool_call from Gemini through the openAI doesn’t have a valid tool ID (and index is missing)
to make it work, you need to set the value of the id with the tool function name for example, and make sure it matches your tool_call_id value
but this does
{
"role": "user",
"content": "remember that I am 52 years old "
},
{
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{\"argument_1\":\"[{\\\"key_name\\\": \\\"age\\\", \\\"key_value\\\":\\\"52\\\", \\\"key_description\\\": \\\"The age of the user\\\", \\\"key_namespace\\\": \\\"personal_data\\\"}]\",\"argument_2\":\"False\"}",
"name": "set_in_user_memory"
},
"id": "**set_in_user_memory**",
"type": "function"
}
]
},
{
"tool_call_id": "**set_in_user_memory**",
"role": "tool",
"name": "**set_in_user_memory**",
"content": "The parameters were successfully saved or updated in the user memory."
}
Voila!