diff --git a/src/lib/outputParsers/listLineOutputParser.ts b/src/lib/outputParsers/listLineOutputParser.ts index 57a9bbc..1e2f0f5 100644 --- a/src/lib/outputParsers/listLineOutputParser.ts +++ b/src/lib/outputParsers/listLineOutputParser.ts @@ -22,6 +22,11 @@ class LineListOutputParser extends BaseOutputParser { const regex = /^(\s*(-|\*|\d+\.\s|\d+\)\s|\u2022)\s*)+/; const startKeyIndex = text.indexOf(`<${this.key}>`); const endKeyIndex = text.indexOf(``); + + if (startKeyIndex === -1 || endKeyIndex === -1) { + return []; + } + const questionsStartIndex = startKeyIndex === -1 ? 0 : startKeyIndex + `<${this.key}>`.length; const questionsEndIndex = endKeyIndex === -1 ? text.length : endKeyIndex;