From ddcc2ccf9381b8b72b31ee693957d3e786cfce05 Mon Sep 17 00:00:00 2001 From: robust-WJL Date: Mon, 27 Jul 2026 15:41:26 +0900 Subject: [PATCH] fix(friendliai): set supports_reasoning from probed model behaviour supports_reasoning was guesswork on my part, so I probed each model against the serverless endpoint instead and set the flag from what came back. gemma-4-31B-it and DeepSeek-V3.2 return no reasoning_content by default but do return it under chat_template_kwargs.enable_thinking, so both are reasoning capable. K-EXAONE-236B-A23B, GLM-5.1, GLM-5.2 and MiniMax-M2.5 return it without being asked. Qwen3-235B-A22B-Instruct-2507 returns byte-identical output with thinking on and off and ships no thinking markers in its published chat template, so it does not get the flag; it is the non-thinking half of the Qwen3-235B pair. gemma-4-31B-it also keeps supports_vision: it answers a base64 image prompt correctly, whereas the non-vision models on this endpoint reject the same payload with "This model does not support image/video inputs" The metadata test now pins the reasoning flag per model --- ...odel_prices_and_context_window_backup.json | 2 ++ model_prices_and_context_window.json | 2 ++ .../test_friendliai_model_metadata.py | 21 ++++++++++++------- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 2ebcceb4bda..f8f652e905a 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -17210,6 +17210,7 @@ "supports_function_calling": true, "supports_parallel_function_calling": true, "supports_prompt_caching": true, + "supports_reasoning": true, "supports_response_schema": true, "supports_system_messages": true, "supports_tool_choice": true @@ -17273,6 +17274,7 @@ "output_cost_per_token": 4e-07, "supports_function_calling": true, "supports_parallel_function_calling": true, + "supports_reasoning": true, "supports_response_schema": true, "supports_system_messages": true, "supports_tool_choice": true, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index ad3cd2380cc..c822acc4a5c 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -17210,6 +17210,7 @@ "supports_function_calling": true, "supports_parallel_function_calling": true, "supports_prompt_caching": true, + "supports_reasoning": true, "supports_response_schema": true, "supports_system_messages": true, "supports_tool_choice": true @@ -17273,6 +17274,7 @@ "output_cost_per_token": 4e-07, "supports_function_calling": true, "supports_parallel_function_calling": true, + "supports_reasoning": true, "supports_response_schema": true, "supports_system_messages": true, "supports_tool_choice": true, diff --git a/tests/test_litellm/test_friendliai_model_metadata.py b/tests/test_litellm/test_friendliai_model_metadata.py index 5a68fa8d289..f1b3ac84b77 100644 --- a/tests/test_litellm/test_friendliai_model_metadata.py +++ b/tests/test_litellm/test_friendliai_model_metadata.py @@ -21,29 +21,30 @@ class FriendliModel(NamedTuple): cache_read_input_token_cost: float | None max_input_tokens: int max_output_tokens: int + supports_reasoning: bool EXPECTED_MODELS: Final[tuple[FriendliModel, ...]] = ( FriendliModel( - "friendliai/LGAI-EXAONE/K-EXAONE-236B-A23B", 2e-07, 8e-07, 1e-07, 262144, 262144 + "friendliai/LGAI-EXAONE/K-EXAONE-236B-A23B", 2e-07, 8e-07, 1e-07, 262144, 262144, True ), FriendliModel( - "friendliai/MiniMaxAI/MiniMax-M2.5", 3e-07, 1.2e-06, 6e-08, 196608, 196608 + "friendliai/MiniMaxAI/MiniMax-M2.5", 3e-07, 1.2e-06, 6e-08, 196608, 196608, True ), FriendliModel( - "friendliai/Qwen/Qwen3-235B-A22B-Instruct-2507", 2e-07, 8e-07, None, 262144, 262144 + "friendliai/Qwen/Qwen3-235B-A22B-Instruct-2507", 2e-07, 8e-07, None, 262144, 262144, False ), FriendliModel( - "friendliai/deepseek-ai/DeepSeek-V3.2", 5e-07, 1.5e-06, 2.5e-07, 163840, 163840 + "friendliai/deepseek-ai/DeepSeek-V3.2", 5e-07, 1.5e-06, 2.5e-07, 163840, 163840, True ), FriendliModel( - "friendliai/google/gemma-4-31B-it", 1.4e-07, 4e-07, None, 262144, 262144 + "friendliai/google/gemma-4-31B-it", 1.4e-07, 4e-07, None, 262144, 262144, True ), FriendliModel( - "friendliai/zai-org/GLM-5.1", 1.4e-06, 4.4e-06, 2.6e-07, 202752, 202752 + "friendliai/zai-org/GLM-5.1", 1.4e-06, 4.4e-06, 2.6e-07, 202752, 202752, True ), FriendliModel( - "friendliai/zai-org/GLM-5.2", 1.4e-06, 4.4e-06, 2.6e-07, 1048576, 1048576 + "friendliai/zai-org/GLM-5.2", 1.4e-06, 4.4e-06, 2.6e-07, 1048576, 1048576, True ), ) @@ -106,6 +107,12 @@ def test_prompt_caching_flag_tracks_cache_read_cost() -> None: ), f"{expected.key} prompt-caching flag disagrees with cache_read cost" +@pytest.mark.parametrize("expected", EXPECTED_MODELS, ids=lambda m: m.key) +def test_reasoning_flag_matches_verified_behaviour(expected: FriendliModel) -> None: + entry = _load(ROOT_PATH)[expected.key] + assert entry.get("supports_reasoning", False) is expected.supports_reasoning + + def test_deprecating_model_carries_iso_date() -> None: entry = _load(ROOT_PATH)["friendliai/Qwen/Qwen3-235B-A22B-Instruct-2507"] assert entry["deprecation_date"] == "2026-08-05"