AsyncRetrieveContextsRequest.fromJson constructor

AsyncRetrieveContextsRequest.fromJson(
  1. Object? j
)

Implementation

factory AsyncRetrieveContextsRequest.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return AsyncRetrieveContextsRequest(
    parent: switch (json['parent']) {
      null => '',
      Object $1 => decodeString($1),
    },
    query: switch (json['query']) {
      null => null,
      Object $1 => RagQuery.fromJson($1),
    },
    tools: switch (json['tools']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Tool.fromJson(i)],
      _ => throw const FormatException('"tools" is not a list'),
    },
  );
}