fix: omit container param when None to avoid proxy 400 errors

This commit is contained in:
Robot committed 2026-02-26 17:51:29 +00:00
1 parent 063d03b5b4
commit 646fd953af
1 file changed
+4 -2
+4 -2
View File
@@ -687,7 +687,7 @@ class AnthropicBaseLLMEntity(Entity):
max_tokens=options.get(CONF_MAX_TOKENS, DEFAULT[CONF_MAX_TOKENS]),
system=system_prompt,
stream=True,
container=container_id,
**({"container": container_id} if container_id else {}),
)
if not model.startswith(tuple(NON_ADAPTIVE_THINKING_MODELS)):
@@ -849,7 +849,7 @@ class AnthropicBaseLLMEntity(Entity):
try:
stream = await client.messages.create(**model_args)
new_messages, model_args["container"] = _convert_content(
new_messages, _new_container = _convert_content(
[
content
async for content in chat_log.async_add_delta_content_stream(
@@ -862,6 +862,8 @@ class AnthropicBaseLLMEntity(Entity):
)
]
)
if _new_container:
model_args["container"] = _new_container
messages.extend(new_messages)
except anthropic.AnthropicError as err:
raise HomeAssistantError(