Skip to main content
Ollama’s Cloud currently does not support structured outputs.
Structured outputs let you enforce a JSON schema on model responses so you can reliably extract structured data, describe images, or keep every reply consistent.

Generating structured JSON

Generating structured JSON with a schema

Provide a JSON schema to the format field.
It is ideal to also pass the JSON schema as a string in the prompt to ground the model’s response.

Example: Extract structured data

Define the objects you want returned and let the model populate the fields:

Example: Vision with structured outputs

Vision models accept the same format parameter, enabling deterministic descriptions of images:

Tips for reliable structured outputs

  • Define schemas with Pydantic (Python) or Zod (JavaScript) so they can be reused for validation.
  • Lower the temperature (e.g., set it to 0) for more deterministic completions.
  • Structured outputs work through the OpenAI-compatible API via response_format