SmartRAG 3.2.0
See the version list below for details.
dotnet add package SmartRAG --version 3.2.0
NuGet\Install-Package SmartRAG -Version 3.2.0
<PackageReference Include="SmartRAG" Version="3.2.0" />
<PackageVersion Include="SmartRAG" Version="3.2.0" />
<PackageReference Include="SmartRAG" />
paket add SmartRAG --version 3.2.0
#r "nuget: SmartRAG, 3.2.0"
#:package SmartRAG@3.2.0
#addin nuget:?package=SmartRAG&version=3.2.0
#tool nuget:?package=SmartRAG&version=3.2.0
SmartRAG
Multi-Database RAG Library for .NET
Ask questions about your data in natural language
Description
SmartRAG is a comprehensive Retrieval-Augmented Generation (RAG) library that enables you to query multiple databases, documents, images, and audio files using natural language. Transform your data into intelligent conversations with a single, unified API.
Key Capabilities
- Multi-Database RAG - Query SQL Server, MySQL, PostgreSQL, SQLite together
- Multi-Modal Intelligence - PDF, Word, Excel, Images (OCR), Audio (Whisper.net)
- On-Premise Ready - 100% local with Ollama, LM Studio, Whisper.net
- Conversation History - Built-in automatic context management
- Universal AI Support - OpenAI, Anthropic, Gemini, Azure, Custom APIs
- Enterprise Storage - Qdrant, Redis, SQLite, FileSystem, In-Memory
Getting Started
Prerequisites
- .NET Standard 2.1 or higher
- AI Provider API key (OpenAI, Anthropic, etc.) or local AI setup (Ollama)
- Database connections (SQL Server, MySQL, PostgreSQL, SQLite)
Installation
dotnet add package SmartRAG
Basic Setup
// Program.cs
builder.Services.AddSmartRAG(builder.Configuration);
Configuration
Add database connections to your appsettings.json:
{
"SmartRAG": {
"DatabaseConnections": [
{
"Name": "Sales",
"ConnectionString": "Server=localhost;Database=Sales;...",
"DatabaseType": "SqlServer"
}
]
}
}
Usage
Upload Documents
// Upload document
var document = await documentService.UploadDocumentAsync(
fileStream, fileName, contentType, "user-123"
);
Query Across Multiple Data Sources
// Query across databases and documents
var response = await documentSearchService.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 queries SQL Server (orders), MySQL (payments), PostgreSQL (customer data),
// analyzes uploaded PDF contracts, OCR-scanned invoices, and transcribed call recordings
Multi-Database Queries
// Direct multi-database query coordination
var multiDbResponse = await multiDbCoordinator.QueryMultipleDatabasesAsync(
"Calculate total revenue by customer across all databases",
maxResults: 10
);
// → AI analyzes query intent, generates SQL for each database,
// executes queries, and merges results intelligently
Real-World Use Cases
Banking - Customer Financial Profile
var answer = await documentSearchService.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
Healthcare - Patient Care Management
var answer = await documentSearchService.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
Inventory - Supply Chain Optimization
var answer = await documentSearchService.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?
- Only .NET library with native multi-database RAG capabilities
- 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
Supported Data Sources
Databases: SQL Server, MySQL, PostgreSQL, SQLite
Documents: PDF, Word, Excel, PowerPoint, Images, Audio
AI Models: OpenAI, Anthropic, Ollama (local), LM Studio
Vector Stores: Qdrant, Redis, SQLite, InMemory
Comparison with Other RAG Libraries
| Feature | SmartRAG | LM-Kit.NET | Semantic Kernel | LangChain.NET |
|---|---|---|---|---|
| Library Owner | Barış Yerlikaya | LM-Kit (France) | Microsoft | LangChain Community |
| Description | Multi-database RAG library for .NET | Generative AI SDK for .NET applications | AI orchestration framework | .NET port of LangChain framework |
| RAG Support | ✅ | ✅ | ✅ | ✅ |
| Memory Management | ✅ | ✅ | ✅ | ✅ |
| Vector Stores | ✅ | ✅ | ✅ | ✅ |
| AI Model Integration | ✅ | ✅ | ✅ | ✅ |
| Plugin/Extension System | ✅ | ✅ | ✅ | ✅ |
| Multi-Modal | ✅ | ✅ | ❌ | ❌ |
| Local AI | ✅ | ✅ | ❌ | ❌ |
| Audio | ✅ | ✅ | ❌ | ❌ |
| OCR | ✅ | ✅ | ❌ | ❌ |
| On-Premise | ✅ | ✅ | ❌ | ❌ |
| Fallback Providers* | ✅ | ❌ | ❌ | ❌ |
| Retry Policies* | ✅ | ❌ | ❌ | ❌ |
| Batch Embeddings* | ✅ | ❌ | ❌ | ❌ |
| Hybrid Search* | ✅ | ❌ | ❌ | ❌ |
| Session Management* | ✅ | ❌ | ❌ | ❌ |
| Cross-DB JOIN* | ✅ | ❌ | ❌ | ❌ |
| Multi-DB RAG* | ✅ | ❌ | ❌ | ❌ |
| Databases* | ✅ | ❌ | ❌ | ❌ |
SmartRAG Exclusive Features (*):
- Fallback Providers: Automatic failover to backup AI providers when primary fails
- Retry Policies: Configurable retry with FixedDelay, LinearBackoff, ExponentialBackoff
- Batch Embeddings: Efficient batch processing for multiple texts simultaneously
- Hybrid Search: Semantic + keyword hybrid algorithm (80% semantic, 20% keyword)
- Session Management: Persistent conversation continuity across app restarts
- Cross-DB JOIN: AI-powered intelligent joins across different databases
- Multi-DB RAG: Native multi-database query coordination
- Databases: Native support for SQL Server, MySQL, PostgreSQL, SQLite
Additional Documentation
- Complete Documentation - https://byerlikaya.github.io/SmartRAG/en/ - Comprehensive guides, API reference, and tutorials
- GitHub Repository - https://github.com/byerlikaya/SmartRAG - Source code, examples, and community
- Live Examples - https://byerlikaya.github.io/SmartRAG/en/examples - Real-world usage scenarios
- API Reference - https://byerlikaya.github.io/SmartRAG/en/api-reference - Complete API documentation
- Changelog - https://github.com/byerlikaya/SmartRAG/blob/main/CHANGELOG.md - Version history and updates
Feedback
- Email Support - b.yerlikaya@outlook.com
- LinkedIn - https://www.linkedin.com/in/barisyerlikaya/
- GitHub Issues - https://github.com/byerlikaya/SmartRAG/issues
- Website - https://byerlikaya.github.io/SmartRAG/en/
License
MIT License - see LICENSE for details.
Built with ❤️ by Barış Yerlikaya
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- DocumentFormat.OpenXml (>= 3.3.0)
- EPPlus (>= 8.2.1)
- FFMpegCore (>= 5.4.0)
- itext (>= 9.4.0)
- Microsoft.Data.SqlClient (>= 6.1.3)
- Microsoft.Data.Sqlite (>= 9.0.10)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Caching.Memory (>= 9.0.10)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Http (>= 9.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.10)
- MySql.Data (>= 9.5.0)
- Npgsql (>= 8.0.8)
- Qdrant.Client (>= 1.15.1)
- SkiaSharp (>= 3.119.1)
- StackExchange.Redis (>= 2.10.1)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Text.Json (>= 9.0.10)
- Tesseract (>= 5.2.0)
- Whisper.net (>= 1.8.1)
- Xabe.FFmpeg.Downloader (>= 6.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.3.0 | 720 | 12/1/2025 |
| 3.2.0 | 329 | 11/27/2025 |
| 3.1.0 | 317 | 11/13/2025 |
| 3.0.3 | 422 | 11/6/2025 |
| 3.0.2 | 309 | 10/23/2025 |
| 3.0.1 | 377 | 10/22/2025 |
| 3.0.0 | 367 | 10/22/2025 |
| 2.3.1 | 229 | 10/8/2025 |
| 2.3.0 | 351 | 9/16/2025 |
| 2.2.0 | 387 | 9/15/2025 |
| 2.1.0 | 155 | 9/5/2025 |
| 2.0.0 | 317 | 8/27/2025 |
| 1.1.0 | 174 | 8/22/2025 |
| 1.0.3 | 189 | 8/20/2025 |
| 1.0.2 | 192 | 8/19/2025 |
| 1.0.1 | 163 | 8/17/2025 |
| 1.0.0 | 124 | 8/15/2025 |
Release 3.2.0: Architectural Refactoring & Modular Design (MINOR Release - 2025-11-27)
ARCHITECTURAL REFACTORING:
- Strategy Pattern Implementation: ISqlDialectStrategy, IScoringStrategy, IFileParser
- Repository Layer Separation: IConversationRepository separated from IDocumentRepository
- Service Layer Refactoring: AI, Database, Search, Parser, and Support services decomposed
- Model Consolidation: DatabaseSchema and DatabaseSchemaInfo unified
NEW FEATURES:
- SearchOptions: Per-request search configuration with flag-based filtering (-db, -d, -a, -i)
- FeatureToggles: Global feature flag configuration
- ContextExpansionService: Adjacent chunk context expansion
- FileParserResult: Standardized parser result structure
- DatabaseFileParser: SQLite database file parsing support
- Native Library Inclusion: Tesseract OCR native libraries bundled (Windows, macOS, Linux)
- Nullable Reference Types: Enhanced null safety across 14+ files
- ClearAllAsync Methods: Efficient bulk deletion operations
- Collection Management: Enhanced Qdrant collection operations
- Tesseract On-Demand Language Data: Automatic language support (30+ languages)
- Currency Symbol Correction: Improved OCR accuracy for financial documents
- Parallel Batch Processing: Ollama embeddings performance optimization
- Query Tokens Parameter: Pre-computed token support for performance
- Native Qdrant Text Search: Token-based filtering for improved search performance
IMPROVEMENTS:
- Language-Agnostic Code: Removed domain-specific and language-specific references
- Unicode Normalization: Better text retrieval across all languages
- PDF OCR Encoding: Automatic fallback handling
- Numbered List Detection: Improved counting query accuracy
- RAG Scoring: Enhanced relevance calculation with unique keyword bonus
- Document Search: Adaptive threshold and chunk prioritization
- Prompt Builder: Enhanced AI answer generation
- Qdrant Performance: Optimized GetAllAsync implementation
FIXES:
- Table Alias Enforcement: Prevents ambiguous column errors in SQL generation
- EnableDatabaseSearch Config: Proper feature flag handling
- macOS Native Libraries: OCR library inclusion and DYLD_LIBRARY_PATH configuration
- Missing Method Signature: DocumentSearchService restoration
CODE QUALITY:
- Maintained 0 errors, 0 warnings
- Full SOLID compliance
- Improved testability and extensibility
- Language-agnostic codebase
This release introduces significant architectural improvements and new features while maintaining full backward compatibility.