Annotation Type DynamoDbVectorAttribute


@SdkPublicApi @Target(METHOD) @Retention(RUNTIME) public @interface DynamoDbVectorAttribute
Marks an attribute as the vector embedding for a named vector index. The annotated getter should return a List<Float> representing the vector embedding.

Each vector index requires exactly one attribute annotated with @DynamoDbVectorAttribute. Multiple vector indexes on the same bean require separate annotated attributes, each with a distinct indexName.

Example usage:


 @DynamoDbBean
 public class Product {
     @DynamoDbVectorAttribute(
         indexName = "product-embedding-index",
         dimensions = 1536,
         distanceFunction = DistanceFunction.COSINE)
     public List<Float> productEmbedding() { return productEmbedding; }
 }
 

Vector indexes defined via annotations default to ProjectionType.ALL. For KEYS_ONLY or INCLUDE projections, use the programmatic CreateTableEnhancedRequest.vectorIndexes() API with explicit EnhancedVectorIndex definitions.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    int
    The number of dimensions in the vector embedding.
    The distance function used for similarity search on this index.
    The name of the vector index this embedding attribute belongs to.
  • Element Details

    • indexName

      String indexName
      The name of the vector index this embedding attribute belongs to.
    • dimensions

      int dimensions
      The number of dimensions in the vector embedding.
    • distanceFunction

      DistanceFunction distanceFunction
      The distance function used for similarity search on this index.