if (FALSE) {
Sys.setenv(OPENAI_API_KEY = "sk-xxxxxx")
# Simple text response
resp <- create_response(
model = "gpt-4o",
input = "What is the difference between OLS and IV?"
)
cat(resp$output[[1]]$content[[1]]$text)
# Multi-turn: continue conversation using previous response ID
resp1 <- create_response("gpt-4o", "What is GMM?")
resp2 <- create_response(
model = "gpt-4o",
input = "Give me an R code example.",
previous_response_id = resp1$id
)
cat(resp2$output[[1]]$content[[1]]$text)
}
Run the code above in your browser using DataLab