From d86e3c554bea7f5d2d44985012eec115204d4438 Mon Sep 17 00:00:00 2001 From: RayJueWang <570828708@qq.com> Date: Wed, 9 Sep 2026 14:23:13 +0800 Subject: [PATCH] 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. --- .../llms/volcengine/chat/transformation.py | 1 + .../llms/volcengine/test_volcengine.py | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/litellm/llms/volcengine/chat/transformation.py b/litellm/llms/volcengine/chat/transformation.py index 52b3242c186..16bb1b9229b 100644 --- a/litellm/llms/volcengine/chat/transformation.py +++ b/litellm/llms/volcengine/chat/transformation.py @@ -63,6 +63,7 @@ class VolcEngineChatConfig(OpenAILikeChatConfig): "tool_choice", "function_call", "functions", + "response_format", "max_retries", "extra_headers", "thinking", diff --git a/tests/test_litellm/llms/volcengine/test_volcengine.py b/tests/test_litellm/llms/volcengine/test_volcengine.py index d472d52d2db..63ffb9154bd 100644 --- a/tests/test_litellm/llms/volcengine/test_volcengine.py +++ b/tests/test_litellm/llms/volcengine/test_volcengine.py @@ -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()