{
  "name": "PDF Text Extract and LLM Summary",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "pdf-summarize",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "pts0001-0001-4000-8000-000000000001",
      "name": "Receive PDF Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [240, 300]
    },
    {
      "parameters": {
        "url": "={{ $json.body.pdfUrl }}",
        "options": {
          "responseType": "arraybuffer",
          "timeout": 60000
        }
      },
      "id": "pts0001-0002-4000-8000-000000000002",
      "name": "Fetch PDF File",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [460, 300]
    },
    {
      "parameters": {
        "operation": "pdf",
        "options": {}
      },
      "id": "pts0001-0003-4000-8000-000000000003",
      "name": "Extract PDF Text",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [680, 300]
    },
    {
      "parameters": {
        "resource": "text",
        "operation": "message",
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list"
        },
        "messages": {
          "values": [
            {
              "content": "You are a document summarizer. Produce a concise, structured summary of the following PDF text. Include: (1) a 2-3 sentence executive summary, (2) key points as bullet list, (3) any action items or next steps.\n\nDocument text:\n{{ $json.text }}"
            }
          ]
        },
        "options": {
          "temperature": 0.3,
          "maxTokens": 1024
        }
      },
      "id": "pts0001-0004-4000-8000-000000000004",
      "name": "Summarize with GPT",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1,
      "position": [900, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "field1",
              "name": "summary",
              "value": "={{ $json.message.content }}",
              "type": "string"
            },
            {
              "id": "field2",
              "name": "sourceUrl",
              "value": "={{ $('Receive PDF Webhook').item.json.body.pdfUrl }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "pts0001-0005-4000-8000-000000000005",
      "name": "Format Response",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [1120, 300]
    }
  ],
  "connections": {
    "Receive PDF Webhook": {
      "main": [[{ "node": "Fetch PDF File", "type": "main", "index": 0 }]]
    },
    "Fetch PDF File": {
      "main": [[{ "node": "Extract PDF Text", "type": "main", "index": 0 }]]
    },
    "Extract PDF Text": {
      "main": [[{ "node": "Summarize with GPT", "type": "main", "index": 0 }]]
    },
    "Summarize with GPT": {
      "main": [[{ "node": "Format Response", "type": "main", "index": 0 }]]
    }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "meta": {},
  "pinData": {}
}
