-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path17_agent-tools.py
More file actions
30 lines (22 loc) · 864 Bytes
/
17_agent-tools.py
File metadata and controls
30 lines (22 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from smolagents import CodeAgent, InferenceClientModel, Tool, DuckDuckGoSearchTool
from tools.hub_stats_tool import HubStatsTool
from tools.weather_info_tool import WeatherInfoTool
# Initialize the DuckDuckGo search tool
search_tool = DuckDuckGoSearchTool()
# Initialize the tool
weather_info_tool = WeatherInfoTool()
# Initialize the tool
hub_stats_tool = HubStatsTool()
# Initialize the Hugging Face model
model = InferenceClientModel()
# Create Alfred with all the tools
alfred = CodeAgent(
tools=[search_tool, weather_info_tool, hub_stats_tool],
model=model
)
# Example usage
print(hub_stats_tool("facebook")) # Example: Get the most downloaded model by Facebook
# Example query Alfred might receive during the gala
response = alfred.run("What is Facebook and what's their most popular model?")
print("🎩 Alfred's Response:")
print(response)