Spaces:
Runtime error
Runtime error
updated notebook
Browse files- notebook.ipynb +21 -6
notebook.ipynb
CHANGED
@@ -33,12 +33,24 @@
|
|
33 |
"outputs": [],
|
34 |
"source": [
|
35 |
"from smolagents import CodeAgent, Tool, InferenceClientModel\n",
|
|
|
|
|
|
|
|
|
|
|
36 |
"from tools import fetch_file\n",
|
37 |
"\n",
|
38 |
-
"
|
39 |
-
"model = InferenceClientModel()\n",
|
40 |
"\n",
|
41 |
-
"from app import BasicAgent\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
"\n",
|
43 |
"agent = CodeAgent(tools=[fetch_file], model=model, additional_authorized_imports=['requests', 'bs4'])\n",
|
44 |
"\n",
|
@@ -68,10 +80,13 @@
|
|
68 |
" }\n",
|
69 |
"\n",
|
70 |
"question_text = item[\"question\"]\n",
|
71 |
-
"print(f\"Question: {question_text}\")\n",
|
72 |
"\n",
|
73 |
-
"
|
74 |
-
"
|
|
|
|
|
|
|
|
|
75 |
]
|
76 |
}
|
77 |
],
|
|
|
33 |
"outputs": [],
|
34 |
"source": [
|
35 |
"from smolagents import CodeAgent, Tool, InferenceClientModel\n",
|
36 |
+
"\n",
|
37 |
+
"#print(dir(smolagents.models))\n",
|
38 |
+
"#print(smolagents.__version__)\n",
|
39 |
+
"\n",
|
40 |
+
"\n",
|
41 |
"from tools import fetch_file\n",
|
42 |
"\n",
|
43 |
+
"model = InferenceClientModel(model_id=\"Qwen/Qwen2.5-Coder-7B-Instruct\", provider=\"nscale\")\n",
|
44 |
+
"#model = InferenceClientModel()\n",
|
45 |
"\n",
|
46 |
+
"#from app import BasicAgent\n",
|
47 |
+
"\n",
|
48 |
+
"system_promt = \"\"\"You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: \n",
|
49 |
+
"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.\n",
|
50 |
+
"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.\n",
|
51 |
+
"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.\n",
|
52 |
+
"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. \n",
|
53 |
+
"\"\"\"\n",
|
54 |
"\n",
|
55 |
"agent = CodeAgent(tools=[fetch_file], model=model, additional_authorized_imports=['requests', 'bs4'])\n",
|
56 |
"\n",
|
|
|
80 |
" }\n",
|
81 |
"\n",
|
82 |
"question_text = item[\"question\"]\n",
|
|
|
83 |
"\n",
|
84 |
+
"question = f\"{system_promt} {question_text}\"\n",
|
85 |
+
"\n",
|
86 |
+
"print(f\"Question: {question}\")\n",
|
87 |
+
"\n",
|
88 |
+
"#task_id = item[\"task_id\"]\n",
|
89 |
+
"submitted_answer = agent(question)\n"
|
90 |
]
|
91 |
}
|
92 |
],
|