OpenAICompatibleEmbeddingModel
Namespace: Vercel.AI.OpenAICompatible
public sealed class OpenAICompatibleEmbeddingModel : IEmbeddingModelOpenAI-compatible embeddings model.
Inheritance: object
Implements: IEmbeddingModel
Constructors
Section titled “Constructors”OpenAICompatibleEmbeddingModel(OpenAICompatibleProvider, string)
Section titled “OpenAICompatibleEmbeddingModel(OpenAICompatibleProvider, string)”public OpenAICompatibleEmbeddingModel(OpenAICompatibleProvider provider, string modelId)Creates an embedding model.
Parameters
| Name | Type | Description |
|---|---|---|
provider |
OpenAICompatibleProvider | |
modelId |
string |
Properties
Section titled “Properties”Endpoint
Section titled “Endpoint”public Uri? Endpoint { get; set; }When set, the embedding call uses this URL instead of the provider embeddings route.
Value: Uri
MaxEmbeddingsPerCall
Section titled “MaxEmbeddingsPerCall”public int MaxEmbeddingsPerCall { get; set; }Maximum inputs accepted by one request.
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
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>
DoEmbedAsync(IReadOnlyList<string>, int?, string?, CancellationToken)
Section titled “DoEmbedAsync(IReadOnlyList<string>, int?, string?, CancellationToken)”public Task<EmbeddingResult> DoEmbedAsync(IReadOnlyList<string> values, int? dimensions, string? user, CancellationToken cancellationToken)Embeds values, sending <code class=“paramref”>dimensions</code> and <code class=“paramref”>user</code> when they are set. A dimensions provider option wins over <code class=“paramref”>dimensions</code>.
Parameters
| Name | Type | Description |
|---|---|---|
values |
IReadOnlyList<string> | |
dimensions |
int? | |
user |
string | |
cancellationToken |
CancellationToken |
Returns: Task<EmbeddingResult>
DoEmbedAsync(EmbeddingCallOptions, CancellationToken)
Section titled “DoEmbedAsync(EmbeddingCallOptions, CancellationToken)”public Task<EmbeddingResult> DoEmbedAsync(EmbeddingCallOptions options, CancellationToken cancellationToken)Embeds values with per-call options. Nothing is kept on the model, so concurrent calls do not see each other.
Parameters
| Name | Type | Description |
|---|---|---|
options |
EmbeddingCallOptions | |
cancellationToken |
CancellationToken |
Returns: Task<EmbeddingResult>
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product