[PR #93] fix(openai): serialize Responses tool constraints #91

Open
opened 2026-10-29 21:07:08 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/sglang/pull/93
Author: @yyj6666667
Created: 9/9/2026
Status: 🔄 Open

Base: main ← Head: fix/responses-tool-schema-serialization


📝 Commits (1)

  • 543926f fix(openai): serialize Responses tool constraints

📊 Changes

2 files changed (+22 additions, -1 deletions)

View changed files

📝 python/sglang/srt/entrypoints/openai/serving_responses.py (+12 -0)
📝 test/registered/unit/entrypoints/openai/test_dsv4_reasoning_responses.py (+10 -1)

📄 Description

Summary

  • serialize non-Harmony Responses tool-call constraints before they enter the scheduler
  • mirror the existing Chat Completions handling for JSON Schema and structural-tag constraints
  • add a regression test that verifies the scheduler cache key is hashable

Failure mode

Follow-up to #92. A /v1/responses request with a function tool and
"tool_choice": "required" produced a dict-valued json_schema. The Responses
adapter copied that dict directly into sampling_params; the grammar manager
then called self.cache.get(key) and crashed the scheduler with:

TypeError: unhashable type: 'dict'

Validation

  • black --check on both changed files
  • targeted unit suite: 11 passed, 8 subtests passed
  • qj5090 source-build E2E with DeepSeek-V4-Flash-0731:
    • required Responses function call: HTTP 200
    • previous_response_id + function_call_output continuation: HTTP 200
    • server remained healthy after both requests

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/sglang/pull/93 **Author:** [@yyj6666667](https://github.com/yyj6666667) **Created:** 9/9/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/responses-tool-schema-serialization` --- ### 📝 Commits (1) - [`543926f`](https://github.com/kvcache-ai/sglang/commit/543926fc6354a0d7add8c861a5b26f7b4f3ff818) fix(openai): serialize Responses tool constraints ### 📊 Changes **2 files changed** (+22 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `python/sglang/srt/entrypoints/openai/serving_responses.py` (+12 -0) 📝 `test/registered/unit/entrypoints/openai/test_dsv4_reasoning_responses.py` (+10 -1) </details> ### 📄 Description ## Summary - serialize non-Harmony Responses tool-call constraints before they enter the scheduler - mirror the existing Chat Completions handling for JSON Schema and structural-tag constraints - add a regression test that verifies the scheduler cache key is hashable ## Failure mode Follow-up to #92. A `/v1/responses` request with a function tool and `"tool_choice": "required"` produced a dict-valued `json_schema`. The Responses adapter copied that dict directly into `sampling_params`; the grammar manager then called `self.cache.get(key)` and crashed the scheduler with: ```text TypeError: unhashable type: 'dict' ``` ## Validation - `black --check` on both changed files - targeted unit suite: `11 passed, 8 subtests passed` - qj5090 source-build E2E with DeepSeek-V4-Flash-0731: - required Responses function call: HTTP 200 - `previous_response_id` + `function_call_output` continuation: HTTP 200 - server remained healthy after both requests --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/sglang#91
No description provided.