GenerateInstanceRubricsRequest.fromJson constructor

GenerateInstanceRubricsRequest.fromJson(
  1. Object? j
)

Implementation

factory GenerateInstanceRubricsRequest.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return GenerateInstanceRubricsRequest(
    location: switch (json['location']) {
      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'),
    },
    predefinedRubricGenerationSpec:
        switch (json['predefinedRubricGenerationSpec']) {
          null => null,
          Object $1 => PredefinedMetricSpec.fromJson($1),
        },
    rubricGenerationSpec: switch (json['rubricGenerationSpec']) {
      null => null,
      Object $1 => RubricGenerationSpec.fromJson($1),
    },
    agentConfig: switch (json['agentConfig']) {
      null => null,
      Object $1 => EvaluationInstance_DeprecatedAgentConfig.fromJson($1),
    },
  );
}