Skip to content

Support for Full Structured Output Constraints (regex, ebnf) and Grammar Backend Selection? #29

Description

@endolith

According to SGLang's Structured Outputs docs, SGLang supports constraining outputs via json_schema, regex, or ebnf, and allows choosing grammar backends (xgrammar, outlines, llguidance)—some of which (like Outlines) enforce JSON property order.

However, the current RunPod worker only accepts json_schema via the OpenAI-compatible response_format, and does not expose:

  • regex or ebnf constraints,
  • --grammar-backend configuration (e.g., to use outlines for deterministic field ordering).

This means ordered structured output is impossible with this worker, even though SGLang supports it upstream.

Example error when trying ebnf:

{
  "response_format": { "type": "ebnf", "ebnf": { "schema": "..." } }
}

ValidationError: Input should be 'text', 'json_object' or 'json_schema'

Request:

  1. Add support for regex and ebnf in response_format.type, or
  2. Allow setting GRAMMAR_BACKEND via env var (e.g., outlines for field-order enforcement).

This would enable use cases requiring strict output ordering or non-JSON structured formats.

[this was written by AI]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions