mrpe24 commited on
Commit
701fff7
·
1 Parent(s): e83529f

Implemented multi-agent system.

Browse files
Files changed (1) hide show
  1. app.py +40 -6
app.py CHANGED
@@ -7,7 +7,7 @@ from retriever import load_guest_dataset
7
  from tools import DuckDuckGoSearchTool, WeatherInfoTool, HubStatsTool
8
 
9
  # Initialize the Hugging Face model
10
- model = HfApiModel()
11
 
12
  # Initialize the web search tool
13
  search_tool = DuckDuckGoSearchTool()
@@ -26,12 +26,46 @@ collection = chroma_client.create_collection(name="guests-collection", embedding
26
  guest_info_tool = load_guest_dataset(collection)
27
 
28
  # Create Alfred with all the tools
29
- alfred = CodeAgent(
30
- tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool],
 
 
31
  model=model,
32
- add_base_tools=False, # Add any additional base tools
33
- planning_interval=3 # Enable planning every 3 steps
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  )
35
 
36
  if __name__ == "__main__":
37
- GradioUI(alfred).launch()
 
7
  from tools import DuckDuckGoSearchTool, WeatherInfoTool, HubStatsTool
8
 
9
  # Initialize the Hugging Face model
10
+ model = HfApiModel(max_tokens=8096)
11
 
12
  # Initialize the web search tool
13
  search_tool = DuckDuckGoSearchTool()
 
26
  guest_info_tool = load_guest_dataset(collection)
27
 
28
  # Create Alfred with all the tools
29
+ search_agent = CodeAgent(
30
+ name="search_agent",
31
+ description="Browses the web to find information",
32
+ tools=[search_tool],
33
  model=model,
34
+ add_base_tools=False,
35
+ planning_interval=3,
36
+ verbosity_level=2,
37
+ max_steps=5
38
+ )
39
+ hub_stats_agent = CodeAgent(
40
+ name="hub_stats_agent",
41
+ description="Browses the HF statistics",
42
+ tools=[hub_stats_tool],
43
+ model=model,
44
+ add_base_tools=False,
45
+ planning_interval=3,
46
+ verbosity_level=2,
47
+ max_steps=2
48
+ )
49
+ weather_agent = CodeAgent(
50
+ name="weather_agent",
51
+ description="Weather forecasting",
52
+ tools=[weather_info_tool],
53
+ model=model,
54
+ add_base_tools=False,
55
+ planning_interval=3,
56
+ verbosity_level=2,
57
+ max_steps=2
58
+ )
59
+
60
+ alfred_manager = CodeAgent(
61
+ tools=[guest_info_tool],
62
+ managed_agents=[search_agent, hub_stats_agent, weather_agent],
63
+ model=model,
64
+ add_base_tools=False,
65
+ planning_interval=5,
66
+ verbosity_level=2,
67
+ max_steps=15
68
  )
69
 
70
  if __name__ == "__main__":
71
+ GradioUI(alfred_manager).launch()