Thanks to visit codestin.com
Credit goes to github.com

Skip to content

⚑ Production-ready .NET Standard 2.1 RAG library with πŸ€– multi-AI provider support, 🏒 enterprise vector storage, πŸ“„ intelligent document processing, and πŸ—„οΈ multi-database query coordination. 🌍 Cross-platform compatible.

License

Notifications You must be signed in to change notification settings

byerlikaya/SmartRAG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SmartRAG Logo

Multi-Modal RAG for .NET β€” query databases, documents, images & audio in natural language

NuGet Version Downloads GitHub Stars License

Build Status Code Coverage .NET Standard 2.1

Documentation Turkish README

πŸš€ Quick Start

1. Install SmartRAG

dotnet add package SmartRAG

2. Setup

builder.Services.UseSmartRAG(builder.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"
);

// Query across databases and documents
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 queries SQL Server (orders), MySQL (payments), PostgreSQL (customer data), 
//   analyzes uploaded PDF contracts, OCR-scanned invoices, and transcribed call recordings

Want to test SmartRAG immediately? β†’ Jump to Examples & Testing

πŸ† Why SmartRAG?

🎯 Multi-Database RAG - Query multiple databases simultaneously with natural language

🧠 Multi-Modal Intelligence - PDF, Word, Excel, Images, Audio, and more

🏠 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?

  • 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

πŸ§ͺ 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-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

πŸ“‹ Demo Features & Steps:

πŸ”— Database Management:

  • Step 1-2: Show connections & health check
  • Step 3-5: Create test databases (SQL Server, MySQL, PostgreSQL)
  • Step 6: View database schemas and relationships

πŸ€– AI & Query Testing:

  • Step 7: Query analysis - see how natural language converts to SQL
  • Step 8: Automatic test queries - pre-built scenarios
  • Step 9: Multi-database AI queries - ask questions across all databases

🏠 Local AI Setup:

  • Step 10: Setup Ollama models for 100% local processing
  • Step 11: Test vector stores (InMemory, Redis, SQLite, Qdrant)

πŸ“„ Document Processing:

  • Step 12: Upload documents (PDF, Word, Excel, Images, Audio)
  • Step 13: List and manage uploaded documents
  • Step 14: Multi-modal RAG - combine documents + databases
  • Step 15: Clear documents for fresh testing

Perfect for: Quick evaluation, proof-of-concept, team demos, learning SmartRAG capabilities

πŸ“š Complete Examples & Testing Guide - Step-by-step tutorials and test scenarios

🎯 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

πŸ“„ 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

About

⚑ Production-ready .NET Standard 2.1 RAG library with πŸ€– multi-AI provider support, 🏒 enterprise vector storage, πŸ“„ intelligent document processing, and πŸ—„οΈ multi-database query coordination. 🌍 Cross-platform compatible.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Languages