{
  "schema_version": "1.0",
  "nodes": [
    {
      "id": "service",
      "type": "input/text",
      "label": "Service and date",
      "parameters": {
        "text": "Dinner · Friday 2 October",
        "multiline": false,
        "required": true
      }
    },
    {
      "id": "notes",
      "type": "input/text",
      "label": "Chef's notes",
      "parameters": {
        "multiline": true,
        "required": true,
        "text": "pumpkins arrived from kent this morning (ravioli). lamb braised all afternoon, polenta from bergamo. new: courgette flowers, lamb. suggest starting light."
      }
    },
    {
      "id": "menu",
      "type": "input/json_value",
      "label": "Menu",
      "parameters": {
        "required": true
      }
    },
    {
      "id": "writer",
      "type": "ai/text_generation",
      "label": "Write the chef's note",
      "parameters": {
        "response_format": "json_object",
        "temperature": 0.5,
        "max_tokens": 1500,
        "system_prompt": "You write the short note printed at the top of an Italian restaurant's evening menu, in English, in the chef's voice.\nUse only what the chef's notes say. Never mention prices, never name a dish that the notes do not mention, never promise.\nTwo sentences, warm and plain, no exclamation marks, at most 220 characters in total.\nReturn one JSON object and nothing else: { \"chef_note\": \"…\" }."
      }
    },
    {
      "id": "note_contract",
      "type": "utility/json_schema_validate",
      "label": "Note fits the page",
      "parameters": {
        "schema_source": "inline",
        "schema_definition": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "additionalProperties": false,
          "required": [
            "chef_note"
          ],
          "properties": {
            "chef_note": {
              "type": "string",
              "minLength": 60,
              "maxLength": 220,
              "description": "Two sentences in English about tonight, warm and plain, no prices, no dish that is not in the menu."
            }
          }
        },
        "mode": "fail"
      }
    },
    {
      "id": "render",
      "type": "design/template_render",
      "label": "Compose the menu",
      "parameters": {
        "template_id": "__TEMPLATE_ID__",
        "template_revision": "__TEMPLATE_REVISION__",
        "output": "both",
        "page_selection": "all",
        "missing_policy": "fail_required",
        "overflow_policy": "template",
        "max_repeat": 10
      }
    },
    {
      "id": "menu_pdf",
      "type": "output/pdf",
      "label": "Menu — PDF",
      "parameters": {}
    },
    {
      "id": "menu_image",
      "type": "output/image",
      "label": "Menu — image",
      "parameters": {}
    },
    {
      "id": "layout_report",
      "type": "output/json",
      "label": "Layout report",
      "parameters": {}
    },
    {
      "id": "note_output",
      "type": "output/json",
      "label": "Chef note",
      "parameters": {}
    }
  ],
  "connections": [
    {
      "from_node": "notes",
      "from_output": "text",
      "to_node": "writer",
      "to_input": "prompt"
    },
    {
      "from_node": "writer",
      "from_output": "json",
      "to_node": "note_contract",
      "to_input": "document"
    },
    {
      "from_node": "note_contract",
      "from_output": "normalized_json",
      "to_node": "render",
      "to_input": "data"
    },
    {
      "from_node": "service",
      "from_output": "text",
      "to_node": "render",
      "to_input": "service_line"
    },
    {
      "from_node": "menu",
      "from_output": "json",
      "to_node": "render",
      "to_input": "sections"
    },
    {
      "from_node": "render",
      "from_output": "pdf",
      "to_node": "menu_pdf",
      "to_input": "pdf"
    },
    {
      "from_node": "render",
      "from_output": "image",
      "to_node": "menu_image",
      "to_input": "image"
    },
    {
      "from_node": "render",
      "from_output": "layout_report",
      "to_node": "layout_report",
      "to_input": "json"
    },
    {
      "from_node": "note_contract",
      "from_output": "normalized_json",
      "to_node": "note_output",
      "to_input": "json"
    }
  ]
}
