DatasetStats.fromJson constructor

DatasetStats.fromJson(
  1. Object? j
)

Implementation

factory DatasetStats.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return DatasetStats(
    tuningDatasetExampleCount: switch (json['tuningDatasetExampleCount']) {
      null => 0,
      Object $1 => decodeInt64($1),
    },
    totalTuningCharacterCount: switch (json['totalTuningCharacterCount']) {
      null => 0,
      Object $1 => decodeInt64($1),
    },
    totalBillableCharacterCount:
        switch (json['totalBillableCharacterCount']) {
          null => 0,
          Object $1 => decodeInt64($1),
        },
    tuningStepCount: switch (json['tuningStepCount']) {
      null => 0,
      Object $1 => decodeInt64($1),
    },
    userInputTokenDistribution: switch (json['userInputTokenDistribution']) {
      null => null,
      Object $1 => DatasetDistribution.fromJson($1),
    },
    userOutputTokenDistribution:
        switch (json['userOutputTokenDistribution']) {
          null => null,
          Object $1 => DatasetDistribution.fromJson($1),
        },
    userMessagePerExampleDistribution:
        switch (json['userMessagePerExampleDistribution']) {
          null => null,
          Object $1 => DatasetDistribution.fromJson($1),
        },
    userDatasetExamples: switch (json['userDatasetExamples']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Content.fromJson(i)],
      _ => throw const FormatException('"userDatasetExamples" is not a list'),
    },
  );
}