Tutorial 3. A bot that answers from your documents

The bot from tutorial 1 only knows what the model knows. This one answers from your price list, your policy or your manual: before every answer it looks for matching pieces of text in the files you uploaded and answers from them.

What you end up with: the same public link as in tutorial 1, but “how much is delivery to Manchester” gets quoted out of your document, and a question your documents do not cover gets an honest “I don’t know”.

Entry
RAG Query
Knowledge Base
AI Agent
LLM
Exit
  • Execute + Data
  • Data
  • LLM
  • Execute + Data + Streaming
Retrieval runs before the answer: Entry hands the question to RAG Query, the knowledge base attaches from the side and sets the search parameters, the agent answers from what was found.

Step 1. Create the knowledge base

  1. Open Knowledge and press New.

  2. Fill in the name and the description — that is what you will tell your bases apart by later.

  3. In Embedding Model keep the preselected model: the list opens on the local all-MiniLM-L6-v2. If you have your own cloud provider key, its models appear in the same list — but this tutorial does not need one.

  4. Leave Chunk Size (default 500) and Chunk Overlap (default 50) as they are. That is the length of one text piece in characters, and how many characters neighbouring pieces share so a sentence is not cut exactly at the boundary.

  5. Press Create.

app.iterna.ai

New Knowledge Base

New Knowledge Base

Create
Name*
Policies
Description
Price list, delivery terms, warranty
Embedding Model
all-MiniLM-L6-v2 (fast, 384-dim)

Local model, no key required.

Chunk Size
500
Chunk Overlap
50
The three fields at the bottom — model, chunk size and overlap — are set once and for good.

Step 2. Upload a document and wait for it to be ready

  1. Open the base you created and press Add Document.

  2. Either Upload File — accepted types are PDF, DOCX, TXT, MD, — or give a Web Page URL, and the platform fetches the page text itself.

  3. Optionally add Metadata (searchable via hard filters) — key/value pairs such as section = delivery. They pay off later, when there are many documents and search has to be narrowed; for this tutorial you can skip them.

  4. Wait for Ready. A document goes PendingProcessingReady; on failure it stays Failed with the reason. Next to the status you see the number of chunks — that is your document, sliced.

Upload limits on the free plan: 10 MB per file, 100 MB across all documents, and no more than 50,000 vector points (one point = one chunk). Anything outside PDF, DOCX, TXT, MD is rejected up front, before the upload.

Step 3. Build the graph

It is the graph from tutorial 1 with one insertion in front of the agent.

  1. Create a new workflow (or copy the bot from tutorial 1) and put Entry and Exit on the canvas.

  2. Drag in RAG Query (section AI, group RAG) and connect Entry’s output to its Query port.

  3. Drag in Knowledge Base — a configuration node — and run a wire from it to the KB port of RAG Query. In its settings pick the base from step 1.

  4. Add the AI Agent, connect RAG Query’s output to the agent’s input and the agent’s output to Exit.

  5. Add an LLM node, attach it to the agent’s LLM port and pick a model.

  6. Press Validate, then Save.

Why the knowledge base hangs off to the side instead of sitting in the chain

Knowledge Base searches nothing — it is configuration. It hands RAG Query four values (which base, how many chunks to return, the similarity threshold, how many neighbouring chunks to glue on) and wins over the search node’s own fields. The point is that one base node can feed several consumers and the parameters live in a single place. Metadata filters are the one exception: they do not replace the consumer’s filters, they are AND-ed with them.

Retrieval and answering are separate nodes on purpose, too: RAG Query is a deterministic step and its result shows up in the execution as its own row — so “did the bot make this up, or does the document really say so” is answered by looking, not by guessing.

Step 4. Write a prompt that demands grounding

Here the tutorial hits a non-obvious thing. What arrives at the agent’s input is the whole search result — the chunks, their scores and the query itself — not a ready-made user question. The agent reads it as the visitor’s turn. So the question and the context have to be named in the system prompt explicitly, by node id:

You answer customer questions from the company's documents.

Question: {{ nodes.entry_1.output }}

Retrieved fragments:
{{ nodes.rag_query_1.output.context }}

Answer only from the fragments above. If the answer is not in them, say so:
"Our documents do not cover this." Do not improvise and do not answer from general knowledge.

entry_1 and rag_query_1 are your node ids: they are shown in the node’s configuration window under its name, and can be renamed there. Substitute your own.

The second half of the prompt is not politeness — it is the only thing separating a “document bot” from an ordinary one: without an explicit ban the model will happily answer from general knowledge, and nothing in the reply will tell you which it did.

Step 5. Check it on the Test tab

The Test tab is a real, billed run. Ask three questions in a row:

  • something the document definitely contains — the answer must lean on the text;
  • something it definitely does not — you should get a refusal, not a lecture from general knowledge;
  • the first question again, worded differently — search goes by meaning, not by word overlap, and this is what proves it.

Click the RAG Query node on the tab’s canvas: you see exactly what it retrieved. If the fragments are relevant and the answer is poor, the prompt is at fault. If the fragments are wrong, the search parameters or the chunking are — and that is what to fix, not the prompt.

Step 6. Deploy

The Deploy tab → the Public chat channel → flip the toggle and press Deploy version 1. The rest is tutorial 1: a link, another browser, a conversation as a visitor. If the bot from tutorial 1 is still deployed, undeploy it — the free plan allows one deployed workflow.

What it costs

Embeddings are computed twice: when a document is loaded into the base, and when a question is asked — the query has to become a vector too. The default rate is 1 credit per 10,000 tokens, the same for writing and reading.

In practice a question costs a fraction of a credit, while loading a large document is visible: a hundred pages of text is a few credits out of the hundred you get per month, and re-uploading the same file is charged again.

If it did not work

What you seeWhyWhat to do
A document sits in Processing for a long timeProcessing is a background task inside the API process. If the server restarted mid-way, file documents are marked failed with a "re-upload" message and URL documents are queued againRefresh the page; if the status is Failed, read the reason and upload the file again
Status Ready but zero chunksThe file has no text layer — usually a scanned PDF or photos of pagesRun OCR first and upload TXT/MD or a text PDF
The bot answers in generalities, as if it never read the documentEither the knowledge base node is not wired into the search node's KB port, or the prompt does not demand groundingCheck the wire into the KB port; put both the fragments and an explicit ban on general knowledge into the prompt
"Nothing found" although the text is definitely in the documentThe similarity threshold cuts everything off: it defaults to 0 ("cut nothing"), but a hand-set 0.7–0.8 discards live hits. The other common case is an answer split by chunkingPut the threshold back to 0, raise the number of chunks (top_k, up to 20) and turn on the context window so neighbouring chunks are glued to each hit
It finds the wrong thingA 500-character chunk cuts long tables and lists mid-rowCreate a new base with a larger chunk size: an existing one cannot be changed
The embedding model list is empty or lacks the model you wantThe list is the platform catalog plus the models of your own connections. Cloud provider models only appear together with a connection and a keyFor this tutorial take the local all-MiniLM-L6-v2 — it needs no key
The file will not uploadThe format is outside PDF/DOCX/TXT/MD, the file is over 10 MB, or the base hit the plan quota (100 MB, 50,000 chunks)Split the document or delete what you no longer need
The run is refusedOut of credits: the free plan forbids work beyond the remaining balanceSettings → Usage

The search parameters in full are in Knowledge bases and RAG; the section of the app itself is Knowledge; the general symptom list is Troubleshooting.

What next