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
endpointUriThe endpoint URI of the Azure AI Content Safety service.
credentialAzureKeyCredentialThe AzureKeyCredential used to authenticate requests to the service.
optionsAPIEndpointClientOptionsOptional configuration settings for the client, such as retry policies and timeouts.
enableRetryboolIndicates 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
requestAnalyzeTextRequestThe request containing the text to analyze.
cancellationTokenCancellationTokenThe 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
clientBuilderParametersDictionary<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
requestShieldPromptRequestThe request containing the user prompt and associated documents.
cancellationTokenCancellationTokenThe 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.