ContentSafetyEvaluator class abstract

Base class for evaluators that call the Azure AI Foundry Evaluation service to detect unsafe content.

Subclasses specify the annotation task name and the mapping from service metric names to the EvaluationMetric names returned to callers.

Implemented types
Implementers
Annotations
  • @Source(name: 'ContentSafetyEvaluator.cs', namespace: 'Microsoft.Extensions.AI.Evaluation.Safety', repository: 'dotnet/extensions', path: 'src/Libraries/Microsoft.Extensions.AI.Evaluation.Safety/')

Constructors

ContentSafetyEvaluator({required ContentSafetyServiceConfiguration configuration, required String annotationTask, required Map<String, String> metricNames})
Creates a ContentSafetyEvaluator.

Properties

annotationTask String
The annotation task name sent to the service.
final
configuration ContentSafetyServiceConfiguration
Azure AI Foundry service configuration.
final
evaluationMetricNames List<String>
The names of the EvaluationMetrics produced by this evaluator.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

evaluate(Iterable<ChatMessage> messages, ChatResponse modelResponse, {ChatConfiguration? chatConfiguration, Iterable<EvaluationContext>? additionalContext, CancellationToken? cancellationToken}) Future<EvaluationResult>
Evaluates modelResponse and returns an EvaluationResult.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited