{
  "name": "Build a document-upload RAG chatbot with OpenAI, Pinecone and daily analytics",
  "nodes": [
    {
      "id": "5acb77f0-cd31-4722-b7db-b33b75bfa320",
      "name": "Document Upload Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -240,
        368
      ]
    },
    {
      "id": "a96a28f2-2b93-4556-a44b-b9cfa5ed86ac",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        144,
        368
      ]
    },
    {
      "id": "500d17e0-24f1-4cc3-b2fe-cf39e4b08e57",
      "name": "Store Form Responses",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        560,
        112
      ]
    },
    {
      "id": "46a3853d-bffb-4bac-b0d1-a91230fa18d1",
      "name": "Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        656,
        640
      ]
    },
    {
      "id": "4f386a05-c6d0-463e-acac-33abdf8b896c",
      "name": "Document Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        768,
        544
      ]
    },
    {
      "id": "93ec926a-7961-48cb-88da-20079aaf41a2",
      "name": "OpenAI Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        624,
        1312
      ]
    },
    {
      "id": "33bbc928-7c05-4815-98d6-e77710401a7f",
      "name": "Pinecone Insert Documents",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        496,
        448
      ]
    },
    {
      "id": "377b69f9-5e95-43a9-96bf-458c9a5bc6c7",
      "name": "Chat Trigger",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -288,
        1024
      ]
    },
    {
      "id": "747fa77b-15e9-41aa-8453-c53e6470a66c",
      "name": "Chat Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        64,
        1216
      ]
    },
    {
      "id": "f5d25ef0-f0c3-4b9d-9834-b3e821c77442",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -64,
        1248
      ]
    },
    {
      "id": "9a8b8891-8d74-44df-8d45-458407baefe3",
      "name": "RAG Chatbot Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        128,
        992
      ]
    },
    {
      "id": "e538b0af-5948-4c20-8d4d-332d5b5f0960",
      "name": "Prepare Chat Log",
      "type": "n8n-nodes-base.set",
      "position": [
        512,
        992
      ]
    },
    {
      "id": "a4954013-c46f-4ddf-9309-a7084654defa",
      "name": "Log Chat Interactions",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        720,
        992
      ]
    },
    {
      "id": "78e53642-8860-40c5-bc64-e703fd9f49d5",
      "name": "Daily Summary Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -336,
        1712
      ]
    },
    {
      "id": "0c306f96-b778-41bb-9652-aa9c4367ca59",
      "name": "Get Chat Logs",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        0,
        1728
      ]
    },
    {
      "id": "adcad995-4d1f-4afc-8bef-cbe268c6eafb",
      "name": "Analyze Chat Data",
      "type": "n8n-nodes-base.code",
      "position": [
        192,
        1728
      ]
    },
    {
      "id": "592d1663-f607-4b72-8ed7-02306663f418",
      "name": "Send Daily Summary Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        464,
        1728
      ]
    },
    {
      "id": "0e51abc9-107d-4839-bf35-240b838cda4e",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        192,
        1216
      ]
    },
    {
      "id": "29097054-fe5f-426b-a751-f10f84e62a27",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        304
      ],
      "parameters": {
        "width": 576,
        "height": 448,
        "content": "## Vector Database Indexing\n\nDocument chunks are converted into embeddings and stored in Pinecone.\n\nThis creates a searchable vector index that allows the chatbot to retrieve relevant document context"
      }
    },
    {
      "id": "b93be14c-5167-4b60-b344-7d43cddad206",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        0
      ],
      "parameters": {
        "width": 400,
        "height": 256,
        "content": "## Document Processing Pipeline\n\nUploaded files are loaded and converted into text."
      }
    },
    {
      "id": "1661ee8b-cc57-4767-9838-09405ad04d77",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        224
      ],
      "parameters": {
        "width": 336,
        "height": 304,
        "content": "## Workflow Configuration\n\nDefines key settings used throughout the workflow:\nPinecone index name,namespace,chunk size, chunk overlap, retrieval depth (top-K)\n\n"
      }
    },
    {
      "id": "ce5be48c-5f81-4f91-95e3-ed7c051918f0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        240
      ],
      "parameters": {
        "width": 336,
        "height": 288,
        "content": "## Document Upload Interface\n\nUsers upload PDF, CSV, or JSON files through a form."
      }
    },
    {
      "id": "cf312465-3ac5-4523-bbc4-512ad1af49c4",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        832
      ],
      "parameters": {
        "width": 448,
        "height": 544,
        "content": "## RAG Question Answering\n\nThe chatbot retrieves relevant document chunks from Pinecone and uses them as context for the LLM.\n\nThe assistant answers using only retrieved information from the uploaded "
      }
    },
    {
      "id": "804a9321-0120-414a-a3f3-4d9893e1e085",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        896
      ],
      "parameters": {
        "width": 368,
        "height": 304,
        "content": "## Chat Interface\n\nUsers interact with the knowledge base through a chat interface."
      }
    },
    {
      "id": "9a3c83ec-7603-4c1d-97e6-707b5f01e60b",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        832
      ],
      "parameters": {
        "width": 480,
        "height": 336,
        "content": "## Chat Logging\n\nUser queries and chatbot responses are captured with metadata such as session ID and timestamps.\n\nThis enables conversation tracking, analytics, and debugging."
      }
    },
    {
      "id": "37f396ac-de6e-486a-8d9e-9ba21641d65c",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        1488
      ],
      "parameters": {
        "width": 416,
        "height": 384,
        "content": "## Chat Log Analysis\n\nThe workflow retrieves chat interactions from the last 24 hours and analyzes usage patterns.\n\nMetrics include:\n• total questions asked\n• files referenced\n• failed document lookup"
      }
    },
    {
      "id": "68960ed9-f358-4709-94f4-42253d01e258",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        1504
      ],
      "parameters": {
        "width": 416,
        "height": 368,
        "content": "## Daily Analytics Trigger\n\nThis scheduled trigger runs every morning to generate a usage summary for the RAG chatbot."
      }
    },
    {
      "id": "9e0194dd-4feb-40f2-9314-eebb194ee417",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        1472
      ],
      "parameters": {
        "width": 368,
        "height": 400,
        "content": "## Daily Summary Report\n\nThe workflow generates a formatted HTML report and sends it via email."
      }
    },
    {
      "id": "b5163c62-dcd8-4565-afa2-3521bd6ef130",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1152,
        1200
      ],
      "parameters": {
        "width": 448,
        "height": 560,
        "content": "## Daily RAG Chatbot Analytics\n\nThis workflow generates a daily performance report for a Retrieval-Augmented Generation (RAG) chatbot by analyzing recent chat activity stored in the system.\n\nEvery mor"
      }
    }
  ],
  "connections": {
    "Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "Chat Trigger",
            "type": "ai_memory",
            "index": 0
          },
          {
            "node": "RAG Chatbot Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Chat Trigger": {
      "main": [
        [
          {
            "node": "RAG Chatbot Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Chat Logs": {
      "main": [
        [
          {
            "node": "Analyze Chat Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Document Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Document Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Insert Documents",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Chat Log": {
      "main": [
        [
          {
            "node": "Log Chat Interactions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Chat Data": {
      "main": [
        [
          {
            "node": "Send Daily Summary Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "RAG Chatbot Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Insert Documents",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "RAG Chatbot Agent": {
      "main": [
        [
          {
            "node": "Prepare Chat Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Document Upload Form": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "ai_tool": [
        [
          {
            "node": "RAG Chatbot Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Daily Summary Schedule": {
      "main": [
        [
          {
            "node": "Get Chat Logs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Store Form Responses",
            "type": "main",
            "index": 0
          },
          {
            "node": "Pinecone Insert Documents",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}