Merged
Conversation
… a batch of requests and managing them
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
export relevant functions
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
add (batch) to vignette name
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 rowoai_batch_prepare_embeddings()- Prepare an entire data frame for batch embeddingsoai_batch_build_completions_req()- Build a single chat completions request rowoai_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 APIoai_batch_start()- Trigger a batch job on an uploaded fileoai_batch_status()- Check the status of a running batch joboai_batch_list()- List all batch jobs associated with your API keyoai_batch_cancel()- Cancel an in-progress batch jobResults parsing:
oai_batch_parse_embeddings()- Parse batch embedding results into a tidy data frameoai_batch_parse_completions()- Parse batch completion results into a tidy data frame