From 252bb493af28eae44c9b2637fb51b418fce9da06 Mon Sep 17 00:00:00 2001 From: Paul Kompfner Date: Mon, 27 Apr 2026 14:43:23 -0400 Subject: [PATCH] fix: cast Anthropic-format passthrough message to MessageParam MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/pipecat/adapters/services/anthropic_adapter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pipecat/adapters/services/anthropic_adapter.py b/src/pipecat/adapters/services/anthropic_adapter.py index d0fdfca3b..cbe870d81 100644 --- a/src/pipecat/adapters/services/anthropic_adapter.py +++ b/src/pipecat/adapters/services/anthropic_adapter.py @@ -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.