Chat class

Representation of a back and forth interaction with a model.

Handles the capturing and storage of the communication with the model, providing methods for further interaction.

Note: This object is not thread-safe, and calling sendMessage multiple times without waiting for a response will throw an InvalidStateException.

Constructors

Chat(GenerativeModel model, {required List<Content> history})
Creates a Chat instance.

Properties

hashCode int
The hash code for this object.
no setterinherited
history List<Content>
final
model GenerativeModel
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendMessage(Content prompt) Future<GenerateContentResponse>
Generates a response from the backend with the provided Content, and any previous ones sent/returned from this chat.
sendMessageImage(Uint8List prompt) Future<GenerateContentResponse>
Generates a response from the backend with the provided image represented Content.
sendMessageImageStream(Uint8List prompt) Future<Stream<GenerateContentResponse>>
Generates a streaming response from the backend with the provided image represented Content.
sendMessageStream(Content prompt) Future<Stream<GenerateContentResponse>>
Generates a streaming response from the backend with the provided Contents.
sendMessageText(String prompt) Future<GenerateContentResponse>
Generates a response from the backend with the provided text represented Content.
sendMessageTextStream(String prompt) Future<Stream<GenerateContentResponse>>
Generates a streaming response from the backend with the provided text represented Content.
toString() String
A string representation of this object.
inherited

Operators

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