{
  "name": "RAG Agent",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        60,
        80
      ],
      "id": "13e510a4-9b68-4aa9-9722-cd4641563274",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "mode": "insert",
        "qdrantCollection": {
          "__rl": true,
          "value": "support",
          "mode": "id"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "typeVersion": 1.2,
      "position": [
        300,
        80
      ],
      "id": "8b8603dd-3210-4a0b-9fc0-5301f7c3df05",
      "name": "Qdrant Vector Store",
      "credentials": {
        "qdrantApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsonMode": "expressionData",
        "jsonData": "={{ $json.content }}",
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "title",
                "value": "={{ $json.title }}"
              },
              {
                "name": "content",
                "value": "={{ $json.content }}"
              }
            ]
          }
        }
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1,
      "position": [
        200,
        320
      ],
      "id": "1362e35e-9b76-46b8-b869-dcee69151525",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "content": "## Populate Qdrant Collection",
        "height": 660,
        "width": 700,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "daeb5cf8-6289-400c-a533-97c2c08b617e",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "You are a support agent for an online shop.  Only use the information available in the tools provided. Do not use any other information and if asked for information not available in these tools, inform the user that you cannot help them further and that they should send an email to support@shop.com."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        1200,
        80
      ],
      "id": "1c4cfaf6-b373-4685-952c-14f7a499e101",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        1020,
        80
      ],
      "id": "1eede6bd-b220-487f-9406-65a73bcee79b",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "content": "## Chat with RAG Agent using data from Qdrant Collection",
        "height": 660,
        "width": 660,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        940,
        0
      ],
      "id": "6e71f4d7-da19-4f68-b0f0-a3fe542a4640",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolName": "support",
        "toolDescription": "Call this tool to get data from the support database",
        "qdrantCollection": {
          "__rl": true,
          "value": "support",
          "mode": "list",
          "cachedResultName": "support"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "typeVersion": 1.2,
      "position": [
        1320,
        320
      ],
      "id": "9d0b0a4b-9f96-4fe9-9e3c-91727330461f",
      "name": "Qdrant Vector Store2",
      "credentials": {
        "qdrantApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        220,
        500
      ],
      "id": "bcb11236-fcc7-4d8b-8bce-de0cbd097ffc",
      "name": "Recursive Character Text Splitter"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        1180,
        320
      ],
      "id": "30683d51-8246-411e-9a7a-f01baacac1a3",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "llama3.2:latest",
          "mode": "list",
          "cachedResultName": "llama3.2:latest"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        1000,
        320
      ],
      "id": "06206fa9-3fce-4a94-a235-241a9320b937",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "nomic-embed-text:latest",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        780,
        540
      ],
      "id": "1e4284ab-c554-4b35-bcf0-8a9348b45a50",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store2": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store2",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6a1ae594-7c4b-4b36-8448-8ac6e9c67075",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "I33agLmP5dzRpzod",
  "tags": []
}