Bug fix for 0.1.2 where ImportError "soundfile" is raised when agent reaches max_steps. #151
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.
With v1.2.0, a bug got introduced to the code in wich the below error is raised when the agent is reaching max_steps.
Traceback (most recent call last): File "/home/azureuser/smolagents/examples/tool_calling_agent_from_any_llm.py", line 26, in <module> print(agent.run("What's the weather like in Paris?")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/azureuser/smolagents/src/smolagents/agents.py", line 514, in run return self.direct_run(self.task) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/azureuser/smolagents/src/smolagents/agents.py", line 623, in direct_run return handle_agent_output_types(final_answer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/azureuser/smolagents/src/smolagents/types.py", line 280, in handle_agent_output_types return _v(output) ^^^^^^^^^^ File "/home/azureuser/smolagents/src/smolagents/types.py", line 193, in __init__ raise ImportError("soundfile must be installed in order to handle audio.") ImportError: soundfile must be installed in order to handle audio.
The problem is that in
provide_final_answer()
a Message object is returned instead of a str. This is handled as Audio type byhandle_agent_output_types
.I fixed it by editing
provide_final_answer()
to return the same format as thefinal_answer
tool.