From e73fa00981f0e30fc2cc0d77013160b705077106 Mon Sep 17 00:00:00 2001 From: alp Date: Wed, 14 Oct 2026 12:42:20 -0700 Subject: [PATCH] [Bugfix][Frontend] Apply the JSON schema in Cohere Chat v2 response_format (#60586) Signed-off-by: mottopanikeiku <176798723+mottopanikeiku@users.noreply.github.com> Co-authored-by: mottopanikeiku <176798723+mottopanikeiku@users.noreply.github.com> --- tests/entrypoints/cohere/test_serving_conversion.py | 11 +++++++++++ vllm/entrypoints/cohere/serving.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/entrypoints/cohere/test_serving_conversion.py b/tests/entrypoints/cohere/test_serving_conversion.py index 7136b4acdd..8cc05ec45f 100644 --- a/tests/entrypoints/cohere/test_serving_conversion.py +++ b/tests/entrypoints/cohere/test_serving_conversion.py @@ -770,6 +770,17 @@ class TestResponseFormat: dumped = result.response_format.json_schema.model_dump(exclude_none=True) assert dumped["json_schema"] == schema + def test_json_schema_reaches_sampling_params(self): + schema = {"type": "object", "properties": {"a": {"type": "string"}}} + request = _make_request( + response_format={"type": "json_object", "json_schema": schema} + ) + + params = _convert(request).to_sampling_params(16, {}) + + assert params.structured_outputs is not None + assert params.structured_outputs.json == schema + # ====================================================================== # Tools / tool_choice diff --git a/vllm/entrypoints/cohere/serving.py b/vllm/entrypoints/cohere/serving.py index 4ce734a812..45eb369e78 100644 --- a/vllm/entrypoints/cohere/serving.py +++ b/vllm/entrypoints/cohere/serving.py @@ -601,7 +601,7 @@ class CohereServingChatV2(OpenAIServingChat): json_schema=( JsonSchemaResponseFormat( name="cohere_v2_json_schema", - json_schema=rf.json_schema, + schema=rf.json_schema, ) if rf.json_schema else None