Tool.fromJson constructor

Tool.fromJson(
  1. Object? j
)

Implementation

factory Tool.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Tool(
    functionDeclarations: switch (json['functionDeclarations']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) FunctionDeclaration.fromJson(i),
      ],
      _ => throw const FormatException(
        '"functionDeclarations" is not a list',
      ),
    },
    googleSearchRetrieval: switch (json['googleSearchRetrieval']) {
      null => null,
      Object $1 => GoogleSearchRetrieval.fromJson($1),
    },
    codeExecution: switch (json['codeExecution']) {
      null => null,
      Object $1 => CodeExecution.fromJson($1),
    },
    googleSearch: switch (json['googleSearch']) {
      null => null,
      Object $1 => Tool_GoogleSearch.fromJson($1),
    },
    computerUse: switch (json['computerUse']) {
      null => null,
      Object $1 => Tool_ComputerUse.fromJson($1),
    },
    urlContext: switch (json['urlContext']) {
      null => null,
      Object $1 => UrlContext.fromJson($1),
    },
  );
}