toPublic method

Candidate toPublic()

Maps the internal Candidate to the external Candidate.

Implementation

public_types.Candidate toPublic() {
  final safetyRatings = this.safetyRatings?.map((rating) => rating.toPublic()).toList() ?? [];
  final citations = citationMetadata?.citationSources?.map((source) => source.toPublic()).toList() ?? [];
  final finishReason = this.finishReason!.toPublic();

  return public_types.Candidate(
    content : content?.toPublic() ?? public_types.content(role : "model",init :  (b) {}),
   safetyRatings:  safetyRatings,
   citationMetadata:  citations,
   finishReason:  finishReason,
  );
}