supratipb commited on
Commit
f939e66
Β·
verified Β·
1 Parent(s): c39e7b4

Upload 2 files

Browse files
Files changed (2) hide show
  1. agent.py +2 -1
  2. 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
- Now, I will ask you a question. Report your thoughts, and finish your answer with the following template:
3
- FINAL ANSWER: [YOUR FINAL ANSWER].
4
- YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. 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. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
5
- Your answer should only start with "FINAL ANSWER: ", then follows with the answer.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.