Knowledge & behaviour

Knowledge Base (RAG)

The knowledge base is your agent's memory: here you store documents, web pages and notes (menu, price list, opening hours, services, terms and conditions). With every incoming message, the agent automatically pulls out the most relevant snippets of text ("chunks") and answers from them – this technique is called RAG (Retrieval-Augmented Generation). This is the most important and, at the same time, the most error-prone area: an agent can only ever know what has been stored here cleanly.

You will find this area within the agent under the "Knowledge Base" tab. The two controls "Use Knowledge Base (RAG)" and "Top-K Chunks" sit in the "Model" tab of the same agent.

Step 1: Enable the knowledge base (kb_enabled)

Open the agent and switch to the "Model" tab.

  • "Use Knowledge Base (RAG)" – The central on/off switch. When it is on, the agent retrieves relevant document chunks for every message and uses them to answer. When it is off, the agent ignores all uploaded documents completely and answers only from its persona/prompt.
  • Default: on (enabled).
  • Recommendation: leave it switched on. Switching it off only makes sense if the agent is meant to be purely conversational and needs no factual knowledge from documents at all.

Step 2: Set the number of hits (kb_top_k)

Directly below it is the "Top-K Chunks" field.

  • What it does: Determines how many of the most relevant text snippets are fed into the agent's answer per message. Higher values give the agent more context, but cost more tokens (money) and, if set too high, can also bring in irrelevant "noise".
  • Default: 5.
  • Permitted range: 1 to 20 (the system will not allow anything outside these limits).
  • Recommendation: Leave it at 5. For very extensive document collections (a large menu, a long service catalogue), 8–10 can make sense; more than that rarely helps and only makes every answer more expensive. The field is greyed out as long as "Use Knowledge Base" is switched off.

Note: The third, finer control – the similarity threshold kb_max_distance – is not set here by hand, but conveniently at the press of a button via the Retrieval Test in the "AI-Debug" area (see Step 8).

Step 3: Upload a file (the "File" tab)

Switch to the "Knowledge Base" tab. You will see three tabs: "File", "URL" and "Note".

In the "File" tab:

  • Drag a file via drag & drop into the dashed box, or click "Choose file".
  • Supported formats: PDF, Word (.docx), Excel (.xlsx), PowerPoint (.pptx), images (.png, .jpg, .jpeg, .gif, .webp), as well as .txt, .md, .html, .csv, .json and .log.
  • Maximum size: 25 MB per file. Larger files are rejected with the message "File too large (max 25 MB)".
  • Images: Uploaded images are transcribed by vision AI – the AI describes the content and extracts visible text (e.g. a photographed menu). This is handy, but less accurate than clean text – see pitfalls.

After the upload, the document appears in the list below with a status label. It passes through the statuses "pending" / "processing" (the list refreshes automatically every 2 seconds) and only becomes available to the agent once it reaches "ready" (green tick). "failed" (red) indicates an error (e.g. file not readable).

Step 4: Import a single URL (the "URL" tab)

In the "URL" tab you index a single web page.

  • "URL" – Required field. Enter the full address, e.g. https://example.com/info. With Enter or the "Fetch & index" button, the page is loaded, the text is extracted and indexed.
  • "Title" – Optional. Determined automatically from the page if you leave the field empty. Only enter something if the automatic title would be unsuitable.
  • Prezio additionally pulls structured data from the page (schema.org / meta tags): name, address, phone, email, price range, cuisine and opening hours. This way even image- or JavaScript-heavy pages (Wix, Squarespace, Shopify) deliver usable facts.

Step 5: Crawl an entire website (checkbox in the "URL" tab)

In the URL tab, tick the checkbox "Also read in subpages of this domain". The button is then called "Crawl & index website".

  • What happens: Prezio follows the links of the same website (e.g. menu, opening hours, about us) and indexes each page individually. External links are ignored, image-based content is read via OCR.
  • In the background: The crawl runs as a background job. A progress card "Website Crawl" shows the status live ("Queued", "Crawling…", "Done", "Failed"), a progress bar and "X of Y pages processed". You can leave the tab – the crawl carries on.
  • Limits: By default, up to 25 pages are captured with a link depth of 2 levels (technical maximum: 500 pages). When the limit is reached, the notice "Page limit reached" appears. Pages without readable text are skipped ("X skipped").
  • Recommendation: For most restaurants/practices/shops, a crawl of your own domain is entirely sufficient. Only crawl your own, well-maintained website – not third-party sites.

Step 6: Add a free-form note (the "Note" tab)

The "Note" tab is the most reliable and cleanest source, because you type the text yourself.

  • "Title" – Required field, e.g. "Opening hours".
  • "Content" – Required field. Add any text you want the agent to know.
  • With "Save & index" the note is processed immediately.
  • Recommendation: For crucial, frequently asked facts (opening hours, address, cancellation conditions, prices), a hand-typed note is always the best choice – it contains no junk and is found most reliably.

