Skip to contents

This function sets up a new chatlog object for a conversation.

Usage

set_chatlog(
  initial_role = "system",
  initial_content = "You are a helpful assistant.",
  chatlog_id = NULL
)

Arguments

initial_role

A character string representing the role issueing the initial content (per default: "system")

initial_content

A character string representing the initial message from the system

chatlog_id

A character string representing the ID of this conversation. Per default, this will be set automatically.

Value

A new chatlog object

Examples

chat <- set_chatlog("Welcome to our chat!")
is_chatlog(chat)
#> [1] TRUE
chat
#> An object of class "chatlog"
#> Slot "messages":
#>                   role                      content
#> 1 Welcome to our chat! You are a helpful assistant.
#> 
#> Slot "chatlog_id":
#> [1] ".chatlog_20230814200410"
#>