powered by
Shortcut that creates an OpenAI client from the OPENAI_API_KEY environment variable and calls client$batch$create().
OPENAI_API_KEY
client$batch$create()
create_batch(input_file_id, endpoint, ...)
A batch object with $id and $status.
$id
$status
Character. Required. File ID of the uploaded JSONL batch input file (uploaded with purpose = "batch").
purpose = "batch"
Character. Required. API endpoint for each request. One of "/v1/chat/completions", "/v1/embeddings", "/v1/completions".
"/v1/chat/completions"
"/v1/embeddings"
"/v1/completions"
Additional parameters passed to BatchClient$create(), such as completion_window (default "24h") and metadata.
$create()
completion_window
"24h"
metadata
if (FALSE) { Sys.setenv(OPENAI_API_KEY = "sk-xxxxxx") batch <- create_batch( input_file_id = "file-abc123", endpoint = "/v1/chat/completions" ) cat("Batch ID:", batch$id) }
Run the code above in your browser using DataLab