Learn R Programming

TheOpenAIR (version 0.1.0)

messages: Extract messages from a response object or a chatlog object

Description

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)

Value

A data.frame containing the messages

Arguments

x

A list representing a response object or a chatlog object

Examples

Run this code
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)
}

Run the code above in your browser using DataLab