Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -403,7 +403,7 @@ class MagAgent:
|
|
| 403 |
if missing := required_keys - set(self.prompt_templates.keys()):
|
| 404 |
raise ValueError(f"Missing required prompt templates: {missing}")
|
| 405 |
|
| 406 |
-
required_managed_agent_vars = {'task_id', 'task', 'timestamp', 'question_analysis', 'subtasks', 'validation_rules'}
|
| 407 |
if missing_vars := required_managed_agent_vars - set(self.prompt_templates["managed_agent"]["variables"]):
|
| 408 |
raise ValueError(f"Missing required variables in managed_agent template: {missing_vars}")
|
| 409 |
|
|
@@ -430,10 +430,11 @@ class MagAgent:
|
|
| 430 |
def _create_context(self, question: str, task_id: str) -> dict:
|
| 431 |
"""Create context dictionary for the task."""
|
| 432 |
return {
|
| 433 |
-
"
|
| 434 |
"task_id": task_id,
|
| 435 |
"timestamp": datetime.now().isoformat(),
|
| 436 |
-
"validation_checks": []
|
|
|
|
| 437 |
}
|
| 438 |
|
| 439 |
def _build_task_prompt(self, question: str, task_id: str) -> str:
|
|
@@ -445,7 +446,8 @@ class MagAgent:
|
|
| 445 |
"timestamp": datetime.now().isoformat(),
|
| 446 |
"question_analysis": self._generate_analysis(question),
|
| 447 |
"subtasks": self._generate_subtasks(question),
|
| 448 |
-
"validation_rules": self._get_validation_rules(question)
|
|
|
|
| 449 |
}
|
| 450 |
return template.format(**variables)
|
| 451 |
|
|
|
|
| 403 |
if missing := required_keys - set(self.prompt_templates.keys()):
|
| 404 |
raise ValueError(f"Missing required prompt templates: {missing}")
|
| 405 |
|
| 406 |
+
required_managed_agent_vars = {'task_id', 'task', 'timestamp', 'question_analysis', 'subtasks', 'validation_rules', 'report'}
|
| 407 |
if missing_vars := required_managed_agent_vars - set(self.prompt_templates["managed_agent"]["variables"]):
|
| 408 |
raise ValueError(f"Missing required variables in managed_agent template: {missing_vars}")
|
| 409 |
|
|
|
|
| 430 |
def _create_context(self, question: str, task_id: str) -> dict:
|
| 431 |
"""Create context dictionary for the task."""
|
| 432 |
return {
|
| 433 |
+
"task": question,
|
| 434 |
"task_id": task_id,
|
| 435 |
"timestamp": datetime.now().isoformat(),
|
| 436 |
+
"validation_checks": [],
|
| 437 |
+
"report": None
|
| 438 |
}
|
| 439 |
|
| 440 |
def _build_task_prompt(self, question: str, task_id: str) -> str:
|
|
|
|
| 446 |
"timestamp": datetime.now().isoformat(),
|
| 447 |
"question_analysis": self._generate_analysis(question),
|
| 448 |
"subtasks": self._generate_subtasks(question),
|
| 449 |
+
"validation_rules": self._get_validation_rules(question),
|
| 450 |
+
"report": None
|
| 451 |
}
|
| 452 |
return template.format(**variables)
|
| 453 |
|