Skip to content

Commit

Permalink
Update outputParser.ts - Fix TypeError (langchain-ai#1674)
Browse files Browse the repository at this point in the history
* Update outputParser.ts - Fix TypeError

TypeError: Cannot read properties of undefined (reading 'trim') langchain-ai#1673

* Format

---------

Co-authored-by: Nuno Campos <[email protected]>
  • Loading branch information
aaronfonseca and nfcampos authored Jun 23, 2023
1 parent 9721754 commit fb0ae6d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion langchain/src/agents/mrkl/outputParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class ZeroShotAgentOutputParser extends AgentActionOutputParser {

return {
tool: match[1].trim(),
toolInput: match[2].trim().replace(/^("+)(.*?)(\1)$/, "$2") ?? "",
toolInput: match[2]
? match[2].trim().replace(/^("+)(.*?)(\1)$/, "$2")
: "",
log: text,
};
}
Expand Down

0 comments on commit fb0ae6d

Please sign in to comment.