Knowledge Base (RAG)
Teach your AI agent about your product, documentation, or domain-specific knowledge using Retrieval Augmented Generation (RAG).
What is RAG?
RAG (Retrieval Augmented Generation) allows the AI to search your custom documentation and include relevant information in its responses.
Without RAG:
- User: “How do I reset my password?”
- AI: “I don’t have specific information about your password reset process.”
With RAG (after adding your docs):
- User: “How do I reset my password?”
- AI: “To reset your password, go to Settings → Account → Reset Password. You’ll receive a reset link via email within 5 minutes.”
How It Works
- Add URLs - You provide documentation URLs in the dashboard
- Content Extraction - InAppAI fetches and processes the content
- Vector Embeddings - Content is converted to searchable vectors
- Semantic Search - When users ask questions, relevant sections are found
- Context Injection - Relevant docs are added to the AI’s context
- Enhanced Response - AI answers using your documentation
Adding Documentation
Dashboard Interface
- Go to app.inappai.com
- Navigate to Knowledge Base
- Click Add URL
- Enter the documentation URL
- (Optional) Add a title and category
- Click Save
Supported Content
InAppAI can extract content from:
- Documentation sites - GitBook, ReadTheDocs, Hugo, Docusaurus
- Blog posts - Medium, WordPress, Ghost
- HTML pages - Any public webpage
- Markdown files - GitHub READMEs, wiki pages
Note: The URL must be publicly accessible (not behind authentication).
URL Examples
✅ Good URLs:
https://docs.yourapp.com/getting-started
https://yourblog.com/how-to-use-our-api
https://github.com/yourorg/project/blob/main/README.md
https://help.yourapp.com/billing
❌ Not Supported:
https://app.yoursite.com/admin/docs (requires login)
file:///local/docs.html (not public)
https://yoursite.com/video-tutorial (video, not text)
Content Indexing
How Pages Are Split
Long documentation pages are automatically split into sections for better search accuracy:
- Each section is ~1,000 characters
- Sections maintain context (titles, headings)
- Overlapping content ensures continuity
Example: A 10,000-character page becomes ~10 searchable sections.
Indexing Process
When you add a URL:
- Fetch - Content is downloaded from the URL
- Parse - HTML is converted to plain text
- Split - Text is divided into sections
- Embed - Each section is converted to a vector embedding
- Store - Vectors are saved with metadata
- Cache - Results are cached for fast retrieval
This process typically takes 5-30 seconds per URL.
Search and Retrieval
Semantic Search
InAppAI uses semantic search, not keyword matching:
- Understands meaning, not just exact words
- Finds relevant content even with different phrasing
- Ranks results by similarity
Example:
- User asks: “How much does it cost?”
- Matches documentation about: “Pricing”, “Plans”, “Billing”
Search Threshold
The threshold determines how similar content must be to be included:
- 0.7 (default) - Moderately similar content
- 0.8 - More selective, higher similarity required
- 0.6 - More permissive, includes loosely related content
Configure in dashboard: Knowledge Base → Settings → Search Threshold
Maximum Results
Control how many documentation sections are included in each response:
- Default: 5 sections
- Range: 1-10 sections
More sections = more context but higher latency and cost.
Configure in dashboard: Knowledge Base → Settings → Max Results
Managing Your Knowledge Base
Viewing Indexed URLs
See all added documentation:
- Go to Knowledge Base → URLs
- View list with:
- URL
- Document title
- Section count (number of chunks)
- Last updated timestamp
Refreshing Content
Update existing documentation when it changes:
- Find the URL in Knowledge Base → URLs
- Click Refresh icon
- Content is re-fetched and re-indexed
When to refresh:
- Documentation has been updated
- Page content has changed
- Fixing outdated information
Deleting URLs
Remove documentation from the knowledge base:
- Find the URL in Knowledge Base → URLs
- Click Delete icon
- Confirm deletion
All sections from that URL are immediately removed.
Testing Your Knowledge Base
Test Search Feature
Verify your documentation is working:
- Go to Knowledge Base → Test Search
- Enter a test query (e.g., “How do I authenticate?”)
- Adjust threshold and limit
- Click Search
Results show:
- Similarity score - How well content matches (0.0-1.0)
- Content preview - Text snippet
- Metadata - Document title, URL, section
- Included? - Whether it exceeds threshold
Example:
Query: "password reset"
Threshold: 0.7
Results:
✅ 0.89 - "To reset your password..." (Account Settings)
✅ 0.82 - "Forgotten passwords can be..." (FAQ)
❌ 0.65 - "Change your username..." (Profile) - below threshold
Testing in Chat
Test knowledge base in actual conversation:
- Open your React app with InAppAI component
- Ask a question related to your documentation
- Check if AI includes information from your docs
Example:
- User: “What payment methods do you accept?”
- AI: “We accept Visa, MasterCard, American Express, and PayPal. You can manage payment methods in Billing → Payment Methods.” (sourced from your docs)
Statistics
Usage Limits
Knowledge base limits vary by plan:
| Plan | URL Limit |
|---|---|
| Developer | 10 KB URLs |
| Startup | 100 KB URLs |
| ScaleUp | 200 KB URLs |
What counts as 1 KB URL?
- Each unique URL you add
- Example: Adding 5 documentation pages = 5 KB URLs
Current Usage
View in dashboard: Knowledge Base → Stats
- Total URLs indexed
- Total sections (chunks)
- Storage used
- Cache size
Best Practices
1. Start Small
Add your most important documentation first:
✅ Priority 1: Getting Started, FAQ, Common Issues
✅ Priority 2: API Reference, Feature Guides
✅ Priority 3: Advanced Topics, Edge Cases
2. Use Clear Titles
Help the AI understand context:
❌ "Page 1", "Doc2"
✅ "Getting Started Guide", "API Authentication", "Billing FAQ"
3. Keep Content Updated
Refresh documentation when it changes:
- Set reminders to refresh monthly
- Update after major product changes
- Remove outdated content
4. Test Your Queries
Use Test Search to verify:
- Documentation is indexed correctly
- Relevant content is found
- Threshold is appropriate
5. Monitor Performance
If AI isn’t using your docs:
- Lower the threshold (try 0.6)
- Add more URLs covering the topic
- Improve documentation clarity
- Use Test Search to debug
Advanced Features
Categories and Tags
Organize documentation (coming soon):
Category: API Documentation
Tags: authentication, REST, OAuth
Category: User Guides
Tags: getting-started, tutorial
Custom Embeddings
Currently uses OpenAI’s text-embedding-3-small model. Custom embedding models coming soon.
Batch Import
Add multiple URLs at once:
- Go to Knowledge Base → Batch Import
- Upload CSV file with URLs
- Map columns (URL, Title, Category)
- Click Import
CSV format:
url,title,category
https://docs.example.com/api,API Docs,documentation
https://docs.example.com/faq,FAQ,support
Troubleshooting
“Failed to fetch URL”
Problem: URL cannot be accessed
Solutions:
- Verify URL is publicly accessible
- Check for typos in URL
- Ensure page doesn’t require authentication
- Try accessing URL in incognito browser
“No content found”
Problem: Page exists but no text extracted
Solutions:
- Page might be JavaScript-rendered (not supported yet)
- Content might be in images (not extracted)
- Page might be PDF (add PDF URL directly if text-based)
“AI not using my docs”
Problem: Knowledge base exists but AI doesn’t reference it
Solutions:
- Use Test Search to verify content is indexed
- Lower search threshold (try 0.6)
- Ask questions more similar to documentation language
- Add more comprehensive documentation
- Check that documentation is relevant to the question
“Too many sections”
Problem: Hit URL limit for your plan
Solutions:
- Remove outdated or low-value URLs
- Combine related pages into single comprehensive pages
- Upgrade to higher plan for more URLs
API Reference
Add URL
POST /api/:agentId/kb/urls
Authorization: Bearer <firebase-auth-token>
Content-Type: application/json
{
"url": "https://docs.example.com/guide",
"documentTitle": "User Guide",
"category": "documentation",
"tags": ["getting-started", "tutorial"]
}
List URLs
GET /api/:agentId/kb/urls
Authorization: Bearer <firebase-auth-token>
Refresh URL
POST /api/:agentId/kb/urls/refresh
Authorization: Bearer <firebase-auth-token>
Content-Type: application/json
{
"url": "https://docs.example.com/guide"
}
Delete URL
DELETE /api/:agentId/kb/urls
Authorization: Bearer <firebase-auth-token>
Content-Type: application/json
{
"url": "https://docs.example.com/guide"
}
Test Search
POST /api/:agentId/kb/test-search
Authorization: Bearer <firebase-auth-token>
Content-Type: application/json
{
"query": "How to authenticate?",
"limit": 5,
"threshold": 0.7
}
Note: All KB management endpoints require Firebase authentication token (admin access).
Next Steps
- Backend Settings - Configure AI provider and authentication
- React Installation - Integrate the chat component
- Live Demo - See knowledge base in action
Need Help?
- Dashboard - Manage your knowledge base
- GitHub Issues - Report problems
- Contact: Contact Us