Skip to contents

This function clears a chat log, leaving only its system messages (none, if it has none). To remove the log altogether, use delete_chatlog().

Usage

clear_chatlog(chatlog_id = ".__CURRENTCHAT__")

Arguments

chatlog_id

character string indicating the name of the chat log to clear, or a chatlog object. Default is ".__CURRENTCHAT__", the log of chat().

Value

The cleared chatlog object, invisibly. It is also stored under chatlog_id.

Author

Ulrich Matter umatter@protonmail.com

Examples

start_chat(initial_content = "You are terse.", chatlog_id = "demo")
#> Chatlog ID: demo
#>     role        content
#> 1 system You are terse.
add_to_chatlog(data.frame(role = c("user", "assistant"),
  content = c("Hi", "Hello.")), chatlog_id = "demo")
#> Chatlog ID: demo
#>        role        content
#> 1    system You are terse.
#> 2      user             Hi
#> 3 assistant         Hello.
cleared <- clear_chatlog("demo")
cleared@messages
#>     role        content
#> 1 system You are terse.