Class EmbeddingsClient

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

public final class EmbeddingsClient extends Object
Initializes a new instance of the synchronous EmbeddingsClient type.
  • Method Details

    • embedWithResponse

      public com.azure.core.http.rest.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.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • 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.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • 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.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • embedWithResponse

      public com.azure.core.http.rest.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.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • 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.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.