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
- clientOpenAIClient
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
- requestEmbeddingsRequest
- cancellationTokenCancellationToken
- Optional, 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
- inputIEnumerable<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. 
- modelstring
- ID of the model to use. Defaults to: text-embedding-ada-002 
- userstring
- A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. 
- dimensionsint?
- The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models 
- cancellationTokenCancellationToken
- Optional, 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
- inputstring
- 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. 
- modelstring
- ID of the model to use. Defaults to: text-embedding-ada-002 
- userstring
- A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. 
- dimensionsint?
- The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models 
- cancellationTokenCancellationToken
- Optional, CancellationToken.