Usage:
// The LLM Workflow contains the prompt and pass it to the LLM
const workflow = new ConceptExtractorChapterWorkflow()
const content = `${document.title}\n\n${document.content}`
const textHandler = new EfficientTextHandler(content)
const result = await workflow.execute({
context: this.context,
// textHandler.wrappedText contains the text wrapped in <div id="n">...</div>
content: textHandler.wrappedText,
})
const chapters: string[] = []
// The LLM returns an array of chapter start and end using div IDs
for (const chapter of result.chapters) {
chapters.push(
textHandler.extractPart({ start: chapter.start, end: chapter.end })
)
}
return chapters