Brain-Score 84/100 TECH Matt Williams · 7:59

The Truth About Ollama's Structured Outputs

3-Second Blueprint (English)

  1. Ollama's legacy JSON mode guarantees valid JSON syntax but fails to enforce schemas, often hallucinating invalid enum labels.
  2. Ollama 0.5.0 Structured Outputs accept explicit JSON Schemas via REST, Pydantic, or Zod to constrain model responses to defined fields.
  3. Strict schema verification eliminates out-of-spec enum values, though rigid case sensitivity can return empty objects on minor mismatches.
Ollama 0.5.0Structured OutputsJSON SchemaPydantic & Zod

3-Sekunden-Fazit (Deutsch)

  1. Ollamas älterer JSON-Modus garantiert nur gültige JSON-Syntax, erzwingt aber kein Schema und halluziniert oft falsche Enum-Werte.
  2. Mit Structured Outputs ab Ollama 0.5.0 lassen sich explizite JSON-Schemata über REST, Pydantic oder Zod verbindlich vorgeben.
  3. Strikte Schemaprüfung verhindert falsche Enums, kann bei abweichender Groß-/Kleinschreibung aber leere Objekte zurückgeben.
Ollama 0.5.0Structured OutputsJSON-SchemaPydantic & Zod

Note / Hinweis: Blueprints are AI-generated educational summaries (0% Politics · 0% Religion · 0% Brainrot) and do not constitute medical, legal, or financial advice. / KI-generierte Zusammenfassung zu Bildungszwecken – ersetzt keine medizinische, rechtliche oder finanzielle Fachberatung.