CountTokensRequest.fromJson constructor
CountTokensRequest.fromJson(
- Object? j
Implementation
factory CountTokensRequest.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return CountTokensRequest(
model: switch (json['model']) {
null => '',
Object $1 => decodeString($1),
},
contents: switch (json['contents']) {
null => [],
List<Object?> $1 => [for (final i in $1) Content.fromJson(i)],
_ => throw const FormatException('"contents" is not a list'),
},
generateContentRequest: switch (json['generateContentRequest']) {
null => null,
Object $1 => GenerateContentRequest.fromJson($1),
},
);
}