OpenAIEmbeddingModel
Namespace: Vercel.AI.OpenAI
public sealed class OpenAIEmbeddingModel : IEmbeddingModelOpenAI embeddings model.
Inheritance: object
Implements: IEmbeddingModel
Constructors
Section titled “Constructors”OpenAIEmbeddingModel(OpenAIProvider, string)
Section titled “OpenAIEmbeddingModel(OpenAIProvider, string)”public OpenAIEmbeddingModel(OpenAIProvider provider, string modelId)Creates an embedding model.
Parameters
| Name | Type | Description |
|---|---|---|
provider |
OpenAIProvider | |
modelId |
string |
Fields
Section titled “Fields”DefaultMaxEmbeddingsPerCall
Section titled “DefaultMaxEmbeddingsPerCall”public const int DefaultMaxEmbeddingsPerCall = 2048Maximum embedding inputs in one request.
Value: int
DefaultMaxInputBytesPerCall
Section titled “DefaultMaxInputBytesPerCall”public const int DefaultMaxInputBytesPerCall = 300000Maximum input bytes in one request.
Value: int
Properties
Section titled “Properties”MaxEmbeddingsPerCall
Section titled “MaxEmbeddingsPerCall”public int MaxEmbeddingsPerCall { get; }Maximum values accepted by one call.
Value: int
MaxInputBytesPerCall
Section titled “MaxInputBytesPerCall”public int MaxInputBytesPerCall { get; }Maximum combined input size accepted by one call.
Value: int
ModelId
Section titled “ModelId”public string ModelId { get; }Model id.
Value: string
Provider
Section titled “Provider”public string Provider { get; }Provider id.
Value: string
SpecificationVersion
Section titled “SpecificationVersion”public string SpecificationVersion { get; }Specification version. Always V4.
Value: string
SupportsParallelCalls
Section titled “SupportsParallelCalls”public bool SupportsParallelCalls { get; }Whether the model accepts parallel embedding calls.
Value: bool
Methods
Section titled “Methods”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>
EmbedAsync(IReadOnlyList<string>, int?, string?, IReadOnlyDictionary<string, string?>?, CancellationToken)
Section titled “EmbedAsync(IReadOnlyList<string>, int?, string?, IReadOnlyDictionary<string, string?>?, CancellationToken)”public Task<OpenAIEmbeddingCallResult> EmbedAsync(IReadOnlyList<string> values, int? dimensions, string? user, IReadOnlyDictionary<string, string?>? headers, CancellationToken cancellationToken)Embeds <code class=“paramref”>values</code>, sending <code class=“paramref”>dimensions</code> and <code class=“paramref”>user</code> when they are set.
Parameters
| Name | Type | Description |
|---|---|---|
values |
IReadOnlyList<string> | |
dimensions |
int? | |
user |
string | |
headers |
IReadOnlyDictionary<string, string> | |
cancellationToken |
CancellationToken |
Returns: Task<OpenAIEmbeddingCallResult>
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product