Retrieve batch results
Value
(list) if simplify is TRUE, a list of the batch results; otherwise, a list of the full responses.
Details
For more information, see the OpenAI API documentation.
See also
Other batches:
batch_cancel()
,
batch_create()
,
batch_list()
,
batch_status()
,
file_upload()
Examples
if (FALSE) {
batch_file_info <- file_upload("abc123.jsonl")
batch_job_info <- batch_file_info[["id"]] |>
batch_create()
batch_status <- batch_job_info[["id"]] |>
batch_status()
# once the batch is completed
if (batch_status[["status"]] == "completed") {
results <- batch_status[["id"]] |>
batch_result()
res <- results |>
purrr::map_chr(get_content)
res
}
full_results <- batch_status[["id"]] |>
batch_result(simplify = FALSE)
str(full_results, 2)
full_res <- full_results |>
purrr::map_chr(\(x) get_content(x[["response"]][["body"]]))
full_res
identical(res, full_res)
}