View Source ExOpenAI.Batches (ex_openai.ex v1.8.0-beta)
Modules for interacting with the batches group of OpenAI APIs
API Reference: https://platform.openai.com/docs/api-reference/batches
Summary
Functions
Cancels an in-progress batch. The batch will be in status cancelling for up to 10 minutes, before changing to cancelled, where it will have partial results (if any) available in the output file.
Creates and executes a batch from an uploaded file of requests
List your organization's batches.
Retrieves a batch.
Functions
@spec cancel_batch(String.t(), base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t() ) :: {:ok, ExOpenAI.Components.Batch.t()} | {:error, any()}
Cancels an in-progress batch. The batch will be in status cancelling for up to 10 minutes, before changing to cancelled, where it will have partial results (if any) available in the output file.
Endpoint: https://api.openai.com/v1/batches/{batch_id}/cancel
Method: POST
Docs: https://platform.openai.com/docs/api-reference/batches
Required Arguments:
batch_id
Optional Arguments:
openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override theapi_keyconfig value."openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override theorganization_keyconfig value."base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"
@spec create_batch( base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t() ) :: {:ok, ExOpenAI.Components.Batch.t()} | {:error, any()}
Creates and executes a batch from an uploaded file of requests
Endpoint: https://api.openai.com/v1/batches
Method: POST
Docs: https://platform.openai.com/docs/api-reference/batches
Required Arguments:
Optional Arguments:
openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override theapi_keyconfig value."openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override theorganization_keyconfig value."base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"
@spec list_batches( base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t(), limit: integer(), after: String.t(), stream_to: (... -> any()) | pid() ) :: {:ok, ExOpenAI.Components.ListBatchesResponse.t()} | {:error, any()}
List your organization's batches.
Endpoint: https://api.openai.com/v1/batches
Method: GET
Docs: https://platform.openai.com/docs/api-reference/batches
Required Arguments:
Optional Arguments:
stream_to: "PID or function of where to stream content to"afterlimitopenai_api_key: "OpenAI API key to pass directly. If this is specified, it will override theapi_keyconfig value."openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override theorganization_keyconfig value."base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"
@spec retrieve_batch(String.t(), base_url: String.t(), openai_organization_key: String.t(), openai_api_key: String.t() ) :: {:ok, ExOpenAI.Components.Batch.t()} | {:error, any()}
Retrieves a batch.
Endpoint: https://api.openai.com/v1/batches/{batch_id}
Method: GET
Docs: https://platform.openai.com/docs/api-reference/batches
Required Arguments:
batch_id
Optional Arguments:
openai_api_key: "OpenAI API key to pass directly. If this is specified, it will override theapi_keyconfig value."openai_organization_key: "OpenAI API key to pass directly. If this is specified, it will override theorganization_keyconfig value."base_url: "Which API endpoint to use as base, defaults to https://api.openai.com/v1"