Step 7: Manage, view and correct documents

In the document list below, you have the following options per entry:

  • Clicking the title opens the detail view (a side panel) with two tabs:
  • "Content" – shows the exact extracted text that the AI actually retrieves. You can edit it directly here. On saving, the document is re-chunked and re-embedded ("Save & re-index"). This is exactly where you correct messy text from PDF or crawl imports.
  • "Chunks" – shows, read-only, how the text was split up for search (index + token count + content). This lets you see what the AI really "sees".
  • Re-index (circular-arrow icon) – reprocesses the document without changing the text (useful after a failed import).
  • Delete (bin) – removes a single document. After this, the agent can no longer retrieve any information from it.
  • Multiple selection: Using the checkboxes on the left, you select several documents and delete them together ("Delete selected") or empty the entire knowledge base ("Delete all"). Both are irreversible.

Each list entry shows the source type (PDF, URL, Note …), the number of chunks and the file size; for URL/crawl documents there is additionally a "Source" link to the original page.

Step 8: Check accuracy and set the threshold (Retrieval Test)

Whether the agent finds the right knowledge is something you check in the "AI-Debug" → "Retrieval Test" area. This is your most important tool when faced with "the agent doesn't know the menu".

Here is how the hit logic works in the background:

  • Every snippet found is given a cosine distance between 0 (perfect match) and 2 (no connection). Smaller = better.
  • The threshold kb_max_distance decides which hits are "close enough". Default: 0.5 (valid range 0.0–2.0). Per agent it is initially empty and then automatically uses this global default value.

Here is how you tune it without guessing:

  1. In the Retrieval Test, enter a real customer question (e.g. "Do you have vegetarian dishes?") and click "Run test".
  2. You will see which chunks were found, their distances, a distance histogram and – where appropriate – a recommended value for the threshold.
  3. With one click you adopt the recommended threshold ("Apply recommendation") or save it directly on the agent ("Save to agent"). There is no need to type kb_max_distance in manually anywhere.

Step 9: Understanding "Recall-First" – why the agent does not stay silent

Prezio deliberately works "Recall-First" (hits first): if no snippet clears the threshold for a question, the agent would otherwise say "I don't know that" – even if the right document was just over the line (noisy data inflates distances).

  • Instead, in this case the system keeps the best near-hit (and near-hits clustered close together), as long as it lies below a generous upper limit (threshold + 0.25, capped at 0.85; above that it counts as a genuine "no hit").
  • These answers appear in the decision flow as a yellow "recall-fallback" – an indication that the context was a lenient near-hit, not a strong one. At the same time, the agent is instructed to use it only if it really fits.
  • Consequence for you: The agent is robust out of the box, even without perfect data – but frequent appearances of "recall-fallback" are a clear signal that your documents need to become cleaner or more complete.

Step 10: Keep an eye on document quality (Quality Score)

When indexing, Prezio calculates a quality score from 0 (junk) to 100 (clean text) for each document. It detects binary/OCR junk (e.g. a JPEG read in as text, or a repeating, scanned menu) that pollutes the search.

  • You do not see this score in the normal document list, but in the "AI-Debug" area – in the overview / KB health (with a "Quality Index" across all documents) and in the tables of the Retrieval Test. Values below 50 are marked red.
  • Recommendation: If you see red, low scores here (especially for important documents such as the menu), re-upload the content as clean text – typed as a note, as a genuine text PDF, or corrected by hand via the "Content" detail view.

Tips & pitfalls

  • Polluted crawl pages distort hits. When crawling, navigation and footer text ("boilerplate") often ends up in the document. This noise increases the distances, so the actual answer slips just over the threshold and may only get through as a yellow "recall-fallback". Solution: Recapture the relevant content as a clean note, or delete the superfluous text in the detail view ("Content") and re-index.
  • Images/scans are the least reliable source. Vision AI and OCR make mistakes (prices, tables, umlauts). After the upload, check in the "Content" detail view whether, for example, "€18.50" and dish names were recognised correctly – otherwise it is better to type the menu as a note.
  • Only "ready" counts. Documents in the "pending"/"processing" status are not yet retrieved. For "failed", "Re-index" often helps; if it stays red, the source file is corrupted or not readable.
  • Do not adjust the threshold blindly. If you increase kb_max_distance (e.g. to 0.7), the agent lets more through – but also more false hits; if you lower it, it becomes stricter and more often says "I don't know". Only change it via the data-backed recommended value from the Retrieval Test.
  • Don't overdo Top-K. A very high "Top-K Chunks" delivers more context, but also more distraction and higher cost per answer. 5 is ideal for the vast majority of cases.
  • Check the RAG switch when "nothing" is found. If the agent simply cannot find any knowledge, first make sure that "Use Knowledge Base (RAG)" in the "Model" tab is actually switched on.
  • Back up important facts redundantly. Store opening hours, address and prices additionally as a hand-typed note – this is the most robust source and is found most reliably.