From c79f3ac19552f82ab5f6fa5b365ddd21fb239a35 Mon Sep 17 00:00:00 2001 From: Shifat Islam Santo Date: Sun, 23 Aug 2026 19:44:25 -0500 Subject: [PATCH] refactor(anthropic): single-source the converted system note The /v1/messages pass-through and the chat completions path must prefix a converted system turn with the same operator note. --- .../experimental_pass_through/messages/transformation.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py b/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py index ebd514c2605..f0dc5ecce3c 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py @@ -31,6 +31,7 @@ from ...common_utils import ( optionally_handle_anthropic_oauth, strip_advisor_blocks_from_messages, ) +from ...mid_conversation_system import CONVERTED_SYSTEM_NOTE DEFAULT_ANTHROPIC_API_VERSION: Final = "2023-06-01" @@ -160,9 +161,7 @@ class AnthropicMessagesConfig(BaseAnthropicMessagesConfig): def _is_system_role_message(message: Any) -> bool: return isinstance(message, dict) and message.get("role") == "system" - _CONVERTED_SYSTEM_NOTE: Final = ( - "Operator note (not from the user): the following was originally a mid-conversation system-role reminder." - ) + _CONVERTED_SYSTEM_NOTE: Final = CONVERTED_SYSTEM_NOTE def _system_role_message_as_user(self, message: Mapping) -> Mapping: return {