Local InferenceOpen SourceFreeActiveLocal hardware· intermediate · ~20 min setup
Guaranteed JSON from Local LLMs with Outlines
Force valid, schema-conformant JSON out of any local model.
Run this workflow
See exactly what it produces before you build it.
Build this with your agent
One copy-paste hands Claude Code, Codex, or Cursor the full recipe, steps included, nothing to fetch.
Intended Use
Anyone using local LLMs for tool-calling or pipeline outputs where the next step requires valid JSON.
Not for
- Free-form chat responses
- Code generation (different constraint model)
The Stack
Tested Against
outlines@0.1.xollama@0.5Side effects & data flow
- Network
- none, local only
- Writes
- no filesystem writes
- Credentials
- none required
Steps
- 1
Constrain generation
Define a Pydantic schema and let Outlines guarantee the output shape.
from outlines import models, generate from pydantic import BaseModel class Person(BaseModel): name: str age: int model = models.transformers('deepseek-v4') generator = generate.json(model, Person) result = generator('Generate a person')
Eval, 1 fixture
Last passed: verified 1mo agoschema-conformancerubrictimeout 60s · max $0Judge: heuristic-json-validate Rubric: Pass if the output parses as JSON AND has exactly the keys 'name' (string) and 'age' (integer).
Did this work for you?
Our CI checks the setup runs. You tell us if the whole thing worked. Tell us straight.
Related workflows
- Prove your meeting-notes pipeline never phones home (and gates on consent)
- Unsloth: write parametric memory in with a fine-tune config
- Validate an Apple Core AI export entry and skill plugin before you touch a Mac
- Serve NVIDIA Nemotron 3 Ultra yourself for high-throughput agents (vLLM)
- Serve GLM-5.1 yourself for long-horizon agentic coding (vLLM)
- Serve MiniMax M3 yourself for agentic coding (vLLM)
Liked this workflow?
Get new verified workflows in WebAfterAI, three issues a week (Tue, Thu, Sat).