Spaces:
Runtime error
Runtime error
Scott Cogan commited on
Commit ·
3e7082a
1
Parent(s): 969a900
fix: Update template processing and agent configuration
Browse files- app.py +3 -1
- prompts.yaml +3 -3
app.py
CHANGED
|
@@ -87,7 +87,9 @@ agent = CodeAgent(
|
|
| 87 |
planning_interval=1, # Added planning interval to ensure proper planning
|
| 88 |
name="question_answering_agent",
|
| 89 |
description="An agent specialized in answering various types of questions using available tools. The agent must use the final_answer tool to submit its answer.",
|
| 90 |
-
prompt_templates=prompt_templates
|
|
|
|
|
|
|
| 91 |
)
|
| 92 |
|
| 93 |
# Configure Gradio UI with sharing enabled
|
|
|
|
| 87 |
planning_interval=1, # Added planning interval to ensure proper planning
|
| 88 |
name="question_answering_agent",
|
| 89 |
description="An agent specialized in answering various types of questions using available tools. The agent must use the final_answer tool to submit its answer.",
|
| 90 |
+
prompt_templates=prompt_templates,
|
| 91 |
+
authorized_imports=config.get("authorized_imports", []), # Add authorized imports from config
|
| 92 |
+
tools_dict={tool.name: tool for tool in [final_answer, DuckDuckGoSearchTool(), calculate_min_price, extract_price_from_snippet, get_current_time_in_timezone]} # Add tools dictionary
|
| 93 |
)
|
| 94 |
|
| 95 |
# Configure Gradio UI with sharing enabled
|
prompts.yaml
CHANGED
|
@@ -22,8 +22,8 @@ prompt_templates:
|
|
| 22 |
d. Use final_answer to submit your response
|
| 23 |
|
| 24 |
Available tools:
|
| 25 |
-
{% for tool in
|
| 26 |
-
- {{
|
| 27 |
{% endfor %}
|
| 28 |
|
| 29 |
Here are the rules you should always follow to solve your task:
|
|
@@ -34,7 +34,7 @@ prompt_templates:
|
|
| 34 |
5. Call a tool only when needed, and never re-do a tool call that you previously did with the exact same parameters.
|
| 35 |
6. Don't name any new variable with the same name as a tool.
|
| 36 |
7. Never create any notional variables in our code.
|
| 37 |
-
8. You can use imports in your code, but only from the following list of modules: {{ authorized_imports }}
|
| 38 |
9. The state persists between code executions.
|
| 39 |
10. Don't give up! You're in charge of solving the task, not providing directions to solve it.
|
| 40 |
|
|
|
|
| 22 |
d. Use final_answer to submit your response
|
| 23 |
|
| 24 |
Available tools:
|
| 25 |
+
{% for tool_name, tool in tools_dict.items() %}
|
| 26 |
+
- {{ tool_name }}: {{ tool.description }}
|
| 27 |
{% endfor %}
|
| 28 |
|
| 29 |
Here are the rules you should always follow to solve your task:
|
|
|
|
| 34 |
5. Call a tool only when needed, and never re-do a tool call that you previously did with the exact same parameters.
|
| 35 |
6. Don't name any new variable with the same name as a tool.
|
| 36 |
7. Never create any notional variables in our code.
|
| 37 |
+
8. You can use imports in your code, but only from the following list of modules: {{ authorized_imports | join(', ') }}
|
| 38 |
9. The state persists between code executions.
|
| 39 |
10. Don't give up! You're in charge of solving the task, not providing directions to solve it.
|
| 40 |
|