TunedModel.fromJson constructor

TunedModel.fromJson(
  1. Object? j
)

Implementation

factory TunedModel.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return TunedModel(
    model: switch (json['model']) {
      null => '',
      Object $1 => decodeString($1),
    },
    endpoint: switch (json['endpoint']) {
      null => '',
      Object $1 => decodeString($1),
    },
    checkpoints: switch (json['checkpoints']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) TunedModelCheckpoint.fromJson(i),
      ],
      _ => throw const FormatException('"checkpoints" is not a list'),
    },
  );
}