pulkitme
commited on
Commit
·
fb5a9ca
1
Parent(s):
dd8c569
simple smolagent with duck duck go search tool and youtube transcription tool
Browse files- app.py +2 -2
- test.ipynb +3 -12
app.py
CHANGED
|
@@ -10,7 +10,7 @@ from langchain_community.document_loaders import YoutubeLoader
|
|
| 10 |
|
| 11 |
|
| 12 |
#client = genai.Client(api_key=os.getenv("API_KEY"))
|
| 13 |
-
model = LiteLLMModel(model_id="gemini/gemini-2.0-flash
|
| 14 |
api_key=os.getenv("API_KEY"))
|
| 15 |
# (Keep Constants as is)
|
| 16 |
# --- Constants ---
|
|
@@ -129,7 +129,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 129 |
continue
|
| 130 |
try:
|
| 131 |
submitted_answer = agent(question_text)
|
| 132 |
-
time.sleep(
|
| 133 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 134 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 135 |
except Exception as e:
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
#client = genai.Client(api_key=os.getenv("API_KEY"))
|
| 13 |
+
model = LiteLLMModel(model_id="gemini/gemini-2.0-flash",
|
| 14 |
api_key=os.getenv("API_KEY"))
|
| 15 |
# (Keep Constants as is)
|
| 16 |
# --- Constants ---
|
|
|
|
| 129 |
continue
|
| 130 |
try:
|
| 131 |
submitted_answer = agent(question_text)
|
| 132 |
+
time.sleep(20)
|
| 133 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 134 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 135 |
except Exception as e:
|
test.ipynb
CHANGED
|
@@ -108,24 +108,15 @@
|
|
| 108 |
},
|
| 109 |
{
|
| 110 |
"cell_type": "code",
|
| 111 |
-
"execution_count":
|
| 112 |
"metadata": {},
|
| 113 |
-
"outputs": [
|
| 114 |
-
{
|
| 115 |
-
"name": "stderr",
|
| 116 |
-
"output_type": "stream",
|
| 117 |
-
"text": [
|
| 118 |
-
"c:\\Users\\pulkitme\\AppData\\Local\\miniconda3\\Lib\\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",
|
| 119 |
-
" from .autonotebook import tqdm as notebook_tqdm\n"
|
| 120 |
-
]
|
| 121 |
-
}
|
| 122 |
-
],
|
| 123 |
"source": [
|
| 124 |
"from smolagents import Tool , CodeAgent, ToolCallingAgent, DuckDuckGoSearchTool, LiteLLMModel, PythonInterpreterTool, tool, DuckDuckGoSearchTool\n",
|
| 125 |
"\n",
|
| 126 |
"\n",
|
| 127 |
"#client = genai.Client(api_key=os.getenv(\"API_KEY\"))\n",
|
| 128 |
-
"model = LiteLLMModel(model_id=\"gemini/gemini-2.0-flash
|
| 129 |
" api_key=\"\")"
|
| 130 |
]
|
| 131 |
},
|
|
|
|
| 108 |
},
|
| 109 |
{
|
| 110 |
"cell_type": "code",
|
| 111 |
+
"execution_count": 11,
|
| 112 |
"metadata": {},
|
| 113 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
"source": [
|
| 115 |
"from smolagents import Tool , CodeAgent, ToolCallingAgent, DuckDuckGoSearchTool, LiteLLMModel, PythonInterpreterTool, tool, DuckDuckGoSearchTool\n",
|
| 116 |
"\n",
|
| 117 |
"\n",
|
| 118 |
"#client = genai.Client(api_key=os.getenv(\"API_KEY\"))\n",
|
| 119 |
+
"model = LiteLLMModel(model_id=\"gemini/gemini-2.0-flash\",\n",
|
| 120 |
" api_key=\"\")"
|
| 121 |
]
|
| 122 |
},
|