{
  "name": "Classify & auto-sort invoices in Google Drive with GPT-4o",
  "nodes": [
    {
      "id": "c3eb01ce-ad98-4c88-8426-f6ff738ec932",
      "name": "Download File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -1600,
        632
      ]
    },
    {
      "id": "f4ae926e-f3a2-4471-84e8-5b9c37050d04",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -2048,
        632
      ]
    },
    {
      "id": "bbf3ef7d-1a6e-44cc-b878-1c3a0c73535b",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -928,
        192
      ]
    },
    {
      "id": "2a77af9f-32db-49c0-9655-308a2dc2d9c4",
      "name": "Azure OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        -832,
        416
      ]
    },
    {
      "id": "c10f4dbc-9378-426b-bf74-5873f4c9194d",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1152,
        632
      ]
    },
    {
      "id": "aedbda2e-2625-437a-a138-2ee019fad248",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -1376,
        632
      ]
    },
    {
      "id": "6018cc36-6bb0-45c8-946f-77fc87beb52b",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -528,
        176
      ]
    },
    {
      "id": "11a50e6e-4bb3-41bc-9a3f-e5e12b898209",
      "name": "Search files and folders",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -1824,
        632
      ]
    },
    {
      "id": "934c8224-4adb-491a-a696-f60292088eb0",
      "name": "Manufacturing",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -304,
        488
      ]
    },
    {
      "id": "7db81eed-1d18-4af6-850e-9acc696b4f84",
      "name": "Retail",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -304,
        296
      ]
    },
    {
      "id": "c200afa0-87b3-4e81-8b72-3735e21c36c9",
      "name": "EdTech",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -304,
        680
      ]
    },
    {
      "id": "249fa33e-26e5-4668-b54f-e3ba5e10099d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        800
      ],
      "parameters": {
        "width": 320,
        "height": 240,
        "content": "Search files and folders (Google Drive)\n\nType: Google Drive node\n\nOperation: Search for files and folders\n\nWhat it does:\nSearches for files in a specific Google Drive folder (ID: - folder named \"\")\nRe"
      }
    },
    {
      "id": "d210bbff-936d-4216-afcd-6b2646fdb00a",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1600,
        800
      ],
      "parameters": {
        "width": null,
        "height": 240,
        "content": "Download File (Google Drive)\n\nType: Google Drive node\nOperation: Download\nWhat it does:\n\nDownloads each file found by the previous node\nUses the file ID from the search results (={{ $json.id }})\nDownl"
      }
    },
    {
      "id": "88dd5e88-6673-480e-8005-27398846f504",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        400
      ],
      "parameters": {
        "width": 272,
        "height": 208,
        "content": "Extract from File (Extract from File)\n\nType: Extract from File node\nOperation: PDF extraction\nWhat it does:\n\nExtracts text content from PDF files\nConverts the downloaded PDF invoices into readable tex"
      }
    },
    {
      "id": "5c87b592-9143-4bfb-8f54-2f8a92fff83b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        800
      ],
      "parameters": {
        "width": null,
        "height": 240,
        "content": "Loop Over Items (Split in Batches)\n\nType: Split in Batches node\nWhat it does:\n\nProcesses multiple files one by one in a loop\nEnsures each invoice is processed individually\nManages batch processing of "
      }
    },
    {
      "id": "983aa05a-34b6-44db-bc1e-a2eaed231848",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1248,
        -16
      ],
      "parameters": {
        "width": 288,
        "height": 288,
        "content": "#AI Agent (LangChain Agent)\n\nType: LangChain AI Agent\nWhat it does:\n\nAnalyzes the extracted text content from invoices\nUses a system prompt that instructs it to classify invoices into three categories"
      }
    },
    {
      "id": "90a266fe-ceda-4e79-b4b0-a772ee0234c7",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        528
      ],
      "parameters": {
        "width": 288,
        "height": 240,
        "content": "Azure OpenAI Chat Model (Language Model)\n\nType: Azure OpenAI Chat Model\nModel: GPT-4o-mini\nWhat it does:\n\nProvides the AI language model for the AI Agent\nConnected to the AI Agent to power the classif"
      }
    },
    {
      "id": "f9daf053-6ab0-43b2-8878-c07829c17b52",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -144
      ],
      "parameters": {
        "width": 288,
        "height": 304,
        "content": "Switch (Conditional Logic)\n\nType: Switch node\nWhat it does:\n\nRoutes the workflow based on AI classification results\nHas three conditional branches:\n\nIf output equals \"Retail\" → Route to Retail folder\n"
      }
    }
  ],
  "connections": {
    "EdTech": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retail": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Retail",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Manufacturing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "EdTech",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manufacturing": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Search files and folders": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}