Skip to content

GoogleImageModel

Namespace: Vercel.AI.Google

public sealed class GoogleImageModel : IImageModel, IImageCaller

Gemini image generation. The call runs through GoogleLanguageModel with the IMAGE response modality, so the google provider options apply, and googleSearch enables Google Search grounding.

Inheritance: object

Implements: IImageModel, IImageCaller

View source

GoogleImageModel(GoogleProvider, string, int?)

Section titled “GoogleImageModel(GoogleProvider, string, int?)”
public GoogleImageModel(GoogleProvider provider, string modelId, int? maxImagesPerCall = null)

Creates an image model.

Parameters

Name Type Description
provider GoogleProvider
modelId string
maxImagesPerCall int?

View source

public int MaxImagesPerCall { get; }

Images accepted in one call.

Value: int

View source

public string ModelId { get; }

Model id.

Value: string

View source

public string Provider { get; }

Provider id.

Value: string

View source

public bool? SupportsFileInputs { get; }

<a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool"&gt;true&lt;/a> for Gemini image models that take input images, otherwise <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null"&gt;null&lt;/a>. Maps to supportsFileInputs.

Value: bool?

View source

public bool? SupportsMaskInputs { get; }

<a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool"&gt;false&lt;/a> for Gemini image models that take input images but no mask, otherwise <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null"&gt;null&lt;/a>. Maps to supportsMaskInputs.

Value: bool?

View source

DoGenerateAsync(ImageModelCall, CancellationToken)

Section titled “DoGenerateAsync(ImageModelCall, CancellationToken)”
public Task<ImageModelResult> DoGenerateAsync(ImageModelCall call, CancellationToken cancellationToken)

Generates images.

Parameters

Name Type Description
call ImageModelCall
cancellationToken CancellationToken

Returns: Task<ImageModelResult>

View source

DoGenerateAsync(ImageCallOptions, CancellationToken)

Section titled “DoGenerateAsync(ImageCallOptions, CancellationToken)”
public Task<ImageGenerationResult> DoGenerateAsync(ImageCallOptions options, CancellationToken cancellationToken)

Generates images. Maps to doGenerate on an image model.

Parameters

Name Type Description
options ImageCallOptions
cancellationToken CancellationToken

Returns: Task<ImageGenerationResult>

View source

ResolveMaxImagesPerCallAsync(CancellationToken)

Section titled “ResolveMaxImagesPerCallAsync(CancellationToken)”
public Task<int?> ResolveMaxImagesPerCallAsync(CancellationToken cancellationToken)

Resolves a functional per-call limit. The default returns MaxImagesPerCall.

Parameters

Name Type Description
cancellationToken CancellationToken

Returns: Task<int?>

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product