ContentSafetyEvaluator.EvaluateContentSafetyAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Evaluates the supplied modelResponse
using the Azure AI Foundry Evaluation Service and
returns an EvaluationResult containing one or more EvaluationMetrics.
protected System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult> EvaluateContentSafetyAsync(Microsoft.Extensions.AI.IChatClient contentSafetyServiceChatClient, System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage> messages, Microsoft.Extensions.AI.ChatResponse modelResponse, System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.Evaluation.EvaluationContext>? additionalContext = default, string contentSafetyServicePayloadFormat = "HumanSystem", bool includeMetricNamesInContentSafetyServicePayload = true, System.Threading.CancellationToken cancellationToken = default);
member this.EvaluateContentSafetyAsync : Microsoft.Extensions.AI.IChatClient * seq<Microsoft.Extensions.AI.ChatMessage> * Microsoft.Extensions.AI.ChatResponse * seq<Microsoft.Extensions.AI.Evaluation.EvaluationContext> * string * bool * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
Protected Function EvaluateContentSafetyAsync (contentSafetyServiceChatClient As IChatClient, messages As IEnumerable(Of ChatMessage), modelResponse As ChatResponse, Optional additionalContext As IEnumerable(Of EvaluationContext) = Nothing, Optional contentSafetyServicePayloadFormat As String = "HumanSystem", Optional includeMetricNamesInContentSafetyServicePayload As Boolean = true, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of EvaluationResult)
Parameters
- contentSafetyServiceChatClient
- IChatClient
The IChatClient that should be used to communicate with the Azure AI Foundry Evaluation Service when performing evaluations.
- messages
- IEnumerable<ChatMessage>
The conversation history including the request that produced the supplied modelResponse
.
- modelResponse
- ChatResponse
The response that is to be evaluated.
- additionalContext
- IEnumerable<EvaluationContext>
Additional contextual information (beyond that which is available in messages
) that the
IEvaluator may need to accurately evaluate the supplied modelResponse
.
- contentSafetyServicePayloadFormat
- String
An identifier that specifies the format of the payload that should be used when communicating with the Azure AI Foundry Evaluation service to perform evaluations.
- includeMetricNamesInContentSafetyServicePayload
- Boolean
A Boolean flag that indicates whether the names of the metrics should be included in the payload that is sent to the Azure AI Foundry Evaluation service when performing evaluations.
- cancellationToken
- CancellationToken
A CancellationToken that can cancel the evaluation operation.
Returns
An EvaluationResult containing one or more EvaluationMetrics.