Skip to content

GatewayEmbeddingModel

Namespace: Vercel.AI.Gateway

public sealed class GatewayEmbeddingModel : IEmbeddingModel

Gateway embedding model.

Inheritance: object

Implements: IEmbeddingModel

View source

GatewayEmbeddingModel(GatewayProvider, string)

Section titled “GatewayEmbeddingModel(GatewayProvider, string)”
public GatewayEmbeddingModel(GatewayProvider provider, string modelId)

Creates a Gateway embedding model.

Parameters

Name Type Description
provider GatewayProvider
modelId string

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. Always V4.

Value: string

View source

DoEmbedAsync(IReadOnlyList<string>, JsonElement?, IReadOnlyDictionary<string, string?>?, CancellationToken, int?)

Section titled “DoEmbedAsync(IReadOnlyList<string>, JsonElement?, IReadOnlyDictionary<string, string?>?, CancellationToken, int?)”
public Task<EmbeddingResult> DoEmbedAsync(IReadOnlyList<string> values, JsonElement? providerOptions, IReadOnlyDictionary<string, string?>? headers, CancellationToken cancellationToken, int? dimensions = null)

Embeds values. Call headers are merged onto the Gateway V4 headers.

Parameters

Name Type Description
values IReadOnlyList<string>
providerOptions JsonElement?
headers IReadOnlyDictionary<string, string>
cancellationToken CancellationToken
dimensions int?

Returns: Task<EmbeddingResult>

View source

DoEmbedAsync(IReadOnlyList<string>, JsonElement?, CancellationToken)

Section titled “DoEmbedAsync(IReadOnlyList<string>, JsonElement?, CancellationToken)”
public Task<EmbeddingResult> DoEmbedAsync(IReadOnlyList<string> values, JsonElement? providerOptions, CancellationToken cancellationToken)

Embeds values and sends <code class=“paramref”>providerOptions</code> when it is a JSON object.

Parameters

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

Returns: Task<EmbeddingResult>

View source

DoEmbedAsync(IReadOnlyList<string>, CancellationToken)

Section titled “DoEmbedAsync(IReadOnlyList<string>, CancellationToken)”
public Task<EmbeddingResult> DoEmbedAsync(IReadOnlyList<string> values, CancellationToken cancellationToken)

Embeds values without provider options.

Parameters

Name Type Description
values IReadOnlyList<string>
cancellationToken CancellationToken

Returns: Task<EmbeddingResult>

View source

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