Class Vector.Builder

java.lang.Object
com.redis.vl.query.Vector.Builder
Enclosing class:
Vector

public static class Vector.Builder extends Object
Builder for creating Vector instances.
  • Method Details

    • vector

      public Vector.Builder vector(float[] vector)
      Set the query vector.
      Parameters:
      vector - Query vector for similarity search
      Returns:
      This builder
    • fieldName

      public Vector.Builder fieldName(String fieldName)
      Set the vector field name to search.
      Parameters:
      fieldName - Name of the vector field
      Returns:
      This builder
    • dtype

      public Vector.Builder dtype(String dtype)
      Set the vector data type.

      Supported types: BFLOAT16, FLOAT16, FLOAT32, FLOAT64, INT8, UINT8 (case-insensitive)

      Parameters:
      dtype - Vector data type
      Returns:
      This builder
    • weight

      public Vector.Builder weight(double weight)
      Set the weight for this vector in multi-vector scoring.

      The final score will be a weighted combination: w_1 * score_1 + w_2 * score_2 + ...

      Parameters:
      weight - Weight value (must be positive)
      Returns:
      This builder
    • build

      public Vector build()
      Build the Vector instance.
      Returns:
      Configured Vector
      Throws:
      IllegalArgumentException - if vector or fieldName is null/empty, dtype is invalid, or weight is non-positive