mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-21 14:55:36 -04:00
17 lines
358 B
TypeScript
17 lines
358 B
TypeScript
import fs from "node:fs/promises";
|
|
|
|
import { SentenceSplitter } from "llamaindex";
|
|
|
|
async function main() {
|
|
const path = "node_modules/llamaindex/examples/abramov.txt";
|
|
const essay = await fs.readFile(path, "utf-8");
|
|
|
|
const textSplitter = new SentenceSplitter();
|
|
|
|
const chunks = textSplitter.splitText(essay);
|
|
|
|
console.log(chunks);
|
|
}
|
|
|
|
void main();
|