Judgy.Xunit 0.1.1

dotnet add package Judgy.Xunit --version 0.1.1
                    
NuGet\Install-Package Judgy.Xunit -Version 0.1.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="Judgy.Xunit" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Judgy.Xunit" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Judgy.Xunit" />
                    
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 Judgy.Xunit --version 0.1.1
                    
#r "nuget: Judgy.Xunit, 0.1.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 Judgy.Xunit@0.1.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=Judgy.Xunit&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Judgy.Xunit&version=0.1.1
                    
Install as a Cake Tool

Judgy

Judgy is a family of .NET libraries for semantic testing of AI and LLM output.

Instead of asserting on exact strings, Judgy lets you evaluate whether generated output satisfies an expectation and then fail with useful semantic evidence.

Current packages target .NET 10.

Providers Are Optional

Judgy.Core defines the provider abstraction used by SemanticEvaluator:

  • Judgy.Providers.ILlmProvider
  • Judgy.Providers.LlmRequest
  • Judgy.Providers.LlmResponse

That means the Judgy.Providers.* packages are optional implementations. You can use the built-in providers for HTTP and common LLM runtimes, or you can implement ILlmProvider yourself if you want to connect Judgy to your own gateway, SDK, wrapper, or in-house model service.

Install the packages you need

Install the core package, add Judgy.Xunit if you want xUnit helpers, and then choose the provider package that matches your model/runtime:

dotnet add package Judgy.Core
dotnet add package Judgy.Xunit

dotnet add package Judgy.Providers.Http
dotnet add package Judgy.Providers.Ollama
dotnet add package Judgy.Providers.OpenAI
dotnet add package Judgy.Providers.Anthropic
dotnet add package Judgy.Providers.Google
dotnet add package Judgy.Providers.AzureOpenAI
dotnet add package Judgy.Providers.Mistral
dotnet add package Judgy.Providers.Moonshot
dotnet add package Judgy.Providers.DeepSeek

If you already have your own LLM integration, you can skip the optional provider packages and implement ILlmProvider directly.

Packages

Package Purpose
Judgy.Core Core evaluation models, provider abstractions, and assertion policy primitives
Judgy.Xunit xUnit assertion helpers such as Assert.JudgyAsync(...)
Judgy.Providers.Http Optional generic HTTP provider for calling text-producing endpoints
Judgy.Providers.Ollama Optional Ollama provider
Judgy.Providers.OpenAI Optional OpenAI provider
Judgy.Providers.Anthropic Optional Anthropic provider
Judgy.Providers.Google Optional Google Gemini provider
Judgy.Providers.AzureOpenAI Optional Azure OpenAI provider
Judgy.Providers.Mistral Optional Mistral provider
Judgy.Providers.Moonshot Optional Moonshot provider
Judgy.Providers.DeepSeek Optional DeepSeek provider

Quick Start With xUnit

The example below uses Judgy.Providers.OpenAI, but the same evaluator flow works with any supported provider package. Swap in HttpProvider, OllamaProvider, AnthropicProvider, GoogleProvider, AzureOpenAiProvider, MistralProvider, MoonshotProvider, or DeepSeekProvider as needed.

using Judgy.Evaluation;
using Judgy.Providers.OpenAI;
using Xunit;

var provider = new OpenAiProvider(new OpenAiProviderOptions
{
    ApiKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!,
    Model = "gpt-4o"
});

var evaluator = new SemanticEvaluator(provider);

await Assert.JudgyAsync(
    actualOutput,
    "The answer should mention refund deadlines",
    evaluator,
    minimumScore: 0.80);

Quick Start Without xUnit

The same pattern also works with any provider package under Judgy.Providers.*.

using Judgy.Assertions;
using Judgy.Evaluation;
using Judgy.Providers.OpenAI;

var provider = new OpenAiProvider(new OpenAiProviderOptions
{
    ApiKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!,
    Model = "gpt-4o"
});

var evaluator = new SemanticEvaluator(provider);
var result = await evaluator.EvaluateAsync(
    actualOutput,
    "The answer should mention refund deadlines");

var decision = SemanticAssertionPolicy.Evaluate(result, new SemanticAssertionOptions(0.80));

Custom Provider Example

If you do not want to use one of the optional Judgy.Providers.* packages, implement ILlmProvider yourself:

using Judgy.Providers;

public sealed class MyProvider : ILlmProvider
{
    public async Task<LlmResponse> CompleteAsync(
        LlmRequest request,
        CancellationToken cancellationToken = default)
    {
        // Call your own SDK, gateway, or service here and return the raw
        // evaluator response text that Judgy will parse.
        var text = await Task.FromResult(
            "{\"confidence\":0.95,\"reasoning\":\"Looks good.\"}");

        return new LlmResponse(text, "MyProvider");
    }
}

How It Works

LLM Provider -> SemanticEvaluator -> Evidence -> Assertion Policy -> Test Assertion

Judgy keeps provider calls, semantic evaluation, and assertion policy separate so tests stay readable while evaluation logic stays reusable.

Samples

The repository includes runnable sample projects under:

  • samples/Judgy.Samples.SemanticEvaluation
  • samples/Judgy.Samples.XunitAssertions

Browse the repository for sample setup and usage details:

  • https://github.com/maurogioberti/judgy-dotnet

Status

Judgy is usable today and still evolving. Expect API and package refinements before a stable 1.0 release.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
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
0.1.1 131 4/5/2026
0.1.0 107 4/5/2026