1 type derived from EvaluationMetric
Microsoft.Extensions.AI.Evaluation (1)
EvaluationMetric{T}.cs (1)
16
public class EvaluationMetric<T> :
EvaluationMetric
4 instantiations of EvaluationMetric
Microsoft.Extensions.AI.Evaluation.Integration.Tests (2)
ResultsTests.cs (2)
436
var metric3 = new
EvaluationMetric
("Metric with error diagnostics only");
489
var metric3 = new
EvaluationMetric
("Metric with error diagnostics only");
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (2)
ScenarioRunResultTests.cs (2)
58
var metricWithNoValue = new
EvaluationMetric
("none", reason: "reason2");
149
var metricWithNoValue = new
EvaluationMetric
("none", reason: "reason2");
227 references to EvaluationMetric
Microsoft.Extensions.AI.Evaluation (153)
BooleanMetric.cs (1)
7
/// An <see cref="
EvaluationMetric
"/> containing a <see cref="bool"/> value that can be used to represent an outcome
CompositeEvaluator.cs (8)
21
/// Gets the <see cref="
EvaluationMetric
.Name"/>s of all the <see cref="
EvaluationMetric
"/>s produced by the
74
/// containing one or more <see cref="
EvaluationMetric
"/>s.
78
/// The <see cref="
EvaluationMetric
.Name"/>s of the <see cref="
EvaluationMetric
"/>s contained in the returned
101
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
109
var metrics = new List<
EvaluationMetric
>();
160
var
metric = new EvaluationMetric(metricName);
EvaluationContext.cs (8)
33
/// that it used, in the <see cref="
EvaluationMetric
.Context"/> property of each <see cref="
EvaluationMetric
"/> that it
34
/// produces. When <see cref="
EvaluationMetric
"/>s are serialized (for example, as part of the result storage and
36
/// <see cref="EvaluationContext"/>s recorded within the <see cref="
EvaluationMetric
.Context"/> will also be
82
/// <see cref="EvaluationContext"/>s that it used, in the <see cref="
EvaluationMetric
.Context"/> property of each
83
/// <see cref="
EvaluationMetric
"/> that it produces. When <see cref="
EvaluationMetric
"/>s are serialized (for
86
/// within the <see cref="
EvaluationMetric
.Context"/> will also be serialized. However, for each such
EvaluationDiagnostic.cs (1)
13
/// in an <see cref="
EvaluationMetric
"/>.
EvaluationMetric.cs (9)
17
/// <param name="name">The name of the <see cref="
EvaluationMetric
"/>.</param>
20
/// <see cref="
EvaluationMetric
"/>.
25
[JsonDerivedType(typeof(
EvaluationMetric
), "none")]
29
/// Gets or sets the name of the <see cref="
EvaluationMetric
"/>.
35
/// this <see cref="
EvaluationMetric
"/>.
41
/// evaluation represented by the current <see cref="
EvaluationMetric
"/> is considered good or bad, passed or
53
/// of the evaluation that produced the current <see cref="
EvaluationMetric
"/>.
59
/// <see cref="
EvaluationMetric
"/>.
65
/// <see cref="
EvaluationMetric
"/>.
EvaluationMetricExtensions.cs (26)
13
/// Extension methods for <see cref="
EvaluationMetric
"/>.
19
/// <see cref="
EvaluationMetric
.Context"/> dictionary.
21
/// <param name="metric">The <see cref="
EvaluationMetric
"/>.</param>
23
public static void AddOrUpdateContext(this
EvaluationMetric
metric, IEnumerable<EvaluationContext> context)
41
/// <see cref="
EvaluationMetric
.Context"/> dictionary.
43
/// <param name="metric">The <see cref="
EvaluationMetric
"/>.</param>
45
public static void AddOrUpdateContext(this
EvaluationMetric
metric, params EvaluationContext[] context)
52
/// <param name="metric">The <see cref="
EvaluationMetric
"/> that is to be inspected.</param>
63
this
EvaluationMetric
metric,
76
/// Adds the supplied <see cref="EvaluationDiagnostic"/>s to the supplied <see cref="
EvaluationMetric
"/>'s
77
/// <see cref="
EvaluationMetric
.Diagnostics"/> collection.
79
/// <param name="metric">The <see cref="
EvaluationMetric
"/>.</param>
81
public static void AddDiagnostics(this
EvaluationMetric
metric, IEnumerable<EvaluationDiagnostic> diagnostics)
98
/// Adds the supplied <see cref="EvaluationDiagnostic"/>s to the supplied <see cref="
EvaluationMetric
"/>'s
99
/// <see cref="
EvaluationMetric
.Diagnostics"/> collection.
101
/// <param name="metric">The <see cref="
EvaluationMetric
"/>.</param>
103
public static void AddDiagnostics(this
EvaluationMetric
metric, params EvaluationDiagnostic[] diagnostics)
108
/// supplied <paramref name="metric"/>'s <see cref="
EvaluationMetric
.Metadata"/> dictionary.
110
/// <param name="metric">The <see cref="
EvaluationMetric
"/>.</param>
113
public static void AddOrUpdateMetadata(this
EvaluationMetric
metric, string name, string value)
123
/// <see cref="
EvaluationMetric
.Metadata"/> dictionary.
125
/// <param name="metric">The <see cref="
EvaluationMetric
"/>.</param>
127
public static void AddOrUpdateMetadata(this
EvaluationMetric
metric, IDictionary<string, string> metadata)
140
/// model, in the supplied <paramref name="metric"/>'s <see cref="
EvaluationMetric
.Metadata"/> dictionary.
142
/// <param name="metric">The <see cref="
EvaluationMetric
"/>.</param>
149
this
EvaluationMetric
metric,
EvaluationMetricInterpretation.cs (6)
12
/// Specifies how the result represented in an associated <see cref="
EvaluationMetric
"/> should be interpreted.
16
/// <see cref="
EvaluationMetric
"/> is considered.
19
/// <see langword="true"/> if the result represented in the associated <see cref="
EvaluationMetric
"/> is considered a
33
/// associated <see cref="
EvaluationMetric
"/> is considered.
38
/// Gets or sets a value indicating whether the result represented in the associated <see cref="
EvaluationMetric
"/>
42
/// <see langword="true"/> if the result represented in the associated <see cref="
EvaluationMetric
"/> is considered
EvaluationRating.cs (1)
7
/// An enumeration that identifies the set of possible ways in which an <see cref="
EvaluationMetric
"/> can be
EvaluationResult.cs (34)
12
/// A collection of one or more <see cref="
EvaluationMetric
"/>s that represent the result of an evaluation.
25
/// Gets or sets a collection of one or more <see cref="
EvaluationMetric
"/>s that represent the result of an
28
public IDictionary<string,
EvaluationMetric
> Metrics { get; set; }
36
/// A dictionary containing one or more <see cref="
EvaluationMetric
"/>s that represent the result of an evaluation.
39
/// The dictionary is keyed on the <see cref="
EvaluationMetric
.Name"/>s of the contained
40
/// <see cref="
EvaluationMetric
"/>s.
44
public EvaluationResult(IDictionary<string,
EvaluationMetric
> metrics)
53
/// An enumeration of <see cref="
EvaluationMetric
"/>s that represent the result of an evaluation.
55
public EvaluationResult(IEnumerable<
EvaluationMetric
> metrics)
59
var metricsDictionary = new Dictionary<string,
EvaluationMetric
>();
61
foreach (
EvaluationMetric
metric in metrics)
85
/// An array of <see cref="
EvaluationMetric
"/>s that represent the result of an evaluation.
87
public EvaluationResult(params
EvaluationMetric
[] metrics)
88
: this(metrics as IEnumerable<
EvaluationMetric
>)
93
/// Returns an <see cref="
EvaluationMetric
"/> with type <typeparamref name="T"/> and with the
94
/// <see cref="
EvaluationMetric
.Name"/> specified via <paramref name="metricName"/> if it exists in
97
/// <typeparam name="T">The type of the <see cref="
EvaluationMetric
"/> to be returned.</typeparam>
99
/// The <see cref="
EvaluationMetric
.Name"/> of the <see cref="
EvaluationMetric
"/> to be returned.
102
/// An <see cref="
EvaluationMetric
"/> with type <typeparamref name="T"/> and with the
103
/// <see cref="
EvaluationMetric
.Name"/> specified via <paramref name="metricName"/> if it exists in
111
where T :
EvaluationMetric
113
if (Metrics.TryGetValue(metricName, out
EvaluationMetric
? m) && m is T metric)
124
/// Returns an <see cref="
EvaluationMetric
"/> with type <typeparamref name="T"/> and with the
125
/// <see cref="
EvaluationMetric
.Name"/> specified via <paramref name="metricName"/> if it exists in
128
/// <typeparam name="T">The type of the <see cref="
EvaluationMetric
"/> to be returned.</typeparam>
130
/// The <see cref="
EvaluationMetric
.Name"/> of the <see cref="
EvaluationMetric
"/> to be returned.
133
/// An <see cref="
EvaluationMetric
"/> with type <typeparamref name="T"/> and with the
134
/// <see cref="
EvaluationMetric
.Name"/> specified via <paramref name="metricName"/> if it exists in
138
/// An <see cref="
EvaluationMetric
"/> with type <typeparamref name="T"/> and with the
139
/// <see cref="
EvaluationMetric
.Name"/> specified via <paramref name="metricName"/> does not exist in
143
where T :
EvaluationMetric
145
if (Metrics.TryGetValue(metricName, out
EvaluationMetric
? m) && m is T metric)
EvaluationResultExtensions.cs (27)
17
/// Adds or updates the supplied <paramref name="context"/> objects in all <see cref="
EvaluationMetric
"/>s
21
/// The <see cref="EvaluationResult"/> containing the <see cref="
EvaluationMetric
"/>s that are to be altered.
30
foreach (
EvaluationMetric
metric in result.Metrics.Values)
37
/// Adds or updates the supplied <paramref name="context"/> objects in all <see cref="
EvaluationMetric
"/>s
41
/// The <see cref="EvaluationResult"/> containing the <see cref="
EvaluationMetric
"/>s that are to be altered.
48
/// Adds the supplied <paramref name="diagnostics"/> to all <see cref="
EvaluationMetric
"/>s contained in the
52
/// The <see cref="EvaluationResult"/> containing the <see cref="
EvaluationMetric
"/>s that are to be altered.
59
foreach (
EvaluationMetric
metric in result.Metrics.Values)
66
/// Adds the supplied <paramref name="diagnostics"/> to all <see cref="
EvaluationMetric
"/>s contained in the
70
/// The <see cref="EvaluationResult"/> containing the <see cref="
EvaluationMetric
"/>s that are to be altered.
77
/// Returns <see langword="true"/> if any <see cref="
EvaluationMetric
"/> contained in the supplied
87
/// <see langword="true"/> if any <see cref="
EvaluationMetric
"/> contained in the supplied
101
/// Applies <see cref="EvaluationMetricInterpretation"/>s to one or more <see cref="
EvaluationMetric
"/>s contained
105
/// The <see cref="EvaluationResult"/> containing the <see cref="
EvaluationMetric
"/>s that are to be interpreted.
109
/// supplied <see cref="
EvaluationMetric
"/>, or <see langword="null"/> if the
110
/// <see cref="
EvaluationMetric
.Interpretation"/> should be left unchanged.</param>
113
Func<
EvaluationMetric
, EvaluationMetricInterpretation?> interpretationProvider)
118
foreach (
EvaluationMetric
metric in result.Metrics.Values)
129
/// <see cref="
EvaluationMetric
"/>s contained in the supplied <paramref name="result"/>.
132
/// The <see cref="EvaluationResult"/> containing the <see cref="
EvaluationMetric
"/>s that are to be altered.
140
foreach (
EvaluationMetric
metric in result.Metrics.Values)
147
/// Adds or updates the supplied <paramref name="metadata"/> in all <see cref="
EvaluationMetric
"/>s contained in
151
/// The <see cref="EvaluationResult"/> containing the <see cref="
EvaluationMetric
"/>s that are to be altered.
160
foreach (
EvaluationMetric
metric in result.Metrics.Values)
168
/// model, in all <see cref="
EvaluationMetric
"/>s contained in the supplied <paramref name="result"/>.
171
/// The <see cref="EvaluationResult"/> containing the <see cref="
EvaluationMetric
"/>s that are to be altered.
185
foreach (
EvaluationMetric
metric in result.Metrics.Values)
EvaluatorExtensions.cs (24)
18
/// containing one or more <see cref="
EvaluationMetric
"/>s.
22
/// The <see cref="
EvaluationMetric
.Name"/>s of the <see cref="
EvaluationMetric
"/>s contained in the returned
43
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
58
/// containing one or more <see cref="
EvaluationMetric
"/>s.
62
/// The <see cref="
EvaluationMetric
.Name"/>s of the <see cref="
EvaluationMetric
"/>s contained in the returned
86
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
103
/// containing one or more <see cref="
EvaluationMetric
"/>s.
107
/// The <see cref="
EvaluationMetric
.Name"/>s of the <see cref="
EvaluationMetric
"/>s contained in the returned
128
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
148
/// containing one or more <see cref="
EvaluationMetric
"/>s.
152
/// The <see cref="
EvaluationMetric
.Name"/>s of the <see cref="
EvaluationMetric
"/>s contained in the returned
173
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
193
/// containing one or more <see cref="
EvaluationMetric
"/>s.
197
/// The <see cref="
EvaluationMetric
.Name"/>s of the <see cref="
EvaluationMetric
"/>s contained in the returned
221
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
242
/// containing one or more <see cref="
EvaluationMetric
"/>s.
246
/// The <see cref="
EvaluationMetric
.Name"/>s of the <see cref="
EvaluationMetric
"/>s contained in the returned
270
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
IEvaluator.cs (6)
19
/// Gets the <see cref="
EvaluationMetric
.Name"/>s of the <see cref="
EvaluationMetric
"/>s produced by this
26
/// containing one or more <see cref="
EvaluationMetric
"/>s.
30
/// The <see cref="
EvaluationMetric
.Name"/>s of the <see cref="
EvaluationMetric
"/>s contained in the returned
53
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
NumericMetric.cs (1)
7
/// An <see cref="
EvaluationMetric
"/> containing a numeric value.
StringMetric.cs (1)
7
/// An <see cref="
EvaluationMetric
"/> containing a <see cref="string"/> value.
Microsoft.Extensions.AI.Evaluation.Integration.Tests (7)
ResultsTests.cs (6)
41
private static EvaluationMetricInterpretation? FailIfValueIsTrue(
EvaluationMetric
m)
67
private static EvaluationMetricInterpretation? FailIfValueIsLessThan4(
EvaluationMetric
m)
108
private static EvaluationMetricInterpretation? FailIfValueIsMissing(
EvaluationMetric
m) =>
128
private static EvaluationMetricInterpretation? FailIfNotImperialOrUSCustomary(
EvaluationMetric
m)
436
var
metric3 = new EvaluationMetric("Metric with error diagnostics only");
489
var
metric3 = new EvaluationMetric("Metric with error diagnostics only");
TestEvaluator.cs (1)
14
public IReadOnlyList<
EvaluationMetric
> TestMetrics { get; set; } = [];
Microsoft.Extensions.AI.Evaluation.Quality (10)
CoherenceEvaluator.cs (1)
47
/// Gets the <see cref="
EvaluationMetric
.Name"/> of the <see cref="NumericMetric"/> returned by
CompletenessEvaluator.cs (1)
43
/// Gets the <see cref="
EvaluationMetric
.Name"/> of the <see cref="NumericMetric"/> returned by
EquivalenceEvaluator.cs (1)
43
/// Gets the <see cref="
EvaluationMetric
.Name"/> of the <see cref="NumericMetric"/> returned by
FluencyEvaluator.cs (1)
41
/// Gets the <see cref="
EvaluationMetric
.Name"/> of the <see cref="NumericMetric"/> returned by
GroundednessEvaluator.cs (1)
42
/// Gets the <see cref="
EvaluationMetric
.Name"/> of the <see cref="NumericMetric"/> returned by
RelevanceEvaluator.cs (1)
45
/// Gets the <see cref="
EvaluationMetric
.Name"/> of the <see cref="NumericMetric"/> returned by
RelevanceTruthAndCompletenessEvaluator.cs (3)
49
/// Gets the <see cref="
EvaluationMetric
.Name"/> of the <see cref="NumericMetric"/> returned by
55
/// Gets the <see cref="
EvaluationMetric
.Name"/> of the <see cref="NumericMetric"/> returned by
61
/// Gets the <see cref="
EvaluationMetric
.Name"/> of the <see cref="NumericMetric"/> returned by
RetrievalEvaluator.cs (1)
51
/// Gets the <see cref="
EvaluationMetric
.Name"/> of the <see cref="NumericMetric"/> returned by
Microsoft.Extensions.AI.Evaluation.Reporting (35)
Formats\Html\HtmlReportWriter.cs (1)
18
/// <see cref="
EvaluationMetric
"/>s present in the supplied <see cref="ScenarioRunResult"/>s and writes it to the
Formats\Json\JsonReportWriter.cs (1)
17
/// <see cref="
EvaluationMetric
"/>s present in the supplied <see cref="ScenarioRunResult"/>s and writes it to the
IEvaluationReportWriter.cs (2)
11
/// Generates a report containing all the <see cref="
EvaluationMetric
"/>s present in the supplied
17
/// Writes a report containing all the <see cref="
EvaluationMetric
"/>s present in the supplied
ReportingConfiguration.cs (8)
82
/// <see cref="
EvaluationMetric
"/>s returned from evaluations that use this <see cref="ReportingConfiguration"/>.
86
/// <see cref="
EvaluationMetric
"/> that is supplied to it, or return <see langword="null"/> if the
87
/// <see cref="
EvaluationMetric
.Interpretation"/> should be left unchanged.
89
public Func<
EvaluationMetric
, EvaluationMetricInterpretation?>? EvaluationMetricInterpreter { get; }
125
/// <see cref="
EvaluationMetric
"/>s returned from evaluations that use this <see cref="ReportingConfiguration"/>.
127
/// <see cref="
EvaluationMetric
"/> that is supplied to it, or return <see langword="null"/> if the
128
/// <see cref="
EvaluationMetric
.Interpretation"/> should be left unchanged.
142
Func<
EvaluationMetric
, EvaluationMetricInterpretation?>? evaluationMetricInterpreter = null,
ScenarioRun.cs (5)
74
/// across these different executions to track how the <see cref="
EvaluationMetric
"/>s for each scenario and
97
private readonly Func<
EvaluationMetric
, EvaluationMetricInterpretation?>? _evaluationMetricInterpreter;
111
Func<
EvaluationMetric
, EvaluationMetricInterpretation?>? evaluationMetricInterpreter = null,
130
/// containing one or more <see cref="
EvaluationMetric
"/>s.
144
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
ScenarioRunExtensions.cs (12)
18
/// containing one or more <see cref="
EvaluationMetric
"/>s.
29
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
42
/// containing one or more <see cref="
EvaluationMetric
"/>s.
57
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
72
/// containing one or more <see cref="
EvaluationMetric
"/>s.
83
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
101
/// containing one or more <see cref="
EvaluationMetric
"/>s.
112
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
130
/// containing one or more <see cref="
EvaluationMetric
"/>s.
145
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
164
/// containing one or more <see cref="
EvaluationMetric
"/>s.
179
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
ScenarioRunResultExtensions.cs (2)
15
/// Returns <see langword="true"/> if any <see cref="
EvaluationMetric
"/> contained in the supplied
25
/// <see langword="true"/> if any <see cref="
EvaluationMetric
"/> contained in the supplied
Storage\DiskBasedReportingConfiguration.cs (4)
45
/// <see cref="
EvaluationMetric
"/>s returned from evaluations that use the returned
47
/// <see cref="EvaluationMetricInterpretation"/> for any <see cref="
EvaluationMetric
"/> that is supplied to it, or
48
/// return <see langword="null"/> if the <see cref="
EvaluationMetric
.Interpretation"/> should be left unchanged.
66
Func<
EvaluationMetric
, EvaluationMetricInterpretation?>? evaluationMetricInterpreter = null,
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (4)
Storage\AzureStorageReportingConfiguration.cs (4)
49
/// <see cref="
EvaluationMetric
"/>s returned from evaluations that use the returned
51
/// <see cref="EvaluationMetricInterpretation"/> for any <see cref="
EvaluationMetric
"/> that is supplied to it, or
52
/// return <see langword="null"/> if the <see cref="
EvaluationMetric
.Interpretation"/> should be left unchanged.
71
Func<
EvaluationMetric
, EvaluationMetricInterpretation?>? evaluationMetricInterpreter = null,
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (8)
ScenarioRunResultTests.cs (8)
58
var
metricWithNoValue = new EvaluationMetric("none", reason: "reason2");
149
var
metricWithNoValue = new EvaluationMetric("none", reason: "reason2");
248
EvaluationMetric
metricWithNoValue = first.Get<
EvaluationMetric
>("none");
249
EvaluationMetric
deserializedMetricWithNoValue = second.Get<
EvaluationMetric
>("none");
253
private static void ValidateEquivalence(
EvaluationMetric
metric,
EvaluationMetric
deserializedMetric)
Microsoft.Extensions.AI.Evaluation.Safety (10)
ContentHarmEvaluator.cs (2)
25
/// with the Azure AI Foundry Evaluation service, to the <see cref="
EvaluationMetric
.Name"/>s of the
26
/// <see cref="
EvaluationMetric
"/>s returned by this <see cref="IEvaluator"/>.
ContentSafetyEvaluator.cs (5)
30
/// AI Foundry Evaluation service, to the <see cref="
EvaluationMetric
.Name"/>s of the <see cref="
EvaluationMetric
"/>s
62
/// returns an <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.
87
/// <returns>An <see cref="EvaluationResult"/> containing one or more <see cref="
EvaluationMetric
"/>s.</returns>
161
foreach (
EvaluationMetric
metric in result.Metrics.Values)
ContentSafetyService.cs (1)
79
EvaluationMetric
metric;
EvaluationMetricExtensions.cs (2)
79
internal static void LogJsonData(this
EvaluationMetric
metric, string data)
97
internal static void LogJsonData(this
EvaluationMetric
metric, JsonNode data)