Skip to content

Commit c99394d

Browse files
committed
fix: config embedding definition
1 parent a7d4d1c commit c99394d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

templates/components/vectordbs/typescript/mongo/generate.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ async function loadAndIndex() {
2727
dbName: databaseName,
2828
collectionName: vectorCollectionName, // this is where your embeddings will be stored
2929
indexName: indexName, // this is the name of the index you will need to create
30-
populatedMetadataFields: POPULATED_METADATA_FIELDS,
30+
indexedMetadataFields: POPULATED_METADATA_FIELDS,
31+
embeddingDefinition: {
32+
dimensions: process.env.EMBEDDING_DIM
33+
? parseInt(process.env.EMBEDDING_DIM)
34+
: 1536,
35+
},
3136
});
3237

3338
// now create an index from all the Documents and store them in Atlas

templates/components/vectordbs/typescript/mongo/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ export async function getDataSource(params?: any) {
1212
dbName: process.env.MONGODB_DATABASE!,
1313
collectionName: process.env.MONGODB_VECTORS!,
1414
indexName: process.env.MONGODB_VECTOR_INDEX,
15-
populatedMetadataFields: POPULATED_METADATA_FIELDS,
15+
indexedMetadataFields: POPULATED_METADATA_FIELDS,
16+
embeddingDefinition: {
17+
dimensions: process.env.EMBEDDING_DIM
18+
? parseInt(process.env.EMBEDDING_DIM)
19+
: 1536,
20+
},
1621
});
1722

1823
return await VectorStoreIndex.fromVectorStore(store);

0 commit comments

Comments
 (0)