LLMValidation 1.0.0.3
dotnet add package LLMValidation --version 1.0.0.3
NuGet\Install-Package LLMValidation -Version 1.0.0.3
<PackageReference Include="LLMValidation" Version="1.0.0.3" />
<PackageVersion Include="LLMValidation" Version="1.0.0.3" />
<PackageReference Include="LLMValidation" />
paket add LLMValidation --version 1.0.0.3
#r "nuget: LLMValidation, 1.0.0.3"
#:package LLMValidation@1.0.0.3
#addin nuget:?package=LLMValidation&version=1.0.0.3
#tool nuget:?package=LLMValidation&version=1.0.0.3
📚 LLMValidator Documentation
💡 The Vision: AI Made Simple
The creation of Microsoft.Extensions.AI enables a bunch of possibilities to integrate AI packages and bring AI to your code. It makes AI accessible for developers without needing to know infrastructure details or complex setup procedures.
The result? Developers can use the benefits of AI with just one line of code.
LLMValidator brings the power of Large Language Models (LLMs) to your validation workflows. It complements traditional validation by handling scenarios where regex and algorithmic validation fall short - like grammar, tone, meaning, and context.
📖 Documentation
| Getting Started | Integration | Advanced |
|---|---|---|
| 🎯 Quick Start | 🔄 FluentValidation | 🎭 Quality Variants |
| 📝 Prompt Templates | ⚙️ Configuration | 🚀 Performance |
LLMValidator is a .NET library that complements traditional validation by handling scenarios where regex and algorithmic validation fall short - like grammar, tone, meaning, and context.
// Traditional validation - Perfect for format validation
public bool IsValidEmailFormat(string email)
{
var pattern = @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$";
return Regex.IsMatch(email, pattern); // Fast, reliable, offline
}
// LLM validation - For things traditional validation can't handle
var result = await validator.ValidateAsync(emailContent, new LLMValidationOptions
{
ValidationPrompt = "Check if this email is professional and follows business communication standards",
ClientModelName = "gpt-4"
});
// Best practice: Combine both approaches
public async Task<bool> ValidateBusinessEmailAsync(string email, string content)
{
// 1. Format validation first (fast, reliable)
if (!IsValidEmailFormat(email))
return false;
// 2. Content validation with LLM (for nuanced checks)
var contentResult = await validator.ValidateAsync(content, new LLMValidationOptions
{
ValidationPrompt = "Check if this email content is professional and appropriate",
ClientModelName = "gpt-4"
});
return contentResult.IsValid;
}
✨ Key Features
- 🧠 Natural Language Rules: Describe validation in plain English
- ⚡ Quality Variants: Fast/Balanced/Accurate modes for different needs
- 🔄 FluentValidation Integration: Works with existing validation
- 📝 Built-in Templates: Grammar, tone, appropriateness, business content
- 🎯 Multiple Models: OpenAI, Azure, Anthropic, local models
🌟 Why LLMValidator?
Traditional validation (regex, algorithms) is perfect for format/structure validation. LLM validation handles what traditional validation can't: grammar, tone, meaning, context.
Use both together for comprehensive validation.
📦 Installation
dotnet add package LLMValidation
dotnet add package LLMValidation.FluentValidation
dotnet add package Microsoft.Extensions.AI.OpenAI
🚀 Get Started
- Quick Start - 5-minute setup
- Prompt Templates - Available validation templates
- FluentValidation - Integration guide
🏆 Features
Built on Microsoft.Extensions.AI for maximum compatibility and extensibility. See the Configuration Guide for setup details including:
- Multiple LLM Providers: OpenAI, Azure, Anthropic, Ollama, local models
- Distributed Caching: Redis, SQL Server, Memory caching support
- Dependency Injection: Clean resolver pattern, no service locator anti-patterns
- .NET Aspire: Full orchestration support with automatic model setup
- Extensible Architecture: Custom resolvers, validators, and prompt templates
For complete setup instructions, examples, and advanced configuration, see the 📖 Documentation above.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
-
net9.0
- Microsoft.Extensions.AI.Abstractions (>= 9.9.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options (>= 9.0.10)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on LLMValidation:
| Package | Downloads |
|---|---|
|
LLMValidation.FluentValidation
FluentValidation integration for LLMValidation. Enables intelligent string validation with any LLM provider using FluentValidation's fluent API. |
GitHub repositories
This package is not used by any popular GitHub repositories.