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

core: fix tool_call function #28915

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

Lycnkd
Copy link

@Lycnkd Lycnkd commented Dec 25, 2024

  • Description: For some LLM APIs, the current tool_call function is too vulnerable, causing validation errors within the chain or graph invocation, such as tool_calls=[ { "name": "function_name", "args": '{}', "id": "tool_call_id", "type": "tool_call", } ], where args here is a string that resembles a dictionary, rather than the standard dictionary type. This issue is encountered when using the Qwen2.5 API and cannot be resolved by adding exception handling within the user-constructed chain or graph, as it is an error within LangChain itself. This update proactively catches dictionary-like structures in args if they are strings, which resolves the issue.

Copy link

vercel bot commented Dec 25, 2024

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

Name Status Preview Comments Updated (UTC)
langchain ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 25, 2024 10:13am

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. langchain Related to the langchain package 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature langchain Related to the langchain package size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

1 participant