Package com.google.genai
Class AsyncBatches
java.lang.Object
com.google.genai.AsyncBatches
Async module of
Batches
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncancel
(String name, CancelBatchJobConfig config) Asynchronously cancels a batch job resource.create
(String model, BatchJobSource src, CreateBatchJobConfig config) Asynchronously creates a batch job.delete
(String name, DeleteBatchJobConfig config) Asynchronously deletes a batch job resource.get
(String name, GetBatchJobConfig config) Asynchronously gets a batch job resource.list
(ListBatchJobsConfig config) Asynchronously makes an API request to list the available batch jobs.
-
Constructor Details
-
AsyncBatches
public AsyncBatches(com.google.genai.ApiClient apiClient)
-
-
Method Details
-
get
Asynchronously gets a batch job resource.- Parameters:
name
- A fully-qualified BatchJob resource name or ID. Example: "projects/.../locations/.../batchPredictionJobs/456" or "456" when project and location are initialized in the Vertex AI client. Or "batches/abc" using the Gemini Developer AI client.config
- AGetBatchJobConfig
for configuring the get request.- Returns:
- A
BatchJob
object that contains the info of the batch job.
-
cancel
Asynchronously cancels a batch job resource.- Parameters:
name
- A fully-qualified BatchJob resource name or ID. Example: "projects/.../locations/.../batchPredictionJobs/456" or "456" when project and location are initialized in the Vertex AI client. Or "batches/abc" using the Gemini Developer AI client.config
- ACancelBatchJobConfig
for configuring the cancel request.
-
delete
Asynchronously deletes a batch job resource.- Parameters:
name
- A fully-qualified BatchJob resource name or ID. Example: "projects/.../locations/.../batchPredictionJobs/456" or "456" when project and location are initialized in the Vertex AI client. Or "batches/abc" using the Gemini Developer AI client.config
- ADeleteBatchJobConfig
for configuring the delete request.
-
create
public CompletableFuture<BatchJob> create(String model, BatchJobSource src, CreateBatchJobConfig config) Asynchronously creates a batch job.- Parameters:
model
- the name of the GenAI model to use for batch generation.src
- TheBatchJobSource
of the batch job.config
- The configurationCreateBatchJobConfig
for the batch job.- Returns:
- A future that resolves to the batch job.
-
list
Asynchronously makes an API request to list the available batch jobs.- Parameters:
config
- AListBatchJobsConfig
for configuring the list request.- Returns:
- A CompletableFuture that resolves to a
AsyncPager
. The AsyncPager has a `forEach` method that can be used to asynchronously process items in the page and automatically query the next page once the current page is exhausted.
-