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

* fix(volcengine.py): add thinking param support

Closes https://github.com/BerriAI/litellm/issues/11879

* fix(gpt_transformation.py): handle azure custom names - e.g. `gpt-4-1`

Closes https://github.com/BerriAI/litellm/issues/11834
This commit is contained in:
Krish Dholakia 2025-06-20 09:40:33 -07:00 • committed by GitHub
parent 7abece4ad8
commit cf83b541e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 62 additions and 1 deletions

View file

@ -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

View file

@ -61,4 +61,5 @@ class VolcEngineConfig(OpenAILikeChatConfig):
"functions",
"max_retries",
"extra_headers",
"thinking",
] # works across all models

View file

@ -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")

View file

@ -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",
}