fix(volcengine): allow response_format in supported params for JSON mode

VolcEngineChatConfig declared a response_format field but left it out of
get_supported_openai_params, so litellm raised UnsupportedParamsError before
dispatch whenever a caller passed response_format to a volcengine/doubao model.
Volcengine's chat API is OpenAI-compatible (the config subclasses
OpenAILikeChatConfig) and accepts response_format for JSON mode, so add it to
the supported list; the base map_openai_params then forwards it unchanged.

Regression test asserts response_format is both listed as supported and passes
end-to-end through get_optional_params without raising.
This commit is contained in:
RayJueWang 2026-09-09 14:23:13 +08:00
parent 47b15ffb67
commit d86e3c554b
2 changed files with 29 additions and 0 deletions

View file

@ -63,6 +63,7 @@ class VolcEngineChatConfig(OpenAILikeChatConfig):
"tool_choice",
"function_call",
"functions",
"response_format",
"max_retries",
"extra_headers",
"thinking",

View file

@ -42,6 +42,34 @@ class TestVolcEngineConfig:
"type": "enabled",
}
def test_response_format_supported(self):
"""response_format must be a supported param so JSON mode is not rejected.
Regression for UnsupportedParamsError on volcengine/doubao when passing
response_format: the field was declared on the config but missing from
get_supported_openai_params, so litellm rejected it before dispatch.
"""
config = VolcEngineConfig()
model = "doubao-seed-2-0-pro-260215"
assert "response_format" in config.get_supported_openai_params(model=model)
mapped = config.map_openai_params(
non_default_params={"response_format": {"type": "json_object"}},
optional_params={},
model=model,
drop_params=False,
)
assert mapped["response_format"] == {"type": "json_object"}
e2e = get_optional_params(
model=model,
custom_llm_provider="volcengine",
response_format={"type": "json_object"},
drop_params=False,
)
assert e2e["response_format"] == {"type": "json_object"}
def test_thinking_parameter_handling(self):
"""Test comprehensive thinking parameter handling scenarios"""
config = VolcEngineConfig()