R/reset_chat_session.R

Defines functions reset_chat_session

Documented in reset_chat_session

#' Reset Chat Session
#'
#' This function is intended to be used with `ask_chatgpt`. If we are using `ask_chatgpt` to chat with ChatGPT, and
#' we want to start a new conversation, we must call `reset_chat_session`.
#'
#' @param system_role ChatGPT's role as an AI assistant.
#'
#' @export
#'
reset_chat_session <- function(system_role = "You are a helpful assistant.") {
  assign(
    "chat_session_messages", list(list(role = "system", content = system_role)),
    envir = .state
  )
}

Try the chatgpt package in your browser

Any scripts or data that you put into this service are public.

chatgpt documentation built on May 31, 2023, 6:54 p.m.