EmbeddingsClient.Embed Method

Definition

Overloads

Embed(EmbeddingsOptions, CancellationToken)

Return the embedding vectors for given text prompts. The method makes a REST API call to the /embeddings route on the given endpoint.

Embed(RequestContent, String, RequestContext)

[Protocol Method] Return the embedding vectors for given text prompts. The method makes a REST API call to the /embeddings route on the given endpoint.

Embed(EmbeddingsOptions, CancellationToken)

Source:
EmbeddingsClient.cs

Return the embedding vectors for given text prompts. The method makes a REST API call to the /embeddings route on the given endpoint.

public virtual Azure.Response<Azure.AI.Inference.EmbeddingsResult> Embed (Azure.AI.Inference.EmbeddingsOptions embeddingsOptions, System.Threading.CancellationToken cancellationToken = default);
abstract member Embed : Azure.AI.Inference.EmbeddingsOptions * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Inference.EmbeddingsResult>
override this.Embed : Azure.AI.Inference.EmbeddingsOptions * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Inference.EmbeddingsResult>
Public Overridable Function Embed (embeddingsOptions As EmbeddingsOptions, Optional cancellationToken As CancellationToken = Nothing) As Response(Of EmbeddingsResult)

Parameters

embeddingsOptions
EmbeddingsOptions
cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

embeddingsOptions is null.

Examples

This sample shows how to call Embed.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);

EmbeddingsOptions embeddingsOptions = null;
Response<EmbeddingsResult> response = client.Embed(embeddingsOptions);

This sample shows how to call Embed.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);

EmbeddingsOptions embeddingsOptions = null;
Response<EmbeddingsResult> response = client.Embed(embeddingsOptions);

Applies to

Embed(RequestContent, String, RequestContext)

Source:
EmbeddingsClient.cs

[Protocol Method] Return the embedding vectors for given text prompts. The method makes a REST API call to the /embeddings route on the given endpoint.

public virtual Azure.Response Embed (Azure.Core.RequestContent content, string extraParams = default, Azure.RequestContext context = default);
abstract member Embed : Azure.Core.RequestContent * string * Azure.RequestContext -> Azure.Response
override this.Embed : Azure.Core.RequestContent * string * Azure.RequestContext -> Azure.Response
Public Overridable Function Embed (content As RequestContent, Optional extraParams As String = Nothing, Optional context As RequestContext = Nothing) As Response

Parameters

content
RequestContent

The content to send as the body of the request.

extraParams
String

Controls what happens if extra parameters, undefined by the REST API, are passed in the JSON request payload. This sets the HTTP request header extra-parameters. Allowed values: "error" | "drop" | "pass-through"

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

content is null.

Service returned a non-success status code.

Applies to