mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 17:49:37 +01:00
ollama integration: Don't drop all falsey values (#159735)
This commit is contained in:
@@ -75,7 +75,11 @@ def _parse_tool_args(arguments: dict[str, Any]) -> dict[str, Any]:
|
||||
small local tool use models. This will repair invalid json arguments and
|
||||
omit unnecessary arguments with empty values that will fail intent parsing.
|
||||
"""
|
||||
return {k: _fix_invalid_arguments(v) for k, v in arguments.items() if v}
|
||||
return {
|
||||
k: _fix_invalid_arguments(v)
|
||||
for k, v in arguments.items()
|
||||
if v is not None and v != ""
|
||||
}
|
||||
|
||||
|
||||
def _convert_content(
|
||||
|
||||
@@ -277,6 +277,14 @@ async def test_template_variables(
|
||||
{"domain": "['light']"},
|
||||
{"domain": "['light']"}, # Preserve invalid json that can't be parsed
|
||||
),
|
||||
(
|
||||
{"position": 0},
|
||||
{"position": 0}, # Preserve 0 as a valid value
|
||||
),
|
||||
(
|
||||
{"enabled": False},
|
||||
{"enabled": False}, # Preserve False as a valid value
|
||||
),
|
||||
],
|
||||
)
|
||||
@patch("homeassistant.components.ollama.entity.llm.AssistAPI._async_get_tools")
|
||||
|
||||
Reference in New Issue
Block a user