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.createEmbeddings(String model, EmbeddingsBatchJobSource src, CreateEmbeddingsBatchJobConfig config) Makes an API request to create the batch embeddings 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- AGetBatchJobConfigfor configuring the get request.- Returns:
- A
BatchJobobject 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- ACancelBatchJobConfigfor 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- ADeleteBatchJobConfigfor 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- TheBatchJobSourceof the batch job.config- The configurationCreateBatchJobConfigfor the batch job.- Returns:
- A future that resolves to the batch job.
-
createEmbeddings
public CompletableFuture<BatchJob> createEmbeddings(String model, EmbeddingsBatchJobSource src, CreateEmbeddingsBatchJobConfig config) Makes an API request to create the batch embeddings job.This method is experimental.
- Parameters:
model- the name of the GenAI model to use for generationsrc- TheEmbeddingsBatchJobSourceof the batch job.config- The configurationCreateEmbeddingsBatchJobConfigfor the batch job.- Returns:
- A BatchJob.
-
list
Asynchronously makes an API request to list the available batch jobs.- Parameters:
config- AListBatchJobsConfigfor 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.
-