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

Bug fix for 0.1.2 where ImportError "soundfile" is raised when agent reaches max_steps. #151

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

benediktstroebl
Copy link

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 by handle_agent_output_types.

I fixed it by editing provide_final_answer() to return the same format as the final_answer tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant