SmartRAG 3.1.0

dotnet add package SmartRAG --version 3.1.0
                    
NuGet\Install-Package SmartRAG -Version 3.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SmartRAG" Version="3.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmartRAG" Version="3.1.0" />
                    
Directory.Packages.props
<PackageReference Include="SmartRAG" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SmartRAG --version 3.1.0
                    
#r "nuget: SmartRAG, 3.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SmartRAG@3.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SmartRAG&version=3.1.0
                    
Install as a Cake Addin
#tool nuget:?package=SmartRAG&version=3.1.0
                    
Install as a Cake Tool

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

Feedback

License

MIT License - see LICENSE for details.

Built with ❤️ by Barış Yerlikaya

Made in Turkey 🇹🇷 | Contact | LinkedIn | Website

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1.0 290 11/13/2025
3.0.3 338 11/6/2025
3.0.2 307 10/23/2025
3.0.1 373 10/22/2025
3.0.0 364 10/22/2025
2.3.1 226 10/8/2025
2.3.0 349 9/16/2025
2.2.0 384 9/15/2025
2.1.0 154 9/5/2025
2.0.0 315 8/27/2025
1.1.0 171 8/22/2025
1.0.3 187 8/20/2025
1.0.2 190 8/19/2025
1.0.1 159 8/17/2025
1.0.0 118 8/15/2025

Release 3.1.0: Unified Query Intelligence (MINOR Release)

UNIFIED QUERY INTELLIGENCE (NEW FEATURES):
- QueryIntelligenceAsync now supports unified search across databases, documents, images (OCR), and audio (transcription) in a single query
- Smart Hybrid Routing: AI-based intent detection with confidence scoring automatically determines optimal search strategy
- New Service Architecture: QueryIntentAnalyzer, DatabaseQueryExecutor, ResultMerger, SQLQueryGenerator services for modular design
- QueryStrategy Enum: New enum for query execution strategies (DatabaseOnly, DocumentOnly, Hybrid)
- Parallel Query Execution: Multi-database queries execute in parallel for better performance
- Intelligent Result Merging: AI-powered merging of results from multiple databases
- Intelligent query routing with graceful degradation and fallback mechanisms

CODE QUALITY IMPROVEMENTS:
- Achieved 0 errors, 0 warnings across all projects
- Improved code standards compliance

AI PROMPT OPTIMIZATION:
- Reduced emoji usage in AI prompts from 235 to 5 (only critical emojis)
- Improved token efficiency (~100 tokens saved per prompt)
- Better AI comprehension through strategic emoji usage

BENEFITS:
- Single query interface for all data sources (databases, documents, images, audio)
- Intelligent routing automatically selects best search strategy
- Cleaner codebase with zero warnings
- More efficient AI prompt processing
- Better maintainability and code quality

This release introduces unified query intelligence and focuses on code quality improvements for better performance and maintainability.