Skip to content
Snippets Groups Projects
Commit 8c1b76f3 authored by swk777's avatar swk777 Committed by Yi Ding
Browse files

add example to simple

parent 6fc6a499
No related branches found
No related tags found
Loading
import { MarkdownReader, VectorStoreIndex } from "llamaindex";
async function main() {
// Load PDF
const reader = new MarkdownReader();
const documents = await reader.loadData("node_modules/llamaindex/README.md");
// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments(documents);
// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query("What does the example code do?");
// Output response
console.log(response.toString());
}
main().catch(console.error);
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