if (FALSE) {
library(openaiRtools)
client <- OpenAI$new(api_key = "sk-xxxxxx")
# Send a local chart image
img <- image_from_file("results/regression_plot.png", detail = "high")
messages <- list(
list(
role = "user",
content = list(
list(
type = "text",
text = "This is a residuals-vs-fitted plot. Does it show heteroskedasticity?"
),
img
)
)
)
response <- client$chat$completions$create(
messages = messages,
model = "gpt-4o"
)
cat(response$choices[[1]]$message$content)
}
Run the code above in your browser using DataLab