Package com.google.genai
Class Batches
java.lang.Object
com.google.genai.Batches
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel(String name, CancelBatchJobConfig config) Cancels a batch job resource.create(String model, BatchJobSource src, CreateBatchJobConfig config) Makes an API request to create the batch job.createEmbeddings(String model, EmbeddingsBatchJobSource src, CreateEmbeddingsBatchJobConfig config) Makes an API request to create the batch embeddings job.delete(String name, DeleteBatchJobConfig config) Deletes a batch job resource.get(String name, GetBatchJobConfig config) Gets a batch job resource.list(ListBatchJobsConfig config) Makes an API request to list the available batch jobs.
-
Constructor Details
-
Batches
public Batches(com.google.genai.ApiClient apiClient)
-
-
Method Details
-
get
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
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
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
Makes an API request to create the batch job.- Parameters:
model- the name of the GenAI model to use for generationsrc- TheBatchJobSourceof the batch job.config- The configurationCreateBatchJobConfigfor the batch job.- Returns:
- A BatchJob.
-
createEmbeddings
public 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
Makes an API request to list the available batch jobs.- Parameters:
config- AListBatchJobsConfigfor configuring the list request.- Returns:
- A
Pagerobject that contains the list of batch jobs. The pager is an iterable and automatically queries the next page once the current page is exhausted.
-