GenerateContentResponse class final
Represents a response from a content generation request.
This class wraps the response from an AI model's content generation, containing one or more candidate responses that the model has generated. Each candidate represents a possible completion or response.
Example usage:
final response = GenerateContentResponse.fromBuffer(responseBuffer);
final generatedText = response.text;
final functionCall = response.functionCall;
Constructors
-
GenerateContentResponse({required List<
Candidate> candidates}) -
Creates a new GenerateContentResponse with the given candidates.
const
- GenerateContentResponse.fromBuffer(Uint8List buffer)
-
Creates a GenerateContentResponse from a binary buffer.
factory
- GenerateContentResponse.fromProto(GenerateContentResponse proto)
-
Creates a GenerateContentResponse from a protobuf message.
factory
Properties
-
candidates
→ List<
Candidate> -
The list of candidate responses generated by the model.
final
- functionCall → FunctionCall?
-
Gets the function call from the first candidate's first part.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- text → String?
-
Gets the text content from the first candidate's first part.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited