Rapid.Agentic.AI.Framework
2.1.2
See the version list below for details.
dotnet add package Rapid.Agentic.AI.Framework --version 2.1.2
NuGet\Install-Package Rapid.Agentic.AI.Framework -Version 2.1.2
<PackageReference Include="Rapid.Agentic.AI.Framework" Version="2.1.2" />
<PackageVersion Include="Rapid.Agentic.AI.Framework" Version="2.1.2" />
<PackageReference Include="Rapid.Agentic.AI.Framework" />
paket add Rapid.Agentic.AI.Framework --version 2.1.2
#r "nuget: Rapid.Agentic.AI.Framework, 2.1.2"
#:package Rapid.Agentic.AI.Framework@2.1.2
#addin nuget:?package=Rapid.Agentic.AI.Framework&version=2.1.2
#tool nuget:?package=Rapid.Agentic.AI.Framework&version=2.1.2
Rapid.Agentic.AI.Framework
Rapid.Agentic.AI.Framework is a lightweight .NET library that simplifies integration with Retrieval-Augmented Generation (RAG) systems and Ollama LLMs. It provides intuitive gateway interfaces for building intelligent applications that can chat, generate content, and ingest domain-specific documents such as PDFs.
Say goodbye to API limits and monthly bills. Run a powerful local AI that browses, codes, and thinks.
โจ Features
- ๐ค Ollama Integration: Send prompts and receive completions from local or remote Ollama servers.
- ๐ Document Ingestion: Upload and convert PDFs into vectorized knowledge for retrieval.
- ๐ง RAG-Powered Answers: Ask questions based on your custom data (uploaded documents).
- ๐งผ Stateful & Stateless Chat: Clearable chat histories to manage conversational memory.
๐ RAG Gateway (IRagGateway
)
- Upload and process PDF documents
- Query domain-specific knowledge with context
- Generate answers and summaries
- Statefull and Stateless by default, with optional history reset
๐ค Ollama Gateway (IOllamaGateway
)
- Lightweight prompt-based chat and content generation
- Statefull and Stateless by default, with optional history reset
๐งช Use Cases
- RAG-enabled customer support systems
- AI-driven PDF analysis tools
- Developer tools for querying technical documentation
- AI assistants embedded in enterprise software
๐ฆ Installation
Install from NuGet.org:
dotnet add package Rapid.Agentic.AI.Framework
Or via Package Manager Console:
Install-Package Rapid.Agentic.AI.Framework
๐ Getting Started
๐ฆ Prerequisites
- .NET 6 or later
- Ollama running locally (default port
http://localhost:11434
) - A downloaded model (e.g.,
llama3
,llama3.2:1b
, etc.)
๐งฑ Example Model Names
- llama3
- llama3.2:1b
- codegemma:2b
- mistral
๐ Quick Recommendation Table for LLM Models in Ollama
Model | Speed | Quality | Context Length | Notes |
---|---|---|---|---|
llama3:8b | ๐ข Fast | ๐ข Great | 8K tokens | Balanced for quality and speed |
llama3:70b | ๐ด Slow | ๐ข Excellent | 8K tokens | High quality but very resource intensive |
mistral | ๐ข Very Fast | ๐ก Good | 4K tokens | Lightweight, good for quick answers and small tasks |
mixtral | ๐ก Medium | ๐ข Great | 32K tokens | Good quality, Mixture of Experts model |
gemma:7b | ๐ข Fast | ๐ก Decent | 8K tokens | Smaller, open model from Google |
dolphin-mistral | ๐ก Medium | ๐ข Tuned | 4K tokens | Fine-tuned for chat and reasoning |
codellama:7b | ๐ก Medium | ๐ก OK | 4K tokens | Best for code understanding and generation |
phi:2 | ๐ข Very Fast | ๐ก Average | 2K tokens | Extremely small, best for tiny apps/devices |
๐งฑ Example Embedding Model Names
- nomic-embed-text โ for general-purpose RAG
- gte-small โ if you want faster inference with slightly lower quality
- bge-base-en โ for rich English text documents
๐ Quick Recommendation Table for Embedding Models in Ollama
Model | Vector Dim | Speed | Quality | Notes |
---|---|---|---|---|
nomic-embed-text | 768 | ๐ข Fast | ๐ข Great | Best for most use cases |
gte-small | 384 | ๐ข Very Fast | ๐ก Good | Great for constrained setups |
gte-large | 1024 | ๐ก Medium | ๐ข Excellent | Needs more compute |
bge-base-en | 768 | ๐ข Fast | ๐ข Great | Excellent for English text |
all-MiniLM-L6-v2 | 384 | ๐ข Fast | ๐ก Good | Low-resource, reliable choice |
Any other model available through Ollama
Ensure the model is already pulled by running:
ollama run llama3.2:1b
โจ Document Format Support. Following document formats are supported
- Microsoft Word (.docx) files
- HTML files
- Markdown files
- PDF files
- c# solution files (.sln). Along with .sln file, all .csproj (C# project) files referenced in the solution and all .cs files referenced in the projects are also processed.
- c# project files (.csproj). Along with .csproj file, all .cs files referenced in the project are also processed.
- C# source code files (.cs)
- .bat files
- .txt files
All above formats can be processed for RAG (Retrieval-Augmented Generation) vector database generation using following API
๐งช Usage
๐ญ Factory Class
public interface IAgenticClientFactory
{
IRagGateway CreateRagGateway(string ollamaUrl, string model, string embeddingModel, string dbPath = "rag.db");
IOllamaGateway CreateOllamaGateway(string ollamaUrl, string model);
}
๐ 1. RAG Gateway
public interface IRagGateway
{
Task<string> ChatAsync(string question);
void ClearChatHistory();
Task<string> GenerateAsync(string question, bool enableStreaming);
Task UploadFileAsync(string pdfPath);
}
โจ 1. Content generation example - Summarizing a PDF document
var factory = new AgenticClientFactory();
var rag = factory.CreateRagGateway("http://localhost:11434", "llama3", "nomic-embed-text");
await rag.UploadFileAsync("documents/manual.pdf");
string summary = await rag.GenerateAsync("Summarize the manual.", enableStreaming: false);
Console.WriteLine(summary);
โจ 2. Content generation example - Reviewing c# source code
var factory = new AgenticClientFactory();
var rag = factory.CreateRagGateway("http://localhost:11434", "llama3");
await rag.UploadFileAsync("documents/MyAlgorithm.cs");
string summary = await rag.GenerateAsync("Review the cs file", enableStreaming: false);
Console.WriteLine(summary);
โจ 3. Content generation example - without uploading local file
var factory = new AgenticClientFactory();
var rag = factory.CreateRagGateway("http://localhost:11434", "llama3");
string summary = await rag.GenerateAsync("What are the best tourist places in Bangalore", enableStreaming: false);
Console.WriteLine(summary);
โจ 4. Chat example (Multi-Turn) - Reviewing c# source code and asking for fix
var factory = new AgenticClientFactory();
var rag = factory.CreateRagGateway("http://localhost:11434", "llama3");
await rag.UploadFileAsync("MyApplication/MyAlgorithm.cs");
string summary = await rag.ChatAsync("Review the cs file", enableStreaming: false);
Console.WriteLine(summary);
string modifiedsummary = await rag.ChatAsync("Provide me top review comments with potential fix", enableStreaming: false);
Console.WriteLine(modifiedsummary);
๐ 5. To Clear Chat History:
rag.ClearChatHistory();
โจ 6. Automatically uploading of c# .cs files from given .csproj or .sln files
Automatically identifies and uploads and generates vector database for RAG:
- All .csproj and .cs files from a given .sln (solution) file and .sln file itesf
- All .cs files referenced in each .csproj (C# project) file.
// Uploads all the .csproj files and .cs files belonging to this .sln file and .sln file itself
await rag.UploadFileAsync("MyApplication/MyAlgorithm.sln");
๐ค 2. IOllamaGateway
public interface IOllamaGateway
{
string ChatAsync(string prompt, string model = "");
void ClearChatHistory();
string GenerateAsync(string prompt, string model = "");
}
โจ 1. Chat Usage example with Context (Multi-Turn)
var factory = new AgenticClientFactory();
var ollama = factory.CreateOllamaGateway(ollamaUrl, myModel);
string response = ollama.ChatAsync("Tell me about India?");
Console.WriteLine(response);
string responseUpdated = ollama.ChatAsync("What are the best tourist places?");
Console.WriteLine(responseUpdated);
ollama.ClearChatHistory();
โจ 2. Content generation Usage example
var factory = new AgenticClientFactory();
var ollama = factory.CreateOllamaGateway(ollamaUrl, myModel);
string response = ollama.GenerateAsync("Tell me about India?");
Console.WriteLine(response);
๐ 3. To Clear Chat History:
OllamaClient.ClearChatHistory();
๐ License
The Core Framework is not open-source, but is freely distributed via NuGet.
For commercial use, licensing, or integration support:
๐ง aruna.devadiga@gmail.com
๐ Support & Contributions
This framework is not open source, but it is freely distributed via NuGet. If you encounter issues, bugs, or have suggestions, feel free to reach out to the maintainers or submit feedback via the appropriate support channels.
๐ง aruna.devadiga@gmail.com
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- DocumentFormat.OpenXml (>= 3.3.0)
- HtmlAgilityPack (>= 1.12.1)
- Markdig (>= 0.41.1)
- Microsoft.Data.Sqlite (>= 9.0.5)
- PdfPig (>= 0.1.10)
- SharpToken (>= 2.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
New Feature: Extended Document Format Support
- Added support for additional document formats including:
- Microsoft Word (.docx) files
- HTML files
- Markdown files
- PDF files
- c# solution files (.sln). Along with .sln file, all .csproj (C# project) files referenced in the solution and all .cs files referenced in the projects are also processed.
- c# project files (.csproj). Along with .csproj file, all .cs files referenced in the project are also processed.
- C# source code files (.cs)
- .bat files
- .txt files
- All these formats can be processed for RAG (Retrieval-Augmented Generation) vector database generation.
Improvements (also check readme file)
- Improved RAG vector database generation
- Improved Sentence Tokenizer
- Improved Context Search
Bug Fixes
- Fixed wrong model usage in generating string embedding for storing.
Automatically uploading of c# .cs files from given .csproj or .sln files
- Automatically identifies and uploads then generates vector database for RAG:
- All .csproj and .cs files from a given .sln (solution) file and .sln file itesf
- All .cs files referenced in each .csproj (C# project) file.