From f237a9fac4ad12b58a659bedc1b5bf69628339ce Mon Sep 17 00:00:00 2001 From: er-s-an <92594860+er-s-an@users.noreply.github.com> Date: Fri, 9 Oct 2026 17:05:18 +0800 Subject: [PATCH] style: drop redundant comment and add Final on #45470 regression test Address greptile review on PR #45478: remove explanatory comments and annotate new test locals with Final per AGENTS.md. --- .../pass_through/responses_adapters/transformation.py | 2 -- .../test_responses_adapters_transformation.py | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/litellm/llms/anthropic/pass_through/responses_adapters/transformation.py b/litellm/llms/anthropic/pass_through/responses_adapters/transformation.py index 1e011ce6d21..9619b473c27 100644 --- a/litellm/llms/anthropic/pass_through/responses_adapters/transformation.py +++ b/litellm/llms/anthropic/pass_through/responses_adapters/transformation.py @@ -210,8 +210,6 @@ class LiteLLMAnthropicToResponsesAPIAdapter: }, ) if btype == "text": - # Emit text in block order so text before/after tool_use is not - # replayed as one trailing assistant message (#45470). return ( { "type": "message", diff --git a/tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_transformation.py b/tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_transformation.py index 71955c16890..8605186fb6a 100644 --- a/tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_transformation.py +++ b/tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_transformation.py @@ -5,7 +5,7 @@ Tests for LiteLLMAnthropicToResponsesAPIAdapter import json import os -from typing import Any, Dict, List +from typing import Any, Dict, Final, List from unittest.mock import MagicMock import pytest @@ -668,7 +668,7 @@ class TestTranslateMessagesToResponsesInput: def test_assistant_text_before_and_after_tool_use_preserves_order(self): """Text around tool_use stays in block order, not replayed after (#45470).""" - messages = [ + messages: Final = [ {"role": "user", "content": "weather in Paris?"}, { "role": "assistant", @@ -690,7 +690,7 @@ class TestTranslateMessagesToResponsesInput: ], }, ] - result = _translate_messages(messages) + result: Final = _translate_messages(messages) assert [item["type"] for item in result] == [ "message", "message",