Class Embeddings

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

public final class Embeddings extends Object implements com.azure.json.JsonSerializable<Embeddings>
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.
  • Method Details

    • getData

      public List<EmbeddingItem> getData()
      Get the data property: Embedding values for the prompts submitted in the request.
      Returns:
      the data value.
    • getUsage

      public EmbeddingsUsage getUsage()
      Get the usage property: Usage counts for tokens input using the embeddings API.
      Returns:
      the usage value.
    • toJson

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

      public static Embeddings fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of Embeddings from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of Embeddings 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 Embeddings.