Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import os
|
| 2 |
-
import
|
| 3 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool, GradioUI, InferenceClientModel, ManagedAgent
|
| 4 |
|
| 5 |
# 1. THE BRAIN
|
| 6 |
model = InferenceClientModel(
|
|
@@ -9,34 +8,29 @@ model = InferenceClientModel(
|
|
| 9 |
)
|
| 10 |
|
| 11 |
# 2. THE RESEARCHER (Specialist)
|
| 12 |
-
# We
|
| 13 |
-
|
|
|
|
| 14 |
tools=[DuckDuckGoSearchTool()],
|
| 15 |
model=model,
|
| 16 |
-
name="
|
| 17 |
-
description="
|
| 18 |
-
)
|
| 19 |
-
|
| 20 |
-
managed_researcher = ManagedAgent(
|
| 21 |
-
agent=search_agent,
|
| 22 |
-
name="researcher",
|
| 23 |
-
description="Use this agent for any task that requires searching the web or finding current information."
|
| 24 |
)
|
| 25 |
|
| 26 |
# 3. THE BOSS (Manager)
|
| 27 |
-
# We
|
| 28 |
manager = CodeAgent(
|
| 29 |
tools=[],
|
| 30 |
model=model,
|
| 31 |
-
managed_agents=[
|
| 32 |
add_base_tools=True
|
| 33 |
)
|
| 34 |
|
| 35 |
-
# Set the
|
| 36 |
-
manager.system_prompt = """You are the BOSS OPERATOR.
|
| 37 |
-
1.
|
| 38 |
2. Use Python for math ($E=mc^2$) and data analysis.
|
| 39 |
-
3. Provide final answers in professional Markdown."""
|
| 40 |
|
| 41 |
if __name__ == "__main__":
|
| 42 |
GradioUI(manager).launch()
|
|
|
|
| 1 |
import os
|
| 2 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, GradioUI, InferenceClientModel
|
|
|
|
| 3 |
|
| 4 |
# 1. THE BRAIN
|
| 5 |
model = InferenceClientModel(
|
|
|
|
| 8 |
)
|
| 9 |
|
| 10 |
# 2. THE RESEARCHER (Specialist)
|
| 11 |
+
# We define it as a standard CodeAgent.
|
| 12 |
+
# Providing a 'name' and 'description' is what makes it "manageable."
|
| 13 |
+
researcher = CodeAgent(
|
| 14 |
tools=[DuckDuckGoSearchTool()],
|
| 15 |
model=model,
|
| 16 |
+
name="research_specialist",
|
| 17 |
+
description="Expert at web search and retrieving technical data. Use this agent for any web-based questions."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
# 3. THE BOSS (Manager)
|
| 21 |
+
# We pass the researcher agent directly into the managed_agents list.
|
| 22 |
manager = CodeAgent(
|
| 23 |
tools=[],
|
| 24 |
model=model,
|
| 25 |
+
managed_agents=[researcher],
|
| 26 |
add_base_tools=True
|
| 27 |
)
|
| 28 |
|
| 29 |
+
# Set the Mission for the Boss
|
| 30 |
+
manager.system_prompt = """You are the BOSS OPERATOR (Elite PhD Level).
|
| 31 |
+
1. Delegate sub-tasks to 'research_specialist' for web data.
|
| 32 |
2. Use Python for math ($E=mc^2$) and data analysis.
|
| 33 |
+
3. Provide final answers in professional Markdown tables."""
|
| 34 |
|
| 35 |
if __name__ == "__main__":
|
| 36 |
GradioUI(manager).launch()
|