SupervisedTuningDataStats.fromJson constructor

SupervisedTuningDataStats.fromJson(
  1. Object? j
)

Implementation

factory SupervisedTuningDataStats.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return SupervisedTuningDataStats(
    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),
        },
    totalBillableTokenCount: switch (json['totalBillableTokenCount']) {
      null => 0,
      Object $1 => decodeInt64($1),
    },
    tuningStepCount: switch (json['tuningStepCount']) {
      null => 0,
      Object $1 => decodeInt64($1),
    },
    userInputTokenDistribution: switch (json['userInputTokenDistribution']) {
      null => null,
      Object $1 => SupervisedTuningDatasetDistribution.fromJson($1),
    },
    userOutputTokenDistribution:
        switch (json['userOutputTokenDistribution']) {
          null => null,
          Object $1 => SupervisedTuningDatasetDistribution.fromJson($1),
        },
    userMessagePerExampleDistribution:
        switch (json['userMessagePerExampleDistribution']) {
          null => null,
          Object $1 => SupervisedTuningDatasetDistribution.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'),
    },
    totalTruncatedExampleCount: switch (json['totalTruncatedExampleCount']) {
      null => 0,
      Object $1 => decodeInt64($1),
    },
    truncatedExampleIndices: switch (json['truncatedExampleIndices']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeInt64(i)],
      _ => throw const FormatException(
        '"truncatedExampleIndices" is not a list',
      ),
    },
    droppedExampleReasons: switch (json['droppedExampleReasons']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"droppedExampleReasons" is not a list',
      ),
    },
  );
}