👉 Try the demo: https://github.com/LM-Kit/lm-kit-net-samples/tree/main/console_net/rag/help_desk_knowledge_base
Help Desk Knowledge Base for C# .NET Applications
🎯 Purpose of the Sample
The Help Desk Knowledge Base demo shows how to build a production-grade RAG system with LM-Kit.NET that persists its index to disk, supports incremental article management, and scopes queries to specific categories using DataFilter.
This is the demo to study when you need to build a knowledge base that survives restarts, grows over time, and serves different departments or topics.
👥 Industry Target Audience
This demo is particularly useful for developers and organizations working on:
- Customer support: build a knowledge base of FAQs and support articles that agents (human or AI) query to resolve tickets
- Internal documentation portals: maintain a searchable wiki of company policies, procedures, and technical documentation
- Multi-department help desks: scope queries to specific departments (HR, IT, Finance) using category filters
- SaaS product documentation: embed a searchable knowledge base in your product for self-service support
- Compliance and legal: maintain a persistent, auditable knowledge base of regulations and policies
🚀 Problem Solved
Most RAG tutorials show a "build once, query, throw away" pattern. Real applications need to:
- Persist the index so it survives restarts without re-embedding (which is slow and costly)
- Add and remove content incrementally as documentation evolves
- Scope queries so users searching billing issues do not get results from technical troubleshooting
- Show sources so users can verify answers against the original articles
This demo solves all of these problems with a complete, working implementation.
💻 Sample Application Description
The Help Desk Knowledge Base demo is a console application that:
- Loads a chat model and an embedding model
- Creates or reloads a persistent, file-backed knowledge base
- Seeds 20 fictional support articles across 5 categories on first run
- Provides an interactive help desk assistant with article management commands
✨ Key Features
- Persistent storage: file-backed
DataSourcethat reloads instantly without re-embedding - Incremental management: add and remove articles at runtime; changes persist automatically
- Category-scoped search:
DataFilterrestricts queries to specific categories - Markdown-aware chunking:
MarkdownChunkingrespects heading boundaries for cleaner chunks - Answer generation: two-step pipeline using
FindMatchingPartitionsthenQueryPartitions - Source attribution: shows which articles contributed to each answer, with relevance scores
🏗️ Architecture
┌─────────────────────────────────────────────────────────┐
│ help_desk_kb.dat │
│ (persistent file storage) │
│ │
│ Account Management/ Billing/ Technical Support/ ... │
│ Password Reset Plans Connectivity │
│ Account Recovery Payments Error Codes │
│ Profile Settings Refunds API Rate Limits │
│ ... ... ... │
└──────────────────────────┬──────────────────────────────┘
│
LoadFromFile / CreateFileDataSource
│
┌──────────▼──────────┐
│ RagEngine │
│ + DataFilter │◄── /scope Billing
└──────────┬──────────┘
│
FindMatchingPartitions
│
┌──────────▼──────────┐
│ Top-5 Passages │
│ + source info │──► Source Attribution
└──────────┬──────────┘
│
QueryPartitions
│
┌──────────▼──────────┐
│ SingleTurnConv │
│ (chat model) │──► Grounded Answer
└─────────────────────┘
🛠️ Getting Started
📋 Prerequisites
- .NET 8.0 or later
- Minimum 6 GB VRAM (Qwen-3 8B) or 4 GB VRAM (Gemma 3 4B)
📥 Download the Project
▶️ Running the Application
Clone the repository:
git clone https://github.com/LM-Kit/lm-kit-net-samplesNavigate to the project directory:
cd lm-kit-net-samples/console_net/rag/help_desk_knowledge_baseBuild and run the application:
dotnet build dotnet runFirst run: the knowledge base is created and seeded with 20 sample articles. Subsequent runs reload the persisted index instantly.
💡 Example Usage
- Ask a question: type a support question to get a grounded answer with source attribution
- Scope to a category: use
/scope Billingto restrict queries, then/scope allto remove the filter - Add an article: use
/add Security "API Key Best Practices"and enter content interactively - Remove outdated content: use
/remove "Outdated Article"to remove articles - Browse the knowledge base: use
/categoriesfor an overview or/list Technical Supportfor details - Restart the demo: the knowledge base reloads from disk without re-embedding
🔧 Troubleshooting
| Issue | Solution |
|---|---|
| No relevant articles found | Remove the scope filter with /scope all or lower the search threshold |
| First run is slow | Embedding 20 articles takes a few seconds; subsequent runs are instant |
| Article not added | Check that the section identifier (Category/Title) does not already exist |
🚀 Extend the Demo
- Load from files: use
/addfileto import Markdown files, or modify the code to scan a directory - Add hybrid search: set
ragEngine.RetrievalStrategy = new HybridRetrievalStrategy()for BM25 + vector fusion - Multi-turn conversation: replace
SingleTurnConversationwithRagChatfor follow-up questions - Connect to Qdrant: replace the file-backed
DataSourcewith a Qdrant-backed store for scalability
📚 Additional Resources
- LM-Kit.NET RAG Documentation
- Conversational RAG Demo: multi-turn RAG with query generation modes
- Retrieval Quality Tuning Demo: compare Vector, BM25, and Hybrid strategies
- Single-Turn RAG with Qdrant Demo: enterprise RAG with external vector database