NAME

OpenAI::API::Response::Chat - encapsulate the response from the OpenAI Chat API.

SYNOPSIS

This module should not be used directly. It will be used by OpenAI::API::Request::Chat to parse and encapsulate the response.

DESCRIPTION

OpenAI::API::Response::Chat extends the OpenAI::API::Response superclass and is used to encapsulate the response from the OpenAI Chat API.

ATTRIBUTES

id

The unique identifier of the chat completion.

object

The type of the object, which is "chat.completion" for this module.

created

The timestamp when the chat completion was created.

choices

An arrayref containing the chat completion choices.

usage

A hashref containing the tokens usage information.

STRING OVERLOAD

This module uses overload to provide string representation for the response object. When the object is used as a string, it will automatically return the content of the message in the first choice of the choices arrayref.

SEE ALSO

OpenAI::API::Request::Chat, OpenAI::API::Response