Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
| 69 |
-
|
| 70 |
|
| 71 |
-
#agent
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
| 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):
|