mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-01 19:17:41 +03:00
Fix gemini tools call
This commit is contained in:
parent
11bb9fed4c
commit
3c19eba7c4
@ -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,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user