{
  "schemaVersion": "flowdrome.workflow.v1",
  "id": "",
  "name": "AI · 10 — Output parser (LLM → valid JSON)",
  "version": "0",
  "status": "draft",
  "nodes": [
    {
      "id": "seed",
      "type": "input.inject",
      "label": "Question",
      "category": "trigger",
      "config": {
        "contentType": "application/json",
        "payload": {
          "question": "Name the capital of France and its country."
        }
      },
      "position": {
        "x": 0,
        "y": 0
      }
    },
    {
      "id": "ask",
      "type": "ai.prompt",
      "label": "Ask for JSON",
      "category": "ai",
      "config": {
        "provider": "ollama",
        "baseUrl": "",
        "apiKey": "",
        "model": "qwen2.5:1.5b",
        "systemPrompt": "Reply with ONLY a JSON object exactly like {\"city\":\"...\",\"country\":\"...\"} — no prose, no markdown.",
        "promptMode": "field",
        "promptField": "question",
        "temperature": "0",
        "maxTokens": 100,
        "jsonMode": false,
        "timeoutMs": 120000
      },
      "position": {
        "x": 530,
        "y": 0
      },
      "attachments": {
        "model": "llm"
      }
    },
    {
      "id": "llm",
      "type": "ai.model",
      "label": "Ollama (local)",
      "category": "ai",
      "config": {
        "provider": "ollama",
        "baseUrl": "",
        "apiKey": "",
        "model": "qwen2.5:1.5b",
        "models": [],
        "temperature": 0.2,
        "maxTokens": 512
      },
      "position": {
        "x": 530,
        "y": 222
      }
    },
    {
      "id": "parse",
      "type": "processing.output-parser",
      "label": "Parse",
      "category": "ai",
      "config": {
        "inputField": "reply",
        "mode": "json",
        "errorOnInvalid": false
      },
      "position": {
        "x": 1060,
        "y": 0
      }
    },
    {
      "id": "out",
      "type": "utility.console",
      "label": "Parsed object",
      "category": "utility",
      "config": {
        "message": "valid={{ $json.valid }} city={{ $json.parsed.city }} country={{ $json.parsed.country }}"
      },
      "position": {
        "x": 1590,
        "y": 0
      }
    }
  ],
  "edges": [
    {
      "id": "e0",
      "sourceNodeId": "seed",
      "sourcePort": "output",
      "targetNodeId": "ask",
      "targetPort": "input"
    },
    {
      "id": "e1",
      "sourceNodeId": "ask",
      "sourcePort": "output",
      "targetNodeId": "parse",
      "targetPort": "input"
    },
    {
      "id": "e2",
      "sourceNodeId": "parse",
      "sourcePort": "output",
      "targetNodeId": "out",
      "targetPort": "input"
    }
  ],
  "triggers": [
    {
      "id": "t0",
      "nodeId": "seed"
    }
  ],
  "meta": {
    "snippets": [],
    "source": "template-gallery",
    "description": "LLMs return prose; pipelines need JSON. The ◈-wired Chat is told to answer in JSON, and the Output Parser turns that answer (even when it is wrapped in prose or code fences) into a validated object downstream nodes can use."
  }
}