Loading...
await db.createIndex({ name: 'docs', dimension: 768 });
await db.upsert('docs', [{ id, values: await embed(text) }]);const vector = await embed(text);
await db.createIndex({ name: 'docs', dimension: vector.length, metric: 'cosine' });
await db.upsert('docs', [{ id, values: vector, metadata: { source: url, title } }]);The index size comes from the model's output, and metadata is stored so results can be filtered and cited.
Not always. Many regular databases support vector columns and similarity search, which is enough for small and medium data sets.
An index method that finds very similar vectors fast by trading a little accuracy for speed, instead of comparing every vector.
The one the embedding model was trained for, often cosine similarity or dot product. Check the model's documentation.