Metric.fromJson constructor
Metric.fromJson(
- Object? j
Implementation
factory Metric.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return Metric(
predefinedMetricSpec: switch (json['predefinedMetricSpec']) {
null => null,
Object $1 => PredefinedMetricSpec.fromJson($1),
},
computationBasedMetricSpec: switch (json['computationBasedMetricSpec']) {
null => null,
Object $1 => ComputationBasedMetricSpec.fromJson($1),
},
llmBasedMetricSpec: switch (json['llmBasedMetricSpec']) {
null => null,
Object $1 => LlmbasedMetricSpec.fromJson($1),
},
pointwiseMetricSpec: switch (json['pointwiseMetricSpec']) {
null => null,
Object $1 => PointwiseMetricSpec.fromJson($1),
},
pairwiseMetricSpec: switch (json['pairwiseMetricSpec']) {
null => null,
Object $1 => PairwiseMetricSpec.fromJson($1),
},
exactMatchSpec: switch (json['exactMatchSpec']) {
null => null,
Object $1 => ExactMatchSpec.fromJson($1),
},
bleuSpec: switch (json['bleuSpec']) {
null => null,
Object $1 => BleuSpec.fromJson($1),
},
rougeSpec: switch (json['rougeSpec']) {
null => null,
Object $1 => RougeSpec.fromJson($1),
},
aggregationMetrics: switch (json['aggregationMetrics']) {
null => [],
List<Object?> $1 => [
for (final i in $1) Metric_AggregationMetric.fromJson(i),
],
_ => throw const FormatException('"aggregationMetrics" is not a list'),
},
);
}