ChatResponse class

Represents the response to a chat request.

A ChatResponse provides one or more response messages and metadata about the response. A typical response will contain a single message, however a response might contain multiple messages in a variety of scenarios. For example, if automatic function calling is employed, such that a single request to a chat client might actually generate multiple round-trips to an inner chat client it uses, all of the involved messages might be surfaced as part of the final ChatResponse.

Constructors

ChatResponse({List<ChatMessage>? messages, String? responseId, String? conversationId, String? modelId, DateTime? createdAt, ChatFinishReason? finishReason, UsageDetails? usage, ResponseContinuationToken? continuationToken, Object? rawRepresentation, AdditionalPropertiesDictionary? additionalProperties})
Creates a new ChatResponse.
ChatResponse.fromMessage(ChatMessage message)
Creates a ChatResponse with a single message.

Properties

additionalProperties AdditionalPropertiesDictionary?
Additional properties.
getter/setter pair
continuationToken ResponseContinuationToken?
A token to resume an interrupted response.
getter/setter pair
conversationId String?
A conversation state identifier.
getter/setter pair
createdAt DateTime?
When the response was created.
getter/setter pair
finishReason ChatFinishReason?
The reason the response finished being generated.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
messages List<ChatMessage>
The response messages.
final
modelId String?
The model that generated this response.
getter/setter pair
rawRepresentation Object?
The underlying implementation-specific object.
getter/setter pair
responseId String?
A unique identifier for the response.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
text String
Gets concatenated text from the last message's TextContent items.
no setter
usage UsageDetails?
Usage details for the request/response.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toChatResponseUpdates() List<ChatResponseUpdate>
Converts this response into a list of ChatResponseUpdates.
toString() String
A string representation of this object.
override

Operators

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