diff --git a/python/sglang/srt/entrypoints/openai/serving_chat.py b/python/sglang/srt/entrypoints/openai/serving_chat.py index 042911f63..6179ab5c4 100644 --- a/python/sglang/srt/entrypoints/openai/serving_chat.py +++ b/python/sglang/srt/entrypoints/openai/serving_chat.py @@ -81,6 +81,11 @@ class OpenAIServingChat(OpenAIServingBase): f"This model supports at most {server_context_length} completion tokens." ) + if request.response_format and request.response_format.type == "json_schema": + schema = getattr(request.response_format.json_schema, "schema_", None) + if schema is None: + return "schema_ is required for json_schema response format request." + return None def _convert_to_internal_request(