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

fix tool_inputs parse error in message that in CoT(ReAct) agent mode #2949

Merged

Conversation

listeng
Copy link
Contributor

@listeng listeng commented Mar 24, 2024

Description

Occasionally, the action_input result provided by the LLM (depending on its specific capabilities, like the 'moonshot-v1-8k') may not yield a valid JSON string when operating in the CoT agent mode. This can lead to disrupt the flow of the conversation.

Fixes # (issue)

Type of Change

Please delete options that are not relevant.

  • [ X ] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Try to ask "计算一百二十八乘以六等于多少" with a tool eval_expression, the answer from the LLM moonshot-v1-8k will be "action_input='128乘以6的结果是768'". The fixed code will not raising an excetion in this situation, and will not interfere with other result that the LLM provided valid JSON outputs.

  • TODO

Suggested Checklist:

  • [ X ] I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
  • optional I have made corresponding changes to the documentation
  • optional I have added tests that prove my fix is effective or that my feature works
  • optional New and existing unit tests pass locally with my changes

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 24, 2024
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Mar 24, 2024
@crazywoola crazywoola requested a review from Yeuoly March 25, 2024 14:20
Copy link
Collaborator

@Yeuoly Yeuoly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dosubot dosubot bot added the 🌞 lgtm This PR has been approved by a maintainer label Mar 26, 2024
@crazywoola crazywoola merged commit d70bd4a into langgenius:main Mar 26, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌞 lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants