langchain-ai / langchainjs

🦜🔗 Build context-aware reasoning applications 🦜🔗
https://js.langchain.com/docs/
MIT License
12.75k stars 2.2k forks source link

fix(langchain): Fix structured parser error handling #7232

Open burivuhster opened 3 days ago

burivuhster commented 3 days ago

Previously, StructuredOutputParser would sometimes throw JSON.parse errors instead of the original Zod schema validation errors.

This PR modifies the fallback mechanism to only trigger for JSON parsing failures, while preserving Zod's schema validation errors.

Relevant links:

vercel[bot] commented 3 days ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview Nov 19, 2024 1:40pm
1 Skipped Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **langchainjs-api-refs** | ⬜️ Ignored ([Inspect](https://vercel.com/langchain/langchainjs-api-refs/DW6beP3CFNrnvfn7DyxPyC8QkQk6)) | | | Nov 19, 2024 1:40pm |