Skip to content

Commit d2719c9

Browse files
committed
fix 1 / clear all outputs, remove output files, add tracing zava lab
1 parent 115072b commit d2719c9

22 files changed

+1384
-4389
lines changed

labs/1-agents/11-agent-service-creation.ipynb

Lines changed: 26 additions & 237 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,10 @@
3737
},
3838
{
3939
"cell_type": "code",
40-
"execution_count": 1,
40+
"execution_count": null,
4141
"id": "38e5768b",
4242
"metadata": {},
43-
"outputs": [
44-
{
45-
"name": "stdout",
46-
"output_type": "stream",
47-
"text": [
48-
"✅ All required packages are installed!\n",
49-
"📦 azure-ai-projects: 1.0.0\n",
50-
"📦 azure-identity: 1.25.1\n"
51-
]
52-
}
53-
],
43+
"outputs": [],
5444
"source": [
5545
"# Verify required packages are installed\n",
5646
"import importlib.metadata\n",
@@ -84,18 +74,10 @@
8474
},
8575
{
8676
"cell_type": "code",
87-
"execution_count": 2,
77+
"execution_count": null,
8878
"id": "b7e331ee",
8979
"metadata": {},
90-
"outputs": [
91-
{
92-
"name": "stdout",
93-
"output_type": "stream",
94-
"text": [
95-
"✅ All libraries imported successfully!\n"
96-
]
97-
}
98-
],
80+
"outputs": [],
9981
"source": [
10082
"import os\n",
10183
"from azure.ai.projects import AIProjectClient\n",
@@ -123,21 +105,10 @@
123105
},
124106
{
125107
"cell_type": "code",
126-
"execution_count": 3,
108+
"execution_count": null,
127109
"id": "03bee6a0",
128110
"metadata": {},
129-
"outputs": [
130-
{
131-
"name": "stdout",
132-
"output_type": "stream",
133-
"text": [
134-
"✅ Environment variables loaded successfully!\n",
135-
"📍 Project Endpoint: https://aoai-4v6jkpb4qesje.services.ai.azure.com/api/projects/proj-4v6jkpb4qesje\n",
136-
"🤖 Model Deployment: gpt-4.1\n",
137-
"🔍 Search Index: zava-products\n"
138-
]
139-
}
140-
],
111+
"outputs": [],
141112
"source": [
142113
"# Get environment variables\n",
143114
"project_endpoint = os.environ.get(\"AZURE_EXISTING_AIPROJECT_ENDPOINT\")\n",
@@ -171,19 +142,10 @@
171142
},
172143
{
173144
"cell_type": "code",
174-
"execution_count": 4,
145+
"execution_count": null,
175146
"id": "366abd1e",
176147
"metadata": {},
177-
"outputs": [
178-
{
179-
"name": "stdout",
180-
"output_type": "stream",
181-
"text": [
182-
"✅ Azure credentials verified successfully!\n",
183-
"✅ AI Project Client initialized successfully!\n"
184-
]
185-
}
186-
],
148+
"outputs": [],
187149
"source": [
188150
"# Check Azure credentials\n",
189151
"try:\n",
@@ -222,21 +184,10 @@
222184
},
223185
{
224186
"cell_type": "code",
225-
"execution_count": 5,
187+
"execution_count": null,
226188
"id": "8f6cf8e9",
227189
"metadata": {},
228-
"outputs": [
229-
{
230-
"name": "stdout",
231-
"output_type": "stream",
232-
"text": [
233-
"🔗 Azure AI Search Connection ID: /subscriptions/7a880728-70d3-49d0-adde-4250716cfd94/resourceGroups/rg-nitya-ignite-PREL13/providers/Microsoft.CognitiveServices/accounts/aoai-4v6jkpb4qesje/projects/proj-4v6jkpb4qesje/connections/searchConnection\n",
234-
"✅ Azure AI Search tool configured!\n",
235-
"🔍 Index Name: zava-products\n",
236-
"📊 Top Results: 5\n"
237-
]
238-
}
239-
],
190+
"outputs": [],
240191
"source": [
241192
"# Get the Azure AI Search connection from the project\n",
242193
"# Include credentials to access the endpoint and key\n",
@@ -277,57 +228,10 @@
277228
},
278229
{
279230
"cell_type": "code",
280-
"execution_count": 6,
231+
"execution_count": null,
281232
"id": "8af99580",
282233
"metadata": {},
283-
"outputs": [
284-
{
285-
"name": "stdout",
286-
"output_type": "stream",
287-
"text": [
288-
"🔍 Testing search index with query: 'Eggshell paint'\n",
289-
"📍 Search Endpoint: https://srch-4v6jkpb4qesje.search.windows.net/\n",
290-
"📋 Index Name: zava-products\n",
291-
"\n",
292-
"✅ Search completed successfully!\n",
293-
"\n",
294-
"================================================================================\n",
295-
"📊 SEARCH RESULTS:\n",
296-
"================================================================================\n",
297-
"\n",
298-
"Result #1:\n",
299-
" content: Durable eggshell finish paint with subtle sheen, ideal for living rooms and bedrooms with easy cleanup.\n",
300-
" title: Interior Eggshell Paint\n",
301-
" stock: 80\n",
302-
" filepath: pfip000002\n",
303-
" price: 44.0\n",
304-
" id: PFIP000002\n",
305-
" url: /products/pfip000002\n",
306-
"--------------------------------------------------------------------------------\n",
307-
"\n",
308-
"Result #2:\n",
309-
" content: Disposable plastic liners that fit standard paint trays for quick cleanup and color changes.\n",
310-
" title: Paint Tray Liner Set\n",
311-
" filepath: pfpt000043\n",
312-
" price: 5.0\n",
313-
" id: PFPT000043\n",
314-
" url: /products/pfpt000043\n",
315-
"--------------------------------------------------------------------------------\n",
316-
"\n",
317-
"Result #3:\n",
318-
" content: Environmentally friendly zero-VOC paint for healthy indoor air quality in all living spaces.\n",
319-
" title: Zero VOC Interior Paint\n",
320-
" stock: 25\n",
321-
" filepath: pfip000004\n",
322-
" price: 52.0\n",
323-
" id: PFIP000004\n",
324-
" url: /products/pfip000004\n",
325-
"--------------------------------------------------------------------------------\n",
326-
"\n",
327-
"✅ Found 3 result(s) - Search index is working correctly!\n"
328-
]
329-
}
330-
],
234+
"outputs": [],
331235
"source": [
332236
"# Test the search index with a sample query\n",
333237
"from azure.search.documents import SearchClient\n",
@@ -406,21 +310,10 @@
406310
},
407311
{
408312
"cell_type": "code",
409-
"execution_count": 7,
313+
"execution_count": null,
410314
"id": "19c64125",
411315
"metadata": {},
412-
"outputs": [
413-
{
414-
"name": "stdout",
415-
"output_type": "stream",
416-
"text": [
417-
"✅ Agent created successfully!\n",
418-
"🤖 Agent ID: asst_jj1fls3VqnJfHxi9gfVPM8ix\n",
419-
"📝 Agent Name: Zava-Customer-Agent\n",
420-
"📋 Instructions: You are a polite and helpful shopping assistant for Zava products. Use the Azure AI Search tool to find information about products in the catalog and answer customer questions. Always cite your sources.\n"
421-
]
422-
}
423-
],
316+
"outputs": [],
424317
"source": [
425318
"# Agent 1: Zava-Customer-Agent\n",
426319
"# Create an agent with the Azure AI Search tool\n",
@@ -455,19 +348,10 @@
455348
},
456349
{
457350
"cell_type": "code",
458-
"execution_count": 8,
351+
"execution_count": null,
459352
"id": "5a87a37d",
460353
"metadata": {},
461-
"outputs": [
462-
{
463-
"name": "stdout",
464-
"output_type": "stream",
465-
"text": [
466-
"✅ Conversation thread created!\n",
467-
"💬 Thread ID: thread_zsMsbiRQHt0IHM9rZpVa9294\n"
468-
]
469-
}
470-
],
354+
"outputs": [],
471355
"source": [
472356
"# Create a thread for communication\n",
473357
"thread = project_client.agents.threads.create()\n",
@@ -493,20 +377,10 @@
493377
},
494378
{
495379
"cell_type": "code",
496-
"execution_count": 9,
380+
"execution_count": null,
497381
"id": "3ac7f21e",
498382
"metadata": {},
499-
"outputs": [
500-
{
501-
"name": "stdout",
502-
"output_type": "stream",
503-
"text": [
504-
"✅ User message added to thread!\n",
505-
"📨 Message ID: msg_uKWhUrMPI4de1B8jFiAvqRvg\n",
506-
"💭 Message content: [{'type': 'text', 'text': {'value': 'Tell me about your Eggshell paint products', 'annotations': []}}]\n"
507-
]
508-
}
509-
],
383+
"outputs": [],
510384
"source": [
511385
"# Add a message to the thread asking about products\n",
512386
"message = project_client.agents.messages.create(\n",
@@ -538,21 +412,10 @@
538412
},
539413
{
540414
"cell_type": "code",
541-
"execution_count": 10,
415+
"execution_count": null,
542416
"id": "a87070c1",
543417
"metadata": {},
544-
"outputs": [
545-
{
546-
"name": "stdout",
547-
"output_type": "stream",
548-
"text": [
549-
"🔄 Running the agent... (this may take a few moments)\n",
550-
"✅ Run completed!\n",
551-
"📊 Run status: RunStatus.COMPLETED\n",
552-
"🎉 Agent successfully searched the product catalog!\n"
553-
]
554-
}
555-
],
418+
"outputs": [],
556419
"source": [
557420
"# Create and process an agent run\n",
558421
"print(\"🔄 Running the agent... (this may take a few moments)\")\n",
@@ -589,43 +452,10 @@
589452
},
590453
{
591454
"cell_type": "code",
592-
"execution_count": 11,
455+
"execution_count": null,
593456
"id": "7863aa5e",
594457
"metadata": {},
595-
"outputs": [
596-
{
597-
"name": "stdout",
598-
"output_type": "stream",
599-
"text": [
600-
"\n",
601-
"================================================================================\n",
602-
"📝 CONVERSATION HISTORY\n",
603-
"================================================================================\n",
604-
"\n",
605-
"👤 USER:\n",
606-
"Tell me about your Eggshell paint products\n",
607-
"--------------------------------------------------------------------------------\n",
608-
"\n",
609-
"🤖 ASSISTANT:\n",
610-
"Zava offers a range of Eggshell paint products, which are known for their low-sheen, durable, and washable finish—ideal for interior walls, woodwork, and sometimes metal. Eggshell paints typically strike a balance between matt and gloss, giving a subtle, elegant appearance while offering better washability than flat paints.\n",
611-
"\n",
612-
"**Key features of Zava Eggshell paint products:**\n",
613-
"- **Finish:** Soft, low-sheen eggshell (more durable than matt, less glossy than satin)\n",
614-
"- **Usage:** Suitable for walls, ceilings, woodwork, and metal where a gentle sheen is desired\n",
615-
"- **Durability:** Resistant to stains and easy to clean—ideal for living rooms, dining rooms, and hallways\n",
616-
"- **Application:** Can be applied by brush, roller, or spray\n",
617-
"\n",
618-
"**Popular Zava Eggshell Paint Options:**\n",
619-
"- **Zava Premium Eggshell:** High coverage, available in a wide range of colors, excellent washability, and low odor\n",
620-
"- **Zava Quick-Dry Eggshell:** Fast drying time for quicker recoating and less downtime\n",
621-
"- **Zava Eco Eggshell:** Formulated with low VOC for a more environmentally friendly choice\n",
622-
"\n",
623-
"If you let me know your preferred color or surface (walls, wood, or metal), I can help you narrow down the best Zava Eggshell product for your project. Would you like more details on colors, technical specifications, or application tips?\n",
624-
"--------------------------------------------------------------------------------\n",
625-
"\n"
626-
]
627-
}
628-
],
458+
"outputs": [],
629459
"source": [
630460
"# Fetch all messages from the thread\n",
631461
"from azure.ai.agents.models import MessageRole, ListSortOrder\n",
@@ -673,42 +503,10 @@
673503
},
674504
{
675505
"cell_type": "code",
676-
"execution_count": 12,
506+
"execution_count": null,
677507
"id": "19379dd5",
678508
"metadata": {},
679-
"outputs": [
680-
{
681-
"name": "stdout",
682-
"output_type": "stream",
683-
"text": [
684-
"📨 Second question: [{'type': 'text', 'text': {'value': 'Tell me about the Paint Tray Liner Set', 'annotations': []}}]\n",
685-
"🔄 Running the agent...\n",
686-
"✅ Run completed with status: RunStatus.COMPLETED\n",
687-
"\n",
688-
"================================================================================\n",
689-
"🤖 LATEST AGENT RESPONSE:\n",
690-
"================================================================================\n",
691-
"\n",
692-
"The **Zava Paint Tray Liner Set** is a convenient accessory designed to simplify the painting process and make cleanup faster and easier. Here are the key details about this product:\n",
693-
"\n",
694-
"- **Purpose:** Paint tray liners are disposable inserts used inside your paint tray. They protect the tray from messy paint residue, making it easy to switch between colors or clean up after painting.\n",
695-
"- **Material:** Made from durable plastic that resists tearing and holds up well to both water-based and oil-based paints.\n",
696-
"- **Compatibility:** Designed to fit standard-sized paint trays commonly used with rollers for walls, ceilings, and other large surfaces.\n",
697-
"- **Convenience:** After painting, simply remove and discard the liner—no scrubbing necessary!\n",
698-
"- **Pack Size:** Typically comes in a set (for example, packs of 3 or 5 liners), so you have replacements ready for multi-color or multi-room projects.\n",
699-
"\n",
700-
"**Benefits of using the Zava Paint Tray Liner Set:**\n",
701-
"- Saves time on post-painting cleanup\n",
702-
"- Prevents contamination when switching paint colors\n",
703-
"- Prolongs the life of your main paint tray\n",
704-
"- Suitable for DIY and professional use\n",
705-
"\n",
706-
"If you need more specific information such as size, pack quantity, or compatibility with a particular Zava tray, please let me know!\n",
707-
"\n",
708-
"================================================================================\n"
709-
]
710-
}
711-
],
509+
"outputs": [],
712510
"source": [
713511
"# Ask another question\n",
714512
"message2 = project_client.agents.messages.create(\n",
@@ -764,19 +562,10 @@
764562
},
765563
{
766564
"cell_type": "code",
767-
"execution_count": 13,
565+
"execution_count": null,
768566
"id": "be314830",
769567
"metadata": {},
770-
"outputs": [
771-
{
772-
"name": "stdout",
773-
"output_type": "stream",
774-
"text": [
775-
"🗑️ Deleted thread: thread_zsMsbiRQHt0IHM9rZpVa9294\n",
776-
"🗑️ Deleted agent: asst_jj1fls3VqnJfHxi9gfVPM8ix\n"
777-
]
778-
}
779-
],
568+
"outputs": [],
780569
"source": [
781570
"# Delete the thread and agent to clean up resources\n",
782571
"project_client.agents.threads.delete(thread.id)\n",

0 commit comments

Comments
 (0)