if (FALSE) {
Sys.setenv(OPENAI_API_KEY = "sk-xxxxxx")
run <- create_run(
thread_id = "thread_abc123",
assistant_id = "asst_abc123"
)
cat("Run ID:", run$id, "Status:", run$status)
# Poll until done
repeat {
run <- retrieve_run("thread_abc123", run$id)
if (run$status %in% c("completed", "failed", "cancelled")) break
Sys.sleep(2)
}
}
Run the code above in your browser using DataLab