-
Notifications
You must be signed in to change notification settings - Fork 17k
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
(Ollama) Fix String Value parsing in _parse_arguments_from_tool_call #30154
Conversation
keenborder786
commented
Mar 7, 2025
- Description: Fix String Value parsing in _parse_arguments_from_tool_call
- Issue: Ollama tools argument type modification #30145
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
There was a problem hiding this 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?
@ccurme okay |
Done |
1 similar comment
There was a problem hiding this 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) |
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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):