fix(anthropic): type tool_result block for is_error lookup

Removes the reportUnknownMemberType added by content.get("is_error") on
the untyped client payload; same cast-ok pattern as _tool_result_part.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Eugenio "Jay" Zuccarelli 2026-10-15 23:26:38 +00:00
parent 289b1b5df0
commit ee24e7bd8f

View file

@ -535,7 +535,8 @@ class LiteLLMAnthropicMessagesAdapter:
content=self._tool_result_content(content.get("content")),
)
self._add_cache_control_if_applicable(content, tool_result, model)
if content.get("is_error") is True and self.target_consumes_tool_error(
tool_result_block = cast(Mapping[str, object], content) # cast-ok: untrusted client payload
if tool_result_block.get("is_error") is True and self.target_consumes_tool_error(
model, custom_llm_provider
):
tool_result["is_error"] = True