You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, great package.
For the sake of reproducibility and for ease of continuing a chat, could the create_chat_completion() returned result object include the inputted settings (in particular the messages argument)?
The text was updated successfully, but these errors were encountered:
Hi @sda030, thanks for this. In principle, I can do it. However, I tried to be as consistent with the official Python package as possible. If I will return other objects, then it won't be inline.
I suggest keeping messages in a stand-alone variable:
library(openai)
messages <- list(
list(
"role" = "system",
"content" = "You are a helpful assistant."
),
list(
"role" = "user",
"content" = "Who won the world series in 2020?"
),
list(
"role" = "assistant",
"content" = "The Los Angeles Dodgers won the World Series in 2020."
),
list(
"role" = "user",
"content" = "Where was it played?"
)
)
response <- create_chat_completion(
model = "gpt-3.5-turbo",
messages = messages
)
Or even keeping it in one list:
library(openai)
chat <- list()
chat[["input_messages"]] <- list(
list(
"role" = "system",
"content" = "You are a helpful assistant."
),
list(
"role" = "user",
"content" = "Who won the world series in 2020?"
),
list(
"role" = "assistant",
"content" = "The Los Angeles Dodgers won the World Series in 2020."
),
list(
"role" = "user",
"content" = "Where was it played?"
)
)
chat[["reply"]] <- create_chat_completion(
model = "gpt-3.5-turbo",
messages = chat[["input_messages"]]
)
Hi, great package.
For the sake of reproducibility and for ease of continuing a chat, could the
create_chat_completion()
returned result object include the inputted settings (in particular the messages argument)?The text was updated successfully, but these errors were encountered: