pub struct Batches<'c, C: Config> { /* private fields */ }
Expand description
Create large batches of API requests for asynchronous processing. The Batch API returns completions within 24 hours for a 50% discount.
Related guide: Batch
Implementations§
Source§impl<'c, C: Config> Batches<'c, C>
impl<'c, C: Config> Batches<'c, C>
pub fn new(client: &'c Client<C>) -> Self
Sourcepub async fn create(&self, request: BatchRequest) -> Result<Batch, OpenAIError>
pub async fn create(&self, request: BatchRequest) -> Result<Batch, OpenAIError>
Creates and executes a batch from an uploaded file of requests Creates and executes a batch from an uploaded file of requests
Sourcepub async fn create_byot<T0: Serialize, R: DeserializeOwned>(
&self,
request: T0,
) -> Result<R, OpenAIError>
pub async fn create_byot<T0: Serialize, R: DeserializeOwned>( &self, request: T0, ) -> Result<R, OpenAIError>
Creates and executes a batch from an uploaded file of requests
Sourcepub async fn list<Q>(
&self,
query: &Q,
) -> Result<ListBatchesResponse, OpenAIError>
pub async fn list<Q>( &self, query: &Q, ) -> Result<ListBatchesResponse, OpenAIError>
List your organization’s batches. List your organization’s batches.
Sourcepub async fn list_byot<T0: Serialize, R: DeserializeOwned>(
&self,
query: T0,
) -> Result<R, OpenAIError>
pub async fn list_byot<T0: Serialize, R: DeserializeOwned>( &self, query: T0, ) -> Result<R, OpenAIError>
List your organization’s batches.
Sourcepub async fn retrieve(&self, batch_id: &str) -> Result<Batch, OpenAIError>
pub async fn retrieve(&self, batch_id: &str) -> Result<Batch, OpenAIError>
Retrieves a batch. Retrieves a batch.
Sourcepub async fn retrieve_byot<T0: Display, R: DeserializeOwned>(
&self,
batch_id: T0,
) -> Result<R, OpenAIError>
pub async fn retrieve_byot<T0: Display, R: DeserializeOwned>( &self, batch_id: T0, ) -> Result<R, OpenAIError>
Retrieves a batch.
Sourcepub async fn cancel(&self, batch_id: &str) -> Result<Batch, OpenAIError>
pub async fn cancel(&self, batch_id: &str) -> Result<Batch, OpenAIError>
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.
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.
Sourcepub async fn cancel_byot<T0: Display, R: DeserializeOwned>(
&self,
batch_id: T0,
) -> Result<R, OpenAIError>
pub async fn cancel_byot<T0: Display, R: DeserializeOwned>( &self, batch_id: T0, ) -> Result<R, OpenAIError>
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.