CodeVulnerabilityEvaluator Class

Definition

An IEvaluator that utilizes the Azure AI Foundry Evaluation service to evaluate code completion responses produced by an AI model for the presence of vulnerable code.

public ref class CodeVulnerabilityEvaluator sealed : Microsoft::Extensions::AI::Evaluation::Safety::ContentSafetyEvaluator
public sealed class CodeVulnerabilityEvaluator : Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyEvaluator
type CodeVulnerabilityEvaluator = class
    inherit ContentSafetyEvaluator
Public NotInheritable Class CodeVulnerabilityEvaluator
Inherits ContentSafetyEvaluator
Inheritance
CodeVulnerabilityEvaluator

Remarks

CodeVulnerabilityEvaluator supports evaluation of code vulnerabilities in the following programming languages: Python, Java, C++, C#, Go, JavaScript and SQL. It can identify a variety of code vulnerabilities such as sql injection, stack trace exposure, hardcoded credentials etc.

CodeVulnerabilityEvaluator returns a BooleanMetric with a value of true indicating the presence of an vulnerable code in the evaluated response, and a value of false indicating the absence of vulnerable code.

Note that CodeVulnerabilityEvaluator does not support evaluation of multimodal content present in the evaluated responses. Images and other multimodal content present in the evaluated responses will be ignored. Also note that if a multi-turn conversation is supplied as input, CodeVulnerabilityEvaluator will only evaluate the code present in the last conversation turn. Any code present in the previous conversation turns will be ignored.

Constructors

CodeVulnerabilityEvaluator()

An IEvaluator that utilizes the Azure AI Foundry Evaluation service to evaluate code completion responses produced by an AI model for the presence of vulnerable code.

Properties

CodeVulnerabilityMetricName

Gets the Name of the BooleanMetric returned by CodeVulnerabilityEvaluator.

EvaluationMetricNames

Gets the Names of the EvaluationMetrics produced by this IEvaluator.

(Inherited from ContentSafetyEvaluator)

Methods

EvaluateAsync(IEnumerable<ChatMessage>, ChatResponse, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)
EvaluateContentSafetyAsync(IChatClient, IEnumerable<ChatMessage>, ChatResponse, IEnumerable<EvaluationContext>, String, Boolean, CancellationToken)

Evaluates the supplied modelResponse using the Azure AI Foundry Evaluation Service and returns an EvaluationResult containing one or more EvaluationMetrics.

(Inherited from ContentSafetyEvaluator)
FilterAdditionalContext(IEnumerable<EvaluationContext>)

Filters the EvaluationContexts supplied by the caller via additionalContext down to just the EvaluationContexts that are relevant to the evaluation being performed by this ContentSafetyEvaluator.

(Inherited from ContentSafetyEvaluator)

Extension Methods

EvaluateAsync(IEvaluator, ChatMessage, ChatMessage, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

Evaluates the supplied modelResponse and returns an EvaluationResult containing one or more EvaluationMetrics.

EvaluateAsync(IEvaluator, ChatMessage, ChatResponse, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

Evaluates the supplied modelResponse and returns an EvaluationResult containing one or more EvaluationMetrics.

EvaluateAsync(IEvaluator, ChatMessage, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

Evaluates the supplied modelResponse and returns an EvaluationResult containing one or more EvaluationMetrics.

EvaluateAsync(IEvaluator, ChatResponse, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

Evaluates the supplied modelResponse and returns an EvaluationResult containing one or more EvaluationMetrics.

EvaluateAsync(IEvaluator, String, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

Evaluates the supplied modelResponse and returns an EvaluationResult containing one or more EvaluationMetrics.

EvaluateAsync(IEvaluator, String, String, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

Evaluates the supplied modelResponse and returns an EvaluationResult containing one or more EvaluationMetrics.

Applies to