parent
391de22342
commit
a85ccb94e3
|
@ -177,6 +177,11 @@ class APIInstance:
|
|||
else:
|
||||
raise HomeAssistantError(f'Tool "{tool_input.tool_name}" not found')
|
||||
|
||||
tool_input = ToolInput(
|
||||
tool_name=tool_input.tool_name,
|
||||
tool_args=tool.parameters(tool_input.tool_args),
|
||||
)
|
||||
|
||||
return await tool.async_call(self.api.hass, tool_input, self.llm_context)
|
||||
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ async def test_function_call(
|
|||
name="test_tool",
|
||||
args={
|
||||
"param1": ["test_value", "param1\\'s value"],
|
||||
"param2": "param2\\'s value",
|
||||
"param2": 2.7,
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -258,7 +258,7 @@ async def test_function_call(
|
|||
tool_name="test_tool",
|
||||
tool_args={
|
||||
"param1": ["test_value", "param1's value"],
|
||||
"param2": "param2's value",
|
||||
"param2": 2.7,
|
||||
},
|
||||
),
|
||||
llm.LLMContext(
|
||||
|
|
|
@ -121,7 +121,7 @@ async def test_template_variables(
|
|||
("tool_args", "expected_tool_args"),
|
||||
[
|
||||
({"param1": "test_value"}, {"param1": "test_value"}),
|
||||
({"param1": 2}, {"param1": 2}),
|
||||
({"param2": 2}, {"param2": 2}),
|
||||
(
|
||||
{"param1": "test_value", "floor": ""},
|
||||
{"param1": "test_value"}, # Omit empty arguments
|
||||
|
@ -153,7 +153,8 @@ async def test_function_call(
|
|||
mock_tool.name = "test_tool"
|
||||
mock_tool.description = "Test function"
|
||||
mock_tool.parameters = vol.Schema(
|
||||
{vol.Optional("param1", description="Test parameters"): str}
|
||||
{vol.Optional("param1", description="Test parameters"): str},
|
||||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
mock_tool.async_call.return_value = "Test response"
|
||||
|
||||
|
|
Loading…
Reference in New Issue