Skip to content

EmbedMany

Namespace: Vercel.AI.Operations

public static class EmbedMany

Embeds many values, splitting on count and UTF-8 byte limits. Maps to embedMany.

Inheritance: object

View source

EmbedManyAsync(EmbedManyRequest, CancellationToken)

Section titled “EmbedManyAsync(EmbedManyRequest, CancellationToken)”
public static Task<EmbedManyResult> EmbedManyAsync(EmbedManyRequest request, CancellationToken cancellationToken = default)

Embeds Values.

Parameters

Name Type Description
request EmbedManyRequest
cancellationToken CancellationToken

Returns: Task<EmbedManyResult>

View source

SplitByLimits(IReadOnlyList<string>, int, double)

Section titled “SplitByLimits(IReadOnlyList<string>, int, double)”
public static IReadOnlyList<IReadOnlyList<string>> SplitByLimits(IReadOnlyList<string> values, int maxEmbeddingsPerCall, double maxInputBytesPerCall)

Splits values by embedding count and UTF-8 byte budget.

Parameters

Name Type Description
values IReadOnlyList<string>
maxEmbeddingsPerCall int
maxInputBytesPerCall double

Returns: IReadOnlyList<IReadOnlyList<string>>

View source

Wrap(IEmbeddingCaller, Func<EmbeddingModelCall, IEmbeddingCaller, CancellationToken, Task<EmbeddingModelCall>>?)

Section titled “Wrap(IEmbeddingCaller, Func<EmbeddingModelCall, IEmbeddingCaller, CancellationToken, Task<EmbeddingModelCall>>?)”
public static IEmbeddingCaller Wrap(IEmbeddingCaller model, Func<EmbeddingModelCall, IEmbeddingCaller, CancellationToken, Task<EmbeddingModelCall>>? transformParams)

Wraps a model so middleware can rewrite each doEmbed call.

Parameters

Name Type Description
model IEmbeddingCaller
transformParams Func<EmbeddingModelCall, IEmbeddingCaller, CancellationToken, Task<EmbeddingModelCall>>

Returns: IEmbeddingCaller

View source

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