The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(fireworks_ai): let extra_body thinking/reasoning_effort take precedence over chat_template_kwargs
mateo-berri3b2ed3c018e4
diff --git a/litellm/llms/fireworks_ai/chat/transformation.py b/litellm/llms/fireworks_ai/chat/transformation.pyindex 6fccda1a791..3965858d314 100644--- a/litellm/llms/fireworks_ai/chat/transformation.py+++ b/litellm/llms/fireworks_ai/chat/transformation.py@@ -397,7 +397,7 @@ class FireworksAIConfig(FireworksAIMixin, OpenAIGPTConfig):other_keys,model,)- if "reasoning_effort" in optional_params or "thinking" in optional_params:+ if any(key in optional_params or key in extra_body for key in ("reasoning_effort", "thinking")):verbose_logger.debug("fireworks_ai ignoring chat_template_kwargs; explicit reasoning_effort/thinking takes precedence.")diff --git a/litellm/llms/fireworks_ai/completion/transformation.py b/litellm/llms/fireworks_ai/completion/transformation.pyindex bff0fed0b33..7e72d1c3fa6 100644--- a/litellm/llms/fireworks_ai/completion/transformation.py+++ b/litellm/llms/fireworks_ai/completion/transformation.py@@ -127,7 +127,7 @@ class FireworksAITextCompletionConfig(FireworksAIMixin, BaseTextCompletionConfigeffort: Final = _effort_from_chat_template_kwargs(chat_template_kwargs)if effort is None:return result- if "reasoning_effort" in result or "thinking" in optional_params:+ if any(key in result or key in optional_params for key in ("reasoning_effort", "thinking")):verbose_logger.debug("fireworks_ai ignoring chat_template_kwargs; explicit reasoning_effort/thinking takes precedence.")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.pyindex 95a4902a1f2..354f4656d6e 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@@ -1418,6 +1418,25 @@ def test_map_extra_body_params_chat_template_kwargs_native_thinking_wins():assert result == {"thinking": thinking}+def test_map_extra_body_params_chat_template_kwargs_extra_body_thinking_wins():+ config = FireworksAIConfig()+ thinking = {"type": "enabled", "budget_tokens": 4096}+ result = config.map_extra_body_params(+ {"extra_body": {"thinking": thinking, "chat_template_kwargs": {"enable_thinking": False}}},+ _REASONING_MODEL,+ )+ assert result == {"extra_body": {"thinking": thinking}}+++def test_map_extra_body_params_chat_template_kwargs_extra_body_reasoning_effort_wins():+ config = FireworksAIConfig()+ result = config.map_extra_body_params(+ {"extra_body": {"reasoning_effort": "high", "chat_template_kwargs": {"enable_thinking": False}}},+ _REASONING_MODEL,+ )+ assert result == {"extra_body": {"reasoning_effort": "high"}}++def test_map_extra_body_params_chat_template_kwargs_dropped_for_non_reasoning_model():config = FireworksAIConfig()result = config.map_extra_body_params(diff --git a/tests/test_litellm/llms/fireworks_ai/completion/test_fireworks_ai_text_completion_transformation.py b/tests/test_litellm/llms/fireworks_ai/completion/test_fireworks_ai_text_completion_transformation.pyindex 5408c6dc520..78186846fbb 100644--- a/tests/test_litellm/llms/fireworks_ai/completion/test_fireworks_ai_text_completion_transformation.py+++ b/tests/test_litellm/llms/fireworks_ai/completion/test_fireworks_ai_text_completion_transformation.py@@ -73,6 +73,16 @@ def test_map_extra_body_params_chat_template_kwargs_dropped_for_non_reasoning_moassert result == {}+def test_map_extra_body_params_chat_template_kwargs_extra_body_thinking_wins():+ config = FireworksAITextCompletionConfig()+ thinking = {"type": "enabled", "budget_tokens": 4096}+ result = config.map_extra_body_params(+ {"extra_body": {"thinking": thinking, "chat_template_kwargs": {"enable_thinking": False}}},+ _REASONING_MODEL,+ )+ assert result == {"extra_body": {"thinking": thinking}}++def test_map_extra_body_params_top_level_reasoning_effort_moves_into_extra_body():config = FireworksAITextCompletionConfig()result = config.map_extra_body_params(