fix: cast Anthropic-format passthrough message to MessageParam

The fallback path in `_from_universal_context_message` returns
`message.message` from an `LLMSpecificMessage`, which is typed loosely
(`Any | dict`). The surrounding comment already documents the
assumption that the message is already in Anthropic format — make that
assumption explicit to pyright with a cast.
This commit is contained in:
Paul Kompfner
2026-04-27 14:43:23 -04:00
parent c517b67bad
commit 252bb493af

View File

@@ -248,7 +248,7 @@ class AnthropicLLMAdapter(BaseLLMAdapter[AnthropicLLMInvocationParams]):
}
# Fall back to assuming that the message is already in Anthropic format
return copy.deepcopy(message.message)
return cast(MessageParam, copy.deepcopy(message.message))
def _from_standard_message(self, message: LLMStandardMessage) -> MessageParam:
"""Convert standard universal context message to Anthropic format.