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

(Ollama) Fix String Value parsing in _parse_arguments_from_tool_call #30154

Merged

Conversation

keenborder786
Copy link
Contributor

Copy link

vercel bot commented Mar 7, 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 Mar 20, 2025 1:43am

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Mar 7, 2025
Copy link
Collaborator

@ccurme ccurme left a comment

Choose a reason for hiding this comment

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

Can you add a test demonstrating what this is fixing?

@keenborder786
Copy link
Contributor Author

@ccurme okay

@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 9, 2025
@keenborder786
Copy link
Contributor Author

Done

@keenborder786
Copy link
Contributor Author

@ccurme

1 similar comment
@keenborder786
Copy link
Contributor Author

@ccurme

Copy link
Collaborator

@ccurme ccurme left a comment

Choose a reason for hiding this comment

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

Posted on the issue asking for a minimal reproducible example of the underlying issue.

@@ -131,6 +131,8 @@ def _parse_arguments_from_tool_call(
parsed_arguments[key] = _parse_json_string(
value, skip=True, raw_tool_call=raw_tool_call
)
if not isinstance(parsed_arguments[key], (dict, list)):
parsed_arguments[key] = str(value)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will cast all inputs to string, correct? What about tools that require other types (e.g., ints)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay I see, let me fix it

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be good actually, I missed we're in a condition if isinstance(value, str):

@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Mar 20, 2025
@ccurme ccurme merged commit 1103bdf into langchain-ai:master Mar 20, 2025
20 checks passed
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 lgtm PR looks good. Use to confirm that a PR is ready for merging. size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants