TruthVouch.SemanticKernel 1.0.1

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

TruthVouch.SemanticKernel

Semantic Kernel integration for TruthVouch — verify LLM outputs for factual accuracy and attach trust scores to kernel function results.

Installation

dotnet add package TruthVouch.SemanticKernel

Quick Start

Register TruthVouch directly on your IKernelBuilder. This wires in both the function invocation filter and the prompt render filter automatically:

using TruthVouch.SemanticKernel;

var kernel = Kernel.CreateBuilder()
    .AddOpenAIChatCompletion("gpt-4o", openAiApiKey)
    .AddTruthVouch(o =>
    {
        o.ApiKey         = "your-truthvouch-api-key";
        o.TrustThreshold = 0.75;
        o.ThrowOnLowTrust = true;
    })
    .Build();

If you use a plain IServiceCollection (e.g., ASP.NET Core), call the IServiceCollection overload instead:

builder.Services.AddTruthVouch(o =>
{
    o.ApiKey         = "your-truthvouch-api-key";
    o.TrustThreshold = 0.8;
});

Components

TruthVouchPlugin

A Semantic Kernel plugin that exposes fact-verification as a first-class kernel function (verify_content). The function accepts a text string and an optional verification mode, calls the TruthVouch Trust API, and returns a structured VerifyResponse containing the trust score and per-claim verdicts.

Add the plugin to your kernel to let the AI planner invoke it on demand:

kernel.Plugins.AddFromObject(kernel.Services.GetRequiredService<TruthVouchPlugin>(), "TruthVouch");

TruthVouchFilter

Implements IFunctionInvocationFilter. After every kernel function call that returns a string, this filter automatically sends the output to the Trust API and:

  • Attaches truthvouch_trust_score and truthvouch_verification_id to the FunctionResult metadata on every call.
  • When the score falls below TrustThreshold and ThrowOnLowTrust is false, logs a warning and adds a truthvouch_warning key to the result metadata.
  • When ThrowOnLowTrust is true, throws a TrustVerificationException.

Functions decorated with [SkipTruthVerification] are bypassed entirely.

TruthVouchPromptFilter

Implements IPromptRenderFilter. When VerifyInputPrompts is true, this filter verifies the fully rendered prompt text before it is sent to the LLM. The trust score and verification ID are attached to the prompt context arguments (truthvouch_prompt_trust_score, truthvouch_prompt_verification_id) so downstream filters can inspect them without a second API call.

Both filters are registered automatically when you call AddTruthVouch on an IKernelBuilder.

Configuration

All options are set via the TruthVouchOptions delegate passed to AddTruthVouch.

Property Type Default Description
ApiKey string "" Bearer token sent with every Trust API request.
BaseUrl string http://localhost:5004/api/v1/trust Base URL of the TruthVouch Trust API.
TrustThreshold double 0.8 Minimum acceptable trust score (0.0–1.0). Scores below this trigger a warning or exception.
DefaultMode string spot_check Default verification mode when none is specified. Valid values: spot_check, standard, full.
ThrowOnLowTrust bool false When true, TruthVouchFilter throws a TrustVerificationException instead of logging a warning on low-trust results.
VerifyInputPrompts bool false When true, TruthVouchPromptFilter verifies rendered prompts before they are sent to the LLM.

License

Apache-2.0

Product 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. 
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
1.0.1 115 4/2/2026
1.0.0 105 4/1/2026

v1.0.1: Added package README, LICENSE, tags and metadata. No code changes from v1.0.0.