• Recreate the vector index with COSINE distance

    Use this to fix an existing index that was created with wrong distance metric. This will drop the existing index and recreate it with COSINE distance.

    WARNING: This may take time if you have many embeddings, as the index needs to be rebuilt.

    Parameters

    • dimensions: number = 1536

      Embedding vector dimensions (default: 1536 for text-embedding-3-small)

    Returns Promise<void>

    import { recreate_index } from './database';
    await recreate_index(1536);