fix: make the home location lookup work against Claude
validate / hassfest (push) Failing after 11s
validate / hacs (push) Failing after 23s
test / pytest (push) Successful in 46s

- Send the location question as a user message. A request with only a
  system message has no user content, which endpoints in front of Anthropic
  models reject ("text content blocks must be non-empty").
- Leave unknown fields out of the web search user_location. After a failed
  lookup there is no city or region, and the empty strings made every
  request fail ("user_location.city: String should have at least 1
  character").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pc-heiniandClaude Opus 5.5 committed 2026-10-22 08:52:14 +02:00
1 parent 235c536cab
commit 84f4bcda55
4 files changed
+63 -7

No files matched your search

+1
View File
@@ -1334,6 +1334,7 @@ async def test_subentry_web_search_user_location_lookup_fails(
)
await hass.async_block_till_done()
assert mock_create.call_args.kwargs["model"] == "claude-sonnet-5-5"
assert mock_create.call_args.kwargs["input"][0]["role"] == "user"
assert subentry_flow["type"] is FlowResultType.ABORT
assert subentry_flow["reason"] == "reconfigure_successful"
assert CONF_WEB_SEARCH_CITY not in subentry.data