We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f963e5a commit e28224bCopy full SHA for e28224b
packages/components/nodes/outputparsers/StructuredOutputParser/StructuredOutputParser.ts
@@ -79,7 +79,7 @@ class StructuredOutputParser implements INode {
79
80
// Fix broken JSON from LLM
81
structuredOutputParser.parse = (text) => {
82
- const jsonString = text.includes('```') ? text.trim().split(/```(?:json)?/)[1] : text.trim()
+ const jsonString = text.replace(/(?:^[^{[]*)|(?:[^}\]]*$)/g, '')
83
return baseParse.call(structuredOutputParser, jsonrepair(jsonString))
84
}
85
0 commit comments