Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
|
@@ -22,6 +22,7 @@ from dataclasses import dataclass
|
|
| 22 |
# smolagents imports
|
| 23 |
from smolagents import (
|
| 24 |
CodeAgent,
|
|
|
|
| 25 |
DuckDuckGoSearchTool,
|
| 26 |
InferenceClientModel,
|
| 27 |
tool,
|
|
@@ -280,28 +281,34 @@ class PersonalProductivityAgent:
|
|
| 280 |
create_meeting_summary
|
| 281 |
]
|
| 282 |
|
| 283 |
-
# Custom system prompt
|
| 284 |
-
custom_system_prompt = """You are an advanced Personal Productivity Assistant
|
| 285 |
|
| 286 |
-
You help users manage their daily tasks, schedule, communications, and information needs.
|
| 287 |
|
| 288 |
-
|
| 289 |
- Task management (add, list, complete tasks)
|
| 290 |
-
- Time and date calculations
|
| 291 |
-
- Weather information
|
| 292 |
- Web search and research
|
| 293 |
- Email composition (mock)
|
| 294 |
- Meeting planning and templates
|
| 295 |
-
- General calculations
|
| 296 |
|
| 297 |
-
Always
|
| 298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 299 |
|
| 300 |
-
|
| 301 |
-
|
|
|
|
|
|
|
| 302 |
tools=[self.search_tool] + self.custom_tools,
|
| 303 |
model=self.model,
|
| 304 |
-
add_base_tools=True, # Adds basic tools
|
| 305 |
planning_interval=3 # Plan every 3 steps
|
| 306 |
)
|
| 307 |
|
|
@@ -310,6 +317,7 @@ When users ask for help, offer multiple options and explain your reasoning."""
|
|
| 310 |
self.agent.prompt_templates['system_prompt'] = custom_system_prompt
|
| 311 |
|
| 312 |
print("✅ Personal Productivity Agent initialized successfully!")
|
|
|
|
| 313 |
print(f"🤖 Model: {self.model.model if hasattr(self.model, 'model') else 'Unknown'}")
|
| 314 |
print(f"🔧 Tools available: {len(self.custom_tools) + 1} custom + base tools")
|
| 315 |
|
|
|
|
| 22 |
# smolagents imports
|
| 23 |
from smolagents import (
|
| 24 |
CodeAgent,
|
| 25 |
+
ToolCallingAgent,
|
| 26 |
DuckDuckGoSearchTool,
|
| 27 |
InferenceClientModel,
|
| 28 |
tool,
|
|
|
|
| 281 |
create_meeting_summary
|
| 282 |
]
|
| 283 |
|
| 284 |
+
# Custom system prompt for ToolCallingAgent
|
| 285 |
+
custom_system_prompt = """You are Alfred, an advanced Personal Productivity Assistant.
|
| 286 |
|
| 287 |
+
You help users manage their daily tasks, schedule, communications, and information needs by using the available tools effectively.
|
| 288 |
|
| 289 |
+
Available capabilities:
|
| 290 |
- Task management (add, list, complete tasks)
|
| 291 |
+
- Time and date calculations
|
| 292 |
+
- Weather information lookup
|
| 293 |
- Web search and research
|
| 294 |
- Email composition (mock)
|
| 295 |
- Meeting planning and templates
|
| 296 |
+
- General calculations
|
| 297 |
|
| 298 |
+
Always:
|
| 299 |
+
- Be helpful, concise, and professional
|
| 300 |
+
- Use the appropriate tools to fulfill requests
|
| 301 |
+
- Provide clear, actionable responses
|
| 302 |
+
- Suggest productivity improvements when relevant
|
| 303 |
+
- Call tools when needed rather than making up information
|
| 304 |
|
| 305 |
+
When users ask questions, analyze what tools you need and use them to provide accurate, helpful responses."""
|
| 306 |
+
|
| 307 |
+
# Initialize the ToolCallingAgent (more reliable than CodeAgent)
|
| 308 |
+
self.agent = ToolCallingAgent(
|
| 309 |
tools=[self.search_tool] + self.custom_tools,
|
| 310 |
model=self.model,
|
| 311 |
+
add_base_tools=True, # Adds basic tools
|
| 312 |
planning_interval=3 # Plan every 3 steps
|
| 313 |
)
|
| 314 |
|
|
|
|
| 317 |
self.agent.prompt_templates['system_prompt'] = custom_system_prompt
|
| 318 |
|
| 319 |
print("✅ Personal Productivity Agent initialized successfully!")
|
| 320 |
+
print(f"🤖 Agent Type: ToolCallingAgent (more reliable)")
|
| 321 |
print(f"🤖 Model: {self.model.model if hasattr(self.model, 'model') else 'Unknown'}")
|
| 322 |
print(f"🔧 Tools available: {len(self.custom_tools) + 1} custom + base tools")
|
| 323 |
|