TunedModel.fromJson constructor

TunedModel.fromJson(
  1. Object? j
)

Implementation

factory TunedModel.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return TunedModel(
    tunedModelSource: switch (json['tunedModelSource']) {
      null => null,
      Object $1 => TunedModelSource.fromJson($1),
    },
    baseModel: switch (json['baseModel']) {
      null => null,
      Object $1 => decodeString($1),
    },
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    displayName: switch (json['displayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => '',
      Object $1 => decodeString($1),
    },
    temperature: switch (json['temperature']) {
      null => null,
      Object $1 => decodeDouble($1),
    },
    topP: switch (json['topP']) {
      null => null,
      Object $1 => decodeDouble($1),
    },
    topK: switch (json['topK']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    state: switch (json['state']) {
      null => TunedModel_State.$default,
      Object $1 => TunedModel_State.fromJson($1),
    },
    createTime: switch (json['createTime']) {
      null => null,
      Object $1 => Timestamp.fromJson($1),
    },
    updateTime: switch (json['updateTime']) {
      null => null,
      Object $1 => Timestamp.fromJson($1),
    },
    tuningTask: switch (json['tuningTask']) {
      null => null,
      Object $1 => TuningTask.fromJson($1),
    },
    readerProjectNumbers: switch (json['readerProjectNumbers']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeInt64(i)],
      _ => throw const FormatException(
        '"readerProjectNumbers" is not a list',
      ),
    },
  );
}