Chat History Save
chat.history.save

R Package "GenAI" Documentation

CRAN Open in GitHub Open In Colab

Last update: 2024/02/15


Usage

chat.history.save(genai.object, file.name)

Arguments

  • genai.object: A generative AI object containing necessary and correct information.
  • file.name: A character string representing the name of the JSON file for the chat history.

Value

If successful, the chat history will be saved as a JSON file in your current or specified directory.


Description

This function saves a chat history along with a generative AI object as a JSON file.


Details

Providing accurate and valid information for each argument is crucial for successful chat generation by the generative AI model. If any parameter is incorrect, the function responds with an error message based on the API feedback. To view all supported generative AI models, use the function available.models.


Examples

Open In Colab
# Method 1 (recommended): use the pipe operator "%>%"
genai.model %>%
  chat.history.save(file.name = "saved_history")

# Method 2: use the reference operator "$"
genai.model$chat.history.save(file.name = "saved_history")

# Method 3: use the function chat.history.save() directly
chat.history.save(genai.object = genai.model,
                  file.name = "saved_history")