SmartRAG
Multi-Modal RAG for .NET — query databases, documents, images and audio in natural language. Production-ready with multi-AI support, vector storage, and multi-database coordination.
Install / Use
/learn @byerlikaya/SmartRAGREADME
🚀 Quick Start
1. Install SmartRAG
dotnet add package SmartRAG
2. Setup
// For Web API applications
builder.Services.AddSmartRag(builder.Configuration, options =>
{
options.AIProvider = AIProvider.OpenAI;
options.StorageProvider = StorageProvider.InMemory;
});
// For Console applications
var serviceProvider = services.UseSmartRag(
configuration,
aiProvider: AIProvider.OpenAI,
storageProvider: StorageProvider.InMemory
);
3. Configure databases in appsettings.json
{
"SmartRAG": {
"DatabaseConnections": [
{
"Name": "Sales",
"ConnectionString": "Server=localhost;Database=Sales;...",
"DatabaseType": "SqlServer"
}
]
}
}
4. Upload documents & ask questions
// Upload document
var document = await documentService.UploadDocumentAsync(
fileStream, fileName, contentType, "user-123"
);
// Unified query across databases, documents, images, and audio
var response = await searchService.QueryIntelligenceAsync(
"Show me all customers who made purchases over $10,000 in the last quarter, their payment history, and any complaints or feedback they provided"
);
// → AI automatically analyzes query intent and routes intelligently:
// - High confidence + database queries → Searches databases only
// - High confidence + document queries → Searches documents only
// - Medium confidence → Searches both databases and documents, merges results
// → Queries SQL Server (orders), MySQL (payments), PostgreSQL (customer data)
// → Analyzes uploaded PDF contracts, OCR-scanned invoices, and transcribed call recordings
// → Provides unified answer combining all sources
5. (Optional) Configure MCP Client & File Watcher
{
"SmartRAG": {
"Features": {
"EnableMcpSearch": true,
"EnableFileWatcher": true
},
"McpServers": [
{
"ServerId": "example-server",
"Endpoint": "https://mcp.example.com/api",
"TransportType": "Http"
}
],
"WatchedFolders": [
{
"FolderPath": "/path/to/documents",
"AllowedExtensions": [".pdf", ".docx", ".txt"],
"AutoUpload": true
}
],
"DefaultLanguage": "en"
}
}
Want to test SmartRAG immediately? → Jump to Examples & Testing
Dashboard (Web UI)
SmartRAG includes a built-in browser-based dashboard for document management and chat (no separate package needed):
builder.Services.AddSmartRag(builder.Configuration);
builder.Services.AddSmartRagDashboard(options => { options.Path = "/smartrag"; });
app.UseSmartRagDashboard("/smartrag");
app.MapSmartRagDashboard("/smartrag");
Then open https://localhost:5000/smartrag to list/upload/delete documents and chat with the active AI model. By default the dashboard is only enabled in Development. For production, protect the path with your own auth or use AuthorizationFilter. See Dashboard documentation for security and options.
Dashboard & UI Overview
SmartRAG ships with a production-ready web dashboard for managing documents, databases, and AI conversations.
The screenshots below show a typical setup in development:
| Chat & Conversation | Database Schema Analysis |
| ------------------- | ------------------------ |
|
|
|
| Database Details & Relations | Document Management & Settings |
| ---------------------------- | ------------------------------ |
|
|
|
Chat & Conversations
Database Overview & Health
Schema & Table Insights
Documents & File Processing
Settings & Configuration
🏆 Why SmartRAG?
🎯 Unified Query Intelligence - Single query searches across databases, documents, images, and audio automatically
🧠 Smart Hybrid Routing - AI analyzes query intent and automatically determines optimal search strategy
🗄️ Multi-Database RAG - Query multiple databases simultaneously with natural language
📄 Multi-Modal Intelligence - PDF, Word, Excel, Images (OCR), Audio (Speech-to-Text), and more
🔌 MCP Client Integration - Connect to external MCP servers and extend capabilities with external tools
📁 Automatic File Watching - Monitor folders and automatically index new documents without manual uploads
🧩 Modular Architecture - Strategy Pattern for SQL dialects, scoring, and file parsing
🏠 100% Local Processing - GDPR, KVKK, HIPAA compliant
🚀 Production Ready - Enterprise-grade, thread-safe, high performance
🎯 Real-World Use Cases
1. Banking - Customer Financial Profile
var answer = await searchService.QueryIntelligenceAsync(
"Which customers have overdue payments and what's their total outstanding balance?"
);
// → Queries Customer DB, Payment DB, Account DB and combines results
// → Provides comprehensive financial risk assessment for credit decisions
2. Healthcare - Patient Care Management
var answer = await searchService.QueryIntelligenceAsync(
"Show me all patients with diabetes who haven't had their HbA1c checked in 6 months"
);
// → Combines Patient DB, Lab Results DB, Appointment DB and identifies at-risk patients
// → Ensures preventive care compliance and reduces complications
3. Inventory - Supply Chain Optimization
var answer = await searchService.QueryIntelligenceAsync(
"Which products are running low on stock and which suppliers can restock them fastest?"
);
// → Analyzes Inventory DB, Supplier DB, Order History DB and provides restocking recommendations
// → Prevents stockouts and optimizes supply chain efficiency
🚀 What Makes SmartRAG Special?
- Native multi-database RAG capabilities for .NET
- Automatic schema detection across different database types
- 100% local processing with Ollama and Whisper.net
- Enterprise-ready with comprehensive error handling and logging
- Cross-database queries without manual SQL writing
- Multi-modal intelligence combining documents, databases, and AI
- MCP Client integration for extending capabilities with external tools
- Automatic file watching for real-time document indexing
🧪 Examples & Testing
SmartRAG provides comprehensive example applications for different use cases:
📁 Available Examples
examples/
├── SmartRAG.API/ # Complete REST API with Swagger UI
└── SmartRAG.Demo/ # Interactive console application
🚀 Quick Test with Demo
Want to see SmartRAG in action immediately? Try our interactive console demo:
# Clone and run the demo
git clone https://github.com/byerlikaya/SmartRAG.git
cd SmartRAG/examples/SmartRAG.Demo
dotnet run
Prerequisites: You need to have databases and AI services running locally, or use Docker for easy setup.
📖 SmartRAG.Demo README - Complete demo application guide and setup instructions
🐳 Docker Setup (Recommended)
For the easiest experience with all services pre-configured:
# Start all services (SQL Server, MySQL, PostgreSQL, Ollama, Qdrant, Redis)
docker-









