Learn R Programming

tidyprompt (version 0.0.1)

chat_history.data.frame: Method for chat_history() when the input is a data.frame

Description

Creates a chat_history object from a data frame.

Usage

# S3 method for data.frame
chat_history(chat_history)

Value

A valid chat history data.frame (of class chat_history), with the 'role' and 'content' columns as specified in the input data frame

Arguments

chat_history

A data frame with 'role' and 'content' columns, where 'role' is either 'user', 'assistant', or 'system', and 'content' is a character string representing a chat message