Skip to contents

This function takes a response object or a chatlog object as input and returns the messages. If the input is a response object, the function extracts and returns the messages from the choices. If the input is a chatlog object, the function returns the messages directly.

Usage

messages(x)

Arguments

x

A list representing a response object or a chatlog object

Value

A data.frame containing the messages

Examples

if (FALSE) {
# Using a response object
response <- list(choices = list(message = "This is a message."))
messages_from_response <- messages(response)
print(messages_from_response)

# Using a chatlog object
chatlog_id <- chat("Hello, how are you?")
chatlog <- get_chatlog(chatlog_id)
messages_from_chatlog <- messages(chatlog)
print(messages_from_chatlog)
}