Skip to content

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]

Volcengine - thinking param support + Azure - handle more gpt custom naming patterns (#11914)

Krish Dholakiacf83b541e5c5
diff --git a/litellm/llms/azure/chat/gpt_transformation.py b/litellm/llms/azure/chat/gpt_transformation.py
index 2ae684ddaeb..97a044cf01a 100644
--- a/litellm/llms/azure/chat/gpt_transformation.py
+++ b/litellm/llms/azure/chat/gpt_transformation.py
@@ -116,7 +116,14 @@ class AzureOpenAIConfig(BaseConfig):
"""
if "4o" in model:
return True
- elif supports_response_schema(model):
+
+ # Normalize model name by replacing dashes between numbers with dots
+ # e.g., gpt-4-1 -> gpt-4.1, gpt-3-5-turbo -> gpt-3.5-turbo
+ import re
+
+ normalized_model = re.sub(r"(\d)-(\d)", r"\1.\2", model)
+
+ if supports_response_schema(normalized_model):
return True
return False
diff --git a/litellm/llms/volcengine.py b/litellm/llms/volcengine.py
index e4a78104f48..c569475b11c 100644
--- a/litellm/llms/volcengine.py
+++ b/litellm/llms/volcengine.py
@@ -61,4 +61,5 @@ class VolcEngineConfig(OpenAILikeChatConfig):
"functions",
"max_retries",
"extra_headers",
+ "thinking",
] # works across all models
diff --git a/tests/test_litellm/llms/azure/chat/test_azure_chat_gpt_transformation.py b/tests/test_litellm/llms/azure/chat/test_azure_chat_gpt_transformation.py
new file mode 100644
index 00000000000..c4bf7a3300e
--- /dev/null
+++ b/tests/test_litellm/llms/azure/chat/test_azure_chat_gpt_transformation.py
@@ -0,0 +1,15 @@
+import os
+import sys
+
+sys.path.insert(
+ 0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../.."))
+)
+
+from litellm.llms.azure.chat.gpt_transformation import AzureOpenAIConfig
+
+
+class TestAzureOpenAIConfig:
+ def test_is_response_format_supported_model(self):
+ config = AzureOpenAIConfig()
+ assert config._is_response_format_supported_model("gpt-4.1")
+ assert config._is_response_format_supported_model("gpt-4-1")
diff --git a/tests/test_litellm/llms/test_volcengine.py b/tests/test_litellm/llms/test_volcengine.py
new file mode 100644
index 00000000000..cb9bc0f521c
--- /dev/null
+++ b/tests/test_litellm/llms/test_volcengine.py
@@ -0,0 +1,38 @@
+import os
+import sys
+
+from pydantic import BaseModel
+
+from litellm.llms.volcengine import VolcEngineConfig
+from litellm.utils import get_optional_params
+
+
+class TestVolcEngineConfig:
+ def test_get_optional_params(self):
+ config = VolcEngineConfig()
+ supported_params = config.get_supported_openai_params(model="doubao-seed-1.6")
+ assert "thinking" in supported_params
+
+ mapped_params = config.map_openai_params(
+ non_default_params={
+ "thinking": {"type": "disabled"},
+ },
+ optional_params={},
+ model="doubao-seed-1.6",
+ drop_params=False,
+ )
+
+ assert mapped_params == {
+ "thinking": {"type": "disabled"},
+ }
+
+ e2e_mapped_params = get_optional_params(
+ model="doubao-seed-1.6",
+ custom_llm_provider="volcengine",
+ thinking={"type": "enabled"},
+ drop_params=False,
+ )
+
+ assert "thinking" in e2e_mapped_params and e2e_mapped_params["thinking"] == {
+ "type": "enabled",
+ }