{
  "nodes": [
    {
      "parameters": {
        "formTitle": "Upload your data to test RAG",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Upload your file(s)",
              "fieldType": "file",
              "acceptFileTypes": ".pdf, .csv",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        208,
        96
      ],
      "id": "3a6e5b06-3c76-45ec-8e5f-4ab839a193bf",
      "name": "Upload your file here"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        864,
        576
      ],
      "id": "759f8ca4-03c0-4215-82b9-016a17c4c534",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "dataType": "binary",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        656,
        256
      ],
      "id": "f6e95791-79c3-467f-9931-e9026a7acac0",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "content": "### Readme\nLoad your data into a vector database with the \ud83d\udcda **Load Data** flow, and then use your data as chat context with the \ud83d\udc15 **Retriever** flow.\n\n**Quick start**\n1. Click on the `Execute Workflow` button to run the \ud83d\udcda **Load Data** flow.\n2. Click on `Open Chat` button to run the \ud83d\udc15 **Retriever** flow. Then ask a question about content from your document(s)\n\n\nFor more info, check [our docs on RAG in n8n](https://docs.n8n.io/advanced-ai/rag-in-n8n/).",
        "height": 300,
        "width": 440,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        32
      ],
      "typeVersion": 1,
      "id": "4d65196c-56d0-4dab-80fd-5ee35fae1cdc",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "### \ud83d\udcda Load Data Flow",
        "height": 460,
        "width": 700,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        32
      ],
      "typeVersion": 1,
      "id": "7d4b51e7-819c-49b7-af6d-9bc041702df1",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "mode": "insert",
        "memoryKey": {
          "__rl": true,
          "value": "vector_store_key",
          "mode": "list",
          "cachedResultName": "vector_store_key"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1.2,
      "position": [
        400,
        96
      ],
      "id": "b8a85fb8-5be8-4dae-a1e3-9591bd94cedc",
      "name": "Insert Data to Store"
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolName": "knowledge_base",
        "toolDescription": "Use this knowledge base to answer questions from the user",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "vector_store_key"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1.2,
      "position": [
        1280,
        304
      ],
      "id": "c0f27926-6fb5-4aee-8838-615445d65100",
      "name": "Query Data Tool"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        1280,
        80
      ],
      "id": "281a3182-ee39-4f87-ad73-3de068425715",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        1056,
        80
      ],
      "id": "0a9f57e8-ea04-4b97-b5aa-9199795fdc9a",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        1056,
        304
      ],
      "id": "ec8bac52-3bcc-4285-bf6e-8478d8971af2",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "### \ud83d\udc15 2. Retriever Flow",
        "height": 460,
        "width": 680,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        32
      ],
      "typeVersion": 1,
      "id": "69016cae-2970-49f5-8797-a0fc564b2382",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "### Embeddings\n\nThe Insert and Retrieve operation use the same embedding node.\n\nThis is to ensure that they are using the **exact same embeddings and settings**.\n\nDifferent embeddings might not work at all, or have unintended consequences.\n",
        "height": 240,
        "width": 320,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        544
      ],
      "typeVersion": 1,
      "id": "b8c60a7b-5165-45f6-a37c-27ad48bd407f",
      "name": "Sticky Note3"
    }
  ],
  "connections": {
    "Upload your file here": {
      "main": [
        [
          {
            "node": "Insert Data to Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Insert Data to Store",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Query Data Tool",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Insert Data to Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Query Data Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}