SmartRAG 3.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SmartRAG --version 3.4.0
                    
NuGet\Install-Package SmartRAG -Version 3.4.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.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmartRAG" Version="3.4.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.4.0
                    
#r "nuget: SmartRAG, 3.4.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.4.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.4.0
                    
Install as a Cake Addin
#tool nuget:?package=SmartRAG&version=3.4.0
                    
Install as a Cake Tool

SmartRAG

Multi-Database RAG Library for .NET
Ask questions about your data in natural language

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.

🚀 Quick Start

Installation

dotnet add package SmartRAG

Basic 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
);

Configuration

Add database connections to your appsettings.json:

{
  "SmartRAG": {
    "DatabaseConnections": [
      {
        "Name": "Sales",
        "ConnectionString": "Server=localhost;Database=Sales;...",
        "DatabaseType": "SqlServer"
      }
    ]
  }
}

Usage Example

// 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

✨ Key Features

🎯 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
🏠 100% Local Processing - GDPR, KVKK, HIPAA compliant with Ollama and Whisper.net
🚀 Production Ready - Enterprise-grade, thread-safe, high performance

📊 Supported Data Sources

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

🎯 Real-World Use Cases

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

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

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

📚 Additional Resources

📞 Support

📄 License

This project is licensed under the MIT License - see the LICENSE file 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
4.0.1 96 3/9/2026
4.0.0 95 3/2/2026
3.9.0 178 2/5/2026
3.8.1 201 1/28/2026
3.8.0 240 1/26/2026
3.7.0 185 1/19/2026
3.6.0 241 12/30/2025
3.5.0 251 12/26/2025
3.4.0 261 12/11/2025
3.3.0 808 12/1/2025
3.2.0 413 11/27/2025
3.1.0 359 11/13/2025
3.0.3 456 11/6/2025
3.0.2 347 10/23/2025
3.0.1 420 10/22/2025
3.0.0 402 10/22/2025
2.3.1 267 10/8/2025
2.3.0 388 9/16/2025
2.2.0 423 9/15/2025
2.1.0 187 9/5/2025
Loading failed

Release 3.4.0: MCP Integration & Enhanced Search Capabilities (MINOR Release - 2025-12-12)

NEW FEATURES:
- MCP (Model Context Protocol) Integration: External MCP server integration for enhanced search capabilities
- File Watcher Service: Automatic document indexing from watched folders with real-time updates
- DocumentType Property: Enhanced document chunk filtering by content type (Document, Audio, Image)
- DefaultLanguage Support: Global default language configuration for document processing
- Enhanced Search Feature Flags: Granular control over MCP, audio, and image search capabilities
- Early Exit Optimization: Performance improvement with parallel execution of document search and query intent analysis, smart skip logic for eager document answer generation
- IsExplicitlyNegative Check: Fast-fail mechanism for negative answers with [NO_ANSWER_FOUND] pattern support
- SmartRagStartupService: Centralized startup service for automatic initialization

IMPROVEMENTS:
- Query Strategy Optimization: Enhanced query execution strategy with intelligent source selection and improved early exit logic using StrongDocumentMatchThreshold
- Code Quality: Comprehensive code cleanup, removed redundant comments and language-specific references
- Model Organization: Reorganized models into logical subfolders (Configuration, RequestResponse, Results, Schema)
- Dependency Injection: Improved DI patterns and error handling
- Image Parsing: Enhanced context expansion and error handling for image processing
- Database Query Error Handling: Better error messages and response validation
- Missing Data Detection: Language-agnostic missing data detection patterns

FIXES:
- Language-Agnostic Missing Data Detection: Fixed language-specific patterns, now works with all languages
- HttpClient Timeout: Increased timeout to 10 minutes for long-running AI operations
- Turkish Character Encoding: Fixed encoding issues in PDF text extraction
- Chunk0 Retrieval: Fixed numbered list processing chunk retrieval
- DI Scope Issues: Resolved dependency injection scope conflicts and circular dependencies
- Content Type Detection: Improved content type detection accuracy

CHANGED:
- Feature Flag Naming: Renamed EnableMcpClient→EnableMcpSearch, EnableAudioParsing→EnableAudioSearch, EnableImageParsing→EnableImageSearch
- Interface Restructuring: Reorganized interfaces into Mcp/ and FileWatcher/ folders

CODE QUALITY:
- Maintained 0 errors, 0 warnings
- Comprehensive code cleanup and organization
- Improved maintainability and readability

This release adds MCP integration, file watcher service, and enhanced search capabilities while maintaining full backward compatibility.