CountTokensRequest.fromJson constructor

CountTokensRequest.fromJson(
  1. Map<String, dynamic> json
)

Creates a CountTokensRequest from JSON.

Implementation

factory CountTokensRequest.fromJson(Map<String, dynamic> json) =>
    CountTokensRequest(
      contents: json['contents'] != null
          ? (json['contents'] as List)
                .map((e) => Content.fromJson(e as Map<String, dynamic>))
                .toList()
          : null,
      generateContentRequest: json['generateContentRequest'] != null
          ? GenerateContentRequest.fromJson(
              json['generateContentRequest'] as Map<String, dynamic>,
            )
          : null,
      systemInstruction: json['system_instruction'] != null
          ? Content.fromJson(
              json['system_instruction'] as Map<String, dynamic>,
            )
          : null,
    );