fix: make the home location lookup work against Claude
- 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:
1 parent
235c536cab
commit
84f4bcda55
4 files changed
+63
-7
No files matched your search
@@ -708,9 +708,11 @@ class OpenAISubentryFlowHandler(ConfigSubentryFlow):
|
||||
try:
|
||||
response = await client.responses.create(
|
||||
model=self.options.get(CONF_CHAT_MODEL, RECOMMENDED_CHAT_MODEL),
|
||||
# A user message, not a system one: endpoints in front of
|
||||
# Anthropic models reject a request without user content.
|
||||
input=[
|
||||
{
|
||||
"role": "system",
|
||||
"role": "user",
|
||||
"content": "Where are the following coordinates located: "
|
||||
f"({zone_home.attributes[EntityStateAttribute.LATITUDE]},"
|
||||
f" {zone_home.attributes[EntityStateAttribute.LONGITUDE]})?",
|
||||
|
||||
Reference in new issue
Block a user