Absolute path to the directory to embed and store
Combined options for all stages
Object containing embedded directory, stats, and storage stats
// Embed and store MDX files only
const result = await embed_and_store_directory('/path/to/docs', {
fileExtensions: ['.mdx'],
costLimit: 0.50,
model: 'text-embedding-3-small',
dimensions: 1536
});
console.log(`Project: ${result.storageStats.projectId}`);
console.log(`Stored: ${result.storageStats.chunksCreated} chunks`);
console.log(`Embeddings: ${result.storageStats.embeddingsCreated} new, ${result.storageStats.embeddingsReused} reused`);
// Embed and store TypeScript files
const result = await embed_and_store_directory('/path/to/src', {
fileExtensions: ['.ts', '.tsx'],
costLimit: 2.0,
delimiter: /\n{3,}/g,
deleteExisting: true
});
Embeds and stores an entire directory in SurrealDB.
This is the complete end-to-end function that: