// CONTENTS Part 08 · Knowledge and AI

// PART 08

Retrieval and RAG

Chapter 35 / 60 3 min read English Part 08 of 15

Retrieval decides what the model knows when it answers. General Bots implements six retrieval modes, selected per bot with the single setting rag-mode (default standard), and all six are reachable from chat. This page describes what each mode actually does and when to choose it.

The modes

Mode What it does Cost
standard Embeds the query, searches the vector store by cosine similarity, drops results scoring below 0.20 One embedding call
hybrid Runs the dense search and a keyword search, then merges both with Reciprocal Rank Fusion, k = 60; falls back to whichever side returned results One embedding call + one scroll
corrective Asks the LLM for 2–3 search variants, searches each, merges and de-duplicates, then has the LLM grade every chunk 0–10 and keeps those scoring 3 or better. If nothing is found locally it tries a web crawl (depth 1, up to 3 pages) 1 + N embedding calls, one grading call per chunk
graph Has the LLM extract up to 5 named entities, searches each separately, then merges with the original query’s results. This is entity-expansion retrieval, not a knowledge graph 1 + N embedding calls
agentic Has the LLM decompose the query into 2–3 focused sub-queries, searches each, then merges and re-ranks by score 1 + N embedding calls
multimodal Expands the query into three variants biased toward visual language, searches each, then boosts chunks containing terms like diagram, chart, figure or screenshot 1 + 3 embedding calls

Every mode degrades rather than failing: if the LLM is unavailable, the LLM-assisted modes fall back to heuristic splitting of the query instead of returning nothing.

Which mode to choose

Situation Mode
Focused documents, factual questions standard — cheapest, usually enough
Documents with exact terms, codes, product names hybrid — the keyword side catches what embeddings miss
Sparse knowledge where first attempts miss corrective — variants plus grading, with web fallback
Questions about people, products, places graph — entity expansion broadens the net
Broad, compound questions agentic — sub-queries cover the parts
Visual material — manuals with figures multimodal — boosts diagram-bearing chunks

The limits that shape expectations

  • Whole-file records. Documents are indexed as one record each — there is no chunking and no overlap, so very long documents lose precision.
  • Scores are per mode. The 0.20 floor in standard is that mode’s threshold; the graded modes judge with the LLM instead.
  • graph is not a knowledge graph. No entity store or relations are built; it is retrieval expanded by extracted entity names.
  • Web crawl is a fallback, not a source. corrective crawls only when local retrieval finds nothing, up to three pages at depth one.

Set the mode in the bot’s configuration; there is one value per bot, so pick for the dominant question type and revisit when the document set changes.

Found a mistake? Open an issue · All books

// SEARCH ESC
Pagefind · 236 pages · 4 books Enter to open ↑ ↓ to move