Skip to content

Commit c070a51

Browse files
committed
fix: missing params when init Astra vectorstore
1 parent 7562cb4 commit c070a51

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ async function loadAndIndex() {
1414

1515
// create vector store and a collection
1616
const collectionName = process.env.ASTRA_DB_COLLECTION!;
17-
const vectorStore = new AstraDBVectorStore();
17+
const vectorStore = new AstraDBVectorStore({
18+
params: {
19+
endpoint: process.env.ASTRA_DB_ENDPOINT!,
20+
token: process.env.ASTRA_DB_APPLICATION_TOKEN!,
21+
},
22+
});
1823
await vectorStore.createAndConnect(collectionName, {
1924
vector: {
2025
dimension: parseInt(process.env.EMBEDDING_DIM!),

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import { checkRequiredEnvVars } from "./shared";
55

66
export async function getDataSource(params?: any) {
77
checkRequiredEnvVars();
8-
const store = new AstraDBVectorStore();
8+
const store = new AstraDBVectorStore({
9+
params: {
10+
endpoint: process.env.ASTRA_DB_ENDPOINT!,
11+
token: process.env.ASTRA_DB_APPLICATION_TOKEN!,
12+
},
13+
});
914
await store.connect(process.env.ASTRA_DB_COLLECTION!);
1015
return await VectorStoreIndex.fromVectorStore(store);
1116
}

0 commit comments

Comments
 (0)