KaiserShultz commited on
Commit
c4dbcb0
·
verified ·
1 Parent(s): f250bd4

Update src/prompts/prompts.py

Browse files
Files changed (1) hide show
  1. src/prompts/prompts.py +58 -13
src/prompts/prompts.py CHANGED
@@ -105,23 +105,24 @@ Example 1: "Analyze sales data and calculate growth rates"
105
  {{"id": "s2", "goal": "Calculate monthly growth rates using Python", "tool": "safe_code_run"}},
106
  {{"id": "s3", "goal": "Generate summary statistics and trends", "tool": "safe_code_run"}}
107
  ]
108
- }}ф
109
 
110
  Example 2: "Research recent AI developments and summarize key trends"
111
  {{
112
  "steps": [
113
- {{"id": "s1", "goal": "Search for recent AI news and developments", "tool": "web_search"}},
114
- {{"id": "s2", "goal": "Extract all info from founded urls", "tool": "web_extract"}},
115
- {{"id": "s3", "goal": "Extract and organize key information from articles", "tool": "analyze_(csv, docx, pdf etc.)_file"}},
116
- {{"id": "s4", "goal": "Analyze and synthesize key trends from gathered information", "tool": null}}
 
117
  ]
118
  }}
119
 
120
  Example 3: "Compare performance metrics between two datasets"
