mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-16 10:33:00 +03:00
Fix gemini tools call
This commit is contained in:
+14
-10
@@ -143,15 +143,17 @@ class GeminiClient(GenAIClient):
|
|||||||
)
|
)
|
||||||
elif role == "tool":
|
elif role == "tool":
|
||||||
# Handle tool response
|
# Handle tool response
|
||||||
function_response = {
|
response_payload = (
|
||||||
"name": msg.get("name", ""),
|
content if isinstance(content, dict) else {"result": content}
|
||||||
"response": content,
|
)
|
||||||
}
|
|
||||||
gemini_messages.append(
|
gemini_messages.append(
|
||||||
types.Content(
|
types.Content(
|
||||||
role="function",
|
role="function",
|
||||||
parts=[
|
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":
|
elif role == "tool":
|
||||||
# Handle tool response
|
# Handle tool response
|
||||||
function_response = {
|
response_payload = (
|
||||||
"name": msg.get("name", ""),
|
content if isinstance(content, dict) else {"result": content}
|
||||||
"response": content,
|
)
|
||||||
}
|
|
||||||
gemini_messages.append(
|
gemini_messages.append(
|
||||||
types.Content(
|
types.Content(
|
||||||
role="function",
|
role="function",
|
||||||
parts=[
|
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,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user