Skip to content

After this module you can build an assistant that answers questions from your documents, with sources, and says "I don't know" instead of making things up.

What it does

Two flows in one workflow:

  • Ingest (POST /webhook/kb/ingest {text, source}): splits the document into ~800-character chunks, embeds them with OpenAI text-embedding-3-small, and stores them in n8n's in-memory vector store.
  • Ask (hosted chat): an AI Agent searches the knowledge base with a search_docs tool, answers only from what it finds, and cites the source.

A sample company handbook (assets/sample-handbook.md) with known answers is included for testing.

Flow

Ingest API → Has Text? ─true─→ Add to Knowledge Base (vector store: insert) → Respond Ingested
                       └false→ 400        ├ Embeddings (ingest)
                                          └ Document Loader ← Text Splitter

Ask the Docs → Docs Agent ─ model: OpenAI · memory: 6 messages · tool: search_docs (vector store: retrieve) ← Embeddings (search)

Verification status

  • Ingest validation (400) and chat page: tested on n8n 2.43.6. A valid ingest reaches the vector store and stops at "Error in sub-node Embeddings (ingest)" without a credential, as expected.
  • Embedding, retrieval and answer quality: needs an OpenAI credential. WITH_CREDS=1 ./test/test.sh ingests the handbook and checks 6 answers, including an "I couldn't find that" case.

Files

File Tier Purpose
lesson.md Free Step-by-step build + how RAG works
workflow/starter.json Free Triggers and validation only
workflow/learner.json Learner Finished workflow
workflow/business.json Business Business workflow (see setup guide)
deploy/docker-compose.qdrant.yml Business Qdrant for the playground
setup-guide.md Business Credentials + configuration
assets/sample-handbook.md Learner Test document with known answers
exercises.md Learner Practice tasks
solutions.md Learner Exercise solutions
notes.md Private Learning log
sell/ Private Offer, video script, blog post