ChatCompletionResponse class

ChatCompletionResponse is the response body for the chat completion endpoint.

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "\n\nHello there, how may I assist you today?",
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 12,
    "total_tokens": 21
  }
}
Annotations
  • @freezed

Constructors

ChatCompletionResponse({required List<ChatChoice> choices, required String id, required String object, required int created, String? systemFingerprint, ChatCompletionUsage? usage})
const
factory
ChatCompletionResponse.fromJson(Map<String, Object?> json)
factory

Properties

choices List<ChatChoice>
The list of choices for the completion.
no setterinherited
copyWith → $ChatCompletionResponseCopyWith<ChatCompletionResponse>
no setterinherited
created int
The time the completion was created.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
id String
The ID of the completion.
no setterinherited
object String
The object type, which is always chat.completion.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
systemFingerprint String?
This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the seed request parameter to understand when backend
no setterinherited
usage ChatCompletionUsage?
The usage statistics for the completion.
no setterinherited

Methods

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

Operators

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