Table of Contents

Class Batches

Namespace
Google.GenAI
Assembly
Google.GenAI.dll
public sealed class Batches
Inheritance
Batches
Inherited Members

Constructors

Batches(ApiClient)

public Batches(ApiClient apiClient)

Parameters

apiClient ApiClient

Methods

CancelAsync(string, CancelBatchJobConfig?, CancellationToken)

Cancels a batch job resource.

public Task CancelAsync(string name, CancelBatchJobConfig? config = null, CancellationToken cancellationToken = default)

Parameters

name string

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 CancelBatchJobConfig

A CancelBatchJobConfig for configuring the cancel request.

cancellationToken CancellationToken

The CancellationToken for the request.

Returns

Task

A Task that represents the asynchronous operation.

CreateAsync(string, BatchJobSource, CreateBatchJobConfig, CancellationToken)

Creates a batch job.

public Task<BatchJob> CreateAsync(string model, BatchJobSource src, CreateBatchJobConfig config, CancellationToken cancellationToken = default)

Parameters

model string

The model to use for the batch job.

src BatchJobSource

The BatchJobSource of the batch job. Currently Gemini Enterprise Agent Platform supports GCS URIs or BigQuery URI. Example: "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId". Gemini Developer API supports List of inlined_request, or file name. Example: "files/file_name".

config CreateBatchJobConfig

Optional CreateBatchJobConfig to configure the batch job.

cancellationToken CancellationToken

The cancellation token for the request.

Returns

Task<BatchJob>

A Task<TResult> that represents the asynchronous operation. The task result contains a BatchJob instance with batch job details.

CreateEmbeddingsAsync(string, EmbeddingsBatchJobSource, CreateEmbeddingsBatchJobConfig, CancellationToken)

Makes an API request to create the batch embeddings job. This method is experimental.

public Task<BatchJob> CreateEmbeddingsAsync(string model, EmbeddingsBatchJobSource src, CreateEmbeddingsBatchJobConfig config, CancellationToken cancellationToken = default)

Parameters

model string

The model to use for the embeddings.

src EmbeddingsBatchJobSource

The EmbeddingsBatchJobSource of the batch job. Gemini Developer API supports List of inlined_request, or file name. Example: "files/file_name".

config CreateEmbeddingsBatchJobConfig

Optional CreateEmbeddingsBatchJobConfig to configure the batch job.

cancellationToken CancellationToken

The cancellation token for the request.

Returns

Task<BatchJob>

A Task<TResult> that represents the asynchronous operation. The task result contains a BatchJob instance with batch job details.

DeleteAsync(string, DeleteBatchJobConfig?, CancellationToken)

Deletes a batch job resource.

public Task<DeleteResourceJob> DeleteAsync(string name, DeleteBatchJobConfig? config = null, CancellationToken cancellationToken = default)

Parameters

name string

A fully-qualified BatchJob resource name or ID. Example: "projects/.../locations/.../batchPredictionJobs/456" or "456" when project and location are initialized in the Gemini Enterprise Agent Platform client. Or "batches/abc" using the Gemini Developer AI client.

config DeleteBatchJobConfig

A DeleteBatchJobConfig for configuring the delete request.

cancellationToken CancellationToken

The CancellationToken for the request.

Returns

Task<DeleteResourceJob>

A DeleteResourceJob object that shows the status of the deletion.

GetAsync(string, GetBatchJobConfig?, CancellationToken)

Gets a batch job resource.

public Task<BatchJob> GetAsync(string name, GetBatchJobConfig? config = null, CancellationToken cancellationToken = default)

Parameters

name string

A fully-qualified BatchJob resource name or ID. Example: "projects/.../locations/.../batchPredictionJobs/456" or "456" when project and location are initialized in the Gemini Enterprise Agent Platform client. Or "batches/abc" using the Gemini Developer AI client.

config GetBatchJobConfig

A GetBatchJobConfig for configuring the get request.

cancellationToken CancellationToken

The CancellationToken for the request.

Returns

Task<BatchJob>

A BatchJob object that contains the info of the batch job.

ListAsync(ListBatchJobsConfig?, CancellationToken)

Makes an API request to list the available batch jobs.

public Task<Pager<BatchJob, ListBatchJobsConfig, ListBatchJobsResponse>> ListAsync(ListBatchJobsConfig? config = null, CancellationToken cancellationToken = default)

Parameters

config ListBatchJobsConfig

A ListBatchJobsConfig for configuring the list request.

cancellationToken CancellationToken

The CancellationToken for the request.

Returns

Task<Pager<BatchJob, ListBatchJobsConfig, ListBatchJobsResponse>>

A Pager<TItem, TConfig, TResponse> 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.