Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle function arguments parsing errors (langchain-ai#1893)
* Handle function arguments parsing errors This PR introduces error handling for function arguments parsing in the `parseOutput` function. **Changes**: - A try-catch block has been added around the parsing of `function_call.arguments` with `JSON.parse` in the `parseOutput` function. - If an error occurs during parsing, an error message is thrown. This message includes the text that failed to parse and the original error message. **Rationale**: The previous code did not handle errors when parsing `function_call.arguments`. This could lead to unclear feedback to the user when incorrect argument formats were provided. This change addresses this issue and provides clearer feedback when an error occurs. * Use an OutputParserException for output errors * Update error message --------- Co-authored-by: jacoblee93 <[email protected]>
- Loading branch information