From 7057b2f6c47b00dcfb7f2ae3b75c8edde1123b65 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 11 Sep 2026 18:47:37 -0700 Subject: [PATCH] fix(fireworks_ai): keep reasoning_content on replayed assistant messages (#40682) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/llms/fireworks_ai/chat/transformation.py | 1 - .../chat/test_fireworks_ai_chat_transformation.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/litellm/llms/fireworks_ai/chat/transformation.py b/litellm/llms/fireworks_ai/chat/transformation.py index 26ad9a02a79..b4e1856f499 100644 --- a/litellm/llms/fireworks_ai/chat/transformation.py +++ b/litellm/llms/fireworks_ai/chat/transformation.py @@ -511,7 +511,6 @@ class FireworksAIConfig(FireworksAIMixin, OpenAIGPTConfig): m = cast(dict, message) m.pop("provider_specific_fields", None) m.pop("thinking_blocks", None) - m.pop("reasoning_content", None) return messages diff --git a/tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py b/tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py index d4ef4282b27..8479397efa7 100644 --- a/tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py +++ b/tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py @@ -501,8 +501,8 @@ def test_unmapped_model_fallback_function_calling(): assert info["supports_function_calling"] is True -def test_transform_messages_helper_strips_thinking_blocks(): - """thinking_blocks must not be forwarded to Fireworks chat completions.""" +def test_transform_messages_helper_strips_thinking_blocks_but_keeps_reasoning_content(): + """Fireworks rejects thinking_blocks but requires reasoning_content to be replayed for reasoning_history.""" config = FireworksAIConfig() messages = [ {"role": "user", "content": "Translate a poem."}, @@ -519,7 +519,7 @@ def test_transform_messages_helper_strips_thinking_blocks(): messages, model="accounts/fireworks/models/glm-5p1", litellm_params={} ) assert "thinking_blocks" not in out[1] - assert "reasoning_content" not in out[1] + assert out[1]["reasoning_content"] == "internal" assert out[1]["content"] == "I can help."