{
  "name": "Webhook-enabled AI PDF analyzer",
  "nodes": [
    {
      "id": "505f25b4-eaa7-4d42-98d9-2154d7d4cc81",
      "name": "File Ref",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -1360,
        280
      ]
    },
    {
      "id": "59721669-a3a9-48ab-8cb0-29ea0af84f6d",
      "name": "Success1",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        620,
        -20
      ]
    },
    {
      "id": "16479572-c3a6-4127-9bf2-db7380bd734c",
      "name": "Is Valid File?",
      "type": "n8n-nodes-base.if",
      "position": [
        -660,
        280
      ]
    },
    {
      "id": "d35868fb-2a0b-4f07-a942-216a8d226b46",
      "name": "Get Filesize",
      "type": "n8n-nodes-base.code",
      "position": [
        -980,
        280
      ]
    },
    {
      "id": "87e6b82c-4099-4435-b47f-647ae0b97d39",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -820,
        280
      ]
    },
    {
      "id": "e4f623cd-418b-49f1-bc1b-2e804a089617",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        140
      ],
      "parameters": {
        "width": 720,
        "height": 480,
        "content": "### 2. Validate PDF File\nWe need to add validation here to meet service limits of our LLM. Here, we need to get for filesize and number of pages. "
      }
    },
    {
      "id": "ece12347-4205-447a-85cd-298bfa7595e0",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        -120
      ],
      "parameters": {
        "width": 600,
        "height": 480,
        "content": "### 3. Document Parsing with Gemini API \nGoogle Gemini is used to breakdown the PDF into topics and provide insights for each. The number of topics and insights are not set and can be variable."
      }
    },
    {
      "id": "c7197f2f-7ac9-4c97-bd58-859c1d0950f0",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        340,
        -120
      ],
      "parameters": {
        "width": 480,
        "height": 280,
        "content": "### 5. Format Response\nFinally, we'll format the output to return the summary as markdown."
      }
    },
    {
      "id": "9ef4b032-de21-48bd-ad3a-fb1cf391fe77",
      "name": "Information Extractor",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        -180,
        40
      ]
    },
    {
      "id": "4d9f3117-972b-417b-9dee-4098bbd71102",
      "name": "Format Response",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        -20
      ]
    },
    {
      "id": "db32ecb9-79d0-45ee-aced-05aca99c9f27",
      "name": "400 Error",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -480,
        440
      ]
    },
    {
      "id": "61d6e5e7-dcd7-4cdc-82be-8fec58f26e5a",
      "name": "500 Error",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        140,
        120
      ]
    },
    {
      "id": "732d7d7b-f7f5-4342-93b7-e8b49d381dfb",
      "name": "Get File Hash",
      "type": "n8n-nodes-base.crypto",
      "position": [
        -1180,
        280
      ]
    },
    {
      "id": "e6221a49-d4d8-4aa5-bbd8-69b885ff7254",
      "name": "POST /ai_pdf_summariser",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1520,
        280
      ]
    },
    {
      "id": "3d605049-571f-45d2-b1ba-914f0c9d68f4",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1680,
        140
      ],
      "parameters": {
        "width": 280,
        "height": 100,
        "content": "### POST /ai_pdf_summariser\nCall this endpoint to upload a document for summarising."
      }
    },
    {
      "id": "d79d5cf3-2f7c-459c-9977-9e0a77ed8d7b",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -100,
        220
      ]
    }
  ],
  "connections": {
    "File Ref": {
      "main": [
        [
          {
            "node": "Get File Hash",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Filesize": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get File Hash": {
      "main": [
        [
          {
            "node": "Get Filesize",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Valid File?": {
      "main": [
        [
          {
            "node": "Information Extractor",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "400 Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Response": {
      "main": [
        [
          {
            "node": "Success1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Is Valid File?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Information Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Information Extractor": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "500 Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "POST /ai_pdf_summariser": {
      "main": [
        [
          {
            "node": "File Ref",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}