{
  "schema_version": "1.0",
  "nodes": [
    {
      "id": "notes",
      "type": "input/text",
      "label": "Site-visit notes",
      "parameters": {
        "multiline": true,
        "required": true,
        "text": "visited tue 29/9 with aoife and ciaran. two walls of units, keep the window free, want an island w breakfast bar (oak top). they keep water+power during works. ~5 days on site. appliances theirs, we fit."
      }
    },
    {
      "id": "quote",
      "type": "input/json_value",
      "label": "Quote from the system",
      "parameters": {
        "required": true
      }
    },
    {
      "id": "writer",
      "type": "ai/text_generation",
      "label": "Write the introduction",
      "parameters": {
        "response_format": "json_object",
        "temperature": 0.4,
        "max_tokens": 1500,
        "system_prompt": "You write the introduction of a joinery firm's quote, in English, addressed to the client by the firm (\"we\").\nUse only what the site-visit notes say. Never write prices, amounts, quantities of money, dates of payment or guarantees.\nTwo or three sentences, warm and precise, no exclamation marks, between 120 and 420 characters.\nReturn one JSON object and nothing else: { \"introduction\": \"…\" }."
      }
    },
    {
      "id": "intro_contract",
      "type": "utility/json_schema_validate",
      "label": "Introduction fits the page",
      "parameters": {
        "schema_source": "inline",
        "schema_definition": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "additionalProperties": false,
          "required": [
            "introduction"
          ],
          "properties": {
            "introduction": {
              "type": "string",
              "minLength": 120,
              "maxLength": 420,
              "description": "Two or three sentences to the client, from the site-visit notes only."
            }
          }
        },
        "mode": "fail"
      }
    },
    {
      "id": "render",
      "type": "design/template_render",
      "label": "Compose the quote",
      "parameters": {
        "template_id": "__TEMPLATE_ID__",
        "template_revision": "__TEMPLATE_REVISION__",
        "output": "both",
        "page_selection": "1",
        "missing_policy": "fail_required",
        "overflow_policy": "template",
        "max_repeat": 20
      }
    },
    {
      "id": "quote_pdf",
      "type": "output/pdf",
      "label": "Quote — PDF",
      "parameters": {}
    },
    {
      "id": "quote_image",
      "type": "output/image",
      "label": "Quote — first page",
      "parameters": {}
    },
    {
      "id": "layout_report",
      "type": "output/json",
      "label": "Layout report",
      "parameters": {}
    },
    {
      "id": "intro_output",
      "type": "output/json",
      "label": "Introduction",
      "parameters": {}
    }
  ],
  "connections": [
    {
      "from_node": "notes",
      "from_output": "text",
      "to_node": "writer",
      "to_input": "prompt"
    },
    {
      "from_node": "writer",
      "from_output": "json",
      "to_node": "intro_contract",
      "to_input": "document"
    },
    {
      "from_node": "intro_contract",
      "from_output": "normalized_json",
      "to_node": "render",
      "to_input": "data_0"
    },
    {
      "from_node": "quote",
      "from_output": "json",
      "to_node": "render",
      "to_input": "data_1"
    },
    {
      "from_node": "render",
      "from_output": "pdf",
      "to_node": "quote_pdf",
      "to_input": "pdf"
    },
    {
      "from_node": "render",
      "from_output": "image",
      "to_node": "quote_image",
      "to_input": "image"
    },
    {
      "from_node": "render",
      "from_output": "layout_report",
      "to_node": "layout_report",
      "to_input": "json"
    },
    {
      "from_node": "intro_contract",
      "from_output": "normalized_json",
      "to_node": "intro_output",
      "to_input": "json"
    }
  ]
}
