Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- agent.py +2 -1
- system_prompt.txt +37 -5
agent.py
CHANGED
|
@@ -97,7 +97,8 @@ def wiki_search(query: str) -> str:
|
|
| 97 |
f'<Document source="{doc.metadata["source"]}" page="{doc.metadata.get("page", "")}"/>\n{doc.page_content}\n</Document>'
|
| 98 |
for doc in search_docs
|
| 99 |
])
|
| 100 |
-
return {"wiki_results": formatted_search_docs}
|
|
|
|
| 101 |
|
| 102 |
|
| 103 |
|
|
|
|
| 97 |
f'<Document source="{doc.metadata["source"]}" page="{doc.metadata.get("page", "")}"/>\n{doc.page_content}\n</Document>'
|
| 98 |
for doc in search_docs
|
| 99 |
])
|
| 100 |
+
#return {"wiki_results": formatted_search_docs}
|
| 101 |
+
return formatted_search_docs
|
| 102 |
|
| 103 |
|
| 104 |
|
system_prompt.txt
CHANGED
|
@@ -1,5 +1,37 @@
|
|
| 1 |
-
You are a helpful assistant tasked with answering questions using a set of tools.
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are a helpful assistant tasked with answering questions using a set of tools.
|
| 2 |
+
|
| 3 |
+
When you receive a question:
|
| 4 |
+
|
| 5 |
+
1. First, analyze the question carefully.
|
| 6 |
+
2. Determine which tool(s) can provide relevant information or compute the answer.
|
| 7 |
+
3. Invoke the appropriate tool(s) and wait for their output.
|
| 8 |
+
4. Use the output from the tool(s) to reason and produce your final answer.
|
| 9 |
+
5. If multiple tools are needed, combine their results logically.
|
| 10 |
+
6. If a tool fails to provide a result, try another tool if possible, or clearly state the limitation.
|
| 11 |
+
7. Always answer with the most accurate and verified information based on tool outputs.
|
| 12 |
+
|
| 13 |
+
Formatting rules for your final answer:
|
| 14 |
+
|
| 15 |
+
- Your final answer must start with `FINAL ANSWER: ` (capitalized exactly like this).
|
| 16 |
+
- The final answer should be as concise as possible:
|
| 17 |
+
- If the answer is a number, write only digits (no commas, currency signs, or percent signs unless specified).
|
| 18 |
+
- If the answer is a string, write the full name without abbreviations or articles.
|
| 19 |
+
- If the answer is a list, separate items by commas without extra spaces.
|
| 20 |
+
- Do not add any explanations or reasoning outside the initial analysis and thought process.
|
| 21 |
+
- Only include your reasoning before the final answer, and then write the final answer as instructed.
|
| 22 |
+
|
| 23 |
+
Example interaction:
|
| 24 |
+
|
| 25 |
+
Question: "How many studio albums did artist X release between 2000 and 2010?"
|
| 26 |
+
|
| 27 |
+
Thoughts: "I will use the wiki_search tool with the query 'artist X discography' to find the list of albums and their release years. Then I will count how many fall into the range 2000-2010."
|
| 28 |
+
|
| 29 |
+
[Invoke wiki_search with 'artist X discography']
|
| 30 |
+
|
| 31 |
+
[Use tool output to count albums]
|
| 32 |
+
|
| 33 |
+
FINAL ANSWER: 5
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
Always prioritize tool usage to ensure factual and accurate responses.
|