← Back to Pull requests

feat: support structured Responses output in native vLLM #592

Open
unknown opened this pull request with 398 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 28, 2026 04:16 UTC
Author

Summary

The native runner from #382 returns HTTP 400 for both Responses JSON formats, including ordinary OpenAI SDK responses.parse calls. This extends #231 to native inference by passing the request's format to vLLM's constrained decoder. Advances #362 and #314.

Changes by API

| API | What changed |
| --- | --- |
| Responses (/v1/responses, native mode) | Supports json_object and ordered json_schema. A stored answer can be continued in plain text or with a new schema. Invalid schemas, unresolved local references, and unsupported decoder constraints return 400 on text.format during validation. |

Flow

flowchart LR
    A[Responses request and resolved history] --> B[Native request adapter]
    B -->|Validated format and assistant text| C[vLLM constrained decoding]
    C --> D[Shared Responses delivery and storage]

Test Plan

  • On an Apple M5 Max with Qwen2.5-0.5B-Instruct, native main accepted plain text and rejected both JSON formats. The updated native runner and HTTP backend produced the same ordered values over JSON, SSE and WebSocket. Checked retrieval, changing and clearing the format on continuation, and the OpenAI Python SDK 3.60.0. The native runner also completed a client function call followed by a schema-constrained answer and parsed a nested Pydantic model with a local $ref. A one-token limit returned incomplete over JSON and SSE. Used vLLM Metal 0.34.0, XGrammar 0.2.8 and the pinned Rust frontend f2f9edca.

  • Recorded nine native gateway requests per transport (JSON and SSE). The default structured_output suite runs the native frontend, shared HTTP handlers and SQLite. It checks the decoder grammar, rendered history, returned format, ordered output, SSE deltas and stored tool-call identity. The existing OpenAI edge-tools-settings recording supplies the answer schema, markers and tool-continuation contract. OpenAI reference recording

  • Replayed both captures against live native inference with the same assertions. Both offline tests also failed when schema forwarding, the answer schema in the tool grammar, or stored assistant replay was separately removed. Offline, live and recording commands

  • cargo test --workspace --locked --no-fail-fast on macOS finished with 3,298 passed, 2 failed and 26 ignored. The two Messages unreachable-upstream tests also return 504 on untouched 8ebe927d, where they expect 502. The opt-in live native test passed when run explicitly. All 14 agentic-vllm tests, workspace Clippy with warnings denied, formatting, pre-commit and the strict documentation build passed. The macOS wheel passed its 134 Python tests. Ubuntu workspace CI
  • Diff: 398 lines (+298 / -100) across 4 files Reviewer: franciscojavierarceo Review duration: 3667m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.48) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 398 lines diff across 4 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.358
    Shallow Review Depth shallow_review_depth
    0.344
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #592"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 48.2% (MEDIUM) · Higher = larger blast radius
    48.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.5% · Safe to merge
    27.5%