-
Notifications
You must be signed in to change notification settings - Fork 994
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
Do not record tool call id if no tool has been called #571
Open
sysradium
wants to merge
7
commits into
huggingface:main
Choose a base branch
from
sysradium:web-tool-call-issue
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+72
−62
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@aymeric-roucher another one here if you have some time. |
Thank you @sysradium! Could you please add a regression test for this? |
@aymeric-roucher sure, will try to figure out a way. |
Co-authored-by: Aymeric Roucher <[email protected]>
sysradium
force-pushed
the
web-tool-call-issue
branch
from
February 13, 2025 22:18
893e409
to
0b82035
Compare
Added a test fixing some things along the way:
FAILED tests/test_models.py::ModelTests::test_get_mlx_message_no_tool - ModuleNotFoundError: Please install 'mlx-lm' extra to use 'MLXModel': `pip install 'smolagents[mlx-lm]'`
PYTHON='uv run python' make test
PYTHON='uv run python' make quality Or override it with python path you need. Just a bit of flexibility. It is backwards compatible, so if you don't override
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I came across this issue here: #570
The problem is that if you have callbacks which modify observations like it is done here https://github.com/huggingface/smolagents/blob/main/src/smolagents/vision_web_browser.py#L66
It may happen that there is no tool call recorded yet and hence
self.tool_calls
isNone
. (ref https://github.com/sysradium/smolagents/blob/web-tool-call-issue/src/smolagents/agents.py#L871)For example in my case it happened with
vision_web_browser.py
when the model did not return any Python code on the first call to it. That led to the exception here https://github.com/sysradium/smolagents/blob/web-tool-call-issue/src/smolagents/agents.py#L867 which happens right before we setmemory.step.tools_calls
.So essentially you end up having
data:,
as an observation but no recorded tool call.Maybe not the best solution, but I decided to just not print
Call id: ...
if there has been no successful tool call.