You’ve built your chatbots. Now let’s talk about how they work and how to manage your knowledge bases efficiently.
What is RAG?
RAG = Retrieval-Augmented Generation
When you ask a chatbot a question, it doesn’t “know” everything in its knowledge base. Instead:
- Retrieval: Your question + KB files are processed together
- Augmentation: Relevant information is pulled from KB
- Generation: AI generates response using that context
User Question → [Retrieval] → Relevant KB Content → [Generation] → Response
Why This Matters
| Factor | Impact |
|---|---|
| Token Limit | Chatbots have maximum context (typically 8K-128K tokens) |
| KB Size | More files = more tokens = may exceed limits |
| Cost | More tokens = higher API costs |
| Speed | More tokens = slower responses |
Token Estimation
Rough guidelines:
- 1 token ≈ 4 characters of English text
- 1 page of text ≈ 1,000-1,500 tokens
- Average email ≈ 100 tokens
Example: 10 markdown files × 2,000 tokens each = 20,000 tokens
Managing KB Size
Strategy 1: Chunking
Split large documents into focused sections:
# Instead of one large file:
scrapy-complete-guide.md (10,000 tokens)
# Split into focused files:
scrapy-selectors.md (1,500 tokens)
scrapy-spiders.md (2,000 tokens)
scrapy-settings.md (1,500 tokens)
Strategy 2: Selective Upload
Only upload relevant files per chatbot:
scrapy-tutor→ Scrapy docs onlyzapier-specialist→ Zapier help content only
Strategy 3: Local Storage
Keep full KB locally, upload subsets:
my-chatbot-bundles/
├── scrapy-tutor/
│ ├── directive.md
│ └── knowledge-base/ # Full Scrapy docs (local)
│ ├── selectors.md
│ ├── spiders.md
│ └── ...
├── zapier-specialist/
│ ├── directive.md
│ └── knowledge-base/ # Full Zapier content (local)
│ ├── troubleshooting.md
│ ├── getting-started.md
│ └── ...
RAG Storage Limits
| Plan | KB Size | Retention |
|---|---|---|
| Free | ~10MB | Varies |
| Pro | ~100MB | Longer |
Practical tip: Keep knowledge bases under 5MB for free tier.
Versioning Your Knowledge
As content changes, maintain versions:
knowledge-base/
├── v1/ # Initial scrape
│ ├── article-01.md
│ └── ...
├── v2/ # Updated content
│ ├── article-01.md
│ └── ...
└── current/ # Active version
├── article-01.md
└── ...
When to Update KB
- Service introduces new features
- Major troubleshooting patterns emerge
- Your bot gives outdated information
Key Takeaways
- RAG = Retrieval-Augmented Generation - How chatbots use KB
- Token limits exist - Manage KB size carefully
- Local storage + selective upload = efficient management
- Version your content - Track changes over time
Next Steps
Important consideration: your data on cloud services. Continue to Module 7: Data Privacy Considerations