TuningJob.fromJson constructor

TuningJob.fromJson(
  1. Object? j
)

Implementation

factory TuningJob.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return TuningJob(
    baseModel: switch (json['baseModel']) {
      null => null,
      Object $1 => decodeString($1),
    },
    preTunedModel: switch (json['preTunedModel']) {
      null => null,
      Object $1 => PreTunedModel.fromJson($1),
    },
    supervisedTuningSpec: switch (json['supervisedTuningSpec']) {
      null => null,
      Object $1 => SupervisedTuningSpec.fromJson($1),
    },
    distillationSpec: switch (json['distillationSpec']) {
      null => null,
      Object $1 => DistillationSpec.fromJson($1),
    },
    partnerModelTuningSpec: switch (json['partnerModelTuningSpec']) {
      null => null,
      Object $1 => PartnerModelTuningSpec.fromJson($1),
    },
    veoTuningSpec: switch (json['veoTuningSpec']) {
      null => null,
      Object $1 => VeoTuningSpec.fromJson($1),
    },
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    tunedModelDisplayName: switch (json['tunedModelDisplayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => '',
      Object $1 => decodeString($1),
    },
    customBaseModel: switch (json['customBaseModel']) {
      null => '',
      Object $1 => decodeString($1),
    },
    state: switch (json['state']) {
      null => JobState.$default,
      Object $1 => JobState.fromJson($1),
    },
    createTime: switch (json['createTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    startTime: switch (json['startTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    endTime: switch (json['endTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    updateTime: switch (json['updateTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    error: switch (json['error']) {
      null => null,
      Object $1 => Status.fromJson($1),
    },
    labels: switch (json['labels']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"labels" is not an object'),
    },
    experiment: switch (json['experiment']) {
      null => '',
      Object $1 => decodeString($1),
    },
    tunedModel: switch (json['tunedModel']) {
      null => null,
      Object $1 => TunedModel.fromJson($1),
    },
    tuningDataStats: switch (json['tuningDataStats']) {
      null => null,
      Object $1 => TuningDataStats.fromJson($1),
    },
    pipelineJob: switch (json['pipelineJob']) {
      null => '',
      Object $1 => decodeString($1),
    },
    encryptionSpec: switch (json['encryptionSpec']) {
      null => null,
      Object $1 => EncryptionSpec.fromJson($1),
    },
    serviceAccount: switch (json['serviceAccount']) {
      null => '',
      Object $1 => decodeString($1),
    },
    outputUri: switch (json['outputUri']) {
      null => '',
      Object $1 => decodeString($1),
    },
    evaluateDatasetRuns: switch (json['evaluateDatasetRuns']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) EvaluateDatasetRun.fromJson(i),
      ],
      _ => throw const FormatException('"evaluateDatasetRuns" is not a list'),
    },
  );
}