Skip to content

Commit 1d868ca

Browse files
committed
small fix notebook
1 parent 0fc22a9 commit 1d868ca

File tree

1 file changed

+26
-44
lines changed

1 file changed

+26
-44
lines changed

modules/src/agent_deployer/agent_deployer.ipynb

Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,8 @@
1010
},
1111
{
1212
"cell_type": "code",
13-
"execution_count": 21,
1413
"id": "be42e7c5-b2af-476f-8041-c17be56edb52",
1514
"metadata": {},
16-
"outputs": [
17-
{
18-
"name": "stdout",
19-
"output_type": "stream",
20-
"text": [
21-
"> 2025-12-03 07:17:36,530 [info] Project loaded successfully: {\"project_name\":\"langchain-example-10\"}\n"
22-
]
23-
}
24-
],
2515
"source": [
2616
"%config Completer.use_jedi = False\n",
2717
"\n",
@@ -31,7 +21,9 @@
3121
"image = \"mlrun/mlrun\"\n",
3222
"project_name = \"langchain-example\"\n",
3323
"project = get_or_create_project(project_name, context=\"./\", allow_cross_project=True)"
34-
]
24+
],
25+
"outputs": [],
26+
"execution_count": null
3527
},
3628
{
3729
"cell_type": "markdown",
@@ -43,17 +35,17 @@
4335
},
4436
{
4537
"cell_type": "code",
46-
"execution_count": 23,
4738
"id": "a47d7789-2ea2-493e-8905-f53b978e2abd",
4839
"metadata": {},
49-
"outputs": [],
5040
"source": [
5141
"# Create project secrets for project\n",
5242
"secrets = {\"OPENAI_API_KEY\": \"\", # add your OpenAI API key here\n",
5343
" \"OPENAI_BASE_URL\": \"\" # add your OpenAI base url here if needed\n",
5444
" }\n",
5545
"project.set_secrets(secrets=secrets, provider=\"kubernetes\")"
56-
]
46+
],
47+
"outputs": [],
48+
"execution_count": null
5749
},
5850
{
5951
"cell_type": "markdown",
@@ -65,10 +57,8 @@
6557
},
6658
{
6759
"cell_type": "code",
68-
"execution_count": null,
6960
"id": "25cbd982-86de-43b5-91ef-24fc60b2d758",
7061
"metadata": {},
71-
"outputs": [],
7262
"source": [
7363
"%%writefile langchain_model.py\n",
7464
"\n",
@@ -197,7 +187,9 @@
197187
" result[\"total_cost_usd\"] = input_cost + output_cost\n",
198188
" return result\n",
199189
" "
200-
]
190+
],
191+
"outputs": [],
192+
"execution_count": null
201193
},
202194
{
203195
"cell_type": "markdown",
@@ -209,20 +201,8 @@
209201
},
210202
{
211203
"cell_type": "code",
212-
"execution_count": 81,
213204
"id": "691e9068-ec9c-40d6-9ac8-e6c3e605b44c",
214205
"metadata": {},
215-
"outputs": [
216-
{
217-
"name": "stdout",
218-
"output_type": "stream",
219-
"text": [
220-
"> 2025-12-03 10:55:46,194 [info] Project loaded successfully: {\"project_name\":\"langchain-example-10\"}\n",
221-
"> 2025-12-03 10:55:46,463 [info] Model monitoring credentials were set successfully. Please keep in mind that if you already had model monitoring functions / model monitoring infra / tracked model server deployed on your project, you will need to redeploy them. For redeploying the model monitoring infra, first disable it using `project.disable_model_monitoring()` and then enable it using `project.enable_model_monitoring()`.\n",
222-
"details: MLRunConflictError(\"The following model-montioring infrastructure functions are already deployed, aborting: ['model-monitoring-controller', 'model-monitoring-writer']\\nIf you want to redeploy the model-monitoring controller (maybe with different base-period), use update_model_monitoring_controller.If you want to redeploy all of model-monitoring infrastructure, call disable_model_monitoringbefore calling enable_model_monitoring again.\")\n"
223-
]
224-
}
225-
],
226206
"source": [
227207
"module = mlrun.import_module(\"hub://agent_deployer\")\n",
228208
"\n",
@@ -237,11 +217,11 @@
237217
" prompt_template= \"\"\"\n",
238218
" Answer the following questions as best you can.\n",
239219
" You have access to the following tools:\n",
240-
" {tools}\n",
220+
" {{tools}}\n",
241221
" Use the following format:\n",
242222
" Question: the input question you must answer\n",
243223
" Thought: you should always think about what to do\n",
244-
" Action: the action to take, should be one of [{tool_names}]\n",
224+
" Action: the action to take, should be one of [{{tool_names}}]\n",
245225
" Action Input: the input to the action\n",
246226
" Observation: the result of the action\n",
247227
" ... (this Thought/Action/Action Input/Observation can repeat N times)\n",
@@ -252,16 +232,18 @@
252232
" Question: {input}\n",
253233
" Thought:{agent_scratchpad}\n",
254234
" \"\"\",\n",
255-
")"
256-
]
235+
")\n"
236+
],
237+
"outputs": [],
238+
"execution_count": null
257239
},
258240
{
259241
"cell_type": "code",
260-
"execution_count": 82,
261242
"id": "0bb1c4d1-5d7c-4d1c-bf51-8f53b319e91f",
262243
"metadata": {},
244+
"source": "func = agent.deploy_function(enable_tracking=True)",
263245
"outputs": [],
264-
"source": "func = agent.deploy_function(enable_tracking=True)"
246+
"execution_count": null
265247
},
266248
{
267249
"metadata": {},
@@ -272,10 +254,10 @@
272254
{
273255
"metadata": {},
274256
"cell_type": "code",
257+
"source": "func.invoke(\"./\", {\"question\" : \"If a pizza costs $18.75 and I want to buy 3, what is the total cost?\"})",
258+
"id": "ac5c3ba174d2cf8b",
275259
"outputs": [],
276-
"execution_count": null,
277-
"source": "func.invoke(\"./\", {\"question\" : \"If a pizza costs $18.75 and I want to buy 3, plus a 15% tip, what is the total cost?\"})",
278-
"id": "ac5c3ba174d2cf8b"
260+
"execution_count": null
279261
},
280262
{
281263
"metadata": {},
@@ -289,8 +271,6 @@
289271
{
290272
"metadata": {},
291273
"cell_type": "code",
292-
"outputs": [],
293-
"execution_count": null,
294274
"source": [
295275
"%%writefile monitoring_application.py\n",
296276
"\n",
@@ -405,7 +385,9 @@
405385
" value=value,\n",
406386
" )\n"
407387
],
408-
"id": "377487422f5ed289"
388+
"id": "377487422f5ed289",
389+
"outputs": [],
390+
"execution_count": null
409391
},
410392
{
411393
"metadata": {},
@@ -416,8 +398,6 @@
416398
{
417399
"metadata": {},
418400
"cell_type": "code",
419-
"outputs": [],
420-
"execution_count": null,
421401
"source": [
422402
"llm_monitoring_app = project.set_model_monitoring_function(\n",
423403
" func=\"monitoring_application.py\",\n",
@@ -428,7 +408,9 @@
428408
"\n",
429409
"project.deploy_function(llm_monitoring_app)"
430410
],
431-
"id": "9d6ad2a4a47a44bd"
411+
"id": "9d6ad2a4a47a44bd",
412+
"outputs": [],
413+
"execution_count": null
432414
}
433415
],
434416
"metadata": {

0 commit comments

Comments
 (0)