// CONTENTS Part 08 · Knowledge and AI

// PART 08

Semantic cache and vector collections

Chapter 36 / 60 2 min read English Part 08 of 15

Two caches shape how fast and how cheap answers are: the semantic cache reuses whole answers, and the vector collections organise what retrieval can find. This chapter covers both, plus the context settings that bound conversation cost.

Vector collections

Collections emerge automatically from the folder structure inside .gbkb/: each folder becomes a distinct collection, indexed separately and activatable with USE KB. Processing is incremental — only new or modified files are re-embedded — and each stored record carries the file path, type, bucket and tags.

Accuracy note. Documents are indexed as whole-file records: no chunking, no overlap. Long documents can lose precision — favour focused documents per folder.

The semantic cache

When caching is enabled, the platform checks whether a semantically similar question was answered before. If the similarity exceeds the threshold, the cached answer is returned; otherwise a new answer is generated and cached.

Parameter Type Default Meaning
llm-cache boolean false Enable LLM response caching
llm-cache-ttl integer 3600 Time-to-live in seconds
llm-cache-semantic boolean true Match by semantic similarity, not exact text
llm-cache-threshold float 0.95 Similarity required for a cache hit

These live in the bot’s config.csv. Semantic matching uses the configured embedding service.

When to enable it

Enable for Avoid for
FAQ bots with repetitive questions Real-time data where freshness matters
Knowledge queries asked often Personalised answers that must vary per user
Expensive external calls Development and testing, where you want the real answer

Tuning

TTL should match data freshness: minutes for volatile data, an hour or so for general knowledge, a day for static documentation. The threshold trades precision against coverage — 0.95 or above is strict, below 0.85 risks answering a different question. Entries expire by TTL and memory pressure; no manual housekeeping is required.

Conversation context settings

Two related settings control how much conversation history rides along with each turn:

Parameter Default Effect
episodic-memory-history 2 Number of previous exchanges kept in context
episodic-memory-threshold 4 Compact the conversation after this many exchanges

Compaction summarises older history so recent, relevant turns keep the space — the mechanism behind “the bot remembers” without unbounded token cost. Episodic summaries themselves are stored per conversation for long-term recall.

Reading the whole picture

Question Page
What retrieval mode should my bot use? Retrieval and RAG
How do documents become searchable? Sources and indexing
Where does the assistant get my facts? Attachments and memory (Part 2)

Found a mistake? Open an issue · All books

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