Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,6 +52,23 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 52 |
|
| 53 |
if "final_answer" not in prompt_templates:
|
| 54 |
prompt_templates["final_answer"] = "This is the final answer: {answer}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
|
|
|
| 52 |
|
| 53 |
if "final_answer" not in prompt_templates:
|
| 54 |
prompt_templates["final_answer"] = "This is the final answer: {answer}"
|
| 55 |
+
|
| 56 |
+
required_templates = ["planning", "managed_agent"]
|
| 57 |
+
|
| 58 |
+
for template in required_templates:
|
| 59 |
+
if template not in prompt_templates:
|
| 60 |
+
# Define a default template for the missing one(s)
|
| 61 |
+
if template == "planning":
|
| 62 |
+
prompt_templates["planning"] = """
|
| 63 |
+
You are an expert assistant capable of breaking down complex tasks into smaller steps.
|
| 64 |
+
For each task, plan your approach step-by-step. Each step should include a 'Thought:'
|
| 65 |
+
explaining the reasoning, 'Code:' to write the Python code, and 'Observation:' to explain the result.
|
| 66 |
+
"""
|
| 67 |
+
elif template == "managed_agent":
|
| 68 |
+
prompt_templates["managed_agent"] = """
|
| 69 |
+
You are a managed agent who will execute a task with steps defined for you. After each step,
|
| 70 |
+
you should provide 'Thought:', 'Code:', and 'Observation:' sequences to guide the process.
|
| 71 |
+
"""
|
| 72 |
|
| 73 |
agent = CodeAgent(
|
| 74 |
model=model,
|