← back to work
AI Systems2026

AI-Powered Knowledge Retrieval
& Support Chatbot

A two-pipeline RAG system built in n8n — one pipeline indexes enterprise documents into Pinecone, the other answers staff questions in real time using GPT-4.1 and semantic retrieval.

Pipelines
2
LLM
GPT-4.1
Vector DB
Pinecone
Chunk Overlap
200 tokens
Embedding Dims
512

// the problem

Enterprise knowledge trapped in documents no one can find

Most companies have policies, manuals, SOPs, and reports spread across Google Drive folders. Staff waste time hunting through documents or asking colleagues for answers that already exist — somewhere. A RAG chatbot makes that knowledge instantly accessible through a simple question-and-answer interface, with answers grounded in the actual source material.

// system overview

Two decoupled pipelines

Pipeline 1 — Knowledge Indexing

Runs manually whenever documents are updated. Downloads from Google Drive, splits into overlapping chunks, embeds with OpenAI, and stores vectors in Pinecone.

01Manual Trigger
02Google Drive Download
03Document Parsing
04Chunk Splitting
05OpenAI Embeddings
06Pinecone Insert
Pipeline 2 — Chatbot Response

Always-on webhook listener. Receives a question, embeds it, retrieves the top matching chunks from Pinecone, generates a concise answer via GPT-4.1, and returns it.

01Webhook Trigger
02Query Embedding
03Pinecone Search
04Context Retrieval
05GPT-4.1 Answer
06Format & Respond

// workflow diagram

Both pipelines at a glance

PIPELINE 1 — KNOWLEDGE INDEXINGManualTriggerGoogle DriveDownloadLoadDocumentSplit intoChunksCreateEmbeddingsInsert intoPineconePIPELINE 2 — CHATBOT RESPONSEWebhookTriggerEmbedQuerySearchPineconeRetrieveContextGPT-4.1AnswerFormatResponseReturn toFrontendshared vector storeIndexing pipelineResponse pipeline--- shared resource

// pipeline 1 — knowledge indexing

From document to searchable vector store

01
Manual Trigger
One-time run to index the knowledge base. Re-run whenever documents are updated.
02
Download Knowledge File
Pulls the source document from Google Drive by file ID — PDF, DOCX, or plain text.
03
Load Downloaded Document
Parses the raw binary file into processable text content.
04
Split Document into Chunks
RecursiveCharacterTextSplitter with 200-token overlap — preserves sentence context across chunk boundaries.
05
Create Embeddings for Indexing
OpenAI Embeddings at 512 dimensions, batch size 512 for efficient bulk processing.
06
Insert Documents into Pinecone
Stores all chunks with their vector embeddings in the Pinecone index, ready for similarity search.

// pipeline 2 — chatbot response

From question to grounded answer

01
Chatbot Webhook Trigger
Always-on entry point that listens for incoming questions from any connected frontend — website chat widget, internal tool, or mobile app.
02
Create Query Embedding
Converts the incoming question into a 512-dimension vector using the same OpenAI model as indexing.
03
Search Pinecone Knowledge Base
Runs cosine similarity search against the indexed vectors to find the most relevant document chunks.
04
Retrieve Matching Knowledge
Vector Store Retriever node — packages the matched chunks as context for the LLM.
05
Answer Question with Retrieved Context
RetrievalQA chain with GPT-4.1. System prompt enforces concise 2–3 sentence answers and hands off to a human when uncertain.
06
Format Chatbot Response
JavaScript node strips newlines and trims whitespace — ensures clean, single-line output for the frontend.
07
Return Answer to Frontend
Respond to Webhook — sends the formatted answer back to the calling application.

// technical stack

Tools & technologies

n8n
Workflow orchestration — two-pipeline architecture
GPT-4.1
LLM powering answer generation via RetrievalQA chain
Pinecone
Vector database storing and retrieving document embeddings
OpenAI Embeddings
512-dimension vectors for both indexing and query matching
Google Drive
Document source — policies, manuals, reports
Webhook (n8n)
HTTP interface — receives questions, returns formatted answers

// engineering decisions

Why it was built this way

512-dimension embeddings
Chosen to balance retrieval precision with index storage costs. High enough for semantic accuracy across enterprise document types without over-dimensioning.
RecursiveCharacterTextSplitter with 200-token overlap
Overlap prevents context from being cut across chunk boundaries — critical when answers span paragraph breaks in policy documents.
RetrievalQA over a simple prompt
The QA chain handles context injection and source grounding natively, reducing prompt engineering overhead and improving answer faithfulness.
Strict system prompt with human escalation
Capped at 2–3 sentences per answer. When the model is uncertain it routes to the human team — keeping trust high and hallucinations low.
Two-pipeline separation
Indexing runs manually on-demand; the chatbot pipeline runs continuously. This decouples knowledge updates from live query handling.

// business value

What this delivers

Instant knowledge access
Staff get accurate answers in seconds — no more document hunting or waiting on colleagues.
Always up to date
Re-run the indexing pipeline whenever documents change. The chatbot reflects the latest version immediately.
Controlled and grounded
Answers are generated strictly from indexed content. When uncertain, the system routes to a human rather than guessing.
Frontend-agnostic
Any frontend can query it via a simple POST request — website chat widget, internal tool, Slack bot, or mobile app.

Need a knowledge base chatbot for your team?

Let's build a RAG system tailored to your documents and stack.

Get in touch →← Back to work