/ examples / cookbooks / rag_examples / agentic_rag / PraisonAI_RecipeAgent.ipynb
PraisonAI_RecipeAgent.ipynb
  1  {
  2   "cells": [
  3    {
  4     "cell_type": "markdown",
  5     "metadata": {
  6      "id": "LJRJRQtFTagH"
  7     },
  8     "source": [
  9      "# AI RAG Agent with Web Access using PraisonAI"
 10     ]
 11    },
 12    {
 13     "cell_type": "markdown",
 14     "metadata": {
 15      "id": "Ph4RVTBCTcmB"
 16     },
 17     "source": [
 18      "This notebook demonstrates how to build a Retrieval-Augmented Generation (RAG) agent with web access using GPT-4o and PraisonAI. The agent specializes in Thai recipes and can search the web for additional information."
 19     ]
 20    },
 21    {
 22     "cell_type": "markdown",
 23     "metadata": {
 24      "id": "tMxfwPPATy_o"
 25     },
 26     "source": [
 27      "This RAG agent:\n",
 28      "*   Creates an AI assistant specialized in Thai recipes and cooking\n",
 29      "*   Has access to a PDF knowledge base about Thai recipes\n",
 30      "*   Can search the web using DuckDuckGo for additional information\n",
 31      "*   Provides comprehensive answers about Thai cuisine\n",
 32      "*   Uses PraisonAI framework for agent management"
 33     ]
 34    },
 35    {
 36     "cell_type": "markdown",
 37     "metadata": {
 38      "id": "h68oMaCITmqt"
 39     },
 40     "source": [
 41      "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Dhivya-Bharathy/PraisonAI/blob/main/examples/cookbooks/rag_examples/agentic_rag/PraisonAI_RecipeAgent.ipynb)\n"
 42     ]
 43    },
 44    {
 45     "cell_type": "markdown",
 46     "metadata": {
 47      "id": "cAdzoWXJUMfF"
 48     },
 49     "source": [
 50      "# Dependencies"
 51     ]
 52    },
 53    {
 54     "cell_type": "code",
 55     "execution_count": null,
 56     "metadata": {
 57      "id": "9D-2TlOrUNcu"
 58     },
 59     "outputs": [],
 60     "source": [
 61      "!pip install praisonaiagents openai requests"
 62     ]
 63    },
 64    {
 65     "cell_type": "markdown",
 66     "metadata": {
 67      "id": "yY-4-kEIUW40"
 68     },
 69     "source": [
 70      "# Set Up API Key"
 71     ]
 72    },
 73    {
 74     "cell_type": "code",
 75     "execution_count": 2,
 76     "metadata": {
 77      "colab": {
 78       "base_uri": "https://localhost:8080/"
 79      },
 80      "id": "f5bhQ05yUX6J",
 81      "outputId": "dcf9d0d9-332e-4136-9289-4c39d898005c"
 82     },
 83     "outputs": [
 84      {
 85       "name": "stdout",
 86       "output_type": "stream",
 87       "text": [
 88        "Enter your OpenAI API key: ··········\n",
 89        "✅ API key set successfully!\n"
 90       ]
 91      }
 92     ],
 93     "source": [
 94      "import os\n",
 95      "\n",
 96      "# Set your OpenAI API key here\n",
 97      "os.environ['OPENAI_API_KEY'] = 'Enter your api key here'\n",
 98      "\n",
 99      "# Or use this method to input it securely\n",
100      "from getpass import getpass\n",
101      "api_key = getpass('Enter your OpenAI API key: ')\n",
102      "os.environ['OPENAI_API_KEY'] = api_key\n",
103      "\n",
104      "print(\"✅ API key set successfully!\")"
105     ]
106    },
107    {
108     "cell_type": "markdown",
109     "metadata": {
110      "id": "Eh0j-SegUi13"
111     },
112     "source": [
113      "# Tools"
114     ]
115    },
116    {
117     "cell_type": "code",
118     "execution_count": 3,
119     "metadata": {
120      "colab": {
121       "base_uri": "https://localhost:8080/"
122      },
123      "id": "Z1A9oifIUkQN",
124      "outputId": "9be78226-36fa-43c4-865d-2f7e6e2ba9de"
125     },
126     "outputs": [
127      {
128       "name": "stdout",
129       "output_type": "stream",
130       "text": [
131        "✅ Tools imported successfully!\n"
132       ]
133      }
134     ],
135     "source": [
136      "from praisonaiagents import Agent\n",
137      "import requests\n",
138      "import tempfile\n",
139      "from pathlib import Path\n",
140      "\n",
141      "print(\"✅ Tools imported successfully!\")"
142     ]
143    },
144    {
145     "cell_type": "markdown",
146     "metadata": {
147      "id": "efnnREHXUnYA"
148     },
149     "source": [
150      "# YAML Prompt"
151     ]
152    },
153    {
154     "cell_type": "code",
155     "execution_count": 4,
156     "metadata": {
157      "colab": {
158       "base_uri": "https://localhost:8080/"
159      },
160      "id": "kcM14-yQUqG-",
161      "outputId": "c5b6288d-a789-4a93-e20c-1d285370b667"
162     },
163     "outputs": [
164      {
165       "name": "stdout",
166       "output_type": "stream",
167       "text": [
168        "✅ Agent instructions configured!\n"
169       ]
170      }
171     ],
172     "source": [
173      "# Agent configuration and instructions\n",
174      "AGENT_INSTRUCTIONS = \"\"\"\n",
175      "You are a helpful AI assistant specialized in Thai recipes and cooking.\n",
176      "\n",
177      "You have access to a PDF knowledge base about Thai recipes from: https://phi-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf\n",
178      "\n",
179      "You can also search the web for additional information about Thai cooking, ingredients, and techniques.\n",
180      "\n",
181      "When answering questions:\n",
182      "1. Use your knowledge about Thai cuisine to provide helpful information\n",
183      "2. If needed, search the web for additional details, current information, or clarification\n",
184      "3. Provide comprehensive, helpful answers about Thai cuisine\n",
185      "4. Always be informative and helpful about Thai cooking!\n",
186      "\n",
187      "You can use the internet_search function to search the web when needed.\n",
188      "\n",
189      "Focus on providing practical cooking advice, ingredient information, and authentic Thai recipe guidance.\n",
190      "\"\"\"\n",
191      "\n",
192      "print(\"✅ Agent instructions configured!\")"
193     ]
194    },
195    {
196     "cell_type": "markdown",
197     "metadata": {
198      "id": "MCBRcXFJUulY"
199     },
200     "source": [
201      "# Main"
202     ]
203    },
204    {
205     "cell_type": "code",
206     "execution_count": 5,
207     "metadata": {
208      "colab": {
209       "base_uri": "https://localhost:8080/"
210      },
211      "id": "YaRLbgMmUvXv",
212      "outputId": "8ed8d9f8-85a7-48de-ccc6-f617cd672a85"
213     },
214     "outputs": [
215      {
216       "name": "stdout",
217       "output_type": "stream",
218       "text": [
219        "🤖 Thai Recipe RAG Agent created successfully!\n",
220        "The agent is ready to answer questions about Thai cooking.\n"
221       ]
222      }
223     ],
224     "source": [
225      "# Create the RAG agent\n",
226      "rag_agent = Agent(\n",
227      "    instructions=AGENT_INSTRUCTIONS,\n",
228      "    llm=\"gpt-4o\",\n",
229      "    markdown=True,\n",
230      "    verbose=True\n",
231      ")\n",
232      "\n",
233      "print(\"🤖 Thai Recipe RAG Agent created successfully!\")\n",
234      "print(\"The agent is ready to answer questions about Thai cooking.\")"
235     ]
236    },
237    {
238     "cell_type": "markdown",
239     "metadata": {
240      "id": "QvZM94pGU0IX"
241     },
242     "source": [
243      "# Test the Agent"
244     ]
245    },
246    {
247     "cell_type": "code",
248     "execution_count": 6,
249     "metadata": {
250      "colab": {
251       "base_uri": "https://localhost:8080/",
252       "height": 1000,
253       "referenced_widgets": [
254        "47739975c9f04ee5b4e69e8f445cbeda",
255        "08888d583cba4c01b3fdf8f30b06ca4f"
256       ]
257      },
258      "id": "QPdrleKxU1VN",
259      "outputId": "a71a86cd-eff8-4309-9b50-173a30066c90"
260     },
261     "outputs": [
262      {
263       "name": "stdout",
264       "output_type": "stream",
265       "text": [
266        "🤔 Question: What are the essential ingredients for Thai cooking?\n"
267       ]
268      },
269      {
270       "data": {
271        "text/html": [
272         "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">╭─ </span><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8; font-weight: bold\">Agent Info</span><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\"> ────────────────────────────────────────────────────────────────────────────────────────────────────╮</span>\n",
273         "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>                                                                                                                 <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
274         "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>  <span style=\"color: #ff9b9b; text-decoration-color: #ff9b9b; font-weight: bold\">👤 Agent:</span> <span style=\"color: #ffe5e5; text-decoration-color: #ffe5e5\">Agent</span>                                                                                                <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
275         "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>  <span style=\"color: #b4b4b3; text-decoration-color: #b4b4b3; font-weight: bold\">Role:</span> <span style=\"color: #ffe5e5; text-decoration-color: #ffe5e5\">Assistant</span>                                                                                                <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
276         "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>                                                                                                                 <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
277         "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
278         "</pre>\n"
279        ],
280        "text/plain": [
281         "\u001b[38;2;210;227;200m╭─\u001b[0m\u001b[38;2;210;227;200m \u001b[0m\u001b[1;38;2;210;227;200mAgent Info\u001b[0m\u001b[38;2;210;227;200m \u001b[0m\u001b[38;2;210;227;200m───────────────────────────────────────────────────────────────────────────────────────────────────\u001b[0m\u001b[38;2;210;227;200m─╮\u001b[0m\n",
282         "\u001b[38;2;210;227;200m│\u001b[0m                                                                                                                 \u001b[38;2;210;227;200m│\u001b[0m\n",
283         "\u001b[38;2;210;227;200m│\u001b[0m  \u001b[1;38;2;255;155;155m👤 Agent:\u001b[0m \u001b[38;2;255;229;229mAgent\u001b[0m                                                                                                \u001b[38;2;210;227;200m│\u001b[0m\n",
284         "\u001b[38;2;210;227;200m│\u001b[0m  \u001b[1;38;2;180;180;179mRole:\u001b[0m \u001b[38;2;255;229;229mAssistant\u001b[0m                                                                                                \u001b[38;2;210;227;200m│\u001b[0m\n",
285         "\u001b[38;2;210;227;200m│\u001b[0m                                                                                                                 \u001b[38;2;210;227;200m│\u001b[0m\n",
286         "\u001b[38;2;210;227;200m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
287        ]
288       },
289       "metadata": {},
290       "output_type": "display_data"
291      },
292      {
293       "data": {
294        "application/vnd.jupyter.widget-view+json": {
295         "model_id": "47739975c9f04ee5b4e69e8f445cbeda",
296         "version_major": 2,
297         "version_minor": 0
298        },
299        "text/plain": [
300         "Output()"
301        ]
302       },
303       "metadata": {},
304       "output_type": "display_data"
305      },
306      {
307       "data": {
308        "text/html": [
309         "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
310        ],
311        "text/plain": []
312       },
313       "metadata": {},
314       "output_type": "display_data"
315      },
316      {
317       "data": {
318        "text/html": [
319         "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
320         "</pre>\n"
321        ],
322        "text/plain": [
323         "\n"
324        ]
325       },
326       "metadata": {},
327       "output_type": "display_data"
328      },
329      {
330       "data": {
331        "text/html": [
332         "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">Response generated in 8.4s</span>\n",
333         "</pre>\n"
334        ],
335        "text/plain": [
336         "\u001b[2mResponse generated in 8.4s\u001b[0m\n"
337        ]
338       },
339       "metadata": {},
340       "output_type": "display_data"
341      },
342      {
343       "data": {
344        "text/html": [
345         "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080\">╭───────────────────────────────────────────────────── Task ──────────────────────────────────────────────────────╮</span>\n",
346         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> What are the essential ingredients for Thai cooking?                                                            <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
347         "<span style=\"color: #008080; text-decoration-color: #008080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
348         "</pre>\n"
349        ],
350        "text/plain": [
351         "\u001b[36m╭─\u001b[0m\u001b[36m────────────────────────────────────────────────────\u001b[0m\u001b[36m Task \u001b[0m\u001b[36m─────────────────────────────────────────────────────\u001b[0m\u001b[36m─╮\u001b[0m\n",
352         "\u001b[36m│\u001b[0m What are the essential ingredients for Thai cooking?                                                            \u001b[36m│\u001b[0m\n",
353         "\u001b[36m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
354        ]
355       },
356       "metadata": {},
357       "output_type": "display_data"
358      },
359      {
360       "data": {
361        "text/html": [
362         "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080\">╭─────────────────────────────────────────────────── Response ────────────────────────────────────────────────────╮</span>\n",
363         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> Thai cooking is known for its balance of five fundamental taste senses in each dish or the overall meal: sour,  <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
364         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> sweet, salty, bitter, and spicy. Essential ingredients that help achieve this balance include:                  <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
365         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
366         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">  1 </span><span style=\"font-weight: bold\">Fish Sauce (Nam Pla)</span>: A salty, savory sauce made from fermented fish. It's a cornerstone of Thai cooking,   <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
367         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    </span>used to add depth of flavor.                                                                                <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
368         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">  2 </span><span style=\"font-weight: bold\">Lime Juice</span>: Used to add a fresh, tangy citrus flavor to dishes, especially in salads and some curries.      <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
369         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">  3 </span><span style=\"font-weight: bold\">Chilies</span>: Thai cuisine often features fresh Thai bird's eye chilies for heat, as well as dried chilies for   <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
370         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    </span>certain recipes.                                                                                            <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
371         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">  4 </span><span style=\"font-weight: bold\">Lemongrass</span>: A citrusy, fragrant herb that is often used in soups, curries, and teas.                        <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
372         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">  5 </span><span style=\"font-weight: bold\">Galangal</span>: Similar to ginger, galangal has a sharp, peppery flavor and is used in soups and curries.         <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
373         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">  6 </span><span style=\"font-weight: bold\">Kaffir Lime Leaves</span>: They add a distinct, zesty citrus aroma and flavor to Thai dishes.                      <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
374         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">  7 </span><span style=\"font-weight: bold\">Coconut Milk</span>: Adds richness and creaminess, commonly used in curries and desserts.                          <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
375         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">  8 </span><span style=\"font-weight: bold\">Palm Sugar</span>: Used as a sweetener, palm sugar has a nuanced flavor, unlike regular sugar.                     <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
376         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">  9 </span><span style=\"font-weight: bold\">Tamarind Paste</span>: Provides a sour element to many dishes, particularly pad Thai and some sauces.              <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
377         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> 10 </span><span style=\"font-weight: bold\">Thai Basil</span>: Adds a spicy, peppery flavor, different from the sweet basil used in Western cooking.           <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
378         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> 11 </span><span style=\"font-weight: bold\">Coriander (Cilantro)</span>: Used as a garnish and for its fresh, citrusy leaves and roots, which add depth to     <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
379         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    </span>sauces and stocks.                                                                                          <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
380         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> 12 </span><span style=\"font-weight: bold\">Shrimp Paste</span>: A very pungent paste made from fermented shrimp, used sparingly to enrich the flavor of       <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
381         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    </span>dishes.                                                                                                     <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
382         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
383         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> These ingredients are commonly used in combination to create the complex and rich flavors characteristic of     <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
384         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> Thai cuisine. Fresh and high-quality versions of these ingredients contribute significantly to the authenticity <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
385         "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> of Thai dishes.                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
386         "<span style=\"color: #008080; text-decoration-color: #008080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
387         "</pre>\n"
388        ],
389        "text/plain": [
390         "\u001b[36m╭─\u001b[0m\u001b[36m──────────────────────────────────────────────────\u001b[0m\u001b[36m Response \u001b[0m\u001b[36m───────────────────────────────────────────────────\u001b[0m\u001b[36m─╮\u001b[0m\n",
391         "\u001b[36m│\u001b[0m Thai cooking is known for its balance of five fundamental taste senses in each dish or the overall meal: sour,  \u001b[36m│\u001b[0m\n",
392         "\u001b[36m│\u001b[0m sweet, salty, bitter, and spicy. Essential ingredients that help achieve this balance include:                  \u001b[36m│\u001b[0m\n",
393         "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
394         "\u001b[36m│\u001b[0m \u001b[1;33m  1 \u001b[0m\u001b[1mFish Sauce (Nam Pla)\u001b[0m: A salty, savory sauce made from fermented fish. It's a cornerstone of Thai cooking,   \u001b[36m│\u001b[0m\n",
395         "\u001b[36m│\u001b[0m \u001b[1;33m    \u001b[0mused to add depth of flavor.                                                                                \u001b[36m│\u001b[0m\n",
396         "\u001b[36m│\u001b[0m \u001b[1;33m  2 \u001b[0m\u001b[1mLime Juice\u001b[0m: Used to add a fresh, tangy citrus flavor to dishes, especially in salads and some curries.      \u001b[36m│\u001b[0m\n",
397         "\u001b[36m│\u001b[0m \u001b[1;33m  3 \u001b[0m\u001b[1mChilies\u001b[0m: Thai cuisine often features fresh Thai bird's eye chilies for heat, as well as dried chilies for   \u001b[36m│\u001b[0m\n",
398         "\u001b[36m│\u001b[0m \u001b[1;33m    \u001b[0mcertain recipes.                                                                                            \u001b[36m│\u001b[0m\n",
399         "\u001b[36m│\u001b[0m \u001b[1;33m  4 \u001b[0m\u001b[1mLemongrass\u001b[0m: A citrusy, fragrant herb that is often used in soups, curries, and teas.                        \u001b[36m│\u001b[0m\n",
400         "\u001b[36m│\u001b[0m \u001b[1;33m  5 \u001b[0m\u001b[1mGalangal\u001b[0m: Similar to ginger, galangal has a sharp, peppery flavor and is used in soups and curries.         \u001b[36m│\u001b[0m\n",
401         "\u001b[36m│\u001b[0m \u001b[1;33m  6 \u001b[0m\u001b[1mKaffir Lime Leaves\u001b[0m: They add a distinct, zesty citrus aroma and flavor to Thai dishes.                      \u001b[36m│\u001b[0m\n",
402         "\u001b[36m│\u001b[0m \u001b[1;33m  7 \u001b[0m\u001b[1mCoconut Milk\u001b[0m: Adds richness and creaminess, commonly used in curries and desserts.                          \u001b[36m│\u001b[0m\n",
403         "\u001b[36m│\u001b[0m \u001b[1;33m  8 \u001b[0m\u001b[1mPalm Sugar\u001b[0m: Used as a sweetener, palm sugar has a nuanced flavor, unlike regular sugar.                     \u001b[36m│\u001b[0m\n",
404         "\u001b[36m│\u001b[0m \u001b[1;33m  9 \u001b[0m\u001b[1mTamarind Paste\u001b[0m: Provides a sour element to many dishes, particularly pad Thai and some sauces.              \u001b[36m│\u001b[0m\n",
405         "\u001b[36m│\u001b[0m \u001b[1;33m 10 \u001b[0m\u001b[1mThai Basil\u001b[0m: Adds a spicy, peppery flavor, different from the sweet basil used in Western cooking.           \u001b[36m│\u001b[0m\n",
406         "\u001b[36m│\u001b[0m \u001b[1;33m 11 \u001b[0m\u001b[1mCoriander (Cilantro)\u001b[0m: Used as a garnish and for its fresh, citrusy leaves and roots, which add depth to     \u001b[36m│\u001b[0m\n",
407         "\u001b[36m│\u001b[0m \u001b[1;33m    \u001b[0msauces and stocks.                                                                                          \u001b[36m│\u001b[0m\n",
408         "\u001b[36m│\u001b[0m \u001b[1;33m 12 \u001b[0m\u001b[1mShrimp Paste\u001b[0m: A very pungent paste made from fermented shrimp, used sparingly to enrich the flavor of       \u001b[36m│\u001b[0m\n",
409         "\u001b[36m│\u001b[0m \u001b[1;33m    \u001b[0mdishes.                                                                                                     \u001b[36m│\u001b[0m\n",
410         "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
411         "\u001b[36m│\u001b[0m These ingredients are commonly used in combination to create the complex and rich flavors characteristic of     \u001b[36m│\u001b[0m\n",
412         "\u001b[36m│\u001b[0m Thai cuisine. Fresh and high-quality versions of these ingredients contribute significantly to the authenticity \u001b[36m│\u001b[0m\n",
413         "\u001b[36m│\u001b[0m of Thai dishes.                                                                                                 \u001b[36m│\u001b[0m\n",
414         "\u001b[36m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
415        ]
416       },
417       "metadata": {},
418       "output_type": "display_data"
419      },
420      {
421       "name": "stdout",
422       "output_type": "stream",
423       "text": [
424        "�� Answer: Thai cooking is known for its balance of five fundamental taste senses in each dish or the overall meal: sour, sweet, salty, bitter, and spicy. Essential ingredients that help achieve this balance include:\n",
425        "\n",
426        "1. **Fish Sauce (Nam Pla)**: A salty, savory sauce made from fermented fish. It's a cornerstone of Thai cooking, used to add depth of flavor.\n",
427        "\n",
428        "2. **Lime Juice**: Used to add a fresh, tangy citrus flavor to dishes, especially in salads and some curries.\n",
429        "\n",
430        "3. **Chilies**: Thai cuisine often features fresh Thai bird's eye chilies for heat, as well as dried chilies for certain recipes.\n",
431        "\n",
432        "4. **Lemongrass**: A citrusy, fragrant herb that is often used in soups, curries, and teas.\n",
433        "\n",
434        "5. **Galangal**: Similar to ginger, galangal has a sharp, peppery flavor and is used in soups and curries.\n",
435        "\n",
436        "6. **Kaffir Lime Leaves**: They add a distinct, zesty citrus aroma and flavor to Thai dishes.\n",
437        "\n",
438        "7. **Coconut Milk**: Adds richness and creaminess, commonly used in curries and desserts.\n",
439        "\n",
440        "8. **Palm Sugar**: Used as a sweetener, palm sugar has a nuanced flavor, unlike regular sugar.\n",
441        "\n",
442        "9. **Tamarind Paste**: Provides a sour element to many dishes, particularly pad Thai and some sauces.\n",
443        "\n",
444        "10. **Thai Basil**: Adds a spicy, peppery flavor, different from the sweet basil used in Western cooking.\n",
445        "\n",
446        "11. **Coriander (Cilantro)**: Used as a garnish and for its fresh, citrusy leaves and roots, which add depth to sauces and stocks.\n",
447        "\n",
448        "12. **Shrimp Paste**: A very pungent paste made from fermented shrimp, used sparingly to enrich the flavor of dishes.\n",
449        "\n",
450        "These ingredients are commonly used in combination to create the complex and rich flavors characteristic of Thai cuisine. Fresh and high-quality versions of these ingredients contribute significantly to the authenticity of Thai dishes.\n"
451       ]
452      }
453     ],
454     "source": [
455      "# Test question 1: Basic Thai cooking\n",
456      "question1 = \"What are the essential ingredients for Thai cooking?\"\n",
457      "print(f\"🤔 Question: {question1}\")\n",
458      "\n",
459      "try:\n",
460      "    response1 = rag_agent.start(question1)\n",
461      "    print(f\"�� Answer: {response1}\")\n",
462      "except Exception as e:\n",
463      "    print(f\"❌ Error: {e}\")"
464     ]
465    }
466   ],
467   "metadata": {
468    "colab": {
469     "provenance": []
470    },
471    "kernelspec": {
472     "display_name": "Python 3",
473     "name": "python3"
474    },
475    "language_info": {
476     "name": "python"
477    }
478   },
479   "nbformat": 4,
480   "nbformat_minor": 0
481  }