Learn R Programming

GenAI (version 0.2.0)

chat.history.convert: Chat History Convert

Description

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

Usage

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

Value

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

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.

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.

See Also

Examples

Run this code
if (FALSE) {
# Assuming there are two GenAI objects named 'genai.model' and 'another.genai.model'
# supporting this function, please refer to the "Live Demo in Colab" above for
# real examples. The following examples are just some basic guidelines.

# 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)
}

Run the code above in your browser using DataLab