Multi-Modal RAG for .NET β query databases, documents, images & audio in natural language
dotnet add package SmartRAG// 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
);{
"SmartRAG": {
"DatabaseConnections": [
{
"Name": "Sales",
"ConnectionString": "Server=localhost;Database=Sales;...",
"DatabaseType": "SqlServer"
}
]
}
}// 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{
"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
π― 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
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 decisionsvar 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 complicationsvar 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- 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
SmartRAG provides comprehensive example applications for different use cases:
examples/
βββ SmartRAG.API/ # Complete REST API with Swagger UI
βββ SmartRAG.Demo/ # Interactive console application
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 runPrerequisites: 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
For the easiest experience with all services pre-configured:
# Start all services (SQL Server, MySQL, PostgreSQL, Ollama, Qdrant, Redis)
docker-compose up -d
# Setup AI models
docker exec -it smartrag-ollama ollama pull llama3.2
docker exec -it smartrag-ollama ollama pull nomic-embed-textπ Complete Docker Setup Guide - Detailed Docker configuration, troubleshooting, and management
π Database Management:
- Step 1-2: Show connections & health check
- Step 3-5: Create test databases (SQL Server, MySQL, PostgreSQL)
- Step 6: Create SQLite test database
- Step 7: View database schemas and relationships
π€ AI & Query Testing:
- Step 8: Query analysis - see how natural language converts to SQL
- Step 9: Automatic test queries - pre-built scenarios
- Step 10: Multi-database AI queries - ask questions across all databases
π Local AI Setup:
- Step 11: Setup Ollama models for 100% local processing
- Step 12: Test vector stores (InMemory, FileSystem, Redis, SQLite, Qdrant)
π Document Processing:
- Step 13: Upload documents (PDF, Word, Excel, Images, Audio)
- Step 14: List and manage uploaded documents
- Step 15: Clear documents for fresh testing
- Step 16: Conversational Assistant - combine databases + documents + chat
- Step 17: MCP Integration - list tools and run MCP queries
π File Watcher:
- Automatic folder monitoring for new documents
- Real-time document indexing
- Duplicate detection and prevention
Perfect for: Quick evaluation, proof-of-concept, team demos, learning SmartRAG capabilities
π Complete Examples & Testing Guide - Step-by-step tutorials and test scenarios
π Databases: SQL Server, MySQL, PostgreSQL, SQLite
π Documents: PDF, Word, Excel, PowerPoint, Images, Audio
π€ AI Models: OpenAI, Anthropic, Gemini, Azure OpenAI, Ollama (local), LM Studio
ποΈ Vector Stores: Qdrant, Redis, InMemory
π¬ Conversation Storage: Redis, SQLite, FileSystem, InMemory (independent from document storage)
π External Integrations: MCP (Model Context Protocol) servers for extended tool capabilities
π File Monitoring: Automatic folder watching with real-time document indexing
This project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ by BarΔ±Ε Yerlikaya