Class ScalarQuantizationCompression

java.lang.Object
com.azure.search.documents.indexes.models.VectorSearchCompression
com.azure.search.documents.indexes.models.ScalarQuantizationCompression
All Implemented Interfaces:
com.azure.json.JsonSerializable<VectorSearchCompression>

public final class ScalarQuantizationCompression extends VectorSearchCompression
Contains configuration options specific to the scalar quantization compression method used during indexing and querying.
  • Constructor Details

    • ScalarQuantizationCompression

      public ScalarQuantizationCompression(String compressionName)
      Creates an instance of ScalarQuantizationCompression class.
      Parameters:
      compressionName - the compressionName value to set.
  • Method Details

    • getKind

      public VectorSearchCompressionKind getKind()
      Get the kind property: The name of the kind of compression method being configured for use with vector search.
      Overrides:
      getKind in class VectorSearchCompression
      Returns:
      the kind value.
    • getParameters

      public ScalarQuantizationParameters getParameters()
      Get the parameters property: Contains the parameters specific to Scalar Quantization.
      Returns:
      the parameters value.
    • setParameters

      Set the parameters property: Contains the parameters specific to Scalar Quantization.
      Parameters:
      parameters - the parameters value to set.
      Returns:
      the ScalarQuantizationCompression object itself.
    • setRerankWithOriginalVectors

      public ScalarQuantizationCompression setRerankWithOriginalVectors(Boolean rerankWithOriginalVectors)
      Set the rerankWithOriginalVectors property: If set to true, once the ordered set of results calculated using compressed vectors are obtained, they will be reranked again by recalculating the full-precision similarity scores. This will improve recall at the expense of latency.
      Overrides:
      setRerankWithOriginalVectors in class VectorSearchCompression
      Parameters:
      rerankWithOriginalVectors - the rerankWithOriginalVectors value to set.
      Returns:
      the VectorSearchCompression object itself.
    • setDefaultOversampling

      public ScalarQuantizationCompression setDefaultOversampling(Double defaultOversampling)
      Set the defaultOversampling property: Default oversampling factor. Oversampling will internally request more documents (specified by this multiplier) in the initial search. This increases the set of results that will be reranked using recomputed similarity scores from full-precision vectors. Minimum value is 1, meaning no oversampling (1x). This parameter can only be set when rerankWithOriginalVectors is true. Higher values improve recall at the expense of latency.
      Overrides:
      setDefaultOversampling in class VectorSearchCompression
      Parameters:
      defaultOversampling - the defaultOversampling value to set.
      Returns:
      the VectorSearchCompression object itself.
    • setRescoringOptions

      public ScalarQuantizationCompression setRescoringOptions(RescoringOptions rescoringOptions)
      Set the rescoringOptions property: Contains the options for rescoring.
      Overrides:
      setRescoringOptions in class VectorSearchCompression
      Parameters:
      rescoringOptions - the rescoringOptions value to set.
      Returns:
      the VectorSearchCompression object itself.
    • setTruncationDimension

      public ScalarQuantizationCompression setTruncationDimension(Integer truncationDimension)
      Set the truncationDimension property: The number of dimensions to truncate the vectors to. Truncating the vectors reduces the size of the vectors and the amount of data that needs to be transferred during search. This can save storage cost and improve search performance at the expense of recall. It should be only used for embeddings trained with Matryoshka Representation Learning (MRL) such as OpenAI text-embedding-3-large (small). The default value is null, which means no truncation.
      Overrides:
      setTruncationDimension in class VectorSearchCompression
      Parameters:
      truncationDimension - the truncationDimension value to set.
      Returns:
      the VectorSearchCompression 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<VectorSearchCompression>
      Overrides:
      toJson in class VectorSearchCompression
      Throws:
      IOException
    • fromJson

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