EmbeddingsClient Class

  • java.lang.Object
    • com.azure.ai.inference.EmbeddingsClient

public final class EmbeddingsClient

Initializes a new instance of the synchronous EmbeddingsClient type.

Method Summary

Modifier and Type Method and Description
EmbeddingsResult embed(List<String> input)

Return the embedding vectors for given text prompts.

EmbeddingsResult embed(List<String> input, Integer dimensions, EmbeddingEncodingFormat encodingFormat, EmbeddingInputType inputType, String model, ExtraParameters extraParams)

Return the embedding vectors for given text prompts.

Response<EmbeddingsResult> embedWithResponse(List<String> input)

Return the embedding vectors for given text prompts.

Response<EmbeddingsResult> embedWithResponse(List<String> input, Integer dimensions, EmbeddingEncodingFormat encodingFormat, EmbeddingInputType inputType, String model, ExtraParameters extraParams)

Return the embedding vectors for given text prompts.

ModelInfo getModelInfo()

Returns information about the AI model.

Methods inherited from java.lang.Object

Method Details

embed

public EmbeddingsResult embed(List<String> input)

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

Parameters:

input - Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays.

Returns:

representation of the response data from an embeddings request. Embeddings measure the relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar scenarios.

embed

public EmbeddingsResult embed(List<String> input, Integer dimensions, EmbeddingEncodingFormat encodingFormat, EmbeddingInputType inputType, String model, ExtraParameters extraParams)

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

Parameters:

input - Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays.
dimensions - Optional. The number of dimensions the resulting output embeddings should have. Passing null causes the model to use its default value. Returns a 422 error if the model doesn't support the value or parameter.
encodingFormat - Optional. The desired format for the returned embeddings.
inputType - Optional. The type of the input. Returns a 422 error if the model doesn't support the value or parameter.
model - ID of the specific AI model to use, if more than one model is available on the endpoint.
extraParams - 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.

Returns:

representation of the response data from an embeddings request. Embeddings measure the relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar scenarios.

embedWithResponse

public Response<EmbeddingsResult> embedWithResponse(List<String> input)

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

Parameters:

input - Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays.

Returns:

representation of the response data from an embeddings request. Embeddings measure the relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar scenarios.

embedWithResponse

public Response<EmbeddingsResult> embedWithResponse(List<String> input, Integer dimensions, EmbeddingEncodingFormat encodingFormat, EmbeddingInputType inputType, String model, ExtraParameters extraParams)

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

Parameters:

input - Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays.
dimensions - Optional. The number of dimensions the resulting output embeddings should have. Passing null causes the model to use its default value. Returns a 422 error if the model doesn't support the value or parameter.
encodingFormat - Optional. The desired format for the returned embeddings.
inputType - Optional. The type of the input. Returns a 422 error if the model doesn't support the value or parameter.
model - ID of the specific AI model to use, if more than one model is available on the endpoint.
extraParams - 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.

Returns:

representation of the response data from an embeddings request. Embeddings measure the relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar scenarios.

getModelInfo

public ModelInfo getModelInfo()

Returns information about the AI model. The method makes a REST API call to the `/info` route on the given endpoint.

Returns:

represents some basic information about the AI model.

Applies to