AutomationFlowsAI & RAG › Answer Support Questions From a Knowledge Base with Openai Gpt-4o-mini

Answer Support Questions From a Knowledge Base with Openai Gpt-4o-mini

ByTakatoYamada @takato-door on n8n.io

This workflow powers a support chat experience that uses an OpenAI RAG agent with in-memory vector search to answer questions from a knowledge base, and includes a manual ingestion flow that fetches an external FAQ document, splits it into chunks, embeds it with OpenAI, and…

Chat trigger trigger★★★★☆ complexityAI-powered18 nodesChat TriggerAgentOpenAI ChatMemory Buffer WindowIn-Memory Vector StoreOpenAI EmbeddingsHTTP RequestDocument Default Data Loader
AI & RAG Trigger: Chat trigger Nodes: 18 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #16336 — we link there as the canonical source.

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "7aa8e7bda52cce54",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "name": "Answer support questions from your knowledge base using an OpenAI RAG agent",
  "tags": [
    {
      "name": "ai-agent"
    },
    {
      "name": "rag"
    },
    {
      "name": "customer-support"
    },
    {
      "name": "chatbot"
    },
    {
      "name": "vector-store"
    },
    {
      "name": "openai"
    },
    {
      "name": "automation"
    },
    {
      "name": "ai"
    }
  ],
  "nodes": [
    {
      "id": "a0b16545-37ea-4bbe-9594-c03d2e882803",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -112
      ],
      "parameters": {
        "width": 480,
        "height": 896,
        "content": "## Answer support questions from your knowledge base using an OpenAI RAG agent\n\n## How it works\n\n1. Receives chat messages and triggers AI response.\n2. Uses AI to process and generate support responses.\n3. Manually triggered document ingestion updates the knowledge base.\n4. Fetches and processes documents into the knowledge base.\n5. Handles document embeddings and loading.\n\n## Setup steps\n\n- [ ] Configure OpenAI credentials for embeddings and AI response.\n- [ ] Set up manual trigger details for document ingestion.\n- [ ] Configure HTTP request node for fetching source documents.\n\n## Customization\n\nYou can customize the workflow by changing the source URL in the 'Fetch Source Docs' node or adjusting the AI model parameters in the 'AI Support Agent' node."
      },
      "typeVersion": 1
    },
    {
      "id": "9b188b38-239a-432a-93ea-efe214db89c4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 816,
        "height": 512,
        "content": "## Receive and process chat\n\nInitiates AI support agent when a chat message is received."
      },
      "typeVersion": 1
    },
    {
      "id": "2146aa62-63ab-4e9f-9bc5-220e51659bd2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        432
      ],
      "parameters": {
        "color": 7,
        "width": 592,
        "height": 304,
        "content": "## AI query components\n\nComponents related to the AI support system including chat model, conversation memory, and knowledge base."
      },
      "typeVersion": 1
    },
    {
      "id": "02a000fa-7085-4711-b898-21e8bce46c64",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        768
      ],
      "parameters": {
        "color": 7,
        "width": 752,
        "height": 304,
        "content": "## Document ingestion setup\n\nManually triggered source document ingestion and processing into the knowledge base."
      },
      "typeVersion": 1
    },
    {
      "id": "d1d5e18c-c446-4baf-a70a-1c7f99a81b7d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        432
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 304,
        "content": "## Query embeddings\n\nHandles embeddings for query processing."
      },
      "typeVersion": 1
    },
    {
      "id": "cea5f323-8949-4397-9cf8-18c001aa60ed",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        768
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 480,
        "content": "## Document handling\n\nEmbeddings and loading documents for processing into the system."
      },
      "typeVersion": 1
    },
    {
      "id": "b4a7faed-6d46-4e27-b4c6-550af504f518",
      "name": "When Chat Message Received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -40,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "ec2de1a5-1064-4932-8325-1bf13d0a778c",
      "name": "AI Support Assistant",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        380,
        0
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a friendly, accurate customer-support assistant.\nALWAYS search the knowledge base before answering.\nIf the answer is not found, say you are not sure and offer to escalate to a human. Never invent policies, prices or facts.\nAnswer concisely and cite the source title when possible."
        },
        "promptType": "auto"
      },
      "typeVersion": 1.7
    },
    {
      "id": "cf8bee60-ad33-43bf-8206-e975d8ea7b62",
      "name": "OpenAI Chat GPT-4o-Mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        176,
        560
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {
          "temperature": 0.4
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a1019f98-e278-481e-83ee-76de6c00e7a0",
      "name": "Manage Conversation Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        384,
        560
      ],
      "parameters": {
        "contextWindowLength": 12
      },
      "typeVersion": 1.3
    },
    {
      "id": "f2bc16e5-bccc-4a8a-8839-e8189250bb2a",
      "name": "Load Knowledge Base Data",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        608,
        576
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 4,
        "toolName": "company_knowledge_base",
        "memoryKey": "support-kb",
        "toolDescription": "Search internal docs, FAQs and policies to answer the user."
      },
      "typeVersion": 1.1
    },
    {
      "id": "b8b3ac2a-3402-4da8-8859-0ae9c3ddfb6a",
      "name": "Generate Query Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        800,
        576
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "ccc5dbf3-6d76-488d-9f54-1bb5956ac40e",
      "name": "Manual Document Ingestion",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -32,
        896
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "309e424d-4545-47e1-907c-cc1735af8c8a",
      "name": "Fetch FAQ Documents",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        208,
        896
      ],
      "parameters": {
        "url": "https://example.com/help-center/faq.txt",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "703aa157-3cae-47ae-8803-ef820203a5de",
      "name": "Add Data to Knowledge Base",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        528,
        896
      ],
      "parameters": {
        "mode": "insert",
        "memoryKey": "support-kb"
      },
      "typeVersion": 1.1
    },
    {
      "id": "1ca187ee-80f1-4170-bd52-46b65fcf00a1",
      "name": "Create Insert Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        752,
        912
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "e6223a06-f157-41a3-9acd-4b54d98619be",
      "name": "Load Documents",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        992,
        912
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "bed7c42a-2cb1-4f5d-93ae-63043e05a800",
      "name": "Split Text for Processing",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        992,
        1088
      ],
      "parameters": {
        "chunkSize": 1000,
        "chunkOverlap": 100
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Load Documents": {
      "ai_document": [
        [
          {
            "node": "Add Data to Knowledge Base",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Fetch FAQ Documents": {
      "main": [
        [
          {
            "node": "Add Data to Knowledge Base",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat GPT-4o-Mini": {
      "ai_languageModel": [
        [
          {
            "node": "AI Support Assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create Insert Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Add Data to Knowledge Base",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Load Knowledge Base Data": {
      "ai_tool": [
        [
          {
            "node": "AI Support Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Generate Query Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Load Knowledge Base Data",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Manual Document Ingestion": {
      "main": [
        [
          {
            "node": "Fetch FAQ Documents",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Text for Processing": {
      "ai_textSplitter": [
        [
          {
            "node": "Load Documents",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Manage Conversation Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Support Assistant",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "When Chat Message Received": {
      "main": [
        [
          {
            "node": "AI Support Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow powers a support chat experience that uses an OpenAI RAG agent with in-memory vector search to answer questions from a knowledge base, and includes a manual ingestion flow that fetches an external FAQ document, splits it into chunks, embeds it with OpenAI, and…

Source: https://n8n.io/workflows/16336/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow acts as a 24/7 sales agent, engaging leads across WhatsApp, Instagram, Facebook, Telegram, and your website. It intelligently transcribes audio messages, answers questions using a knowle

Chat Trigger, Memory Postgres Chat, Tool Workflow +20
AI & RAG

• Create a Google Drive folder to watch. • Connect your Google Drive account in n8n and authorize access. • Point the Google Drive Trigger node to this folder (new/modified files trigger the flow).

Agent, Chat Trigger, Memory Buffer Window +14
AI & RAG

⚡AI-Powered YouTube Playlist & Video Summarization and Analysis v2. Uses lmChatGoogleGemini, agent, splitOut, chainLlm. Chat trigger; 72 nodes.

Google Gemini Chat, Agent, Chain Llm +11
AI & RAG

This n8n workflow transforms entire YouTube playlists or single videos into interactive knowledge bases you can chat with. Ask questions and get summaries without needing to watch hours of content. 🔗

Google Gemini Chat, Agent, Chain Llm +11
AI & RAG

AI-Powered YouTube Playlist & Video Summarization and Analysis v2. Uses lmChatGoogleGemini, agent, chainLlm, vectorStoreQdrant. Chat trigger; 72 nodes.

Google Gemini Chat, Agent, Chain Llm +11