Class EmbeddingsEndpoint
- Namespace
- OpenAI.Embeddings
- Assembly
- OpenAI-DotNet.dll
Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
https://platform.openai.com/docs/guides/embeddings
public sealed class EmbeddingsEndpoint : OpenAIBaseEndpoint
- Inheritance
-
EmbeddingsEndpoint
- Inherited Members
Constructors
EmbeddingsEndpoint(OpenAIClient)
public EmbeddingsEndpoint(OpenAIClient client)
Parameters
client
OpenAIClient
Properties
IsAzureDeployment
Indicates if the endpoint has an Azure Deployment.
protected override bool? IsAzureDeployment { get; }
Property Value
- bool?
Remarks
If the endpoint is an Azure deployment, is true. If it is not an Azure deployment, is false. If it is not an Azure supported Endpoint, is null.
Root
The root endpoint address.
protected override string Root { get; }
Property Value
Methods
CreateEmbeddingAsync(EmbeddingsRequest, CancellationToken)
Creates an embedding vector representing the input text.
public Task<EmbeddingsResponse> CreateEmbeddingAsync(EmbeddingsRequest request, CancellationToken cancellationToken = default)
Parameters
request
EmbeddingsRequestcancellationToken
CancellationTokenOptional, CancellationToken.
Returns
CreateEmbeddingAsync(IEnumerable<string>, string, string, int?, CancellationToken)
Creates an embedding vector representing the input text.
public Task<EmbeddingsResponse> CreateEmbeddingAsync(IEnumerable<string> input, string model = null, string user = null, int? dimensions = null, CancellationToken cancellationToken = default)
Parameters
input
IEnumerable<string>Input text to get embeddings for, encoded as a string or array of tokens. To get embeddings for multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed 8192 tokens in length.
model
stringID of the model to use. Defaults to: text-embedding-ada-002
user
stringA unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
dimensions
int?The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models
cancellationToken
CancellationTokenOptional, CancellationToken.
Returns
CreateEmbeddingAsync(string, string, string, int?, CancellationToken)
Creates an embedding vector representing the input text.
public Task<EmbeddingsResponse> CreateEmbeddingAsync(string input, string model = null, string user = null, int? dimensions = null, CancellationToken cancellationToken = default)
Parameters
input
stringInput text to get embeddings for, encoded as a string or array of tokens. To get embeddings for multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed 8192 tokens in length.
model
stringID of the model to use. Defaults to: text-embedding-ada-002
user
stringA unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
dimensions
int?The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models
cancellationToken
CancellationTokenOptional, CancellationToken.