{
  "name": "Conversational RAG",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        -1720,
        440
      ],
      "id": "9a5673f1-0e60-402b-80e3-96e87ea48926",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        -2288,
        0
      ],
      "id": "21323550-71c0-4694-bd5e-6a8b063cbef2",
      "name": "[Trigger] Chat Input"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are a helpful and strictly factual AI assistant. \nYour primary task is to answer the user's question based ONLY on the provided documents from the Vector Store.\n\nRULES:\n1. If the answer is not explicitly stated in the provided documents, you MUST say: \"\u0628\u0627 \u062a\u0648\u062c\u0647 \u0628\u0647 \u0627\u0633\u0646\u0627\u062f \u0627\u0631\u0627\u0626\u0647\u200c\u0634\u062f\u0647\u060c \u0627\u0637\u0644\u0627\u0639\u0627\u062a\u06cc \u062f\u0631 \u0627\u06cc\u0646 \u0645\u0648\u0631\u062f \u0648\u062c\u0648\u062f \u0646\u062f\u0627\u0631\u062f.\" (Do NOT make up information or use your pre-trained knowledge).\n2. Always cite the title of the document you are using to answer.\n3. Be concise and direct.\n4. If the user asks about multiple items, ensure you check all provided context chunks before answering.\n\nuser massage :{{ $json.chatInput }}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        -2000,
        0
      ],
      "id": "444ba438-16a2-4f8f-b536-9d5b4dc5861c",
      "name": "[Agent] RAG Assistant"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "gpt-4o-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        -2096,
        224
      ],
      "id": "dda52b9f-daf3-4249-ae3e-96601518a23e",
      "name": "[model] gpt-4o-mini",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.4,
      "position": [
        -1928,
        232
      ],
      "id": "86e2f822-0340-4d7e-91c7-0d1ef5c4ba68",
      "name": "[Memory] 10-Msg Buffer"
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "work with my data\n",
        "qdrantCollection": {
          "__rl": true,
          "value": "my_rag",
          "mode": "list",
          "cachedResultName": "my_rag"
        },
        "topK": 6,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "typeVersion": 1.3,
      "position": [
        -1800,
        232
      ],
      "id": "9db77231-c4be-476b-b839-3af125da2c2e",
      "name": "[Tool] Qdrant Retriever",
      "credentials": {
        "qdrantApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        -1552,
        0
      ],
      "id": "f9794e6d-0f3d-4db9-bfa5-0491635187b3",
      "name": "[Output] Send Chat Response"
    }
  ],
  "connections": {
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "[Tool] Qdrant Retriever",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "[Trigger] Chat Input": {
      "main": [
        [
          {
            "node": "[Agent] RAG Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[Agent] RAG Assistant": {
      "main": [
        [
          {
            "node": "[Output] Send Chat Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[model] gpt-4o-mini": {
      "ai_languageModel": [
        [
          {
            "node": "[Agent] RAG Assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "[Memory] 10-Msg Buffer": {
      "ai_memory": [
        [
          {
            "node": "[Agent] RAG Assistant",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "[Tool] Qdrant Retriever": {
      "ai_tool": [
        [
          {
            "node": "[Agent] RAG Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "nodeGroups": [],
  "tags": []
}