batch-mode-batch-client
This crate provides a client for interacting with OpenAI's batch processing API, allowing you to manage and download batch files asynchronously. It offers functionality for managing batch statuses, uploading files, and retrieving results after batch processing.
Features
- Create and manage batches: Create new batches for processing, retrieve batch details, and monitor batch status.
- Upload and retrieve files: Upload files for batch processing and retrieve file content after batch completion.
- Handle batch statuses: Automatically wait for batch completion and handle error cases such as batch failures or incomplete batches.
- Download output and error files: After batch completion, download the resulting output and error files.
Usage
Creating a New Client
use OpenAIClientHandle;
let client = new;
Creating a Batch
let batch = client.create_batch.await?;
Uploading a File
let file = client.upload_batch_file.await?;
Retrieving Batch Status
let batch = client.retrieve_batch.await?;
Downloading Files
use check_for_and_download_output_and_error_online;
check_for_and_download_output_and_error_online.await?;
Error Handling
This crate uses error-tree
for error management, providing structured errors such as BatchFailed
, BatchStillProcessing
, and other batch-related errors.
Requirements
OPENAI_API_KEY
environment variable must be set with your OpenAI API key.
License
This crate is licensed under the MIT License. See LICENSE for details.