fix: ensure reasoning_effort gets dropped for xai models

This commit is contained in:
Peter Clement 2026-01-29 15:51:04 +00:00
parent e444199d95
commit 7f54e60a71
3 changed files with 40 additions and 12 deletions

View file

@ -30727,7 +30727,6 @@
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-reasoning",
"supports_audio_input": true,
"supports_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true,
@ -30747,7 +30746,6 @@
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-reasoning",
"supports_audio_input": true,
"supports_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true,
@ -30767,7 +30765,6 @@
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-reasoning",
"supports_audio_input": true,
"supports_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true,
@ -30835,7 +30832,6 @@
"output_cost_per_token": 1.5e-06,
"source": "https://docs.x.ai/docs/models",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_tool_choice": true
},
"xai/grok-code-fast-1": {
@ -30849,7 +30845,6 @@
"output_cost_per_token": 1.5e-06,
"source": "https://docs.x.ai/docs/models",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_tool_choice": true
},
"xai/grok-code-fast-1-0825": {
@ -30863,7 +30858,6 @@
"output_cost_per_token": 1.5e-06,
"source": "https://docs.x.ai/docs/models",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_tool_choice": true
},
"xai/grok-vision-beta": {

View file

@ -30727,7 +30727,6 @@
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-reasoning",
"supports_audio_input": true,
"supports_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true,
@ -30747,7 +30746,6 @@
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-reasoning",
"supports_audio_input": true,
"supports_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true,
@ -30767,7 +30765,6 @@
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-reasoning",
"supports_audio_input": true,
"supports_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true,
@ -30835,7 +30832,6 @@
"output_cost_per_token": 1.5e-06,
"source": "https://docs.x.ai/docs/models",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_tool_choice": true
},
"xai/grok-code-fast-1": {
@ -30849,7 +30845,6 @@
"output_cost_per_token": 1.5e-06,
"source": "https://docs.x.ai/docs/models",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_tool_choice": true
},
"xai/grok-code-fast-1-0825": {
@ -30863,7 +30858,6 @@
"output_cost_per_token": 1.5e-06,
"source": "https://docs.x.ai/docs/models",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_tool_choice": true
},
"xai/grok-vision-beta": {

View file

@ -0,0 +1,40 @@
"""
Tests for XAI Chat API transformation.
Source: litellm/llms/xai/chat/transformation.py
"""
import os
import sys
sys.path.insert(0, os.path.abspath("../../../../../.."))
import pytest
from litellm.llms.xai.chat.transformation import XAIChatConfig
class TestXAIChatTransformation:
def test_grok_3_mini_supports_reasoning_effort(self):
config = XAIChatConfig()
supported_params = config.get_supported_openai_params(model="grok-3-mini")
assert "reasoning_effort" in supported_params
@pytest.mark.parametrize(
"model",
[
"grok-3",
"grok-4",
"grok-4-fast-reasoning",
"grok-4-1-fast-reasoning",
"grok-4-1-fast-non-reasoning",
],
)
def test_reasoning_effort_excluded_for_other_grok_models(self, model: str):
config = XAIChatConfig()
supported_params = config.get_supported_openai_params(model=model)
assert "reasoning_effort" not in supported_params