Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -310,37 +310,25 @@ def assistant(state: AgentState, llm_with_tools):
|
|
| 310 |
# Do not ask the user to upload files."""
|
| 311 |
previous_message = state["messages"]
|
| 312 |
sys_msg = SystemMessage(content=f"""
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
3. Clicked "PDF".
|
| 333 |
-
4. Found the calculations for the volume of the fish bag and noted them.
|
| 334 |
-
Tools:
|
| 335 |
-
1. GoogleSearchAPIWrapper(k=10).run
|
| 336 |
-
2. PDF access
|
| 337 |
-
3. web_search
|
| 338 |
-
|
| 339 |
-
- FINAL ANSWER: 0.1777
|
| 340 |
-
|
| 341 |
-
==========================
|
| 342 |
-
|
| 343 |
-
Now, please answer the following question step by step.""")
|
| 344 |
|
| 345 |
return {"messages": [llm_with_tools.invoke([sys_msg] + state["messages"])], "input_file": state["input_file"]}
|
| 346 |
|
|
|
|
| 310 |
# Do not ask the user to upload files."""
|
| 311 |
previous_message = state["messages"]
|
| 312 |
sys_msg = SystemMessage(content=f"""
|
| 313 |
+
You are a helpful assistant tasked with answering questions using a set of tools.
|
| 314 |
+
|
| 315 |
+
Instructions:
|
| 316 |
+
1. Read the question carefully.
|
| 317 |
+
2. Use any available tools first.
|
| 318 |
+
3. If tools do not help, search online.
|
| 319 |
+
4. Use your own knowledge if all else fails.
|
| 320 |
+
5. Think step-by-step and explain your reasoning.
|
| 321 |
+
6. Extract the final answer from your reasoning and put it in the following format:
|
| 322 |
+
|
| 323 |
+
FINAL ANSWER: <your answer here> ← use this line exactly
|
| 324 |
+
|
| 325 |
+
Rules for FINAL ANSWER:
|
| 326 |
+
- If it's a number, write the digits without commas or units unless specified.
|
| 327 |
+
- If it's a string, do not repeat it, do not include articles or abbreviations, write digits in words if requested. If it is a string of number, use the number first.
|
| 328 |
+
- If it's a list, separate items with commas, and follow the above rules per item.
|
| 329 |
+
- DO NOT include square brackets around the answer.
|
| 330 |
+
|
| 331 |
+
Finally, in a new line, ONLY print the FINAL ANSWER, nothing else.""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
|
| 333 |
return {"messages": [llm_with_tools.invoke([sys_msg] + state["messages"])], "input_file": state["input_file"]}
|
| 334 |
|