Class Batches

java.lang.Object
com.google.genai.Batches

public final class Batches extends Object
Provides methods for managing the batch jobs. Instantiating this class is not required. After instantiating a Client, access methods through `client.batches.methodName(...)` directly.
  • Constructor Details

    • Batches

      public Batches(com.google.genai.ApiClient apiClient)
  • Method Details

    • get

      public BatchJob get(String name, GetBatchJobConfig config)
      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 - A GetBatchJobConfig for configuring the get request.
      Returns:
      A BatchJob object that contains the info of the batch job.
    • cancel

      public void cancel(String name, CancelBatchJobConfig config)
      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 - A CancelBatchJobConfig for configuring the cancel request.
    • delete

      public DeleteResourceJob delete(String name, DeleteBatchJobConfig config)
      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 - A DeleteBatchJobConfig for configuring the delete request.
    • create

      public BatchJob create(String model, BatchJobSource src, CreateBatchJobConfig config)
      Makes an API request to create the batch job.
      Parameters:
      model - the name of the GenAI model to use for generation
      src - The BatchJobSource of the batch job.
      config - The configuration CreateBatchJobConfig for the batch job.
      Returns:
      A BatchJob.
    • list

      public Pager<BatchJob> list(ListBatchJobsConfig config)
      Makes an API request to list the available batch jobs.
      Parameters:
      config - A ListBatchJobsConfig for configuring the list request.
      Returns:
      A Pager object that contains the list of batch jobs. The pager is an iterable and automatically queries the next page once the current page is exhausted.