Skip to content

Dev#39

Merged
jpcompartir merged 40 commits intomainfrom
dev
Jan 14, 2026
Merged

Dev#39
jpcompartir merged 40 commits intomainfrom
dev

Conversation

@jpcompartir
Copy link
Owner

OpenAI Batch API

Adds support for OpenAI's asynchronous Batch API, offering 50% cost savings and higher rate limits compared to synchronous endpoints. Ideal for large-scale embeddings, classifications, and batch inference tasks.

Request preparation:

  • oai_batch_build_embed_req() - Build a single embedding request row
  • oai_batch_prepare_embeddings() - Prepare an entire data frame for batch embeddings
  • oai_batch_build_completions_req() - Build a single chat completions request row
  • oai_batch_prepare_completions() - Prepare an entire data frame for batch completions (supports structured outputs via JSON schema)

Job management:

  • oai_batch_upload() - Upload prepared JSONL to OpenAI Files API
  • oai_batch_start() - Trigger a batch job on an uploaded file
  • oai_batch_status() - Check the status of a running batch job
  • oai_batch_list() - List all batch jobs associated with your API key
  • oai_batch_cancel() - Cancel an in-progress batch job

Results parsing:

  • oai_batch_parse_embeddings() - Parse batch embedding results into a tidy data frame
  • oai_batch_parse_completions() - Parse batch completion results into a tidy data frame
  • some docs, vignettes, README bits and pieces

add vignette to pkgdown (funcs later)
start batch api implementation
add tests for oai_batch_build_embed_row
continue vignette
add dev_doc for batch API
add chunk for progress for batches and files
but may revise this to oai_file_upload
…ity/potential future development)

add dev_docs for batch api
…n is file = batch job output, but it doesn't have to be that way.
oai_batch_prepare_embeddings, otherwise API rejects the requests
add cancel function for batches
…completions

Add start of Roxygen2 docs for Embeddings + some of the batch handlers (will add examples when happy/code is final)
export batch and files functions
update sync v async vignette
lean on @inheritParams for brevity/redude duplication
update NEWS.md to summarise batch/files implementation
…e) in openai_batch_api.R in prep and req funcs for Completions API

Add test case
Link to sync v a sync vignette on README
build readme.md()
rename oai_batch_create -> oai_batch_start
create oai_file_upload func, and then call it in oai_batch_upload
add tests for input args
rename test file  for openai_batch_api.R
add endpoint_url argument to file/batch funcs (future proofing)
make sure purpose has match.args where it's called
export oai_batch_upload
add examples and return for oai_file_upload
catch a 'watch' -> 'each' typo in README
add custom_id to globals
fix error_message -> error_msg in HF vignette
change .error_message in df_sentiment_classification_example to .error_msg and then overwrite package data
and in df_embeddings_hf data
add oai_file_upload to _pkgdown.yml
@jpcompartir jpcompartir mentioned this pull request Jan 14, 2026
@jpcompartir jpcompartir merged commit 0188f8e into main Jan 14, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant