VOOZH about

URL: https://www.nuget.org/packages/FonsecaFramework.Ai/

⇱ NuGet Gallery | FonsecaFramework.Ai 2026.6.18.1




FonsecaFramework.Ai 2026.6.18.1

dotnet add package FonsecaFramework.Ai --version 2026.6.18.1
 
 
NuGet\Install-Package FonsecaFramework.Ai -Version 2026.6.18.1
 
 
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="FonsecaFramework.Ai" Version="2026.6.18.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FonsecaFramework.Ai" Version="2026.6.18.1" />
 
Directory.Packages.props
<PackageReference Include="FonsecaFramework.Ai" />
 
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 FonsecaFramework.Ai --version 2026.6.18.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FonsecaFramework.Ai, 2026.6.18.1"
 
 
#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 FonsecaFramework.Ai@2026.6.18.1
 
 
#: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=FonsecaFramework.Ai&version=2026.6.18.1
 
Install as a Cake Addin
#tool nuget:?package=FonsecaFramework.Ai&version=2026.6.18.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

FonsecaFramework.Ai

AI and machine learning utilities for .NET applications.

Overview

FonsecaFramework.Ai is a .NET 9 library that provides tools for building ML models with AutoML, performing sentiment/discourse analysis, implementing RAG (Retrieval-Augmented Generation) vector stores, and integrating with LLM providers via the Microsoft.Extensions.AI abstraction. It wraps ML.NET and ONNX Runtime to offer a streamlined API for training, predicting, and exporting models.

Installation

dotnet add package FonsecaFramework.Ai

Features

Area Key Classes
AutoML Model Building AiModelBuilder<T> — build regression, classification, ranking, and recommendation models with ML.NET AutoML
Trained Model AiModel<T, TMetrics> — make predictions and export to ONNX format
RAG Vector Store RagVectorStore — chunk documents, build TF-IDF + discourse vectors, and retrieve context for LLM prompts
Agent Framework RAG Bridge RagVectorStore.CreateTextSearchProvider(...) — expose store retrieval through Microsoft.Agents.AI.TextSearchProvider
RAG Snapshots RagVectorStoreSnapshot — serialize/deserialize a vector store to avoid re-processing documents
Sentiment Analysis ISentimentAnalyzer — 10-element discourse vector interface
LexiconSentimentAnalyzer — fast, deterministic, lexicon-based analyzer (no external service required)
OllamaSentimentAnalyzer — LLM-powered analyzer via IChatClient with lexicon fallback
LLM Chat Client VLRChatClientIChatClient implementation for OpenAI-compatible endpoints (e.g. Ollama) with streaming support

Examples

Build and Use a Regression Model

using FonsecaFramework.Ai;

var data = new List<HouseData>
{
 new() { Size = 1000, Price = 200_000 },
 new() { Size = 1500, Price = 300_000 },
 new() { Size = 2000, Price = 400_000 },
 // ... more training data
};

var builder = new AiModelBuilder<HouseData>(data, nameof(HouseData.Price));

var model = builder.BuildRegressionModel(
 MaxExperimentTimeInSeconds: 30);

float prediction = model.Predict(new HouseData { Size = 1750 });
Console.WriteLine($"Predicted price: {prediction:C}");

// Export to ONNX
await model.ConvertToOnnx("house-model.onnx");

Build a Binary Classification Model

using FonsecaFramework.Ai;

var data = new List<EmailData>
{
 new() { Subject = "Free money!", Body = "Click here now", IsSpam = true },
 new() { Subject = "Meeting tomorrow", Body = "See you at 3pm", IsSpam = false },
 // ... more training data
};

var builder = new AiModelBuilder<EmailData>(data, nameof(EmailData.IsSpam));
var model = builder.BuildBinaryClassificationModel(MaxExperimentTimeInSeconds: 60);

float score = model.Predict(new EmailData { Subject = "You won!", Body = "Claim prize" });
Console.WriteLine($"Spam score: {score}");

RAG Vector Store — Build and Query

using FonsecaFramework.Ai;

