const dataPath = path.resolve('../documents'); const reader = new SimpleDirectoryReader(); const documents = await reader.loadData({ directoryPath: dataPath });
const index = await VectorStoreIndex.fromVectorStore(astraVS, ctx);
const dynamicPrompt = createPrompt(query, LlamaContext);
const retriever = await index.asRetriever({ similarityTopK: 3 });
const queryEngine = await index.asQueryEngine({ retriever });
const result = await queryEngine.query({
query: dynamicPrompt,
});