Skip to content

GoogleMultimodalEmbedding

Namespace: Vercel.AI.Operations

public sealed class GoogleMultimodalEmbedding : IEmbeddingCaller

Gemini embedding caller used by EmbedMany. Splits multimodal google.content to the chunk that is about to be sent and posts embedContent or batchEmbedContents.

Inheritance: object

Implements: IEmbeddingCaller

View source

GoogleMultimodalEmbedding(string, HttpClient, string?)

Section titled “GoogleMultimodalEmbedding(string, HttpClient, string?)”
public GoogleMultimodalEmbedding(string modelId, HttpClient http, string? baseUrl = null)

Creates a caller that posts to <code class=“paramref”>baseUrl</code>.

Parameters

Name Type Description
modelId string
http HttpClient
baseUrl string

View source

public const int EmbeddingsPerCall = 100

Values accepted by one Gemini embedding request.

Value: int

View source

public int? MaxEmbeddingsPerCall { get; }

Maximum values per call. Null means unlimited.

Value: int?

View source

public double? MaxInputBytesPerCall { get; }

Maximum UTF-8 input bytes per call. Null and infinity mean unlimited.

Value: double?

View source

public string ModelId { get; }

Model id.

Value: string

View source

public string Provider { get; }

Provider id.

Value: string

View source

public string SpecificationVersion { get; }

Specification version. v4 is current. v2 omits warnings.

Value: string

View source

public bool SupportsParallelCalls { get; }

Whether chunks may run at the same time.

Value: bool

View source

DoEmbedAsync(EmbeddingModelCall, CancellationToken)

Section titled “DoEmbedAsync(EmbeddingModelCall, CancellationToken)”
public Task<EmbeddingModelResponse> DoEmbedAsync(EmbeddingModelCall call, CancellationToken cancellationToken)

Embeds one chunk.

Parameters

Name Type Description
call EmbeddingModelCall
cancellationToken CancellationToken

Returns: Task<EmbeddingModelResponse>

View source

TransformProviderOptionsAsync(JsonElement?, IReadOnlyList<string>, int, int, CancellationToken)

Section titled “TransformProviderOptionsAsync(JsonElement?, IReadOnlyList<string>, int, int, CancellationToken)”
public Task<JsonElement?> TransformProviderOptionsAsync(JsonElement? providerOptions, IReadOnlyList<string> values, int startIndex, int endIndex, CancellationToken cancellationToken)

Slices provider options for one chunk. Null leaves the options unchanged.

Parameters

Name Type Description
providerOptions JsonElement?
values IReadOnlyList<string>
startIndex int
endIndex int
cancellationToken CancellationToken

Returns: Task<JsonElement?>

View source

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