USE KB 🟡 BETA
Activate a knowledge base collection for semantic search.
Syntax
USE KB "collection_name"
USE KB collection_variable
Parameters
| Parameter | Type | Description |
|---|---|---|
collection_name | String | Name of folder inside .gbkb/ |
Description
Loads a knowledge base collection, enabling automatic semantic search for that content. Once active, the LLM searches this collection when answering questions - no explicit search code needed.
Examples
Basic Usage
USE KB "policies"
' Bot now answers questions using policy documents
Multiple Collections
USE KB "products"
USE KB "pricing"
USE KB "support"
' All three collections searchable
Conditional Loading
dept = GET user_department
IF dept = "HR" THEN
USE KB "hr_policies"
ELSE IF dept = "IT" THEN
USE KB "it_docs"
END IF
Dynamic Collection
topic = HEAR "What topic?"
USE KB topic
How It Works
- User asks question
- System searches active collections
- Top matching chunks added to LLM context
- LLM generates informed response
Collection Structure
bot.gbkb/
├── policies/ → USE KB "policies"
├── products/ → USE KB "products"
└── support/ → USE KB "support"
Supported File Types
| Category | Formats | Extensions |
|---|---|---|
| Documents | PDF, Word | .pdf, .docx, .doc |
| Spreadsheets | Excel, OpenDocument | .xlsx, .xls, .ods |
| Presentations | PowerPoint, OpenDocument | .pptx, .ppt, .odp |
| E-books | EPUB, OpenDocument Text | .epub, .odt |
| Text | Plain, Markdown, reStructuredText, AsciiDoc | .txt, .md, .rst, .adoc |
| Web | HTML | .html |
| Data | CSV, JSON, JSONL, TSV | .csv, .json, .jsonl, .tsv |
| Config | YAML, TOML, INI, Properties | .yaml, .yml, .toml, .ini, .conf, .cfg, .env, .properties |
| Code | Python, Rust, JS/TS, Shell, SQL, GraphQL, Proto | .py, .rs, .js, .ts, .sh, .sql, .graphql, .proto |
| Style | CSS, SVG | .css, .svg |
| Calendar | iCalendar, vCard, Email | .ics, .vcf, .eml |
| Logs | Log files | .log |
Performance
- Each collection uses ~50MB RAM when active
- First search: 100-200ms
- Subsequent: 20-50ms (cached)
Tip: Load only what’s needed, clear when done.
Common Patterns
Role-Based
SWITCH GET user_role
CASE "manager"
USE KB "management"
CASE "developer"
USE KB "documentation"
CASE "customer"
USE KB "products"
END SWITCH
With Context
USE KB "technical_docs"
SET CONTEXT "You are a technical expert" AS prompt
With Website
USE WEBSITE "https://docs.example.com"
USE KB "documentation"
' Fresh web content now searchable
Error Handling
TRY
USE KB user_requested_kb
CATCH
TALK "That knowledge base doesn't exist"
END TRY
See Also
- CLEAR KB - Deactivate collections
- Knowledge Base System - Technical details
- Retrieval and RAG - How retrieval works