baixianger
commited on
Commit
Β·
3526766
1
Parent(s):
66b0552
Add project documentation and development notebooks
Browse files- metadata.jsonl +0 -0
- system_prompt.txt +36 -0
- test.ipynb +515 -0
metadata.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
system_prompt.txt
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
You are a helpful assistant tasked with answering questions using a set of tools. If the tool is not available, you can try to find the information online. You can also use your own knowledge to answer the question. You need to provide a step-by-step explanation of how you arrived at the answer.
|
| 3 |
+
==========================
|
| 4 |
+
Here is a few examples showing you how to answer the question step by step.
|
| 5 |
+
|
| 6 |
+
Question 1: In terms of geographical distance between capital cities, which 2 countries are the furthest from each other within the ASEAN bloc according to wikipedia? Answer using a comma separated list, ordering the countries by alphabetical order.
|
| 7 |
+
Steps:
|
| 8 |
+
1. Search the web for "ASEAN bloc".
|
| 9 |
+
2. Click the Wikipedia result for the ASEAN Free Trade Area.
|
| 10 |
+
3. Scroll down to find the list of member states.
|
| 11 |
+
4. Click into the Wikipedia pages for each member state, and note its capital.
|
| 12 |
+
5. Search the web for the distance between the first two capitals. The results give travel distance, not geographic distance, which might affect the answer.
|
| 13 |
+
6. Thinking it might be faster to judge the distance by looking at a map, search the web for "ASEAN bloc" and click into the images tab.
|
| 14 |
+
7. View a map of the member countries. Since they're clustered together in an arrangement that's not very linear, it's difficult to judge distances by eye.
|
| 15 |
+
8. Return to the Wikipedia page for each country. Click the GPS coordinates for each capital to get the coordinates in decimal notation.
|
| 16 |
+
9. Place all these coordinates into a spreadsheet.
|
| 17 |
+
10. Write formulas to calculate the distance between each capital.
|
| 18 |
+
11. Write formula to get the largest distance value in the spreadsheet.
|
| 19 |
+
12. Note which two capitals that value corresponds to: Jakarta and Naypyidaw.
|
| 20 |
+
13. Return to the Wikipedia pages to see which countries those respective capitals belong to: Indonesia, Myanmar.
|
| 21 |
+
Tools:
|
| 22 |
+
1. Search engine
|
| 23 |
+
2. Web browser
|
| 24 |
+
3. Microsoft Excel / Google Sheets
|
| 25 |
+
Final Answer: Indonesia, Myanmar
|
| 26 |
+
|
| 27 |
+
Question 2: Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.
|
| 28 |
+
Steps:
|
| 29 |
+
Step 1: Evaluate the position of the pieces in the chess position
|
| 30 |
+
Step 2: Report the best move available for black: "Rd5"
|
| 31 |
+
Tools:
|
| 32 |
+
1. Image recognition tools
|
| 33 |
+
Final Answer: Rd5
|
| 34 |
+
==========================
|
| 35 |
+
|
| 36 |
+
Now, I will ask you a question. Report your thoughts, and finish your answer with the following template: 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. 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.
|
test.ipynb
ADDED
|
@@ -0,0 +1,515 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
| 13 |
+
"with open('metadata.jsonl', 'r') as jsonl_file:\n",
|
| 14 |
+
" json_list = list(jsonl_file)\n",
|
| 15 |
+
"\n",
|
| 16 |
+
"json_QA = []\n",
|
| 17 |
+
"for json_str in json_list:\n",
|
| 18 |
+
" json_data = json.loads(json_str)\n",
|
| 19 |
+
" json_QA.append(json_data)"
|
| 20 |
+
]
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"cell_type": "code",
|
| 24 |
+
"execution_count": 51,
|
| 25 |
+
"id": "5e2da6fc",
|
| 26 |
+
"metadata": {},
|
| 27 |
+
"outputs": [
|
| 28 |
+
{
|
| 29 |
+
"name": "stdout",
|
| 30 |
+
"output_type": "stream",
|
| 31 |
+
"text": [
|
| 32 |
+
"==================================================\n",
|
| 33 |
+
"Task ID: f0f46385-fc03-4599-b5d3-f56496c3e69f\n",
|
| 34 |
+
"Question: In terms of geographical distance between capital cities, which 2 countries are the furthest from each other within the ASEAN bloc according to wikipedia? Answer using a comma separated list, ordering the countries by alphabetical order.\n",
|
| 35 |
+
"Level: 2\n",
|
| 36 |
+
"Final Answer: Indonesia, Myanmar\n",
|
| 37 |
+
"Annotator Metadata: \n",
|
| 38 |
+
" βββ Steps: \n",
|
| 39 |
+
" β βββ 1. Search the web for \"ASEAN bloc\".\n",
|
| 40 |
+
" β βββ 2. Click the Wikipedia result for the ASEAN Free Trade Area.\n",
|
| 41 |
+
" β βββ 3. Scroll down to find the list of member states.\n",
|
| 42 |
+
" β βββ 4. Click into the Wikipedia pages for each member state, and note its capital.\n",
|
| 43 |
+
" β βββ 5. Search the web for the distance between the first two capitals. The results give travel distance, not geographic distance, which might affect the answer.\n",
|
| 44 |
+
" β βββ 6. Thinking it might be faster to judge the distance by looking at a map, search the web for \"ASEAN bloc\" and click into the images tab.\n",
|
| 45 |
+
" β βββ 7. View a map of the member countries. Since they're clustered together in an arrangement that's not very linear, it's difficult to judge distances by eye.\n",
|
| 46 |
+
" β βββ 8. Return to the Wikipedia page for each country. Click the GPS coordinates for each capital to get the coordinates in decimal notation.\n",
|
| 47 |
+
" β βββ 9. Place all these coordinates into a spreadsheet.\n",
|
| 48 |
+
" β βββ 10. Write formulas to calculate the distance between each capital.\n",
|
| 49 |
+
" β βββ 11. Write formula to get the largest distance value in the spreadsheet.\n",
|
| 50 |
+
" β βββ 12. Note which two capitals that value corresponds to: Jakarta and Naypyidaw.\n",
|
| 51 |
+
" β βββ 13. Return to the Wikipedia pages to see which countries those respective capitals belong to: Indonesia, Myanmar.\n",
|
| 52 |
+
" βββ Number of steps: 13\n",
|
| 53 |
+
" βββ How long did this take?: 45 minutes\n",
|
| 54 |
+
" βββ Tools:\n",
|
| 55 |
+
" β βββ 1. Search engine\n",
|
| 56 |
+
" β βββ 2. Web browser\n",
|
| 57 |
+
" β βββ 3. Microsoft Excel / Google Sheets\n",
|
| 58 |
+
" βββ Number of tools: 3\n",
|
| 59 |
+
"==================================================\n",
|
| 60 |
+
"Task ID: cca530fc-4052-43b2-b130-b30968d8aa44\n",
|
| 61 |
+
"Question: Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.\n",
|
| 62 |
+
"Level: 1\n",
|
| 63 |
+
"Final Answer: Rd5\n",
|
| 64 |
+
"Annotator Metadata: \n",
|
| 65 |
+
" βββ Steps: \n",
|
| 66 |
+
" β βββ Step 1: Evaluate the position of the pieces in the chess position\n",
|
| 67 |
+
" β βββ Step 2: Report the best move available for black: \"Rd5\"\n",
|
| 68 |
+
" βββ Number of steps: 2\n",
|
| 69 |
+
" βββ How long did this take?: 10 minutes\n",
|
| 70 |
+
" βββ Tools:\n",
|
| 71 |
+
" β βββ 1. Image recognition tools\n",
|
| 72 |
+
" βββ Number of tools: 1\n",
|
| 73 |
+
"==================================================\n"
|
| 74 |
+
]
|
| 75 |
+
}
|
| 76 |
+
],
|
| 77 |
+
"source": [
|
| 78 |
+
"# randomly select 3 samples\n",
|
| 79 |
+
"# {\"task_id\": \"c61d22de-5f6c-4958-a7f6-5e9707bd3466\", \"Question\": \"A paper about AI regulation that was originally submitted to arXiv.org in June 2022 shows a figure with three axes, where each axis has a label word at both ends. Which of these words is used to describe a type of society in a Physics and Society article submitted to arXiv.org on August 11, 2016?\", \"Level\": 2, \"Final answer\": \"egalitarian\", \"file_name\": \"\", \"Annotator Metadata\": {\"Steps\": \"1. Go to arxiv.org and navigate to the Advanced Search page.\\n2. Enter \\\"AI regulation\\\" in the search box and select \\\"All fields\\\" from the dropdown.\\n3. Enter 2022-06-01 and 2022-07-01 into the date inputs, select \\\"Submission date (original)\\\", and submit the search.\\n4. Go through the search results to find the article that has a figure with three axes and labels on each end of the axes, titled \\\"Fairness in Agreement With European Values: An Interdisciplinary Perspective on AI Regulation\\\".\\n5. Note the six words used as labels: deontological, egalitarian, localized, standardized, utilitarian, and consequential.\\n6. Go back to arxiv.org\\n7. Find \\\"Physics and Society\\\" and go to the page for the \\\"Physics and Society\\\" category.\\n8. Note that the tag for this category is \\\"physics.soc-ph\\\".\\n9. Go to the Advanced Search page.\\n10. Enter \\\"physics.soc-ph\\\" in the search box and select \\\"All fields\\\" from the dropdown.\\n11. Enter 2016-08-11 and 2016-08-12 into the date inputs, select \\\"Submission date (original)\\\", and submit the search.\\n12. Search for instances of the six words in the results to find the paper titled \\\"Phase transition from egalitarian to hierarchical societies driven by competition between cognitive and social constraints\\\", indicating that \\\"egalitarian\\\" is the correct answer.\", \"Number of steps\": \"12\", \"How long did this take?\": \"8 minutes\", \"Tools\": \"1. Web browser\\n2. Image recognition tools (to identify and parse a figure with three axes)\", \"Number of tools\": \"2\"}}\n",
|
| 80 |
+
"\n",
|
| 81 |
+
"import random\n",
|
| 82 |
+
"# random.seed(42)\n",
|
| 83 |
+
"random_samples = random.sample(json_QA, 2)\n",
|
| 84 |
+
"for sample in random_samples:\n",
|
| 85 |
+
" print(\"=\" * 50)\n",
|
| 86 |
+
" print(f\"Task ID: {sample['task_id']}\")\n",
|
| 87 |
+
" print(f\"Question: {sample['Question']}\")\n",
|
| 88 |
+
" print(f\"Level: {sample['Level']}\")\n",
|
| 89 |
+
" print(f\"Final Answer: {sample['Final answer']}\")\n",
|
| 90 |
+
" print(f\"Annotator Metadata: \")\n",
|
| 91 |
+
" print(f\" βββ Steps: \")\n",
|
| 92 |
+
" for step in sample['Annotator Metadata']['Steps'].split('\\n'):\n",
|
| 93 |
+
" print(f\" β βββ {step}\")\n",
|
| 94 |
+
" print(f\" βββ Number of steps: {sample['Annotator Metadata']['Number of steps']}\")\n",
|
| 95 |
+
" print(f\" βββ How long did this take?: {sample['Annotator Metadata']['How long did this take?']}\")\n",
|
| 96 |
+
" print(f\" βββ Tools:\")\n",
|
| 97 |
+
" for tool in sample['Annotator Metadata']['Tools'].split('\\n'):\n",
|
| 98 |
+
" print(f\" β βββ {tool}\")\n",
|
| 99 |
+
" print(f\" βββ Number of tools: {sample['Annotator Metadata']['Number of tools']}\")\n",
|
| 100 |
+
"print(\"=\" * 50)"
|
| 101 |
+
]
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"cell_type": "code",
|
| 105 |
+
"execution_count": 31,
|
| 106 |
+
"id": "1eae5ba4",
|
| 107 |
+
"metadata": {},
|
| 108 |
+
"outputs": [
|
| 109 |
+
{
|
| 110 |
+
"name": "stdout",
|
| 111 |
+
"output_type": "stream",
|
| 112 |
+
"text": [
|
| 113 |
+
"List of tools used in all samples:\n",
|
| 114 |
+
"Total number of tools used: 83\n",
|
| 115 |
+
" βββ web browser: 107\n",
|
| 116 |
+
" βββ image recognition tools (to identify and parse a figure with three axes): 1\n",
|
| 117 |
+
" βββ search engine: 101\n",
|
| 118 |
+
" βββ calculator: 34\n",
|
| 119 |
+
" βββ unlambda compiler (optional): 1\n",
|
| 120 |
+
" βββ a web browser.: 2\n",
|
| 121 |
+
" βββ a search engine.: 2\n",
|
| 122 |
+
" βββ a calculator.: 1\n",
|
| 123 |
+
" βββ microsoft excel: 5\n",
|
| 124 |
+
" βββ google search: 1\n",
|
| 125 |
+
" βββ ne: 9\n",
|
| 126 |
+
" βββ pdf access: 7\n",
|
| 127 |
+
" βββ file handling: 2\n",
|
| 128 |
+
" βββ python: 3\n",
|
| 129 |
+
" βββ image recognition tools: 12\n",
|
| 130 |
+
" βββ jsonld file access: 1\n",
|
| 131 |
+
" βββ video parsing: 1\n",
|
| 132 |
+
" βββ python compiler: 1\n",
|
| 133 |
+
" βββ video recognition tools: 3\n",
|
| 134 |
+
" βββ pdf viewer: 7\n",
|
| 135 |
+
" βββ microsoft excel / google sheets: 3\n",
|
| 136 |
+
" βββ word document access: 1\n",
|
| 137 |
+
" βββ tool to extract text from images: 1\n",
|
| 138 |
+
" βββ a word reversal tool / script: 1\n",
|
| 139 |
+
" βββ counter: 1\n",
|
| 140 |
+
" βββ excel: 3\n",
|
| 141 |
+
" βββ image recognition: 5\n",
|
| 142 |
+
" βββ color recognition: 3\n",
|
| 143 |
+
" βββ excel file access: 3\n",
|
| 144 |
+
" βββ xml file access: 1\n",
|
| 145 |
+
" βββ access to the internet archive, web.archive.org: 1\n",
|
| 146 |
+
" βββ text processing/diff tool: 1\n",
|
| 147 |
+
" βββ gif parsing tools: 1\n",
|
| 148 |
+
" βββ a web browser: 7\n",
|
| 149 |
+
" βββ a search engine: 7\n",
|
| 150 |
+
" βββ a speech-to-text tool: 2\n",
|
| 151 |
+
" βββ code/data analysis tools: 1\n",
|
| 152 |
+
" βββ audio capability: 2\n",
|
| 153 |
+
" βββ pdf reader: 1\n",
|
| 154 |
+
" βββ markdown: 1\n",
|
| 155 |
+
" βββ a calculator: 5\n",
|
| 156 |
+
" βββ access to wikipedia: 3\n",
|
| 157 |
+
" βββ image recognition/ocr: 3\n",
|
| 158 |
+
" βββ google translate access: 1\n",
|
| 159 |
+
" βββ ocr: 4\n",
|
| 160 |
+
" βββ bass note data: 1\n",
|
| 161 |
+
" βββ text editor: 1\n",
|
| 162 |
+
" βββ xlsx file access: 1\n",
|
| 163 |
+
" βββ powerpoint viewer: 1\n",
|
| 164 |
+
" βββ csv file access: 1\n",
|
| 165 |
+
" βββ calculator (or use excel): 1\n",
|
| 166 |
+
" βββ computer algebra system: 1\n",
|
| 167 |
+
" βββ video processing software: 1\n",
|
| 168 |
+
" βββ audio processing software: 1\n",
|
| 169 |
+
" βββ computer vision: 1\n",
|
| 170 |
+
" βββ google maps: 1\n",
|
| 171 |
+
" βββ access to excel files: 1\n",
|
| 172 |
+
" βββ calculator (or ability to count): 1\n",
|
| 173 |
+
" βββ a file interface: 3\n",
|
| 174 |
+
" βββ a python ide: 1\n",
|
| 175 |
+
" βββ spreadsheet editor: 1\n",
|
| 176 |
+
" βββ tools required: 1\n",
|
| 177 |
+
" βββ b browser: 1\n",
|
| 178 |
+
" βββ image recognition and processing tools: 1\n",
|
| 179 |
+
" βββ computer vision or ocr: 1\n",
|
| 180 |
+
" βββ c++ compiler: 1\n",
|
| 181 |
+
" βββ access to google maps: 1\n",
|
| 182 |
+
" βββ youtube player: 1\n",
|
| 183 |
+
" βββ natural language processor: 1\n",
|
| 184 |
+
" βββ graph interaction tools: 1\n",
|
| 185 |
+
" βββ bablyonian cuniform -> arabic legend: 1\n",
|
| 186 |
+
" βββ access to youtube: 1\n",
|
| 187 |
+
" βββ image search tools: 1\n",
|
| 188 |
+
" βββ calculator or counting function: 1\n",
|
| 189 |
+
" βββ a speech-to-text audio processing tool: 1\n",
|
| 190 |
+
" βββ access to academic journal websites: 1\n",
|
| 191 |
+
" βββ pdf reader/extracter: 1\n",
|
| 192 |
+
" βββ rubik's cube model: 1\n",
|
| 193 |
+
" βββ wikipedia: 1\n",
|
| 194 |
+
" βββ video capability: 1\n",
|
| 195 |
+
" βββ image processing tools: 1\n",
|
| 196 |
+
" βββ age recognition software: 1\n",
|
| 197 |
+
" βββ youtube: 1\n"
|
| 198 |
+
]
|
| 199 |
+
}
|
| 200 |
+
],
|
| 201 |
+
"source": [
|
| 202 |
+
"# list of the tools used in all the samples\n",
|
| 203 |
+
"from collections import Counter, OrderedDict\n",
|
| 204 |
+
"\n",
|
| 205 |
+
"tools = []\n",
|
| 206 |
+
"for sample in json_QA:\n",
|
| 207 |
+
" for tool in sample['Annotator Metadata']['Tools'].split('\\n'):\n",
|
| 208 |
+
" tool = tool[2:].strip().lower()\n",
|
| 209 |
+
" if tool.startswith(\"(\"):\n",
|
| 210 |
+
" tool = tool[11:].strip()\n",
|
| 211 |
+
" tools.append(tool)\n",
|
| 212 |
+
"tools_counter = OrderedDict(Counter(tools))\n",
|
| 213 |
+
"print(\"List of tools used in all samples:\")\n",
|
| 214 |
+
"print(\"Total number of tools used:\", len(tools_counter))\n",
|
| 215 |
+
"for tool, count in tools_counter.items():\n",
|
| 216 |
+
" print(f\" βββ {tool}: {count}\")"
|
| 217 |
+
]
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"cell_type": "code",
|
| 221 |
+
"execution_count": 55,
|
| 222 |
+
"id": "7fe573cc",
|
| 223 |
+
"metadata": {},
|
| 224 |
+
"outputs": [],
|
| 225 |
+
"source": [
|
| 226 |
+
"system_prompt = \"\"\"\n",
|
| 227 |
+
"You are a helpful assistant tasked with answering questions using a set of tools.\n",
|
| 228 |
+
"If the tool is not available, you can try to find the information online. You can also use your own knowledge to answer the question. \n",
|
| 229 |
+
"You need to provide a step-by-step explanation of how you arrived at the answer.\n",
|
| 230 |
+
"==========================\n",
|
| 231 |
+
"Here is a few examples showing you how to answer the question step by step.\n",
|
| 232 |
+
"\"\"\"\n",
|
| 233 |
+
"for i, samples in enumerate(random_samples):\n",
|
| 234 |
+
" system_prompt += f\"\\nQuestion {i+1}: {samples['Question']}\\nSteps:\\n{samples['Annotator Metadata']['Steps']}\\nTools:\\n{samples['Annotator Metadata']['Tools']}\\nFinal Answer: {samples['Final answer']}\\n\"\n",
|
| 235 |
+
"system_prompt += \"\\n==========================\\n\"\n",
|
| 236 |
+
"system_prompt += \"Now, please answer the following question step by step.\\n\"\n",
|
| 237 |
+
"\n",
|
| 238 |
+
"# save the system_prompt to a file\n",
|
| 239 |
+
"with open('system_prompt.txt', 'w') as f:\n",
|
| 240 |
+
" f.write(system_prompt)"
|
| 241 |
+
]
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"cell_type": "code",
|
| 245 |
+
"execution_count": 56,
|
| 246 |
+
"id": "d6beb0da",
|
| 247 |
+
"metadata": {},
|
| 248 |
+
"outputs": [
|
| 249 |
+
{
|
| 250 |
+
"name": "stdout",
|
| 251 |
+
"output_type": "stream",
|
| 252 |
+
"text": [
|
| 253 |
+
"\n",
|
| 254 |
+
"You are a helpful assistant tasked with answering questions using a set of tools.\n",
|
| 255 |
+
"If the tool is not available, you can try to find the information online. You can also use your own knowledge to answer the question. \n",
|
| 256 |
+
"You need to provide a step-by-step explanation of how you arrived at the answer.\n",
|
| 257 |
+
"==========================\n",
|
| 258 |
+
"Here is a few examples showing you how to answer the question step by step.\n",
|
| 259 |
+
"\n",
|
| 260 |
+
"Question 1: In terms of geographical distance between capital cities, which 2 countries are the furthest from each other within the ASEAN bloc according to wikipedia? Answer using a comma separated list, ordering the countries by alphabetical order.\n",
|
| 261 |
+
"Steps:\n",
|
| 262 |
+
"1. Search the web for \"ASEAN bloc\".\n",
|
| 263 |
+
"2. Click the Wikipedia result for the ASEAN Free Trade Area.\n",
|
| 264 |
+
"3. Scroll down to find the list of member states.\n",
|
| 265 |
+
"4. Click into the Wikipedia pages for each member state, and note its capital.\n",
|
| 266 |
+
"5. Search the web for the distance between the first two capitals. The results give travel distance, not geographic distance, which might affect the answer.\n",
|
| 267 |
+
"6. Thinking it might be faster to judge the distance by looking at a map, search the web for \"ASEAN bloc\" and click into the images tab.\n",
|
| 268 |
+
"7. View a map of the member countries. Since they're clustered together in an arrangement that's not very linear, it's difficult to judge distances by eye.\n",
|
| 269 |
+
"8. Return to the Wikipedia page for each country. Click the GPS coordinates for each capital to get the coordinates in decimal notation.\n",
|
| 270 |
+
"9. Place all these coordinates into a spreadsheet.\n",
|
| 271 |
+
"10. Write formulas to calculate the distance between each capital.\n",
|
| 272 |
+
"11. Write formula to get the largest distance value in the spreadsheet.\n",
|
| 273 |
+
"12. Note which two capitals that value corresponds to: Jakarta and Naypyidaw.\n",
|
| 274 |
+
"13. Return to the Wikipedia pages to see which countries those respective capitals belong to: Indonesia, Myanmar.\n",
|
| 275 |
+
"Tools:\n",
|
| 276 |
+
"1. Search engine\n",
|
| 277 |
+
"2. Web browser\n",
|
| 278 |
+
"3. Microsoft Excel / Google Sheets\n",
|
| 279 |
+
"Final Answer: Indonesia, Myanmar\n",
|
| 280 |
+
"\n",
|
| 281 |
+
"Question 2: Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.\n",
|
| 282 |
+
"Steps:\n",
|
| 283 |
+
"Step 1: Evaluate the position of the pieces in the chess position\n",
|
| 284 |
+
"Step 2: Report the best move available for black: \"Rd5\"\n",
|
| 285 |
+
"Tools:\n",
|
| 286 |
+
"1. Image recognition tools\n",
|
| 287 |
+
"Final Answer: Rd5\n",
|
| 288 |
+
"\n",
|
| 289 |
+
"==========================\n",
|
| 290 |
+
"Now, please answer the following question step by step.\n",
|
| 291 |
+
"\n"
|
| 292 |
+
]
|
| 293 |
+
}
|
| 294 |
+
],
|
| 295 |
+
"source": [
|
| 296 |
+
"# load the system prompt from the file\n",
|
| 297 |
+
"with open('system_prompt.txt', 'r') as f:\n",
|
| 298 |
+
" system_prompt = f.read()\n",
|
| 299 |
+
"print(system_prompt)"
|
| 300 |
+
]
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"cell_type": "code",
|
| 304 |
+
"execution_count": 46,
|
| 305 |
+
"id": "42fde0f8",
|
| 306 |
+
"metadata": {},
|
| 307 |
+
"outputs": [],
|
| 308 |
+
"source": [
|
| 309 |
+
"import dotenv\n",
|
| 310 |
+
"from langgraph.graph import MessagesState\n",
|
| 311 |
+
"from langchain_core.messages import HumanMessage, SystemMessage\n",
|
| 312 |
+
"from langgraph.graph import START, StateGraph\n",
|
| 313 |
+
"from langgraph.prebuilt import tools_condition\n",
|
| 314 |
+
"from langgraph.prebuilt import ToolNode\n",
|
| 315 |
+
"from langchain_google_genai import ChatGoogleGenerativeAI\n",
|
| 316 |
+
"from langchain_community.tools.tavily_search import TavilySearchResults\n",
|
| 317 |
+
"from langchain_community.document_loaders import WikipediaLoader\n",
|
| 318 |
+
"from langchain_community.document_loaders import ArxivLoader\n",
|
| 319 |
+
"from langchain_core.tools import tool\n",
|
| 320 |
+
"\n",
|
| 321 |
+
"@tool\n",
|
| 322 |
+
"def multiply(a: int, b: int) -> int:\n",
|
| 323 |
+
" \"\"\"Multiply two numbers.\n",
|
| 324 |
+
"\n",
|
| 325 |
+
" Args:\n",
|
| 326 |
+
" a: first int\n",
|
| 327 |
+
" b: second int\n",
|
| 328 |
+
" \"\"\"\n",
|
| 329 |
+
" return a * b\n",
|
| 330 |
+
"\n",
|
| 331 |
+
"@tool\n",
|
| 332 |
+
"def add(a: int, b: int) -> int:\n",
|
| 333 |
+
" \"\"\"Add two numbers.\n",
|
| 334 |
+
" \n",
|
| 335 |
+
" Args:\n",
|
| 336 |
+
" a: first int\n",
|
| 337 |
+
" b: second int\n",
|
| 338 |
+
" \"\"\"\n",
|
| 339 |
+
" return a + b\n",
|
| 340 |
+
"\n",
|
| 341 |
+
"@tool\n",
|
| 342 |
+
"def subtract(a: int, b: int) -> int:\n",
|
| 343 |
+
" \"\"\"Subtract two numbers.\n",
|
| 344 |
+
" \n",
|
| 345 |
+
" Args:\n",
|
| 346 |
+
" a: first int\n",
|
| 347 |
+
" b: second int\n",
|
| 348 |
+
" \"\"\"\n",
|
| 349 |
+
" return a - b\n",
|
| 350 |
+
"\n",
|
| 351 |
+
"@tool\n",
|
| 352 |
+
"def divide(a: int, b: int) -> int:\n",
|
| 353 |
+
" \"\"\"Divide two numbers.\n",
|
| 354 |
+
" \n",
|
| 355 |
+
" Args:\n",
|
| 356 |
+
" a: first int\n",
|
| 357 |
+
" b: second int\n",
|
| 358 |
+
" \"\"\"\n",
|
| 359 |
+
" if b == 0:\n",
|
| 360 |
+
" raise ValueError(\"Cannot divide by zero.\")\n",
|
| 361 |
+
" return a / b\n",
|
| 362 |
+
"\n",
|
| 363 |
+
"@tool\n",
|
| 364 |
+
"def modulus(a: int, b: int) -> int:\n",
|
| 365 |
+
" \"\"\"Get the modulus of two numbers.\n",
|
| 366 |
+
" \n",
|
| 367 |
+
" Args:\n",
|
| 368 |
+
" a: first int\n",
|
| 369 |
+
" b: second int\n",
|
| 370 |
+
" \"\"\"\n",
|
| 371 |
+
" return a % b\n",
|
| 372 |
+
"\n",
|
| 373 |
+
"@tool\n",
|
| 374 |
+
"def wiki_search(query: str) -> str:\n",
|
| 375 |
+
" \"\"\"Search Wikipedia for a query and return maximum 2 results.\n",
|
| 376 |
+
" \n",
|
| 377 |
+
" Args:\n",
|
| 378 |
+
" query: The search query.\"\"\"\n",
|
| 379 |
+
" search_docs = WikipediaLoader(query=query, load_max_docs=2).load()\n",
|
| 380 |
+
" formatted_search_docs = \"\\n\\n---\\n\\n\".join(\n",
|
| 381 |
+
" [\n",
|
| 382 |
+
" f'<Document source=\"{doc.metadata[\"source\"]}\" page=\"{doc.metadata.get(\"page\", \"\")}\"/>\\n{doc.page_content}\\n</Document>'\n",
|
| 383 |
+
" for doc in search_docs\n",
|
| 384 |
+
" ])\n",
|
| 385 |
+
" return {\"wiki_results\": formatted_search_docs}\n",
|
| 386 |
+
"\n",
|
| 387 |
+
"@tool\n",
|
| 388 |
+
"def web_search(query: str) -> str:\n",
|
| 389 |
+
" \"\"\"Search Tavily for a query and return maximum 3 results.\n",
|
| 390 |
+
" \n",
|
| 391 |
+
" Args:\n",
|
| 392 |
+
" query: The search query.\"\"\"\n",
|
| 393 |
+
" search_docs = TavilySearchResults(max_results=3).invoke(query=query)\n",
|
| 394 |
+
" formatted_search_docs = \"\\n\\n---\\n\\n\".join(\n",
|
| 395 |
+
" [\n",
|
| 396 |
+
" f'<Document source=\"{doc.metadata[\"source\"]}\" page=\"{doc.metadata.get(\"page\", \"\")}\"/>\\n{doc.page_content}\\n</Document>'\n",
|
| 397 |
+
" for doc in search_docs\n",
|
| 398 |
+
" ])\n",
|
| 399 |
+
" return {\"web_results\": formatted_search_docs}\n",
|
| 400 |
+
"\n",
|
| 401 |
+
"@tool\n",
|
| 402 |
+
"def arvix_search(query: str) -> str:\n",
|
| 403 |
+
" \"\"\"Search Arxiv for a query and return maximum 3 result.\n",
|
| 404 |
+
" \n",
|
| 405 |
+
" Args:\n",
|
| 406 |
+
" query: The search query.\"\"\"\n",
|
| 407 |
+
" search_docs = ArxivLoader(query=query, load_max_docs=3).load()\n",
|
| 408 |
+
" formatted_search_docs = \"\\n\\n---\\n\\n\".join(\n",
|
| 409 |
+
" [\n",
|
| 410 |
+
" f'<Document source=\"{doc.metadata[\"source\"]}\" page=\"{doc.metadata.get(\"page\", \"\")}\"/>\\n{doc.page_content[:1000]}\\n</Document>'\n",
|
| 411 |
+
" for doc in search_docs\n",
|
| 412 |
+
" ])\n",
|
| 413 |
+
" return {\"arvix_results\": formatted_search_docs}\n",
|
| 414 |
+
"\n",
|
| 415 |
+
"tools = [\n",
|
| 416 |
+
" multiply,\n",
|
| 417 |
+
" add,\n",
|
| 418 |
+
" subtract,\n",
|
| 419 |
+
" divide,\n",
|
| 420 |
+
" modulus,\n",
|
| 421 |
+
" wiki_search,\n",
|
| 422 |
+
" web_search,\n",
|
| 423 |
+
" arvix_search,\n",
|
| 424 |
+
"]\n",
|
| 425 |
+
"\n",
|
| 426 |
+
"\n",
|
| 427 |
+
"# Load environment variables from .env file\n",
|
| 428 |
+
"dotenv.load_dotenv()\n",
|
| 429 |
+
"llm = ChatGoogleGenerativeAI(model=\"gemini-2.0-flash\")\n",
|
| 430 |
+
"llm_with_tools = llm.bind_tools(tools)"
|
| 431 |
+
]
|
| 432 |
+
},
|
| 433 |
+
{
|
| 434 |
+
"cell_type": "code",
|
| 435 |
+
"execution_count": null,
|
| 436 |
+
"id": "7dd0716c",
|
| 437 |
+
"metadata": {},
|
| 438 |
+
"outputs": [],
|
| 439 |
+
"source": [
|
| 440 |
+
"# load the system prompt from the file\n",
|
| 441 |
+
"with open('system_prompt.txt', 'r') as f:\n",
|
| 442 |
+
" system_prompt = f.read()\n",
|
| 443 |
+
"\n",
|
| 444 |
+
"\n",
|
| 445 |
+
"# System message\n",
|
| 446 |
+
"sys_msg = SystemMessage(content=system_prompt)\n",
|
| 447 |
+
"\n",
|
| 448 |
+
"# Node\n",
|
| 449 |
+
"def assistant(state: MessagesState):\n",
|
| 450 |
+
" \"\"\"Assistant node\"\"\"\n",
|
| 451 |
+
" return {\"messages\": [llm_with_tools.invoke([sys_msg] + state[\"messages\"])]}\n",
|
| 452 |
+
"\n",
|
| 453 |
+
"# Build graph\n",
|
| 454 |
+
"builder = StateGraph(MessagesState)\n",
|
| 455 |
+
"builder.add_node(\"assistant\", assistant)\n",
|
| 456 |
+
"builder.add_node(\"tools\", ToolNode(tools))\n",
|
| 457 |
+
"builder.add_edge(START, \"assistant\")\n",
|
| 458 |
+
"builder.add_conditional_edges(\n",
|
| 459 |
+
" \"assistant\",\n",
|
| 460 |
+
" # If the latest message (result) from assistant is a tool call -> tools_condition routes to tools\n",
|
| 461 |
+
" # If the latest message (result) from assistant is a not a tool call -> tools_condition routes to END\n",
|
| 462 |
+
" tools_condition,\n",
|
| 463 |
+
")\n",
|
| 464 |
+
"builder.add_edge(\"tools\", \"assistant\")\n",
|
| 465 |
+
"\n",
|
| 466 |
+
"# Compile graph\n",
|
| 467 |
+
"graph = builder.compile()\n"
|
| 468 |
+
]
|
| 469 |
+
},
|
| 470 |
+
{
|
| 471 |
+
"cell_type": "code",
|
| 472 |
+
"execution_count": 49,
|
| 473 |
+
"id": "f4e77216",
|
| 474 |
+
"metadata": {},
|
| 475 |
+
"outputs": [
|
| 476 |
+
{
|
| 477 |
+
"data": {
|
| 478 |
+
"image/png": "iVBORw0KGgoAAAANSUhEUgAAANgAAAD5CAIAAADKsmwpAAAQ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Ed54jKuJwzZparlV3Dw47I6BuDEtDVQiFRIPpRI1GK3HiNWYjIyVMGJrCL8I9DD4WOFlzzhn+S5JTze/YvbXCTwNxKKhc3uKl7p5FDB76HWoisR7e27mi4BwGSREwGEzVUTerRZRRk0VEjlGaW9xxmjRqHiGhoeo20+/N0hUu7hmda8/PpOnvm/zW4CfpCapPS9eDxWrIS4uYS2Nh7UKkULBan7lSLzXkP0ooaDkfnGdTUmyQiGhrfDpbpt6Q11YoGT94D1Wy5LsiocDg8W5uWfA81FdV9xr6giUbqiEZg8BtOmdfytVpaTBNVlFbi38Hc4UWTyxERjcP4eR6ZV3JRa6covczemRkcbvXCPYmIxsHGgTvhI9f0i9katQlP/9c0JRllPkGcvuOaNe8wEdFo8C04r81xAxelFXLUutCqtXnJhZ5+7M79bZr5FCKiMRHact750oejlebeLpBXtZL8YklWRer57J5DrLtEvUSHCGk1G5+oSY45abLzB0p5Fjwmlyu0F2B7ml8TSMrkklJZVbGk/SvWY2e+9CXGiIhY4O7Hn/iRx6N70rRb0sxreTbO5soaLZvLZnHZDCamnexMFlMlV2pUGqTTVhTIoV0c1EkQ1N3zZWdG1ENExIg2QYI2T7K+Rdk1T6YuVtfItAoZJSPH/j3mFjoGky0Q8vhCtrOXE4f7r6p5REQccfQwc/RAtKJhEblmDC0y4WFXAmsOk2Xyw8ZoRcPh1NKGU/LIhHMK2SkSWyfTPq+AbjQsooM7z3THocolapErz8Ka1DpMiUYjomtbs/O/NGuuT9w4tSO/y4Dm5lEJmNDU9Zrv/iFOvyVp39vOxpHLYuOe+q6RaapKlZcOFg+c7OjgQceJjkyaF1w4POuu9Na5ysKsGhYb66LaSsSpKld5Bgk6D7CBblxEMDVeIGItCjnWffM6LTITkO5KE6a5IhIIlEKalgQsICISsICISMACIiIBC4iIBCwgIhKw4P8BAAD//2v4e7oAAAAGSURBVAMA1x7mMDWkAPIAAAAASUVORK5CYII=",
|
| 479 |
+
"text/plain": [
|
| 480 |
+
"<IPython.core.display.Image object>"
|
| 481 |
+
]
|
| 482 |
+
},
|
| 483 |
+
"metadata": {},
|
| 484 |
+
"output_type": "display_data"
|
| 485 |
+
}
|
| 486 |
+
],
|
| 487 |
+
"source": [
|
| 488 |
+
"from IPython.display import Image, display\n",
|
| 489 |
+
"\n",
|
| 490 |
+
"display(Image(graph.get_graph(xray=True).draw_mermaid_png()))"
|
| 491 |
+
]
|
| 492 |
+
}
|
| 493 |
+
],
|
| 494 |
+
"metadata": {
|
| 495 |
+
"kernelspec": {
|
| 496 |
+
"display_name": "aiagent",
|
| 497 |
+
"language": "python",
|
| 498 |
+
"name": "python3"
|
| 499 |
+
},
|
| 500 |
+
"language_info": {
|
| 501 |
+
"codemirror_mode": {
|
| 502 |
+
"name": "ipython",
|
| 503 |
+
"version": 3
|
| 504 |
+
},
|
| 505 |
+
"file_extension": ".py",
|
| 506 |
+
"mimetype": "text/x-python",
|
| 507 |
+
"name": "python",
|
| 508 |
+
"nbconvert_exporter": "python",
|
| 509 |
+
"pygments_lexer": "ipython3",
|
| 510 |
+
"version": "3.12.9"
|
| 511 |
+
}
|
| 512 |
+
},
|
| 513 |
+
"nbformat": 4,
|
| 514 |
+
"nbformat_minor": 5
|
| 515 |
+
}
|