You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have developed a solution using SmolAgents that incorporates an agent with multiple tools (Python functions). Specifically, I utilize UserInputTool() to request missing parameters when executing a function. This approach ensures that the agent doesn't fabricate or assume parameters.
However, I've encountered an issue where the prompts from UserInputTool() are displayed in the terminal instead of the Gradio interface, this is beacause this tool uses input(). As a result, users interacting with the agent through the Gradio UI cannot see or respond to these prompts, which disrupts the intended user experience.
def forward(self, question):
user_input = input(f"{question} => Type your answer here:")
return user_input
Code to reproduce the error
The code simplified would be something like this:
from smolagents import tool, CodeAgent, GradioUI, UserInputTool
#tools definition
...
agent = CodeAgent(
tools=[check_status_vm, ping_vm, UserInputTool()],
model=model,
verbosity_level=2,
description="Solve IT issues with tools. If it needs a missing parameter to execute a tool, it will use UserInputTool to ask the user for it.",
max_steps=6, add_base_tools=True, planning_interval=3
)
GradioUI(agent).launch()
Expected behavior
When a function requiring additional parameters is invoked, the UserInputTool() prompts should appear within the Gradio interface.
Packages version:
smolagents==1.9.2
The text was updated successfully, but these errors were encountered:
This should ideally be possible with the chatbot style of the gradio UI. Let me try to reproduce this to understand it better. Thanks for bringing this to my attention, @albertvillanova.
Describe the bug
I have developed a solution using SmolAgents that incorporates an agent with multiple tools (Python functions). Specifically, I utilize UserInputTool() to request missing parameters when executing a function. This approach ensures that the agent doesn't fabricate or assume parameters.
However, I've encountered an issue where the prompts from UserInputTool() are displayed in the terminal instead of the Gradio interface, this is beacause this tool uses input(). As a result, users interacting with the agent through the Gradio UI cannot see or respond to these prompts, which disrupts the intended user experience.
Source code (https://github.com/huggingface/smolagents/blob/v1.9.2/src/smolagents/default_tools.py):
class UserInputTool(Tool):
name = "user_input"
description = "Asks for user's input on a specific question"
inputs = {"question": {"type": "string", "description": "The question to ask the user"}}
output_type = "string"
Code to reproduce the error
The code simplified would be something like this:
from smolagents import tool, CodeAgent, GradioUI, UserInputTool
#tools definition
...
agent = CodeAgent(
tools=[check_status_vm, ping_vm, UserInputTool()],
model=model,
verbosity_level=2,
description="Solve IT issues with tools. If it needs a missing parameter to execute a tool, it will use UserInputTool to ask the user for it.",
max_steps=6, add_base_tools=True, planning_interval=3
)
GradioUI(agent).launch()
Expected behavior
When a function requiring additional parameters is invoked, the UserInputTool() prompts should appear within the Gradio interface.
Packages version:
smolagents==1.9.2
The text was updated successfully, but these errors were encountered: