Table of Contents

Class VideoGenerationModel

Namespace
GenerativeAI
Assembly
GenerativeAI.dll

A client for interacting with the Gemini API for video generation tasks. Note: Video generation capabilities might be specific to certain API versions or platforms (e.g., Vertex AI).

public class VideoGenerationModel : BaseClient
Inheritance
VideoGenerationModel
Inherited Members
Extension Methods

Constructors

VideoGenerationModel(IPlatformAdapter, string, HttpClient?, ILogger?)

Initializes a new instance of the VideoGenerationModel class.

public VideoGenerationModel(IPlatformAdapter platform, string model = "veo-2.0-generate-001", HttpClient? httpClient = null, ILogger? logger = null)

Parameters

platform IPlatformAdapter

The platform adapter for integrating with the API.

model string

The name of the video generation model.

httpClient HttpClient

Optional HTTP client instance for making API calls.

logger ILogger

Optional logger instance for logging operations.

Properties

ModelName

Gets or sets the name of the video generation model.

public string ModelName { get; set; }

Property Value

string

Methods

AwaitForLongRunningOperation(string, int?, CancellationToken)

Awaits the completion of a long-running operation specified by its operation ID. This method repeatedly checks the operation's progress until it's complete or until the specified timeout is reached.

public Task<GenerateVideosOperation?> AwaitForLongRunningOperation(string operationId, int? timeOut = null, CancellationToken cancellationToken = default)

Parameters

operationId string

The unique identifier of the long-running operation to monitor.

timeOut int?

Optional timeout (in milliseconds) for awaiting the operation. If not provided, the default timeout specified by LongRunningOperationTimeout is used.

cancellationToken CancellationToken

An optional token to observe and respond to cancellation requests.

Returns

Task<GenerateVideosOperation>

Returns a GoogleLongRunningOperation instance representing the final state of the long-running operation upon completion. Throws an exception if the operation encounters an error.

GenerateVideosAsync(GenerateVideosRequest, CancellationToken)

Generates videos based on a text prompt and optional image input and configuration. This typically initiates a long-running operation.

public Task<GenerateVideosOperation?> GenerateVideosAsync(GenerateVideosRequest request, CancellationToken cancellationToken = default)

Parameters

request GenerateVideosRequest

The request containing the prompt, optional image, and configuration for video generation.

cancellationToken CancellationToken

A cancellation token to cancel the operation.

Returns

Task<GenerateVideosOperation>

A GenerateVideosOperation representing the long-running video generation task.

GenerateVideosAsync(string, ImageSample?, GenerateVideosConfig?, CancellationToken)

Generates videos based on a specified text prompt, an optional reference image, and configuration settings. This operation typically initiates a long-running task.

public Task<GenerateVideosOperation?> GenerateVideosAsync(string prompt, ImageSample? referenceImage = null, GenerateVideosConfig? config = null, CancellationToken cancellationToken = default)

Parameters

prompt string

The text prompt to guide the video generation process.

referenceImage ImageSample

An optional reference image to influence the video's style or content.

config GenerateVideosConfig

Optional configuration settings for customizing the video generation.

cancellationToken CancellationToken

A token to observe while waiting for the operation to complete, allowing it to be cancelled.

Returns

Task<GenerateVideosOperation>

A GenerateVideosOperation representing the long-running operation for video generation.

GetVideoGenerationStatusAsync(string, int?, CancellationToken)

Awaits the completion of a long-running operation specified by its operation ID. This method repeatedly checks the operation's progress until it's complete or until the specified timeout is reached.

public Task<GenerateVideosOperation?> GetVideoGenerationStatusAsync(string operationId, int? timeOut = null, CancellationToken cancellationToken = default)

Parameters

operationId string

The unique identifier of the long-running operation to monitor.

timeOut int?

Optional timeout (in milliseconds) for awaiting the operation. If not provided, the default timeout specified by LongRunningOperationTimeout is used.

cancellationToken CancellationToken

An optional token to observe and respond to cancellation requests.

Returns

Task<GenerateVideosOperation>

Returns a GoogleLongRunningOperation instance representing the final state of the long-running operation upon completion. Throws an exception if the operation encounters an error.