NodeParser
The NodeParser
in LlamaIndex is responsible for splitting Document
objects into more manageable Node
objects. When you call .fromDocuments()
, the NodeParser
from the ServiceContext
is used to do this automatically for you. Alternatively, you can use it to split documents ahead of time.
import { Document, SimpleNodeParser } from "llamaindex";
const nodeParser = new SimpleNodeParser();
const nodes = nodeParser.getNodesFromDocuments([
new Document({ text: "I am 10 years old. John is 20 years old." }),
]);