GenerateContentResponse class final

Response from the model supporting multiple candidate responses.

Safety ratings and content filtering are reported for both prompt in GenerateContentResponse.prompt_feedback and for each candidate in finish_reason and in safety_ratings. The API:

  • Returns either all requested candidates or none of them
  • Returns no candidates at all only if there was something wrong with the prompt (check prompt_feedback)
  • Reports feedback on each candidate in finish_reason and safety_ratings.

Constructors

GenerateContentResponse({List<Candidate> candidates = const [], GenerateContentResponse_PromptFeedback? promptFeedback, GenerateContentResponse_UsageMetadata? usageMetadata, String modelVersion = '', String responseId = ''})
GenerateContentResponse.fromJson(Object? j)
factory

Properties

candidates → List<Candidate>
Candidate responses from the model.
final
hashCode → int
The hash code for this object.
no setterinherited
modelVersion → String
Output only. The model version used to generate the response.
final
promptFeedback → GenerateContentResponse_PromptFeedback?
Returns the prompt's feedback related to the content filters.
final
qualifiedName → String
The fully qualified name of this message, i.e., google.protobuf.Duration or google.rpc.ErrorInfo.
finalinherited
responseId → String
Output only. response_id is used to identify each response.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
usageMetadata → GenerateContentResponse_UsageMetadata?
Output only. Metadata on the generation requests' token usage.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Object
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

fullyQualifiedName → const String