Class EmbeddingsOptions

java.lang.Object
com.azure.ai.openai.models.EmbeddingsOptions
All Implemented Interfaces:
com.azure.json.JsonSerializable<EmbeddingsOptions>

public final class EmbeddingsOptions extends Object implements com.azure.json.JsonSerializable<EmbeddingsOptions>
The configuration information for an embeddings request. Embeddings measure the relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar scenarios.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of EmbeddingsOptions class.
  • Method Summary

    Modifier and Type
    Method
    Description
    fromJson(com.azure.json.JsonReader jsonReader)
    Reads an instance of EmbeddingsOptions from the JsonReader.
    Get the dimensions property: The number of dimensions the resulting output embeddings should have.
    Get the input property: Input texts to get embeddings for, encoded as a an array of strings.
    Get the inputType property: When using Azure OpenAI, specifies the input type to use for embedding search.
    Get the model property: The model name to provide as part of this embeddings request.
    Get the user property: An identifier for the caller or end user of the operation.
    setDimensions(Integer dimensions)
    Set the dimensions property: The number of dimensions the resulting output embeddings should have.
    setInputType(String inputType)
    Set the inputType property: When using Azure OpenAI, specifies the input type to use for embedding search.
    Set the model property: The model name to provide as part of this embeddings request.
    Set the user property: An identifier for the caller or end user of the operation.
    com.azure.json.JsonWriter
    toJson(com.azure.json.JsonWriter jsonWriter)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.azure.json.JsonSerializable

    toJson, toJson, toJsonBytes, toJsonString
  • Constructor Details

    • EmbeddingsOptions

      public EmbeddingsOptions(List<String> input)
      Creates an instance of EmbeddingsOptions class.
      Parameters:
      input - the input value to set.
  • Method Details

    • getUser

      public String getUser()
      Get the user property: An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes.
      Returns:
      the user value.
    • setUser

      public EmbeddingsOptions setUser(String user)
      Set the user property: An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes.
      Parameters:
      user - the user value to set.
      Returns:
      the EmbeddingsOptions object itself.
    • getModel

      public String getModel()
      Get the model property: The model name to provide as part of this embeddings request. Not applicable to Azure OpenAI, where deployment information should be included in the Azure resource URI that's connected to.
      Returns:
      the model value.
    • setModel

      public EmbeddingsOptions setModel(String model)
      Set the model property: The model name to provide as part of this embeddings request. Not applicable to Azure OpenAI, where deployment information should be included in the Azure resource URI that's connected to.
      Parameters:
      model - the model value to set.
      Returns:
      the EmbeddingsOptions object itself.
    • getInput

      public List<String> getInput()
      Get the input property: Input texts to get embeddings for, encoded as a an array of strings. Each input must not exceed 2048 tokens in length. Unless you are embedding code, we suggest replacing newlines (\n) in your input with a single space, as we have observed inferior results when newlines are present.
      Returns:
      the input value.
    • getInputType

      public String getInputType()
      Get the inputType property: When using Azure OpenAI, specifies the input type to use for embedding search.
      Returns:
      the inputType value.
    • setInputType

      public EmbeddingsOptions setInputType(String inputType)
      Set the inputType property: When using Azure OpenAI, specifies the input type to use for embedding search.
      Parameters:
      inputType - the inputType value to set.
      Returns:
      the EmbeddingsOptions object itself.
    • getDimensions

      public Integer getDimensions()
      Get the dimensions property: The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.
      Returns:
      the dimensions value.
    • setDimensions

      public EmbeddingsOptions setDimensions(Integer dimensions)
      Set the dimensions property: The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.
      Parameters:
      dimensions - the dimensions value to set.
      Returns:
      the EmbeddingsOptions object itself.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<EmbeddingsOptions>
      Throws:
      IOException
    • fromJson

      public static EmbeddingsOptions fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of EmbeddingsOptions from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of EmbeddingsOptions if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
      Throws:
      IllegalStateException - If the deserialized JSON object was missing any required properties.
      IOException - If an error occurs while reading the EmbeddingsOptions.