How To: Add Documents to Knowledge Base ๐ก BETA
Tutorial 3 of the Knowledge Base Series
Teach your bot from files in 15 minutes
Objective
By the end of this tutorial, you will have:
- Prepared documents for the knowledge base
- Uploaded files to your botโs
.gbkbfolder - Indexed documents for semantic search
- Tested that your bot can answer questions from the documents
Time Required
โฑ๏ธ 15 minutes
Prerequisites
Before you begin, make sure you have:
- A working bot (see Create Your First Bot)
- Access to the Drive app
- Documents to upload (PDF, Word, Text, or Markdown files)
What is a Knowledge Base?
A Knowledge Base (KB) is a collection of documents that your bot uses to answer questions. When a user asks something, the bot searches through these documents to find relevant information.
Supported File Formats
| Format | Extension | Best For |
|---|---|---|
.pdf | Manuals, reports, official documents | |
| Word | .docx, .doc | Policies, procedures, articles |
| Excel | .xlsx, .xls | FAQs, structured data, tabular content |
| OpenDocument Spreadsheet | .ods | Open-source spreadsheet data |
| PowerPoint | .pptx, .ppt | Training materials, slide decks |
| OpenDocument Presentation | .odp | Open-source presentations |
| E-book | .epub | Books, long-form guides |
| OpenDocument Text | .odt | Open-source word processing |
| Text | .txt | Simple content, FAQs |
| Markdown | .md | Technical documentation |
| reStructuredText | .rst | Python/docs project documentation |
| AsciiDoc | .adoc | Technical publishing |
| HTML | .html | Web content |
| CSV / TSV | .csv, .tsv | Tabular data, exports |
| JSON / JSONL | .json, .jsonl | Structured data, API responses |
| YAML | .yaml, .yml | Configuration, structured content |
| TOML | .toml | Configuration files |
| Source Code | .py, .rs, .js, .ts, .sh, .sql, .graphql, .proto | Code documentation, technical references |
| CSS / SVG | .css, .svg | Style references, vector graphics text |
| Calendar / Contacts / Email | .ics, .vcf, .eml | Scheduling, address books, message archives |
| Config / Log | .ini, .conf, .cfg, .env, .properties, .log | System configuration, diagnostics |
Step 1: Prepare Your Documents
1.1 Gather Your Files
Collect the documents you want your bot to learn from. Good candidates include:
- โ Product manuals
- โ FAQ documents
- โ Company policies
- โ Help articles
- โ Training materials
1.2 Review Document Quality
Before uploading, check that your documents:
| Check | Why It Matters |
|---|---|
| Text is selectable | Scanned images canโt be indexed |
| Content is accurate | Bot will repeat incorrect info |
| Information is current | Outdated docs confuse users |
| No sensitive data | Protect confidential information |
โ ๏ธ Warning: The bot will use exactly whatโs in your documents. Remove any outdated or incorrect information first.
1.3 Organize Files (Optional)
For large knowledge bases, organize files into folders by topic:
mycompany.gbkb/
โโโ ๐ products/
โ โโโ product-guide.pdf
โ โโโ specifications.docx
โโโ ๐ policies/
โ โโโ refund-policy.pdf
โ โโโ privacy-policy.md
โโโ ๐ support/
โ โโโ faq.docx
โ โโโ troubleshooting.pdf
โโโ ๐ training/
โโโ onboarding-guide.pptx
โ Checkpoint: You have documents ready to upload.
Step 2: Upload Files to Knowledge Base
2.1 Open the Drive App
Click the Apps Menu (โฎโฎโฎ) and select Drive.
2.2 Navigate to Your Botโs KB Folder
Navigate to your botโs knowledge base folder:
๐ mycompany.gbai
โโโ ๐ mycompany.gbkb โโโ Open this folder
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Drive โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ ๐ mycompany.gbai โ
โ โโโ ๐ mycompany.gbdialog โ
โ โโโ ๐ mycompany.gbot โ
โ โโโ ๐ mycompany.gbkb โโโ Knowledge base folder โ
โ โ โโโ (your documents go here) โ
โ โโโ ๐ mycompany.gbdrive โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
2.3 Upload Your Documents
Method A: Drag and Drop
- Open your file explorer
- Select the documents you want to upload
- Drag them into the Drive window
Method B: Upload Button
- Click the Upload button (๐ค)
- Select files from your computer
- Click Open
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Drive > mycompany.gbai > mycompany.gbkb โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ค Upload โ โ ๐ New Folder โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ ๐ company-faq.pdf 2.3 MB Just now โ
โ ๐ product-manual.docx 1.1 MB Just now โ
โ ๐ refund-policy.pdf 0.5 MB Just now โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Drag files here to upload โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
2.4 Wait for Upload to Complete
Youโll see a progress indicator for each file. Wait until all uploads finish.
๐ก Tip: Large files may take longer. PDF files typically upload fastest.
โ
Checkpoint: Your documents appear in the .gbkb folder.
Step 3: Index the Knowledge Base
After uploading, you need to index the documents so the bot can search them.
3.1 Automatic Indexing
In most cases, indexing happens automatically when files are uploaded. Look for:
- A โProcessingโฆโ indicator
- Files changing from gray to normal color
- A completion notification
3.2 Manual Indexing (If Needed)
If automatic indexing doesnโt start, trigger it manually:
From Chat:
/reindex
From a BASIC Dialog:
' Clear and rebuild the knowledge base
CLEAR KB
USE KB "mycompany"
3.3 Check Indexing Status
You can check how many documents are indexed:
From Chat:
/kb stats
Expected Output:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Knowledge Base Statistics โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Collection: mycompany โ
โ Documents: 3 โ
โ Vectors: 847 โ
โ Status: โ Ready โ
โ Last Index: 2 minutes ago โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Checkpoint: Documents are indexed and ready to search.
Step 4: Test the Knowledge Base
4.1 Open Chat
Click the Apps Menu (โฎโฎโฎ) and select Chat.
4.2 Ask a Question from Your Documents
Type a question that can be answered by your uploaded documents:
You: What is the refund policy?
4.3 Verify the Response
The bot should answer using information from your documents:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฌ Chat โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ค You โ โ
โ โ What is the refund policy? โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ค Bot โ โ
โ โ โ โ
โ โ Based on our refund policy document: โ โ
โ โ โ โ
โ โ Customers may request a full refund within 30 days of โ โ
โ โ purchase. After 30 days, refunds are prorated based on โ โ
โ โ usage. To request a refund, contact support@company.com โ โ
โ โ with your order number. โ โ
โ โ โ โ
โ โ ๐ Source: refund-policy.pdf โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
4.4 Test Different Questions
Try several questions to ensure the knowledge base is working:
| Test Question | Expected Source |
|---|---|
| โHow do I return a product?โ | refund-policy.pdf |
| โWhat are the product specs?โ | product-manual.docx |
| โHow do I contact support?โ | company-faq.pdf |
โ Checkpoint: Your bot answers questions using the uploaded documents!
๐ Congratulations!
Youโve successfully added documents to your knowledge base! Hereโs what you accomplished:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โ Prepared documents for upload โ
โ โ Uploaded files to the .gbkb folder โ
โ โ Indexed documents for semantic search โ
โ โ Tested that the bot can answer from documents โ
โ โ
โ Your bot can now answer questions from your documents! โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Troubleshooting
Problem: Bot doesnโt find information from documents
Cause: Documents may not be indexed yet.
Solution:
- Check indexing status with
/kb stats - Wait a few minutes for processing to complete
- Try
/reindexto force re-indexing
Problem: Bot gives wrong information
Cause: Document contains outdated or incorrect content.
Solution:
- Review the source document
- Update or replace the incorrect document
- Re-index the knowledge base
Problem: โNo relevant information foundโ
Cause: Question doesnโt match document content well enough.
Solution:
- Try rephrasing the question
- Use keywords that appear in your documents
- Check that the document actually contains the answer
Problem: Upload fails
Cause: File too large or unsupported format.
Solution:
- Check file size (max 50MB per file)
- Verify file format is supported
- Try converting to PDF if format issues persist
Problem: PDF text not extracted
Cause: PDF contains scanned images, not selectable text.
Solution:
- Use OCR software to convert image-based PDFs
- Or recreate the document as a text-based PDF
- Consider using Word format instead
Best Practices
Document Organization
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ RECOMMENDED KB STRUCTURE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ mycompany.gbkb/ โ
โ โ โ
โ โโโ ๐ policies/ โโโ Company policies โ
โ โ โโโ refund-policy.pdf โ
โ โ โโโ privacy-policy.pdf โ
โ โ โโโ terms-of-service.pdf โ
โ โ โ
โ โโโ ๐ products/ โโโ Product documentation โ
โ โ โโโ product-guide.pdf โ
โ โ โโโ user-manual.pdf โ
โ โ โโโ specifications.xlsx โ
โ โ โ
โ โโโ ๐ support/ โโโ Support resources โ
โ โ โโโ faq.docx โ
โ โ โโโ troubleshooting.pdf โ
โ โ โ
โ โโโ ๐ internal/ โโโ Internal documentation โ
โ โโโ processes.docx โ
โ โโโ guidelines.pdf โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Content Guidelines
- Be specific โ Clear, detailed content produces better answers
- Use headings โ Helps the bot find relevant sections
- Include keywords โ Use terms users are likely to search for
- Update regularly โ Keep documents current
- Remove duplicates โ Avoid conflicting information
Naming Conventions
| โ Good Names | โ Bad Names |
|---|---|
refund-policy-2024.pdf | doc1.pdf |
product-manual-v2.docx | final final (2).docx |
employee-handbook.pdf | new document.pdf |
Advanced: Using KB in Dialogs
You can reference the knowledge base in your BASIC dialogs:
' Activate a specific knowledge base
USE KB "mycompany"
' Ask the user what they want to know
TALK "What would you like to know about?"
HEAR question
' The bot will automatically search the KB and respond
Multiple Knowledge Bases
You can have different knowledge bases for different purposes:
' Switch between knowledge bases based on topic
TALK "Are you asking about Products or Policies?"
HEAR topic
IF topic = "Products" THEN
USE KB "products"
ELSE IF topic = "Policies" THEN
USE KB "policies"
END IF
TALK "What would you like to know?"
HEAR question
Next Steps
| Next Tutorial | What Youโll Learn |
|---|---|
| Import a Website | Crawl web pages into your KB |
| Create FAQ Responses | Define question-answer pairs |
| Manage Collections | Organize knowledge by topic |
Quick Reference
Chat Commands
| Command | Description |
|---|---|
/kb stats | Show knowledge base statistics |
/reindex | Rebuild the search index |
/kb list | List all KB collections |
BASIC Keywords
| Keyword | Description | Example |
|---|---|---|
USE KB | Activate a KB | USE KB "mycompany" |
CLEAR KB | Clear current KB | CLEAR KB |
KB STATISTICS | Get KB info | stats = KB STATISTICS |
File Size Limits
| File Type | Max Size |
|---|---|
| 100 MB | |
| Word / EPUB / ODT | 100 MB |
| Excel / ODS | 100 MB |
| PowerPoint / ODP | 100 MB |
| Text / MD / Code / Config | 100 MB |
| Any text-based format | 100 MB |
Tutorial 3 of 30 โข Back to How-To Index โข Next: Import a Website โ