Chat History Convert
chat.history.convert

R Package "GenAI" Documentation

CRAN Open in GitHub Open In Colab

Last update: 2024/02/15


Usage

chat.history.convert(from.genai.object, to.genai.object)

Arguments

  • from.genai.object: A source generative AI object containing necessary and correct information.
  • to.genai.object: A target generative AI object containing necessary and correct information.

Value

If successful, the converted chat history list will be returned.


Description

This function converts the chat history along with a generative AI object to a valid format for another generative AI object.


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. Moreover, you can print out the chat history using the function chat.history.print or simply use verbose = TRUE during the chat.


Examples

Open In Colab
# Method 1 (recommended): use the pipe operator "%>%"
converted.history = genai.model %>%
  chat.history.convert(to.genai.object = another.genai.model)

# Method 2: use the reference operator "$"
converted.history = genai.model$chat.history.convert(to.genai.object = another.genai.model)

# Method 3: use the function chat.history.convert() directly
converted.history = chat.history.convert(from.genai.object = genai.model,
                                         to.genai.object = another.genai.model)