1
0
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:
Kory Prince
2025-12-28 16:22:34 -06:00
committed by GitHub
parent 4f589b144d
commit e68ef21522
2 changed files with 13 additions and 1 deletions
+5 -1
View File
@@ -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")