Skip to content

AmazonBedrockEmbeddingModel

Namespace: Vercel.AI.AmazonBedrock

public sealed class AmazonBedrockEmbeddingModel : IEmbeddingModel

Amazon Bedrock InvokeModel embedding model for Titan, Cohere, and Nova.

Inheritance: object

Implements: IEmbeddingModel

View source

AmazonBedrockEmbeddingModel(AmazonBedrockProvider, string)

Section titled “AmazonBedrockEmbeddingModel(AmazonBedrockProvider, string)”
public AmazonBedrockEmbeddingModel(AmazonBedrockProvider provider, string modelId)

Creates an embedding model.

Parameters

Name Type Description
provider AmazonBedrockProvider
modelId string

View source

AmazonBedrockEmbeddingModel(AmazonBedrockProvider, string, AmazonBedrockEmbeddingModelSettings?)

Section titled “AmazonBedrockEmbeddingModel(AmazonBedrockProvider, string, AmazonBedrockEmbeddingModelSettings?)”
public AmazonBedrockEmbeddingModel(AmazonBedrockProvider provider, string modelId, AmazonBedrockEmbeddingModelSettings? settings)

Creates an embedding model with <code class=“paramref”>settings</code>.

Parameters

Name Type Description
provider AmazonBedrockProvider
modelId string
settings AmazonBedrockEmbeddingModelSettings

View source

public int MaxEmbeddingsPerCall { get; }

Maximum values per call. Cohere models take 96. Titan and Nova take one.

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 string SpecificationVersion { get; }

Specification version. Always V4.

Value: string

View source

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

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

Embeds each value. Maps to doEmbed. <code class=“paramref”>providerOptions</code> is keyed by provider id. <code class=“paramref”>dimensions</code> is the requested vector width. A provider option for the same setting wins. <code class=“paramref”>headers</code> are sent with this call and override the provider headers.

Parameters

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

Returns: Task<EmbeddingResult>

View source

DoEmbedAsync(EmbeddingCallOptions, CancellationToken)

Section titled “DoEmbedAsync(EmbeddingCallOptions, CancellationToken)”
public Task<EmbeddingResult> DoEmbedAsync(EmbeddingCallOptions call, CancellationToken cancellationToken)

Embeds each value. Values, provider options, headers, and dimensions travel in <code class=“paramref”>call</code>, so concurrent calls do not share state.

Parameters

Name Type Description
call EmbeddingCallOptions
cancellationToken CancellationToken

Returns: Task<EmbeddingResult>

View source

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