Fix Gemini tool response format by including function name (#187)
Gemini requires the 'name' field in tool/function response messages, while OpenAI infers it from tool_call_id. Without it, Gemini returns: 'function_response.name: Name cannot be empty' Added 'name' field to both tool result messages in the reflect agent.
This commit is contained in:
parent
9db64ecda3
commit
66abad61b8
1 changed files with 2 additions and 0 deletions
|
|
@ -436,6 +436,7 @@ async def run_reflect_agent(
|
|||
{
|
||||
"role": "tool",
|
||||
"tool_call_id": done_call.id,
|
||||
"name": done_call.name, # Required by Gemini
|
||||
"content": json.dumps(
|
||||
{
|
||||
"error": "You must search for information first. Use search_reflections(), search_mental_models(), or recall() before providing your final answer."
|
||||
|
|
@ -535,6 +536,7 @@ async def run_reflect_agent(
|
|||
{
|
||||
"role": "tool",
|
||||
"tool_call_id": tc.id,
|
||||
"name": tc.name, # Required by Gemini
|
||||
"content": json.dumps(output, default=str),
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue