Table of Contents

Class Metric

Namespace
GenerativeAI.Types
Assembly
GenerativeAI.dll

The metric used for evaluation during model tuning.

public class Metric
Inheritance
Metric
Inherited Members
Extension Methods

Remarks

Set the convenience properties (Name, PromptTemplate, JudgeModelSystemInstruction, ReturnRawOutput) and TuningClient converts them to the wire format (ExactMatchSpec, BleuSpec, RougeSpec or PointwiseMetricSpec plus AggregationMetrics) the same way the google-genai SDK does. The wire-format properties can also be set directly.

Properties

AggregationMetrics

Wire format. The aggregation metrics to compute (for example AVERAGE, STANDARD_DEVIATION).

[JsonPropertyName("aggregationMetrics")]
public List<string>? AggregationMetrics { get; set; }

Property Value

List<string>

BleuSpec

Wire format. Spec for the BLEU metric.

[JsonPropertyName("bleuSpec")]
public JsonObject? BleuSpec { get; set; }

Property Value

JsonObject

ExactMatchSpec

Wire format. Spec for the exact match metric.

[JsonPropertyName("exactMatchSpec")]
public JsonObject? ExactMatchSpec { get; set; }

Property Value

JsonObject

JudgeModelSystemInstruction

The system instruction for the judge model.

[JsonPropertyName("judgeModelSystemInstruction")]
public string? JudgeModelSystemInstruction { get; set; }

Property Value

string

Name

The name of the metric (for example exact_match, bleu, rouge_l_sum or a custom name used together with PromptTemplate).

[JsonPropertyName("name")]
public string? Name { get; set; }

Property Value

string

PointwiseMetricSpec

Wire format. Spec for a pointwise (model-based) metric.

[JsonPropertyName("pointwiseMetricSpec")]
public JsonObject? PointwiseMetricSpec { get; set; }

Property Value

JsonObject

PromptTemplate

The prompt template for the metric.

[JsonPropertyName("promptTemplate")]
public string? PromptTemplate { get; set; }

Property Value

string

ReturnRawOutput

Whether to return the raw output from the judge model.

[JsonPropertyName("returnRawOutput")]
public bool? ReturnRawOutput { get; set; }

Property Value

bool?

RougeSpec

Wire format. Spec for the ROUGE metric (for example {"rougeType": "rougeLSum"}).

[JsonPropertyName("rougeSpec")]
public JsonObject? RougeSpec { get; set; }

Property Value

JsonObject