Skip to content

Index

Source: src/AWS/S3Vectors/VectorIndex.ts

A vector index inside an S3 Vectors VectorBucket — stores vectors of a fixed dimension and answers similarity queries under a distance metric.

The index shape (data type, dimension, distance metric, non-filterable metadata keys) is fixed at create time; changing any of them replaces the index.

import * as S3Vectors from "alchemy/AWS/S3Vectors";
const bucket = yield* S3Vectors.VectorBucket("Embeddings", {});
const index = yield* S3Vectors.Index("Docs", {
vectorBucketName: bucket.vectorBucketName,
dimension: 1024,
distanceMetric: "cosine",
});