{
  "name": "Build a knowledge base chatbot with OpenAI, RAG and MongoDB vector embeddings",
  "nodes": [
    {
      "id": "5cb0a836-f9a1-4f92-9326-cd82a392d0da",
      "name": "Knowledge Base Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        220,
        0
      ]
    },
    {
      "id": "56e6fb75-6a97-4466-9e7f-70710c2740d7",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        60,
        240
      ]
    },
    {
      "id": "e352c32e-7108-4a0d-b081-b2532d96d092",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        680,
        380
      ]
    },
    {
      "id": "74bbfb00-1a00-4131-a291-bce5b79628b4",
      "name": "When clicking \"Execute Workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -60,
        -420
      ]
    },
    {
      "id": "f720a4b0-6239-4a0b-bb61-1e43f78f8e40",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        320,
        220
      ]
    },
    {
      "id": "94561d61-4a01-48b6-b114-dc4d47546ff3",
      "name": "MongoDB Vector Search",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas",
      "position": [
        560,
        220
      ]
    },
    {
      "id": "c473c33d-5681-4f3a-ac36-0d3012e7251f",
      "name": "Document Section Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        740,
        -260
      ]
    },
    {
      "id": "321222cb-1daf-4be2-a6ca-1a03d24f670f",
      "name": "Document Chunker",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        860,
        -100
      ]
    },
    {
      "id": "716519f5-cec1-4bfe-afbe-614fc23e74b5",
      "name": "MongoDB Vector Store Inserter",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas",
      "position": [
        540,
        -420
      ]
    },
    {
      "id": "a49c19fc-f5f5-4381-b6ba-1bfc12b96135",
      "name": "OpenAI Embeddings Generator",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        480,
        -180
      ]
    },
    {
      "id": "6de724d5-2941-4e72-af8b-302ca2cf2ca0",
      "name": "Google Docs Importer",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        200,
        -420
      ]
    },
    {
      "id": "4f30bb21-72f0-4d13-b610-2ec218ad31b1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        -440
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "Run this workflow manually to import and index Google Docs product documentation into MongoDB with vector embeddings for fast search."
      }
    },
    {
      "id": "25fd33d5-041b-4f01-a46b-1bacabd88376",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        40,
        0
      ]
    },
    {
      "id": "f1f3fadd-d5e6-45df-b810-1616531dffcb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        40
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "This workflow uses retrieval-augmented generation (RAG) to answer user questions by searching the MongoDB vector store and generating AI responses with context."
      }
    },
    {
      "id": "39eee95c-b332-4ae4-bde9-aaf0fe5e0546",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1060,
        -380
      ],
      "parameters": {
        "width": null,
        "height": 520,
        "content": "Search Index Example \n\n{\n  \"mappings\": {\n    \"dynamic\": false,\n    \"fields\": {\n      \"_id\": {\n        \"type\": \"string\"\n      },\n      \"text\": {\n        \"type\": \"string\"\n      },\n      \"embedding\": {\n "
      }
    }
  ],
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Document Chunker": {
      "ai_textSplitter": [
        [
          {
            "node": "Document Section Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "MongoDB Vector Search",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Docs Importer": {
      "main": [
        [
          {
            "node": "MongoDB Vector Store Inserter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Knowledge Base Agent": {
      "main": [
        []
      ]
    },
    "MongoDB Vector Search": {
      "ai_tool": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Document Section Loader": {
      "ai_document": [
        [
          {
            "node": "MongoDB Vector Store Inserter",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Embeddings Generator": {
      "ai_embedding": [
        [
          {
            "node": "MongoDB Vector Store Inserter",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \"Execute Workflow\"": {
      "main": [
        [
          {
            "node": "Google Docs Importer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}