AWSTemplateFormatVersion: '2010-09-09'
Description: Optional three-dimensional native-vector demonstration, not a production model
Parameters:
  TableName:
    Type: String
    MinLength: 3
    MaxLength: 255
    AllowedPattern: '[A-Za-z0-9_.-]+'
Resources:
  VectorDocuments:
    Type: AWS::DynamoDB::Table
    DeletionPolicy: Retain
    UpdateReplacePolicy: Retain
    Properties:
      TableName: !Ref TableName
      BillingMode: PAY_PER_REQUEST
      DeletionProtectionEnabled: true
      AttributeDefinitions:
        - AttributeName: PK
          AttributeType: S
        - AttributeName: Tenant
          AttributeType: S
        - AttributeName: Status
          AttributeType: S
      KeySchema:
        - AttributeName: PK
          KeyType: HASH
      VectorIndexes:
        - IndexName: EmbeddingIndex
          VectorAttribute:
            AttributeName: Embedding
          Dimensions: 3
          DistanceFunction: COSINE
          SearchSchema:
            - AttributeName: Tenant
              SearchSchemaElementType: HASH
            - AttributeName: Status
              SearchSchemaElementType: INLINE_FILTER
          Projection:
            ProjectionType: INCLUDE
            NonKeyAttributes: [Title]