121
  {{
122
  "steps": [
123
- {{"id": "s1", "goal": "Load first dataset and examine structure", "tool": "analyze_(csv, docx, pdf etc.)_file"}},
124
- {{"id": "s2", "goal": "Load second dataset and examine structure", "tool": "analyze_(csv, docx, pdf etc.)_file"}},
125
  {{"id": "s3", "goal": "Calculate statistical metrics for both datasets using code", "tool": "safe_code_run"}},
126
  {{"id": "s4", "goal": "Perform statistical comparison and significance testing", "tool": "safe_code_run"}}
127
  ]
@@ -130,13 +131,24 @@ Example 3: "Compare performance metrics between two datasets"
130
  Example 4: "Create a budget analysis from expense data"
131
  {{
132
  "steps": [
133
- {{"id": "s1", "goal": "Load expense data and validate format", "tool": "analyze_(csv, docx, pdf etc.)_file"}},
134
  {{"id": "s2", "goal": "Calculate category totals and percentages using code", "tool": "safe_code_run"}},
135
  {{"id": "s3", "goal": "Generate budget variance analysis and projections", "tool": "safe_code_run"}},
136
  {{"id": "s4", "goal": "Create visualization of spending patterns", "tool": "safe_code_run"}}
137
  ]
138
  }}
139
 
 
 
 
 
 
 
 
 
 
 
 
140
  Return a single JSON object with this structure:
141
  {{
142
  "task_type": "info|calc|table|doc_qa|image_qa|multi_hop",
@@ -159,15 +171,48 @@ Return a single JSON object with this structure:
159
 
160
  Ground rules:
161
  - Prefer 2-4 steps for most tasks. Single steps only for truly trivial queries. Calculation tasks must use tools always.
162
- - Break down complex tasks into logical components - don't try to solve everything at once
163
  - Use tool names exactly as listed. If no tool is needed, set "tool": null.
164
  - Never assume files or URLs exist—plan to search/extract before analysing.
165
  - Skip download steps when the required file is already provided.
166
  - Ensure later steps only depend on results created by earlier steps.
167
- - For any numerical work: ALWAYS use tools (calculator/code) - never manual calculation
168
- - If the query involves analysis of multiple sources, plan separate steps for each source
169
- - Consider data validation and error checking as separate steps when handling files
170
- - Plan for visualization or formatting steps when presenting complex results
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  """
172
 
173
  COMPLEXITY_ASSESSOR_PROMPT = """
 
105
  {{"id": "s2", "goal": "Calculate monthly growth rates using Python", "tool": "safe_code_run"}},
106
  {{"id": "s3", "goal": "Generate summary statistics and trends", "tool": "safe_code_run"}}
107
  ]
108
+ }}
109
 
110
  Example 2: "Research recent AI developments and summarize key trends"
111
  {{
112
  "steps": [
113
+ {{"id": "s1", "goal": "Search for recent AI news and developments", "tool": "tavily_search"}},
114
+ {{"id": "s2", "goal": "Extract key links and pick relevant documents (PDF, reports)", "tool": "tavilyextract"}},
115
+ {{"id": "s3", "goal": "Download chosen report for detailed analysis", "tool": "download_file_from_url"}},
116
+ {{"id": "s4", "goal": "Analyze the downloaded document (PDF/DOCX/TXT)", "tool": "analyze_pdf_file"}},
117
+ {{"id": "s5", "goal": "Summarize and synthesize key insights from the analyzed content", "tool": null}}
118
  ]
119
  }}
120
 
121
  Example 3: "Compare performance metrics between two datasets"
122
  {{
123
  "steps": [
124
+ {{"id": "s1", "goal": "Load first dataset and examine structure", "tool": "analyze_csv_file"}},
125
+ {{"id": "s2", "goal": "Load second dataset and examine structure", "tool": "analyze_excel_file"}},
126
  {{"id": "s3", "goal": "Calculate statistical metrics for both datasets using code", "tool": "safe_code_run"}},
127
  {{"id": "s4", "goal": "Perform statistical comparison and significance testing", "tool": "safe_code_run"}}
128
  ]
 
131
  Example 4: "Create a budget analysis from expense data"
132
  {{
133
  "steps": [
134
+ {{"id": "s1", "goal": "Load expense data and validate format", "tool": "analyze_csv_file"}},
135
  {{"id": "s2", "goal": "Calculate category totals and percentages using code", "tool": "safe_code_run"}},
136
  {{"id": "s3", "goal": "Generate budget variance analysis and projections", "tool": "safe_code_run"}},
137
  {{"id": "s4", "goal": "Create visualization of spending patterns", "tool": "safe_code_run"}}
138
  ]
139
  }}
140
 
141
+ Example 5: "Find and analyze a scientific PDF report on renewable energy"
142
+ {{
143
+ "steps": [
144
+ {{"id": "s1", "goal": "Search the web for renewable energy PDF reports", "tool": "tavily_search"}},
145
+ {{"id": "s2", "goal": "Extract candidate PDF links from the search results", "tool": "tavilyextract"}},
146
+ {{"id": "s3", "goal": "Download the most relevant PDF document", "tool": "download_file_from_url"}},
147
+ {{"id": "s4", "goal": "Parse and extract text from the downloaded PDF", "tool": "analyze_pdf_file"}},
148
+ {{"id": "s5", "goal": "Summarize findings and highlight key trends in renewable energy", "tool": null}}
149
+ ]
150
+ }}
151
+
152
  Return a single JSON object with this structure:
153
  {{
154
  "task_type": "info|calc|table|doc_qa|image_qa|multi_hop",
 
171
 
172
  Ground rules:
173
  - Prefer 2-4 steps for most tasks. Single steps only for truly trivial queries. Calculation tasks must use tools always.
174
+ - Break down complex tasks into logical components - don't try to solve everything at once.
175
  - Use tool names exactly as listed. If no tool is needed, set "tool": null.
176
  - Never assume files or URLs exist—plan to search/extract before analysing.
177
  - Skip download steps when the required file is already provided.
178
  - Ensure later steps only depend on results created by earlier steps.
179
+ - For any numerical work: ALWAYS use tools (calculator/code) - never manual calculation.
180
+ - If the query involves analysis of multiple sources, plan separate steps for each source.
181
+ - Consider data validation and error checking as separate steps when handling files.
182
+ - Plan for visualization or formatting steps when presenting complex results.
183
+ """
184
+
185
+
186
+ SYSTEM_EXECUTOR_PROMPT = """
187
+ You are the executor of a grounded multi-tool agent.
188
+
189
+ Plan summary: {plan_summary}
190
+ Step map:
191
+ {plan_overview}
192
+
193
+ Current focus: {current_step_id} — {step_goal}
194
+ Suggested tool: {step_tool}
195
+ Available tools: {tool_catalogue}
196
+ Known local files: {file_list}
197
+
198
+ CRITICAL COMPUTATION RULE: You MUST use tools for ANY numerical calculation, counting, or mathematical operation. This includes:
199
+ - Simple arithmetic (use tools add, subtract, multiply, divide, power)
200
+ - Data analysis and statistics (use safe_code_run)
201
+ - Counting items, rows, or occurrences (use safe_code_run)
202
+ - Percentage calculations (use add, subtract, multiply, divide, power/safe_code_run)
203
+ - Any mathematical transformation or formula application
204
+
205
+ NEVER perform manual calculations or provide estimated numbers.
206
+
207
+ Execution rules:
208
+ 1. Stay aligned with the plan—no new steps or speculative actions.
209
+ 2. Before every tool call, respond with <REASONING>…</REASONING> explaining the step, chosen tool, inputs, and expected outcome.
210
+ 3. Call at most one tool per turn. After a successful step, state "STEP COMPLETE".
211
+ 4. If required inputs are missing (e.g., file not downloaded), explain the issue in <REASONING> and wait for replanning.
212
+ 5. Never invent file paths, URLs, or results. When unsure, request replanning instead of guessing.
213
+ 6. If no tool is needed, answer directly after the reasoning.
214
+ 7. For any calculation task: MANDATORY use of appropriate computational tools
215
+ 8. Validate your tool results before marking steps complete
216
  """
217
 
218
  COMPLEXITY_ASSESSOR_PROMPT = """