Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -262,7 +262,8 @@ class BasicAgent:
|
|
| 262 |
|
| 263 |
return [
|
| 264 |
# web_search,
|
| 265 |
-
wikipedia_search, python_calculator
|
|
|
|
| 266 |
# , file_analyzer
|
| 267 |
]
|
| 268 |
|
|
@@ -312,35 +313,21 @@ class BasicAgent:
|
|
| 312 |
"action_type": "final"
|
| 313 |
}
|
| 314 |
|
| 315 |
-
planning_prompt = f"""
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
- simple_math: Quick arithmetic, basic math functions
|
| 331 |
-
- file_analyzer: Examine uploaded files
|
| 332 |
-
|
| 333 |
-
PLANNING STRATEGY:
|
| 334 |
-
1. Identify the EXACT answer format needed (number, name, date, etc.)
|
| 335 |
-
2. Determine the specific information required
|
| 336 |
-
3. Choose the BEST tool for that information type
|
| 337 |
-
4. Plan for verification if needed
|
| 338 |
-
|
| 339 |
-
RESPONSE FORMAT:
|
| 340 |
-
If you need to use a tool: "EXECUTE: [tool_name] | INPUT: [specific_input] | GOAL: [what_you_expect]"
|
| 341 |
-
If you have the final answer: "FINAL: [exact_answer_only]"
|
| 342 |
-
|
| 343 |
-
Be extremely specific in your tool inputs. Avoid vague searches."""
|
| 344 |
|
| 345 |
response = self.model.invoke([{"role": "system", "content": planning_prompt}])
|
| 346 |
content = response.content.strip()
|
|
@@ -399,7 +386,7 @@ Be extremely specific in your tool inputs. Avoid vague searches."""
|
|
| 399 |
# "web_search": ["web", "search", "google", "internet"],
|
| 400 |
"wikipedia_search": ["wiki", "wikipedia"],
|
| 401 |
"python_calculator": ["python", "code", "calc", "calculate"],
|
| 402 |
-
"simple_math": ["math", "arithmetic"],
|
| 403 |
# "file_analyzer": ["file", "analyze"]
|
| 404 |
}
|
| 405 |
|
|
|
|
| 262 |
|
| 263 |
return [
|
| 264 |
# web_search,
|
| 265 |
+
wikipedia_search, python_calculator
|
| 266 |
+
# , simple_math
|
| 267 |
# , file_analyzer
|
| 268 |
]
|
| 269 |
|
|
|
|
| 313 |
"action_type": "final"
|
| 314 |
}
|
| 315 |
|
| 316 |
+
planning_prompt = f"""
|
| 317 |
+
You are a general AI assistant. I will ask you a question.
|
| 318 |
+
Report your thoughts, and finish your answer with the following template:
|
| 319 |
+
FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
| 320 |
+
If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise.
|
| 321 |
+
If you are asked for a string, don't use articles,
|
| 322 |
+
neither abbreviations (e.g. for cities),
|
| 323 |
+
and write the digits in plain text unless specified otherwise.
|
| 324 |
+
If you are asked for a comma separated list,
|
| 325 |
+
apply the above rules depending of whether the element to be put in the list is a number or a string.
|
| 326 |
+
|
| 327 |
+
QUESTION: {messages[0]['content'] if messages else 'No question provided'}
|
| 328 |
+
|
| 329 |
+
EXECUTION HISTORY: {plan_history}
|
| 330 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 331 |
|
| 332 |
response = self.model.invoke([{"role": "system", "content": planning_prompt}])
|
| 333 |
content = response.content.strip()
|
|
|
|
| 386 |
# "web_search": ["web", "search", "google", "internet"],
|
| 387 |
"wikipedia_search": ["wiki", "wikipedia"],
|
| 388 |
"python_calculator": ["python", "code", "calc", "calculate"],
|
| 389 |
+
# "simple_math": ["math", "arithmetic"],
|
| 390 |
# "file_analyzer": ["file", "analyze"]
|
| 391 |
}
|
| 392 |
|