EmbeddingsClient.EmbedAsync Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

EmbedAsync(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.

EmbedAsync(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.

EmbedAsync(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.

C#
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.Inference.EmbeddingsResult>> EmbedAsync(Azure.AI.Inference.EmbeddingsOptions embeddingsOptions, System.Threading.CancellationToken cancellationToken = default);

Parameters

embeddingsOptions
EmbeddingsOptions
cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

embeddingsOptions is null.

Examples

This sample shows how to call EmbedAsync.

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

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

This sample shows how to call EmbedAsync.

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

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

Applies to

Azure SDK for .NET Preview
Product Versions
Azure SDK for .NET Preview

EmbedAsync(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.

C#
public virtual System.Threading.Tasks.Task<Azure.Response> EmbedAsync(Azure.Core.RequestContent content, string extraParams = default, Azure.RequestContext context = default);

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

Azure SDK for .NET Preview
Product Versions
Azure SDK for .NET Preview