fix bug
Browse files
app.py
CHANGED
|
@@ -207,14 +207,22 @@ class GAIAAgent:
|
|
| 207 |
self.setup_model(api_key)
|
| 208 |
self.setup_tools()
|
| 209 |
|
|
|
|
|
|
|
|
|
|
| 210 |
# Create code execution agent (based on smolagents)
|
| 211 |
self.code_agent = CodeAgent(
|
| 212 |
model=self.model,
|
| 213 |
tools=self.tools,
|
| 214 |
-
system_prompt=self.create_system_prompt(),
|
| 215 |
verbosity_level=1 # 0=quiet, 1=normal, 2=verbose
|
| 216 |
)
|
| 217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
# Set up state machine workflow (inspired by langgraph)
|
| 219 |
self.setup_workflow()
|
| 220 |
|
|
@@ -289,7 +297,7 @@ class GAIAAgent:
|
|
| 289 |
5. For numerical answers, return only the number (no units or explanation).
|
| 290 |
6. For text answers, ensure exact matching of the correct words.
|
| 291 |
IMPORTANT: The final answer must be simple and direct, without extra explanation. For example, if the question is "What is 2+2?", the answer should simply be "4", not "2+2 equals 4".
|
| 292 |
-
|
| 293 |
|
| 294 |
def setup_workflow(self):
|
| 295 |
"""Set up the agent's state workflow (inspired by langgraph)"""
|
|
|
|
| 207 |
self.setup_model(api_key)
|
| 208 |
self.setup_tools()
|
| 209 |
|
| 210 |
+
# Create custom prompt template based on our system prompt
|
| 211 |
+
self.custom_prompt = self.create_system_prompt()
|
| 212 |
+
|
| 213 |
# Create code execution agent (based on smolagents)
|
| 214 |
self.code_agent = CodeAgent(
|
| 215 |
model=self.model,
|
| 216 |
tools=self.tools,
|
|
|
|
| 217 |
verbosity_level=1 # 0=quiet, 1=normal, 2=verbose
|
| 218 |
)
|
| 219 |
|
| 220 |
+
# Modify the agent's prompt templates to include our custom prompt
|
| 221 |
+
# This is how smolagents handles custom system prompts
|
| 222 |
+
if hasattr(self.code_agent, 'prompt_templates') and 'system_prompt' in self.code_agent.prompt_templates:
|
| 223 |
+
original_prompt = self.code_agent.prompt_templates['system_prompt']
|
| 224 |
+
self.code_agent.prompt_templates['system_prompt'] = original_prompt + "\n\n" + self.custom_prompt
|
| 225 |
+
|
| 226 |
# Set up state machine workflow (inspired by langgraph)
|
| 227 |
self.setup_workflow()
|
| 228 |
|
|
|
|
| 297 |
5. For numerical answers, return only the number (no units or explanation).
|
| 298 |
6. For text answers, ensure exact matching of the correct words.
|
| 299 |
IMPORTANT: The final answer must be simple and direct, without extra explanation. For example, if the question is "What is 2+2?", the answer should simply be "4", not "2+2 equals 4".
|
| 300 |
+
"""
|
| 301 |
|
| 302 |
def setup_workflow(self):
|
| 303 |
"""Set up the agent's state workflow (inspired by langgraph)"""
|