Skip to content
Snippets Groups Projects
Unverified Commit 0a69fe09 authored by Thuc Pham's avatar Thuc Pham Committed by GitHub
Browse files

fix: missing params when init Astra vectorstore (#373)

parent de88b322
No related branches found
No related tags found
No related merge requests found
---
"create-llama": patch
---
fix: missing params when init Astra vectorstore
...@@ -14,7 +14,12 @@ async function loadAndIndex() { ...@@ -14,7 +14,12 @@ async function loadAndIndex() {
// create vector store and a collection // create vector store and a collection
const collectionName = process.env.ASTRA_DB_COLLECTION!; const collectionName = process.env.ASTRA_DB_COLLECTION!;
const vectorStore = new AstraDBVectorStore(); const vectorStore = new AstraDBVectorStore({
params: {
endpoint: process.env.ASTRA_DB_ENDPOINT!,
token: process.env.ASTRA_DB_APPLICATION_TOKEN!,
},
});
await vectorStore.createAndConnect(collectionName, { await vectorStore.createAndConnect(collectionName, {
vector: { vector: {
dimension: parseInt(process.env.EMBEDDING_DIM!), dimension: parseInt(process.env.EMBEDDING_DIM!),
......
...@@ -5,7 +5,12 @@ import { checkRequiredEnvVars } from "./shared"; ...@@ -5,7 +5,12 @@ import { checkRequiredEnvVars } from "./shared";
export async function getDataSource(params?: any) { export async function getDataSource(params?: any) {
checkRequiredEnvVars(); checkRequiredEnvVars();
const store = new AstraDBVectorStore(); const store = new AstraDBVectorStore({
params: {
endpoint: process.env.ASTRA_DB_ENDPOINT!,
token: process.env.ASTRA_DB_APPLICATION_TOKEN!,
},
});
await store.connect(process.env.ASTRA_DB_COLLECTION!); await store.connect(process.env.ASTRA_DB_COLLECTION!);
return await VectorStoreIndex.fromVectorStore(store); return await VectorStoreIndex.fromVectorStore(store);
} }
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"dotenv": "^16.3.1", "dotenv": "^16.3.1",
"duck-duck-scrape": "^2.2.5", "duck-duck-scrape": "^2.2.5",
"express": "^4.18.2", "express": "^4.18.2",
"llamaindex": "0.6.19", "llamaindex": "0.6.21",
"pdf2json": "3.0.5", "pdf2json": "3.0.5",
"ajv": "^8.12.0", "ajv": "^8.12.0",
"@e2b/code-interpreter": "0.0.9-beta.3", "@e2b/code-interpreter": "0.0.9-beta.3",
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
"duck-duck-scrape": "^2.2.5", "duck-duck-scrape": "^2.2.5",
"formdata-node": "^6.0.3", "formdata-node": "^6.0.3",
"got": "^14.4.1", "got": "^14.4.1",
"llamaindex": "0.6.19", "llamaindex": "0.6.21",
"lucide-react": "^0.294.0", "lucide-react": "^0.294.0",
"next": "^14.2.4", "next": "^14.2.4",
"react": "^18.2.0", "react": "^18.2.0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment