Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

langchain: support the situation when action_input is null in json output_parser #29680

Merged
merged 1 commit into from
Feb 8, 2025

Conversation

J-CIC
Copy link
Contributor

@J-CIC J-CIC commented Feb 8, 2025

Description:
This PR fixes handling of null action_input in [langchain.agents.output_parser]. Previously, passing null to action_input could cause OutputParserException with unclear error message which cause LLM don't know how to modify the action. The changes include:

Added null-check validation before processing action_input
Implemented proper fallback behavior with default values
Maintained backward compatibility with existing implementations

Error Examples:

{
  "action":"some action",
  "action_input":null
}

Issue:
None

Dependencies:
None

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Feb 8, 2025
Copy link

vercel bot commented Feb 8, 2025

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Feb 8, 2025 2:33am

@dosubot dosubot bot added langchain Related to the langchain package Ɑ: agent Related to agents module 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Feb 8, 2025
@J-CIC J-CIC force-pushed the fix/json_parser_support_none branch from 9e8f90a to 1126bdf Compare February 8, 2025 02:32
@J-CIC J-CIC force-pushed the fix/json_parser_support_none branch from 1126bdf to d3c2f01 Compare February 8, 2025 02:33
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Feb 8, 2025
@ccurme ccurme merged commit 5d581ba into langchain-ai:master Feb 8, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ɑ: agent Related to agents module 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature langchain Related to the langchain package lgtm PR looks good. Use to confirm that a PR is ready for merging. size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants