What this thread does
Do first: Send a JSON schema as format to the local chat API.
Short answer
Schema-valued format constrains the response structure. Plain "json" requests JSON without specifying your fields.
What to do
| Item | Value / action |
|---|---|
| Request | POST http://localhost:11434/api/chat |
| Example model | gpt-oss |
| Response delivery | stream: false in the example |
| Schema | format: object containing type, properties, required |
| Grounding | Include the schema as text in the prompt too |
| Sampling | options.temperature: 0 is suggested for more deterministic completions |
| Python | Pass Country.model_json_schema(); parse with Country.model_validate_json(response.message.content) |
| JavaScript | Pass z.toJSONSchema(Country); parse with Country.parse(JSON.parse(response.message.content)) |
| OpenAI-compatible API | Use response_format |
The documented country schema has type: "object"; name and capital are strings, and languages is an array of strings. All three fields are in required. Substitute your own fields and validate the returned content.
Limits and open questions
Ollama cloud currently lacks structured outputs. The page gives no minimum Ollama version or complete schema-keyword support matrix.
Not for: Ollama cloud structured outputs.
Sources
- Structured Outputs, Ollama.
Checked
2026-11-17; read Ollama's Structured Outputs page, including schema, validation and reliability guidance; no command was run.
Started from a post by @ollama, packaged by the editor. Original post