Table of Contents

Class AzureAIContentSafetyClient

Namespace
FoundationaLLM.Common.Clients
Assembly
FoundationaLLM.Common.dll

Provides methods for interacting with Azure AI Content Safety services.

public class AzureAIContentSafetyClient : IAzureAIContentSafetyClient
Inheritance
AzureAIContentSafetyClient
Implements
Inherited Members
Extension Methods

Constructors

AzureAIContentSafetyClient(Uri, AzureKeyCredential, APIEndpointClientOptions?, bool)

Initializes a new instance of the AzureAIContentSafetyClient class.

public AzureAIContentSafetyClient(Uri endpoint, AzureKeyCredential credential, APIEndpointClientOptions? options, bool enableRetry)

Parameters

endpoint Uri

The endpoint URI of the Azure AI Content Safety service.

credential AzureKeyCredential

The AzureKeyCredential used to authenticate requests to the service.

options APIEndpointClientOptions

Optional configuration settings for the client, such as retry policies and timeouts.

enableRetry bool

Indicates whether to enable retry logic for transient failures.

Methods

AnalyzeText(AnalyzeTextRequest, CancellationToken)

Analyzes the specified text and returns the results of the analysis.

public Task<ClientResult<AnalyzeTextResult>> AnalyzeText(AnalyzeTextRequest request, CancellationToken cancellationToken = default)

Parameters

request AnalyzeTextRequest

The request containing the text to analyze.

cancellationToken CancellationToken

The optional cancellation token used to signal a cancellation request.

Returns

Task<ClientResult<AnalyzeTextResult>>

A task that represents the asynchronous operation. The task result contains an System.ClientModel.ClientResult object with the results of the analysis.

BuildClient(Dictionary<string, object>)

Creates and configures a new instance of the AzureAIContentSafetyClient.

public static IAzureAIContentSafetyClient BuildClient(Dictionary<string, object> clientBuilderParameters)

Parameters

clientBuilderParameters Dictionary<string, object>

A dictionary of parameters used to further configure the client.

Returns

IAzureAIContentSafetyClient

A new instance of the AzureAIContentSafetyClient configured with the specified clientBuilderParameters.

ShieldPrompt(ShieldPromptRequest, CancellationToken)

Analyzes a user prompt and associated documents for various prompt attacks.

public Task<ClientResult<ShieldPromptResult>> ShieldPrompt(ShieldPromptRequest request, CancellationToken cancellationToken = default)

Parameters

request ShieldPromptRequest

The request containing the user prompt and associated documents.

cancellationToken CancellationToken

The optional cancellation token used to signal a cancellation request.

Returns

Task<ClientResult<ShieldPromptResult>>

A task that represents the asynchronous operation. The task result contains an System.ClientModel.ClientResult object with the results of the analysis.