use case

Structured LLM output for your own language — guaranteed, not hoped for

the short answer

JSON mode guarantees structure only for JSON; for a custom DSL or config language, dslai compiles your grammar into a decoding constraint so the model's structured output is valid by construction, then validates it with a deterministic parser — extending the structured-output guarantee to any language you can describe with a grammar.

Structured-output features — JSON mode, function calling, schema-constrained responses — solve the problem only for the formats the provider built in. The moment your structure is your own DSL or config dialect, you're back to prompting and hoping, with no guarantee the result parses.

dslai extends the same idea — constrain the output to a grammar — to any language you can describe. This page covers what that buys you and how it compares to the built-in structured-output tools.

any grammarstructured output beyond built-in JSON modes

Beyond JSON mode

JSON mode works because the provider hard-codes the JSON grammar into decoding. Your DSL isn't in that list, so 'structured output' features don't cover it — they'll happily return a string that your parser then rejects.

dslai treats your grammar the way JSON mode treats JSON: as a decoding constraint. The model's output is forced to be a member of your language, so structure is guaranteed for the format you actually use, not just the ones that shipped.

Guarantee, then verify

Constrained generation makes the output valid; the deterministic validator proves it and gives an exact error on anything that didn't come from the constrained path — hand-written DSL in a pull request, say. Together they give the same confidence for your DSL that JSON schema validation gives for JSON.

It all flows from one grammar, so there's a single source of truth for what 'valid' means across generation and validation.

frequently asked

How is this different from JSON mode or function calling?
Those guarantee structure only for JSON-shaped output. dslai guarantees structure for any language you express as a grammar, including custom DSLs and config dialects.
Can I use it for config files, query languages, or rule languages?
Yes — alert rules, route guards, typed key=value config, small query languages, anything with a grammar. The playground ships examples of several.
Does the model still get to make real choices?
Yes. The constraint only removes options that would break the grammar; the model freely chooses among the valid ones, so content is still the model's, just always well-formed.
Where can I try it?
The dslai playground runs the constraint and the validator in your browser, free and without an account, so you can paste your grammar and see guaranteed-valid output immediately.

Last updated June 7, 2026

ready to try dslai?

open dslai