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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": null,
|
| 6 |
+
"id": "0659aeaf",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [
|
| 9 |
+
{
|
| 10 |
+
"name": "stderr",
|
| 11 |
+
"output_type": "stream",
|
| 12 |
+
"text": [
|
| 13 |
+
"/Users/rex/envs/hf_311/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
| 14 |
+
" from .autonotebook import tqdm as notebook_tqdm\n"
|
| 15 |
+
]
|
| 16 |
+
}
|
| 17 |
+
],
|
| 18 |
+
"source": [
|
| 19 |
+
"from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI\n",
|
| 20 |
+
"import os\n",
|
| 21 |
+
"\n",
|
| 22 |
+
"os.environ['HF_TOKEN'] = 'hf_'\n",
|
| 23 |
+
"llm = HuggingFaceInferenceAPI(model_name='Qwen/Qwen2.5-Coder-32B-Instruct')"
|
| 24 |
+
]
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"cell_type": "markdown",
|
| 28 |
+
"id": "833fba3e",
|
| 29 |
+
"metadata": {},
|
| 30 |
+
"source": []
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"cell_type": "code",
|
| 34 |
+
"execution_count": 8,
|
| 35 |
+
"id": "312823b0",
|
| 36 |
+
"metadata": {},
|
| 37 |
+
"outputs": [],
|
| 38 |
+
"source": [
|
| 39 |
+
"from llama_index.core.agent.workflow import AgentWorkflow\n",
|
| 40 |
+
"from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI\n",
|
| 41 |
+
"from llama_index.tools.wikipedia import WikipediaToolSpec\n",
|
| 42 |
+
"from llama_index.core.tools import FunctionTool\n",
|
| 43 |
+
"from llama_index.tools.duckduckgo import DuckDuckGoSearchToolSpec\n",
|
| 44 |
+
"from llama_index.tools.code_interpreter import CodeInterpreterToolSpec\n",
|
| 45 |
+
"from tools import read_python_file_tool, audio_to_text_tool, read_xlsx_file_tool, read_png_file_tool\n",
|
| 46 |
+
"\n",
|
| 47 |
+
"# (Keep Constants as is)\n",
|
| 48 |
+
"# --- Constants ---\n",
|
| 49 |
+
"DEFAULT_API_URL = \"https://agents-course-unit4-scoring.hf.space\"\n",
|
| 50 |
+
"FETCH_QUESTIONS_LOCAL = True\n",
|
| 51 |
+
"\n",
|
| 52 |
+
"system_prompt=\"\"\"You are a general AI assistant. I will ask you a question. Report your thoughts, and return\n",
|
| 53 |
+
"your answer.\n",
|
| 54 |
+
"\n",
|
| 55 |
+
"YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of\n",
|
| 56 |
+
"numbers and/or strings.\n",
|
| 57 |
+
"If you are asked for a number, don’t use comma to write your number neither use units such as $ or percent\n",
|
| 58 |
+
"sign unless specified otherwise.\n",
|
| 59 |
+
"If you are asked for a string, don’t use articles, neither abbreviations (e.g. for cities), and write the digits in\n",
|
| 60 |
+
"plain text unless specified otherwise.\n",
|
| 61 |
+
"If you are asked for a comma separated list, apply the above rules depending of whether the element to be put\n",
|
| 62 |
+
"in the list is a number or a string.\n",
|
| 63 |
+
"\n",
|
| 64 |
+
"Here is the question: \n",
|
| 65 |
+
"\"\"\"\n",
|
| 66 |
+
"\n",
|
| 67 |
+
"llm = HuggingFaceInferenceAPI(model_name='Qwen/Qwen3-32B', num_output=10000, temperature=0.01)\n",
|
| 68 |
+
"wikipedia_tools = WikipediaToolSpec().to_tool_list()\n",
|
| 69 |
+
"search_tool = FunctionTool.from_defaults(DuckDuckGoSearchToolSpec().duckduckgo_full_search)\n",
|
| 70 |
+
"agent = AgentWorkflow.from_tools_or_functions(\n",
|
| 71 |
+
" tools_or_functions=[search_tool, read_python_file_tool, audio_to_text_tool, read_xlsx_file_tool, read_png_file_tool] + wikipedia_tools,\n",
|
| 72 |
+
" llm=llm,\n",
|
| 73 |
+
" #system_prompt=system_prompt,\n",
|
| 74 |
+
" verbose=False,\n",
|
| 75 |
+
")\n"
|
| 76 |
+
]
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"cell_type": "code",
|
| 80 |
+
"execution_count": 13,
|
| 81 |
+
"id": "9813de74",
|
| 82 |
+
"metadata": {},
|
| 83 |
+
"outputs": [
|
| 84 |
+
{
|
| 85 |
+
"name": "stdout",
|
| 86 |
+
"output_type": "stream",
|
| 87 |
+
"text": [
|
| 88 |
+
"Right\n"
|
| 89 |
+
]
|
| 90 |
+
}
|
| 91 |
+
],
|
| 92 |
+
"source": [
|
| 93 |
+
"item = {\n",
|
| 94 |
+
" \"task_id\": \"2d83110e-a098-4ebb-9987-066c06fa42d0\",\n",
|
| 95 |
+
" \"question\": \".rewsna eht sa \\\"tfel\\\" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI\",\n",
|
| 96 |
+
" \"Level\": \"1\",\n",
|
| 97 |
+
" \"file_name\": \"\"\n",
|
| 98 |
+
" }\n",
|
| 99 |
+
"question_text = item.get(\"question\")\n",
|
| 100 |
+
"prompt = system_prompt + question_text\n",
|
| 101 |
+
"if item.get(\"file_name\", \"\") != \"\":\n",
|
| 102 |
+
" file_path = os.path.join(\"files\", item.get(\"file_name\", \"\"))\n",
|
| 103 |
+
" prompt += f'\\nHere is the attached file you might need to answer the question: files/{file_path}'\n",
|
| 104 |
+
"r = await agent.run(prompt)\n",
|
| 105 |
+
"print(r.response.blocks[0].text)"
|
| 106 |
+
]
|
| 107 |
+
},
|
| 108 |
+
{
|
| 109 |
+
"cell_type": "code",
|
| 110 |
+
"execution_count": 6,
|
| 111 |
+
"id": "da5b2551",
|
| 112 |
+
"metadata": {},
|
| 113 |
+
"outputs": [
|
| 114 |
+
{
|
| 115 |
+
"name": "stdout",
|
| 116 |
+
"output_type": "stream",
|
| 117 |
+
"text": [
|
| 118 |
+
"Ian Rose\n"
|
| 119 |
+
]
|
| 120 |
+
}
|
| 121 |
+
],
|
| 122 |
+
"source": [
|
| 123 |
+
"import re\n",
|
| 124 |
+
"\n",
|
| 125 |
+
"question = 'Who nominated the only Featured Article on English Wikipedia about a dinosaur that was promoted in November 2016?'\n",
|
| 126 |
+
"r = await agent.run(system_prompt + question)\n",
|
| 127 |
+
"print(r.response.blocks[0].text)"
|
| 128 |
+
]
|
| 129 |
+
},
|
| 130 |
+
{
|
| 131 |
+
"cell_type": "code",
|
| 132 |
+
"execution_count": 7,
|
| 133 |
+
"id": "24ceb99e",
|
| 134 |
+
"metadata": {},
|
| 135 |
+
"outputs": [
|
| 136 |
+
{
|
| 137 |
+
"name": "stdout",
|
| 138 |
+
"output_type": "stream",
|
| 139 |
+
"text": [
|
| 140 |
+
"Bartłomiej\n"
|
| 141 |
+
]
|
| 142 |
+
}
|
| 143 |
+
],
|
| 144 |
+
"source": [
|
| 145 |
+
"import re\n",
|
| 146 |
+
"\n",
|
| 147 |
+
"question = 'Who did the actor who played Ray in the Polish-language version of Everybody Loves Raymond play in Magda M.? Give only the first name.'\n",
|
| 148 |
+
"r = await agent.run(system_prompt + question)\n",
|
| 149 |
+
"print(r.response.blocks[0].text)"
|
| 150 |
+
]
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"cell_type": "code",
|
| 154 |
+
"execution_count": 12,
|
| 155 |
+
"id": "31f8d4b6",
|
| 156 |
+
"metadata": {},
|
| 157 |
+
"outputs": [
|
| 158 |
+
{
|
| 159 |
+
"name": "stdout",
|
| 160 |
+
"output_type": "stream",
|
| 161 |
+
"text": [
|
| 162 |
+
"The chess position image file is missing or inaccessible. Please provide the correct file path or describe the position.\n"
|
| 163 |
+
]
|
| 164 |
+
}
|
| 165 |
+
],
|
| 166 |
+
"source": [
|
| 167 |
+
"item = {\n",
|
| 168 |
+
" \"task_id\": \"cca530fc-4052-43b2-b130-b30968d8aa44\",\n",
|
| 169 |
+
" \"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",
|
| 170 |
+
" \"Level\": \"1\",\n",
|
| 171 |
+
" \"file_name\": \"cca530fc-4052-43b2-b130-b30968d8aa44.png\"\n",
|
| 172 |
+
" }\n",
|
| 173 |
+
"\n",
|
| 174 |
+
"question_text = item.get(\"question\")\n",
|
| 175 |
+
"prompt = system_prompt + question_text\n",
|
| 176 |
+
"if item.get(\"file_name\", \"\") != \"\":\n",
|
| 177 |
+
" file_path = os.path.join(\"files\", item.get(\"file_name\", \"\"))\n",
|
| 178 |
+
" prompt += f'\\nHere is the attached file you might need to answer the question: files/{file_path}'\n",
|
| 179 |
+
"r = await agent.run(prompt)\n",
|
| 180 |
+
"print(r.response.blocks[0].text)"
|
| 181 |
+
]
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
"cell_type": "code",
|
| 185 |
+
"execution_count": 11,
|
| 186 |
+
"id": "f342112e",
|
| 187 |
+
"metadata": {},
|
| 188 |
+
"outputs": [
|
| 189 |
+
{
|
| 190 |
+
"name": "stdout",
|
| 191 |
+
"output_type": "stream",
|
| 192 |
+
"text": [
|
| 193 |
+
"0\n"
|
| 194 |
+
]
|
| 195 |
+
}
|
| 196 |
+
],
|
| 197 |
+
"source": [
|
| 198 |
+
"item = {\n",
|
| 199 |
+
" \"task_id\": \"f918266a-b3e0-4914-865d-4faa564f1aef\",\n",
|
| 200 |
+
" \"question\": \"What is the final numeric output from the attached Python code?\",\n",
|
| 201 |
+
" \"Level\": \"1\",\n",
|
| 202 |
+
" \"file_name\": \"f918266a-b3e0-4914-865d-4faa564f1aef.py\"\n",
|
| 203 |
+
" }\n",
|
| 204 |
+
"\n",
|
| 205 |
+
"question_text = item.get(\"question\")\n",
|
| 206 |
+
"prompt = system_prompt + question_text\n",
|
| 207 |
+
"if item.get(\"file_name\", \"\") != \"\":\n",
|
| 208 |
+
" prompt += f'\\nHere is the attached file you might need to answer the question: files/{item.get(\"file_name\", \"\")}'\n",
|
| 209 |
+
"r = await agent.run(prompt)\n",
|
| 210 |
+
"print(r.response.blocks[0].text)"
|
| 211 |
+
]
|
| 212 |
+
},
|
| 213 |
+
{
|
| 214 |
+
"cell_type": "code",
|
| 215 |
+
"execution_count": null,
|
| 216 |
+
"id": "247038e8",
|
| 217 |
+
"metadata": {},
|
| 218 |
+
"outputs": [
|
| 219 |
+
{
|
| 220 |
+
"name": "stdout",
|
| 221 |
+
"output_type": "stream",
|
| 222 |
+
"text": [
|
| 223 |
+
"cornstarch, granulated sugar, freshly squeezed lemon juice, pure vanilla extract, ripe strawberries\n"
|
| 224 |
+
]
|
| 225 |
+
}
|
| 226 |
+
],
|
| 227 |
+
"source": [
|
| 228 |
+
"item = {\n",
|
| 229 |
+
" \"task_id\": \"99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3\",\n",
|
| 230 |
+
" \"question\": \"Hi, I'm making a pie but I could use some help with my shopping list. I have everything I need for the crust, but I'm not sure about the filling. I got the recipe from my friend Aditi, but she left it as a voice memo and the speaker on my phone is buzzing so I can't quite make out what she's saying. Could you please listen to the recipe and list all of the ingredients that my friend described? I only want the ingredients for the filling, as I have everything I need to make my favorite pie crust. I've attached the recipe as Strawberry pie.mp3.\\n\\nIn your response, please only list the ingredients, not any measurements. So if the recipe calls for \\\"a pinch of salt\\\" or \\\"two cups of ripe strawberries\\\" the ingredients on the list would be \\\"salt\\\" and \\\"ripe strawberries\\\".\\n\\nPlease format your response as a comma separated list of ingredients. Also, please alphabetize the ingredients.\",\n",
|
| 231 |
+
" \"Level\": \"1\",\n",
|
| 232 |
+
" \"file_name\": \"99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3.mp3\"\n",
|
| 233 |
+
" }\n",
|
| 234 |
+
"\n",
|
| 235 |
+
"question_text = item.get(\"question\")\n",
|
| 236 |
+
"prompt = system_prompt + question_text\n",
|
| 237 |
+
"if item.get(\"file_name\", \"\") != \"\":\n",
|
| 238 |
+
" prompt += f'\\nHere is the attched file you might need to answer the question: files/{item.get(\"file_name\", \"\")}'\n",
|
| 239 |
+
"r = await agent.run(prompt)\n",
|
| 240 |
+
"print(r.response.blocks[0].text)"
|
| 241 |
+
]
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"cell_type": "code",
|
| 245 |
+
"execution_count": 5,
|
| 246 |
+
"id": "59110ca7",
|
| 247 |
+
"metadata": {},
|
| 248 |
+
"outputs": [
|
| 249 |
+
{
|
| 250 |
+
"name": "stdout",
|
| 251 |
+
"output_type": "stream",
|
| 252 |
+
"text": [
|
| 253 |
+
"132,133,134,197,245\n"
|
| 254 |
+
]
|
| 255 |
+
}
|
| 256 |
+
],
|
| 257 |
+
"source": [
|
| 258 |
+
"item = {\n",
|
| 259 |
+
" \"task_id\": \"1f975693-876d-457b-a649-393859e79bf3\",\n",
|
| 260 |
+
" \"question\": \"Hi, I was out sick from my classes on Friday, so I'm trying to figure out what I need to study for my Calculus mid-term next week. My friend from class sent me an audio recording of Professor Willowbrook giving out the recommended reading for the test, but my headphones are broken :(\\n\\nCould you please listen to the recording for me and tell me the page numbers I'm supposed to go over? I've attached a file called Homework.mp3 that has the recording. Please provide just the page numbers as a comma-delimited list. And please provide the list in ascending order.\",\n",
|
| 261 |
+
" \"Level\": \"1\",\n",
|
| 262 |
+
" \"file_name\": \"1f975693-876d-457b-a649-393859e79bf3.mp3\"\n",
|
| 263 |
+
" }\n",
|
| 264 |
+
"\n",
|
| 265 |
+
"question_text = item.get(\"question\")\n",
|
| 266 |
+
"prompt = system_prompt + question_text\n",
|
| 267 |
+
"if item.get(\"file_name\", \"\") != \"\":\n",
|
| 268 |
+
" prompt += f'\\nHere is the additional file you might need to answer the question: files/{item.get(\"file_name\", \"\")}'\n",
|
| 269 |
+
"r = await agent.run(prompt)\n",
|
| 270 |
+
"print(r.response.blocks[0].text)"
|
| 271 |
+
]
|
| 272 |
+
},
|
| 273 |
+
{
|
| 274 |
+
"cell_type": "code",
|
| 275 |
+
"execution_count": 4,
|
| 276 |
+
"id": "3e61988b",
|
| 277 |
+
"metadata": {},
|
| 278 |
+
"outputs": [
|
| 279 |
+
{
|
| 280 |
+
"name": "stdout",
|
| 281 |
+
"output_type": "stream",
|
| 282 |
+
"text": [
|
| 283 |
+
"89706.00\n"
|
| 284 |
+
]
|
| 285 |
+
}
|
| 286 |
+
],
|
| 287 |
+
"source": [
|
| 288 |
+
"item = {\n",
|
| 289 |
+
" \"task_id\": \"7bd855d8-463d-4ed5-93ca-5fe35145f733\",\n",
|
| 290 |
+
" \"question\": \"The attached Excel file contains the sales of menu items for a local fast-food chain. What were the total sales that the chain made from food (not including drinks)? Express your answer in USD with two decimal places.\",\n",
|
| 291 |
+
" \"Level\": \"1\",\n",
|
| 292 |
+
" \"file_name\": \"7bd855d8-463d-4ed5-93ca-5fe35145f733.xlsx\"\n",
|
| 293 |
+
" }\n",
|
| 294 |
+
"\n",
|
| 295 |
+
"question_text = item.get(\"question\")\n",
|
| 296 |
+
"prompt = system_prompt + question_text\n",
|
| 297 |
+
"if item.get(\"file_name\", \"\") != \"\":\n",
|
| 298 |
+
" prompt += f'\\nHere is the additional file you might need to answer the question: files/{item.get(\"file_name\", \"\")}'\n",
|
| 299 |
+
"r = await agent.run(prompt)\n",
|
| 300 |
+
"print(r.response.blocks[0].text)"
|
| 301 |
+
]
|
| 302 |
+
},
|
| 303 |
+
{
|
| 304 |
+
"cell_type": "code",
|
| 305 |
+
"execution_count": 14,
|
| 306 |
+
"id": "ecc8d8be",
|
| 307 |
+
"metadata": {},
|
| 308 |
+
"outputs": [
|
| 309 |
+
{
|
| 310 |
+
"name": "stdout",
|
| 311 |
+
"output_type": "stream",
|
| 312 |
+
"text": [
|
| 313 |
+
"You are a general AI assistant. I will ask you a question. Report your thoughts, and return\n",
|
| 314 |
+
"your answer.\n",
|
| 315 |
+
"\n",
|
| 316 |
+
"YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of\n",
|
| 317 |
+
"numbers and/or strings.\n",
|
| 318 |
+
"If you are asked for a number, don’t use comma to write your number neither use units such as $ or percent\n",
|
| 319 |
+
"sign unless specified otherwise.\n",
|
| 320 |
+
"If you are asked for a string, don’t use articles, neither abbreviations (e.g. for cities), and write the digits in\n",
|
| 321 |
+
"plain text unless specified otherwise.\n",
|
| 322 |
+
"If you are asked for a comma separated list, apply the above rules depending of whether the element to be put\n",
|
| 323 |
+
"in the list is a number or a string.\n",
|
| 324 |
+
"\n",
|
| 325 |
+
"Here is the question: \n",
|
| 326 |
+
".rewsna eht sa \"tfel\" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI\n"
|
| 327 |
+
]
|
| 328 |
+
}
|
| 329 |
+
],
|
| 330 |
+
"source": [
|
| 331 |
+
"print(prompt)"
|
| 332 |
+
]
|
| 333 |
+
}
|
| 334 |
+
],
|
| 335 |
+
"metadata": {
|
| 336 |
+
"kernelspec": {
|
| 337 |
+
"display_name": "hf_311",
|
| 338 |
+
"language": "python",
|
| 339 |
+
"name": "python3"
|
| 340 |
+
},
|
| 341 |
+
"language_info": {
|
| 342 |
+
"codemirror_mode": {
|
| 343 |
+
"name": "ipython",
|
| 344 |
+
"version": 3
|
| 345 |
+
},
|
| 346 |
+
"file_extension": ".py",
|
| 347 |
+
"mimetype": "text/x-python",
|
| 348 |
+
"name": "python",
|
| 349 |
+
"nbconvert_exporter": "python",
|
| 350 |
+
"pygments_lexer": "ipython3",
|
| 351 |
+
"version": "3.11.9"
|
| 352 |
+
}
|
| 353 |
+
},
|
| 354 |
+
"nbformat": 4,
|
| 355 |
+
"nbformat_minor": 5
|
| 356 |
+
}
|