// Build from a folder of .txt documents
var store = await RagVectorStore.Build(
 sourceFolder: "./docs",
 chunkSize: 512,
 chunkOverlap: 128);

// Augment a user prompt with relevant context
string augmentedPrompt = await store.Lookup(
 prompt: "How do I configure the database?",
 topK: 3);

Console.WriteLine(augmentedPrompt);
// The prompt now includes the most relevant document chunks as context

RAG with LLM-Powered Sentiment Analysis

using FonsecaFramework.Ai;
using FonsecaFramework.Ai.LLM;

// Use Ollama for richer discourse analysis
var chatClient = new VLRChatClient("http://localhost:11434");
var sentimentAnalyzer = new OllamaSentimentAnalyzer(chatClient);

var store = await RagVectorStore.Build(
 sourceFolder: "./docs",
 sentimentAnalyzer: sentimentAnalyzer);

// Filter by discourse category
string result = await store.Lookup(
 prompt: "What safety precautions should I take?",
 topK: 5,
 sentimentFilter: "cautionary");

Agent Framework Integration (TextSearchProvider)

using FonsecaFramework.Ai;
using Microsoft.Agents.AI;

var store = await RagVectorStore.Build("./docs");

// Basic wrapper for Microsoft Agent Framework RAG pattern
var provider = store.CreateTextSearchProvider(
 options: new TextSearchProviderOptions
 {
 SearchTime = TextSearchProviderOptions.TextSearchBehavior.BeforeAIInvoke
 },
 topK: 3,
 minSimilarity: 0.05);

// Optional: direct adapter usage if you need raw search results
var results = await store.SearchTextResultsAsync("refund policy", topK: 3);

Sentiment / Discourse Analysis

using FonsecaFramework.Ai;

var analyzer = new LexiconSentimentAnalyzer();

float[] vector = await analyzer.AnalyzeAsync(
 "Warning: Do not operate the machine without safety equipment.");

// vector is a 10-element array:
// [positive, negative, instructional, technical, cautionary,
// informational, urgency, formality, specificity, actionability]

string category = analyzer.Classify(vector);
Console.WriteLine($"Dominant category: {category}"); // "cautionary"

VLRChatClient — OpenAI-Compatible LLM Integration

using FonsecaFramework.Ai.LLM;
using Microsoft.Extensions.AI;

using var client = new VLRChatClient("http://localhost:11434");

var messages = new[]
{
 new ChatMessage(ChatRole.System, "You are a helpful assistant."),
 new ChatMessage(ChatRole.User, "Explain dependency injection in one paragraph.")
};

var response = await client.GetResponseAsync(messages);
Console.WriteLine(response.Text);

Requirements

  • .NET 9.0
  • For OllamaSentimentAnalyzer / VLRChatClient: an OpenAI-compatible LLM endpoint (e.g. Ollama)

License

Copyright 2025 Steven Fonseca / VLR Creations

Licensed under the . You may use this library free of charge, provided you include the required attribution notices. See the file for full terms.

Product Versions Compatible and additional computed target framework versions.
.NET net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on FonsecaFramework.Ai:

Package Downloads
FonsecaFramework.Asp

Base Classes for Asp.Net Core

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.6.18.1 0 6/18/2026
2026.6.13.1 81 6/13/2026
2026.6.4.2 135 6/4/2026
2026.6.4.1 127 6/4/2026
2026.6.3.3 137 6/4/2026
2026.6.3.2 138 6/4/2026
2026.6.3.1 135 6/3/2026
2026.5.21.1 135 5/22/2026
2026.5.20.1 140 5/20/2026
2026.5.12.1 142 5/13/2026
2026.5.11.1 144 5/11/2026
2026.5.7.2 142 5/7/2026
2026.5.7.1 135 5/7/2026
2026.5.6.1 121 5/6/2026
2026.5.5.1 122 5/5/2026
2026.5.2.1 123 5/2/2026
2026.4.30.1 115 4/30/2026
2026.4.29.1 148 4/29/2026
2026.4.27.1 128 4/28/2026
2026.4.22.1 115 4/22/2026
Loading failed