mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 09:23:17 -04:00
Use ToolResult in google_generative_ai_conversation (#182545)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
6f9375c905
commit
f1f854262a
@@ -271,7 +271,12 @@ def _create_google_tool_response_parts(
|
||||
return [
|
||||
Part.from_function_response(
|
||||
name=tool_result.tool_name,
|
||||
response=_validate_tool_results(tool_result.tool_result),
|
||||
response=_validate_tool_results(
|
||||
{
|
||||
"data": tool_result.result.data,
|
||||
"error": tool_result.result.error,
|
||||
}
|
||||
),
|
||||
)
|
||||
for tool_result in parts
|
||||
]
|
||||
|
||||
+9
-10
@@ -27,16 +27,12 @@
|
||||
name='HassGetCurrentTime',
|
||||
response={
|
||||
'data': {
|
||||
'failed': [],
|
||||
'success': []
|
||||
'data': {<... 2 items at Max depth ...>},
|
||||
'response_type': 'action_done',
|
||||
'speech': {<... 1 item at Max depth ...>},
|
||||
'speech_slots': {<... 1 item at Max depth ...>}
|
||||
},
|
||||
'response_type': 'action_done',
|
||||
'speech': {
|
||||
'plain': {<... 2 items at Max depth ...>}
|
||||
},
|
||||
'speech_slots': {
|
||||
'time': '16:24:17.813343'
|
||||
}
|
||||
'error': False
|
||||
}
|
||||
)
|
||||
),
|
||||
@@ -92,7 +88,10 @@
|
||||
function_response=FunctionResponse(
|
||||
name='test_tool',
|
||||
response={
|
||||
'result': 'Test response'
|
||||
'data': {
|
||||
'result': 'Test response'
|
||||
},
|
||||
'error': False
|
||||
}
|
||||
)
|
||||
),
|
||||
|
||||
@@ -269,7 +269,8 @@ async def test_function_call(
|
||||
"name": "test_tool",
|
||||
"parts": None,
|
||||
"response": {
|
||||
"result": "Test response",
|
||||
"data": {"result": "Test response"},
|
||||
"error": False,
|
||||
},
|
||||
"scheduling": None,
|
||||
"will_continue": None,
|
||||
|
||||
Reference in New Issue
Block a user