{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "markdown", "source": [ "# **Name: Muhammad Haider Abbas Malik**\n", "\n", "# Roll No: 2430-6063 **bold text**\n", "\n", "# **MS EE 2nd Semester Student at CASE**\n", "\n", "# **I have done my Bachelors in EE from EME College from 2013 - 2017**\n", "\n", "# Before this course i had no background in python ML or LLM and this was first time i have created something like that.." ], "metadata": { "id": "UHQK1-a1GxxI" } }, { "cell_type": "markdown", "source": [ "**1. Inspiration**" ], "metadata": { "id": "1e8MuJHFu7pw" } }, { "cell_type": "markdown", "source": [ "1.1 Our goal was to use AgentPro and build an AI agent which can interact with the people, get the LLM and internet in loop to find best answers for the questions the user ask, not only those questions but to go an extra mile and fetch the information which seems to be necessary. So, I have decided to make AI Evenet Manager, as i have been in management tasks and i know how hectic it is and how difficult to remember each and every thing in time, then to find best contractors for that task, get their contacts etc. This task takes weeks and it is very difficult to bring everything at one place. So i wanted to make such an Agent that can provide all necessary details to me with only few steps.. So let us find out how did it go..." ], "metadata": { "id": "uqoYX_ISt_dK" } }, { "cell_type": "markdown", "source": [ "**2. Getting the Agent Pro package... **" ], "metadata": { "id": "6WxsX1c4uw87" } }, { "cell_type": "markdown", "source": [ "2.1 Clonning the agentpro from github" ], "metadata": { "id": "yesDFPmvvQpc" } }, { "cell_type": "code", "source": [ "!git clone https://github.com/traversaal-ai/AgentPro.git\n", "# Please RUN it whenever you use or open the colab notebook to get the agentPro tools in the environment" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "HSxm0QO8ORKz", "outputId": "e2b84ee5-f6d2-4335-bb72-6d323796c304" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Cloning into 'AgentPro'...\n", "remote: Enumerating objects: 1423, done.\u001b[K\n", "remote: Counting objects: 100% (324/324), done.\u001b[K\n", "remote: Compressing objects: 100% (158/158), done.\u001b[K\n", "remote: Total 1423 (delta 268), reused 166 (delta 166), pack-reused 1099 (from 3)\u001b[K\n", "Receiving objects: 100% (1423/1423), 12.62 MiB | 31.38 MiB/s, done.\n", "Resolving deltas: 100% (697/697), done.\n" ] } ] }, { "cell_type": "markdown", "source": [ "2.2 Installing required libraries" ], "metadata": { "id": "4yyZfYWkvUtF" } }, { "cell_type": "code", "source": [ "# Install any needed libraries (some may already be installed)\n", "!pip install openai requests scipy\n", "!pip install dateparser" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "xuNH28foPIjA", "outputId": "b70bc93e-66c9-45d5-d0ae-12cf9503cc5b" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Requirement already satisfied: openai in /usr/local/lib/python3.11/dist-packages (1.82.1)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.11/dist-packages (2.32.3)\n", "Requirement already satisfied: scipy in /usr/local/lib/python3.11/dist-packages (1.15.3)\n", "Requirement already satisfied: anyio<5,>=3.5.0 in /usr/local/lib/python3.11/dist-packages (from openai) (4.9.0)\n", "Requirement already satisfied: distro<2,>=1.7.0 in /usr/local/lib/python3.11/dist-packages (from openai) (1.9.0)\n", "Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.11/dist-packages (from openai) (0.28.1)\n", "Requirement already satisfied: jiter<1,>=0.4.0 in /usr/local/lib/python3.11/dist-packages (from openai) (0.10.0)\n", "Requirement already satisfied: pydantic<3,>=1.9.0 in /usr/local/lib/python3.11/dist-packages (from openai) (2.11.5)\n", "Requirement already satisfied: sniffio in /usr/local/lib/python3.11/dist-packages (from openai) (1.3.1)\n", "Requirement already satisfied: tqdm>4 in /usr/local/lib/python3.11/dist-packages (from openai) (4.67.1)\n", "Requirement already satisfied: typing-extensions<5,>=4.11 in /usr/local/lib/python3.11/dist-packages (from openai) (4.13.2)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests) (3.4.2)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.11/dist-packages (from requests) (3.10)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests) (2.4.0)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.11/dist-packages (from requests) (2025.4.26)\n", "Requirement already satisfied: numpy<2.5,>=1.23.5 in /usr/local/lib/python3.11/dist-packages (from scipy) (2.0.2)\n", "Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.11/dist-packages (from httpx<1,>=0.23.0->openai) (1.0.9)\n", "Requirement already satisfied: h11>=0.16 in /usr/local/lib/python3.11/dist-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.16.0)\n", "Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic<3,>=1.9.0->openai) (0.7.0)\n", "Requirement already satisfied: pydantic-core==2.33.2 in /usr/local/lib/python3.11/dist-packages (from pydantic<3,>=1.9.0->openai) (2.33.2)\n", "Requirement already satisfied: typing-inspection>=0.4.0 in /usr/local/lib/python3.11/dist-packages (from pydantic<3,>=1.9.0->openai) (0.4.1)\n", "Collecting dateparser\n", " Downloading dateparser-1.2.1-py3-none-any.whl.metadata (29 kB)\n", "Requirement already satisfied: python-dateutil>=2.7.0 in /usr/local/lib/python3.11/dist-packages (from dateparser) (2.9.0.post0)\n", "Requirement already satisfied: pytz>=2024.2 in /usr/local/lib/python3.11/dist-packages (from dateparser) (2025.2)\n", "Requirement already satisfied: regex!=2019.02.19,!=2021.8.27,>=2015.06.24 in /usr/local/lib/python3.11/dist-packages (from dateparser) (2024.11.6)\n", "Requirement already satisfied: tzlocal>=0.2 in /usr/local/lib/python3.11/dist-packages (from dateparser) (5.3.1)\n", "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil>=2.7.0->dateparser) (1.17.0)\n", "Downloading dateparser-1.2.1-py3-none-any.whl (295 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m295.7/295.7 kB\u001b[0m \u001b[31m9.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hInstalling collected packages: dateparser\n", "Successfully installed dateparser-1.2.1\n" ] } ] }, { "cell_type": "code", "source": [ "# Import libraries\n", "import openai\n", "import json\n", "import requests\n", "import numpy as np\n", "from scipy.optimize import linprog\n", "import os\n", "from google.colab import userdata\n", "from datetime import datetime, time\n", "import dateparser\n", "from datetime import datetime, timezone, timedelta" ], "metadata": { "id": "aczmToPHPMA0" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "2.3 Getting the API Key from *secrets*" ], "metadata": { "id": "XiSF46MtvOPv" } }, { "cell_type": "code", "source": [ "#Pleae Use Own API Keys as there may be low balance in the keys i provide\n", "from google.colab import userdata\n", "OPENAI_API_KEY = userdata.get('OPENAI_API_KEY')\n", "GOOGLE_API_KEY = userdata.get('GOOGLE_API_KEY')\n", "print(\"Google API key loaded:\", bool(GOOGLE_API_KEY))\n", "print(\"OPEN AI API key loaded:\", bool(OPENAI_API_KEY))" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "j-WGjcekPQJO", "outputId": "0589b96e-ae69-44c0-b9cf-ca7cf2527ebe" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Google API key loaded: True\n", "OPEN AI API key loaded: True\n" ] } ] }, { "cell_type": "markdown", "source": [ "2.4 Installing Agent Pro" ], "metadata": { "id": "dBsbZfv5vfy1" } }, { "cell_type": "code", "source": [ "%cd AgentPro\n", "!pip install -e .\n", "# Make the Meal Planner tool file in AgentPro tools and save it\n", "#Then make changes in __init__.py as shown in next cell" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "lUpaNqlSOb7g", "outputId": "6b4e7271-6347-44d0-c6e0-72adc255d0c0" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "/content/AgentPro\n", "Obtaining file:///content/AgentPro\n", " Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n", " Checking if build backend supports build_editable ... \u001b[?25l\u001b[?25hdone\n", " Getting requirements to build editable ... \u001b[?25l\u001b[?25hdone\n", " Preparing editable metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n", "Requirement already satisfied: openai in /usr/local/lib/python3.11/dist-packages (from agentpro==0.1.0) (1.82.1)\n", "Collecting youtube_transcript_api (from agentpro==0.1.0)\n", " Downloading youtube_transcript_api-1.0.3-py3-none-any.whl.metadata (23 kB)\n", "Collecting duckduckgo-search (from agentpro==0.1.0)\n", " Downloading duckduckgo_search-8.0.2-py3-none-any.whl.metadata (16 kB)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.11/dist-packages (from agentpro==0.1.0) (2.32.3)\n", "Collecting python-pptx (from agentpro==0.1.0)\n", " Downloading python_pptx-1.0.2-py3-none-any.whl.metadata (2.5 kB)\n", "Requirement already satisfied: pydantic in /usr/local/lib/python3.11/dist-packages (from agentpro==0.1.0) (2.11.5)\n", "Collecting python-dotenv (from agentpro==0.1.0)\n", " Downloading python_dotenv-1.1.0-py3-none-any.whl.metadata (24 kB)\n", "Requirement already satisfied: pandas in /usr/local/lib/python3.11/dist-packages (from agentpro==0.1.0) (2.2.2)\n", "Requirement already satisfied: numpy in /usr/local/lib/python3.11/dist-packages (from agentpro==0.1.0) (2.0.2)\n", "Requirement already satisfied: matplotlib in /usr/local/lib/python3.11/dist-packages (from agentpro==0.1.0) (3.10.0)\n", "Requirement already satisfied: seaborn in /usr/local/lib/python3.11/dist-packages (from agentpro==0.1.0) (0.13.2)\n", "Requirement already satisfied: openpyxl in /usr/local/lib/python3.11/dist-packages (from agentpro==0.1.0) (3.1.5)\n", "Requirement already satisfied: pyarrow in /usr/local/lib/python3.11/dist-packages (from agentpro==0.1.0) (18.1.0)\n", "Requirement already satisfied: scikit-learn in /usr/local/lib/python3.11/dist-packages (from agentpro==0.1.0) (1.6.1)\n", "Requirement already satisfied: yfinance in /usr/local/lib/python3.11/dist-packages (from agentpro==0.1.0) (0.2.61)\n", "Collecting litellm (from agentpro==0.1.0)\n", " Downloading litellm-1.72.1-py3-none-any.whl.metadata (39 kB)\n", "Requirement already satisfied: click>=8.1.8 in /usr/local/lib/python3.11/dist-packages (from duckduckgo-search->agentpro==0.1.0) (8.2.1)\n", "Collecting primp>=0.15.0 (from duckduckgo-search->agentpro==0.1.0)\n", " Downloading primp-0.15.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (13 kB)\n", "Requirement already satisfied: lxml>=5.3.0 in /usr/local/lib/python3.11/dist-packages (from duckduckgo-search->agentpro==0.1.0) (5.4.0)\n", "Requirement already satisfied: aiohttp in /usr/local/lib/python3.11/dist-packages (from litellm->agentpro==0.1.0) (3.11.15)\n", "Requirement already satisfied: httpx>=0.23.0 in /usr/local/lib/python3.11/dist-packages (from litellm->agentpro==0.1.0) (0.28.1)\n", "Requirement already satisfied: importlib-metadata>=6.8.0 in /usr/local/lib/python3.11/dist-packages (from litellm->agentpro==0.1.0) (8.7.0)\n", "Requirement already satisfied: jinja2<4.0.0,>=3.1.2 in /usr/local/lib/python3.11/dist-packages (from litellm->agentpro==0.1.0) (3.1.6)\n", "Requirement already satisfied: jsonschema<5.0.0,>=4.22.0 in /usr/local/lib/python3.11/dist-packages (from litellm->agentpro==0.1.0) (4.24.0)\n", "Requirement already satisfied: tiktoken>=0.7.0 in /usr/local/lib/python3.11/dist-packages (from litellm->agentpro==0.1.0) (0.9.0)\n", "Requirement already satisfied: tokenizers in /usr/local/lib/python3.11/dist-packages (from litellm->agentpro==0.1.0) (0.21.1)\n", "Requirement already satisfied: anyio<5,>=3.5.0 in /usr/local/lib/python3.11/dist-packages (from openai->agentpro==0.1.0) (4.9.0)\n", "Requirement already satisfied: distro<2,>=1.7.0 in /usr/local/lib/python3.11/dist-packages (from openai->agentpro==0.1.0) (1.9.0)\n", "Requirement already satisfied: jiter<1,>=0.4.0 in /usr/local/lib/python3.11/dist-packages (from openai->agentpro==0.1.0) (0.10.0)\n", "Requirement already satisfied: sniffio in /usr/local/lib/python3.11/dist-packages (from openai->agentpro==0.1.0) (1.3.1)\n", "Requirement already satisfied: tqdm>4 in /usr/local/lib/python3.11/dist-packages (from openai->agentpro==0.1.0) (4.67.1)\n", "Requirement already satisfied: typing-extensions<5,>=4.11 in /usr/local/lib/python3.11/dist-packages (from openai->agentpro==0.1.0) (4.13.2)\n", "Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic->agentpro==0.1.0) (0.7.0)\n", "Requirement already satisfied: pydantic-core==2.33.2 in /usr/local/lib/python3.11/dist-packages (from pydantic->agentpro==0.1.0) (2.33.2)\n", "Requirement already satisfied: typing-inspection>=0.4.0 in /usr/local/lib/python3.11/dist-packages (from pydantic->agentpro==0.1.0) (0.4.1)\n", "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib->agentpro==0.1.0) (1.3.2)\n", "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.11/dist-packages (from matplotlib->agentpro==0.1.0) (0.12.1)\n", "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.11/dist-packages (from matplotlib->agentpro==0.1.0) (4.58.1)\n", "Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib->agentpro==0.1.0) (1.4.8)\n", "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.11/dist-packages (from matplotlib->agentpro==0.1.0) (24.2)\n", "Requirement already satisfied: pillow>=8 in /usr/local/lib/python3.11/dist-packages (from matplotlib->agentpro==0.1.0) (11.2.1)\n", "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib->agentpro==0.1.0) (3.2.3)\n", "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.11/dist-packages (from matplotlib->agentpro==0.1.0) (2.9.0.post0)\n", "Requirement already satisfied: et-xmlfile in /usr/local/lib/python3.11/dist-packages (from openpyxl->agentpro==0.1.0) (2.0.0)\n", "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.11/dist-packages (from pandas->agentpro==0.1.0) (2025.2)\n", "Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.11/dist-packages (from pandas->agentpro==0.1.0) (2025.2)\n", "Collecting XlsxWriter>=0.5.7 (from python-pptx->agentpro==0.1.0)\n", " Downloading XlsxWriter-3.2.3-py3-none-any.whl.metadata (2.7 kB)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests->agentpro==0.1.0) (3.4.2)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.11/dist-packages (from requests->agentpro==0.1.0) (3.10)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests->agentpro==0.1.0) (2.4.0)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.11/dist-packages (from requests->agentpro==0.1.0) (2025.4.26)\n", "Requirement already satisfied: scipy>=1.6.0 in /usr/local/lib/python3.11/dist-packages (from scikit-learn->agentpro==0.1.0) (1.15.3)\n", "Requirement already satisfied: joblib>=1.2.0 in /usr/local/lib/python3.11/dist-packages (from scikit-learn->agentpro==0.1.0) (1.5.1)\n", "Requirement already satisfied: threadpoolctl>=3.1.0 in /usr/local/lib/python3.11/dist-packages (from scikit-learn->agentpro==0.1.0) (3.6.0)\n", "Requirement already satisfied: multitasking>=0.0.7 in /usr/local/lib/python3.11/dist-packages (from yfinance->agentpro==0.1.0) (0.0.11)\n", "Requirement already satisfied: platformdirs>=2.0.0 in /usr/local/lib/python3.11/dist-packages (from yfinance->agentpro==0.1.0) (4.3.8)\n", "Requirement already satisfied: frozendict>=2.3.4 in /usr/local/lib/python3.11/dist-packages (from yfinance->agentpro==0.1.0) (2.4.6)\n", "Requirement already satisfied: peewee>=3.16.2 in /usr/local/lib/python3.11/dist-packages (from yfinance->agentpro==0.1.0) (3.18.1)\n", "Requirement already satisfied: beautifulsoup4>=4.11.1 in /usr/local/lib/python3.11/dist-packages (from yfinance->agentpro==0.1.0) (4.13.4)\n", "Requirement already satisfied: curl_cffi>=0.7 in /usr/local/lib/python3.11/dist-packages (from yfinance->agentpro==0.1.0) (0.11.1)\n", "Requirement already satisfied: protobuf>=3.19.0 in /usr/local/lib/python3.11/dist-packages (from yfinance->agentpro==0.1.0) (5.29.5)\n", "Requirement already satisfied: websockets>=13.0 in /usr/local/lib/python3.11/dist-packages (from yfinance->agentpro==0.1.0) (15.0.1)\n", "Requirement already satisfied: defusedxml<0.8.0,>=0.7.1 in /usr/local/lib/python3.11/dist-packages (from youtube_transcript_api->agentpro==0.1.0) (0.7.1)\n", "Requirement already satisfied: soupsieve>1.2 in /usr/local/lib/python3.11/dist-packages (from beautifulsoup4>=4.11.1->yfinance->agentpro==0.1.0) (2.7)\n", "Requirement already satisfied: cffi>=1.12.0 in /usr/local/lib/python3.11/dist-packages (from curl_cffi>=0.7->yfinance->agentpro==0.1.0) (1.17.1)\n", "Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.11/dist-packages (from httpx>=0.23.0->litellm->agentpro==0.1.0) (1.0.9)\n", "Requirement already satisfied: h11>=0.16 in /usr/local/lib/python3.11/dist-packages (from httpcore==1.*->httpx>=0.23.0->litellm->agentpro==0.1.0) (0.16.0)\n", "Requirement already satisfied: zipp>=3.20 in /usr/local/lib/python3.11/dist-packages (from importlib-metadata>=6.8.0->litellm->agentpro==0.1.0) (3.22.0)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.11/dist-packages (from jinja2<4.0.0,>=3.1.2->litellm->agentpro==0.1.0) (3.0.2)\n", "Requirement already satisfied: attrs>=22.2.0 in /usr/local/lib/python3.11/dist-packages (from jsonschema<5.0.0,>=4.22.0->litellm->agentpro==0.1.0) (25.3.0)\n", "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.11/dist-packages (from jsonschema<5.0.0,>=4.22.0->litellm->agentpro==0.1.0) (2025.4.1)\n", "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.11/dist-packages (from jsonschema<5.0.0,>=4.22.0->litellm->agentpro==0.1.0) (0.36.2)\n", "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.11/dist-packages (from jsonschema<5.0.0,>=4.22.0->litellm->agentpro==0.1.0) (0.25.1)\n", "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil>=2.7->matplotlib->agentpro==0.1.0) (1.17.0)\n", "Requirement already satisfied: regex>=2022.1.18 in /usr/local/lib/python3.11/dist-packages (from tiktoken>=0.7.0->litellm->agentpro==0.1.0) (2024.11.6)\n", "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp->litellm->agentpro==0.1.0) (2.6.1)\n", "Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.11/dist-packages (from aiohttp->litellm->agentpro==0.1.0) (1.3.2)\n", "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.11/dist-packages (from aiohttp->litellm->agentpro==0.1.0) (1.6.0)\n", "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.11/dist-packages (from aiohttp->litellm->agentpro==0.1.0) (6.4.4)\n", "Requirement already satisfied: propcache>=0.2.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp->litellm->agentpro==0.1.0) (0.3.1)\n", "Requirement already satisfied: yarl<2.0,>=1.17.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp->litellm->agentpro==0.1.0) (1.20.0)\n", "Requirement already satisfied: huggingface-hub<1.0,>=0.16.4 in /usr/local/lib/python3.11/dist-packages (from tokenizers->litellm->agentpro==0.1.0) (0.32.2)\n", "Requirement already satisfied: pycparser in /usr/local/lib/python3.11/dist-packages (from cffi>=1.12.0->curl_cffi>=0.7->yfinance->agentpro==0.1.0) (2.22)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.11/dist-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers->litellm->agentpro==0.1.0) (3.18.0)\n", "Requirement already satisfied: fsspec>=2023.5.0 in /usr/local/lib/python3.11/dist-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers->litellm->agentpro==0.1.0) (2025.3.2)\n", "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.11/dist-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers->litellm->agentpro==0.1.0) (6.0.2)\n", "Requirement already satisfied: hf-xet<2.0.0,>=1.1.2 in /usr/local/lib/python3.11/dist-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers->litellm->agentpro==0.1.0) (1.1.2)\n", "Downloading duckduckgo_search-8.0.2-py3-none-any.whl (18 kB)\n", "Downloading litellm-1.72.1-py3-none-any.whl (8.0 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m8.0/8.0 MB\u001b[0m \u001b[31m77.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading python_dotenv-1.1.0-py3-none-any.whl (20 kB)\n", "Downloading python_pptx-1.0.2-py3-none-any.whl (472 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m472.8/472.8 kB\u001b[0m \u001b[31m28.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading youtube_transcript_api-1.0.3-py3-none-any.whl (2.2 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.2/2.2 MB\u001b[0m \u001b[31m61.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading primp-0.15.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.3/3.3 MB\u001b[0m \u001b[31m75.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading XlsxWriter-3.2.3-py3-none-any.whl (169 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m169.4/169.4 kB\u001b[0m \u001b[31m11.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hBuilding wheels for collected packages: agentpro\n", " Building editable for agentpro (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n", " Created wheel for agentpro: filename=agentpro-0.1.0-0.editable-py3-none-any.whl size=7155 sha256=9b8f88fca5db42804214ad265de0370154a57ef130cd4dffda332527e8b31493\n", " Stored in directory: /tmp/pip-ephem-wheel-cache-1gs8rl3_/wheels/9c/c4/78/3256381eeab54c5a623877649478a807224b8b9955de374b97\n", "Successfully built agentpro\n", "Installing collected packages: XlsxWriter, python-dotenv, primp, youtube_transcript_api, python-pptx, duckduckgo-search, litellm, agentpro\n", "Successfully installed XlsxWriter-3.2.3 agentpro-0.1.0 duckduckgo-search-8.0.2 litellm-1.72.1 primp-0.15.0 python-dotenv-1.1.0 python-pptx-1.0.2 youtube_transcript_api-1.0.3\n" ] } ] }, { "cell_type": "markdown", "source": [ "**Meal Planner Tool Code**\n", "You need to copy this code in the meal planner tool file that you create in the agentpro tools (name it as **meal_planner_tool.py**)" ], "metadata": { "id": "32nkHEs-deMA" } }, { "cell_type": "code", "source": [ "from openai import OpenAI\n", "import os\n", "import ast\n", "from agentpro.tools import Tool\n", "from typing import Any, Dict\n", "\n", "class MealPlannerTool(Tool):\n", " name: str = \"Meal Planner Tool\"\n", " description: str = (\n", " \"Generates a detailed meal plan for any event based on event type, location, and schedule.\"\n", " )\n", " action_type: str = \"generate_meal_plan\"\n", " input_format: str = (\n", " \"Dict with keys: 'event_type', 'location', and 'schedule'.\"\n", " )\n", "\n", " def run(self, input_data: Dict[str, Any]) -> Dict[str, Any]:\n", " client = OpenAI(api_key=os.environ[\"OPENAI_API_KEY\"])\n", "\n", " event_type = input_data.get(\"event_type\", \"general event\")\n", " location = input_data.get(\"location\", \"unknown location\")\n", " schedule = input_data.get(\"schedule\", [])\n", "\n", " prompt = f\"\"\"\n", "You are an expert catering planner.\n", "\n", "Create a culturally appropriate, structured meal plan for:\n", "\n", "- Event Type: {event_type}\n", "- Location: {location}\n", "- Schedule: {schedule}\n", "\n", "Return a Python dictionary with keys:\n", "- 'breakfast': [...]\n", "- 'lunch': [...]\n", "- 'snacks': [...]\n", "- 'dinner': [...]\n", "- 'special_requests': \"...\"\n", "\n", "Ensure output is valid Python.\n", "IMPORTANT: Respond immediately with the final JSON object using only Final Answer: followed by the valid JSON.\\n\"\n", "\"\"\"\n", "\n", " response = client.chat.completions.create(\n", " model=\"gpt-4o\",\n", " messages=[\n", " {\"role\": \"system\", \"content\": \"You plan meals for global events.\"},\n", " {\"role\": \"user\", \"content\": prompt}\n", " ]\n", " )\n", "\n", " content = response.choices[0].message.content\n", "\n", " try:\n", " meal_plan = ast.literal_eval(content.strip())\n", " return {\"meal_plan\": meal_plan}\n", " except Exception as e:\n", " return {\n", " \"error\": \"Parsing failed\",\n", " \"raw_output\": content,\n", " \"exception\": str(e)\n", " }" ], "metadata": { "id": "HV844KUadh_I" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "__init__.py code to use meal planner tool" ], "metadata": { "id": "09K4yFdYdiMg" } }, { "cell_type": "code", "source": [ "# Add this code in __init__.py in agent pro tools\n", "from .base_tool import Tool\n", "from .duckduckgo_tool import QuickInternetTool\n", "from .calculator_tool import CalculateTool\n", "from .userinput_tool import UserInputTool\n", "from .ares_tool import AresInternetTool\n", "from .yfinance_tool import YFinanceTool\n", "from .traversaalpro_rag_tool import TraversaalProRAGTool\n", "from .slide_generation_tool import SlideGenerationTool\n", "from .meal_planner_tool import MealPlannerTool #add this line in already existing code\n", "__all__ = [\n", " \"Tool\",\n", " \"QuickInternetTool\",\n", " \"CalculateTool\",\n", " \"UserInputTool\",\n", " \"AresInternetTool\",\n", " \"YFinanceTool\",\n", " \"TraversaalProRAGTool\",\n", " \"SlideGenerationTool\",\n", " \"MealPlannerTool\" # add this line in already existing code\n", "]" ], "metadata": { "id": "P5foL-Hjde7Y" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "2.5 Getting the API Keys in our environment" ], "metadata": { "id": "NAAYF015vjfU" } }, { "cell_type": "code", "source": [ "from google.colab import userdata\n", "import os\n", "\n", "# Set keys from secrets\n", "os.environ[\"OPENAI_API_KEY\"] = userdata.get(\"OPENAI_API_KEY\")\n", "os.environ[\"GOOGLE_API_KEY\"] = userdata.get(\"GOOGLE_API_KEY\")\n", "\n", "print(\"✅ API keys successfully loaded into environment.\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "8TJh3BWBOiNa", "outputId": "cb16fa84-3af2-4242-9bc6-a8dab2fa8ad5" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "✅ API keys successfully loaded into environment.\n" ] } ] }, { "cell_type": "markdown", "source": [ "**3. Making Own Tool**" ], "metadata": { "id": "pZsst_EFvn9b" } }, { "cell_type": "markdown", "source": [ "3.1 So in our task, we had to generate our own tool as well as use the tools available with the agent pro.. So i decided to make one tool that is meal planner tool, i have it saved in the tools folder and it is working fine, so now check the tool if it works," ], "metadata": { "id": "xNmx_WtQvrA_" } }, { "cell_type": "markdown", "source": [ "3.2 Code for testing the API" ], "metadata": { "id": "YUAgOgtov65B" } }, { "cell_type": "code", "source": [ "# It is not required to be executed if you know that the API Key is functioning and is available in the environment here\n", "from openai import OpenAI\n", "import os\n", "\n", "client = OpenAI(api_key=os.environ[\"OPENAI_API_KEY\"])\n", "\n", "response = client.chat.completions.create(\n", " model=\"gpt-4o\",\n", " messages=[\n", " {\"role\": \"system\", \"content\": \"You are a catering expert.\"},\n", " {\"role\": \"user\", \"content\": \"Create a meal plan for a tech conference in Dubai.\"}\n", " ]\n", ")\n", "\n", "print(response.choices[0].message.content)\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "bTURZlh7Rc7q", "outputId": "944ef004-b559-458a-9229-ef4a83fe3b5d" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "When planning a meal plan for a tech conference in Dubai, it's important to consider the diversity of the audience and the local cuisine. Additionally, accommodating dietary restrictions and ensuring a variety of options is key to a successful event. Here's a sample meal plan for a three-day conference:\n", "\n", "### Day 1: Welcome Day\n", "\n", "**Breakfast:**\n", "- Assorted pastries and croissants\n", "- Fresh fruit platter\n", "- Greek yogurt with granola and honey\n", "- Variety of cold-pressed juices\n", "- Coffee and tea station\n", "\n", "**Mid-Morning Snack:**\n", "- Mixed nuts and dried fruits\n", "- Mini muffins\n", "- Herbal teas and coffee\n", "\n", "**Lunch:**\n", "- Mezze platter (hummus, baba ghanoush, tabbouleh, olives)\n", "- Grilled chicken skewers\n", "- Herb-crusted lamb chops\n", "- Quinoa salad with pomegranate\n", "- Grilled vegetable medley\n", "- Assorted bread rolls\n", "- Assortment of Arabic sweets\n", "- Lemon-mint cooler\n", "\n", "**Afternoon Snack:**\n", "- Date bars\n", "- Dark chocolate bites\n", "- Selection of seasonal fruit juices\n", "\n", "**Dinner:**\n", "- Reception with food stations:\n", " - Sushi and sashimi bar\n", " - Live pasta station with various sauces and toppings\n", " - Middle Eastern grill station with shawarma and kebabs\n", " - Vegan station featuring stuffed bell peppers and roasted cauliflower\n", "- Dessert:\n", " - Baklava and mini cheesecakes\n", " - Modeled chocolate fondue fountain with fruit and marshmallows\n", "\n", "### Day 2: Conference Day\n", "\n", "**Breakfast:**\n", "- Continental breakfast with assorted breads\n", "- Cheese and cold cuts selection\n", "- Smoked salmon platter\n", "- Spinach and feta frittata\n", "- Selection of juices and smoothies\n", "\n", "**Mid-Morning Snack:**\n", "- Energy-protein bars\n", "- Fruit skewers\n", "- Variety of herbal teas\n", "\n", "**Lunch:**\n", "- Build-your-own salad bar\n", "- Moroccan-style beef tagine\n", "- Biryani with paneer (vegetarian option)\n", "- Roasted carrot and pumpkin soup\n", "- Selection of flatbreads\n", "- Assortment of pastries\n", "- Infused waters (cucumber-lime, berry)\n", "\n", "**Afternoon Snack:**\n", "- Mini samosas\n", "- Almond and apricot bites\n", "- Lemon-ginger tea\n", "\n", "**Dinner:**\n", "- Sit-down dinner:\n", " - Starter: Caprese salad with balsamic glaze\n", " - Main: Grilled sea bass with lemon-herb sauce or roasted beetroot and goat cheese risotto (vegetarian)\n", " - Dessert: Mango panna cotta with coconut meringue\n", "\n", "### Day 3: Closing Day\n", "\n", "**Breakfast:**\n", "- Middle Eastern breakfast spread (labneh, zatar, olives, pita)\n", "- Omelette station\n", "- Fresh fruit and nut granola\n", "- Assorted lassi (mango, rose)\n", "\n", "**Mid-Morning Snack:**\n", "- Mini quiches\n", "- Dates stuffed with almonds\n", "- Chai tea and coffee\n", "\n", "**Lunch:**\n", "- International cuisine buffet:\n", " - Thai green curry with chicken\n", " - Falafel wraps with tahini sauce\n", " - Spanish tortilla\n", " - Beetroot and feta salad\n", " - Basil couscous\n", " - Selection of naan bread\n", " - Mini tiramisu cups\n", "- Fresh fruit juices\n", "\n", "**Afternoon Snack:**\n", "- Cheese platter with assorted crackers\n", "- Pistachio shortbread cookies\n", "- Matcha green tea\n", "\n", "**Farewell Dinner:**\n", "- Outdoor BBQ party:\n", " - Grilled steak and prawns\n", " - Veggie burgers and corn on the cob\n", " - Caesar salad station\n", " - Sweet potato wedges\n", "- Dessert:\n", " - Ice cream cart with various toppings\n", " - Arabian pastries and coffee\n", "\n", "When planning this meal plan, ensure you have options for dietary restrictions such as gluten-free, vegan, or allergies. Confirm ingredient origins for authenticity and cultural sensitivity, particularly in a diverse location like Dubai.\n" ] } ] }, { "cell_type": "markdown", "source": [ "# **4. Building Agents**" ], "metadata": { "id": "OGLkvtdcULIE" } }, { "cell_type": "markdown", "source": [ "So now i am going to build the various agents which will be required to perform various tasks for us in the Event Planning.. Let's see what all we have here" ], "metadata": { "id": "icV2A8YOwAnU" } }, { "cell_type": "markdown", "source": [ "**4.1 User Intent Agent**" ], "metadata": { "id": "WyQ3Vw3oQsIC" } }, { "cell_type": "markdown", "source": [ "This agent is the second most important agent. it gets the input from the user and then takes out the necessary information from it. This information will be used later on in the other agents to perform their task.. So the user only interacts with this agent and then he gets the output plan.." ], "metadata": { "id": "VSnDt7XSwLls" } }, { "cell_type": "code", "source": [ "import sys\n", "import os\n", "import re\n", "import json\n", "import ast\n", "import dateparser\n", "\n", "# Add AgentPro to system path\n", "sys.path.insert(0, \"/content/AgentPro\")\n", "\n", "# ✅ AgentPro imports\n", "from agentpro import ReactAgent, create_model\n", "from agentpro.tools import UserInputTool # AgentPro tool used\n", "\n", "# ✅ Create model wrapper (this solves the .chat_completion error)\n", "model = create_model(\n", " provider=\"openai\",\n", " model_name=\"gpt-4o\",\n", " api_key=os.environ[\"OPENAI_API_KEY\"]\n", ")\n", "\n", "agent = ReactAgent(model=model, tools=[])\n", "\n", "# 🧼 LLM response parser\n", "def extract_json_from_response(response):\n", " cleaned = response.strip()\n", " cleaned = re.sub(r\"```(?:json|python)?\", \"\", cleaned)\n", " cleaned = re.sub(r\"[^\\x00-\\x7F]+\", \"\", cleaned).strip()\n", " cleaned = cleaned.replace(\"“\", '\"').replace(\"”\", '\"').replace(\"‘\", \"'\").replace(\"’\", \"'\")\n", "\n", " try:\n", " return json.loads(cleaned)\n", " except json.JSONDecodeError:\n", " match = re.search(r\"(\\{.*\\}|\\[.*\\])\", cleaned, re.DOTALL)\n", " if match:\n", " try:\n", " return json.loads(match.group(0))\n", " except json.JSONDecodeError:\n", " pass\n", " raise ValueError(f\"❌ Could not extract valid JSON from LLM response:\\n{cleaned}\")\n", "\n", "# 🚀 Main user intent extraction\n", "def extract_user_intent():\n", " user_query = input(\"👤 Please describe the event you want to plan (type, location, guests, etc.):\\n> \")\n", "\n", " prompt = (\n", " \"You are an event planning assistant.\\n\"\n", " \"Extract structured event info from the user query below.\\n\"\n", " \"Return a **Python dictionary only**, no explanations or formatting.\\n\\n\"\n", " \"Required dictionary keys:\\n\"\n", " \"- 'event_type': string\\n\"\n", " \"- 'location': string\\n\"\n", " \"- 'event_date': string (YYYY-MM-DD)\\n\"\n", " \"- 'guest_count': integer\\n\"\n", " \"- 'preferences': dictionary (include keys like 'stay_dates', 'guest_origins', etc.)\\n\"\n", " \"- 'event_theme': string (optional)\\n\"\n", " \"- 'meal_count': integer (optional)\\n\"\n", " \"- 'transport_needs': string (optional)\\n\"\n", " \"- 'sightseeing': boolean (optional)\\n\\n\"\n", " \"Missing values must be set to null.\\n\\n\"\n", " \"Output should be in pure JSON form and nothing else should be included which is not in JSON format\"\n", " f\"User input: {user_query}\"\n", " \"IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\"\n", ")\n", "\n", "\n", " print(\"🔁 Querying GPT-4o via ReAct agent...\")\n", " response = agent.run(prompt)\n", " raw_output = response.final_answer\n", " print(\"🧠 LLM RAW OUTPUT:\\n\", raw_output)\n", "\n", " intent_data = extract_json_from_response(raw_output)\n", "\n", " if intent_data.get(\"event_date\"):\n", " parsed_date = dateparser.parse(intent_data[\"event_date\"])\n", " intent_data[\"event_date\"] = parsed_date.strftime(\"%Y-%m-%d\") if parsed_date else None\n", "\n", " print(\"\\n✅ Extracted User Intent:\")\n", " print(json.dumps(intent_data, indent=2))\n", " return intent_data\n", "\n", "# Run the extraction\n", "extracted_intent = extract_user_intent()\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "dN65U1D9UNYO", "outputId": "47954a63-aa97-4a29-c0d7-fcda15d37635" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "👤 Please describe the event you want to plan (type, location, guests, etc.):\n", "> Plan a conference in Islamabad on 13 June 2025 with Turkish Delegation of 100 individuals. 20 Pakistani guests will also arrive from Lahore. All guests will stay from 12 till 15 june 2025.\n", "🔁 Querying GPT-4o via ReAct agent...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an event planning assistant.\n", "Extract structured event info from the user query below.\n", "Return a **Python dictionary only**, no explanations or formatting.\n", "\n", "Required dictionary keys:\n", "- 'event_type': string\n", "- 'location': string\n", "- 'event_date': string (YYYY-MM-DD)\n", "- 'guest_count': integer\n", "- 'preferences': dictionary (include keys like 'stay_dates', 'guest_origins', etc.)\n", "- 'event_theme': string (optional)\n", "- 'meal_count': integer (optional)\n", "- 'transport_needs': string (optional)\n", "- 'sightseeing': boolean (optional)\n", "\n", "Missing values must be set to null.\n", "\n", "Output should be in pure JSON form and nothing else should be included which is not in JSON formatUser input: Plan a conference in Islamabad on 13 June 2025 with Turkish Delegation of 100 individuals. 20 Pakistani guests will also arrive from Lahore. All guests will stay from 12 till 15 june 2025.IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"event_type\": \"conference\", \"location\": \"Islamabad\", \"event_date\": \"2025-06-13\", \"guest_count\": 120, \"preferences\": {\"stay_dates\": [\"2025-06-12\", \"2025-06-15\"], \"guest_origins\": [\"Turkey\", \"Lahore\"]}, \"event_theme\": null, \"meal_count\": null, \"transport_needs\": null, \"sightseeing\": null}\n", "✅ Parsed Final Answer: {\"event_type\": \"conference\", \"location\": \"Islamabad\", \"event_date\": \"2025-06-13\", \"guest_count\": 120, \"preferences\": {\"stay_dates\": [\"2025-06-12\", \"2025-06-15\"], \"guest_origins\": [\"Turkey\", \"Lahore\"]}, \"event_theme\": null, \"meal_count\": null, \"transport_needs\": null, \"sightseeing\": null}\n", "🧠 LLM RAW OUTPUT:\n", " {\"event_type\": \"conference\", \"location\": \"Islamabad\", \"event_date\": \"2025-06-13\", \"guest_count\": 120, \"preferences\": {\"stay_dates\": [\"2025-06-12\", \"2025-06-15\"], \"guest_origins\": [\"Turkey\", \"Lahore\"]}, \"event_theme\": null, \"meal_count\": null, \"transport_needs\": null, \"sightseeing\": null}\n", "\n", "✅ Extracted User Intent:\n", "{\n", " \"event_type\": \"conference\",\n", " \"location\": \"Islamabad\",\n", " \"event_date\": \"2025-06-13\",\n", " \"guest_count\": 120,\n", " \"preferences\": {\n", " \"stay_dates\": [\n", " \"2025-06-12\",\n", " \"2025-06-15\"\n", " ],\n", " \"guest_origins\": [\n", " \"Turkey\",\n", " \"Lahore\"\n", " ]\n", " },\n", " \"event_theme\": null,\n", " \"meal_count\": null,\n", " \"transport_needs\": null,\n", " \"sightseeing\": null\n", "}\n" ] } ] }, { "cell_type": "markdown", "source": [ "**4.2 Schedular Agent**" ], "metadata": { "id": "QzUvHXuuWuUQ" } }, { "cell_type": "markdown", "source": [ "The next important task is to make the schedule and this agent is exactly doing that... By using create model and ReactAgent, it will get the details of the event and give us a comprehensive output schedule." ], "metadata": { "id": "qRagEuFKwnZ7" } }, { "cell_type": "code", "source": [ "import sys\n", "import os\n", "import json\n", "import re\n", "\n", "# Add AgentPro to path\n", "sys.path.insert(0, \"/content/AgentPro\")\n", "\n", "from agentpro import create_model, ReactAgent\n", "\n", "# ✅ Create GPT-4o model client\n", "model = create_model(\n", " provider=\"openai\",\n", " model_name=\"gpt-4o\",\n", " api_key=os.environ[\"OPENAI_API_KEY\"]\n", ")\n", "\n", "agent = ReactAgent(model=model, tools=[])\n", "\n", "# 📦 Extract structured list from LLM output\n", "def extract_json_from_response(response):\n", " cleaned = response.strip()\n", " cleaned = re.sub(r\"```(?:json|python)?\", \"\", cleaned)\n", " cleaned = re.sub(r\"[^\\x00-\\x7F]+\", \"\", cleaned).strip()\n", " cleaned = cleaned.replace(\"“\", '\"').replace(\"”\", '\"').replace(\"‘\", \"'\").replace(\"’\", \"'\")\n", "\n", " try:\n", " return json.loads(cleaned)\n", " except json.JSONDecodeError:\n", " match = re.search(r\"(\\{.*\\}|\\[.*\\])\", cleaned, re.DOTALL)\n", " if match:\n", " try:\n", " return json.loads(match.group(0))\n", " except json.JSONDecodeError:\n", " pass\n", " raise ValueError(f\"❌ Could not extract valid JSON from LLM response:\\n{cleaned}\")\n", "\n", "# 📅 Scheduler Agent logic\n", "def scheduler_agent(user_intent):\n", " \"\"\"\n", " Uses GPT-4o to generate a high-level multi-day schedule based on intent.\n", " \"\"\"\n", " event_type = user_intent.get(\"event_type\")\n", " event_date = user_intent.get(\"event_date\") or \"a typical day\"\n", " guest_count = user_intent.get(\"guest_count\", \"unknown\")\n", "\n", " if not event_type:\n", " raise ValueError(\"User intent must include an event_type.\")\n", "\n", " prompt = (\n", " f\"You are an expert event planner. Create a high-level multi-day schedule for a {event_type} \"\n", " f\"beginning on {event_date} with around {guest_count} guests. Include major activities from arrival to departure:\\n\"\n", " f\"airport pickups, hotel check-in, meals, sessions, sightseeing in free slots, and checkout.\\n\"\n", " f\"Return the result as a Python list of dictionaries in this format:\\n\\n\"\n", " f\"Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.\"\n", " f\"[{{\\\"day\\\": \\\"Day 1 - Arrival\\\", \\\"activities\\\": [\\\"Hotel check-in\\\", \\\"Welcome dinner\\\"]}}, ...]\"\n", " f\"IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\"\n", " )\n", "\n", " print(\"🧠 Prompting GPT-4o for schedule...\")\n", " response = agent.run(prompt).final_answer\n", " schedule = extract_json_from_response(response)\n", " return schedule\n", "\n", "# 🔁 Run in standalone mode\n", "if __name__ == \"__main__\":\n", " try:\n", " user_intent = extracted_intent # Make sure this is defined globally\n", " except NameError:\n", " raise Exception(\"❌ 'extracted_intent' not defined. Run User Intent Agent first.\")\n", "\n", " print(\"\\n🎯 Extracted User Intent:\")\n", " print(json.dumps(user_intent, indent=2))\n", "\n", " print(\"\\n📅 Generating high-level schedule...\")\n", " schedule = scheduler_agent(user_intent)\n", "\n", " print(\"\\n🗓️ Multi-day Itinerary:\")\n", " for day in schedule:\n", " print(f\"\\n📌 {day['day']}\")\n", " for act in day[\"activities\"]:\n", " print(f\" - {act}\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Cl-gk393Wvl7", "outputId": "7cf17487-469a-4f34-d25e-5d9d9f7a3941" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", "🎯 Extracted User Intent:\n", "{\n", " \"event_type\": \"conference\",\n", " \"location\": \"Islamabad\",\n", " \"event_date\": \"2025-06-13\",\n", " \"guest_count\": 120,\n", " \"preferences\": {\n", " \"stay_dates\": [\n", " \"2025-06-12\",\n", " \"2025-06-15\"\n", " ],\n", " \"guest_origins\": [\n", " \"Turkey\",\n", " \"Lahore\"\n", " ]\n", " },\n", " \"event_theme\": null,\n", " \"meal_count\": null,\n", " \"transport_needs\": null,\n", " \"sightseeing\": null\n", "}\n", "\n", "📅 Generating high-level schedule...\n", "🧠 Prompting GPT-4o for schedule...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner. Create a high-level multi-day schedule for a conference beginning on 2025-06-13 with around 120 guests. Include major activities from arrival to departure:\n", "airport pickups, hotel check-in, meals, sessions, sightseeing in free slots, and checkout.\n", "Return the result as a Python list of dictionaries in this format:\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.[{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Hotel check-in\", \"Welcome dinner\"]}, ...]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Airport pickups\", \"Hotel check-in\", \"Welcome dinner\"]}, {\"day\": \"Day 2 - Conference Day 1\", \"activities\": [\"Breakfast\", \"Opening keynote session\", \"Morning breakout sessions\", \"Lunch\", \"Afternoon breakout sessions\", \"Networking event\", \"Dinner\"]}, {\"day\": \"Day 3 - Conference Day 2\", \"activities\": [\"Breakfast\", \"Panel discussion\", \"Morning breakout sessions\", \"Lunch\", \"Afternoon breakout sessions\", \"Sightseeing tour\", \"Dinner\"]}, {\"day\": \"Day 4 - Departure\", \"activities\": [\"Breakfast\", \"Checkout\", \"Airport drop-offs\"]}]\n", "✅ Parsed Final Answer: [{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Airport pickups\", \"Hotel check-in\", \"Welcome dinner\"]}, {\"day\": \"Day 2 - Conference Day 1\", \"activities\": [\"Breakfast\", \"Opening keynote session\", \"Morning breakout sessions\", \"Lunch\", \"Afternoon breakout sessions\", \"Networking event\", \"Dinner\"]}, {\"day\": \"Day 3 - Conference Day 2\", \"activities\": [\"Breakfast\", \"Panel discussion\", \"Morning breakout sessions\", \"Lunch\", \"Afternoon breakout sessions\", \"Sightseeing tour\", \"Dinner\"]}, {\"day\": \"Day 4 - Departure\", \"activities\": [\"Breakfast\", \"Checkout\", \"Airport drop-offs\"]}]\n", "\n", "🗓️ Multi-day Itinerary:\n", "\n", "📌 Day 1 - Arrival\n", " - Airport pickups\n", " - Hotel check-in\n", " - Welcome dinner\n", "\n", "📌 Day 2 - Conference Day 1\n", " - Breakfast\n", " - Opening keynote session\n", " - Morning breakout sessions\n", " - Lunch\n", " - Afternoon breakout sessions\n", " - Networking event\n", " - Dinner\n", "\n", "📌 Day 3 - Conference Day 2\n", " - Breakfast\n", " - Panel discussion\n", " - Morning breakout sessions\n", " - Lunch\n", " - Afternoon breakout sessions\n", " - Sightseeing tour\n", " - Dinner\n", "\n", "📌 Day 4 - Departure\n", " - Breakfast\n", " - Checkout\n", " - Airport drop-offs\n" ] } ] }, { "cell_type": "markdown", "source": [ "**4.3 Venue Agent**" ], "metadata": { "id": "Y5_rbJKlbfI4" } }, { "cell_type": "markdown", "source": [ "When we are told to arrange the event, the first question is where to arrange this event.. so there is this agent coming to help with selecting the appropriate locations as per our event requirement." ], "metadata": { "id": "t70z43qsw_V1" } }, { "cell_type": "code", "source": [ "import os\n", "import json\n", "import requests\n", "from agentpro import create_model, ReactAgent\n", "from agentpro.tools import QuickInternetTool\n", "\n", "# ✅ Load API keys from environment\n", "GOOGLE_API_KEY = os.environ[\"GOOGLE_API_KEY\"]\n", "OPENAI_API_KEY = os.environ[\"OPENAI_API_KEY\"]\n", "\n", "# ✅ Setup model + agent\n", "model = create_model(provider=\"openai\", model_name=\"gpt-4o\", api_key=OPENAI_API_KEY)\n", "agent = ReactAgent(model=model, tools=[QuickInternetTool()]) # tool not used yet, but available\n", "\n", "# ✅ JSON extraction (robust for LLM output)\n", "def extract_json_list(response):\n", " cleaned = response.strip()\n", " cleaned = cleaned.replace(\"```json\", \"\").replace(\"```\", \"\").strip()\n", " cleaned = cleaned.replace(\"“\", '\"').replace(\"”\", '\"').replace(\"‘\", \"'\").replace(\"’\", \"'\")\n", "\n", " try:\n", " return json.loads(cleaned)\n", " except json.JSONDecodeError:\n", " match = re.search(r\"\\[(.*?)\\]\", cleaned, re.DOTALL)\n", " if match:\n", " try:\n", " return json.loads(f\"[{match.group(1)}]\")\n", " except json.JSONDecodeError:\n", " pass\n", " raise ValueError(f\"❌ Could not extract valid JSON list from LLM response:\\n{cleaned}\")\n", "\n", "# ✅ Get venue types for given event\n", "def get_suitable_venue_types(event_type):\n", " prompt = (\n", " f\"You are an expert event planner.\\n\"\n", " f\"Suggest the 3 most suitable types of venues for a '{event_type}' event.\\n\"\n", " f\"Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.\"\n", " f\"Return only a valid JSON list like: [\\\"banquet hall\\\", \\\"outdoor garden\\\", \\\"conference center\\\"]\"\n", " f\"IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\"\n", " )\n", " response = agent.run(prompt)\n", " return extract_json_list(response.final_answer)\n", "\n", "# ✅ Search Google Places for venue info\n", "def search_venues(location, venue_type, limit=3):\n", " search_url = \"https://maps.googleapis.com/maps/api/place/textsearch/json\"\n", " params = {\n", " \"query\": f\"{venue_type} in {location}\",\n", " \"key\": GOOGLE_API_KEY\n", " }\n", " response = requests.get(search_url, params=params)\n", " results = response.json().get(\"results\", [])[:limit]\n", "\n", " venues = []\n", " for result in results:\n", " place_id = result.get(\"place_id\")\n", " details_url = \"https://maps.googleapis.com/maps/api/place/details/json\"\n", " details_params = {\n", " \"place_id\": place_id,\n", " \"fields\": \"name,rating,formatted_address,formatted_phone_number,website\",\n", " \"key\": GOOGLE_API_KEY\n", " }\n", " detail_resp = requests.get(details_url, params=details_params).json()\n", " detail = detail_resp.get(\"result\", {})\n", "\n", " venues.append({\n", " \"name\": detail.get(\"name\", \"N/A\"),\n", " \"rating\": detail.get(\"rating\", \"N/A\"),\n", " \"address\": detail.get(\"formatted_address\", \"N/A\"),\n", " \"phone\": detail.get(\"formatted_phone_number\", \"N/A\"),\n", " \"website\": detail.get(\"website\", \"N/A\")\n", " })\n", "\n", " return venues\n", "\n", "# ✅ Main venue agent logic\n", "def venue_agent(extracted_intent):\n", " event_type = extracted_intent.get(\"event_type\")\n", " location = extracted_intent.get(\"location\")\n", "\n", " if not event_type or not location:\n", " raise ValueError(\"❌ User intent must include both 'event_type' and 'location'.\")\n", "\n", " print(f\"\\n🧠 Determining suitable venue types for: {event_type}\")\n", " venue_types = get_suitable_venue_types(event_type)\n", "\n", " all_venues = []\n", " for vtype in venue_types:\n", " print(f\"🔎 Searching: {vtype} in {location}\")\n", " venues = search_venues(location, vtype)\n", " all_venues.append({\n", " \"venue_type\": vtype,\n", " \"options\": venues\n", " })\n", "\n", " return all_venues\n", "\n", "# ✅ Run standalone\n", "if __name__ == \"__main__\":\n", " print(\"\\n🎯 Extracted User Intent:\")\n", " print(json.dumps(extracted_intent, indent=2))\n", "\n", " venue_results = venue_agent(extracted_intent)\n", "\n", " print(\"\\n📍 Recommended Venues:\")\n", " for group in venue_results:\n", " print(f\"\\n🔹 Venue Type: {group['venue_type']}\")\n", " for i, v in enumerate(group[\"options\"], start=1):\n", " print(f\" {i}. {v['name']}\")\n", " print(f\" ⭐ Rating: {v.get('rating', 'N/A')}\")\n", " print(f\" 📍 Address: {v.get('address', 'N/A')}\")\n", " print(f\" ☎️ Phone: {v.get('phone', 'N/A')}\")\n", " print(f\" 🌐 Website: {v.get('website', 'N/A')}\\n\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "n05L60QCbgVc", "outputId": "221de45b-8477-4982-cbe5-52b25b0701ae" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", "🎯 Extracted User Intent:\n", "{\n", " \"event_type\": \"conference\",\n", " \"location\": \"Islamabad\",\n", " \"event_date\": \"2025-06-13\",\n", " \"guest_count\": 120,\n", " \"preferences\": {\n", " \"stay_dates\": [\n", " \"2025-06-12\",\n", " \"2025-06-15\"\n", " ],\n", " \"guest_origins\": [\n", " \"Turkey\",\n", " \"Lahore\"\n", " ]\n", " },\n", " \"event_theme\": null,\n", " \"meal_count\": null,\n", " \"transport_needs\": null,\n", " \"sightseeing\": null\n", "}\n", "\n", "🧠 Determining suitable venue types for: conference\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: search\n", "\n", "Tool: Quick Internet Search\n", "Description: Searches internet quickly using DuckDuckGo for a given query and returns top 5 results.\n", "Action Type: search\n", "Input Format: A search query as a string. Example: 'Latest advancements in AI'\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner.\n", "Suggest the 3 most suitable types of venues for a 'conference' event.\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return only a valid JSON list like: [\"banquet hall\", \"outdoor garden\", \"conference center\"]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [\"conference center\", \"hotel ballroom\", \"university auditorium\"]\n", "✅ Parsed Final Answer: [\"conference center\", \"hotel ballroom\", \"university auditorium\"]\n", "🔎 Searching: conference center in Islamabad\n", "🔎 Searching: hotel ballroom in Islamabad\n", "🔎 Searching: university auditorium in Islamabad\n", "\n", "📍 Recommended Venues:\n", "\n", "🔹 Venue Type: conference center\n", " 1. Jinnah Convention Centre\n", " ⭐ Rating: 4.5\n", " 📍 Address: Club Rd, Islamabad, Pakistan\n", " ☎️ Phone: N/A\n", " 🌐 Website: http://conventioncenter.pk/\n", "\n", " 2. Pakistan-China Friendship Center\n", " ⭐ Rating: 4.5\n", " 📍 Address: Garden Avenue، Shakarparian Rd, Islamabad, Pakistan\n", " ☎️ Phone: N/A\n", " 🌐 Website: http://www.pakchinacentre.pk/\n", "\n", " 3. Rehman Town Conference Center\n", " ⭐ Rating: 4.3\n", " 📍 Address: JWCQ+43C, Street No 7, Rehman Town Jhangi Sayedan, Islamabad, Pakistan\n", " ☎️ Phone: N/A\n", " 🌐 Website: N/A\n", "\n", "\n", "🔹 Venue Type: hotel ballroom\n", " 1. Grand Islamabad Hotel\n", " ⭐ Rating: 4.3\n", " 📍 Address: St 1, MPCHS E-11/1 MPCHS E 11/1 E-11, Islamabad, Pakistan\n", " ☎️ Phone: (051) 2304846\n", " 🌐 Website: http://www.grandislamabadhotel.com/\n", "\n", " 2. MARGALLA Hills Residency Islamabad E-11/3\n", " ⭐ Rating: 4.8\n", " 📍 Address: House 170-A, Street 70, MPCHS E-11/3 MPCHS E 11/3 E-11, Islamabad, 44000, Pakistan\n", " ☎️ Phone: 0349 5709104\n", " 🌐 Website: https://www.facebook.com/Margalla-Hills-Residency-118394189997081/\n", "\n", " 3. Serena Hotel\n", " ⭐ Rating: 4.5\n", " 📍 Address: Khayaban-e-Suhrwardy Rd, opposite Convention Centre, G-5/1 G-5, Islamabad, 44000, Pakistan\n", " ☎️ Phone: (051) 111 133 133\n", " 🌐 Website: https://www.serenahotels.com/islamabad\n", "\n", "\n", "🔹 Venue Type: university auditorium\n", " 1. Air University Main Auditorium\n", " ⭐ Rating: 4.7\n", " 📍 Address: P27G+G6Q, University Rd, E-9/4 E-9, Islamabad, Pakistan\n", " ☎️ Phone: N/A\n", " 🌐 Website: N/A\n", "\n", " 2. Jinnah Auditorium\n", " ⭐ Rating: 4.7\n", " 📍 Address: JXVV+893, Indus Loop, H-12, Islamabad, Pakistan\n", " ☎️ Phone: N/A\n", " 🌐 Website: N/A\n", "\n", " 3. NSU Auditorium\n", " ⭐ Rating: 4.9\n", " 📍 Address: M3G4+PWJ, H-8/1 H 8/1 H-8, Islamabad, Pakistan\n", " ☎️ Phone: N/A\n", " 🌐 Website: http://www.nsu.edu.pk/\n", "\n" ] } ] }, { "cell_type": "markdown", "source": [ "**4.4 Hotel Booking Agent**" ], "metadata": { "id": "uXGbcwsicBUa" } }, { "cell_type": "markdown", "source": [ "Ok the next important task is that where the guests will stay... Sometimes it is a VIP delegation like i have selected in this problem that a Turkish Delegation is arriving, so we need to keep them in a hotel which is luxurious enough, the staff knows how to deal with the foreigners and it is as close to the venue as possible." ], "metadata": { "id": "r2JAgPBbxUrc" } }, { "cell_type": "code", "source": [ "import os\n", "import json\n", "import re\n", "import ast\n", "import requests\n", "\n", "from agentpro import create_model, ReactAgent\n", "\n", "# ✅ Load environment keys\n", "OPENAI_API_KEY = os.environ[\"OPENAI_API_KEY\"]\n", "GOOGLE_API_KEY = os.environ[\"GOOGLE_API_KEY\"]\n", "\n", "# ✅ Agent setup\n", "model = create_model(provider=\"openai\", model_name=\"gpt-4o\", api_key=OPENAI_API_KEY)\n", "agent = ReactAgent(model=model, tools=[])\n", "\n", "# ✅ JSON-safe parser\n", "def extract_json_from_response(response):\n", " cleaned = response.strip()\n", " cleaned = re.sub(r\"```(?:json|python)?\", \"\", cleaned)\n", " cleaned = re.sub(r\"[^\\x00-\\x7F]+\", \"\", cleaned).strip()\n", " cleaned = cleaned.replace(\"“\", '\"').replace(\"”\", '\"').replace(\"‘\", \"'\").replace(\"’\", \"'\")\n", "\n", " try:\n", " return json.loads(cleaned)\n", " except json.JSONDecodeError:\n", " match = re.search(r\"(\\{.*\\}|\\[.*\\])\", cleaned, re.DOTALL)\n", " if match:\n", " try:\n", " return json.loads(match.group(0))\n", " except json.JSONDecodeError:\n", " pass\n", " raise ValueError(f\"❌ Could not extract valid JSON from LLM response:\\n{cleaned}\")\n", "\n", "# ✅ LLM: Analyze hotel needs based on intent + venues\n", "def analyze_hotel_needs(user_intent, venues):\n", " prompt = (\n", " \"You are a hotel planning assistant.\\n\"\n", " \"Based on the event type, location, and venues, determine the hotel needs.\\n\"\n", " \"Return a Python dictionary with:\\n\"\n", " \"- 'hotel_type': e.g., 3-star, 5-star\\n\"\n", " \"- 'room_requirements': {single: int, double: int, suite: int}\\n\"\n", " \"- 'priorities': list of preferences (e.g., budget, proximity, Wi-Fi)\\n\"\n", " \"- 'suggested_hotels': optional hotel suggestions with name, type, rooms, amenities\\n\\n\"\n", " \"Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.\"\n", " f\"user_intent = {json.dumps(user_intent, indent=2)}\\n\"\n", " f\"venues = {json.dumps(venues[:2], indent=2)}\"\n", " \"IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\"\n", " )\n", " response = agent.run(prompt)\n", " return extract_json_from_response(response.final_answer)\n", "\n", "# ✅ Google API helpers\n", "def get_place_details(place_id):\n", " url = \"https://maps.googleapis.com/maps/api/place/details/json\"\n", " params = {\n", " \"place_id\": place_id,\n", " \"fields\": \"name,rating,formatted_address,formatted_phone_number,website\",\n", " \"key\": GOOGLE_API_KEY\n", " }\n", " return requests.get(url, params=params).json().get(\"result\", {})\n", "\n", "def search_hotels_near_venue(venue_address, hotel_type, limit=3):\n", " url = \"https://maps.googleapis.com/maps/api/place/textsearch/json\"\n", " params = {\n", " \"query\": f\"{hotel_type} hotel near {venue_address}\",\n", " \"key\": GOOGLE_API_KEY\n", " }\n", " res = requests.get(url, params=params).json()\n", " results = res.get(\"results\", [])[:limit]\n", "\n", " hotels = []\n", " for r in results:\n", " details = get_place_details(r.get(\"place_id\", \"\"))\n", " hotels.append({\n", " \"name\": details.get(\"name\", r.get(\"name\")),\n", " \"rating\": details.get(\"rating\", \"N/A\"),\n", " \"address\": details.get(\"formatted_address\", r.get(\"formatted_address\", \"\")),\n", " \"phone\": details.get(\"formatted_phone_number\", \"N/A\"),\n", " \"website\": details.get(\"website\", \"N/A\")\n", " })\n", "\n", " return hotels\n", "\n", "# ✅ Main hotel booking agent\n", "def hotel_booking_agent(user_intent, venue_data):\n", " all_venues = []\n", " for group in venue_data:\n", " all_venues.extend(group.get(\"options\", []))\n", "\n", " # 🧠 LLM: Analyze hotel needs\n", " hotel_plan = analyze_hotel_needs(user_intent, all_venues)\n", "\n", " # ✅ Fix if hotel_plan is a list of dicts instead of a single dict\n", " if isinstance(hotel_plan, list) and len(hotel_plan) > 0:\n", " hotel_plan = hotel_plan[0]\n", " hotel_type = hotel_plan.get(\"hotel_type\", \"hotel\")\n", " room_requirements = hotel_plan.get(\"room_requirements\", {})\n", " priorities = hotel_plan.get(\"priorities\", [])\n", "\n", " # 🔎 Search near each venue\n", " recommendations = {}\n", " for venue in all_venues:\n", " venue_name = venue.get(\"name\")\n", " venue_address = venue.get(\"address\") or venue.get(\"formatted_address\")\n", " if not venue_name or not venue_address:\n", " continue\n", "\n", " hotels = search_hotels_near_venue(venue_address, hotel_type)\n", " recommendations[venue_name] = hotels\n", "\n", " return {\n", " \"hotel_type\": hotel_type,\n", " \"room_requirements\": room_requirements,\n", " \"priorities\": priorities,\n", " \"recommendations\": recommendations\n", " }\n", "\n", "# ✅ Test entry point\n", "if __name__ == \"__main__\":\n", " user_intent = extracted_intent\n", " venue_data = venue_agent(user_intent)\n", "\n", " print(\"\\n🏨 Generating hotel suggestions...\")\n", " hotel_output = hotel_booking_agent(user_intent, venue_data)\n", "\n", " print(\"\\n🛏️ Room Requirements:\")\n", " print(json.dumps(hotel_output[\"room_requirements\"], indent=2))\n", "\n", " print(\"\\n📌 Booking Priorities:\")\n", " for p in hotel_output[\"priorities\"]:\n", " print(f\"- {p}\")\n", "\n", " print(\"\\n🏨 Hotel Recommendations by Venue:\")\n", " for venue, hotels in hotel_output[\"recommendations\"].items():\n", " print(f\"\\n📍 Near {venue}\")\n", " for h in hotels:\n", " print(f\" - {h['name']} ({h['rating']})\")\n", " print(f\" 📍 {h['address']}\")\n", " print(f\" ☎️ {h['phone']}\")\n", " print(f\" 🌐 {h['website']}\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "cMeubazgcC1L", "outputId": "268151e5-3c46-4897-d38a-e2a9009be67e" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", "🧠 Determining suitable venue types for: conference\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner.\n", "Suggest the 3 most suitable types of venues for a 'conference' event.\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return only a valid JSON list like: [\"banquet hall\", \"outdoor garden\", \"conference center\"]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [\"conference center\", \"hotel ballroom\", \"university auditorium\"]\n", "✅ Parsed Final Answer: [\"conference center\", \"hotel ballroom\", \"university auditorium\"]\n", "🔎 Searching: conference center in Islamabad\n", "🔎 Searching: hotel ballroom in Islamabad\n", "🔎 Searching: university auditorium in Islamabad\n", "\n", "🏨 Generating hotel suggestions...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a hotel planning assistant.\n", "Based on the event type, location, and venues, determine the hotel needs.\n", "Return a Python dictionary with:\n", "- 'hotel_type': e.g., 3-star, 5-star\n", "- 'room_requirements': {single: int, double: int, suite: int}\n", "- 'priorities': list of preferences (e.g., budget, proximity, Wi-Fi)\n", "- 'suggested_hotels': optional hotel suggestions with name, type, rooms, amenities\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.user_intent = {\n", " \"event_type\": \"conference\",\n", " \"location\": \"Islamabad\",\n", " \"event_date\": \"2025-06-13\",\n", " \"guest_count\": 120,\n", " \"preferences\": {\n", " \"stay_dates\": [\n", " \"2025-06-12\",\n", " \"2025-06-15\"\n", " ],\n", " \"guest_origins\": [\n", " \"Turkey\",\n", " \"Lahore\"\n", " ]\n", " },\n", " \"event_theme\": null,\n", " \"meal_count\": null,\n", " \"transport_needs\": null,\n", " \"sightseeing\": null\n", "}\n", "venues = [\n", " {\n", " \"name\": \"Jinnah Convention Centre\",\n", " \"rating\": 4.5,\n", " \"address\": \"Club Rd, Islamabad, Pakistan\",\n", " \"phone\": \"N/A\",\n", " \"website\": \"http://conventioncenter.pk/\"\n", " },\n", " {\n", " \"name\": \"Pakistan-China Friendship Center\",\n", " \"rating\": 4.5,\n", " \"address\": \"Garden Avenue\\u060c Shakarparian Rd, Islamabad, Pakistan\",\n", " \"phone\": \"N/A\",\n", " \"website\": \"http://www.pakchinacentre.pk/\"\n", " }\n", "]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"hotel_type\":\"4-star\",\"room_requirements\":{\"single\":30,\"double\":20,\"suite\":10},\"priorities\":[\"proximity\",\"Wi-Fi\",\"conference facilities\"],\"suggested_hotels\":[{\"name\":\"Islamabad Serena Hotel\",\"type\":\"5-star\",\"rooms\":{\"single\":150,\"double\":100,\"suite\":50},\"amenities\":[\"Wi-Fi\",\"conference rooms\",\"airport shuttle\"]},{\"name\":\"Ramada by Wyndham Islamabad\",\"type\":\"4-star\",\"rooms\":{\"single\":100,\"double\":50,\"suite\":20},\"amenities\":[\"Wi-Fi\",\"conference rooms\",\"restaurant\"]}]}\n", "✅ Parsed Final Answer: {\"hotel_type\":\"4-star\",\"room_requirements\":{\"single\":30,\"double\":20,\"suite\":10},\"priorities\":[\"proximity\",\"Wi-Fi\",\"conference facilities\"],\"suggested_hotels\":[{\"name\":\"Islamabad Serena Hotel\",\"type\":\"5-star\",\"rooms\":{\"single\":150,\"double\":100,\"suite\":50},\"amenities\":[\"Wi-Fi\",\"conference rooms\",\"airport shuttle\"]},{\"name\":\"Ramada by Wyndham Islamabad\",\"type\":\"4-star\",\"rooms\":{\"single\":100,\"double\":50,\"suite\":20},\"amenities\":[\"Wi-Fi\",\"conference rooms\",\"restaurant\"]}]}\n", "\n", "🛏️ Room Requirements:\n", "{\n", " \"single\": 30,\n", " \"double\": 20,\n", " \"suite\": 10\n", "}\n", "\n", "📌 Booking Priorities:\n", "- proximity\n", "- Wi-Fi\n", "- conference facilities\n", "\n", "🏨 Hotel Recommendations by Venue:\n", "\n", "📍 Near Jinnah Convention Centre\n", " - Ramada by Wyndham Islamabad (4.3)\n", " 📍 1 Club Road, Murree Rd, Shakar Parian, Islamabad, 44000, Pakistan\n", " ☎️ (051) 111 379 379\n", " 🌐 https://www.wyndhamhotels.com/en-uk/ramada/islamabad-pakistan/ramada-islamabad/overview?CID=LC:wmcic5n98gs1g0r:36547&iata=00093796\n", " - Grand Islamabad Hotel (4.3)\n", " 📍 St 1, MPCHS E-11/1 MPCHS E 11/1 E-11, Islamabad, Pakistan\n", " ☎️ (051) 2304846\n", " 🌐 http://www.grandislamabadhotel.com/\n", " - Islamabad Hotel (4.1)\n", " 📍 Main Civic Centre, G6 Municipal Rd, G-6 Markaz G 6 Markaz G-6, Islamabad, 44000, Pakistan\n", " ☎️ (051) 2827311\n", " 🌐 N/A\n", "\n", "📍 Near Pakistan-China Friendship Center\n", " - Grand Islamabad Hotel (4.3)\n", " 📍 St 1, MPCHS E-11/1 MPCHS E 11/1 E-11, Islamabad, Pakistan\n", " ☎️ (051) 2304846\n", " 🌐 http://www.grandislamabadhotel.com/\n", " - Ramada by Wyndham Islamabad (4.3)\n", " 📍 1 Club Road, Murree Rd, Shakar Parian, Islamabad, 44000, Pakistan\n", " ☎️ (051) 111 379 379\n", " 🌐 https://www.wyndhamhotels.com/en-uk/ramada/islamabad-pakistan/ramada-islamabad/overview?CID=LC:wmcic5n98gs1g0r:36547&iata=00093796\n", " - Crown Plaza Hotel (4)\n", " 📍 99-E Jinnah Ave, Block I G 7/2 Blue Area, Islamabad, 44000, Pakistan\n", " ☎️ N/A\n", " 🌐 N/A\n", "\n", "📍 Near Rehman Town Conference Center\n", " - SAZ HOTEL ISLAMABAD (5)\n", " 📍 Center of Zarkon Heights ,G 15/4 , G.T Road, G, 15/4 Capital, Jammu & Kashmir Housing Society G 15/4 G-15, Islamabad, Pakistan\n", " ☎️ 0331 6664777\n", " 🌐 https://www.sazhotelislamabad.com/\n", " - Islamabad Marriott Hotel (4.6)\n", " 📍 Agha Khan Rd, F-5/1 F-5, Islamabad, 44000, Pakistan\n", " ☎️ (051) 2826121\n", " 🌐 https://www.marriott.com/hotels/travel/isbpk-islamabad-marriott-hotel/\n", " - Grand Islamabad Hotel (4.3)\n", " 📍 St 1, MPCHS E-11/1 MPCHS E 11/1 E-11, Islamabad, Pakistan\n", " ☎️ (051) 2304846\n", " 🌐 http://www.grandislamabadhotel.com/\n", "\n", "📍 Near Grand Islamabad Hotel\n", " - Grand Islamabad Hotel (4.3)\n", " 📍 St 1, MPCHS E-11/1 MPCHS E 11/1 E-11, Islamabad, Pakistan\n", " ☎️ (051) 2304846\n", " 🌐 http://www.grandislamabadhotel.com/\n", " - MARGALLA Hills Residency Islamabad E-11/3 (4.8)\n", " 📍 House 170-A, Street 70, MPCHS E-11/3 MPCHS E 11/3 E-11, Islamabad, 44000, Pakistan\n", " ☎️ 0349 5709104\n", " 🌐 https://www.facebook.com/Margalla-Hills-Residency-118394189997081/\n", " - Canadian Inn Hotel Islamabad (4.7)\n", " 📍 308 Street 64, MPCHS E-11/3 MPCHS E 11/3 E-11, Islamabad, Pakistan\n", " ☎️ 0335 3304742\n", " 🌐 http://canadianinn.pk/\n", "\n", "📍 Near MARGALLA Hills Residency Islamabad E-11/3\n", " - Grand Islamabad Hotel (4.3)\n", " 📍 St 1, MPCHS E-11/1 MPCHS E 11/1 E-11, Islamabad, Pakistan\n", " ☎️ (051) 2304846\n", " 🌐 http://www.grandislamabadhotel.com/\n", " - MARGALLA Hills Residency Islamabad E-11/3 (4.8)\n", " 📍 House 170-A, Street 70, MPCHS E-11/3 MPCHS E 11/3 E-11, Islamabad, 44000, Pakistan\n", " ☎️ 0349 5709104\n", " 🌐 https://www.facebook.com/Margalla-Hills-Residency-118394189997081/\n", " - Faletti's Express - Islamabad (4.4)\n", " 📍 Faletti's Express Main, markaz FECHS E 11/2 E-11, Islamabad, 46000, Pakistan\n", " ☎️ 0332 5481791\n", " 🌐 https://isb.falettisexpress.com.pk/\n", "\n", "📍 Near Serena Hotel\n", " - Serena Hotel (4.5)\n", " 📍 Khayaban-e-Suhrwardy Rd, opposite Convention Centre, G-5/1 G-5, Islamabad, 44000, Pakistan\n", " ☎️ (051) 111 133 133\n", " 🌐 https://www.serenahotels.com/islamabad\n", "\n", "📍 Near Air University Main Auditorium\n", " - Islamabad Marriott Hotel (4.6)\n", " 📍 Agha Khan Rd, F-5/1 F-5, Islamabad, 44000, Pakistan\n", " ☎️ (051) 2826121\n", " 🌐 https://www.marriott.com/hotels/travel/isbpk-islamabad-marriott-hotel/\n", " - Grand Islamabad Hotel (4.3)\n", " 📍 St 1, MPCHS E-11/1 MPCHS E 11/1 E-11, Islamabad, Pakistan\n", " ☎️ (051) 2304846\n", " 🌐 http://www.grandislamabadhotel.com/\n", " - Executive Grand Royal (Hotel & Resort) Islamabad (4.8)\n", " 📍 F, 1 Street 59, near Centuras Mall, 8/4 F 8/4 F-8, Islamabad, 75000, Pakistan\n", " ☎️ 0303 5003005\n", " 🌐 http://www.islamabadbooking.com/\n", "\n", "📍 Near Jinnah Auditorium\n", " - Islamabad Marriott Hotel (4.6)\n", " 📍 Agha Khan Rd, F-5/1 F-5, Islamabad, 44000, Pakistan\n", " ☎️ (051) 2826121\n", " 🌐 https://www.marriott.com/hotels/travel/isbpk-islamabad-marriott-hotel/\n", " - Grand Islamabad Hotel (4.3)\n", " 📍 St 1, MPCHS E-11/1 MPCHS E 11/1 E-11, Islamabad, Pakistan\n", " ☎️ (051) 2304846\n", " 🌐 http://www.grandislamabadhotel.com/\n", " - Serena Hotel (4.5)\n", " 📍 Khayaban-e-Suhrwardy Rd, opposite Convention Centre, G-5/1 G-5, Islamabad, 44000, Pakistan\n", " ☎️ (051) 111 133 133\n", " 🌐 https://www.serenahotels.com/islamabad\n", "\n", "📍 Near NSU Auditorium\n", " - Islamabad Marriott Hotel (4.6)\n", " 📍 Agha Khan Rd, F-5/1 F-5, Islamabad, 44000, Pakistan\n", " ☎️ (051) 2826121\n", " 🌐 https://www.marriott.com/hotels/travel/isbpk-islamabad-marriott-hotel/\n", " - Serena Hotel (4.5)\n", " 📍 Khayaban-e-Suhrwardy Rd, opposite Convention Centre, G-5/1 G-5, Islamabad, 44000, Pakistan\n", " ☎️ (051) 111 133 133\n", " 🌐 https://www.serenahotels.com/islamabad\n", " - Islamabad Hotel (4.1)\n", " 📍 Main Civic Centre, G6 Municipal Rd, G-6 Markaz G 6 Markaz G-6, Islamabad, 44000, Pakistan\n", " ☎️ (051) 2827311\n", " 🌐 N/A\n" ] } ] }, { "cell_type": "markdown", "source": [ "**4.5 Vendor Agent**" ], "metadata": { "id": "6QmyxzULdfyO" } }, { "cell_type": "markdown", "source": [ "And here comes the most important task.. To find the right vendors for the rigt task. but first we need to know that what all things will be required for this event.. and this will need an AI assistant who will tell us exactly what all we need to purchase or arrnage and the best vendors in town for the purpose." ], "metadata": { "id": "BOpIRfwMyC2f" } }, { "cell_type": "code", "source": [ "import os\n", "import json\n", "import requests\n", "import ast\n", "import re\n", "from agentpro import ReactAgent, create_model\n", "from agentpro.tools import QuickInternetTool\n", "\n", "# ✅ Load keys\n", "OPENAI_API_KEY = os.getenv(\"OPENAI_API_KEY\") # Make sure it's set in environment\n", "GOOGLE_API_KEY = os.getenv(\"GOOGLE_API_KEY\") # Make sure it's set in environment\n", "\n", "# ✅ Create OpenAI model (GPT-4o or GPT-4)\n", "model = create_model(\n", " provider=\"openai\",\n", " model_name=\"gpt-4o\",\n", " api_key=OPENAI_API_KEY\n", ")\n", "\n", "# ✅ Setup ReAct agent with tool\n", "agent = ReactAgent(model=model, tools=[QuickInternetTool()])\n", "\n", "# ✅ Utility to clean LLM list responses\n", "def extract_json_list(response):\n", " cleaned = response.strip()\n", " cleaned = cleaned.replace(\"```json\", \"\").replace(\"```\", \"\").strip()\n", " cleaned = cleaned.replace(\"“\", '\"').replace(\"”\", '\"').replace(\"‘\", \"'\").replace(\"’\", \"'\")\n", "\n", " try:\n", " return json.loads(cleaned)\n", " except json.JSONDecodeError:\n", " match = re.search(r\"\\[(.*?)\\]\", cleaned, re.DOTALL)\n", " if match:\n", " try:\n", " return json.loads(f\"[{match.group(1)}]\")\n", " except json.JSONDecodeError:\n", " pass\n", " raise ValueError(f\"❌ Could not extract valid JSON list from LLM response:\\n{cleaned}\")\n", "\n", "# ✅ LLM step to find vendor types\n", "def get_required_vendor_types(event_type):\n", " prompt = (\n", " f\"You are an expert event planner. What types of vendors are typically needed for a '{event_type}'? \"\n", " \"Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.\"\n", " \"Return only a Python list like: [\\\"catering\\\", \\\"event lighting\\\", \\\"A/V equipment\\\"]\"\n", " \"IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\"\n", " )\n", " response = agent.run(prompt)\n", " return extract_json_list(response.final_answer)\n", "\n", "# ✅ Google Places API\n", "def search_vendors(location, vendor_type, limit=3):\n", " url = \"https://maps.googleapis.com/maps/api/place/textsearch/json\"\n", " params = {\n", " \"query\": f\"{vendor_type} near {location}\",\n", " \"key\": GOOGLE_API_KEY\n", " }\n", " res = requests.get(url, params=params).json()\n", " results = res.get(\"results\", [])[:limit]\n", "\n", " vendors = []\n", " for result in results:\n", " place_id = result.get(\"place_id\")\n", " details_url = \"https://maps.googleapis.com/maps/api/place/details/json\"\n", " details_params = {\n", " \"place_id\": place_id,\n", " \"fields\": \"name,rating,formatted_address,formatted_phone_number,website\",\n", " \"key\": GOOGLE_API_KEY\n", " }\n", " detail_resp = requests.get(details_url, params=details_params).json()\n", " d = detail_resp.get(\"result\", {})\n", " vendors.append({\n", " \"name\": d.get(\"name\"),\n", " \"type\": vendor_type,\n", " \"rating\": d.get(\"rating\", \"N/A\"),\n", " \"address\": d.get(\"formatted_address\", \"N/A\"),\n", " \"phone\": d.get(\"formatted_phone_number\", \"N/A\"),\n", " \"website\": d.get(\"website\", \"N/A\")\n", " })\n", "\n", " return vendors\n", "\n", "# ✅ Main agent\n", "def vendors_agent(user_intent):\n", " event_type = user_intent.get(\"event_type\")\n", " location = user_intent.get(\"location\")\n", "\n", " if not event_type or not location:\n", " raise ValueError(\"User intent must include both event_type and location.\")\n", "\n", " vendor_types = get_required_vendor_types(event_type)\n", " all_vendors = []\n", "\n", " for vtype in vendor_types:\n", " print(f\"🔎 Searching vendors for: {vtype}\")\n", " vendors = search_vendors(location, vtype)\n", " all_vendors.append({\n", " \"vendor_type\": vtype,\n", " \"options\": vendors\n", " })\n", "\n", " return all_vendors\n", "\n", "# ✅ Run if main\n", "if __name__ == \"__main__\":\n", "\n", " print(\"\\n🎯 Extracted Intent:\")\n", " print(json.dumps(extracted_intent, indent=2))\n", "\n", " print(\"\\n🔧 Finding vendors...\")\n", " vendor_results = vendors_agent(extracted_intent)\n", "\n", " print(\"\\n🛍️ Recommended Vendors:\")\n", " for group in vendor_results:\n", " print(f\"\\n🔹 Vendor Type: {group['vendor_type']}\")\n", " for idx, v in enumerate(group[\"options\"], start=1):\n", " print(f\" {idx}. {v['name']} ({v['rating']})\")\n", " print(f\" 📍 {v['address']}\")\n", " print(f\" ☎️ {v['phone']}\")\n", " print(f\" 🌐 {v['website']}\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "mndR4lTidhAc", "outputId": "a04bf117-4b31-41f8-8b7f-6bc9bace29d5" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", "🎯 Extracted Intent:\n", "{\n", " \"event_type\": \"conference\",\n", " \"location\": \"Islamabad\",\n", " \"event_date\": \"2025-06-13\",\n", " \"guest_count\": 120,\n", " \"preferences\": {\n", " \"stay_dates\": [\n", " \"2025-06-12\",\n", " \"2025-06-15\"\n", " ],\n", " \"guest_origins\": [\n", " \"Turkey\",\n", " \"Lahore\"\n", " ]\n", " },\n", " \"event_theme\": null,\n", " \"meal_count\": null,\n", " \"transport_needs\": null,\n", " \"sightseeing\": null\n", "}\n", "\n", "🔧 Finding vendors...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: search\n", "\n", "Tool: Quick Internet Search\n", "Description: Searches internet quickly using DuckDuckGo for a given query and returns top 5 results.\n", "Action Type: search\n", "Input Format: A search query as a string. Example: 'Latest advancements in AI'\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner. What types of vendors are typically needed for a 'conference'? Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return only a Python list like: [\"catering\", \"event lighting\", \"A/V equipment\"]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [\"venue\", \"catering\", \"audio/visual equipment\", \"event production\", \"registration services\", \"transportation\", \"security\", \"photography/videography\", \"printing services\", \"decor\"]\n", "✅ Parsed Final Answer: [\"venue\", \"catering\", \"audio/visual equipment\", \"event production\", \"registration services\", \"transportation\", \"security\", \"photography/videography\", \"printing services\", \"decor\"]\n", "🔎 Searching vendors for: venue\n", "🔎 Searching vendors for: catering\n", "🔎 Searching vendors for: audio/visual equipment\n", "🔎 Searching vendors for: event production\n", "🔎 Searching vendors for: registration services\n", "🔎 Searching vendors for: transportation\n", "🔎 Searching vendors for: security\n", "🔎 Searching vendors for: photography/videography\n", "🔎 Searching vendors for: printing services\n", "🔎 Searching vendors for: decor\n", "\n", "🛍️ Recommended Vendors:\n", "\n", "🔹 Vendor Type: venue\n", " 1. Fortress Events Complex Islamabad (4.4)\n", " 📍 Islamabad Expy, Madina Town, Islamabad, 44000, Pakistan\n", " ☎️ 0300 0452255\n", " 🌐 https://www.facebook.com/fortresseventscomplexislamabad/\n", " 2. Empire Marquee Islamabad (4.4)\n", " 📍 Islamabad Expy, behind PSO Pump، Nawaz, Islamabad, 44000, Pakistan\n", " ☎️ 0300 9714546\n", " 🌐 https://empiremarquee.pk/\n", " 3. Bukhara Royale Marquee in Islamabad (4.1)\n", " 📍 Main Express Way, next to Kaleem CNG, Hussain Abad, Islamabad, 45720, Pakistan\n", " ☎️ 0321 9580443\n", " 🌐 https://bukhararoyale.com/\n", "\n", "🔹 Vendor Type: catering\n", " 1. Naveed Caterers & Event Management (5)\n", " 📍 Office#5, First Floor, Victory Tower, F-8 Markaz F 8 Markaz F-8, Islamabad, 44220, Pakistan\n", " ☎️ 0321 5151972\n", " 🌐 http://www.naveedcaterers.pk/\n", " 2. Tandoori Caterers & Event Management (4.9)\n", " 📍 Shop no. 11, 20A, Jasmine Plaza, G8 Markaz Rd, G-8 Markaz G 8 Markaz G-8, Islamabad, 44000, Pakistan\n", " ☎️ 0300 5095090\n", " 🌐 https://tandoorirestaurants.pk/tandoori-catering/\n", " 3. Capital Caterers & Decorators | Catering Services & Event Planner (4.8)\n", " 📍 Pacific Centre Shop 1 & 2, Ground Floor, Pacific Center, Pacific Center, Johar Rd, F-8 Markaz F 8 Markaz F-8, Islamabad, 44000, Pakistan\n", " ☎️ 0300 5279004\n", " 🌐 https://capitalcaterer.com/\n", "\n", "🔹 Vendor Type: audio/visual equipment\n", " 1. MAJESTIC TECHNOLOGY |Audio Visual Solution|Projector/Screen°Audio Video Conference System°Sound Sys°Ceiling Speaker°Biometric (4.7)\n", " 📍 Office No, First Floor, Mehmood Plaza, 5 Warsak Rd, I-9 Markaz I 9 Markaz I-9, Islamabad, 44000, Pakistan\n", " ☎️ 0333 4747573\n", " 🌐 N/A\n", " 2. Technology Aid & Equipment (5)\n", " 📍 Office No.7, 3rd Floor, Aneeq Arcade, I-8 Markaz I 8 Markaz I-8, Islamabad, 44000, Pakistan\n", " ☎️ 0333 9550902\n", " 🌐 http://www.technologyaids.com.pk/\n", " 3. NASCO Traders | Audio and Video Conferencing and Display Systems, Solutions & Equipments (4.8)\n", " 📍 Nasco-Plaza, Khana east, main service road, adjacent to Islamabad express way near dubai islamic bank & ghouri town, phase 1 entrance, Islamabad, 44000, Pakistan\n", " ☎️ (051) 2303522\n", " 🌐 http://www.nasco-av.com/\n", "\n", "🔹 Vendor Type: event production\n", " 1. Hello Events (4.9)\n", " 📍 E11/4 Street 22, NPF E 11/4 E-11, Islamabad, 46000, Pakistan\n", " ☎️ 0333 5312378\n", " 🌐 https://helloevents.pk/?utm_source=gmb&utm_medium=referral\n", " 2. Zee J Events (4.8)\n", " 📍 House 758 Street 72, D-12/2 D 12/2 D-12, Islamabad, 46000, Pakistan\n", " ☎️ 0304 9198575\n", " 🌐 N/A\n", " 3. Chaar Charagh Media Production and Event Management (5)\n", " 📍 office# 412 , 5th floor , civic center, Gulberg Greens Executive Block Koral Town, Islamabad, 44000, Pakistan\n", " ☎️ 0308 5085363\n", " 🌐 N/A\n", "\n", "🔹 Vendor Type: registration services\n", " 1. Motor Vehicle Registration Office Islamabad (3.6)\n", " 📍 M3F3+VGJ, Service Rd E, H-9/4 H 9/4 H-9, Islamabad, Pakistan\n", " ☎️ (051) 9265598\n", " 🌐 N/A\n", " 2. M-Tag Registration and Recharge Centre (4.2)\n", " 📍 M2, University Town, Rawalpindi, Islamabad, Pakistan\n", " ☎️ 0308 4841091\n", " 🌐 N/A\n", " 3. Company Registration in Islamabad, Pakistan. Chines & Foreigners, SECP, Firm, NTN, Tax Returns, PSEB, GST, PSW, Trademark. (5)\n", " 📍 Office 11, Humair Plaza, I 10 Markaz I-10, Islamabad, 44800, Pakistan\n", " ☎️ 0333 9556602\n", " 🌐 http://one-point-solution.online/\n", "\n", "🔹 Vendor Type: transportation\n", " 1. MS Tours And Transport (4.8)\n", " 📍 Office #16, Ground Floor, Ali Plaza, Markaz, G-10 Markaz G 10 Markaz G-10, Islamabad, 92000, Pakistan\n", " ☎️ 0344 0997199\n", " 🌐 http://www.mstoursandtransport.com/\n", " 2. Niazi Goods Transport Company. (5)\n", " 📍 N-5, opp. bajaur fruits shop، Islamabad, Pakistan\n", " ☎️ 0305 8915031\n", " 🌐 https://ngtc7.wordpress.com/\n", " 3. Ridee office f8/4 islamabad (5)\n", " 📍 P25V+VJ7, F-8/4 F 8/4 F-8, Islamabad, Pakistan\n", " ☎️ 0319 5870578\n", " 🌐 N/A\n", "\n", "🔹 Vendor Type: security\n", " 1. Ghouri Security Guards (Pvt) Ltd. ( Top Security Companies, Islamabad, Lahore, Karachi, Peshawar, Multan, Pakistan, ) (4.6)\n", " 📍 Office No. 2, 2nd Floor, Al-Babar Center, Markaz, F-8 Markaz F 8 Markaz F-8, Islamabad, 44000, Pakistan\n", " ☎️ (051) 2855742\n", " 🌐 https://www.ghourisecurity.com.pk/\n", " 2. Veteran Security & Protection (Pvt) Ltd - Security Guards in Islamabad - Security Company (4.9)\n", " 📍 Office # 11, 2nd Floor, Shahwez Center، Johar Rd, F-8 Markaz F 8 Markaz F-8, Islamabad, 44000, Pakistan\n", " ☎️ (051) 2264991\n", " 🌐 http://veteransecurity.com.pk/\n", " 3. ONYX SECURITY SERVICES RAWALPINDI ISLAMABAD (4.6)\n", " 📍 Onyx Security, 795 Fifth Rd, near Commercial Market Road, D Block Block D Satellite Town, Rawalpindi, 46300, Pakistan\n", " ☎️ 0336 2323218\n", " 🌐 http://www.onyxsecurityservices.com.pk/\n", "\n", "🔹 Vendor Type: photography/videography\n", " 1. Hamza's production - Photography/Videography & Events (4.8)\n", " 📍 Block 12 ofice # Y12 Phase 7, Sector F DHA Phase 1, Islamabad, 46000, Pakistan\n", " ☎️ 0333 1585135\n", " 🌐 https://hamzasproduction.com/\n", " 2. Hamzas production - Photography/Videography & Events (5)\n", " 📍 feroz center, 5th floor, G-6/2 G 6/3 G-6, Islamabad, 46000, Pakistan\n", " ☎️ 0300 1514151\n", " 🌐 https://hamzasproduction.com/\n", " 3. Faizi Photography & Films (Best Wedding Photographer in Islamabad ) (5)\n", " 📍 Office No 7, Main Bazar, Sohan, 45740, Pakistan\n", " ☎️ 0345 5980940\n", " 🌐 https://www.faizistudio.com/\n", "\n", "🔹 Vendor Type: printing services\n", " 1. Printing Shop Islamabad (5)\n", " 📍 Shop #11/A, Capital Plaza, Markaz G 11 Markaz G-11, Islamabad, 44100, Pakistan\n", " ☎️ 0331 6093606\n", " 🌐 N/A\n", " 2. Panaflex Printing Islamabad (4.9)\n", " 📍 Landmark 1 plaza، Street 44, Markaz SCHS E 11/2 ای - ۱۱، اسلام آباد, 44000, Pakistan\n", " ☎️ 0315 6703330\n", " 🌐 http://www.hrgroupisb.com/\n", " 3. PrintFast Islamabad - Print Fast (4.7)\n", " 📍 Office#202, Chenab Center, 2nd Floor, Jinnah Ave, near calfornia pizza, Block H G 7/2 Blue Area, Islamabad, 44000, Pakistan\n", " ☎️ 0300 8243483\n", " 🌐 http://www.printfast.pk/\n", "\n", "🔹 Vendor Type: decor\n", " 1. Interior Decor Islamabad (4.6)\n", " 📍 Office # 4, Ground Floor, Azeem Mansion, 87-E West, Fazal e Haq Road, Block F G 7/3 Blue Area, Islamabad, 44000, Pakistan\n", " ☎️ 0333 8555667\n", " 🌐 https://interiordecor.com.pk/\n", " 2. Decor Klub - Interior Designer Islamabad (4.5)\n", " 📍 Office # 16, 4th Floor, Pakland Building, City Center, I-8 Markaz I 8 Markaz I-8, Islamabad, 44000, Pakistan\n", " ☎️ 0335 5254254\n", " 🌐 http://decorklub.com/\n", " 3. H & H Decor (4.8)\n", " 📍 Shop#S-20 ,2A Floor, Giga Mall, Main GT Rd, Phase-F Sector F DHA Phase II, Islamabad, 44000, Pakistan\n", " ☎️ 0335 5132840\n", " 🌐 N/A\n" ] } ] }, { "cell_type": "markdown", "source": [ "**4.6 Transport and Parking Agent**" ], "metadata": { "id": "syxU25ziemoK" } }, { "cell_type": "markdown", "source": [ "Now coming to the event day.. We will require transport to pick up guests from air port, take to hotel room and then to the venue and back... So transport will be required for the purpose. Now with the AI Agent we can find how many vehicles requried and where to find them.\n", "I have also included the details of parking spaces available near the venue and hotels etc to ensure we do not have any problem in the end." ], "metadata": { "id": "VJllkYh9ye4V" } }, { "cell_type": "code", "source": [ "import os\n", "import json\n", "import ast\n", "import re\n", "import requests\n", "from agentpro import ReactAgent, create_model\n", "\n", "# ✅ Use OpenAI API key\n", "OPENAI_API_KEY = os.getenv(\"OPENAI_API_KEY\")\n", "assert OPENAI_API_KEY, \"❌ Missing OPENAI_API_KEY in environment\"\n", "\n", "# ✅ Create model + ReAct agent with OpenAI GPT-4o\n", "model = create_model(provider=\"openai\", model_name=\"gpt-4o\", api_key=OPENAI_API_KEY)\n", "agent = ReactAgent(model=model)\n", "\n", "def extract_json_from_response(response):\n", " cleaned = response.strip()\n", " cleaned = re.sub(r\"```(?:json|python)?\", \"\", cleaned)\n", " cleaned = re.sub(r\"[^\\x00-\\x7F]+\", \"\", cleaned).strip()\n", " cleaned = cleaned.replace(\"“\", '\"').replace(\"”\", '\"').replace(\"‘\", \"'\").replace(\"’\", \"'\")\n", "\n", " try:\n", " return json.loads(cleaned)\n", " except json.JSONDecodeError:\n", " match = re.search(r\"(\\{.*\\}|\\[.*\\])\", cleaned, re.DOTALL)\n", " if match:\n", " try:\n", " return json.loads(match.group(0))\n", " except json.JSONDecodeError:\n", " pass\n", " raise ValueError(f\"❌ Could not extract valid JSON from LLM response:\\n{cleaned}\")\n", "\n", "def analyze_transport_needs(user_intent, venues, schedule):\n", " prompt = (\n", " \"You are a logistics planner. Based on this event, return:\\n\"\n", " \"- A list of transport vendor types required\\n\"\n", " \"- A dictionary of estimated vehicle needs by type\\n\\n\"\n", " \"Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.\"\n", " \"Return this as a Python dictionary with two keys: 'vendor_types' and 'vehicle_estimates'.\\n\"\n", " \"Example:\\n\"\n", " \"{\\n\"\n", " \" \\\"vendor_types\\\": [\\\"shuttle service\\\", \\\"bus rental\\\"],\\n\"\n", " \" \\\"vehicle_estimates\\\": {\\\"cars\\\": 3, \\\"shuttles\\\": 2, \\\"buses\\\": 1}\\n\"\n", " \"}\\n\\n\"\n", " f\"user_intent = {json.dumps(user_intent, indent=2)}\\n\"\n", " f\"venues = {json.dumps(venues[:2], indent=2)}\\n\"\n", " f\"schedule = {json.dumps(schedule[:2], indent=2)}\"\n", " \"IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\"\n", " )\n", "\n", " response = agent.run(prompt)\n", " cleaned = extract_json_from_response(response.final_answer)\n", "\n", " try:\n", " if isinstance(cleaned, dict):\n", " data = cleaned\n", " elif isinstance(cleaned, str):\n", " try:\n", " data = ast.literal_eval(cleaned)\n", " except Exception:\n", " data = json.loads(cleaned.replace(\"'\", '\"'))\n", " else:\n", " raise Exception(\"LLM returned unparseable content\")\n", "\n", " if isinstance(data, dict) and \"vendor_types\" in data and \"vehicle_estimates\" in data:\n", " return data\n", " else:\n", " raise ValueError(\"Unexpected LLM output structure:\\n\" + json.dumps(data, indent=2))\n", "\n", " except Exception as e:\n", " raise Exception(f\"LLM response could not be parsed:\\n{cleaned}\\n\\nError: {e}\")\n", "\n", "def search_vendors(location, vendor_type, limit=3):\n", " url = \"https://maps.googleapis.com/maps/api/place/textsearch/json\"\n", " params = {\n", " \"query\": f\"{vendor_type} near {location}\",\n", " \"key\": os.getenv(\"GOOGLE_API_KEY\")\n", " }\n", " res = requests.get(url, params=params).json()\n", " results = res.get(\"results\", [])[:limit]\n", "\n", " vendors = []\n", " for r in results:\n", " vendors.append({\n", " \"name\": r.get(\"name\"),\n", " \"type\": vendor_type,\n", " \"address\": r.get(\"formatted_address\"),\n", " \"rating\": r.get(\"rating\", \"N/A\")\n", " })\n", " return vendors\n", "\n", "def get_nearest_transport_hubs(location):\n", " airport = search_vendors(location, \"international airport\", limit=1)\n", " railway = search_vendors(location, \"intercity railway station\", limit=1)\n", " bus = search_vendors(location, \"intercity bus terminal\", limit=1)\n", "\n", " return {\n", " \"nearest_airport\": airport[0] if airport else {\"name\": \"N/A\", \"address\": \"N/A\"},\n", " \"nearest_railway_station\": railway[0] if railway else {\"name\": \"N/A\", \"address\": \"N/A\"},\n", " \"nearest_bus_station\": bus[0] if bus else {\"name\": \"N/A\", \"address\": \"N/A\"},\n", " }\n", "\n", "def find_parking_near_venues(venues):\n", " parking_results = {}\n", " for v in venues:\n", " venue_name = v.get(\"name\")\n", " venue_address = v.get(\"address\") or v.get(\"formatted_address\")\n", " if not venue_name or not venue_address:\n", " continue\n", "\n", " url = \"https://maps.googleapis.com/maps/api/place/textsearch/json\"\n", " params = {\n", " \"query\": f\"parking near {venue_address}\",\n", " \"key\": os.getenv(\"GOOGLE_API_KEY\")\n", " }\n", " res = requests.get(url, params=params).json()\n", " results = res.get(\"results\", [])[:3]\n", "\n", " parking_spots = [{\n", " \"name\": r.get(\"name\"),\n", " \"address\": r.get(\"formatted_address\"),\n", " \"rating\": r.get(\"rating\", \"N/A\")\n", " } for r in results]\n", "\n", " parking_results[venue_name] = parking_spots\n", " return parking_results\n", "\n", "def transport_parking_agent(user_intent, venue_data, schedule_data):\n", " location = user_intent.get(\"location\")\n", " event_type = user_intent.get(\"event_type\")\n", " if not location or not event_type:\n", " raise ValueError(\"Missing location or event_type.\")\n", "\n", " all_venues = []\n", " for group in venue_data:\n", " all_venues.extend(group.get(\"options\", []))\n", "\n", " transport_plan = analyze_transport_needs(user_intent, all_venues, schedule_data)\n", " vendor_types = transport_plan.get(\"vendor_types\", [])\n", " vehicle_estimates = transport_plan.get(\"vehicle_estimates\", {})\n", "\n", " vendor_recs = []\n", " for vtype in vendor_types:\n", " vendor_recs.append({\n", " \"vendor_type\": vtype,\n", " \"options\": search_vendors(location, vtype)\n", " })\n", "\n", " return {\n", " \"transport_plan\": {\n", " \"vendor_types\": vendor_types,\n", " \"vehicle_estimates\": vehicle_estimates\n", " },\n", " \"vendor_recommendations\": vendor_recs,\n", " \"parking_near_venues\": find_parking_near_venues(all_venues),\n", " \"transport_hubs\": get_nearest_transport_hubs(location)\n", " }\n", "\n", "if __name__ == \"__main__\":\n", " user_intent = extracted_intent\n", " venue_data = venue_agent(user_intent)\n", " schedule_data = scheduler_agent(user_intent)\n", " transport_output = transport_parking_agent(user_intent, venue_data, schedule_data)\n", "\n", " print(\"\\n🚗 Vehicle Estimates:\")\n", " for k, v in transport_output[\"transport_plan\"][\"vehicle_estimates\"].items():\n", " print(f\"- {k.title()}: {v}\")\n", "\n", " print(\"\\n🛻 Transport Vendors:\")\n", " for group in transport_output[\"vendor_recommendations\"]:\n", " print(f\"\\n🔹 {group['vendor_type'].title()}\")\n", " for v in group[\"options\"]:\n", " print(f\" - {v['name']} ({v['rating']}) - {v['address']}\")\n", "\n", " print(\"\\n🅿️ Parking Near Venues:\")\n", " for venue, lots in transport_output[\"parking_near_venues\"].items():\n", " print(f\"\\n{venue}\")\n", " for lot in lots:\n", " print(f\" - {lot['name']} ({lot['rating']}) - {lot['address']}\")\n", "\n", " print(\"\\n🚉 Nearest Transport Hubs:\")\n", " hubs = transport_output.get(\"transport_hubs\", {})\n", " print(f\"🛫 Airport: {hubs.get('nearest_airport', {}).get('name', 'N/A')} - {hubs.get('nearest_airport', {}).get('address', 'N/A')}\")\n", " print(f\"🚆 Railway: {hubs.get('nearest_railway_station', {}).get('name', 'N/A')} - {hubs.get('nearest_railway_station', {}).get('address', 'N/A')}\")\n", " print(f\"🚌 Bus Station: {hubs.get('nearest_bus_station', {}).get('name', 'N/A')} - {hubs.get('nearest_bus_station', {}).get('address', 'N/A')}\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "RKn7ro37eoWv", "outputId": "52dd8aea-a56d-4c2f-8ced-d0ae953aedab" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", "🧠 Determining suitable venue types for: conference\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner.\n", "Suggest the 3 most suitable types of venues for a 'conference' event.\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return only a valid JSON list like: [\"banquet hall\", \"outdoor garden\", \"conference center\"]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [\"conference center\", \"hotel ballroom\", \"university auditorium\"]\n", "✅ Parsed Final Answer: [\"conference center\", \"hotel ballroom\", \"university auditorium\"]\n", "🔎 Searching: conference center in Islamabad\n", "🔎 Searching: hotel ballroom in Islamabad\n", "🔎 Searching: university auditorium in Islamabad\n", "🧠 Prompting GPT-4o for schedule...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner. Create a high-level multi-day schedule for a conference beginning on 2025-06-13 with around 120 guests. Include major activities from arrival to departure:\n", "airport pickups, hotel check-in, meals, sessions, sightseeing in free slots, and checkout.\n", "Return the result as a Python list of dictionaries in this format:\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.[{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Hotel check-in\", \"Welcome dinner\"]}, ...]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Airport pickups\", \"Hotel check-in\", \"Welcome dinner\"]}, {\"day\": \"Day 2 - Conference Day 1\", \"activities\": [\"Breakfast\", \"Opening keynote\", \"Morning sessions\", \"Lunch\", \"Afternoon sessions\", \"Networking event\", \"Dinner\"]}, {\"day\": \"Day 3 - Conference Day 2\", \"activities\": [\"Breakfast\", \"Panel discussions\", \"Workshops\", \"Lunch\", \"Afternoon sessions\", \"Free evening for sightseeing\", \"Dinner\"]}, {\"day\": \"Day 4 - Departure\", \"activities\": [\"Breakfast\", \"Checkout\", \"Airport drop-offs\"]}]\n", "✅ Parsed Final Answer: [{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Airport pickups\", \"Hotel check-in\", \"Welcome dinner\"]}, {\"day\": \"Day 2 - Conference Day 1\", \"activities\": [\"Breakfast\", \"Opening keynote\", \"Morning sessions\", \"Lunch\", \"Afternoon sessions\", \"Networking event\", \"Dinner\"]}, {\"day\": \"Day 3 - Conference Day 2\", \"activities\": [\"Breakfast\", \"Panel discussions\", \"Workshops\", \"Lunch\", \"Afternoon sessions\", \"Free evening for sightseeing\", \"Dinner\"]}, {\"day\": \"Day 4 - Departure\", \"activities\": [\"Breakfast\", \"Checkout\", \"Airport drop-offs\"]}]\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a logistics planner. Based on this event, return:\n", "- A list of transport vendor types required\n", "- A dictionary of estimated vehicle needs by type\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return this as a Python dictionary with two keys: 'vendor_types' and 'vehicle_estimates'.\n", "Example:\n", "{\n", " \"vendor_types\": [\"shuttle service\", \"bus rental\"],\n", " \"vehicle_estimates\": {\"cars\": 3, \"shuttles\": 2, \"buses\": 1}\n", "}\n", "\n", "user_intent = {\n", " \"event_type\": \"conference\",\n", " \"location\": \"Islamabad\",\n", " \"event_date\": \"2025-06-13\",\n", " \"guest_count\": 120,\n", " \"preferences\": {\n", " \"stay_dates\": [\n", " \"2025-06-12\",\n", " \"2025-06-15\"\n", " ],\n", " \"guest_origins\": [\n", " \"Turkey\",\n", " \"Lahore\"\n", " ]\n", " },\n", " \"event_theme\": null,\n", " \"meal_count\": null,\n", " \"transport_needs\": null,\n", " \"sightseeing\": null\n", "}\n", "venues = [\n", " {\n", " \"name\": \"Jinnah Convention Centre\",\n", " \"rating\": 4.5,\n", " \"address\": \"Club Rd, Islamabad, Pakistan\",\n", " \"phone\": \"N/A\",\n", " \"website\": \"http://conventioncenter.pk/\"\n", " },\n", " {\n", " \"name\": \"Pakistan-China Friendship Center\",\n", " \"rating\": 4.5,\n", " \"address\": \"Garden Avenue\\u060c Shakarparian Rd, Islamabad, Pakistan\",\n", " \"phone\": \"N/A\",\n", " \"website\": \"http://www.pakchinacentre.pk/\"\n", " }\n", "]\n", "schedule = [\n", " {\n", " \"day\": \"Day 1 - Arrival\",\n", " \"activities\": [\n", " \"Airport pickups\",\n", " \"Hotel check-in\",\n", " \"Welcome dinner\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 2 - Conference Day 1\",\n", " \"activities\": [\n", " \"Breakfast\",\n", " \"Opening keynote\",\n", " \"Morning sessions\",\n", " \"Lunch\",\n", " \"Afternoon sessions\",\n", " \"Networking event\",\n", " \"Dinner\"\n", " ]\n", " }\n", "]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\n", " \"vendor_types\": [\"shuttle service\", \"bus rental\", \"car rental\"],\n", " \"vehicle_estimates\": {\"cars\": 5, \"shuttles\": 3, \"buses\": 1}\n", "}\n", "✅ Parsed Final Answer: {\n", " \"vendor_types\": [\"shuttle service\", \"bus rental\", \"car rental\"],\n", " \"vehicle_estimates\": {\"cars\": 5, \"shuttles\": 3, \"buses\": 1}\n", "}\n", "\n", "🚗 Vehicle Estimates:\n", "- Cars: 5\n", "- Shuttles: 3\n", "- Buses: 1\n", "\n", "🛻 Transport Vendors:\n", "\n", "🔹 Shuttle Service\n", " - Visa Seeker Shuttle Service (3.4) - P4HP+78M, 3rd Ave, Maira, Islamabad, Pakistan\n", "\n", "🔹 Bus Rental\n", " - Rent a car SHAH RIDE TOUR Islamabad Rawalpindi Daewoo stand (5) - jahngisyedaan, Service road, Gali No. 2, Jhangi Sayedan, Islamabad, 46000, Pakistan\n", " - Syed Rent A Car Islamabad || Syed Transport Dewoo Terminal Ict || Pakistan (4.8) - Office #1, Awan Market, Main Peshawar Rd, near Deawoo Bus Terminal, floor Jhangi Sayedan, Islamabad, 44000, Pakistan\n", " - Rent a car Islamabad Pakistan | EARTH Link Tours| Prado Corolla revo Vego Baxsa grand cabin coaster |luxury transport (4.9) - office num ,12 second floor, Ahmed plaza, Bela Rd, G-10 Markaz G 10 Markaz G-10, Islamabad, 44000, Pakistan\n", "\n", "🔹 Car Rental\n", " - New Pakistan Motors (4.9) - I & T Center, Plot # 135 Street 29, G-9/1 G 9/1 G-9, Islamabad, 44000, Pakistan\n", " - Car Hire Pakistan - Rent a car in Islamabad - Best rental cars in Islamabad - Cars for rent (5) - Ist Floor, Bismillah, Bismillah Plaza, OFFICE: Flat #4, Block D-10, G8 Markaz Rd, G-8 Markaz plaza, Islamabad, 44080, Pakistan\n", " - Prado For Rent in Islamabad | Rent A Car Services 247 | Prado V8 Mercedes Audi Civic BRV Corolla | Rent A Car Islamabad (4.9) - first floor, New Aabpara Arcade, Office # F-8, 1 Street Number 49, G-6, Islamabad, 44000, Pakistan\n", "\n", "🅿️ Parking Near Venues:\n", "\n", "Jinnah Convention Centre\n", " - Convention Centre Parking (4.5) - P463+MWF, Unnamed Road, Islamabad, Pakistan\n", " - Islamabad Club Parking (5) - P434+RR6, Main Murree Rd،, near Kashmir Chowk, Islamabad Club, Islamabad, Pakistan\n", " - Parking (3.8) - M4R7+MHC, ANKARA PARK, Islamabad, Pakistan\n", "\n", "Pakistan-China Friendship Center\n", " - Shakarparian Car Parking (4.4) - M3VC+F7F, Islamabad, Pakistan\n", " - Virsa Parking Lot (4.5) - M3QF+5H7, Garden Ave, Islamabad, Pakistan\n", " - Jasmine Garden Parking (4.2) - M3XP+HV8 Jasmin Garden, Islamabad, Pakistan\n", "\n", "Rehman Town Conference Center\n", " - Chongi No 26 Bus Stop (4.2) - Islamabad Homes Rd, Jhangi Sayedan, Islamabad, Pakistan\n", " - Kazmain Plaza Islamabad Sector - H 15 (4.3) - H/15, Sher Shah Suri Rd, Rehman Town Jhangi Sayedan, Islamabad, Pakistan\n", " - Sultan Ali Plaza (4.2) - JWCQ+27M, Rehman Town Jhangi Sayedan, Islamabad, Pakistan\n", "\n", "Grand Islamabad Hotel\n", " - Anjum Aqeel Palace Parking (4) - MXWG+4GP, Golra E-11, Islamabad, Pakistan\n", " - Golra Darbar (4.5) - MXRG+Q2G, Golra E-11, Islamabad, Pakistan\n", " - Parking Area Golra Darbar (4.3) - MXRG+Q8G, Golra E-11, Islamabad, Pakistan\n", "\n", "MARGALLA Hills Residency Islamabad E-11/3\n", " - MARGALLA Hills Residency Islamabad E-11/3 (4.8) - House 170-A, Street 70, MPCHS E-11/3 MPCHS E 11/3 E-11, Islamabad, 44000, Pakistan\n", "\n", "Serena Hotel\n", " - Convention Centre Parking (4.5) - P463+MWF, Unnamed Road, Islamabad, Pakistan\n", "\n", "Air University Main Auditorium\n", " - PAF Complex Main Parking (4.7) - P29G+24M, Rashid Minhas Blvd, E-9/4 E-9, Islamabad, Pakistan\n", " - AU Parking (N/A) - P27F+76M, E-9/4 E-9, Islamabad, Pakistan\n", " - Hospital parking (N/A) - P288+GV7, E-9/1 E-9, Islamabad, Pakistan\n", "\n", "Jinnah Auditorium\n", " - NSTP Parking (4.4) - JXWW+9QH, Khyber Rd, H-12, Islamabad, Pakistan\n", " - SCEE Parking (4) - JXRM+FXJ, Indus Loop, H-12, Islamabad, Pakistan\n", " - CIPS Parking (4.3) - JXVV+GCG, H-12, Islamabad, Pakistan\n", "\n", "NSU Auditorium\n", " - Parking Lot (3.5) - Rose 1 Plaza, Office No. 6, First, I-8 Markaz I 8 Markaz I-8, Islamabad, 44000, Pakistan\n", "\n", "🚉 Nearest Transport Hubs:\n", "🛫 Airport: Islamabad International Airport - New Islamabad Airport Rd, Islamabad, Pakistan\n", "🚆 Railway: Ibn-e-Sina Bay 1 - G 9/3 G-9, Islamabad, Pakistan\n", "🚌 Bus Station: Ibn-e-Sina Bay 1 - G 9/3 G-9, Islamabad, Pakistan\n" ] } ] }, { "cell_type": "markdown", "source": [ "**4.7 Site Seeing Agent**" ], "metadata": { "id": "aMSEqllzpjnq" } }, { "cell_type": "markdown", "source": [ "Then we also have to make sure that if the event is long or there is some free time available in the event schedule, we can take our guests for site seeing. So our agent will use the internet to fetch the details of good sites available in near vicinity" ], "metadata": { "id": "aVYvQ90H3KPk" } }, { "cell_type": "code", "source": [ "import os\n", "import json\n", "import ast\n", "import re\n", "import requests\n", "from agentpro import ReactAgent, create_model\n", "\n", "# ✅ Use OpenAI API Key from environment\n", "OPENAI_API_KEY = os.getenv(\"OPENAI_API_KEY\")\n", "assert OPENAI_API_KEY, \"❌ Missing OPENAI_API_KEY in environment\"\n", "\n", "# ✅ Create ReAct Agent using GPT-4o\n", "model = create_model(provider=\"openai\", model_name=\"gpt-4o\", api_key=OPENAI_API_KEY)\n", "agent = ReactAgent(model=model, tools=[])\n", "\n", "import re\n", "import json\n", "\n", "def extract_json_from_response(response):\n", " cleaned = response.strip()\n", " cleaned = re.sub(r\"```(?:json|python)?\", \"\", cleaned)\n", " cleaned = re.sub(r\"[^\\x00-\\x7F]+\", \"\", cleaned).strip()\n", " cleaned = cleaned.replace(\"“\", '\"').replace(\"”\", '\"').replace(\"‘\", \"'\").replace(\"’\", \"'\")\n", "\n", " try:\n", " return json.loads(cleaned)\n", " except json.JSONDecodeError:\n", " match = re.search(r\"(\\{.*\\}|\\[.*\\])\", cleaned, re.DOTALL)\n", " if match:\n", " try:\n", " return json.loads(match.group(0))\n", " except json.JSONDecodeError:\n", " pass\n", " raise ValueError(f\"❌ Could not extract valid JSON from LLM response:\\n{cleaned}\")\n", "\n", "def analyze_sightseeing_need(user_intent, schedule):\n", " if isinstance(schedule, dict):\n", " schedule = list(schedule.values())\n", " elif not isinstance(schedule, list):\n", " raise Exception(\"❌ Schedule must be a list or a dictionary of days.\")\n", "\n", " sample_schedule = []\n", " for entry in schedule[:2]:\n", " if isinstance(entry, dict) and 'day' in entry and 'activities' in entry:\n", " activity = entry['activities'][0] if isinstance(entry['activities'], list) else str(entry['activities'])\n", " sample_schedule.append(f\"{entry['day']}: {activity}\")\n", " schedule_snippet = \"\\n\".join(sample_schedule)\n", "\n", " prompt = (\n", " \"You are a cultural planner helping design event schedules.\\n\"\n", " \"Given the event type and a brief schedule summary, recommend whether sightseeing could be meaningfully integrated.\\n\"\n", " \"If so, suggest the type and ideal time.\\n\\n\"\n", " \"Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.\"\n", " \"Return ONLY a Python dictionary with the following keys:\\n\"\n", " \"- 'is_required' (true/false)\\n\"\n", " \"- 'sightseeing_type' (e.g. cultural, shopping, historical)\\n\"\n", " \"- 'integration_notes' (e.g. best added on Day 2 afternoon)\\n\\n\"\n", " \"Do NOT return anything else. No text. No schedule. No explanation. and no emojis\\n\"\n", " \"Example:\\n\"\n", " \"{\\n\"\n", " \" \\\"is_required\\\": true,\\n\"\n", " \" \\\"sightseeing_type\\\": \\\"Cultural\\\",\\n\"\n", " \" \\\"integration_notes\\\": \\\"Schedule it on Day 2 afternoon.\\\"\\n\"\n", " \"}\\n\\n\"\n", " \"IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\"\n", " f\"Event type: {user_intent.get('event_type')}\\n\"\n", " f\"Schedule summary:\\n{schedule_snippet}\"\n", " )\n", "\n", " response = agent.run(prompt)\n", " return extract_json_from_response(response.final_answer)\n", "\n", "def get_sightseeing_places(location, theme=\"cultural\", limit=5):\n", " url = \"https://maps.googleapis.com/maps/api/place/textsearch/json\"\n", " params = {\n", " \"query\": f\"{theme} attractions near {location}\",\n", " \"key\": os.getenv(\"GOOGLE_API_KEY\")\n", " }\n", " res = requests.get(url, params=params).json()\n", " results = res.get(\"results\", [])[:limit]\n", "\n", " return [{\n", " \"name\": r.get(\"name\"),\n", " \"rating\": r.get(\"rating\", \"N/A\"),\n", " \"address\": r.get(\"formatted_address\"),\n", " \"type\": theme,\n", " \"description\": r.get(\"types\", [])\n", " } for r in results]\n", "\n", "def sightseeing_agent(user_intent, schedule_data):\n", " location = user_intent.get(\"location\")\n", " if not location:\n", " raise ValueError(\"Location not specified in user intent.\")\n", "\n", " analysis = analyze_sightseeing_need(user_intent, schedule_data)\n", "\n", " if not analysis.get(\"is_required\", False):\n", " return {\n", " \"is_required\": False,\n", " \"reason\": analysis.get(\"reason\", \"LLM suggested sightseeing is not appropriate.\")\n", " }\n", "\n", " theme = analysis.get(\"sightseeing_type\", \"cultural\")\n", " places = get_sightseeing_places(location, theme)\n", "\n", " return {\n", " \"is_required\": True,\n", " \"sightseeing_type\": theme,\n", " \"integration_notes\": analysis.get(\"integration_notes\", \"\"),\n", " \"suggested_places\": places\n", " }\n", "\n", "if __name__ == \"__main__\":\n", " user_intent = extracted_intent\n", " schedule_data = scheduler_agent(user_intent)\n", " sightseeing = sightseeing_agent(user_intent, schedule_data)\n", "\n", " if not sightseeing[\"is_required\"]:\n", " print(\"❌ Sightseeing not included:\")\n", " print(\"Reason:\", sightseeing.get(\"reason\"))\n", " else:\n", " print(\"\\n✅ Sightseeing Included!\")\n", " print(\"Type:\", sightseeing[\"sightseeing_type\"])\n", " print(\"When:\", sightseeing[\"integration_notes\"])\n", " print(\"\\n📍 Suggested Places:\")\n", " for s in sightseeing[\"suggested_places\"]:\n", " print(f\"- {s['name']} ({s['rating']}) — {s['address']}\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "z6icig12plFi", "outputId": "60b8f295-d4d8-47ef-b783-61f15db9d566" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "🧠 Prompting GPT-4o for schedule...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner. Create a high-level multi-day schedule for a conference beginning on 2025-06-13 with around 120 guests. Include major activities from arrival to departure:\n", "airport pickups, hotel check-in, meals, sessions, sightseeing in free slots, and checkout.\n", "Return the result as a Python list of dictionaries in this format:\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.[{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Hotel check-in\", \"Welcome dinner\"]}, ...]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Airport pickups\", \"Hotel check-in\", \"Welcome dinner\"]}, {\"day\": \"Day 2 - Conference\", \"activities\": [\"Breakfast\", \"Opening keynote session\", \"Networking lunch\", \"Afternoon breakout sessions\", \"Dinner\"]}, {\"day\": \"Day 3 - Conference and Sightseeing\", \"activities\": [\"Breakfast\", \"Morning sessions\", \"Lunch\", \"Sightseeing tour in the afternoon\", \"Dinner\"]}, {\"day\": \"Day 4 - Conference and Departure\", \"activities\": [\"Breakfast\", \"Closing session\", \"Hotel checkout\", \"Airport drop-offs\"]}]\n", "✅ Parsed Final Answer: [{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Airport pickups\", \"Hotel check-in\", \"Welcome dinner\"]}, {\"day\": \"Day 2 - Conference\", \"activities\": [\"Breakfast\", \"Opening keynote session\", \"Networking lunch\", \"Afternoon breakout sessions\", \"Dinner\"]}, {\"day\": \"Day 3 - Conference and Sightseeing\", \"activities\": [\"Breakfast\", \"Morning sessions\", \"Lunch\", \"Sightseeing tour in the afternoon\", \"Dinner\"]}, {\"day\": \"Day 4 - Conference and Departure\", \"activities\": [\"Breakfast\", \"Closing session\", \"Hotel checkout\", \"Airport drop-offs\"]}]\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a cultural planner helping design event schedules.\n", "Given the event type and a brief schedule summary, recommend whether sightseeing could be meaningfully integrated.\n", "If so, suggest the type and ideal time.\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return ONLY a Python dictionary with the following keys:\n", "- 'is_required' (true/false)\n", "- 'sightseeing_type' (e.g. cultural, shopping, historical)\n", "- 'integration_notes' (e.g. best added on Day 2 afternoon)\n", "\n", "Do NOT return anything else. No text. No schedule. No explanation. and no emojis\n", "Example:\n", "{\n", " \"is_required\": true,\n", " \"sightseeing_type\": \"Cultural\",\n", " \"integration_notes\": \"Schedule it on Day 2 afternoon.\"\n", "}\n", "\n", "IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.Event type: conference\n", "Schedule summary:\n", "Day 1 - Arrival: Airport pickups\n", "Day 2 - Conference: Breakfast\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"is_required\": true, \"sightseeing_type\": \"Cultural\", \"integration_notes\": \"Schedule it on Day 2 afternoon after the conference.\"}\n", "✅ Parsed Final Answer: {\"is_required\": true, \"sightseeing_type\": \"Cultural\", \"integration_notes\": \"Schedule it on Day 2 afternoon after the conference.\"}\n", "\n", "✅ Sightseeing Included!\n", "Type: Cultural\n", "When: Schedule it on Day 2 afternoon after the conference.\n", "\n", "📍 Suggested Places:\n", "- Lok Virsa Heritage Museum (4.6) — Garden Avenue, Shakarparian Rd, Islamabad, Pakistan\n", "- Pakistan Monument Museum (4.6) — M3V9+2Q9, Srinagar Hwy, Islamabad, Pakistan\n", "- Pakistan Monument (4.6) — M3V9+2Q9 Shakarparian Hills, Srinagar Hwy, Islamabad, Pakistan\n", "- Islamabad Museum (4.3) — P39W+MMP, 19 Ataturk Ave, G-5/1 G-5, Islamabad, Pakistan\n", "- Shah Allah Ditta Caves (4.4) — PWC8+R3C, Road, Shah Allah Ditta Islamabad, 44000, Pakistan\n" ] } ] }, { "cell_type": "markdown", "source": [ "**4.8 Catering Agent**" ], "metadata": { "id": "yHuOPN3dXdUv" } }, { "cell_type": "markdown", "source": [ "So here comes the most important task in the event, especially in Pakistan.. How to select the best menu and who will provide it 3 times a day... So i have made my custom tool for this as well... The meal planner tool... It will be used to get the menu and find the catereres available with the best reputation." ], "metadata": { "id": "N6Aq70CyzOQh" } }, { "cell_type": "code", "source": [ "import sys\n", "import os\n", "import json\n", "import requests\n", "\n", "# AgentPro setup\n", "sys.path.insert(0, \"/content/AgentPro\")\n", "from agentpro import ReactAgent, create_model\n", "from agentpro.tools import MealPlannerTool\n", "\n", "# Load keys from environment\n", "GOOGLE_API_KEY = os.environ[\"GOOGLE_API_KEY\"]\n", "OPENAI_API_KEY = os.environ[\"OPENAI_API_KEY\"]\n", "\n", "# Create model and agent\n", "model = create_model(provider=\"openai\", model_name=\"gpt-4o\", api_key=OPENAI_API_KEY)\n", "meal_tool = MealPlannerTool()\n", "agent = ReactAgent(model=model, tools=[meal_tool])\n", "def extract_json_from_response(response):\n", " cleaned = response.strip()\n", " cleaned = re.sub(r\"```(?:json|python)?\", \"\", cleaned)\n", " cleaned = re.sub(r\"[^\\x00-\\x7F]+\", \"\", cleaned).strip()\n", " cleaned = cleaned.replace(\"“\", '\"').replace(\"”\", '\"').replace(\"‘\", \"'\").replace(\"’\", \"'\")\n", "\n", " try:\n", " return json.loads(cleaned)\n", " except json.JSONDecodeError:\n", " match = re.search(r\"(\\{.*\\}|\\[.*\\])\", cleaned, re.DOTALL)\n", " if match:\n", " try:\n", " return json.loads(match.group(0))\n", " except json.JSONDecodeError:\n", " pass\n", " raise ValueError(f\"❌ Could not extract valid JSON from LLM response:\\n{cleaned}\")\n", "\n", "# 🎯 Main catering agent logic\n", "def catering_agent(user_intent, schedule):\n", " location = user_intent.get(\"location\", \"\")\n", " if not location:\n", " raise ValueError(\"❌ Location missing in user intent.\")\n", "\n", " # Run tool via ReAct agent\n", " llm_input = {\n", " \"event_type\": user_intent.get(\"event_type\", \"event\"),\n", " \"location\": location,\n", " \"schedule\": schedule\n", " }\n", "\n", " print(\"🧠 Calling MealPlannerTool via ReAct agent...\")\n", " response = agent.run(\n", " f\"Use the meal planner tool to suggest an appropriate structured meal plan for the event in {location} based on the schedule.\"\n", " f\" Use the schedule and intent below:\\n\\n{json.dumps(llm_input, indent=2)}\"\n", " f\"IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\"\n", " )\n", "\n", " if isinstance(response.final_answer, dict):\n", " meal_plan = response.final_answer.get(\"meal_plan\", response.final_answer)\n", " else:\n", " # fallback for formatted string meal plan\n", " meal_plan = response.final_answer\n", "\n", "\n", " # 🔍 Use Google Places to find caterers\n", " caterer_recommendations = {}\n", " for meal in [\"breakfast\", \"lunch\", \"dinner\"]: # Simplified; can use meal_plan keys\n", " vendors = search_caterers(location, meal)\n", " caterer_recommendations[meal] = vendors\n", "\n", " return {\n", " \"catering_plan\": meal_plan,\n", " \"caterer_recommendations\": caterer_recommendations\n", " }\n", "\n", "# 📍 Google Places search\n", "def search_caterers(location, meal_type, limit=3):\n", " url = \"https://maps.googleapis.com/maps/api/place/textsearch/json\"\n", " params = {\n", " \"query\": f\"{meal_type} catering near {location}\",\n", " \"key\": GOOGLE_API_KEY\n", " }\n", " res = requests.get(url, params=params).json()\n", " results = res.get(\"results\", [])[:limit]\n", "\n", " caterers = []\n", " for r in results:\n", " place_id = r.get(\"place_id\")\n", " detail_url = \"https://maps.googleapis.com/maps/api/place/details/json\"\n", " detail_params = {\n", " \"place_id\": place_id,\n", " \"fields\": \"name,rating,formatted_address,formatted_phone_number,website\",\n", " \"key\": GOOGLE_API_KEY\n", " }\n", " d = requests.get(detail_url, params=detail_params).json().get(\"result\", {})\n", " caterers.append({\n", " \"name\": d.get(\"name\"),\n", " \"rating\": d.get(\"rating\", \"N/A\"),\n", " \"address\": d.get(\"formatted_address\"),\n", " \"phone\": d.get(\"formatted_phone_number\", \"N/A\"),\n", " \"website\": d.get(\"website\", \"N/A\")\n", " })\n", "\n", " return caterers\n", "\n", "# 🧪 Example usage\n", "if __name__ == \"__main__\":\n", " user_intent = extracted_intent\n", " schedule = scheduler_agent(user_intent)\n", "\n", " print(\"\\n🍽️ Running Catering Agent...\")\n", " catering_result = catering_agent(user_intent, schedule)\n", "\n", " print(\"\\n🧾 Catering Plan:\")\n", " print(json.dumps(catering_result[\"catering_plan\"], indent=2))\n", "\n", " print(\"\\n👨‍🍳 Caterer Recommendations:\")\n", " for meal, vendors in catering_result[\"caterer_recommendations\"].items():\n", " print(f\"\\n🍴 {meal.title()}:\")\n", " for v in vendors:\n", " print(f\" - {v['name']} ({v['rating']})\")\n", " print(f\" 📍 {v['address']}\")\n", " print(f\" ☎️ {v['phone']}\")\n", " print(f\" 🌐 {v['website']}\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "myagM43gXfKP", "outputId": "58cd34bd-22c9-4aa3-ca29-0256664f3b84" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "🧠 Prompting GPT-4o for schedule...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: generate_meal_plan\n", "\n", "Tool: Meal Planner Tool\n", "Description: Generates a detailed meal plan for any event based on event type, location, and schedule.\n", "Action Type: generate_meal_plan\n", "Input Format: Dict with keys: 'event_type', 'location', and 'schedule'.\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner. Create a high-level multi-day schedule for a conference beginning on 2025-06-13 with around 120 guests. Include major activities from arrival to departure:\n", "airport pickups, hotel check-in, meals, sessions, sightseeing in free slots, and checkout.\n", "Return the result as a Python list of dictionaries in this format:\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.[{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Hotel check-in\", \"Welcome dinner\"]}, ...]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Thought: To create a comprehensive multi-day schedule for the conference, I need to outline key activities for each day, including arrival, conference sessions, meals, sightseeing, and departure. I will structure this information in a list of dictionaries, ensuring that each day is clearly defined with its respective activities.\n", "\n", "Final Answer: [{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Airport pickups\", \"Hotel check-in\", \"Welcome dinner\"]}, {\"day\": \"Day 2 - Conference\", \"activities\": [\"Breakfast at hotel\", \"Opening keynote session\", \"Panel discussions\", \"Networking lunch\", \"Breakout sessions\", \"Dinner at local restaurant\"]}, {\"day\": \"Day 3 - Conference & Sightseeing\", \"activities\": [\"Breakfast at hotel\", \"Workshops\", \"Networking lunch\", \"City sightseeing tour\", \"Dinner cruise\"]}, {\"day\": \"Day 4 - Conference\", \"activities\": [\"Breakfast at hotel\", \"Roundtable discussions\", \"Lunch at conference venue\", \"Closing remarks\", \"Gala dinner\"]}, {\"day\": \"Day 5 - Departure\", \"activities\": [\"Breakfast at hotel\", \"Hotel check-out\", \"Airport drop-offs\"]}]\n", "✅ Parsed Thought: To create a comprehensive multi-day schedule for the conference, I need to outline key activities for each day, including arrival, conference sessions, meals, sightseeing, and departure. I will structure this information in a list of dictionaries, ensuring that each day is clearly defined with its respective activities.\n", "✅ Parsed Final Answer: [{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Airport pickups\", \"Hotel check-in\", \"Welcome dinner\"]}, {\"day\": \"Day 2 - Conference\", \"activities\": [\"Breakfast at hotel\", \"Opening keynote session\", \"Panel discussions\", \"Networking lunch\", \"Breakout sessions\", \"Dinner at local restaurant\"]}, {\"day\": \"Day 3 - Conference & Sightseeing\", \"activities\": [\"Breakfast at hotel\", \"Workshops\", \"Networking lunch\", \"City sightseeing tour\", \"Dinner cruise\"]}, {\"day\": \"Day 4 - Conference\", \"activities\": [\"Breakfast at hotel\", \"Roundtable discussions\", \"Lunch at conference venue\", \"Closing remarks\", \"Gala dinner\"]}, {\"day\": \"Day 5 - Departure\", \"activities\": [\"Breakfast at hotel\", \"Hotel check-out\", \"Airport drop-offs\"]}]\n", "\n", "🍽️ Running Catering Agent...\n", "🧠 Calling MealPlannerTool via ReAct agent...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: generate_meal_plan\n", "\n", "Tool: Meal Planner Tool\n", "Description: Generates a detailed meal plan for any event based on event type, location, and schedule.\n", "Action Type: generate_meal_plan\n", "Input Format: Dict with keys: 'event_type', 'location', and 'schedule'.\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: Use the meal planner tool to suggest an appropriate structured meal plan for the event in Islamabad based on the schedule. Use the schedule and intent below:\n", "\n", "{\n", " \"event_type\": \"conference\",\n", " \"location\": \"Islamabad\",\n", " \"schedule\": [\n", " {\n", " \"day\": \"Day 1 - Arrival\",\n", " \"activities\": [\n", " \"Airport pickups\",\n", " \"Hotel check-in\",\n", " \"Welcome dinner\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 2 - Conference\",\n", " \"activities\": [\n", " \"Breakfast at hotel\",\n", " \"Opening keynote session\",\n", " \"Panel discussions\",\n", " \"Networking lunch\",\n", " \"Breakout sessions\",\n", " \"Dinner at local restaurant\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 3 - Conference & Sightseeing\",\n", " \"activities\": [\n", " \"Breakfast at hotel\",\n", " \"Workshops\",\n", " \"Networking lunch\",\n", " \"City sightseeing tour\",\n", " \"Dinner cruise\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 4 - Conference\",\n", " \"activities\": [\n", " \"Breakfast at hotel\",\n", " \"Roundtable discussions\",\n", " \"Lunch at conference venue\",\n", " \"Closing remarks\",\n", " \"Gala dinner\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 5 - Departure\",\n", " \"activities\": [\n", " \"Breakfast at hotel\",\n", " \"Hotel check-out\",\n", " \"Airport drop-offs\"\n", " ]\n", " }\n", " ]\n", "}IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"event_type\":\"conference\",\"location\":\"Islamabad\",\"schedule\":[{\"day\":\"Day 1 - Arrival\",\"activities\":[\"Airport pickups\",\"Hotel check-in\",\"Welcome dinner\"],\"meals\":[\"Welcome dinner at hotel featuring local Pakistani cuisine\"]},{\"day\":\"Day 2 - Conference\",\"activities\":[\"Breakfast at hotel\",\"Opening keynote session\",\"Panel discussions\",\"Networking lunch\",\"Breakout sessions\",\"Dinner at local restaurant\"],\"meals\":[\"Breakfast buffet at hotel with continental and local options\",\"Networking lunch with buffet-style international and local dishes\",\"Dinner at a local restaurant featuring traditional Pakistani dishes\"]},{\"day\":\"Day 3 - Conference & Sightseeing\",\"activities\":[\"Breakfast at hotel\",\"Workshops\",\"Networking lunch\",\"City sightseeing tour\",\"Dinner cruise\"],\"meals\":[\"Breakfast buffet at hotel with continental and local options\",\"Networking lunch with a focus on healthy, light dishes\",\"Dinner cruise with a menu featuring seafood and international cuisine\"]},{\"day\":\"Day 4 - Conference\",\"activities\":[\"Breakfast at hotel\",\"Roundtable discussions\",\"Lunch at conference venue\",\"Closing remarks\",\"Gala dinner\"],\"meals\":[\"Breakfast buffet at hotel with continental and local options\",\"Lunch at conference venue offering a variety of international dishes\",\"Gala dinner featuring a multi-course meal with a mix of international and traditional Pakistani dishes\"]},{\"day\":\"Day 5 - Departure\",\"activities\":[\"Breakfast at hotel\",\"Hotel check-out\",\"Airport drop-offs\"],\"meals\":[\"Breakfast buffet at hotel with continental and local options\"]}]}\n", "✅ Parsed Final Answer: {\"event_type\":\"conference\",\"location\":\"Islamabad\",\"schedule\":[{\"day\":\"Day 1 - Arrival\",\"activities\":[\"Airport pickups\",\"Hotel check-in\",\"Welcome dinner\"],\"meals\":[\"Welcome dinner at hotel featuring local Pakistani cuisine\"]},{\"day\":\"Day 2 - Conference\",\"activities\":[\"Breakfast at hotel\",\"Opening keynote session\",\"Panel discussions\",\"Networking lunch\",\"Breakout sessions\",\"Dinner at local restaurant\"],\"meals\":[\"Breakfast buffet at hotel with continental and local options\",\"Networking lunch with buffet-style international and local dishes\",\"Dinner at a local restaurant featuring traditional Pakistani dishes\"]},{\"day\":\"Day 3 - Conference & Sightseeing\",\"activities\":[\"Breakfast at hotel\",\"Workshops\",\"Networking lunch\",\"City sightseeing tour\",\"Dinner cruise\"],\"meals\":[\"Breakfast buffet at hotel with continental and local options\",\"Networking lunch with a focus on healthy, light dishes\",\"Dinner cruise with a menu featuring seafood and international cuisine\"]},{\"day\":\"Day 4 - Conference\",\"activities\":[\"Breakfast at hotel\",\"Roundtable discussions\",\"Lunch at conference venue\",\"Closing remarks\",\"Gala dinner\"],\"meals\":[\"Breakfast buffet at hotel with continental and local options\",\"Lunch at conference venue offering a variety of international dishes\",\"Gala dinner featuring a multi-course meal with a mix of international and traditional Pakistani dishes\"]},{\"day\":\"Day 5 - Departure\",\"activities\":[\"Breakfast at hotel\",\"Hotel check-out\",\"Airport drop-offs\"],\"meals\":[\"Breakfast buffet at hotel with continental and local options\"]}]}\n", "\n", "🧾 Catering Plan:\n", "\"{\\\"event_type\\\":\\\"conference\\\",\\\"location\\\":\\\"Islamabad\\\",\\\"schedule\\\":[{\\\"day\\\":\\\"Day 1 - Arrival\\\",\\\"activities\\\":[\\\"Airport pickups\\\",\\\"Hotel check-in\\\",\\\"Welcome dinner\\\"],\\\"meals\\\":[\\\"Welcome dinner at hotel featuring local Pakistani cuisine\\\"]},{\\\"day\\\":\\\"Day 2 - Conference\\\",\\\"activities\\\":[\\\"Breakfast at hotel\\\",\\\"Opening keynote session\\\",\\\"Panel discussions\\\",\\\"Networking lunch\\\",\\\"Breakout sessions\\\",\\\"Dinner at local restaurant\\\"],\\\"meals\\\":[\\\"Breakfast buffet at hotel with continental and local options\\\",\\\"Networking lunch with buffet-style international and local dishes\\\",\\\"Dinner at a local restaurant featuring traditional Pakistani dishes\\\"]},{\\\"day\\\":\\\"Day 3 - Conference & Sightseeing\\\",\\\"activities\\\":[\\\"Breakfast at hotel\\\",\\\"Workshops\\\",\\\"Networking lunch\\\",\\\"City sightseeing tour\\\",\\\"Dinner cruise\\\"],\\\"meals\\\":[\\\"Breakfast buffet at hotel with continental and local options\\\",\\\"Networking lunch with a focus on healthy, light dishes\\\",\\\"Dinner cruise with a menu featuring seafood and international cuisine\\\"]},{\\\"day\\\":\\\"Day 4 - Conference\\\",\\\"activities\\\":[\\\"Breakfast at hotel\\\",\\\"Roundtable discussions\\\",\\\"Lunch at conference venue\\\",\\\"Closing remarks\\\",\\\"Gala dinner\\\"],\\\"meals\\\":[\\\"Breakfast buffet at hotel with continental and local options\\\",\\\"Lunch at conference venue offering a variety of international dishes\\\",\\\"Gala dinner featuring a multi-course meal with a mix of international and traditional Pakistani dishes\\\"]},{\\\"day\\\":\\\"Day 5 - Departure\\\",\\\"activities\\\":[\\\"Breakfast at hotel\\\",\\\"Hotel check-out\\\",\\\"Airport drop-offs\\\"],\\\"meals\\\":[\\\"Breakfast buffet at hotel with continental and local options\\\"]}]}\"\n", "\n", "👨‍🍳 Caterer Recommendations:\n", "\n", "🍴 Breakfast:\n", " - Loafology Bakery & Cafe (4.3)\n", " 📍 108-W Jinnah Ave, Area G 7/2 Blue، Islamabad, 44000, Pakistan\n", " ☎️ (051) 2804240\n", " 🌐 https://www.loafology.com/\n", " - Bistro Noir Islamabad (4.5)\n", " 📍 Gol Market, Street 4, F-7/3 F 7/3 F-7, Islamabad, Pakistan\n", " ☎️ 0300 1888768\n", " 🌐 N/A\n", " - Eggspectation Restaurant Cafe (4.5)\n", " 📍 P3PH+683, Street 10, F-6/3 F 6/3 F-6, Islamabad, 44000, Pakistan\n", " ☎️ 0300 1707808\n", " 🌐 http://www.egggspectation.pk/\n", "\n", "🍴 Lunch:\n", " - Tandoori Caterers & Event Management (4.9)\n", " 📍 Shop no. 11, 20A, Jasmine Plaza, G8 Markaz Rd, G-8 Markaz G 8 Markaz G-8, Islamabad, 44000, Pakistan\n", " ☎️ 0300 5095090\n", " 🌐 https://tandoorirestaurants.pk/tandoori-catering/\n", " - Hanif Rajput RoofTop Grill (4.4)\n", " 📍 6th Floor, Karachi Company, PAK CHINA MALL, Mangla Rd, Markaz G 9 Markaz G-9, Islamabad, 44090, Pakistan\n", " ☎️ 0317 7770989\n", " 🌐 https://www.hanifrajputgrill.com/\n", " - Naveed Caterers & Event Management (5)\n", " 📍 Office#5, First Floor, Victory Tower, F-8 Markaz F 8 Markaz F-8, Islamabad, 44220, Pakistan\n", " ☎️ 0321 5151972\n", " 🌐 http://www.naveedcaterers.pk/\n", "\n", "🍴 Dinner:\n", " - Tandoori Caterers & Event Management (4.9)\n", " 📍 Shop no. 11, 20A, Jasmine Plaza, G8 Markaz Rd, G-8 Markaz G 8 Markaz G-8, Islamabad, 44000, Pakistan\n", " ☎️ 0300 5095090\n", " 🌐 https://tandoorirestaurants.pk/tandoori-catering/\n", " - Capital Caterers & Decorators | Catering Services & Event Planner (4.8)\n", " 📍 Pacific Centre Shop 1 & 2, Ground Floor, Pacific Center, Pacific Center, Johar Rd, F-8 Markaz F 8 Markaz F-8, Islamabad, 44000, Pakistan\n", " ☎️ 0300 5279004\n", " 🌐 https://capitalcaterer.com/\n", " - Hanif Rajput RoofTop Grill (4.4)\n", " 📍 6th Floor, Karachi Company, PAK CHINA MALL, Mangla Rd, Markaz G 9 Markaz G-9, Islamabad, 44090, Pakistan\n", " ☎️ 0317 7770989\n", " 🌐 https://www.hanifrajputgrill.com/\n" ] } ] }, { "cell_type": "markdown", "source": [ "**4.9 Event Theme Agent**" ], "metadata": { "id": "noz_eqfmqBPD" } }, { "cell_type": "markdown", "source": [ "The selection of event theme is also a tidious task and then what all items are required to be purchased like penaflaxes and all.. So we have an agent which will recommend a theme, design what all are required and then will suggest the vendors available in the city as well.. All we need is to make few calls and the task will be done" ], "metadata": { "id": "xw441Beo3hWM" } }, { "cell_type": "code", "source": [ "import os\n", "import json\n", "import ast\n", "import re\n", "import requests\n", "from agentpro import ReactAgent, create_model\n", "\n", "# ✅ Use OpenAI API Key\n", "OPENAI_API_KEY = os.getenv(\"OPENAI_API_KEY\")\n", "assert OPENAI_API_KEY, \"❌ Missing OPENAI_API_KEY in environment\"\n", "\n", "# ✅ Create ReAct Agent using GPT-4o\n", "model = create_model(provider=\"openai\", model_name=\"gpt-4o\", api_key=OPENAI_API_KEY)\n", "agent = ReactAgent(model=model, tools=[])\n", "\n", "\n", "def extract_json_from_response(response):\n", " cleaned = response.strip()\n", " cleaned = re.sub(r\"```(?:json|python)?\", \"\", cleaned)\n", " cleaned = re.sub(r\"[^\\x00-\\x7F]+\", \"\", cleaned).strip()\n", " cleaned = cleaned.replace(\"“\", '\"').replace(\"”\", '\"').replace(\"‘\", \"'\").replace(\"’\", \"'\")\n", "\n", " try:\n", " return json.loads(cleaned)\n", " except json.JSONDecodeError:\n", " match = re.search(r\"(\\{.*\\}|\\[.*\\])\", cleaned, re.DOTALL)\n", " if match:\n", " try:\n", " return json.loads(match.group(0))\n", " except json.JSONDecodeError:\n", " pass\n", " raise ValueError(f\"❌ Could not extract valid JSON from LLM response:\\n{cleaned}\")\n", "\n", "\n", "\n", "def get_vendor_details(query, location, limit=3):\n", " url = \"https://maps.googleapis.com/maps/api/place/textsearch/json\"\n", " params = {\n", " \"query\": f\"{query} near {location}\",\n", " \"key\": os.getenv(\"GOOGLE_API_KEY\")\n", " }\n", " res = requests.get(url, params=params).json()\n", " results = res.get(\"results\", [])[:limit]\n", "\n", " vendors = []\n", " for r in results:\n", " place_id = r.get(\"place_id\")\n", " details_url = \"https://maps.googleapis.com/maps/api/place/details/json\"\n", " details_params = {\n", " \"place_id\": place_id,\n", " \"fields\": \"name,rating,formatted_address,formatted_phone_number,website\",\n", " \"key\": os.getenv(\"GOOGLE_API_KEY\")\n", " }\n", " details = requests.get(details_url, params=details_params).json().get(\"result\", {})\n", " vendors.append({\n", " \"name\": details.get(\"name\"),\n", " \"address\": details.get(\"formatted_address\"),\n", " \"phone\": details.get(\"formatted_phone_number\", \"N/A\"),\n", " \"website\": details.get(\"website\", \"N/A\"),\n", " \"rating\": details.get(\"rating\", \"N/A\"),\n", " \"type\": query\n", " })\n", " return vendors\n", "\n", "def analyze_theme(user_intent):\n", " prompt = (\n", " \"You are a creative event theme planner. Based on the event intent below, suggest a detailed event theme plan.\\n\"\n", " \"Include:\\n\"\n", " \"1. A creative theme name and style\\n\"\n", " \"2. A list of decor elements needed (like penaflex, stage, lighting, florals)\\n\"\n", " \"3. Any custom branding or stage setup suggestions\\n\"\n", " \"Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.\"\n", " \"Return as a JSON dictionary with keys: theme_name, style_description, required_elements, branding_notes.\\n\"\n", " \"IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\"\n", " f\"user_intent = {json.dumps(user_intent, indent=2)}\"\n", " )\n", " response = agent.run(prompt)\n", " return extract_json_from_response(response.final_answer)\n", "\n", "def theme_agent(user_intent):\n", " location = user_intent.get(\"location\")\n", " if not location:\n", " raise ValueError(\"Location not found in user intent\")\n", "\n", " theme_plan = analyze_theme(user_intent)\n", "\n", " required_elements = theme_plan.get(\"required_elements\", [])\n", " if isinstance(required_elements, dict):\n", " required_elements = [item.get(\"item\") for item in required_elements.get(\"decor\", []) if item.get(\"item\")]\n", "\n", " vendor_list = []\n", " for item in required_elements:\n", " vendor_list.extend(get_vendor_details(item, location))\n", "\n", " return {\n", " \"recommended\": {\n", " \"theme_name\": theme_plan.get(\"theme_name\"),\n", " \"style_description\": theme_plan.get(\"style_description\"),\n", " \"branding_notes\": theme_plan.get(\"branding_notes\", \"\"),\n", " \"required_elements\": required_elements\n", " },\n", " \"alternates\": [],\n", " \"vendors\": vendor_list\n", " }\n", "\n", "if __name__ == \"__main__\":\n", " user_intent = extracted_intent\n", " print(\"\\n🎨 Generating Event Theme Plan...\")\n", " theme_output = theme_agent(user_intent)\n", "\n", " recommended = theme_output[\"recommended\"]\n", "\n", " print(f\"\\n🎭 Theme Name: {recommended['theme_name']}\")\n", " print(f\"🕋️ Description: {recommended['style_description']}\")\n", " print(f\"🧾 Branding Notes: {recommended['branding_notes']}\")\n", " print(f\"\\n🛠️ Required Decor Elements:\")\n", " for e in recommended['required_elements']:\n", " print(f\"- {e}\")\n", "\n", " print(f\"\\n🏢 Vendor Recommendations:\")\n", " for v in theme_output['vendors']:\n", " print(f\"\\n🔹 {v['type'].title()} Vendor\")\n", " print(f\" Name: {v['name']}\")\n", " print(f\" 📍 Address: {v['address']}\")\n", " print(f\" ☎️ Phone: {v['phone']}\")\n", " print(f\" 🌐 Website: {v['website']}\")\n", " print(f\" ⭐ Rating: {v['rating']}\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "-zWz1nxjqCWv", "outputId": "c39c6748-0e9d-44aa-aa87-3726e36fdc60" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", "🎨 Generating Event Theme Plan...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a creative event theme planner. Based on the event intent below, suggest a detailed event theme plan.\n", "Include:\n", "1. A creative theme name and style\n", "2. A list of decor elements needed (like penaflex, stage, lighting, florals)\n", "3. Any custom branding or stage setup suggestions\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return as a JSON dictionary with keys: theme_name, style_description, required_elements, branding_notes.\n", "IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.user_intent = {\n", " \"event_type\": \"conference\",\n", " \"location\": \"Islamabad\",\n", " \"event_date\": \"2025-06-13\",\n", " \"guest_count\": 120,\n", " \"preferences\": {\n", " \"stay_dates\": [\n", " \"2025-06-12\",\n", " \"2025-06-15\"\n", " ],\n", " \"guest_origins\": [\n", " \"Turkey\",\n", " \"Lahore\"\n", " ]\n", " },\n", " \"event_theme\": null,\n", " \"meal_count\": null,\n", " \"transport_needs\": null,\n", " \"sightseeing\": null\n", "}\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"theme_name\": \"Cultural Confluence Conference\",\"style_description\": \"A vibrant blend of Turkish and Pakistani cultures, emphasizing unity and collaboration in a modern setting.\",\"required_elements\": [\"Penaflex with conference branding and cultural motifs\",\"Stage with backdrop featuring Turkish and Pakistani landmarks\",\"Warm ambient lighting with accents of blue and green\",\"Floral arrangements with tulips and jasmine\",\"Seating arrangements with cultural textiles\",\"Information kiosks with digital screens for interactive sessions\"],\"branding_notes\": \"Incorporate traditional patterns from both cultures into the conference logo and stage design. Use a motif that symbolizes connection and partnership, like interlocking patterns or a bridge design.\"}\n", "✅ Parsed Final Answer: {\"theme_name\": \"Cultural Confluence Conference\",\"style_description\": \"A vibrant blend of Turkish and Pakistani cultures, emphasizing unity and collaboration in a modern setting.\",\"required_elements\": [\"Penaflex with conference branding and cultural motifs\",\"Stage with backdrop featuring Turkish and Pakistani landmarks\",\"Warm ambient lighting with accents of blue and green\",\"Floral arrangements with tulips and jasmine\",\"Seating arrangements with cultural textiles\",\"Information kiosks with digital screens for interactive sessions\"],\"branding_notes\": \"Incorporate traditional patterns from both cultures into the conference logo and stage design. Use a motif that symbolizes connection and partnership, like interlocking patterns or a bridge design.\"}\n", "\n", "🎭 Theme Name: Cultural Confluence Conference\n", "🕋️ Description: A vibrant blend of Turkish and Pakistani cultures, emphasizing unity and collaboration in a modern setting.\n", "🧾 Branding Notes: Incorporate traditional patterns from both cultures into the conference logo and stage design. Use a motif that symbolizes connection and partnership, like interlocking patterns or a bridge design.\n", "\n", "🛠️ Required Decor Elements:\n", "- Penaflex with conference branding and cultural motifs\n", "- Stage with backdrop featuring Turkish and Pakistani landmarks\n", "- Warm ambient lighting with accents of blue and green\n", "- Floral arrangements with tulips and jasmine\n", "- Seating arrangements with cultural textiles\n", "- Information kiosks with digital screens for interactive sessions\n", "\n", "🏢 Vendor Recommendations:\n", "\n", "🔹 Penaflex With Conference Branding And Cultural Motifs Vendor\n", " Name: Panaflex Printing Islamabad\n", " 📍 Address: Landmark 1 plaza، Street 44, Markaz SCHS E 11/2 ای - ۱۱، اسلام آباد, 44000, Pakistan\n", " ☎️ Phone: 0315 6703330\n", " 🌐 Website: http://www.hrgroupisb.com/\n", " ⭐ Rating: 4.9\n", "\n", "🔹 Penaflex With Conference Branding And Cultural Motifs Vendor\n", " Name: ADM Sign & Panaflex Printing Islamabad\n", " 📍 Address: F-11/1 Street, 02 Service Rd W, near Paint & Hardware, F-11/1 F 11/1 F-11, Islamabad, 45200, Pakistan\n", " ☎️ Phone: 0334 3339491\n", " 🌐 Website: N/A\n", " ⭐ Rating: 5\n", "\n", "🔹 Penaflex With Conference Branding And Cultural Motifs Vendor\n", " Name: Caprico Creations (SMC-PVT.) LTD Best Marketing, Advertising & Web Design Company Islamabad\n", " 📍 Address: Office 2nd Floor, Ginza Center, Jinnah Ave, opposite Ufone Towers, Block J F 7/1 Blue Area, Islamabad, 44000, Pakistan\n", " ☎️ Phone: 0324 5031643\n", " 🌐 Website: http://www.capricocreations.pk/\n", " ⭐ Rating: 4.9\n", "\n", "🔹 Stage With Backdrop Featuring Turkish And Pakistani Landmarks Vendor\n", " Name: Pakistan Monument\n", " 📍 Address: M3V9+2Q9 Shakarparian Hills، سری نگر ہائ وے، اسلام آباد، Pakistan\n", " ☎️ Phone: N/A\n", " 🌐 Website: https://wikip.one/a671eR\n", " ⭐ Rating: 4.6\n", "\n", "🔹 Stage With Backdrop Featuring Turkish And Pakistani Landmarks Vendor\n", " Name: Lok Virsa Heritage Museum\n", " 📍 Address: Garden Avenue، Shakarparian Rd, Islamabad, Pakistan\n", " ☎️ Phone: (051) 9249209\n", " 🌐 Website: N/A\n", " ⭐ Rating: 4.6\n", "\n", "🔹 Stage With Backdrop Featuring Turkish And Pakistani Landmarks Vendor\n", " Name: Shakarparian National Park\n", " 📍 Address: Islamabad Expy, Islamabad, 44000, Pakistan\n", " ☎️ Phone: 0313 5021046\n", " 🌐 Website: N/A\n", " ⭐ Rating: 4.5\n", "\n", "🔹 Warm Ambient Lighting With Accents Of Blue And Green Vendor\n", " Name: Islamabad Lights\n", " 📍 Address: 10-11 Block No.89 , Bilal Plaza، Block F G 7/3 Blue Area, Islamabad, Pakistan\n", " ☎️ Phone: (051) 2150070\n", " 🌐 Website: http://www.islamabadlights.com/\n", " ⭐ Rating: 4.2\n", "\n", "🔹 Warm Ambient Lighting With Accents Of Blue And Green Vendor\n", " Name: LIGHT HOUSE\n", " 📍 Address: Shop 1, Bilal Plaza, Blue, Area G 7/3 Blue Area, Islamabad, 44000, Pakistan\n", " ☎️ Phone: 0333 8880200\n", " 🌐 Website: http://www.lighthouseisb.com.pk/\n", " ⭐ Rating: 4.4\n", "\n", "🔹 Warm Ambient Lighting With Accents Of Blue And Green Vendor\n", " Name: Lighting Concepts\n", " 📍 Address: Unit No. 7-8, Badini Plaza, near Razia Shareef Plaza, Block F G 7/3 Blue Area, Islamabad, 44000, Pakistan\n", " ☎️ Phone: 0336 2150294\n", " 🌐 Website: N/A\n", " ⭐ Rating: 4.3\n", "\n", "🔹 Floral Arrangements With Tulips And Jasmine Vendor\n", " Name: Best Ideal Fresh Flowers Shop # 3\n", " 📍 Address: Ideal Fresh Flowers, Shop # 3, super flowers market, F-6/1 F 6/1 F-6, Islamabad, 46000, Pakistan\n", " ☎️ Phone: 0333 8294720\n", " 🌐 Website: https://www.instagram.com/best_ideal_fresh_flower_shop_3?igsh=MTFjeHR0dWowbXhicA==\n", " ⭐ Rating: 4.9\n", "\n", "🔹 Floral Arrangements With Tulips And Jasmine Vendor\n", " Name: Ali Fresh Flower Decoration Center\n", " 📍 Address: Shop Main Main PWD Rd, near Japan Electronics, PWD Housing Society Sector C PWD Society, Islamabad, Pakistan\n", " ☎️ Phone: 0305 5276454\n", " 🌐 Website: N/A\n", " ⭐ Rating: 4.5\n", "\n", "🔹 Floral Arrangements With Tulips And Jasmine Vendor\n", " Name: Zain Flowers\n", " 📍 Address: Shop No 11 Super Market F6/2 School Road, F, 6, F-6/1 F 6/1 F-6, Islamabad, 44220, Pakistan\n", " ☎️ Phone: 0310 7949463\n", " 🌐 Website: https://www.instagram.com/blossomstudio.pk?igsh=MXd6ODBuMmc0NWNpNQ==\n", " ⭐ Rating: 5\n", "\n", "🔹 Seating Arrangements With Cultural Textiles Vendor\n", " Name: Lok Virsa - National Institute of Folk and Traditional Heritage\n", " 📍 Address: Shakarparian Rd, Islamabad, 44000, Pakistan\n", " ☎️ Phone: (051) 9249209\n", " 🌐 Website: http://www.lokvirsa.org.pk/\n", " ⭐ Rating: 4.4\n", "\n", "🔹 Seating Arrangements With Cultural Textiles Vendor\n", " Name: Traditions Furniture Islamabad\n", " 📍 Address: House 130 Street 60, I-8/3 I 8/3 I-8, Islamabad, Pakistan\n", " ☎️ Phone: 0336 5082271\n", " 🌐 Website: https://www.traditionsfurniture.pk/\n", " ⭐ Rating: 4.4\n", "\n", "🔹 Seating Arrangements With Cultural Textiles Vendor\n", " Name: F-7 Markaz (Jinnah Super Market)\n", " 📍 Address: Opposite To Flower Market، College Rd, F-7 Markaz F 7 Markaz F-7, Islamabad, Pakistan\n", " ☎️ Phone: 0317 5666179\n", " 🌐 Website: N/A\n", " ⭐ Rating: 4.4\n", "\n", "🔹 Information Kiosks With Digital Screens For Interactive Sessions Vendor\n", " Name: AioDock Digital SMD Screens\n", " 📍 Address: Office No. 318, Hamdan Heights, Islamabad Expy, Ghori Town Phase 5 Phase 5 Ghauri Town, Islamabad, 44000, Pakistan\n", " ☎️ Phone: 0319 7745430\n", " 🌐 Website: http://aiodockdigital.com/\n", " ⭐ Rating: 5\n", "\n", "🔹 Information Kiosks With Digital Screens For Interactive Sessions Vendor\n", " Name: DIGICRAWL\n", " 📍 Address: Office # 109, 1st Floor, Raj Mahal Plaza, B-223, near Habib Metropolitan Bank, B-Block Block B Satellite Town, Rawalpindi, 46000, Pakistan\n", " ☎️ Phone: 0331 4525293\n", " 🌐 Website: https://www.thedigicrawl.com/\n", " ⭐ Rating: 4.7\n", "\n", "🔹 Information Kiosks With Digital Screens For Interactive Sessions Vendor\n", " Name: Eyedeas Pakistan\n", " 📍 Address: Office # 80 Ground Floor, Posh Arcade Plaza, G-9 Markaz G 9 Markaz G-9, Islamabad, 44000, Pakistan\n", " ☎️ Phone: 0334 3933327\n", " 🌐 Website: http://www.eyedeas.com.pk/\n", " ⭐ Rating: 4.7\n" ] } ] }, { "cell_type": "markdown", "source": [ "**4.10 Weather Predictor**" ], "metadata": { "id": "zCiFEJHUqVOk" } }, { "cell_type": "markdown", "source": [ "So, now we must know that what will be the weather conditions during the event days so that if we are planning some activity which can be disturbed by weather then it can be rescheduled." ], "metadata": { "id": "WjVh2T1f338J" } }, { "cell_type": "code", "source": [ "import requests\n", "from datetime import datetime, timedelta\n", "import os\n", "\n", "# --- Weather Code Descriptions ---\n", "WEATHER_CODE_DESCRIPTIONS = {\n", " 0: \"Clear sky\", 1: \"Mainly clear\", 2: \"Partly cloudy\", 3: \"Overcast\",\n", " 45: \"Fog\", 48: \"Depositing rime fog\", 51: \"Light drizzle\", 53: \"Moderate drizzle\", 55: \"Dense drizzle\",\n", " 56: \"Light freezing drizzle\", 57: \"Dense freezing drizzle\", 61: \"Slight rain\", 63: \"Moderate rain\",\n", " 65: \"Heavy rain\", 66: \"Light freezing rain\", 67: \"Heavy freezing rain\", 71: \"Slight snow fall\",\n", " 73: \"Moderate snow fall\", 75: \"Heavy snow fall\", 77: \"Snow grains\", 80: \"Slight rain showers\",\n", " 81: \"Moderate rain showers\", 82: \"Violent rain showers\", 85: \"Slight snow showers\",\n", " 86: \"Heavy snow showers\", 95: \"Thunderstorm\", 96: \"Thunderstorm with slight hail\",\n", " 99: \"Thunderstorm with heavy hail\",\n", "}\n", "\n", "# --- Get Coordinates from Google Maps ---\n", "def get_coordinates(city):\n", " url = \"https://maps.googleapis.com/maps/api/geocode/json\"\n", " params = {\"address\": city, \"key\": os.getenv(\"GOOGLE_API_KEY\")}\n", " response = requests.get(url, params=params)\n", " data = response.json()\n", " if not data.get(\"results\"):\n", " raise Exception(f\"Could not determine coordinates for: {city}\")\n", " location = data[\"results\"][0][\"geometry\"][\"location\"]\n", " return location[\"lat\"], location[\"lng\"]\n", "\n", "# --- Get Forecast from Open-Meteo ---\n", "def get_open_meteo_forecast(lat, lon):\n", " url = \"https://api.open-meteo.com/v1/forecast\"\n", " params = {\n", " \"latitude\": lat,\n", " \"longitude\": lon,\n", " \"daily\": \"temperature_2m_min,temperature_2m_max,weathercode\",\n", " \"timezone\": \"auto\",\n", " \"forecast_days\": 16\n", " }\n", " response = requests.get(url, params=params)\n", " data = response.json()\n", " return data.get(\"daily\", {})\n", "\n", "# --- Extract Event Dates from Schedule ---\n", "def extract_event_dates(schedule, event_start_date):\n", " try:\n", " base_date = datetime.strptime(event_start_date, \"%Y-%m-%d\")\n", " except ValueError:\n", " raise Exception(\"Event start date must be in YYYY-MM-DD format.\")\n", "\n", " return [(base_date + timedelta(days=i)).strftime(\"%Y-%m-%d\") for i in range(len(schedule))]\n", "\n", "# --- Filter Forecast for Event Dates ---\n", "def filter_forecast(forecast_data, event_dates):\n", " filtered = []\n", " for date, t_min, t_max, code in zip(\n", " forecast_data.get(\"time\", []),\n", " forecast_data.get(\"temperature_2m_min\", []),\n", " forecast_data.get(\"temperature_2m_max\", []),\n", " forecast_data.get(\"weathercode\", [])\n", " ):\n", " if str(date).strip() in [d.strip() for d in event_dates]:\n", " filtered.append({\n", " \"date\": date,\n", " \"min_temp\": f\"{t_min}°C\",\n", " \"max_temp\": f\"{t_max}°C\",\n", " \"description\": WEATHER_CODE_DESCRIPTIONS.get(code, \"Unknown\")\n", " })\n", " return filtered\n", "\n", "# --- Main Weather Agent ---\n", "def weather_predictor_agent(user_intent: dict, schedule: list) -> list:\n", " city = user_intent.get(\"location\")\n", " event_start_date = user_intent.get(\"event_date\")\n", "\n", " if not city or not event_start_date:\n", " raise Exception(\"User intent must include both 'location' and 'event_date'.\")\n", "\n", " lat, lon = get_coordinates(city)\n", " forecast_data = get_open_meteo_forecast(lat, lon)\n", " event_dates = extract_event_dates(schedule, event_start_date)\n", " return filter_forecast(forecast_data, event_dates)\n", "\n", "# --- Test Block ---\n", "if __name__ == \"__main__\":\n", " try:\n", " user_intent = extracted_intent\n", " print(\"\\n🌤️ Fetching weather forecast (Open-Meteo)...\")\n", " forecast = weather_predictor_agent(user_intent, schedule)\n", "\n", " print(\"\\n📆 Weather Forecast for Event Days:\")\n", " if not forecast:\n", " print(\"No forecast available.\")\n", " else:\n", " for day in forecast:\n", " print(f\"{day['date']}: 🌤️ {day['description']}\")\n", " print(f\" 🌡️ Temp: {day['min_temp']} to {day['max_temp']}\")\n", "\n", " except Exception as e:\n", " print(f\"❌ Error in Weather Agent: {e}\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "wRYDwGCfqWcn", "outputId": "f5262b83-041c-4025-c757-d31d9395581a" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", "🌤️ Fetching weather forecast (Open-Meteo)...\n", "\n", "📆 Weather Forecast for Event Days:\n", "2025-06-10: 🌤️ Clear sky\n", " 🌡️ Temp: 31.0°C to 47.6°C\n", "2025-06-11: 🌤️ Partly cloudy\n", " 🌡️ Temp: 31.5°C to 46.0°C\n", "2025-06-12: 🌤️ Clear sky\n", " 🌡️ Temp: 30.7°C to 46.2°C\n", "2025-06-13: 🌤️ Mainly clear\n", " 🌡️ Temp: 30.5°C to 47.0°C\n", "2025-06-14: 🌤️ Partly cloudy\n", " 🌡️ Temp: 35.1°C to 46.4°C\n" ] } ] }, { "cell_type": "markdown", "source": [ "**4.11 Orchestrator Agent**" ], "metadata": { "id": "a7DQasJUrgIL" } }, { "cell_type": "markdown", "source": [ "The brain of the AI Event Manager.. This will organize all the agents at one place to finally give the best answers and a finalized plan to the user." ], "metadata": { "id": "Rh1FTuq84IYS" } }, { "cell_type": "code", "source": [ "import json\n", "from agentpro import ReactAgent, create_model\n", "import os\n", "#from user_intent_agent import extract_user_intent\n", "\n", "# ✅ OpenAI model setup\n", "OPENAI_API_KEY = os.getenv(\"OPENAI_API_KEY\")\n", "assert OPENAI_API_KEY, \"❌ Missing OPENAI_API_KEY in environment\"\n", "\n", "model = create_model(provider=\"openai\", model_name=\"gpt-4o\", api_key=OPENAI_API_KEY)\n", "agent = ReactAgent(model=model, tools=[])\n", "\n", "import json\n", "import ast\n", "def summarize_output(section_name, data):\n", " prompt = (\n", " f\"You are a summarizer for an event planner agent.\\n\"\n", " f\"Please summarize the key information from the '{section_name}' section in bullet points, focusing on top recommended options only.\\n\\n\"\n", " f\"{section_name} data:\\n{json.dumps(data, indent=2)}\\n\\n\"\n", " \"IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. \"\n", " \"You should select the best option given by each agents based on reviews and print only those options and discard other options. formulate a comprehensive plan at the end\"\n", " \"Do NOT output thoughts, actions, or any reasoning.\"\n", " )\n", "\n", " print(f\"\\n📦 Summarizing section: {section_name}\")\n", " response = agent.run(prompt)\n", "\n", " if not hasattr(response, \"final_answer\") or not response.final_answer.strip().startswith(\"{\"):\n", " raise ValueError(f\"❌ LLM did not return usable JSON. Raw output:\\n{response.final_answer}\")\n", "\n", " return extract_json_from_response(response.final_answer)\n", "\n", "def summarize_output(section_name, data):\n", " prompt = (\n", " f\"You are a summarizer for an event planner agent.\\n\"\n", " f\"Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.\"\n", " f\"Please summarize the key information from the '{section_name}' section in bullet points, focusing on top recommended options only.\\n\\n\"\n", " f\"{section_name} data:\\n{json.dumps(data, indent=2)}\"\n", " \"IMPORTANT: In each sub agent, Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\"\n", " )\n", " return agent.run(prompt).final_answer\n", "\n", "def orchestrated_event_plan(user_intent):\n", " print(\"\\n🚀 Launching Orchestrator Agent...\")\n", "\n", " # 1. Extract User Intent\n", " #from your_user_intent_module import extract_user_intent # adjust import if needed\n", " #user_intent = extract_user_intent(user_query)\n", "\n", " print(\"\\n🎯 User Intent:\")\n", " print(json.dumps(user_intent, indent=2))\n", "\n", " # 2. Venue Options\n", " venue_results = venue_agent(user_intent)\n", " venue_summary = summarize_output(\"Venues\", venue_results)\n", "\n", " # 3. Vendor Recommendations\n", " vendor_results = vendors_agent(user_intent)\n", " vendor_summary = summarize_output(\"Vendors\", vendor_results)\n", "\n", " # 4. Event Schedule\n", " schedule = scheduler_agent(user_intent)\n", "\n", " # 5. Transport & Parking\n", " transport_output = transport_parking_agent(user_intent, venue_results, schedule)\n", " transport_summary = summarize_output(\"Transportation\", transport_output)\n", "\n", " # 6. Hotel Options\n", " hotel_output = hotel_booking_agent(user_intent, venue_results)\n", " hotel_summary = summarize_output(\"Hotels\", hotel_output)\n", "\n", " # 7. Sightseeing Plan\n", " sightseeing = sightseeing_agent(user_intent, schedule)\n", " sightseeing_summary = summarize_output(\"Sightseeing\", sightseeing)\n", "\n", " # 8. Catering Options\n", " catering_result = catering_agent(user_intent, schedule)\n", " catering_summary = summarize_output(\"Catering\", catering_result)\n", "\n", " # 9. Theme Plan\n", " theme_output = theme_agent(user_intent)\n", " theme_summary = summarize_output(\"Theme\", theme_output)\n", "\n", " # 10. Weather Forecast\n", " forecast = weather_predictor_agent(user_intent, schedule)\n", "\n", " # 🧠 Final Output Structure\n", " event_plan = {\n", " \"intent\": user_intent,\n", " \"summary\": {\n", " \"venues\": venue_summary,\n", " \"vendors\": vendor_summary,\n", " \"transportation\": transport_summary,\n", " \"hotels\": hotel_summary,\n", " \"sightseeing\": sightseeing_summary,\n", " \"catering\": catering_summary,\n", " \"theme\": theme_summary,\n", " },\n", " \"details\": {\n", " \"venues\": venue_results,\n", " \"vendors\": vendor_results,\n", " \"schedule\": schedule,\n", " \"transportation\": transport_output,\n", " \"hotels\": hotel_output,\n", " \"sightseeing\": sightseeing,\n", " \"catering\": catering_result,\n", " \"theme\": theme_output,\n", " \"weather_forecast\": forecast,\n", " }\n", " }\n", "\n", " print(\"\\n✅ Event Planning Complete!\")\n", " return event_plan\n", "\n", "# ✅ Run it\n", "if __name__ == \"__main__\":\n", " extracted_intent = extract_user_intent()\n", " user_query = extracted_intent\n", " plan = orchestrated_event_plan(extracted_intent)\n", "\n", " print(\"\\n📋 Summary Output:\")\n", " print(json.dumps(plan[\"summary\"], indent=2))\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "X71feYSRrh_h", "outputId": "cc5d4e4a-99ef-45a8-88f2-b14831c47440" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "👤 Please describe the event you want to plan (type, location, guests, etc.):\n", "> Plan a wedding in Lahore on 10 June 2025 with 300 guests. 20 guests each are coming from Germnay and Spain and other guests are local. all guests will stay from 7 june till 12 june 2025.\n", "🔁 Querying GPT-4o via ReAct agent...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an event planning assistant.\n", "Extract structured event info from the user query below.\n", "Return a **Python dictionary only**, no explanations or formatting.\n", "\n", "Required dictionary keys:\n", "- 'event_type': string\n", "- 'location': string\n", "- 'event_date': string (YYYY-MM-DD)\n", "- 'guest_count': integer\n", "- 'preferences': dictionary (include keys like 'stay_dates', 'guest_origins', etc.)\n", "- 'event_theme': string (optional)\n", "- 'meal_count': integer (optional)\n", "- 'transport_needs': string (optional)\n", "- 'sightseeing': boolean (optional)\n", "\n", "Missing values must be set to null.\n", "\n", "Output should be in pure JSON form and nothing else should be included which is not in JSON formatUser input: Plan a wedding in Lahore on 10 June 2025 with 300 guests. 20 guests each are coming from Germnay and Spain and other guests are local. all guests will stay from 7 june till 12 june 2025.IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"event_type\": \"wedding\", \"location\": \"Lahore\", \"event_date\": \"2025-06-10\", \"guest_count\": 300, \"preferences\": {\"stay_dates\": [\"2025-06-07\", \"2025-06-12\"], \"guest_origins\": {\"Germany\": 20, \"Spain\": 20, \"local\": 260}}, \"event_theme\": null, \"meal_count\": null, \"transport_needs\": null, \"sightseeing\": null}\n", "✅ Parsed Final Answer: {\"event_type\": \"wedding\", \"location\": \"Lahore\", \"event_date\": \"2025-06-10\", \"guest_count\": 300, \"preferences\": {\"stay_dates\": [\"2025-06-07\", \"2025-06-12\"], \"guest_origins\": {\"Germany\": 20, \"Spain\": 20, \"local\": 260}}, \"event_theme\": null, \"meal_count\": null, \"transport_needs\": null, \"sightseeing\": null}\n", "🧠 LLM RAW OUTPUT:\n", " {\"event_type\": \"wedding\", \"location\": \"Lahore\", \"event_date\": \"2025-06-10\", \"guest_count\": 300, \"preferences\": {\"stay_dates\": [\"2025-06-07\", \"2025-06-12\"], \"guest_origins\": {\"Germany\": 20, \"Spain\": 20, \"local\": 260}}, \"event_theme\": null, \"meal_count\": null, \"transport_needs\": null, \"sightseeing\": null}\n", "\n", "✅ Extracted User Intent:\n", "{\n", " \"event_type\": \"wedding\",\n", " \"location\": \"Lahore\",\n", " \"event_date\": \"2025-06-10\",\n", " \"guest_count\": 300,\n", " \"preferences\": {\n", " \"stay_dates\": [\n", " \"2025-06-07\",\n", " \"2025-06-12\"\n", " ],\n", " \"guest_origins\": {\n", " \"Germany\": 20,\n", " \"Spain\": 20,\n", " \"local\": 260\n", " }\n", " },\n", " \"event_theme\": null,\n", " \"meal_count\": null,\n", " \"transport_needs\": null,\n", " \"sightseeing\": null\n", "}\n", "\n", "🚀 Launching Orchestrator Agent...\n", "\n", "🎯 User Intent:\n", "{\n", " \"event_type\": \"wedding\",\n", " \"location\": \"Lahore\",\n", " \"event_date\": \"2025-06-10\",\n", " \"guest_count\": 300,\n", " \"preferences\": {\n", " \"stay_dates\": [\n", " \"2025-06-07\",\n", " \"2025-06-12\"\n", " ],\n", " \"guest_origins\": {\n", " \"Germany\": 20,\n", " \"Spain\": 20,\n", " \"local\": 260\n", " }\n", " },\n", " \"event_theme\": null,\n", " \"meal_count\": null,\n", " \"transport_needs\": null,\n", " \"sightseeing\": null\n", "}\n", "\n", "🧠 Determining suitable venue types for: wedding\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner.\n", "Suggest the 3 most suitable types of venues for a 'wedding' event.\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return only a valid JSON list like: [\"banquet hall\", \"outdoor garden\", \"conference center\"]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [\"banquet hall\", \"outdoor garden\", \"beach resort\"]\n", "✅ Parsed Final Answer: [\"banquet hall\", \"outdoor garden\", \"beach resort\"]\n", "🔎 Searching: banquet hall in Lahore\n", "🔎 Searching: outdoor garden in Lahore\n", "🔎 Searching: beach resort in Lahore\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a summarizer for an event planner agent.\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Please summarize the key information from the 'Venues' section in bullet points, focusing on top recommended options only.\n", "\n", "Venues data:\n", "[\n", " {\n", " \"venue_type\": \"banquet hall\",\n", " \"options\": [\n", " {\n", " \"name\": \"Mehmaan Khana Marriage Hall\",\n", " \"rating\": 4.6,\n", " \"address\": \"94 Lahore \\u2013 Kasur Rd, near Shama, Ichhra Lahore, 54000, Pakistan\",\n", " \"phone\": \"0321 6576011\",\n", " \"website\": \"http://www.mehmaankhana.com/\"\n", " },\n", " {\n", " \"name\": \"Grand Orchid Marquee\",\n", " \"rating\": 4.4,\n", " \"address\": \"land breeze housing\\u060c 5 Raiwind Rd, near Suzuki Showroom\\u060c Block B Lda Avenue Phase 1 Lda Avenue, \\u0644\\u0627\\u06c1\\u0648\\u0631\\u060c Pakistan\",\n", " \"phone\": \"(042) 35321023\",\n", " \"website\": \"N/A\"\n", " },\n", " {\n", " \"name\": \"RABAT banquet hall by Time & Taste\",\n", " \"rating\": 4.4,\n", " \"address\": \"Moulana Shoukat, Ali Road, Plot 9 Saadat Farooq Rd, Saddar Town, Lahore, Pakistan\",\n", " \"phone\": \"0301 7130942\",\n", " \"website\": \"N/A\"\n", " }\n", " ]\n", " },\n", " {\n", " \"venue_type\": \"outdoor garden\",\n", " \"options\": [\n", " {\n", " \"name\": \"Bagh-e-Jinnah\",\n", " \"rating\": 4.6,\n", " \"address\": \"Shahrah-e-Quaid-e-Azam, Jinnah Town, Lahore, 54000, Pakistan\",\n", " \"phone\": \"(042) 99201270\",\n", " \"website\": \"https://www.facebook.com/Bagh-e-Jinnah-Lahore-255464461887669/?modal=admin_todo_tour\"\n", " },\n", " {\n", " \"name\": \"Botanical Garden, \\u0628\\u0648\\u0679\\u06cc\\u0646\\u06a9\\u0644 \\u06af\\u0627\\u0631\\u0688\\u0646\",\n", " \"rating\": 4.6,\n", " \"address\": \"HFFP+MR9, Lahore, Pakistan\",\n", " \"phone\": \"N/A\",\n", " \"website\": \"N/A\"\n", " },\n", " {\n", " \"name\": \"Shalimar Gardens\",\n", " \"rating\": 4.5,\n", " \"address\": \"AH1, GT Rd, Shalamar Town, Lahore, 54000, Pakistan\",\n", " \"phone\": \"N/A\",\n", " \"website\": \"N/A\"\n", " }\n", " ]\n", " },\n", " {\n", " \"venue_type\": \"beach resort\",\n", " \"options\": [\n", " {\n", " \"name\": \"Beach Resort by Icon\",\n", " \"rating\": 4.1,\n", " \"address\": \"12-KM Raiwind Rd, Chamru Pur Lahore, 54570, Pakistan\",\n", " \"phone\": \"0324 9923515\",\n", " \"website\": \"N/A\"\n", " },\n", " {\n", " \"name\": \"The Oasis Golf & Aqua Resort\",\n", " \"rating\": 4.6,\n", " \"address\": \"Multan Rd, Lahore, Pakistan\",\n", " \"phone\": \"0321 8236214\",\n", " \"website\": \"http://www.theoasis.com.pk/\"\n", " },\n", " {\n", " \"name\": \"Beach resort\",\n", " \"rating\": 5,\n", " \"address\": \"96FH+R7G, Chamru Pur Chamrupur, Lahore, Pakistan\",\n", " \"phone\": \"0333 0130955\",\n", " \"website\": \"N/A\"\n", " }\n", " ]\n", " }\n", "]IMPORTANT: In each sub agent, Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"recommended_venues\":[{\"name\":\"Mehmaan Khana Marriage Hall\",\"rating\":4.6,\"address\":\"94 Lahore – Kasur Rd, near Shama, Ichhra Lahore, 54000, Pakistan\",\"phone\":\"0321 6576011\",\"website\":\"http://www.mehmaankhana.com/\"},{\"name\":\"Bagh-e-Jinnah\",\"rating\":4.6,\"address\":\"Shahrah-e-Quaid-e-Azam, Jinnah Town, Lahore, 54000, Pakistan\",\"phone\":\"(042) 99201270\",\"website\":\"https://www.facebook.com/Bagh-e-Jinnah-Lahore-255464461887669/?modal=admin_todo_tour\"},{\"name\":\"Botanical Garden, بوٹینکل گارڈن\",\"rating\":4.6,\"address\":\"HFFP+MR9, Lahore, Pakistan\",\"phone\":\"N/A\",\"website\":\"N/A\"},{\"name\":\"The Oasis Golf & Aqua Resort\",\"rating\":4.6,\"address\":\"Multan Rd, Lahore, Pakistan\",\"phone\":\"0321 8236214\",\"website\":\"http://www.theoasis.com.pk/\"},{\"name\":\"Beach resort\",\"rating\":5,\"address\":\"96FH+R7G, Chamru Pur Chamrupur, Lahore, Pakistan\",\"phone\":\"0333 0130955\",\"website\":\"N/A\"}]}\n", "✅ Parsed Final Answer: {\"recommended_venues\":[{\"name\":\"Mehmaan Khana Marriage Hall\",\"rating\":4.6,\"address\":\"94 Lahore – Kasur Rd, near Shama, Ichhra Lahore, 54000, Pakistan\",\"phone\":\"0321 6576011\",\"website\":\"http://www.mehmaankhana.com/\"},{\"name\":\"Bagh-e-Jinnah\",\"rating\":4.6,\"address\":\"Shahrah-e-Quaid-e-Azam, Jinnah Town, Lahore, 54000, Pakistan\",\"phone\":\"(042) 99201270\",\"website\":\"https://www.facebook.com/Bagh-e-Jinnah-Lahore-255464461887669/?modal=admin_todo_tour\"},{\"name\":\"Botanical Garden, بوٹینکل گارڈن\",\"rating\":4.6,\"address\":\"HFFP+MR9, Lahore, Pakistan\",\"phone\":\"N/A\",\"website\":\"N/A\"},{\"name\":\"The Oasis Golf & Aqua Resort\",\"rating\":4.6,\"address\":\"Multan Rd, Lahore, Pakistan\",\"phone\":\"0321 8236214\",\"website\":\"http://www.theoasis.com.pk/\"},{\"name\":\"Beach resort\",\"rating\":5,\"address\":\"96FH+R7G, Chamru Pur Chamrupur, Lahore, Pakistan\",\"phone\":\"0333 0130955\",\"website\":\"N/A\"}]}\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner. What types of vendors are typically needed for a 'wedding'? Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return only a Python list like: [\"catering\", \"event lighting\", \"A/V equipment\"]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [\"catering\", \"florist\", \"photography\", \"videography\", \"music/band/DJ\", \"wedding planner\", \"venue\", \"officiant\", \"transportation\", \"baker\", \"hair and makeup\", \"event lighting\", \"A/V equipment\", \"furniture rental\"]\n", "✅ Parsed Final Answer: [\"catering\", \"florist\", \"photography\", \"videography\", \"music/band/DJ\", \"wedding planner\", \"venue\", \"officiant\", \"transportation\", \"baker\", \"hair and makeup\", \"event lighting\", \"A/V equipment\", \"furniture rental\"]\n", "🔎 Searching vendors for: catering\n", "🔎 Searching vendors for: florist\n", "🔎 Searching vendors for: photography\n", "🔎 Searching vendors for: videography\n", "🔎 Searching vendors for: music/band/DJ\n", "🔎 Searching vendors for: wedding planner\n", "🔎 Searching vendors for: venue\n", "🔎 Searching vendors for: officiant\n", "🔎 Searching vendors for: transportation\n", "🔎 Searching vendors for: baker\n", "🔎 Searching vendors for: hair and makeup\n", "🔎 Searching vendors for: event lighting\n", "🔎 Searching vendors for: A/V equipment\n", "🔎 Searching vendors for: furniture rental\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a summarizer for an event planner agent.\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Please summarize the key information from the 'Vendors' section in bullet points, focusing on top recommended options only.\n", "\n", "Vendors data:\n", "[\n", " {\n", " \"vendor_type\": \"catering\",\n", " \"options\": [\n", " {\n", " \"name\": \"AL-Tuaam Catering and Event Planner\",\n", " \"type\": \"catering\",\n", " \"address\": \"Office # 4, 1st Floor, Zaffar Nadeem Plaza 31-B, Faisal Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.8\n", " },\n", " {\n", " \"name\": \"Moon catering services.\",\n", " \"type\": \"catering\",\n", " \"address\": \"Bastami Rd, Samanabad Town, Lahore, 54400, Pakistan\",\n", " \"rating\": 4.9\n", " },\n", " {\n", " \"name\": \"LAHORE CATERING & DECOR COMPANY\",\n", " \"type\": \"catering\",\n", " \"address\": \"Main Samsani Rd, Block M Phase 2 Johar Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 5\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"florist\",\n", " \"options\": [\n", " {\n", " \"name\": \"SendFlowers.pk\",\n", " \"type\": \"florist\",\n", " \"address\": \"333 M, Block M Phase 2 Johar Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.8\n", " },\n", " {\n", " \"name\": \"Flower Shop Delivery In Lahore | Flower delivery in Lahore\",\n", " \"type\": \"florist\",\n", " \"address\": \"A Block Wahdat Rd, near Sheikh Zayed Hospital, Block A Muslim Town, Lahore, Pakistan\",\n", " \"rating\": 5\n", " },\n", " {\n", " \"name\": \"Flower Bouquet - Lahore\",\n", " \"type\": \"florist\",\n", " \"address\": \"Basement, 23-A, Khayaban-e-Iqbal, Sector XX DHA Phase 3, Lahore, 54810, Pakistan\",\n", " \"rating\": 4.9\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"photography\",\n", " \"options\": [\n", " {\n", " \"name\": \"Khawar Naqvi Studios (Commercial, Fashion and Wedding Photographer in lahore)\",\n", " \"type\": \"photography\",\n", " \"address\": \"88-T Lalik chowk, Civic Commercial Area Sector T DHA Phase 2, Lahore, 54792, Pakistan\",\n", " \"rating\": 4.8\n", " },\n", " {\n", " \"name\": \"Wedding Photographer in Lahore | BS Studio By Ossama Adnan\",\n", " \"type\": \"photography\",\n", " \"address\": \"lll Office No M1-57 E Block, Eden tower, Main Boulevard Gulberg, Block E1 Block E 1 Gulberg III, Lahore, 54660, Pakistan\",\n", " \"rating\": 4.9\n", " },\n", " {\n", " \"name\": \"Noman Hassan photograhpy\",\n", " \"type\": \"photography\",\n", " \"address\": \"G29, Ashiana Center Main Blvd, Block D1 Gulberg III, Lahore, Pakistan\",\n", " \"rating\": 5\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"videography\",\n", " \"options\": [\n", " {\n", " \"name\": \"Memories Studio Photography & Videography\",\n", " \"type\": \"videography\",\n", " \"address\": \"Basement Gurdian Pharmacy, Rehman Tower, Main Market, Gulberg 2, Lahore, 54660, Pakistan\",\n", " \"rating\": 4.9\n", " },\n", " {\n", " \"name\": \"Alie Imran Production\",\n", " \"type\": \"videography\",\n", " \"address\": \"Office: 157/A, ghazni lane, New Super Town Defence main boulevard, Walton Rd, 54000, Pakistan\",\n", " \"rating\": 5\n", " },\n", " {\n", " \"name\": \"Fatima Studio Film & Photography\",\n", " \"type\": \"videography\",\n", " \"address\": \"22 Upper Floor, LCB Market, Sarwar Rd, Cantonment Board Staff Colony, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.9\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"music/band/DJ\",\n", " \"options\": [\n", " {\n", " \"name\": \"Star Sungeet Musical Group Nadeem Dj Sound & Light and Qawali Night\",\n", " \"type\": \"music/band/DJ\",\n", " \"address\": \"Nicha Chait Ram Rd, Shahi Mohallah Walled City of Lahore, Lahore, 54000, Pakistan\",\n", " \"rating\": 5\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"wedding planner\",\n", " \"options\": [\n", " {\n", " \"name\": \"Tulips Events\",\n", " \"type\": \"wedding planner\",\n", " \"address\": \"Trade Center, LG 133 Saddiq, Gulberg III, Lahore, 56660, Pakistan\",\n", " \"rating\": 4.8\n", " },\n", " {\n", " \"name\": \"Event Planners in Pakistan | a2z Events Solutions\",\n", " \"type\": \"wedding planner\",\n", " \"address\": \"Office # 428, 4th Floor, Siddiq Trade Center, Main Boulevard Gulberg, Block H Gulberg 2, Lahore, 54660, Pakistan\",\n", " \"rating\": 4.7\n", " },\n", " {\n", " \"name\": \"HJ Planners - Wedding Planner and Event Management.\",\n", " \"type\": \"wedding planner\",\n", " \"address\": \"Office No 12, 1st Floor, Abrar Business Center, main Wahdat Rd, Muslim Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 5\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"venue\",\n", " \"options\": [\n", " {\n", " \"name\": \"Bel Avenir Event Complex\",\n", " \"type\": \"venue\",\n", " \"address\": \"74 - A Canal Rd, Block A Iqbal Avenue Phase 3 Iqbal Avenue - Phase 3, Lahore, Pakistan\",\n", " \"rating\": 4.5\n", " },\n", " {\n", " \"name\": \"Le Grand Chalet Event Complex\",\n", " \"type\": \"venue\",\n", " \"address\": \"14, A-1, Main Maulana Shaukat Ali Rd, G.E.C.H.S. Phase 3 Sector A 1 Lahore, 54600, Pakistan\",\n", " \"rating\": 4.4\n", " },\n", " {\n", " \"name\": \"HighLand Marquee No 17 Garrison Golf and Country club lahoreLahore\",\n", " \"type\": \"venue\",\n", " \"address\": \"Hall No.17, Garrison Golf and Country Club, behind New Airport, near Pakistan Army Museum, Saddar Town, Lahore, Pakistan\",\n", " \"rating\": 4.4\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"officiant\",\n", " \"options\": [\n", " {\n", " \"name\": \"Hamara Rishta Pvt Ltd | Rishta Center | Marriage Bureau Lahore\",\n", " \"type\": \"officiant\",\n", " \"address\": \"Satluj Block Allama Iqbal Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.8\n", " },\n", " {\n", " \"name\": \"AwAn Marriage Bureau\",\n", " \"type\": \"officiant\",\n", " \"address\": \"Mezzanine Floor, 95 - S Block, Opposite LACAS School System, Imperial Garden Homes, Paragon City, Barki Rd, Cantt, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.8\n", " },\n", " {\n", " \"name\": \"Event Planners in Pakistan | a2z Events Solutions\",\n", " \"type\": \"officiant\",\n", " \"address\": \"Office # 428, 4th Floor, Siddiq Trade Center, Main Boulevard Gulberg, Block H Gulberg 2, Lahore, 54660, Pakistan\",\n", " \"rating\": 4.7\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"transportation\",\n", " \"options\": [\n", " {\n", " \"name\": \"Jeevay Laal Din Goods Transport Shehzore Mazda Company Lahore\",\n", " \"type\": \"transportation\",\n", " \"address\": \"Interchange, Band Road, Service Rd, Mehmood Booti, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.9\n", " },\n", " {\n", " \"name\": \"Faisal Movers Abdullah Terminal Lahore\",\n", " \"type\": \"transportation\",\n", " \"address\": \"G7PC+RQ2 Abdullah Travels, Band Rd, Kot Kamboh Lahore, 54000, Pakistan\",\n", " \"rating\": 4\n", " },\n", " {\n", " \"name\": \"Qamar Awan Goods Transport Company\",\n", " \"type\": \"transportation\",\n", " \"address\": \"Plot no, 57, Block D Sabzazar Housing Scheme Phase 1 & 2 Lahore, 54000, Pakistan\",\n", " \"rating\": 4.9\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"baker\",\n", " \"options\": [\n", " {\n", " \"name\": \"Layers Bakeshop - MM Alam\",\n", " \"type\": \"baker\",\n", " \"address\": \"Shop No 1, KD Plaza, 100 MM Alam Rd, near Zoom Petrol Pump, Block B2 Block B 2 Gulberg III, Lahore, Pakistan\",\n", " \"rating\": 4.6\n", " },\n", " {\n", " \"name\": \"Crumbs The Bakers\",\n", " \"type\": \"baker\",\n", " \"address\": \"9 b1, Johar Town, Lahore, Pakistan\",\n", " \"rating\": 4.9\n", " },\n", " {\n", " \"name\": \"Baked\",\n", " \"type\": \"baker\",\n", " \"address\": \"P.A.F Market, Sarfaraz Rafiqui road\\u060c, Sarfaraz Rafiqui Rd, Cantt, Lahore, Pakistan\",\n", " \"rating\": 4.3\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"hair and makeup\",\n", " \"options\": [\n", " {\n", " \"name\": \"Zara Gul Makeup & Hair Studio\",\n", " \"type\": \"hair and makeup\",\n", " \"address\": \"220 - FF, CCA, Commercial Market, Sector FF Dha Phase 4, Lahore, Pakistan\",\n", " \"rating\": 4.6\n", " },\n", " {\n", " \"name\": \"Shafaq n Kami salon | Best Salon & Studio in Lahore\",\n", " \"type\": \"hair and makeup\",\n", " \"address\": \"51 BB 1, Block B1 Block B 1 Gulberg III, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.7\n", " },\n", " {\n", " \"name\": \"CANVAS Salon Lahore | Best Hair and Bridal Parlour Gulberg\",\n", " \"type\": \"hair and makeup\",\n", " \"address\": \"House 60, B1 MM Alam Rd, Block B 1 Gulberg III, Lahore, 44000, Pakistan\",\n", " \"rating\": 4.8\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"event lighting\",\n", " \"options\": [\n", " {\n", " \"name\": \"Abid Solutions Sound & Lights\",\n", " \"type\": \"event lighting\",\n", " \"address\": \"334-B Poonch Rd, Samanabad Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 5\n", " },\n", " {\n", " \"name\": \"Big Screen Events\",\n", " \"type\": \"event lighting\",\n", " \"address\": \"89 b, Block C-II Gulberg III, Lahore, 54570, Pakistan\",\n", " \"rating\": 4.8\n", " },\n", " {\n", " \"name\": \"Absolute Audio Visual Rental & Productions (Sound System - SMD Screen on rent - Event Lighting equipment)\",\n", " \"type\": \"event lighting\",\n", " \"address\": \"E, 1531 Faisal Ghuman Rd, Nishat Colony Cantonment, Lahore, 54810, Pakistan\",\n", " \"rating\": 4.7\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"A/V equipment\",\n", " \"options\": [\n", " {\n", " \"name\": \"KBS Enterprises | Projectors | Video conferencing\",\n", " \"type\": \"A/V equipment\",\n", " \"address\": \"65 Ferozepur Road, opposite Gaddafi stadium, New Muslim Town Garden Block Garden Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.6\n", " },\n", " {\n", " \"name\": \"Orient AV (Pvt) Ltd.\",\n", " \"type\": \"A/V equipment\",\n", " \"address\": \"Office No. E7C, 7th Floor, Grand Square Mall, 3 Main Boulevard, Block E3 Block E 3 Gulberg, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.5\n", " },\n", " {\n", " \"name\": \"Qamar Sound Systems\",\n", " \"type\": \"A/V equipment\",\n", " \"address\": \"shop 5 qadri chamber chownk, Hall Rd, Garhi Shahu, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.9\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"furniture rental\",\n", " \"options\": [\n", " {\n", " \"name\": \"Mattress on Rent (S.A Traders)\",\n", " \"type\": \"furniture rental\",\n", " \"address\": \"H88X+V55, Railway Stadium Rd, Garhi Shahu, Lahore, 54000, Pakistan\",\n", " \"rating\": 5\n", " },\n", " {\n", " \"name\": \"Hashir bistray and mattres for rent\",\n", " \"type\": \"furniture rental\",\n", " \"address\": \"black, Q, Block Q Model Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.8\n", " },\n", " {\n", " \"name\": \"Finewoods\",\n", " \"type\": \"furniture rental\",\n", " \"address\": \"Metro Station, BANK STOP, Main Ferozpur Road, Kamaha, Aashiana Rd, near Sulman Park, Lahore, 05441, Pakistan\",\n", " \"rating\": 4.9\n", " }\n", " ]\n", " }\n", "]IMPORTANT: In each sub agent, Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"catering\":[\"LAHORE CATERING & DECOR COMPANY\"],\"florist\":[\"Flower Shop Delivery In Lahore | Flower delivery in Lahore\"],\"photography\":[\"Noman Hassan photograhpy\"],\"videography\":[\"Alie Imran Production\"],\"music/band/DJ\":[\"Star Sungeet Musical Group Nadeem Dj Sound & Light and Qawali Night\"],\"wedding planner\":[\"HJ Planners - Wedding Planner and Event Management.\"],\"venue\":[\"Bel Avenir Event Complex\"],\"officiant\":[\"Hamara Rishta Pvt Ltd | Rishta Center | Marriage Bureau Lahore\",\"AwAn Marriage Bureau\"],\"transportation\":[\"Jeevay Laal Din Goods Transport Shehzore Mazda Company Lahore\",\"Qamar Awan Goods Transport Company\"],\"baker\":[\"Crumbs The Bakers\"],\"hair and makeup\":[\"CANVAS Salon Lahore | Best Hair and Bridal Parlour Gulberg\"],\"event lighting\":[\"Abid Solutions Sound & Lights\"],\"A/V equipment\":[\"Qamar Sound Systems\"],\"furniture rental\":[\"Mattress on Rent (S.A Traders)\"]}\n", "✅ Parsed Final Answer: {\"catering\":[\"LAHORE CATERING & DECOR COMPANY\"],\"florist\":[\"Flower Shop Delivery In Lahore | Flower delivery in Lahore\"],\"photography\":[\"Noman Hassan photograhpy\"],\"videography\":[\"Alie Imran Production\"],\"music/band/DJ\":[\"Star Sungeet Musical Group Nadeem Dj Sound & Light and Qawali Night\"],\"wedding planner\":[\"HJ Planners - Wedding Planner and Event Management.\"],\"venue\":[\"Bel Avenir Event Complex\"],\"officiant\":[\"Hamara Rishta Pvt Ltd | Rishta Center | Marriage Bureau Lahore\",\"AwAn Marriage Bureau\"],\"transportation\":[\"Jeevay Laal Din Goods Transport Shehzore Mazda Company Lahore\",\"Qamar Awan Goods Transport Company\"],\"baker\":[\"Crumbs The Bakers\"],\"hair and makeup\":[\"CANVAS Salon Lahore | Best Hair and Bridal Parlour Gulberg\"],\"event lighting\":[\"Abid Solutions Sound & Lights\"],\"A/V equipment\":[\"Qamar Sound Systems\"],\"furniture rental\":[\"Mattress on Rent (S.A Traders)\"]}\n", "🧠 Prompting GPT-4o for schedule...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner. Create a high-level multi-day schedule for a wedding beginning on 2025-06-10 with around 300 guests. Include major activities from arrival to departure:\n", "airport pickups, hotel check-in, meals, sessions, sightseeing in free slots, and checkout.\n", "Return the result as a Python list of dictionaries in this format:\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.[{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Hotel check-in\", \"Welcome dinner\"]}, ...]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Airport pickups\", \"Hotel check-in\", \"Welcome dinner\"]}, {\"day\": \"Day 2 - Pre-Wedding Events\", \"activities\": [\"Breakfast\", \"Rehearsal ceremony\", \"Lunch\", \"Sightseeing tour\", \"Rehearsal dinner\"]}, {\"day\": \"Day 3 - Wedding Day\", \"activities\": [\"Breakfast\", \"Ceremony preparation\", \"Wedding ceremony\", \"Cocktail hour\", \"Wedding reception\"]}, {\"day\": \"Day 4 - Post-Wedding Brunch and Departure\", \"activities\": [\"Farewell brunch\", \"Free time for sightseeing or relaxation\", \"Airport drop-offs\", \"Hotel checkout\"]}]\n", "✅ Parsed Final Answer: [{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Airport pickups\", \"Hotel check-in\", \"Welcome dinner\"]}, {\"day\": \"Day 2 - Pre-Wedding Events\", \"activities\": [\"Breakfast\", \"Rehearsal ceremony\", \"Lunch\", \"Sightseeing tour\", \"Rehearsal dinner\"]}, {\"day\": \"Day 3 - Wedding Day\", \"activities\": [\"Breakfast\", \"Ceremony preparation\", \"Wedding ceremony\", \"Cocktail hour\", \"Wedding reception\"]}, {\"day\": \"Day 4 - Post-Wedding Brunch and Departure\", \"activities\": [\"Farewell brunch\", \"Free time for sightseeing or relaxation\", \"Airport drop-offs\", \"Hotel checkout\"]}]\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a logistics planner. Based on this event, return:\n", "- A list of transport vendor types required\n", "- A dictionary of estimated vehicle needs by type\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return this as a Python dictionary with two keys: 'vendor_types' and 'vehicle_estimates'.\n", "Example:\n", "{\n", " \"vendor_types\": [\"shuttle service\", \"bus rental\"],\n", " \"vehicle_estimates\": {\"cars\": 3, \"shuttles\": 2, \"buses\": 1}\n", "}\n", "\n", "user_intent = {\n", " \"event_type\": \"wedding\",\n", " \"location\": \"Lahore\",\n", " \"event_date\": \"2025-06-10\",\n", " \"guest_count\": 300,\n", " \"preferences\": {\n", " \"stay_dates\": [\n", " \"2025-06-07\",\n", " \"2025-06-12\"\n", " ],\n", " \"guest_origins\": {\n", " \"Germany\": 20,\n", " \"Spain\": 20,\n", " \"local\": 260\n", " }\n", " },\n", " \"event_theme\": null,\n", " \"meal_count\": null,\n", " \"transport_needs\": null,\n", " \"sightseeing\": null\n", "}\n", "venues = [\n", " {\n", " \"name\": \"Mehmaan Khana Marriage Hall\",\n", " \"rating\": 4.6,\n", " \"address\": \"94 Lahore \\u2013 Kasur Rd, near Shama, Ichhra Lahore, 54000, Pakistan\",\n", " \"phone\": \"0321 6576011\",\n", " \"website\": \"http://www.mehmaankhana.com/\"\n", " },\n", " {\n", " \"name\": \"Grand Orchid Marquee\",\n", " \"rating\": 4.4,\n", " \"address\": \"land breeze housing\\u060c 5 Raiwind Rd, near Suzuki Showroom\\u060c Block B Lda Avenue Phase 1 Lda Avenue, \\u0644\\u0627\\u06c1\\u0648\\u0631\\u060c Pakistan\",\n", " \"phone\": \"(042) 35321023\",\n", " \"website\": \"N/A\"\n", " }\n", "]\n", "schedule = [\n", " {\n", " \"day\": \"Day 1 - Arrival\",\n", " \"activities\": [\n", " \"Airport pickups\",\n", " \"Hotel check-in\",\n", " \"Welcome dinner\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 2 - Pre-Wedding Events\",\n", " \"activities\": [\n", " \"Breakfast\",\n", " \"Rehearsal ceremony\",\n", " \"Lunch\",\n", " \"Sightseeing tour\",\n", " \"Rehearsal dinner\"\n", " ]\n", " }\n", "]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\n", " \"vendor_types\": [\"car rental\", \"shuttle service\", \"bus rental\"],\n", " \"vehicle_estimates\": {\"cars\": 10, \"shuttles\": 5, \"buses\": 2}\n", "}\n", "✅ Parsed Final Answer: {\n", " \"vendor_types\": [\"car rental\", \"shuttle service\", \"bus rental\"],\n", " \"vehicle_estimates\": {\"cars\": 10, \"shuttles\": 5, \"buses\": 2}\n", "}\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a summarizer for an event planner agent.\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Please summarize the key information from the 'Transportation' section in bullet points, focusing on top recommended options only.\n", "\n", "Transportation data:\n", "{\n", " \"transport_plan\": {\n", " \"vendor_types\": [\n", " \"car rental\",\n", " \"shuttle service\",\n", " \"bus rental\"\n", " ],\n", " \"vehicle_estimates\": {\n", " \"cars\": 10,\n", " \"shuttles\": 5,\n", " \"buses\": 2\n", " }\n", " },\n", " \"vendor_recommendations\": [\n", " {\n", " \"vendor_type\": \"car rental\",\n", " \"options\": [\n", " {\n", " \"name\": \"Fast Track Tours & Rentals - Rent a Luxury car in Lahore\",\n", " \"type\": \"car rental\",\n", " \"address\": \"Office # 295-Q, Commercial Area Sector Q DHA Phase 2, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.8\n", " },\n", " {\n", " \"name\": \"SAF Rent A Car Lahore\",\n", " \"type\": \"car rental\",\n", " \"address\": \"E90/43 Street 3, Extension Super Town, Lahore, 54810, Pakistan\",\n", " \"rating\": 4.8\n", " },\n", " {\n", " \"name\": \"Haririi Rent a Car Lahore\",\n", " \"type\": \"car rental\",\n", " \"address\": \"98 H Block, Cantt Street 147, Sector H Dha Phase 1, Lahore, Pakistan\",\n", " \"rating\": 4.9\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"shuttle service\",\n", " \"options\": [\n", " {\n", " \"name\": \"Daewoo Express Thokar Lahore\",\n", " \"type\": \"shuttle service\",\n", " \"address\": \"Thokar Niaz Baig Flyover, Amarkot, Lahore, Pakistan\",\n", " \"rating\": 4.1\n", " },\n", " {\n", " \"name\": \"Niazi Express Pvt. Limited\",\n", " \"type\": \"shuttle service\",\n", " \"address\": \"Band Rd, Shera Kot, Lahore, 54000, Pakistan\",\n", " \"rating\": 4\n", " },\n", " {\n", " \"name\": \"Road Master Bus Terminal Lahore\",\n", " \"type\": \"shuttle service\",\n", " \"address\": \"G7X9+79H, J Block Block J Gulshan-e-Ravi, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.5\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"bus rental\",\n", " \"options\": [\n", " {\n", " \"name\": \"Bookme - Bus, Flight, Train, Car Rental, Event, Hotels Booking\",\n", " \"type\": \"bus rental\",\n", " \"address\": \"NASTP, 69 Abid Majeed Rd, near Girja Chowk, Cantt, Lahore, 54660, Pakistan\",\n", " \"rating\": 4\n", " },\n", " {\n", " \"name\": \"Gujjar Travels & tours\",\n", " \"type\": \"bus rental\",\n", " \"address\": \"Main Walton Rd, near Defence Chowk Building of Bank Islamic, Super Town Lahore, 54000, Pakistan\",\n", " \"rating\": 5\n", " },\n", " {\n", " \"name\": \"4 Seasons Rent a Car Lahore DHA | Best luxury Auto Cars Airport | Limo-Limousine Hire Services Wedding\",\n", " \"type\": \"bus rental\",\n", " \"address\": \"2nd Floor 20, Devine Commercial Airport Rd, near Metro Cash N Carry, Block B Divine Gardens, Lahore, Pakistan\",\n", " \"rating\": 5\n", " }\n", " ]\n", " }\n", " ],\n", " \"parking_near_venues\": {\n", " \"Mehmaan Khana Marriage Hall\": [\n", " {\n", " \"name\": \"Ichra Parking\",\n", " \"address\": \"G8P9+94Q, Ichhra Lahore, 54000, Pakistan\",\n", " \"rating\": 3.5\n", " },\n", " {\n", " \"name\": \"Mehmaan Khana Marriage Hall\",\n", " \"address\": \"94 Lahore \\u2013 Kasur Rd, near Shama, Ichhra Lahore, 54000, Pakistan\",\n", " \"rating\": 4.6\n", " },\n", " {\n", " \"name\": \"Hassan centre car parking\",\n", " \"address\": \"G8MC+874, Lahore \\u2013 Kasur Rd, Ichhra Lahore, 54000, Pakistan\",\n", " \"rating\": 4.3\n", " }\n", " ],\n", " \"Grand Orchid Marquee\": [\n", " {\n", " \"name\": \"Suzuki Raiwind Motors\",\n", " \"address\": \"Raiwind Rd, Land Breez Block B Lda Avenue Phase 1 Lda Avenue, Lahore, 54000, Pakistan\",\n", " \"rating\": 3.9\n", " },\n", " {\n", " \"name\": \"Grand Orchid Marquee\",\n", " \"address\": \"land breeze housing\\u060c 5 Raiwind Rd\\u060c near Suzuki Showroom, Block B Lda Avenue Phase 1 Lda Avenue, Lahore, Pakistan\",\n", " \"rating\": 4.4\n", " },\n", " {\n", " \"name\": \"Paid parking for motorcycle and motar car\",\n", " \"address\": \"96RV+G27, Raiwind Rd, Lahore, Pakistan\",\n", " \"rating\": 5\n", " }\n", " ],\n", " \"RABAT banquet hall by Time & Taste\": [\n", " {\n", " \"name\": \"Lahore Garrison Golf & Country Club Parking\",\n", " \"address\": \"G9QV+JCW, Unnamed Road, Saddar Town, Lahore, Pakistan\",\n", " \"rating\": 4.6\n", " },\n", " {\n", " \"name\": \"Parking\",\n", " \"address\": \"226/9 Tufail Rd, Saddar Town, Lahore, Pakistan\",\n", " \"rating\": 2\n", " },\n", " {\n", " \"name\": \"Renoir by Zafar Group\",\n", " \"address\": \"Moulana Shoukat, Ali Road, Plot 9 Saadat Farooq Rd, Saddar Town, Lahore, Pakistan\",\n", " \"rating\": 4.4\n", " }\n", " ],\n", " \"Bagh-e-Jinnah\": [\n", " {\n", " \"name\": \"Parking For BISE LAHORE\",\n", " \"address\": \"H83F+PVX, Mozang Rd, Block B Jinnah Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.6\n", " },\n", " {\n", " \"name\": \"Parking, NCA\",\n", " \"address\": \"4 Shahrah-e-Quaid-e-Azam, Anarkali Bazaar Lahore, 54000, Pakistan\",\n", " \"rating\": 5\n", " },\n", " {\n", " \"name\": \"Public Parking\",\n", " \"address\": \"GPO Station, Anarkali Bazaar Mozang Chungi, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.5\n", " }\n", " ],\n", " \"Botanical Garden, \\u0628\\u0648\\u0679\\u06cc\\u0646\\u06a9\\u0644 \\u06af\\u0627\\u0631\\u0688\\u0646\": [\n", " {\n", " \"name\": \"Botanical Gardens Jallo Parking\",\n", " \"address\": \"HFFP+GQJ, Botanical Gardens Jallo, Canal Rd, adjacent Jallo Park, Lahore, Pakistan\",\n", " \"rating\": 4.5\n", " }\n", " ],\n", " \"Shalimar Gardens\": [\n", " {\n", " \"name\": \"Visitor Parking\",\n", " \"address\": \"H9MM+WR2, Shalamar Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 3\n", " },\n", " {\n", " \"name\": \"Shalimar Gardens\",\n", " \"address\": \"AH1, GT Rd, Shalamar Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.5\n", " },\n", " {\n", " \"name\": \"Shalimar Garden Orange line station\",\n", " \"address\": \"Singhpura, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.5\n", " }\n", " ],\n", " \"Beach Resort by Icon\": [],\n", " \"The Oasis Golf & Aqua Resort\": [\n", " {\n", " \"name\": \"Chaudhary parking stand\",\n", " \"address\": \"Colony, 4 sakeem street Mahajrabad, Multan Rd, near tyab, Sodiwal Lahore, 54500, Pakistan\",\n", " \"rating\": 4\n", " },\n", " {\n", " \"name\": \"Mazda truck stand free parking\",\n", " \"address\": \"Multan Rd, Wahdat Rd, Kamran Block Allama Iqbal Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 5\n", " },\n", " {\n", " \"name\": \"Gulshan-e-Iqbal car parking\",\n", " \"address\": \"G77P+GP7, Gulshan Block Allama Iqbal Town, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.8\n", " }\n", " ],\n", " \"Beach resort\": [\n", " {\n", " \"name\": \"Lahore Airport Parking\",\n", " \"address\": \"GCC7+6XW, Airport Avenue, Cantt, \\u0644\\u0627\\u06c1\\u0648\\u0631 54810, \\u0636\\u0644\\u0639 \\u0644\\u0627\\u06c1\\u0648\\u0631, \\u067e\\u0646\\u062c\\u0627\\u0628\\u060c, Pakistan\",\n", " \"rating\": 4.2\n", " },\n", " {\n", " \"name\": \"Railway Station Car Parking\",\n", " \"address\": \"H8GP+9FH, Swami Nagar Lahore, Pakistan\",\n", " \"rating\": 3.7\n", " }\n", " ]\n", " },\n", " \"transport_hubs\": {\n", " \"nearest_airport\": {\n", " \"name\": \"Allama Iqbal International Airport\",\n", " \"type\": \"international airport\",\n", " \"address\": \"Airport Rd, Cantt, Lahore, 54000, Pakistan\",\n", " \"rating\": 4.3\n", " },\n", " \"nearest_railway_station\": {\n", " \"name\": \"Abid Majeed Road\",\n", " \"type\": \"intercity railway station\",\n", " \"address\": \"PAF Officers Colony, Lahore, Pakistan\",\n", " \"rating\": \"N/A\"\n", " },\n", " \"nearest_bus_station\": {\n", " \"name\": \"Abid Majeed Road\",\n", " \"type\": \"intercity bus terminal\",\n", " \"address\": \"PAF Officers Colony, Lahore, Pakistan\",\n", " \"rating\": \"N/A\"\n", " }\n", " }\n", "}IMPORTANT: In each sub agent, Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"transportation_summary\": [\"Top car rental options include Haririi Rent a Car Lahore (Rating: 4.9), Fast Track Tours & Rentals (Rating: 4.8), and SAF Rent A Car Lahore (Rating: 4.8).\", \"Recommended shuttle services are Road Master Bus Terminal Lahore (Rating: 4.5) and Daewoo Express Thokar Lahore (Rating: 4.1).\", \"For bus rentals, top choices are Gujjar Travels & Tours (Rating: 5) and 4 Seasons Rent a Car Lahore DHA (Rating: 5).\"]}\n", "✅ Parsed Final Answer: {\"transportation_summary\": [\"Top car rental options include Haririi Rent a Car Lahore (Rating: 4.9), Fast Track Tours & Rentals (Rating: 4.8), and SAF Rent A Car Lahore (Rating: 4.8).\", \"Recommended shuttle services are Road Master Bus Terminal Lahore (Rating: 4.5) and Daewoo Express Thokar Lahore (Rating: 4.1).\", \"For bus rentals, top choices are Gujjar Travels & Tours (Rating: 5) and 4 Seasons Rent a Car Lahore DHA (Rating: 5).\"]}\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a hotel planning assistant.\n", "Based on the event type, location, and venues, determine the hotel needs.\n", "Return a Python dictionary with:\n", "- 'hotel_type': e.g., 3-star, 5-star\n", "- 'room_requirements': {single: int, double: int, suite: int}\n", "- 'priorities': list of preferences (e.g., budget, proximity, Wi-Fi)\n", "- 'suggested_hotels': optional hotel suggestions with name, type, rooms, amenities\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.user_intent = {\n", " \"event_type\": \"wedding\",\n", " \"location\": \"Lahore\",\n", " \"event_date\": \"2025-06-10\",\n", " \"guest_count\": 300,\n", " \"preferences\": {\n", " \"stay_dates\": [\n", " \"2025-06-07\",\n", " \"2025-06-12\"\n", " ],\n", " \"guest_origins\": {\n", " \"Germany\": 20,\n", " \"Spain\": 20,\n", " \"local\": 260\n", " }\n", " },\n", " \"event_theme\": null,\n", " \"meal_count\": null,\n", " \"transport_needs\": null,\n", " \"sightseeing\": null\n", "}\n", "venues = [\n", " {\n", " \"name\": \"Mehmaan Khana Marriage Hall\",\n", " \"rating\": 4.6,\n", " \"address\": \"94 Lahore \\u2013 Kasur Rd, near Shama, Ichhra Lahore, 54000, Pakistan\",\n", " \"phone\": \"0321 6576011\",\n", " \"website\": \"http://www.mehmaankhana.com/\"\n", " },\n", " {\n", " \"name\": \"Grand Orchid Marquee\",\n", " \"rating\": 4.4,\n", " \"address\": \"land breeze housing\\u060c 5 Raiwind Rd, near Suzuki Showroom\\u060c Block B Lda Avenue Phase 1 Lda Avenue, \\u0644\\u0627\\u06c1\\u0648\\u0631\\u060c Pakistan\",\n", " \"phone\": \"(042) 35321023\",\n", " \"website\": \"N/A\"\n", " }\n", "]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"hotel_type\": \"5-star\", \"room_requirements\": {\"single\": 40, \"double\": 10, \"suite\": 5}, \"priorities\": [\"proximity\", \"Wi-Fi\", \"luxury\"], \"suggested_hotels\": [{\"name\": \"Pearl Continental Hotel Lahore\", \"type\": \"5-star\", \"rooms\": \"500\", \"amenities\": [\"Wi-Fi\", \"pool\", \"spa\", \"restaurant\"]}, {\"name\": \"Avari Hotel Lahore\", \"type\": \"5-star\", \"rooms\": \"250\", \"amenities\": [\"Wi-Fi\", \"gym\", \"restaurant\", \"conference facilities\"]}]}\n", "✅ Parsed Final Answer: {\"hotel_type\": \"5-star\", \"room_requirements\": {\"single\": 40, \"double\": 10, \"suite\": 5}, \"priorities\": [\"proximity\", \"Wi-Fi\", \"luxury\"], \"suggested_hotels\": [{\"name\": \"Pearl Continental Hotel Lahore\", \"type\": \"5-star\", \"rooms\": \"500\", \"amenities\": [\"Wi-Fi\", \"pool\", \"spa\", \"restaurant\"]}, {\"name\": \"Avari Hotel Lahore\", \"type\": \"5-star\", \"rooms\": \"250\", \"amenities\": [\"Wi-Fi\", \"gym\", \"restaurant\", \"conference facilities\"]}]}\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a summarizer for an event planner agent.\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Please summarize the key information from the 'Hotels' section in bullet points, focusing on top recommended options only.\n", "\n", "Hotels data:\n", "{\n", " \"hotel_type\": \"5-star\",\n", " \"room_requirements\": {\n", " \"single\": 40,\n", " \"double\": 10,\n", " \"suite\": 5\n", " },\n", " \"priorities\": [\n", " \"proximity\",\n", " \"Wi-Fi\",\n", " \"luxury\"\n", " ],\n", " \"recommendations\": {\n", " \"Mehmaan Khana Marriage Hall\": [\n", " {\n", " \"name\": \"Luxus Grand Hotel\",\n", " \"rating\": 4.4,\n", " \"address\": \"4 Egerton Rd, near Ewan-e-Iqbal, Garhi Shahu, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0320 1999955\",\n", " \"website\": \"http://luxusgrandhotel.com/\"\n", " },\n", " {\n", " \"name\": \"Hayyat Luxury Hotel Apartments | Family Hotel in Lahore\",\n", " \"rating\": 4.7,\n", " \"address\": \"56 Lawrence Road, near china chowk, Jinnah Town, Lahore, 54600, Pakistan\",\n", " \"phone\": \"0313 6766699\",\n", " \"website\": \"https://www.hayyathotels.com/?utm_source=google&utm_medium=wix_google_business_profile&utm_campaign=2488859883140921026\"\n", " },\n", " {\n", " \"name\": \"Four Points by Sheraton Lahore\",\n", " \"rating\": 4.3,\n", " \"address\": \"25 Egerton Rd, Garhi Shahu, Lahore, 54000, Pakistan\",\n", " \"phone\": \"(042) 36310077\",\n", " \"website\": \"https://www.marriott.com/en-us/hotels/lhefp-four-points-lahore/overview/?scid=f2ae0541-1279-4f24-b197-a979c79310b0\"\n", " }\n", " ],\n", " \"Grand Orchid Marquee\": [\n", " {\n", " \"name\": \"Grand Orchid Marquee\",\n", " \"rating\": 4.4,\n", " \"address\": \"land breeze housing\\u060c 5 Raiwind Rd, near Suzuki Showroom\\u060c Block B Lda Avenue Phase 1 Lda Avenue, \\u0644\\u0627\\u06c1\\u0648\\u0631\\u060c Pakistan\",\n", " \"phone\": \"(042) 35321023\",\n", " \"website\": \"N/A\"\n", " }\n", " ],\n", " \"RABAT banquet hall by Time & Taste\": [\n", " {\n", " \"name\": \"Royal Swiss Hotel\",\n", " \"rating\": 4.5,\n", " \"address\": \"opposite Cargo Complex, Allama Iqbal International Airport, Lahore, 54800, Pakistan\",\n", " \"phone\": \"(042) 111 000 329\",\n", " \"website\": \"https://swissinternationalhotels.com/hotel/royalswiss/lahore/\"\n", " },\n", " {\n", " \"name\": \"Pearl Continental Hotel, Lahore\",\n", " \"rating\": 4.4,\n", " \"address\": \"Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, Pakistan\",\n", " \"phone\": \"(042) 111 505 505\",\n", " \"website\": \"http://www.pchotels.com/pclahore\"\n", " },\n", " {\n", " \"name\": \"Luxus Grand Hotel\",\n", " \"rating\": 4.4,\n", " \"address\": \"4 Egerton Rd, near Ewan-e-Iqbal, Garhi Shahu, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0320 1999955\",\n", " \"website\": \"http://luxusgrandhotel.com/\"\n", " }\n", " ],\n", " \"Bagh-e-Jinnah\": [\n", " {\n", " \"name\": \"Luxus Grand Hotel\",\n", " \"rating\": 4.4,\n", " \"address\": \"4 Egerton Rd, near Ewan-e-Iqbal, Garhi Shahu, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0320 1999955\",\n", " \"website\": \"http://luxusgrandhotel.com/\"\n", " },\n", " {\n", " \"name\": \"Pearl Continental Hotel, Lahore\",\n", " \"rating\": 4.4,\n", " \"address\": \"Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, Pakistan\",\n", " \"phone\": \"(042) 111 505 505\",\n", " \"website\": \"http://www.pchotels.com/pclahore\"\n", " },\n", " {\n", " \"name\": \"Avari Hotel Lahore\",\n", " \"rating\": 4.7,\n", " \"address\": \"Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, 54000, Pakistan\",\n", " \"phone\": \"(042) 36366366\",\n", " \"website\": \"http://www.avari.com/\"\n", " }\n", " ],\n", " \"Botanical Garden, \\u0628\\u0648\\u0679\\u06cc\\u0646\\u06a9\\u0644 \\u06af\\u0627\\u0631\\u0688\\u0646\": [\n", " {\n", " \"name\": \"Royal Swiss Hotel\",\n", " \"rating\": 4.5,\n", " \"address\": \"opposite Cargo Complex, Allama Iqbal International Airport, Lahore, 54800, Pakistan\",\n", " \"phone\": \"(042) 111 000 329\",\n", " \"website\": \"https://swissinternationalhotels.com/hotel/royalswiss/lahore/\"\n", " },\n", " {\n", " \"name\": \"Pearl Continental Hotel, Lahore\",\n", " \"rating\": 4.4,\n", " \"address\": \"Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, Pakistan\",\n", " \"phone\": \"(042) 111 505 505\",\n", " \"website\": \"http://www.pchotels.com/pclahore\"\n", " },\n", " {\n", " \"name\": \"Luxus Grand Hotel\",\n", " \"rating\": 4.4,\n", " \"address\": \"4 Egerton Rd, near Ewan-e-Iqbal, Garhi Shahu, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0320 1999955\",\n", " \"website\": \"http://luxusgrandhotel.com/\"\n", " }\n", " ],\n", " \"Shalimar Gardens\": [\n", " {\n", " \"name\": \"Luxus Grand Hotel\",\n", " \"rating\": 4.4,\n", " \"address\": \"4 Egerton Rd, near Ewan-e-Iqbal, Garhi Shahu, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0320 1999955\",\n", " \"website\": \"http://luxusgrandhotel.com/\"\n", " },\n", " {\n", " \"name\": \"Royal Swiss Hotel\",\n", " \"rating\": 4.5,\n", " \"address\": \"opposite Cargo Complex, Allama Iqbal International Airport, Lahore, 54800, Pakistan\",\n", " \"phone\": \"(042) 111 000 329\",\n", " \"website\": \"https://swissinternationalhotels.com/hotel/royalswiss/lahore/\"\n", " },\n", " {\n", " \"name\": \"Pearl Continental Hotel, Lahore\",\n", " \"rating\": 4.4,\n", " \"address\": \"Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, Pakistan\",\n", " \"phone\": \"(042) 111 505 505\",\n", " \"website\": \"http://www.pchotels.com/pclahore\"\n", " }\n", " ],\n", " \"Beach Resort by Icon\": [],\n", " \"The Oasis Golf & Aqua Resort\": [\n", " {\n", " \"name\": \"Luxus Grand Hotel\",\n", " \"rating\": 4.4,\n", " \"address\": \"4 Egerton Rd, near Ewan-e-Iqbal, Garhi Shahu, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0320 1999955\",\n", " \"website\": \"http://luxusgrandhotel.com/\"\n", " },\n", " {\n", " \"name\": \"The Nishat Hotel\",\n", " \"rating\": 4.5,\n", " \"address\": \"1 Abdul Haque Rd, Block G1 Block G 1 Phase 1 Johar Town, Lahore, 54700, Pakistan\",\n", " \"phone\": \"(042) 111 646 835\",\n", " \"website\": \"https://nishathotels.com/explore/johar-town/\"\n", " },\n", " {\n", " \"name\": \"Shelton Hotel Lahore\",\n", " \"rating\": 4.1,\n", " \"address\": \"225 Ibraheem Bukhari Rd, J 3 Block Block J 3 Phase 2 Johar Town, Lahore, Pakistan\",\n", " \"phone\": \"0336 8777793\",\n", " \"website\": \"N/A\"\n", " }\n", " ],\n", " \"Beach resort\": [\n", " {\n", " \"name\": \"Luxus Grand Hotel\",\n", " \"rating\": 4.4,\n", " \"address\": \"4 Egerton Rd, near Ewan-e-Iqbal, Garhi Shahu, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0320 1999955\",\n", " \"website\": \"http://luxusgrandhotel.com/\"\n", " },\n", " {\n", " \"name\": \"Avari Hotel Lahore\",\n", " \"rating\": 4.7,\n", " \"address\": \"Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, 54000, Pakistan\",\n", " \"phone\": \"(042) 36366366\",\n", " \"website\": \"http://www.avari.com/\"\n", " },\n", " {\n", " \"name\": \"Pearl Continental Hotel, Lahore\",\n", " \"rating\": 4.4,\n", " \"address\": \"Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, Pakistan\",\n", " \"phone\": \"(042) 111 505 505\",\n", " \"website\": \"http://www.pchotels.com/pclahore\"\n", " }\n", " ]\n", " }\n", "}IMPORTANT: In each sub agent, Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"bullet_points\": [\"Luxus Grand Hotel - Rating: 4.4, Address: 4 Egerton Rd, near Ewan-e-Iqbal, Garhi Shahu, Lahore, 54000, Pakistan, Phone: 0320 1999955, Website: http://luxusgrandhotel.com/\", \"Hayyat Luxury Hotel Apartments - Rating: 4.7, Address: 56 Lawrence Road, near china chowk, Jinnah Town, Lahore, 54600, Pakistan, Phone: 0313 6766699, Website: https://www.hayyathotels.com/?utm_source=google&utm_medium=wix_google_business_profile&utm_campaign=2488859883140921026\", \"Royal Swiss Hotel - Rating: 4.5, Address: opposite Cargo Complex, Allama Iqbal International Airport, Lahore, 54800, Pakistan, Phone: (042) 111 000 329, Website: https://swissinternationalhotels.com/hotel/royalswiss/lahore/\", \"Pearl Continental Hotel, Lahore - Rating: 4.4, Address: Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, Pakistan, Phone: (042) 111 505 505, Website: http://www.pchotels.com/pclahore\", \"Avari Hotel Lahore - Rating: 4.7, Address: Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, 54000, Pakistan, Phone: (042) 36366366, Website: http://www.avari.com/\", \"The Nishat Hotel - Rating: 4.5, Address: 1 Abdul Haque Rd, Block G1 Block G 1 Phase 1 Johar Town, Lahore, 54700, Pakistan, Phone: (042) 111 646 835, Website: https://nishathotels.com/explore/johar-town/\"]}\n", "✅ Parsed Final Answer: {\"bullet_points\": [\"Luxus Grand Hotel - Rating: 4.4, Address: 4 Egerton Rd, near Ewan-e-Iqbal, Garhi Shahu, Lahore, 54000, Pakistan, Phone: 0320 1999955, Website: http://luxusgrandhotel.com/\", \"Hayyat Luxury Hotel Apartments - Rating: 4.7, Address: 56 Lawrence Road, near china chowk, Jinnah Town, Lahore, 54600, Pakistan, Phone: 0313 6766699, Website: https://www.hayyathotels.com/?utm_source=google&utm_medium=wix_google_business_profile&utm_campaign=2488859883140921026\", \"Royal Swiss Hotel - Rating: 4.5, Address: opposite Cargo Complex, Allama Iqbal International Airport, Lahore, 54800, Pakistan, Phone: (042) 111 000 329, Website: https://swissinternationalhotels.com/hotel/royalswiss/lahore/\", \"Pearl Continental Hotel, Lahore - Rating: 4.4, Address: Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, Pakistan, Phone: (042) 111 505 505, Website: http://www.pchotels.com/pclahore\", \"Avari Hotel Lahore - Rating: 4.7, Address: Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, 54000, Pakistan, Phone: (042) 36366366, Website: http://www.avari.com/\", \"The Nishat Hotel - Rating: 4.5, Address: 1 Abdul Haque Rd, Block G1 Block G 1 Phase 1 Johar Town, Lahore, 54700, Pakistan, Phone: (042) 111 646 835, Website: https://nishathotels.com/explore/johar-town/\"]}\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a cultural planner helping design event schedules.\n", "Given the event type and a brief schedule summary, recommend whether sightseeing could be meaningfully integrated.\n", "If so, suggest the type and ideal time.\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return ONLY a Python dictionary with the following keys:\n", "- 'is_required' (true/false)\n", "- 'sightseeing_type' (e.g. cultural, shopping, historical)\n", "- 'integration_notes' (e.g. best added on Day 2 afternoon)\n", "\n", "Do NOT return anything else. No text. No schedule. No explanation. and no emojis\n", "Example:\n", "{\n", " \"is_required\": true,\n", " \"sightseeing_type\": \"Cultural\",\n", " \"integration_notes\": \"Schedule it on Day 2 afternoon.\"\n", "}\n", "\n", "IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.Event type: wedding\n", "Schedule summary:\n", "Day 1 - Arrival: Airport pickups\n", "Day 2 - Pre-Wedding Events: Breakfast\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"is_required\": true, \"sightseeing_type\": \"Cultural\", \"integration_notes\": \"Schedule it on Day 2 afternoon.\"}\n", "✅ Parsed Final Answer: {\"is_required\": true, \"sightseeing_type\": \"Cultural\", \"integration_notes\": \"Schedule it on Day 2 afternoon.\"}\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a summarizer for an event planner agent.\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Please summarize the key information from the 'Sightseeing' section in bullet points, focusing on top recommended options only.\n", "\n", "Sightseeing data:\n", "{\n", " \"is_required\": true,\n", " \"sightseeing_type\": \"Cultural\",\n", " \"integration_notes\": \"Schedule it on Day 2 afternoon.\",\n", " \"suggested_places\": [\n", " {\n", " \"name\": \"Al-Hamra Cultural Complex\",\n", " \"rating\": 4.4,\n", " \"address\": \"G87J+V7J, Old F.C.C. Gulberg III, Lahore, Pakistan\",\n", " \"type\": \"Cultural\",\n", " \"description\": [\n", " \"tourist_attraction\",\n", " \"point_of_interest\",\n", " \"establishment\"\n", " ]\n", " },\n", " {\n", " \"name\": \"Lahore Museum\",\n", " \"rating\": 4.5,\n", " \"address\": \"H895+93H, Mall Rd, Anarkali Bazaar Lahore, 54000, Pakistan\",\n", " \"type\": \"Cultural\",\n", " \"description\": [\n", " \"tourist_attraction\",\n", " \"museum\",\n", " \"point_of_interest\",\n", " \"establishment\"\n", " ]\n", " },\n", " {\n", " \"name\": \"Sheesh Mahal Lahore\",\n", " \"rating\": 4.5,\n", " \"address\": \"H8Q7+X7F, Walled City of Lahore, Lahore, Pakistan\",\n", " \"type\": \"Cultural\",\n", " \"description\": [\n", " \"tourist_attraction\",\n", " \"point_of_interest\",\n", " \"establishment\"\n", " ]\n", " },\n", " {\n", " \"name\": \"Lahore Fort\",\n", " \"rating\": 4.6,\n", " \"address\": \"H8Q7+56P, Fort Rd, Walled City of Lahore, Lahore, Pakistan\",\n", " \"type\": \"Cultural\",\n", " \"description\": [\n", " \"tourist_attraction\",\n", " \"point_of_interest\",\n", " \"establishment\"\n", " ]\n", " },\n", " {\n", " \"name\": \"Gali Surjan Singh\",\n", " \"rating\": 4.6,\n", " \"address\": \"H8MG+286, Gali Surjan Singh, Gur Mandi Kucha Deputy Alam Shah Walled City of Lahore, Lahore, 54000, Pakistan\",\n", " \"type\": \"Cultural\",\n", " \"description\": [\n", " \"tourist_attraction\",\n", " \"point_of_interest\",\n", " \"establishment\"\n", " ]\n", " }\n", " ]\n", "}IMPORTANT: In each sub agent, Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"is_required\":true,\"key_points\":[\"Schedule on Day 2 afternoon.\",\"Top recommended places:\",\"1. Lahore Fort, Rating: 4.6, Address: H8Q7+56P, Fort Rd, Walled City of Lahore.\",\"2. Gali Surjan Singh, Rating: 4.6, Address: H8MG+286, Gali Surjan Singh, Gur Mandi Kucha Deputy Alam Shah Walled City of Lahore.\",\"3. Lahore Museum, Rating: 4.5, Address: H895+93H, Mall Rd, Anarkali Bazaar Lahore.\",\"4. Sheesh Mahal Lahore, Rating: 4.5, Address: H8Q7+X7F, Walled City of Lahore.\"]}\n", "✅ Parsed Final Answer: {\"is_required\":true,\"key_points\":[\"Schedule on Day 2 afternoon.\",\"Top recommended places:\",\"1. Lahore Fort, Rating: 4.6, Address: H8Q7+56P, Fort Rd, Walled City of Lahore.\",\"2. Gali Surjan Singh, Rating: 4.6, Address: H8MG+286, Gali Surjan Singh, Gur Mandi Kucha Deputy Alam Shah Walled City of Lahore.\",\"3. Lahore Museum, Rating: 4.5, Address: H895+93H, Mall Rd, Anarkali Bazaar Lahore.\",\"4. Sheesh Mahal Lahore, Rating: 4.5, Address: H8Q7+X7F, Walled City of Lahore.\"]}\n", "🧠 Calling MealPlannerTool via ReAct agent...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: Use the meal planner tool to suggest an appropriate structured meal plan for the event in Lahore based on the schedule. Use the schedule and intent below:\n", "\n", "{\n", " \"event_type\": \"wedding\",\n", " \"location\": \"Lahore\",\n", " \"schedule\": [\n", " {\n", " \"day\": \"Day 1 - Arrival\",\n", " \"activities\": [\n", " \"Airport pickups\",\n", " \"Hotel check-in\",\n", " \"Welcome dinner\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 2 - Pre-Wedding Events\",\n", " \"activities\": [\n", " \"Breakfast\",\n", " \"Rehearsal ceremony\",\n", " \"Lunch\",\n", " \"Sightseeing tour\",\n", " \"Rehearsal dinner\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 3 - Wedding Day\",\n", " \"activities\": [\n", " \"Breakfast\",\n", " \"Ceremony preparation\",\n", " \"Wedding ceremony\",\n", " \"Cocktail hour\",\n", " \"Wedding reception\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 4 - Post-Wedding Brunch and Departure\",\n", " \"activities\": [\n", " \"Farewell brunch\",\n", " \"Free time for sightseeing or relaxation\",\n", " \"Airport drop-offs\",\n", " \"Hotel checkout\"\n", " ]\n", " }\n", " ]\n", "}IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: \n", "{\n", " \"meal_plan\": [\n", " {\n", " \"day\": \"Day 1 - Arrival\",\n", " \"meals\": [\n", " {\n", " \"type\": \"Welcome Dinner\",\n", " \"cuisine\": \"Traditional Pakistani\",\n", " \"menu\": [\n", " \"Chicken Karahi\",\n", " \"Mutton Biryani\",\n", " \"Naan\",\n", " \"Mixed Vegetable Curry\",\n", " \"Kheer\",\n", " \"Chai\"\n", " ]\n", " }\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 2 - Pre-Wedding Events\",\n", " \"meals\": [\n", " {\n", " \"type\": \"Breakfast\",\n", " \"cuisine\": \"Continental\",\n", " \"menu\": [\n", " \"Assorted Cereals\",\n", " \"Fresh Fruit\",\n", " \"Omelettes\",\n", " \"Parathas\",\n", " \"Chai\",\n", " \"Coffee\"\n", " ]\n", " },\n", " {\n", " \"type\": \"Lunch\",\n", " \"cuisine\": \"Pakistani\",\n", " \"menu\": [\n", " \"Beef Korma\",\n", " \"Palak Paneer\",\n", " \"Rice Pilaf\",\n", " \"Chapati\",\n", " \"Raita\",\n", " \"Mango Lassi\"\n", " ]\n", " },\n", " {\n", " \"type\": \"Rehearsal Dinner\",\n", " \"cuisine\": \"Fusion\",\n", " \"menu\": [\n", " \"Grilled Fish\",\n", " \"Spaghetti Bolognese\",\n", " \"Garlic Bread\",\n", " \"Caesar Salad\",\n", " \"Tiramisu\",\n", " \"Mocktails\"\n", " ]\n", " }\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 3 - Wedding Day\",\n", " \"meals\": [\n", " {\n", " \"type\": \"Breakfast\",\n", " \"cuisine\": \"Traditional Pakistani\",\n", " \"menu\": [\n", " \"Halwa Puri\",\n", " \"Channa Masala\",\n", " \"Lassi\",\n", " \"Fresh Juices\"\n", " ]\n", " },\n", " {\n", " \"type\": \"Cocktail Hour\",\n", " \"cuisine\": \"Appetizers\",\n", " \"menu\": [\n", " \"Mini Samosas\",\n", " \"Spring Rolls\",\n", " \"Chicken Satay\",\n", " \"Fruit Skewers\",\n", " \"Mocktails\"\n", " ]\n", " },\n", " {\n", " \"type\": \"Wedding Reception\",\n", " \"cuisine\": \"Pakistani Cuisine\",\n", " \"menu\": [\n", " \"Lamb Roast\",\n", " \"Chicken Biryani\",\n", " \"Aloo Gobi\",\n", " \"Naan\",\n", " \"Gulab Jamun\",\n", " \"Soft Drinks\"\n", " ]\n", " }\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 4 - Post-Wedding Brunch and Departure\",\n", " \"meals\": [\n", " {\n", " \"type\": \"Farewell Brunch\",\n", " \"cuisine\": \"Mixed\",\n", " \"menu\": [\n", " \"Pancakes\",\n", " \"Scrambled Eggs\",\n", " \"Sausages\",\n", " \"Yogurt Parfaits\",\n", " \"Tea\",\n", " \"Coffee\"\n", " ]\n", " }\n", " ]\n", " }\n", " ]\n", "}\n", "✅ Parsed Final Answer: {\n", " \"meal_plan\": [\n", " {\n", " \"day\": \"Day 1 - Arrival\",\n", " \"meals\": [\n", " {\n", " \"type\": \"Welcome Dinner\",\n", " \"cuisine\": \"Traditional Pakistani\",\n", " \"menu\": [\n", " \"Chicken Karahi\",\n", " \"Mutton Biryani\",\n", " \"Naan\",\n", " \"Mixed Vegetable Curry\",\n", " \"Kheer\",\n", " \"Chai\"\n", " ]\n", " }\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 2 - Pre-Wedding Events\",\n", " \"meals\": [\n", " {\n", " \"type\": \"Breakfast\",\n", " \"cuisine\": \"Continental\",\n", " \"menu\": [\n", " \"Assorted Cereals\",\n", " \"Fresh Fruit\",\n", " \"Omelettes\",\n", " \"Parathas\",\n", " \"Chai\",\n", " \"Coffee\"\n", " ]\n", " },\n", " {\n", " \"type\": \"Lunch\",\n", " \"cuisine\": \"Pakistani\",\n", " \"menu\": [\n", " \"Beef Korma\",\n", " \"Palak Paneer\",\n", " \"Rice Pilaf\",\n", " \"Chapati\",\n", " \"Raita\",\n", " \"Mango Lassi\"\n", " ]\n", " },\n", " {\n", " \"type\": \"Rehearsal Dinner\",\n", " \"cuisine\": \"Fusion\",\n", " \"menu\": [\n", " \"Grilled Fish\",\n", " \"Spaghetti Bolognese\",\n", " \"Garlic Bread\",\n", " \"Caesar Salad\",\n", " \"Tiramisu\",\n", " \"Mocktails\"\n", " ]\n", " }\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 3 - Wedding Day\",\n", " \"meals\": [\n", " {\n", " \"type\": \"Breakfast\",\n", " \"cuisine\": \"Traditional Pakistani\",\n", " \"menu\": [\n", " \"Halwa Puri\",\n", " \"Channa Masala\",\n", " \"Lassi\",\n", " \"Fresh Juices\"\n", " ]\n", " },\n", " {\n", " \"type\": \"Cocktail Hour\",\n", " \"cuisine\": \"Appetizers\",\n", " \"menu\": [\n", " \"Mini Samosas\",\n", " \"Spring Rolls\",\n", " \"Chicken Satay\",\n", " \"Fruit Skewers\",\n", " \"Mocktails\"\n", " ]\n", " },\n", " {\n", " \"type\": \"Wedding Reception\",\n", " \"cuisine\": \"Pakistani Cuisine\",\n", " \"menu\": [\n", " \"Lamb Roast\",\n", " \"Chicken Biryani\",\n", " \"Aloo Gobi\",\n", " \"Naan\",\n", " \"Gulab Jamun\",\n", " \"Soft Drinks\"\n", " ]\n", " }\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 4 - Post-Wedding Brunch and Departure\",\n", " \"meals\": [\n", " {\n", " \"type\": \"Farewell Brunch\",\n", " \"cuisine\": \"Mixed\",\n", " \"menu\": [\n", " \"Pancakes\",\n", " \"Scrambled Eggs\",\n", " \"Sausages\",\n", " \"Yogurt Parfaits\",\n", " \"Tea\",\n", " \"Coffee\"\n", " ]\n", " }\n", " ]\n", " }\n", " ]\n", "}\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a summarizer for an event planner agent.\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Please summarize the key information from the 'Catering' section in bullet points, focusing on top recommended options only.\n", "\n", "Catering data:\n", "{\n", " \"catering_plan\": \"{\\n \\\"meal_plan\\\": [\\n {\\n \\\"day\\\": \\\"Day 1 - Arrival\\\",\\n \\\"meals\\\": [\\n {\\n \\\"type\\\": \\\"Welcome Dinner\\\",\\n \\\"cuisine\\\": \\\"Traditional Pakistani\\\",\\n \\\"menu\\\": [\\n \\\"Chicken Karahi\\\",\\n \\\"Mutton Biryani\\\",\\n \\\"Naan\\\",\\n \\\"Mixed Vegetable Curry\\\",\\n \\\"Kheer\\\",\\n \\\"Chai\\\"\\n ]\\n }\\n ]\\n },\\n {\\n \\\"day\\\": \\\"Day 2 - Pre-Wedding Events\\\",\\n \\\"meals\\\": [\\n {\\n \\\"type\\\": \\\"Breakfast\\\",\\n \\\"cuisine\\\": \\\"Continental\\\",\\n \\\"menu\\\": [\\n \\\"Assorted Cereals\\\",\\n \\\"Fresh Fruit\\\",\\n \\\"Omelettes\\\",\\n \\\"Parathas\\\",\\n \\\"Chai\\\",\\n \\\"Coffee\\\"\\n ]\\n },\\n {\\n \\\"type\\\": \\\"Lunch\\\",\\n \\\"cuisine\\\": \\\"Pakistani\\\",\\n \\\"menu\\\": [\\n \\\"Beef Korma\\\",\\n \\\"Palak Paneer\\\",\\n \\\"Rice Pilaf\\\",\\n \\\"Chapati\\\",\\n \\\"Raita\\\",\\n \\\"Mango Lassi\\\"\\n ]\\n },\\n {\\n \\\"type\\\": \\\"Rehearsal Dinner\\\",\\n \\\"cuisine\\\": \\\"Fusion\\\",\\n \\\"menu\\\": [\\n \\\"Grilled Fish\\\",\\n \\\"Spaghetti Bolognese\\\",\\n \\\"Garlic Bread\\\",\\n \\\"Caesar Salad\\\",\\n \\\"Tiramisu\\\",\\n \\\"Mocktails\\\"\\n ]\\n }\\n ]\\n },\\n {\\n \\\"day\\\": \\\"Day 3 - Wedding Day\\\",\\n \\\"meals\\\": [\\n {\\n \\\"type\\\": \\\"Breakfast\\\",\\n \\\"cuisine\\\": \\\"Traditional Pakistani\\\",\\n \\\"menu\\\": [\\n \\\"Halwa Puri\\\",\\n \\\"Channa Masala\\\",\\n \\\"Lassi\\\",\\n \\\"Fresh Juices\\\"\\n ]\\n },\\n {\\n \\\"type\\\": \\\"Cocktail Hour\\\",\\n \\\"cuisine\\\": \\\"Appetizers\\\",\\n \\\"menu\\\": [\\n \\\"Mini Samosas\\\",\\n \\\"Spring Rolls\\\",\\n \\\"Chicken Satay\\\",\\n \\\"Fruit Skewers\\\",\\n \\\"Mocktails\\\"\\n ]\\n },\\n {\\n \\\"type\\\": \\\"Wedding Reception\\\",\\n \\\"cuisine\\\": \\\"Pakistani Cuisine\\\",\\n \\\"menu\\\": [\\n \\\"Lamb Roast\\\",\\n \\\"Chicken Biryani\\\",\\n \\\"Aloo Gobi\\\",\\n \\\"Naan\\\",\\n \\\"Gulab Jamun\\\",\\n \\\"Soft Drinks\\\"\\n ]\\n }\\n ]\\n },\\n {\\n \\\"day\\\": \\\"Day 4 - Post-Wedding Brunch and Departure\\\",\\n \\\"meals\\\": [\\n {\\n \\\"type\\\": \\\"Farewell Brunch\\\",\\n \\\"cuisine\\\": \\\"Mixed\\\",\\n \\\"menu\\\": [\\n \\\"Pancakes\\\",\\n \\\"Scrambled Eggs\\\",\\n \\\"Sausages\\\",\\n \\\"Yogurt Parfaits\\\",\\n \\\"Tea\\\",\\n \\\"Coffee\\\"\\n ]\\n }\\n ]\\n }\\n ]\\n}\",\n", " \"caterer_recommendations\": {\n", " \"breakfast\": [\n", " {\n", " \"name\": \"Bundu Khan Restaurant - Liberty\",\n", " \"rating\": 4.3,\n", " \"address\": \"1 - Liberty Market\\u060c Noor Jehan Rd, Block D1 Gulberg III, Lahore, 54000, Pakistan\",\n", " \"phone\": \"(042) 35756108\",\n", " \"website\": \"http://www.bundukhan.pk/\"\n", " },\n", " {\n", " \"name\": \"Chaay\\u00e9 Khana\",\n", " \"rating\": 4.2,\n", " \"address\": \"Pearl One, 94 MM Alam Rd, Block B1 Block B 1 Gulberg III, Lahore, Pakistan\",\n", " \"phone\": \"(042) 35778284\",\n", " \"website\": \"https://www.chaayekhana.com/\"\n", " },\n", " {\n", " \"name\": \"Monal Lahore\",\n", " \"rating\": 4.3,\n", " \"address\": \"Plaza Liberty Park and Ride Plaza, Liberty Chowk\\u060c Round About, Commercial Area Gulberg III, Lahore, Pakistan\",\n", " \"phone\": \"(042) 35789823\",\n", " \"website\": \"N/A\"\n", " }\n", " ],\n", " \"lunch\": [\n", " {\n", " \"name\": \"Moon catering services.\",\n", " \"rating\": 4.9,\n", " \"address\": \"Bastami Rd, Samanabad Town, Lahore, 54400, Pakistan\",\n", " \"phone\": \"0323 1460433\",\n", " \"website\": \"N/A\"\n", " },\n", " {\n", " \"name\": \"AL-Tuaam Catering and Event Planner\",\n", " \"rating\": 4.8,\n", " \"address\": \"Office # 4, 1st Floor, Zaffar Nadeem Plaza 31-B, Block B Faisal Town, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0311 1100108\",\n", " \"website\": \"https://altuaam.com/\"\n", " },\n", " {\n", " \"name\": \"LAHORE CATERING & DECOR COMPANY\",\n", " \"rating\": 5,\n", " \"address\": \"Main Samsani Rd, Block M Phase 2 Johar Town, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0306 9805301\",\n", " \"website\": \"https://www.facebook.com/lahorecateringdecorcompany?mibextid=ZbWKwL\"\n", " }\n", " ],\n", " \"dinner\": [\n", " {\n", " \"name\": \"AL-Tuaam Catering and Event Planner\",\n", " \"rating\": 4.8,\n", " \"address\": \"Office # 4, 1st Floor, Zaffar Nadeem Plaza 31-B, Block B Faisal Town, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0311 1100108\",\n", " \"website\": \"https://altuaam.com/\"\n", " },\n", " {\n", " \"name\": \"G.N CATERERS & EVENT PLANNERS\",\n", " \"rating\": 4.9,\n", " \"address\": \"Plot no 21, F2 Block, Block F2 Block F 2 Phase 1 Johar Town, Lahore, 54782, Pakistan\",\n", " \"phone\": \"0300 4866228\",\n", " \"website\": \"https://gncaterers.com/\"\n", " },\n", " {\n", " \"name\": \"Azam Sons Food & Caterers\",\n", " \"rating\": 4.9,\n", " \"address\": \"Shop no 222, Block E1 Block E 1 Phase 1 Johar Town, Lahore, 54782, Pakistan\",\n", " \"phone\": \"0309 4358070\",\n", " \"website\": \"http://azamsonsfoodcaterers.mydurable.com/\"\n", " }\n", " ]\n", " }\n", "}IMPORTANT: In each sub agent, Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"catering_summary\": {\"top_recommendations\": {\"breakfast\": {\"name\": \"Bundu Khan Restaurant - Liberty\", \"rating\": 4.3, \"address\": \"1 - Liberty Market, Noor Jehan Rd, Block D1 Gulberg III, Lahore, 54000, Pakistan\", \"phone\": \"(042) 35756108\", \"website\": \"http://www.bundukhan.pk/\"}, \"lunch\": {\"name\": \"LAHORE CATERING & DECOR COMPANY\", \"rating\": 5, \"address\": \"Main Samsani Rd, Block M Phase 2 Johar Town, Lahore, 54000, Pakistan\", \"phone\": \"0306 9805301\", \"website\": \"https://www.facebook.com/lahorecateringdecorcompany?mibextid=ZbWKwL\"}, \"dinner\": {\"name\": \"G.N CATERERS & EVENT PLANNERS\", \"rating\": 4.9, \"address\": \"Plot no 21, F2 Block, Block F2 Block F 2 Phase 1 Johar Town, Lahore, 54782, Pakistan\", \"phone\": \"0300 4866228\", \"website\": \"https://gncaterers.com/\"}}}}\n", "✅ Parsed Final Answer: {\"catering_summary\": {\"top_recommendations\": {\"breakfast\": {\"name\": \"Bundu Khan Restaurant - Liberty\", \"rating\": 4.3, \"address\": \"1 - Liberty Market, Noor Jehan Rd, Block D1 Gulberg III, Lahore, 54000, Pakistan\", \"phone\": \"(042) 35756108\", \"website\": \"http://www.bundukhan.pk/\"}, \"lunch\": {\"name\": \"LAHORE CATERING & DECOR COMPANY\", \"rating\": 5, \"address\": \"Main Samsani Rd, Block M Phase 2 Johar Town, Lahore, 54000, Pakistan\", \"phone\": \"0306 9805301\", \"website\": \"https://www.facebook.com/lahorecateringdecorcompany?mibextid=ZbWKwL\"}, \"dinner\": {\"name\": \"G.N CATERERS & EVENT PLANNERS\", \"rating\": 4.9, \"address\": \"Plot no 21, F2 Block, Block F2 Block F 2 Phase 1 Johar Town, Lahore, 54782, Pakistan\", \"phone\": \"0300 4866228\", \"website\": \"https://gncaterers.com/\"}}}}\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a creative event theme planner. Based on the event intent below, suggest a detailed event theme plan.\n", "Include:\n", "1. A creative theme name and style\n", "2. A list of decor elements needed (like penaflex, stage, lighting, florals)\n", "3. Any custom branding or stage setup suggestions\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return as a JSON dictionary with keys: theme_name, style_description, required_elements, branding_notes.\n", "IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.user_intent = {\n", " \"event_type\": \"wedding\",\n", " \"location\": \"Lahore\",\n", " \"event_date\": \"2025-06-10\",\n", " \"guest_count\": 300,\n", " \"preferences\": {\n", " \"stay_dates\": [\n", " \"2025-06-07\",\n", " \"2025-06-12\"\n", " ],\n", " \"guest_origins\": {\n", " \"Germany\": 20,\n", " \"Spain\": 20,\n", " \"local\": 260\n", " }\n", " },\n", " \"event_theme\": null,\n", " \"meal_count\": null,\n", " \"transport_needs\": null,\n", " \"sightseeing\": null\n", "}\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"theme_name\": \"Eternal Elegance: A Cultural Symphony\", \"style_description\": \"A fusion of traditional Pakistani motifs with European elegance, integrating rich colors and textures to create a harmonious blend reflecting the couple's diverse cultural backgrounds.\", \"required_elements\": [\"Rich floral arrangements with roses, jasmine, and lilies\", \"Elegant draped fabrics in gold and burgundy\", \"Mood lighting with chandeliers and fairy lights\", \"Custom stage with a traditional Pakistani backdrop\", \"Personalized monogrammed dance floor\", \"Seating arrangements with luxe velvet chairs\", \"Penaflex banners featuring the couple's story\"], \"branding_notes\": \"Incorporate a custom logo featuring elements from both Pakistani and European heritage. Use this logo on invitations, menus, and other printed materials to create a cohesive brand for the event. The stage should include cultural symbols from both regions, merged into a central piece of art that tells the couple's unique love story.\"}\n", "✅ Parsed Final Answer: {\"theme_name\": \"Eternal Elegance: A Cultural Symphony\", \"style_description\": \"A fusion of traditional Pakistani motifs with European elegance, integrating rich colors and textures to create a harmonious blend reflecting the couple's diverse cultural backgrounds.\", \"required_elements\": [\"Rich floral arrangements with roses, jasmine, and lilies\", \"Elegant draped fabrics in gold and burgundy\", \"Mood lighting with chandeliers and fairy lights\", \"Custom stage with a traditional Pakistani backdrop\", \"Personalized monogrammed dance floor\", \"Seating arrangements with luxe velvet chairs\", \"Penaflex banners featuring the couple's story\"], \"branding_notes\": \"Incorporate a custom logo featuring elements from both Pakistani and European heritage. Use this logo on invitations, menus, and other printed materials to create a cohesive brand for the event. The stage should include cultural symbols from both regions, merged into a central piece of art that tells the couple's unique love story.\"}\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a summarizer for an event planner agent.\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Please summarize the key information from the 'Theme' section in bullet points, focusing on top recommended options only.\n", "\n", "Theme data:\n", "{\n", " \"recommended\": {\n", " \"theme_name\": \"Eternal Elegance: A Cultural Symphony\",\n", " \"style_description\": \"A fusion of traditional Pakistani motifs with European elegance, integrating rich colors and textures to create a harmonious blend reflecting the couple's diverse cultural backgrounds.\",\n", " \"branding_notes\": \"Incorporate a custom logo featuring elements from both Pakistani and European heritage. Use this logo on invitations, menus, and other printed materials to create a cohesive brand for the event. The stage should include cultural symbols from both regions, merged into a central piece of art that tells the couple's unique love story.\",\n", " \"required_elements\": [\n", " \"Rich floral arrangements with roses, jasmine, and lilies\",\n", " \"Elegant draped fabrics in gold and burgundy\",\n", " \"Mood lighting with chandeliers and fairy lights\",\n", " \"Custom stage with a traditional Pakistani backdrop\",\n", " \"Personalized monogrammed dance floor\",\n", " \"Seating arrangements with luxe velvet chairs\",\n", " \"Penaflex banners featuring the couple's story\"\n", " ]\n", " },\n", " \"alternates\": [],\n", " \"vendors\": [\n", " {\n", " \"name\": \"Flower Shop Delivery In Lahore | Flower delivery in Lahore\",\n", " \"address\": \"A Block Wahdat Rd, near Sheikh Zayed Hospital, Block A Muslim Town, Lahore, Pakistan\",\n", " \"phone\": \"0300 4853923\",\n", " \"website\": \"N/A\",\n", " \"rating\": 5,\n", " \"type\": \"Rich floral arrangements with roses, jasmine, and lilies\"\n", " },\n", " {\n", " \"name\": \"Flower Bouquet - Lahore\",\n", " \"address\": \"Basement, 23-A, Khayaban-e-Iqbal, Sector XX DHA Phase 3, Lahore, 54810, Pakistan\",\n", " \"phone\": \"0355 5138193\",\n", " \"website\": \"https://flowerbouquet.pk/\",\n", " \"rating\": 4.9,\n", " \"type\": \"Rich floral arrangements with roses, jasmine, and lilies\"\n", " },\n", " {\n", " \"name\": \"Blossoms Flowers\",\n", " \"address\": \"Shop # 1\\u060c Ahad Heights, 137/P Mini Market Round About, Block P Gulberg 2, Lahore, 54660, Pakistan\",\n", " \"phone\": \"(042) 35871115\",\n", " \"website\": \"http://www.blossomsflorals.com/\",\n", " \"rating\": 4.2,\n", " \"type\": \"Rich floral arrangements with roses, jasmine, and lilies\"\n", " },\n", " {\n", " \"name\": \"Saleem Fabrics\",\n", " \"address\": \"Liberty Market Car Park, Liberty Market Road, Liberty Market Gulberg, Lahore, Pakistan\",\n", " \"phone\": \"0321 2122121\",\n", " \"website\": \"https://saleemfabrics.com/\",\n", " \"rating\": 4.2,\n", " \"type\": \"Elegant draped fabrics in gold and burgundy\"\n", " },\n", " {\n", " \"name\": \"The Fabric Store\",\n", " \"address\": \"Head Office Site, 64-D Ghalib Rd, Block D1 Gulberg III, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0300 0606664\",\n", " \"website\": \"https://www.thefabricstore.pk/\",\n", " \"rating\": 4.8,\n", " \"type\": \"Elegant draped fabrics in gold and burgundy\"\n", " },\n", " {\n", " \"name\": \"Ahmed Fabrics Iqbal Town\",\n", " \"address\": \"Allama Iqbal Rd, Jahanzeb Block Allama Iqbal Town, Lahore, 54000, Pakistan\",\n", " \"phone\": \"(042) 37803140\",\n", " \"website\": \"N/A\",\n", " \"rating\": 4.1,\n", " \"type\": \"Elegant draped fabrics in gold and burgundy\"\n", " },\n", " {\n", " \"name\": \"Party Accessories Lahore\",\n", " \"address\": \"Office # 7A, 2nd, Queen's Center, Queen's Road, near Qartaba Chowk Clock Tower, Jinnah Town, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0312 6111069\",\n", " \"website\": \"http://www.partyaccessories.pk/\",\n", " \"rating\": 4.7,\n", " \"type\": \"Custom stage with a traditional Pakistani backdrop\"\n", " },\n", " {\n", " \"name\": \"EventMent (Event Management Company)\",\n", " \"address\": \"Khayaban-e-Firdousi, Block R 1 Phase 2 Johar Town, Lahore, Pakistan\",\n", " \"phone\": \"0321 4796663\",\n", " \"website\": \"http://www.eventment.com.pk/\",\n", " \"rating\": 5,\n", " \"type\": \"Custom stage with a traditional Pakistani backdrop\"\n", " },\n", " {\n", " \"name\": \"Event Planners in Pakistan | a2z Events Solutions\",\n", " \"address\": \"Office # 428, 4th Floor, Siddiq Trade Center, Main Boulevard Gulberg, Block H Gulberg 2, Lahore, 54660, Pakistan\",\n", " \"phone\": \"N/A\",\n", " \"website\": \"http://www.a2zeventssolutions.com/\",\n", " \"rating\": 4.7,\n", " \"type\": \"Custom stage with a traditional Pakistani backdrop\"\n", " },\n", " {\n", " \"name\": \"DECOR WORLD\",\n", " \"address\": \"Street 149, Sector H Dha Phase 1, Lahore, Punjab Street 149, Sector H shop no:H 149 basement, H, Opposite sadiq halwa puri, near sweercream, Sector H DHA Phase 3, Lahore, 54792, Pakistan\",\n", " \"phone\": \"N/A\",\n", " \"website\": \"http://www.decorworldpk.com/\",\n", " \"rating\": 4.9,\n", " \"type\": \"Personalized monogrammed dance floor\"\n", " },\n", " {\n", " \"name\": \"Party Accessories Lahore\",\n", " \"address\": \"Office # 7A, 2nd, Queen's Center, Queen's Road, near Qartaba Chowk Clock Tower, Jinnah Town, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0312 6111069\",\n", " \"website\": \"http://www.partyaccessories.pk/\",\n", " \"rating\": 4.7,\n", " \"type\": \"Personalized monogrammed dance floor\"\n", " },\n", " {\n", " \"name\": \"Tulips Events\",\n", " \"address\": \"LG 133 Saddiq, Trade Center, Block H Gulberg III, Lahore, 56660, Pakistan\",\n", " \"phone\": \"0321 4355789\",\n", " \"website\": \"http://www.tulipsevents.com/\",\n", " \"rating\": 4.8,\n", " \"type\": \"Personalized monogrammed dance floor\"\n", " },\n", " {\n", " \"name\": \"Meeshan Luxe Home - Luxury Furniture\",\n", " \"address\": \"66 Main Blvd, Sector H DHA Phase 6, Lahore, 54810, Pakistan\",\n", " \"phone\": \"0300 0991666\",\n", " \"website\": \"https://meeshan.com/\",\n", " \"rating\": 4.6,\n", " \"type\": \"Seating arrangements with luxe velvet chairs\"\n", " },\n", " {\n", " \"name\": \"Lahore Furniture\",\n", " \"address\": \"210 Defence Rd, Lda Avenue Phase 1 Lda Avenue, Lahore, Pakistan\",\n", " \"phone\": \"0321 7860953\",\n", " \"website\": \"https://lahorefurniture.pk/\",\n", " \"rating\": 4.2,\n", " \"type\": \"Seating arrangements with luxe velvet chairs\"\n", " },\n", " {\n", " \"name\": \"Wing Chair Luxury Group\",\n", " \"address\": \"218-FF, Sector FF Commercial Area Sector FF Dha Phase 4, Lahore, 54810, Pakistan\",\n", " \"phone\": \"0321 8503777\",\n", " \"website\": \"N/A\",\n", " \"rating\": 4.4,\n", " \"type\": \"Seating arrangements with luxe velvet chairs\"\n", " },\n", " {\n", " \"name\": \"Click2Print Pvt. Ltd.\",\n", " \"address\": \"62-A Shan Arcade Barkat Market New, Commercial Area Garden Town, Lahore, 54000, Pakistan\",\n", " \"phone\": \"0336 3333896\",\n", " \"website\": \"https://click2print.pk/\",\n", " \"rating\": 4.8,\n", " \"type\": \"Penaflex banners featuring the couple's story\"\n", " },\n", " {\n", " \"name\": \"PRINTX Printing & Advertising\",\n", " \"address\": \"104 Masood Farooqi Rd, near Cakes & Bakes, Raja Market Abu Bakar Block Garden Town, Lahore, Pakistan\",\n", " \"phone\": \"0300 8611688\",\n", " \"website\": \"http://www.printx.pk/\",\n", " \"rating\": 4.6,\n", " \"type\": \"Penaflex banners featuring the couple's story\"\n", " },\n", " {\n", " \"name\": \"IMC Advertiser | Pana Flex printing |Vinyl Branding| Vehicle Branding |Signboard\",\n", " \"address\": \"241, Block F Punjab CHS, Lahore, 54792, Pakistan\",\n", " \"phone\": \"0322 0144062\",\n", " \"website\": \"N/A\",\n", " \"rating\": 4.9,\n", " \"type\": \"Penaflex banners featuring the couple's story\"\n", " }\n", " ]\n", "}IMPORTANT: In each sub agent, Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"recommended_theme\":\"Eternal Elegance: A Cultural Symphony\",\"style\":\"A fusion of traditional Pakistani motifs with European elegance, integrating rich colors and textures to create a harmonious blend reflecting the couple's diverse cultural backgrounds.\",\"branding_notes\":\"Incorporate a custom logo featuring elements from both Pakistani and European heritage. Use this logo on invitations, menus, and other printed materials to create a cohesive brand for the event. The stage should include cultural symbols from both regions, merged into a central piece of art that tells the couple's unique love story.\",\"required_elements\":[\"Rich floral arrangements with roses, jasmine, and lilies\",\"Elegant draped fabrics in gold and burgundy\",\"Mood lighting with chandeliers and fairy lights\",\"Custom stage with a traditional Pakistani backdrop\",\"Personalized monogrammed dance floor\",\"Seating arrangements with luxe velvet chairs\",\"Penaflex banners featuring the couple's story\"]}\n", "✅ Parsed Final Answer: {\"recommended_theme\":\"Eternal Elegance: A Cultural Symphony\",\"style\":\"A fusion of traditional Pakistani motifs with European elegance, integrating rich colors and textures to create a harmonious blend reflecting the couple's diverse cultural backgrounds.\",\"branding_notes\":\"Incorporate a custom logo featuring elements from both Pakistani and European heritage. Use this logo on invitations, menus, and other printed materials to create a cohesive brand for the event. The stage should include cultural symbols from both regions, merged into a central piece of art that tells the couple's unique love story.\",\"required_elements\":[\"Rich floral arrangements with roses, jasmine, and lilies\",\"Elegant draped fabrics in gold and burgundy\",\"Mood lighting with chandeliers and fairy lights\",\"Custom stage with a traditional Pakistani backdrop\",\"Personalized monogrammed dance floor\",\"Seating arrangements with luxe velvet chairs\",\"Penaflex banners featuring the couple's story\"]}\n", "\n", "✅ Event Planning Complete!\n", "\n", "📋 Summary Output:\n", "{\n", " \"venues\": \"{\\\"recommended_venues\\\":[{\\\"name\\\":\\\"Mehmaan Khana Marriage Hall\\\",\\\"rating\\\":4.6,\\\"address\\\":\\\"94 Lahore \\u2013 Kasur Rd, near Shama, Ichhra Lahore, 54000, Pakistan\\\",\\\"phone\\\":\\\"0321 6576011\\\",\\\"website\\\":\\\"http://www.mehmaankhana.com/\\\"},{\\\"name\\\":\\\"Bagh-e-Jinnah\\\",\\\"rating\\\":4.6,\\\"address\\\":\\\"Shahrah-e-Quaid-e-Azam, Jinnah Town, Lahore, 54000, Pakistan\\\",\\\"phone\\\":\\\"(042) 99201270\\\",\\\"website\\\":\\\"https://www.facebook.com/Bagh-e-Jinnah-Lahore-255464461887669/?modal=admin_todo_tour\\\"},{\\\"name\\\":\\\"Botanical Garden, \\u0628\\u0648\\u0679\\u06cc\\u0646\\u06a9\\u0644 \\u06af\\u0627\\u0631\\u0688\\u0646\\\",\\\"rating\\\":4.6,\\\"address\\\":\\\"HFFP+MR9, Lahore, Pakistan\\\",\\\"phone\\\":\\\"N/A\\\",\\\"website\\\":\\\"N/A\\\"},{\\\"name\\\":\\\"The Oasis Golf & Aqua Resort\\\",\\\"rating\\\":4.6,\\\"address\\\":\\\"Multan Rd, Lahore, Pakistan\\\",\\\"phone\\\":\\\"0321 8236214\\\",\\\"website\\\":\\\"http://www.theoasis.com.pk/\\\"},{\\\"name\\\":\\\"Beach resort\\\",\\\"rating\\\":5,\\\"address\\\":\\\"96FH+R7G, Chamru Pur Chamrupur, Lahore, Pakistan\\\",\\\"phone\\\":\\\"0333 0130955\\\",\\\"website\\\":\\\"N/A\\\"}]}\",\n", " \"vendors\": \"{\\\"catering\\\":[\\\"LAHORE CATERING & DECOR COMPANY\\\"],\\\"florist\\\":[\\\"Flower Shop Delivery In Lahore | Flower delivery in Lahore\\\"],\\\"photography\\\":[\\\"Noman Hassan photograhpy\\\"],\\\"videography\\\":[\\\"Alie Imran Production\\\"],\\\"music/band/DJ\\\":[\\\"Star Sungeet Musical Group Nadeem Dj Sound & Light and Qawali Night\\\"],\\\"wedding planner\\\":[\\\"HJ Planners - Wedding Planner and Event Management.\\\"],\\\"venue\\\":[\\\"Bel Avenir Event Complex\\\"],\\\"officiant\\\":[\\\"Hamara Rishta Pvt Ltd | Rishta Center | Marriage Bureau Lahore\\\",\\\"AwAn Marriage Bureau\\\"],\\\"transportation\\\":[\\\"Jeevay Laal Din Goods Transport Shehzore Mazda Company Lahore\\\",\\\"Qamar Awan Goods Transport Company\\\"],\\\"baker\\\":[\\\"Crumbs The Bakers\\\"],\\\"hair and makeup\\\":[\\\"CANVAS Salon Lahore | Best Hair and Bridal Parlour Gulberg\\\"],\\\"event lighting\\\":[\\\"Abid Solutions Sound & Lights\\\"],\\\"A/V equipment\\\":[\\\"Qamar Sound Systems\\\"],\\\"furniture rental\\\":[\\\"Mattress on Rent (S.A Traders)\\\"]}\",\n", " \"transportation\": \"{\\\"transportation_summary\\\": [\\\"Top car rental options include Haririi Rent a Car Lahore (Rating: 4.9), Fast Track Tours & Rentals (Rating: 4.8), and SAF Rent A Car Lahore (Rating: 4.8).\\\", \\\"Recommended shuttle services are Road Master Bus Terminal Lahore (Rating: 4.5) and Daewoo Express Thokar Lahore (Rating: 4.1).\\\", \\\"For bus rentals, top choices are Gujjar Travels & Tours (Rating: 5) and 4 Seasons Rent a Car Lahore DHA (Rating: 5).\\\"]}\",\n", " \"hotels\": \"{\\\"bullet_points\\\": [\\\"Luxus Grand Hotel - Rating: 4.4, Address: 4 Egerton Rd, near Ewan-e-Iqbal, Garhi Shahu, Lahore, 54000, Pakistan, Phone: 0320 1999955, Website: http://luxusgrandhotel.com/\\\", \\\"Hayyat Luxury Hotel Apartments - Rating: 4.7, Address: 56 Lawrence Road, near china chowk, Jinnah Town, Lahore, 54600, Pakistan, Phone: 0313 6766699, Website: https://www.hayyathotels.com/?utm_source=google&utm_medium=wix_google_business_profile&utm_campaign=2488859883140921026\\\", \\\"Royal Swiss Hotel - Rating: 4.5, Address: opposite Cargo Complex, Allama Iqbal International Airport, Lahore, 54800, Pakistan, Phone: (042) 111 000 329, Website: https://swissinternationalhotels.com/hotel/royalswiss/lahore/\\\", \\\"Pearl Continental Hotel, Lahore - Rating: 4.4, Address: Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, Pakistan, Phone: (042) 111 505 505, Website: http://www.pchotels.com/pclahore\\\", \\\"Avari Hotel Lahore - Rating: 4.7, Address: Shahrah-e-Quaid-e-Azam, Garhi Shahu, Lahore, 54000, Pakistan, Phone: (042) 36366366, Website: http://www.avari.com/\\\", \\\"The Nishat Hotel - Rating: 4.5, Address: 1 Abdul Haque Rd, Block G1 Block G 1 Phase 1 Johar Town, Lahore, 54700, Pakistan, Phone: (042) 111 646 835, Website: https://nishathotels.com/explore/johar-town/\\\"]}\",\n", " \"sightseeing\": \"{\\\"is_required\\\":true,\\\"key_points\\\":[\\\"Schedule on Day 2 afternoon.\\\",\\\"Top recommended places:\\\",\\\"1. Lahore Fort, Rating: 4.6, Address: H8Q7+56P, Fort Rd, Walled City of Lahore.\\\",\\\"2. Gali Surjan Singh, Rating: 4.6, Address: H8MG+286, Gali Surjan Singh, Gur Mandi Kucha Deputy Alam Shah Walled City of Lahore.\\\",\\\"3. Lahore Museum, Rating: 4.5, Address: H895+93H, Mall Rd, Anarkali Bazaar Lahore.\\\",\\\"4. Sheesh Mahal Lahore, Rating: 4.5, Address: H8Q7+X7F, Walled City of Lahore.\\\"]}\",\n", " \"catering\": \"{\\\"catering_summary\\\": {\\\"top_recommendations\\\": {\\\"breakfast\\\": {\\\"name\\\": \\\"Bundu Khan Restaurant - Liberty\\\", \\\"rating\\\": 4.3, \\\"address\\\": \\\"1 - Liberty Market, Noor Jehan Rd, Block D1 Gulberg III, Lahore, 54000, Pakistan\\\", \\\"phone\\\": \\\"(042) 35756108\\\", \\\"website\\\": \\\"http://www.bundukhan.pk/\\\"}, \\\"lunch\\\": {\\\"name\\\": \\\"LAHORE CATERING & DECOR COMPANY\\\", \\\"rating\\\": 5, \\\"address\\\": \\\"Main Samsani Rd, Block M Phase 2 Johar Town, Lahore, 54000, Pakistan\\\", \\\"phone\\\": \\\"0306 9805301\\\", \\\"website\\\": \\\"https://www.facebook.com/lahorecateringdecorcompany?mibextid=ZbWKwL\\\"}, \\\"dinner\\\": {\\\"name\\\": \\\"G.N CATERERS & EVENT PLANNERS\\\", \\\"rating\\\": 4.9, \\\"address\\\": \\\"Plot no 21, F2 Block, Block F2 Block F 2 Phase 1 Johar Town, Lahore, 54782, Pakistan\\\", \\\"phone\\\": \\\"0300 4866228\\\", \\\"website\\\": \\\"https://gncaterers.com/\\\"}}}}\",\n", " \"theme\": \"{\\\"recommended_theme\\\":\\\"Eternal Elegance: A Cultural Symphony\\\",\\\"style\\\":\\\"A fusion of traditional Pakistani motifs with European elegance, integrating rich colors and textures to create a harmonious blend reflecting the couple's diverse cultural backgrounds.\\\",\\\"branding_notes\\\":\\\"Incorporate a custom logo featuring elements from both Pakistani and European heritage. Use this logo on invitations, menus, and other printed materials to create a cohesive brand for the event. The stage should include cultural symbols from both regions, merged into a central piece of art that tells the couple's unique love story.\\\",\\\"required_elements\\\":[\\\"Rich floral arrangements with roses, jasmine, and lilies\\\",\\\"Elegant draped fabrics in gold and burgundy\\\",\\\"Mood lighting with chandeliers and fairy lights\\\",\\\"Custom stage with a traditional Pakistani backdrop\\\",\\\"Personalized monogrammed dance floor\\\",\\\"Seating arrangements with luxe velvet chairs\\\",\\\"Penaflex banners featuring the couple's story\\\"]}\"\n", "}\n" ] } ] }, { "cell_type": "markdown", "source": [ "**A Orchestrator without the ReAct inside it**" ], "metadata": { "id": "tWmgrD0Z6qpA" } }, { "cell_type": "code", "source": [ "import os\n", "import json\n", "import openai\n", "\n", "# Set your OpenAI key\n", "openai.api_key = os.getenv(\"OPENAI_API_KEY\")\n", "\n", "\n", "# 🧠 Call GPT-4o to summarize each section\n", "from openai import OpenAI\n", "\n", "client = OpenAI(api_key=os.getenv(\"OPENAI_API_KEY\"))\n", "\n", "# 🧠 GPT prompt call using new SDK\n", "def ask_gpt(prompt):\n", " print(\"🧠 Calling OpenAI...\")\n", " response = client.chat.completions.create(\n", " model=\"gpt-4o\",\n", " messages=[\n", " {\"role\": \"system\", \"content\": \"You are an expert event planner assistant.\"},\n", " {\"role\": \"user\", \"content\": prompt}\n", " ]\n", " )\n", " return response.choices[0].message.content.strip()\n", "\n", "# 📦 Extract only JSON from LLM output\n", "def extract_json_from_response(response):\n", " cleaned = response.strip()\n", " cleaned = re.sub(r\"```(?:json|python)?\", \"\", cleaned)\n", " cleaned = re.sub(r\"[^\\x00-\\x7F]+\", \"\", cleaned).strip()\n", " cleaned = cleaned.replace(\"“\", '\"').replace(\"”\", '\"').replace(\"‘\", \"'\").replace(\"’\", \"'\")\n", "\n", " try:\n", " return json.loads(cleaned)\n", " except json.JSONDecodeError:\n", " match = re.search(r\"(\\{.*\\}|\\[.*\\])\", cleaned, re.DOTALL)\n", " if match:\n", " try:\n", " return json.loads(match.group(0))\n", " except json.JSONDecodeError:\n", " pass\n", " raise ValueError(f\"❌ Could not extract valid JSON from LLM response:\\n{cleaned}\")\n", "\n", "\n", "\n", "# 🎯 Intent Extraction\n", "def extract_user_intent(query):\n", " prompt = f\"\"\"\n", "Extract the following details from the user message:\n", "- event_type\n", "- location\n", "- event_date\n", "- number_of_guests\n", "- preferences (optional)\n", "\n", "Respond with `Final Answer:` followed by a JSON object only.\n", "\n", "Message: {query}\n", "\"\"\"\n", " response = ask_gpt(prompt)\n", " return extract_json_from_response(response)\n", "\n", "\n", "# 🔄 Orchestrator Agent\n", "def orchestrated_event_plan(user_intent):\n", " print(\"🚀 Running Full Event Orchestrator...\")\n", "\n", " # --- Step 1: Agent Calls ---\n", " venue_results = venue_agent(user_intent)\n", " vendor_results = vendors_agent(user_intent)\n", " schedule = scheduler_agent(user_intent)\n", " transport = transport_parking_agent(user_intent, venue_results, schedule)\n", " hotels = hotel_booking_agent(user_intent, venue_results)\n", " sightseeing = sightseeing_agent(user_intent, schedule)\n", " catering = catering_agent(user_intent, schedule)\n", " theme = theme_agent(user_intent)\n", " weather = weather_predictor_agent(user_intent, schedule)\n", "\n", " # --- Step 2: LLM Summaries ---\n", " def summarize(section_name, data):\n", " prompt = (\n", " f\"You are summarizing the '{section_name}' section from an event planning agent.\\n\"\n", " f\"Here is the agent output:\\n\\n{json.dumps(data, indent=2)}\\n\\n\"\n", " \"Summarize the best 2–3 items. Use bullets or clean formatting.\\n\"\n", " \"Respond with only JSON — start with Final Answer: and no explanation.\"\n", " )\n", " response = ask_gpt(prompt)\n", " return extract_json_from_response(response)\n", "\n", " summary = {\n", " \"venues\": summarize(\"venues\", venue_results),\n", " \"vendors\": summarize(\"vendors\", vendor_results),\n", " \"schedule\": summarize(\"schedule\", schedule),\n", " \"transportation\": summarize(\"transportation\", transport),\n", " \"hotels\": summarize(\"hotels\", hotels),\n", " \"sightseeing\": summarize(\"sightseeing\", sightseeing),\n", " \"catering\": summarize(\"catering\", catering),\n", " \"theme\": summarize(\"theme\", theme),\n", " \"weather_forecast\": summarize(\"weather_forecast\", weather)\n", " }\n", "\n", " return {\n", " \"intent\": user_intent,\n", " \"summary\": summary,\n", " \"details\": {\n", " \"venues\": venue_results,\n", " \"vendors\": vendor_results,\n", " \"schedule\": schedule,\n", " \"transportation\": transport,\n", " \"hotels\": hotels,\n", " \"sightseeing\": sightseeing,\n", " \"catering\": catering,\n", " \"theme\": theme,\n", " \"weather_forecast\": weather\n", " }\n", " }\n", "if __name__ == \"__main__\":\n", " user_query = input(\"📝 Describe your event: \")\n", "\n", " try:\n", " intent = extract_user_intent(user_query)\n", " print(\"\\n🎯 Extracted Intent:\")\n", " print(json.dumps(intent, indent=2))\n", "\n", " plan = orchestrated_event_plan(intent)\n", " print(\"\\n✅ Final Event Plan:\")\n", " print(json.dumps(plan[\"summary\"], indent=2))\n", "\n", " except Exception as e:\n", " print(\"❌ Error during event planning:\", e)\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "swZr4L6b8GgX", "outputId": "9028b4db-c110-4796-ef09-e7a60093f0d9" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "📝 Describe your event: Plan a 4 day trip from Rawalpindi to Karachi for 40 people starting from 9 june 2025 via motorway.\n", "🧠 Calling OpenAI...\n", "\n", "🎯 Extracted Intent:\n", "{\n", " \"event_type\": \"4 day trip\",\n", " \"location\": \"Rawalpindi to Karachi\",\n", " \"event_date\": \"2025-06-09\",\n", " \"number_of_guests\": 40,\n", " \"preferences\": \"via motorway\"\n", "}\n", "🚀 Running Full Event Orchestrator...\n", "\n", "🧠 Determining suitable venue types for: 4 day trip\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner.\n", "Suggest the 3 most suitable types of venues for a '4 day trip' event.\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return only a valid JSON list like: [\"banquet hall\", \"outdoor garden\", \"conference center\"]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [\"resort\", \"conference center\", \"retreat center\"]\n", "✅ Parsed Final Answer: [\"resort\", \"conference center\", \"retreat center\"]\n", "🔎 Searching: resort in Rawalpindi to Karachi\n", "🔎 Searching: conference center in Rawalpindi to Karachi\n", "🔎 Searching: retreat center in Rawalpindi to Karachi\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner. What types of vendors are typically needed for a '4 day trip'? Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return only a Python list like: [\"catering\", \"event lighting\", \"A/V equipment\"]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [\"transportation\", \"accommodation\", \"catering\", \"tour guides\", \"event management\", \"security\", \"logistics\", \"entertainment\"]\n", "✅ Parsed Final Answer: [\"transportation\", \"accommodation\", \"catering\", \"tour guides\", \"event management\", \"security\", \"logistics\", \"entertainment\"]\n", "🔎 Searching vendors for: transportation\n", "🔎 Searching vendors for: accommodation\n", "🔎 Searching vendors for: catering\n", "🔎 Searching vendors for: tour guides\n", "🔎 Searching vendors for: event management\n", "🔎 Searching vendors for: security\n", "🔎 Searching vendors for: logistics\n", "🔎 Searching vendors for: entertainment\n", "🧠 Prompting GPT-4o for schedule...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are an expert event planner. Create a high-level multi-day schedule for a 4 day trip beginning on 2025-06-09 with around unknown guests. Include major activities from arrival to departure:\n", "airport pickups, hotel check-in, meals, sessions, sightseeing in free slots, and checkout.\n", "Return the result as a Python list of dictionaries in this format:\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.[{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Hotel check-in\", \"Welcome dinner\"]}, ...]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: [{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Airport pickups\", \"Hotel check-in\", \"Welcome dinner\"]}, {\"day\": \"Day 2 - Exploration\", \"activities\": [\"Breakfast\", \"Morning sightseeing tour\", \"Lunch\", \"Afternoon session\", \"Dinner\"]}, {\"day\": \"Day 3 - Activities\", \"activities\": [\"Breakfast\", \"Full-day conference sessions\", \"Lunch\", \"Evening free time\", \"Dinner\"]}, {\"day\": \"Day 4 - Departure\", \"activities\": [\"Breakfast\", \"Morning free time\", \"Lunch\", \"Hotel checkout\", \"Airport drop-offs\"]}]\n", "✅ Parsed Final Answer: [{\"day\": \"Day 1 - Arrival\", \"activities\": [\"Airport pickups\", \"Hotel check-in\", \"Welcome dinner\"]}, {\"day\": \"Day 2 - Exploration\", \"activities\": [\"Breakfast\", \"Morning sightseeing tour\", \"Lunch\", \"Afternoon session\", \"Dinner\"]}, {\"day\": \"Day 3 - Activities\", \"activities\": [\"Breakfast\", \"Full-day conference sessions\", \"Lunch\", \"Evening free time\", \"Dinner\"]}, {\"day\": \"Day 4 - Departure\", \"activities\": [\"Breakfast\", \"Morning free time\", \"Lunch\", \"Hotel checkout\", \"Airport drop-offs\"]}]\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a logistics planner. Based on this event, return:\n", "- A list of transport vendor types required\n", "- A dictionary of estimated vehicle needs by type\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return this as a Python dictionary with two keys: 'vendor_types' and 'vehicle_estimates'.\n", "Example:\n", "{\n", " \"vendor_types\": [\"shuttle service\", \"bus rental\"],\n", " \"vehicle_estimates\": {\"cars\": 3, \"shuttles\": 2, \"buses\": 1}\n", "}\n", "\n", "user_intent = {\n", " \"event_type\": \"4 day trip\",\n", " \"location\": \"Rawalpindi to Karachi\",\n", " \"event_date\": \"2025-06-09\",\n", " \"number_of_guests\": 40,\n", " \"preferences\": \"via motorway\"\n", "}\n", "venues = []\n", "schedule = [\n", " {\n", " \"day\": \"Day 1 - Arrival\",\n", " \"activities\": [\n", " \"Airport pickups\",\n", " \"Hotel check-in\",\n", " \"Welcome dinner\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 2 - Exploration\",\n", " \"activities\": [\n", " \"Breakfast\",\n", " \"Morning sightseeing tour\",\n", " \"Lunch\",\n", " \"Afternoon session\",\n", " \"Dinner\"\n", " ]\n", " }\n", "]IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\n", " \"vendor_types\": [\"shuttle service\", \"bus rental\"],\n", " \"vehicle_estimates\": {\"shuttles\": 2, \"buses\": 1}\n", "}\n", "✅ Parsed Final Answer: {\n", " \"vendor_types\": [\"shuttle service\", \"bus rental\"],\n", " \"vehicle_estimates\": {\"shuttles\": 2, \"buses\": 1}\n", "}\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a hotel planning assistant.\n", "Based on the event type, location, and venues, determine the hotel needs.\n", "Return a Python dictionary with:\n", "- 'hotel_type': e.g., 3-star, 5-star\n", "- 'room_requirements': {single: int, double: int, suite: int}\n", "- 'priorities': list of preferences (e.g., budget, proximity, Wi-Fi)\n", "- 'suggested_hotels': optional hotel suggestions with name, type, rooms, amenities\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.user_intent = {\n", " \"event_type\": \"4 day trip\",\n", " \"location\": \"Rawalpindi to Karachi\",\n", " \"event_date\": \"2025-06-09\",\n", " \"number_of_guests\": 40,\n", " \"preferences\": \"via motorway\"\n", "}\n", "venues = []IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"hotel_type\": \"4-star\", \"room_requirements\": {\"single\": 10, \"double\": 10, \"suite\": 5}, \"priorities\": [\"proximity to motorway\", \"Wi-Fi\", \"budget\"], \"suggested_hotels\": [{\"name\": \"Hotel Karachi Inn\", \"type\": \"4-star\", \"rooms\": {\"single\": 20, \"double\": 20, \"suite\": 10}, \"amenities\": [\"Wi-Fi\", \"parking\", \"restaurant\"]}, {\"name\": \"Executive Stay\", \"type\": \"4-star\", \"rooms\": {\"single\": 15, \"double\": 15, \"suite\": 5}, \"amenities\": [\"Wi-Fi\", \"pool\", \"gym\"]}]}\n", "✅ Parsed Final Answer: {\"hotel_type\": \"4-star\", \"room_requirements\": {\"single\": 10, \"double\": 10, \"suite\": 5}, \"priorities\": [\"proximity to motorway\", \"Wi-Fi\", \"budget\"], \"suggested_hotels\": [{\"name\": \"Hotel Karachi Inn\", \"type\": \"4-star\", \"rooms\": {\"single\": 20, \"double\": 20, \"suite\": 10}, \"amenities\": [\"Wi-Fi\", \"parking\", \"restaurant\"]}, {\"name\": \"Executive Stay\", \"type\": \"4-star\", \"rooms\": {\"single\": 15, \"double\": 15, \"suite\": 5}, \"amenities\": [\"Wi-Fi\", \"pool\", \"gym\"]}]}\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a cultural planner helping design event schedules.\n", "Given the event type and a brief schedule summary, recommend whether sightseeing could be meaningfully integrated.\n", "If so, suggest the type and ideal time.\n", "\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return ONLY a Python dictionary with the following keys:\n", "- 'is_required' (true/false)\n", "- 'sightseeing_type' (e.g. cultural, shopping, historical)\n", "- 'integration_notes' (e.g. best added on Day 2 afternoon)\n", "\n", "Do NOT return anything else. No text. No schedule. No explanation. and no emojis\n", "Example:\n", "{\n", " \"is_required\": true,\n", " \"sightseeing_type\": \"Cultural\",\n", " \"integration_notes\": \"Schedule it on Day 2 afternoon.\"\n", "}\n", "\n", "IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.Event type: 4 day trip\n", "Schedule summary:\n", "Day 1 - Arrival: Airport pickups\n", "Day 2 - Exploration: Breakfast\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"is_required\": true, \"sightseeing_type\": \"Cultural\", \"integration_notes\": \"Schedule it on Day 2 afternoon.\"}\n", "✅ Parsed Final Answer: {\"is_required\": true, \"sightseeing_type\": \"Cultural\", \"integration_notes\": \"Schedule it on Day 2 afternoon.\"}\n", "🧠 Calling MealPlannerTool via ReAct agent...\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: Use the meal planner tool to suggest an appropriate structured meal plan for the event in Rawalpindi to Karachi based on the schedule. Use the schedule and intent below:\n", "\n", "{\n", " \"event_type\": \"4 day trip\",\n", " \"location\": \"Rawalpindi to Karachi\",\n", " \"schedule\": [\n", " {\n", " \"day\": \"Day 1 - Arrival\",\n", " \"activities\": [\n", " \"Airport pickups\",\n", " \"Hotel check-in\",\n", " \"Welcome dinner\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 2 - Exploration\",\n", " \"activities\": [\n", " \"Breakfast\",\n", " \"Morning sightseeing tour\",\n", " \"Lunch\",\n", " \"Afternoon session\",\n", " \"Dinner\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 3 - Activities\",\n", " \"activities\": [\n", " \"Breakfast\",\n", " \"Full-day conference sessions\",\n", " \"Lunch\",\n", " \"Evening free time\",\n", " \"Dinner\"\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 4 - Departure\",\n", " \"activities\": [\n", " \"Breakfast\",\n", " \"Morning free time\",\n", " \"Lunch\",\n", " \"Hotel checkout\",\n", " \"Airport drop-offs\"\n", " ]\n", " }\n", " ]\n", "}IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\n", " \"meal_plan\": [\n", " {\n", " \"day\": \"Day 1 - Arrival\",\n", " \"meals\": [\n", " {\n", " \"time\": \"Dinner\",\n", " \"details\": \"Welcome dinner with a variety of local and international cuisines to introduce guests to the local flavors.\"\n", " }\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 2 - Exploration\",\n", " \"meals\": [\n", " {\n", " \"time\": \"Breakfast\",\n", " \"details\": \"Buffet breakfast at the hotel with options including eggs, breads, cereals, and traditional Pakistani breakfast items.\"\n", " },\n", " {\n", " \"time\": \"Lunch\",\n", " \"details\": \"Lunch at a local restaurant featuring traditional Pakistani dishes such as biryani, kebabs, and lentil curry.\"\n", " },\n", " {\n", " \"time\": \"Dinner\",\n", " \"details\": \"Dinner at an upscale restaurant offering a mix of continental and Pakistani dishes.\"\n", " }\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 3 - Activities\",\n", " \"meals\": [\n", " {\n", " \"time\": \"Breakfast\",\n", " \"details\": \"Continental breakfast at the hotel with an assortment of pastries, fruits, and hot dishes.\"\n", " },\n", " {\n", " \"time\": \"Lunch\",\n", " \"details\": \"Catered lunch at the conference venue with light and healthy options like salads, sandwiches, and fruit.\"\n", " },\n", " {\n", " \"time\": \"Dinner\",\n", " \"details\": \"Group dinner in a traditional restaurant with live music and a menu featuring classic regional dishes.\"\n", " }\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 4 - Departure\",\n", " \"meals\": [\n", " {\n", " \"time\": \"Breakfast\",\n", " \"details\": \"Last breakfast at the hotel with a variety of options to suit all dietary preferences.\"\n", " },\n", " {\n", " \"time\": \"Lunch\",\n", " \"details\": \"Farewell lunch with easy-to-eat options such as wraps, salads, and desserts before departure.\"\n", " }\n", " ]\n", " }\n", " ]\n", "}\n", "✅ Parsed Final Answer: {\n", " \"meal_plan\": [\n", " {\n", " \"day\": \"Day 1 - Arrival\",\n", " \"meals\": [\n", " {\n", " \"time\": \"Dinner\",\n", " \"details\": \"Welcome dinner with a variety of local and international cuisines to introduce guests to the local flavors.\"\n", " }\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 2 - Exploration\",\n", " \"meals\": [\n", " {\n", " \"time\": \"Breakfast\",\n", " \"details\": \"Buffet breakfast at the hotel with options including eggs, breads, cereals, and traditional Pakistani breakfast items.\"\n", " },\n", " {\n", " \"time\": \"Lunch\",\n", " \"details\": \"Lunch at a local restaurant featuring traditional Pakistani dishes such as biryani, kebabs, and lentil curry.\"\n", " },\n", " {\n", " \"time\": \"Dinner\",\n", " \"details\": \"Dinner at an upscale restaurant offering a mix of continental and Pakistani dishes.\"\n", " }\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 3 - Activities\",\n", " \"meals\": [\n", " {\n", " \"time\": \"Breakfast\",\n", " \"details\": \"Continental breakfast at the hotel with an assortment of pastries, fruits, and hot dishes.\"\n", " },\n", " {\n", " \"time\": \"Lunch\",\n", " \"details\": \"Catered lunch at the conference venue with light and healthy options like salads, sandwiches, and fruit.\"\n", " },\n", " {\n", " \"time\": \"Dinner\",\n", " \"details\": \"Group dinner in a traditional restaurant with live music and a menu featuring classic regional dishes.\"\n", " }\n", " ]\n", " },\n", " {\n", " \"day\": \"Day 4 - Departure\",\n", " \"meals\": [\n", " {\n", " \"time\": \"Breakfast\",\n", " \"details\": \"Last breakfast at the hotel with a variety of options to suit all dietary preferences.\"\n", " },\n", " {\n", " \"time\": \"Lunch\",\n", " \"details\": \"Farewell lunch with easy-to-eat options such as wraps, salads, and desserts before departure.\"\n", " }\n", " ]\n", " }\n", " ]\n", "}\n", "================================================== Iteration 1 \n", "✅ [Debug] Sending System Prompt (with history) to LLM:\n", "You are an AI assistant that follows the ReAct (Reasoning + Acting) pattern.\n", " \n", "Your goal is to help users by breaking down complex tasks into a series of thought-out steps and actions.\n", "\n", "You have access to these tools: \n", "\n", "\n", "\n", "Your task is to:\n", "1. Think about what action is required — Thought.\n", "2. Take an appropriate action — Action.\n", "3. Repeat Thought/Action as needed until you find the final answer.\n", "\n", "### Format (Choose only one per response)\n", "\n", "Option 1 — When action is needed:\n", "Thought: Your reasoning about action and observation.\n", "Action: {\"action_type\": \"\", \"input\": }\n", "\n", "Option 2 — When you're confident in the final response:\n", "Thought: Now I know the answer that will be given in Final Answer.\n", "Final Answer: Provide a complete, well-structured response that directly addresses the original question.\n", "\n", "### Important:\n", "- Think step-by-step.\n", "- Never provide both Action and Final Answer or multiple Action in the same response.\n", "- Use available tools wisely.\n", "- If stuck, reflect and retry but never hallucinate.\n", "- If observation is empty or not related, reflect and retry but never hallucinate.\n", "- The current date is June 05, 2025.\n", "- If you follow the format strictly, you will be recognized as an excellent and trustworthy AI assistant.\n", "\n", "\n", "Question: You are a creative event theme planner. Based on the event intent below, suggest a detailed event theme plan.\n", "Include:\n", "1. A creative theme name and style\n", "2. A list of decor elements needed (like penaflex, stage, lighting, florals)\n", "3. Any custom branding or stage setup suggestions\n", "Return only a valid JSON object with no code block markers, no explanation, no markdown, no labels — just the raw JSON.Return as a JSON dictionary with keys: theme_name, style_description, required_elements, branding_notes.\n", "IMPORTANT: Respond immediately with the final JSON object using only `Final Answer:` followed by the valid JSON. Do NOT output thoughts, actions, or any reasoning.user_intent = {\n", " \"event_type\": \"4 day trip\",\n", " \"location\": \"Rawalpindi to Karachi\",\n", " \"event_date\": \"2025-06-09\",\n", " \"number_of_guests\": 40,\n", " \"preferences\": \"via motorway\"\n", "}\n", "\n", "\n", "Now continue with next steps by strictly following the required format.\n", "\n", "==================================================\n", "🤖 [Debug] Step LLM Response:\n", "Final Answer: {\"theme_name\": \"Highway Odyssey\", \"style_description\": \"A road trip-inspired adventure with a blend of retro and modern travel aesthetics, emphasizing freedom, exploration, and camaraderie.\", \"required_elements\": [\"Road-themed penaflex with iconic highway signs\", \"A stage designed to look like a vintage bus front\", \"LED lighting to mimic sunrise and sunset along the journey\", \"Floral arrangements with wildflowers and greenery to evoke roadside landscapes\", \"Photo booth with props like steering wheels, sunglasses, and maps\"], \"branding_notes\": \"Custom branding on stage setup with a vintage bus motif, featuring the event name 'Highway Odyssey' in retro travel font. Personalized travel kits for guests with maps and branded badges.\"}\n", "✅ Parsed Final Answer: {\"theme_name\": \"Highway Odyssey\", \"style_description\": \"A road trip-inspired adventure with a blend of retro and modern travel aesthetics, emphasizing freedom, exploration, and camaraderie.\", \"required_elements\": [\"Road-themed penaflex with iconic highway signs\", \"A stage designed to look like a vintage bus front\", \"LED lighting to mimic sunrise and sunset along the journey\", \"Floral arrangements with wildflowers and greenery to evoke roadside landscapes\", \"Photo booth with props like steering wheels, sunglasses, and maps\"], \"branding_notes\": \"Custom branding on stage setup with a vintage bus motif, featuring the event name 'Highway Odyssey' in retro travel font. Personalized travel kits for guests with maps and branded badges.\"}\n", "🧠 Calling OpenAI...\n", "🧠 Calling OpenAI...\n", "🧠 Calling OpenAI...\n", "🧠 Calling OpenAI...\n", "🧠 Calling OpenAI...\n", "🧠 Calling OpenAI...\n", "🧠 Calling OpenAI...\n", "🧠 Calling OpenAI...\n", "🧠 Calling OpenAI...\n", "\n", "✅ Final Event Plan:\n", "{\n", " \"venues\": {\n", " \"venue_summary\": [\n", " {\n", " \"type\": \"resort\",\n", " \"options_available\": false\n", " },\n", " {\n", " \"type\": \"conference center\",\n", " \"options_available\": false\n", " },\n", " {\n", " \"type\": \"retreat center\",\n", " \"options_available\": false\n", " }\n", " ]\n", " },\n", " \"vendors\": [\n", " {\n", " \"vendor_type\": \"tour guides\",\n", " \"top_options\": [\n", " {\n", " \"name\": \"SeePakistanTours (DTS 8135)\",\n", " \"rating\": 5\n", " },\n", " {\n", " \"name\": \"Pakistan Tour And Travel Agency\",\n", " \"rating\": 4.9\n", " },\n", " {\n", " \"name\": \"Nexus Travels\",\n", " \"rating\": 4.9\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"security\",\n", " \"top_options\": [\n", " {\n", " \"name\": \"Al qasim security services pvt ltd islamabad rawalpindi\",\n", " \"rating\": 4.8\n", " },\n", " {\n", " \"name\": \"ONYX SECURITY SERVICES RAWALPINDI ISLAMABAD\",\n", " \"rating\": 4.6\n", " },\n", " {\n", " \"name\": \"Ghouri Security Guards (Pvt) Ltd.\",\n", " \"rating\": 4.6\n", " }\n", " ]\n", " },\n", " {\n", " \"vendor_type\": \"transportation\",\n", " \"top_options\": [\n", " {\n", " \"name\": \"Road Master Bus Terminal Rawalpindi\",\n", " \"rating\": 4.5\n", " },\n", " {\n", " \"name\": \"Pakistan Express Khalid Nasir Rawalpindi\",\n", " \"rating\": 4.1\n", " },\n", " {\n", " \"name\": \"Kainat Travels Terminal\",\n", " \"rating\": 4.1\n", " }\n", " ]\n", " }\n", " ],\n", " \"schedule\": {\n", " \"summary\": [\n", " {\n", " \"Day 1\": \"Arrival and welcome dinner.\"\n", " },\n", " {\n", " \"Day 2\": \"Sightseeing and sessions.\"\n", " },\n", " {\n", " \"Day 3\": \"Full-day conference.\"\n", " }\n", " ]\n", " },\n", " \"transportation\": {\n", " \"Transportation Summary\": [\n", " {\n", " \"vendor_types\": [\n", " \"shuttle service\",\n", " \"bus rental\"\n", " ],\n", " \"vehicle_estimates\": {\n", " \"shuttles\": 2,\n", " \"buses\": 1\n", " }\n", " },\n", " {\n", " \"recommended_bus_rental_vendors\": [\n", " {\n", " \"name\": \"Kainat Travels Terminal\",\n", " \"address\": \"JX6V+7R5, Main Main Peshawar Rd, Rawalpindi, 46000, Pakistan\",\n", " \"rating\": 4.1\n", " },\n", " {\n", " \"name\": \"Faisal Movers Faizabad Al-Makkah Terminal\",\n", " \"address\": \"IJP Road, Faizabad Interchange, I-8, Rawalpindi, 43600, Pakistan\",\n", " \"rating\": 4.1\n", " }\n", " ]\n", " },\n", " {\n", " \"nearest_transport_hub\": {\n", " \"bus_station\": {\n", " \"name\": \"Pirwadhai Bus Terminal Rawalpindi\",\n", " \"address\": \"J2JR+3CM, Pirwadhai, Rawalpindi, Pakistan\",\n", " \"rating\": 4\n", " }\n", " }\n", " }\n", " ]\n", " },\n", " \"hotels\": {\n", " \"hotel_type\": \"4-star\",\n", " \"room_requirements\": {\n", " \"single_rooms\": 10,\n", " \"double_rooms\": 10,\n", " \"suites\": 5\n", " },\n", " \"priorities\": [\n", " \"proximity to motorway\",\n", " \"Wi-Fi\",\n", " \"budget\"\n", " ]\n", " },\n", " \"sightseeing\": {\n", " \"is_required\": true,\n", " \"sightseeing_type\": \"Cultural\",\n", " \"integration_notes\": \"Schedule it on Day 2 afternoon.\"\n", " },\n", " \"catering\": {\n", " \"catering_summary\": {\n", " \"meal_plan_highlights\": [\n", " \"Day 1: Welcome dinner with local and international cuisines.\",\n", " \"Day 2: Traditional Pakistani lunch with biryani, kebabs, and lentil curry.\",\n", " \"Day 3: Group dinner with live music featuring classic regional dishes.\"\n", " ],\n", " \"top_caterer_recommendations\": [\n", " {\n", " \"meal_type\": \"Breakfast\",\n", " \"caterer\": {\n", " \"name\": \"Karachi Inn Catering\",\n", " \"rating\": 5,\n", " \"address\": \"Shop#5,6, Al Saad Arcade, Pakistan Town Phase 2 Rd, near Al-Noor Chemist, Main Commerical Block A PWD, Islamabad, Pakistan\",\n", " \"phone\": \"0301 2447096\",\n", " \"website\": \"https://karachiinncatering.com/\"\n", " }\n", " },\n", " {\n", " \"meal_type\": \"Lunch\",\n", " \"caterer\": {\n", " \"name\": \"Raja usman Food\",\n", " \"rating\": 4.9,\n", " \"address\": \"J2RX+RXG, Unnamed Road, Khayaban e Sir Syed, Rawalpindi, Pakistan\",\n", " \"phone\": \"0333 5105129\",\n", " \"website\": \"N/A\"\n", " }\n", " },\n", " {\n", " \"meal_type\": \"Dinner\",\n", " \"caterer\": {\n", " \"name\": \"Punjab Catering & Party Decorators(Tent Service)\",\n", " \"rating\": 5,\n", " \"address\": \"Shop #4 Ground Floor, Khalid Awan Heights, Bahria Greens overseas 5 Commercial Phase-8 Bahria Town, Rawalpindi, 46620, Pakistan\",\n", " \"phone\": \"0330 3874830\",\n", " \"website\": \"http://punjabcaterings.com/\"\n", " }\n", " }\n", " ]\n", " }\n", " },\n", " \"theme\": {\n", " \"theme_summary\": {\n", " \"name\": \"Highway Odyssey\",\n", " \"description\": \"A road trip-inspired adventure emphasizing freedom, exploration, and camaraderie with retro and modern travel aesthetics.\"\n", " },\n", " \"key_elements\": [\n", " \"Stage setup with vintage bus motif and LED lighting for sunrise/sunset effect\",\n", " \"Floral arrangements with wildflowers evoking roadside landscapes\"\n", " ],\n", " \"top_vendors\": [\n", " {\n", " \"name\": \"Sign 2000 Pakistan (Pvt) Ltd.\",\n", " \"type\": \"Road-themed penaflex with iconic highway signs\",\n", " \"rating\": 4.9\n", " },\n", " {\n", " \"name\": \"360 Selfie PK\",\n", " \"type\": \"Photo booth with props like steering wheels, sunglasses, and maps\",\n", " \"rating\": 5\n", " }\n", " ]\n", " },\n", " \"weather_forecast\": [\n", " {\n", " \"date\": \"2025-06-10\",\n", " \"min_temp\": \"29.2C\",\n", " \"max_temp\": \"46.2C\",\n", " \"description\": \"Mainly clear\"\n", " },\n", " {\n", " \"date\": \"2025-06-11\",\n", " \"min_temp\": \"31.5C\",\n", " \"max_temp\": \"46.1C\",\n", " \"description\": \"Partly cloudy\"\n", " }\n", " ]\n", "}\n" ] } ] }, { "cell_type": "markdown", "source": [ "# **Gradio Implementation**" ], "metadata": { "id": "8G-IajhRCy3l" } }, { "cell_type": "code", "source": [ "!pip install gradio\n", "!python gradio_app.py\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "3HZCXPEi6qHp", "outputId": "919ebcbd-86b5-4e1f-a980-b9bc6bd9ae8b" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Requirement already satisfied: gradio in /usr/local/lib/python3.11/dist-packages (5.31.0)\n", "Requirement already satisfied: aiofiles<25.0,>=22.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (24.1.0)\n", "Requirement already satisfied: anyio<5.0,>=3.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (4.9.0)\n", "Requirement already satisfied: fastapi<1.0,>=0.115.2 in /usr/local/lib/python3.11/dist-packages (from gradio) (0.115.12)\n", "Requirement already satisfied: ffmpy in /usr/local/lib/python3.11/dist-packages (from gradio) (0.5.0)\n", "Requirement already satisfied: gradio-client==1.10.1 in /usr/local/lib/python3.11/dist-packages (from gradio) (1.10.1)\n", "Requirement already satisfied: groovy~=0.1 in /usr/local/lib/python3.11/dist-packages (from gradio) (0.1.2)\n", "Requirement already satisfied: httpx>=0.24.1 in /usr/local/lib/python3.11/dist-packages (from gradio) (0.28.1)\n", "Requirement already satisfied: huggingface-hub>=0.28.1 in /usr/local/lib/python3.11/dist-packages (from gradio) (0.32.2)\n", "Requirement already satisfied: jinja2<4.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (3.1.6)\n", "Requirement already satisfied: markupsafe<4.0,>=2.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (3.0.2)\n", "Requirement already satisfied: numpy<3.0,>=1.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (2.0.2)\n", "Requirement already satisfied: orjson~=3.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (3.10.18)\n", "Requirement already satisfied: packaging in /usr/local/lib/python3.11/dist-packages (from gradio) (24.2)\n", "Requirement already satisfied: pandas<3.0,>=1.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (2.2.2)\n", "Requirement already satisfied: pillow<12.0,>=8.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (11.2.1)\n", "Requirement already satisfied: pydantic<2.12,>=2.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (2.11.5)\n", "Requirement already satisfied: pydub in /usr/local/lib/python3.11/dist-packages (from gradio) (0.25.1)\n", "Requirement already satisfied: python-multipart>=0.0.18 in /usr/local/lib/python3.11/dist-packages (from gradio) (0.0.20)\n", "Requirement already satisfied: pyyaml<7.0,>=5.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (6.0.2)\n", "Requirement already satisfied: ruff>=0.9.3 in /usr/local/lib/python3.11/dist-packages (from gradio) (0.11.12)\n", "Requirement already satisfied: safehttpx<0.2.0,>=0.1.6 in /usr/local/lib/python3.11/dist-packages (from gradio) (0.1.6)\n", "Requirement already satisfied: semantic-version~=2.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (2.10.0)\n", "Requirement already satisfied: starlette<1.0,>=0.40.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (0.46.2)\n", "Requirement already satisfied: tomlkit<0.14.0,>=0.12.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (0.13.2)\n", "Requirement already satisfied: typer<1.0,>=0.12 in /usr/local/lib/python3.11/dist-packages (from gradio) (0.16.0)\n", "Requirement already satisfied: typing-extensions~=4.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (4.13.2)\n", "Requirement already satisfied: uvicorn>=0.14.0 in /usr/local/lib/python3.11/dist-packages (from gradio) (0.34.2)\n", "Requirement already satisfied: fsspec in /usr/local/lib/python3.11/dist-packages (from gradio-client==1.10.1->gradio) (2025.3.2)\n", "Requirement already satisfied: websockets<16.0,>=10.0 in /usr/local/lib/python3.11/dist-packages (from gradio-client==1.10.1->gradio) (15.0.1)\n", "Requirement already satisfied: idna>=2.8 in /usr/local/lib/python3.11/dist-packages (from anyio<5.0,>=3.0->gradio) (3.10)\n", "Requirement already satisfied: sniffio>=1.1 in /usr/local/lib/python3.11/dist-packages (from anyio<5.0,>=3.0->gradio) (1.3.1)\n", "Requirement already satisfied: certifi in /usr/local/lib/python3.11/dist-packages (from httpx>=0.24.1->gradio) (2025.4.26)\n", "Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.11/dist-packages (from httpx>=0.24.1->gradio) (1.0.9)\n", "Requirement already satisfied: h11>=0.16 in /usr/local/lib/python3.11/dist-packages (from httpcore==1.*->httpx>=0.24.1->gradio) (0.16.0)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.11/dist-packages (from huggingface-hub>=0.28.1->gradio) (3.18.0)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.11/dist-packages (from huggingface-hub>=0.28.1->gradio) (2.32.3)\n", "Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.11/dist-packages (from huggingface-hub>=0.28.1->gradio) (4.67.1)\n", "Requirement already satisfied: hf-xet<2.0.0,>=1.1.2 in /usr/local/lib/python3.11/dist-packages (from huggingface-hub>=0.28.1->gradio) (1.1.2)\n", "Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.11/dist-packages (from pandas<3.0,>=1.0->gradio) (2.9.0.post0)\n", "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.11/dist-packages (from pandas<3.0,>=1.0->gradio) (2025.2)\n", "Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.11/dist-packages (from pandas<3.0,>=1.0->gradio) (2025.2)\n", "Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic<2.12,>=2.0->gradio) (0.7.0)\n", "Requirement already satisfied: pydantic-core==2.33.2 in /usr/local/lib/python3.11/dist-packages (from pydantic<2.12,>=2.0->gradio) (2.33.2)\n", "Requirement already satisfied: typing-inspection>=0.4.0 in /usr/local/lib/python3.11/dist-packages (from pydantic<2.12,>=2.0->gradio) (0.4.1)\n", "Requirement already satisfied: click>=8.0.0 in /usr/local/lib/python3.11/dist-packages (from typer<1.0,>=0.12->gradio) (8.2.1)\n", "Requirement already satisfied: shellingham>=1.3.0 in /usr/local/lib/python3.11/dist-packages (from typer<1.0,>=0.12->gradio) (1.5.4)\n", "Requirement already satisfied: rich>=10.11.0 in /usr/local/lib/python3.11/dist-packages (from typer<1.0,>=0.12->gradio) (13.9.4)\n", "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil>=2.8.2->pandas<3.0,>=1.0->gradio) (1.17.0)\n", "Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.11/dist-packages (from rich>=10.11.0->typer<1.0,>=0.12->gradio) (3.0.0)\n", "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.11/dist-packages (from rich>=10.11.0->typer<1.0,>=0.12->gradio) (2.19.1)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests->huggingface-hub>=0.28.1->gradio) (3.4.2)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests->huggingface-hub>=0.28.1->gradio) (2.4.0)\n", "Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.11/dist-packages (from markdown-it-py>=2.2.0->rich>=10.11.0->typer<1.0,>=0.12->gradio) (0.1.2)\n", "python3: can't open file '/content/AgentPro/gradio_app.py': [Errno 2] No such file or directory\n" ] } ] }, { "cell_type": "code", "source": [ "import gradio as gr\n", "\n", "# Global state\n", "user_intent_state = {}\n", "\n", "# Unified extract + cache\n", "def extract_intent_interface(query):\n", " try:\n", " intent = extract_user_intent(query)\n", " user_intent_state[\"intent\"] = intent\n", " return f\"🎯 Intent extracted:\\n```json\\n{json.dumps(intent, indent=2)}\\n```\"\n", " except Exception as e:\n", " return f\"❌ Error: {str(e)}\"\n", "\n", "# Agent output wrappers\n", "def run_agent(agent_func, label):\n", " try:\n", " intent = user_intent_state.get(\"intent\")\n", " if not intent:\n", " return \"⚠️ Please extract intent first by entering a query.\"\n", "\n", " if \"schedule\" in agent_func.__name__:\n", " result = agent_func(intent)\n", " elif \"weather\" in agent_func.__name__:\n", " schedule = scheduler_agent(intent)\n", " result = agent_func(intent, schedule)\n", " elif \"transport\" in agent_func.__name__:\n", " schedule = scheduler_agent(intent)\n", " venues = venue_agent(intent)\n", " result = agent_func(intent, venues, schedule)\n", " elif \"hotel\" in agent_func.__name__:\n", " venues = venue_agent(intent)\n", " result = agent_func(intent, venues)\n", " elif \"sightseeing\" in agent_func.__name__ or \"catering\" in agent_func.__name__:\n", " schedule = scheduler_agent(intent)\n", " result = agent_func(intent, schedule)\n", " else:\n", " result = agent_func(intent)\n", "\n", " return f\"### ✅ {label} Output\\n```json\\n{json.dumps(result, indent=2)}\\n```\"\n", " except Exception as e:\n", " return f\"❌ {label} failed: {str(e)}\"\n", "\n", "# Main plan button\n", "def run_orchestrator(query):\n", " try:\n", " intent = extract_user_intent(query)\n", " plan = orchestrated_event_plan(intent)\n", "\n", " display = f\"### 🎯 Extracted Intent\\n```json\\n{json.dumps(intent, indent=2)}\\n```\\n\"\n", " display += \"### 🧩 Event Summary\\n\"\n", " for k, v in plan[\"summary\"].items():\n", " display += f\"#### {k.title()}\\n```json\\n{json.dumps(v, indent=2)}\\n```\\n\"\n", " return display\n", " except Exception as e:\n", " return f\"❌ Error during full planning: {e}\"\n", "\n", "# Gradio UI\n", "with gr.Blocks(theme=gr.themes.Soft()) as app:\n", " gr.Markdown(\"# 🎉 AI Event Planner – Agent Explorer\")\n", " query = gr.Textbox(label=\"📝 Describe your event\")\n", " with gr.Row():\n", " intent_btn = gr.Button(\"🎯 Extract Intent\")\n", " full_plan_btn = gr.Button(\"🧠 Generate Full Plan\")\n", " intent_out = gr.Markdown()\n", "\n", " intent_btn.click(fn=extract_intent_interface, inputs=query, outputs=intent_out)\n", " full_plan_btn.click(fn=run_orchestrator, inputs=query, outputs=intent_out)\n", "\n", " gr.Markdown(\"## 🧩 Individual Agent Outputs\")\n", "\n", " with gr.Row():\n", " venue_btn = gr.Button(\"📍 Venues\")\n", " vendor_btn = gr.Button(\"🛠️ Vendors\")\n", " schedule_btn = gr.Button(\"📅 Schedule\")\n", " catering_btn = gr.Button(\"🍽️ Catering\")\n", " with gr.Row():\n", " transport_btn = gr.Button(\"🚌 Transport\")\n", " hotel_btn = gr.Button(\"🏨 Hotels\")\n", " sightseeing_btn = gr.Button(\"🧭 Sightseeing\")\n", " weather_btn = gr.Button(\"🌤️ Weather\")\n", " theme_btn = gr.Button(\"🎨 Theme\")\n", "\n", " agent_output = gr.Markdown()\n", "\n", " venue_btn.click(fn=lambda: run_agent(venue_agent, \"Venues\"), outputs=agent_output)\n", " vendor_btn.click(fn=lambda: run_agent(vendors_agent, \"Vendors\"), outputs=agent_output)\n", " schedule_btn.click(fn=lambda: run_agent(scheduler_agent, \"Schedule\"), outputs=agent_output)\n", " catering_btn.click(fn=lambda: run_agent(catering_agent, \"Catering\"), outputs=agent_output)\n", " transport_btn.click(fn=lambda: run_agent(transport_parking_agent, \"Transport\"), outputs=agent_output)\n", " hotel_btn.click(fn=lambda: run_agent(hotel_booking_agent, \"Hotels\"), outputs=agent_output)\n", " sightseeing_btn.click(fn=lambda: run_agent(sightseeing_agent, \"Sightseeing\"), outputs=agent_output)\n", " weather_btn.click(fn=lambda: run_agent(weather_predictor_agent, \"Weather\"), outputs=agent_output)\n", " theme_btn.click(fn=lambda: run_agent(theme_agent, \"Theme\"), outputs=agent_output)\n", "\n", "app.launch(share=True)\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 610 }, "id": "j6rTABhB6lfD", "outputId": "33520a51-89dc-4733-c608-98af1c2bc48d" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Colab notebook detected. To show errors in colab notebook, set debug=True in launch()\n", "* Running on public URL: https://5ea347483bba90d63b.gradio.live\n", "\n", "This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/html": [ "
" ] }, "metadata": {} }, { "output_type": "execute_result", "data": { "text/plain": [] }, "metadata": {}, "execution_count": 29 } ] } ] }