{
  "name": "Build a cost estimation chatbot with Mistral AI, OCR & Supabase",
  "nodes": [
    {
      "id": "4f90c351-3a27-4cef-8165-84b81f339462",
      "name": "Mistral Cloud Chat Model4",
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "position": [
        -416,
        544
      ]
    },
    {
      "id": "02d5fb5f-8410-4d2a-9dc6-9a4e3964fa84",
      "name": "Simple Memory1",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -112,
        560
      ]
    },
    {
      "id": "d09cc06a-b1a5-4d19-90c3-0c58add13b4f",
      "name": "Calculator1",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        160,
        560
      ]
    },
    {
      "id": "ce7fb065-c77e-4b31-b98c-ac18abe4d983",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1952,
        176
      ]
    },
    {
      "id": "54e74d07-150d-440f-a53e-9995baa5cff1",
      "name": "Send a message in Gmail",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        352,
        544
      ]
    },
    {
      "id": "eb045f4b-b2e3-477c-8559-8398a886ca16",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2064,
        -32
      ],
      "parameters": {
        "width": 256,
        "height": 464,
        "content": "## Input endpoints\nWebhook and chat trigger receive user queries from website or n8n chat UI.\n"
      }
    },
    {
      "id": "f868877e-a47e-4366-9800-424072efbdc9",
      "name": "ai agent cost estimate",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        96,
        176
      ]
    },
    {
      "id": "85b0230d-f7ce-43d1-b482-6468a25f1cc4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        64
      ],
      "parameters": {
        "width": 544,
        "height": 288,
        "content": "## AI Agent\nGuides users through the cost estimation form for fabrics and tiles and runs calculations.\n"
      }
    },
    {
      "id": "dcc5f3ad-3a88-4fed-9d15-3d798d8eb46a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        432
      ],
      "parameters": {
        "width": 448,
        "height": 256,
        "content": "## Tools: Calculator & Gmail\nCalculator: performs numeric calculations. Gmail: sends quotes or escalations to support.\n"
      }
    },
    {
      "id": "660ec177-6b8f-4591-a9e2-8be6edc8eedd",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2624,
        16
      ],
      "parameters": {
        "width": 416,
        "height": 624,
        "content": "## Cost Estimate Agent — Overview\n\n## How it works\n- Scans uploaded bills or receipts using OCR.  \n- Extracts key details like items, quantities, and prices.  \n- Calculates total cost and tax automati"
      }
    },
    {
      "id": "d41425c9-72a5-47e6-b1d4-00ee48725736",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        464
      ],
      "parameters": {
        "width": null,
        "height": 192,
        "content": "### Memory \nStores short-term session context so the agent can recall prior user inputs "
      }
    },
    {
      "id": "caa00085-20b6-46f4-84b5-61e9da0e0423",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        464
      ],
      "parameters": {
        "width": 272,
        "height": 192,
        "content": "## Mistral Model\nHandles conversation logic for the cost estimation agent. "
      }
    },
    {
      "id": "897a43ec-b434-41cd-aa4b-713bf05fa406",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -1440,
        96
      ]
    },
    {
      "id": "0c8127b4-405d-452f-9874-e05e684d764d",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        -176,
        144
      ]
    },
    {
      "id": "d6099fc1-790e-4bc1-8cb3-ebdc2ab488eb",
      "name": "CHECK IF BINARY FILE IS PRESENT OR NOT",
      "type": "n8n-nodes-base.if",
      "position": [
        -1664,
        160
      ]
    },
    {
      "id": "fde26d6a-7a41-443e-9973-f0d2c68ffde3",
      "name": "NORMALIZE binary file",
      "type": "n8n-nodes-base.code",
      "position": [
        -1216,
        96
      ]
    },
    {
      "id": "bae39571-4a46-40a3-8a5e-f8fd977cf72d",
      "name": "OCR (ANY OCR API )",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -736,
        -256
      ]
    },
    {
      "id": "5296f45c-fe21-4b06-adea-63bb93ece610",
      "name": "STORE OCR OUTPUT",
      "type": "n8n-nodes-base.supabase",
      "position": [
        -320,
        80
      ]
    },
    {
      "id": "d580dab1-84ca-4e21-8d51-d451cd6851f8",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        -352
      ],
      "parameters": {
        "width": 192,
        "height": 272,
        "content": "### use any ocr(mistral or own hosted ocr)"
      }
    },
    {
      "id": "a1e5e3cc-e235-48c8-be61-babcd43dadc9",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        0
      ],
      "parameters": {
        "width": 224,
        "height": 272,
        "content": "## normalize binary file name "
      }
    },
    {
      "id": "c6fac97d-7110-4cf7-911d-10a03fe4a2b4",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        -16
      ],
      "parameters": {
        "width": 160,
        "height": 288,
        "content": "### store ocr output in supbase"
      }
    },
    {
      "id": "822d5178-03f4-4553-bf53-83eb05f26cd8",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1728,
        48
      ],
      "parameters": {
        "width": null,
        "height": 256,
        "content": "## check if user query have binary file or not ?"
      }
    },
    {
      "id": "a577dfab-3f20-47bd-be7b-64c1cf0f85ec",
      "name": "Supabase Get",
      "type": "n8n-nodes-base.supabaseTool",
      "position": [
        720,
        528
      ]
    },
    {
      "id": "50fe88db-002a-49b6-a124-270a5e7d43ec",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        432
      ],
      "parameters": {
        "width": 272,
        "height": 240,
        "content": "## get ocr output from supbase"
      }
    },
    {
      "id": "15d4bfb8-d049-422c-8541-3bf7aaacedf7",
      "name": "Mistral Upload",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1008,
        96
      ]
    },
    {
      "id": "9de46179-9b2d-4aca-8b4c-c3b8938e7646",
      "name": "Mistral Signed URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -768,
        96
      ]
    },
    {
      "id": "49df803d-8805-483b-8598-a616c589edb2",
      "name": "Mistral DOC OCR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -560,
        96
      ]
    },
    {
      "id": "db0b917c-8843-4061-a88f-d3263ec1d4b0",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        -64
      ],
      "parameters": {
        "width": 608,
        "height": 320,
        "content": "## MISTRAL OCR\n [OCR Guide](https://mistral.ai/news/mistral-ocr)\n1. UPLOAD FILE\n2. GET SIGNED URL\n3. GET EXTRACT DATA AFTER USING MISTRAL OCR"
      }
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "ai agent cost estimate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "NORMALIZE binary file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculator1": {
      "ai_tool": [
        [
          {
            "node": "ai agent cost estimate",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Get": {
      "ai_tool": [
        [
          {
            "node": "ai agent cost estimate",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Upload": {
      "main": [
        [
          {
            "node": "Mistral Signed URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory1": {
      "ai_memory": [
        [
          {
            "node": "ai agent cost estimate",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Mistral DOC OCR": {
      "main": [
        [
          {
            "node": "STORE OCR OUTPUT",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "STORE OCR OUTPUT": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Signed URL": {
      "main": [
        [
          {
            "node": "Mistral DOC OCR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OCR (ANY OCR API )": {
      "main": [
        []
      ]
    },
    "NORMALIZE binary file": {
      "main": [
        [
          {
            "node": "Mistral Upload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Gmail": {
      "ai_tool": [
        [
          {
            "node": "ai agent cost estimate",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Cloud Chat Model4": {
      "ai_languageModel": [
        [
          {
            "node": "ai agent cost estimate",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "CHECK IF BINARY FILE IS PRESENT OR NOT",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CHECK IF BINARY FILE IS PRESENT OR NOT": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}