Skip to main content

AI Guard | C# SDK

AI Guard

AIGuardClient

AI Guard API client.

var config = new Config("pangea_token", "pangea_domain");
var builder = new AIGuardClient.Builder(config);
var client = builder.Build();

Text guard

AIGuardClient.GuardText(TextGuardRequest, CancellationToken)

Analyze and redact text to avoid manipulation of the model, addition of malicious content, and other undesirable data transfers.

TextGuardRequest

Request parameters.

CancellationToken

Cancellation token.

Task<Response<TextGuardResult<object>>>
var response = await client.GuardText(new TextGuardRequest("hello world"));

Text guard

AIGuardClient.GuardText<TMessages>(MessagesGuardRequest<TMessages>, CancellationToken)

Analyze and redact text to avoid manipulation of the model, addition of malicious content, and other undesirable data transfers.

MessagesGuardRequest<TMessages>

Request parameters.

CancellationToken

Cancellation token.

Task<Response<TextGuardResult<TMessages>>>
var response = await client.GuardText(new MessagesGuardRequest <string, string>>>(new[]
{
    new Dictionary<string, string> { { "role", "user" }, { "content", "what was pangea?" } }
}));