#[non_exhaustive]pub struct Metric {
pub aggregation_metrics: Vec<AggregationMetric>,
pub metric_spec: Option<MetricSpec>,
/* private fields */
}gen-ai-tuning-service only.Expand description
The metric used for running evaluations.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.aggregation_metrics: Vec<AggregationMetric>Optional. The aggregation metrics to use.
metric_spec: Option<MetricSpec>The spec for the metric. It would be either a pre-defined metric, or a inline metric spec.
Implementations§
Source§impl Metric
impl Metric
pub fn new() -> Self
Sourcepub fn set_aggregation_metrics<T, V>(self, v: T) -> Self
pub fn set_aggregation_metrics<T, V>(self, v: T) -> Self
Sets the value of aggregation_metrics.
§Example
use google_cloud_aiplatform_v1::model::metric::AggregationMetric;
let x = Metric::new().set_aggregation_metrics([
AggregationMetric::Average,
AggregationMetric::Mode,
AggregationMetric::StandardDeviation,
]);Sourcepub fn set_metric_spec<T: Into<Option<MetricSpec>>>(self, v: T) -> Self
pub fn set_metric_spec<T: Into<Option<MetricSpec>>>(self, v: T) -> Self
Sets the value of metric_spec.
Note that all the setters affecting metric_spec are mutually
exclusive.
§Example
use google_cloud_aiplatform_v1::model::PredefinedMetricSpec;
let x = Metric::new().set_metric_spec(Some(
google_cloud_aiplatform_v1::model::metric::MetricSpec::PredefinedMetricSpec(PredefinedMetricSpec::default().into())));Sourcepub fn predefined_metric_spec(&self) -> Option<&Box<PredefinedMetricSpec>>
pub fn predefined_metric_spec(&self) -> Option<&Box<PredefinedMetricSpec>>
The value of metric_spec
if it holds a PredefinedMetricSpec, None if the field is not set or
holds a different branch.
Sourcepub fn set_predefined_metric_spec<T: Into<Box<PredefinedMetricSpec>>>(
self,
v: T,
) -> Self
pub fn set_predefined_metric_spec<T: Into<Box<PredefinedMetricSpec>>>( self, v: T, ) -> Self
Sets the value of metric_spec
to hold a PredefinedMetricSpec.
Note that all the setters affecting metric_spec are
mutually exclusive.
§Example
use google_cloud_aiplatform_v1::model::PredefinedMetricSpec;
let x = Metric::new().set_predefined_metric_spec(PredefinedMetricSpec::default()/* use setters */);
assert!(x.predefined_metric_spec().is_some());
assert!(x.computation_based_metric_spec().is_none());
assert!(x.llm_based_metric_spec().is_none());
assert!(x.pointwise_metric_spec().is_none());
assert!(x.pairwise_metric_spec().is_none());
assert!(x.exact_match_spec().is_none());
assert!(x.bleu_spec().is_none());
assert!(x.rouge_spec().is_none());Sourcepub fn computation_based_metric_spec(
&self,
) -> Option<&Box<ComputationBasedMetricSpec>>
pub fn computation_based_metric_spec( &self, ) -> Option<&Box<ComputationBasedMetricSpec>>
The value of metric_spec
if it holds a ComputationBasedMetricSpec, None if the field is not set or
holds a different branch.
Sourcepub fn set_computation_based_metric_spec<T: Into<Box<ComputationBasedMetricSpec>>>(
self,
v: T,
) -> Self
pub fn set_computation_based_metric_spec<T: Into<Box<ComputationBasedMetricSpec>>>( self, v: T, ) -> Self
Sets the value of metric_spec
to hold a ComputationBasedMetricSpec.
Note that all the setters affecting metric_spec are
mutually exclusive.
§Example
use google_cloud_aiplatform_v1::model::ComputationBasedMetricSpec;
let x = Metric::new().set_computation_based_metric_spec(ComputationBasedMetricSpec::default()/* use setters */);
assert!(x.computation_based_metric_spec().is_some());
assert!(x.predefined_metric_spec().is_none());
assert!(x.llm_based_metric_spec().is_none());
assert!(x.pointwise_metric_spec().is_none());
assert!(x.pairwise_metric_spec().is_none());
assert!(x.exact_match_spec().is_none());
assert!(x.bleu_spec().is_none());
assert!(x.rouge_spec().is_none());Sourcepub fn llm_based_metric_spec(&self) -> Option<&Box<LLMBasedMetricSpec>>
pub fn llm_based_metric_spec(&self) -> Option<&Box<LLMBasedMetricSpec>>
The value of metric_spec
if it holds a LlmBasedMetricSpec, None if the field is not set or
holds a different branch.
Sourcepub fn set_llm_based_metric_spec<T: Into<Box<LLMBasedMetricSpec>>>(
self,
v: T,
) -> Self
pub fn set_llm_based_metric_spec<T: Into<Box<LLMBasedMetricSpec>>>( self, v: T, ) -> Self
Sets the value of metric_spec
to hold a LlmBasedMetricSpec.
Note that all the setters affecting metric_spec are
mutually exclusive.
§Example
use google_cloud_aiplatform_v1::model::LLMBasedMetricSpec;
let x = Metric::new().set_llm_based_metric_spec(LLMBasedMetricSpec::default()/* use setters */);
assert!(x.llm_based_metric_spec().is_some());
assert!(x.predefined_metric_spec().is_none());
assert!(x.computation_based_metric_spec().is_none());
assert!(x.pointwise_metric_spec().is_none());
assert!(x.pairwise_metric_spec().is_none());
assert!(x.exact_match_spec().is_none());
assert!(x.bleu_spec().is_none());
assert!(x.rouge_spec().is_none());Sourcepub fn pointwise_metric_spec(&self) -> Option<&Box<PointwiseMetricSpec>>
pub fn pointwise_metric_spec(&self) -> Option<&Box<PointwiseMetricSpec>>
The value of metric_spec
if it holds a PointwiseMetricSpec, None if the field is not set or
holds a different branch.
Sourcepub fn set_pointwise_metric_spec<T: Into<Box<PointwiseMetricSpec>>>(
self,
v: T,
) -> Self
pub fn set_pointwise_metric_spec<T: Into<Box<PointwiseMetricSpec>>>( self, v: T, ) -> Self
Sets the value of metric_spec
to hold a PointwiseMetricSpec.
Note that all the setters affecting metric_spec are
mutually exclusive.
§Example
use google_cloud_aiplatform_v1::model::PointwiseMetricSpec;
let x = Metric::new().set_pointwise_metric_spec(PointwiseMetricSpec::default()/* use setters */);
assert!(x.pointwise_metric_spec().is_some());
assert!(x.predefined_metric_spec().is_none());
assert!(x.computation_based_metric_spec().is_none());
assert!(x.llm_based_metric_spec().is_none());
assert!(x.pairwise_metric_spec().is_none());
assert!(x.exact_match_spec().is_none());
assert!(x.bleu_spec().is_none());
assert!(x.rouge_spec().is_none());Sourcepub fn pairwise_metric_spec(&self) -> Option<&Box<PairwiseMetricSpec>>
pub fn pairwise_metric_spec(&self) -> Option<&Box<PairwiseMetricSpec>>
The value of metric_spec
if it holds a PairwiseMetricSpec, None if the field is not set or
holds a different branch.
Sourcepub fn set_pairwise_metric_spec<T: Into<Box<PairwiseMetricSpec>>>(
self,
v: T,
) -> Self
pub fn set_pairwise_metric_spec<T: Into<Box<PairwiseMetricSpec>>>( self, v: T, ) -> Self
Sets the value of metric_spec
to hold a PairwiseMetricSpec.
Note that all the setters affecting metric_spec are
mutually exclusive.
§Example
use google_cloud_aiplatform_v1::model::PairwiseMetricSpec;
let x = Metric::new().set_pairwise_metric_spec(PairwiseMetricSpec::default()/* use setters */);
assert!(x.pairwise_metric_spec().is_some());
assert!(x.predefined_metric_spec().is_none());
assert!(x.computation_based_metric_spec().is_none());
assert!(x.llm_based_metric_spec().is_none());
assert!(x.pointwise_metric_spec().is_none());
assert!(x.exact_match_spec().is_none());
assert!(x.bleu_spec().is_none());
assert!(x.rouge_spec().is_none());Sourcepub fn exact_match_spec(&self) -> Option<&Box<ExactMatchSpec>>
pub fn exact_match_spec(&self) -> Option<&Box<ExactMatchSpec>>
The value of metric_spec
if it holds a ExactMatchSpec, None if the field is not set or
holds a different branch.
Sourcepub fn set_exact_match_spec<T: Into<Box<ExactMatchSpec>>>(self, v: T) -> Self
pub fn set_exact_match_spec<T: Into<Box<ExactMatchSpec>>>(self, v: T) -> Self
Sets the value of metric_spec
to hold a ExactMatchSpec.
Note that all the setters affecting metric_spec are
mutually exclusive.
§Example
use google_cloud_aiplatform_v1::model::ExactMatchSpec;
let x = Metric::new().set_exact_match_spec(ExactMatchSpec::default()/* use setters */);
assert!(x.exact_match_spec().is_some());
assert!(x.predefined_metric_spec().is_none());
assert!(x.computation_based_metric_spec().is_none());
assert!(x.llm_based_metric_spec().is_none());
assert!(x.pointwise_metric_spec().is_none());
assert!(x.pairwise_metric_spec().is_none());
assert!(x.bleu_spec().is_none());
assert!(x.rouge_spec().is_none());Sourcepub fn bleu_spec(&self) -> Option<&Box<BleuSpec>>
pub fn bleu_spec(&self) -> Option<&Box<BleuSpec>>
The value of metric_spec
if it holds a BleuSpec, None if the field is not set or
holds a different branch.
Sourcepub fn set_bleu_spec<T: Into<Box<BleuSpec>>>(self, v: T) -> Self
pub fn set_bleu_spec<T: Into<Box<BleuSpec>>>(self, v: T) -> Self
Sets the value of metric_spec
to hold a BleuSpec.
Note that all the setters affecting metric_spec are
mutually exclusive.
§Example
use google_cloud_aiplatform_v1::model::BleuSpec;
let x = Metric::new().set_bleu_spec(BleuSpec::default()/* use setters */);
assert!(x.bleu_spec().is_some());
assert!(x.predefined_metric_spec().is_none());
assert!(x.computation_based_metric_spec().is_none());
assert!(x.llm_based_metric_spec().is_none());
assert!(x.pointwise_metric_spec().is_none());
assert!(x.pairwise_metric_spec().is_none());
assert!(x.exact_match_spec().is_none());
assert!(x.rouge_spec().is_none());Sourcepub fn rouge_spec(&self) -> Option<&Box<RougeSpec>>
pub fn rouge_spec(&self) -> Option<&Box<RougeSpec>>
The value of metric_spec
if it holds a RougeSpec, None if the field is not set or
holds a different branch.
Sourcepub fn set_rouge_spec<T: Into<Box<RougeSpec>>>(self, v: T) -> Self
pub fn set_rouge_spec<T: Into<Box<RougeSpec>>>(self, v: T) -> Self
Sets the value of metric_spec
to hold a RougeSpec.
Note that all the setters affecting metric_spec are
mutually exclusive.
§Example
use google_cloud_aiplatform_v1::model::RougeSpec;
let x = Metric::new().set_rouge_spec(RougeSpec::default()/* use setters */);
assert!(x.rouge_spec().is_some());
assert!(x.predefined_metric_spec().is_none());
assert!(x.computation_based_metric_spec().is_none());
assert!(x.llm_based_metric_spec().is_none());
assert!(x.pointwise_metric_spec().is_none());
assert!(x.pairwise_metric_spec().is_none());
assert!(x.exact_match_spec().is_none());
assert!(x.bleu_spec().is_none());