natharzu commited on
Commit
59cef33
·
verified ·
1 Parent(s): 4790d7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -63,14 +63,17 @@ def weather_tool(agent_input: str) -> str:
63
  return "Sorry, I couldn't find a place with that weather type."
64
 
65
  # Register the tool in Smolagents
66
- tool_1 = smolagents.Tool(name="FavoriteWeather", function=weather_tool)
67
 
68
- # Example usage (you can use this to test the tool)
69
- #from smolagents.agents import Agent # Importing Agent correctly
70
 
71
- #agent = smolagents.Agent(tools=[tool_1])
72
- #response = agent.run("sunny")
73
- #print(response) # Should print the response for "sunny" weather
 
 
 
74
 
75
  # Tool 2: Ask for favorite color and return a shape associated with it
76
  # def color_shape_tool(agent_input: str):
 
63
  return "Sorry, I couldn't find a place with that weather type."
64
 
65
  # Register the tool in Smolagents
66
+ #tool_1 = smolagents.Tool(name="FavoriteWeather", function=weather_tool)
67
 
68
+ # Register the tool
69
+ tool_1 = smolagents.tools.Tool(name="FavoriteWeather", function=weather_tool)
70
 
71
+ # Example of running the agent directly with the tool
72
+ agent = smolagents.agents.Agent() # Use this if `Agent` is the correct class
73
+ agent.add_tool(tool_1) # Add tool to agent
74
+
75
+ response = agent.run("sunny") # Run the tool with an example input
76
+ print(response) # Should print the response for "sunny" weather
77
 
78
  # Tool 2: Ask for favorite color and return a shape associated with it
79
  # def color_shape_tool(agent_input: str):