Fix gemini tools call

This commit is contained in:
Nicolas Mowen 2026-04-29 16:14:26 -06:00
parent 11bb9fed4c
commit 3c19eba7c4

View File

@ -143,15 +143,17 @@ class GeminiClient(GenAIClient):
)
elif role == "tool":
# Handle tool response
function_response = {
"name": msg.get("name", ""),
"response": content,
}
response_payload = (
content if isinstance(content, dict) else {"result": content}
)
gemini_messages.append(
types.Content(
role="function",
parts=[
types.Part.from_function_response(function_response) # type: ignore[misc,call-arg,arg-type]
types.Part.from_function_response(
name=msg.get("name", ""),
response=response_payload,
)
],
)
)
@ -350,15 +352,17 @@ class GeminiClient(GenAIClient):
)
elif role == "tool":
# Handle tool response
function_response = {
"name": msg.get("name", ""),
"response": content,
}
response_payload = (
content if isinstance(content, dict) else {"result": content}
)
gemini_messages.append(
types.Content(
role="function",
parts=[
types.Part.from_function_response(function_response) # type: ignore[misc,call-arg,arg-type]
types.Part.from_function_response(
name=msg.get("name", ""),
response=response_payload,
)
],
)
)