Skip to content

PredictionGuard

Nuget package dotnet License: MIT Discord

Features 🔥

  • Fully generated C# SDK based on official PredictionGuard OpenAPI specification using AutoSDK
  • Same day update to support new features
  • Updated and supported automatically if there are no breaking changes
  • All modern .NET features - nullability, trimming, NativeAOT, etc.
  • Support .Net Framework/.Net Standard 2.0
  • Microsoft.Extensions.AI AIFunction tool wrappers for guardrails

Usage

1
2
3
using PredictionGuard;

using var client = new PredictionGuardClient(apiKey);

Microsoft.Extensions.AI

The SDK currently exposes guardrail endpoints as AIFunction tools that work with any IChatClient:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
using Microsoft.Extensions.AI;
using PredictionGuard;

var pgClient = new PredictionGuardClient(apiKey);

var tools = new AITool[]
{
    pgClient.AsFactualityCheckTool(),
    pgClient.AsToxicityCheckTool(),
    pgClient.AsPiiDetectionTool(),
    pgClient.AsInjectionDetectionTool(),
};

var options = new ChatOptions { Tools = tools };

See the MEAI guide for details.

Support

Priority place for bugs: https://github.com/tryAGI/PredictionGuard/issues
Priority place for ideas and general questions: https://github.com/tryAGI/PredictionGuard/discussions
Discord: https://discord.gg/Ca2xhfBf3v

Acknowledgments

JetBrains logo

This project is supported by JetBrains through the Open Source Support Program.