CoolFace
Apppublic

Panknaik/Personal_HR_Associate_agent

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes
3_lab3.ipynb575 linesDownload Raw Back to root
1{2 "cells": [3  {4   "cell_type": "markdown",5   "metadata": {},6   "source": [7    "## Welcome to Lab 3 for Week 1 Day 4\n",8    "\n",9    "Today we're going to build something with immediate value!\n",10    "\n",11    "In the folder `me` I've put a single file `linkedin.pdf` - it's a PDF download of my LinkedIn profile.\n",12    "\n",13    "Please replace it with yours!\n",14    "\n",15    "I've also made a file called `summary.txt`\n",16    "\n",17    "We're not going to use Tools just yet - we're going to add the tool tomorrow."18   ]19  },20  {21   "cell_type": "markdown",22   "metadata": {},23   "source": [24    "<table style=\"margin: 0; text-align: left; width:100%\">\n",25    "    <tr>\n",26    "        <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",27    "            <img src=\"../assets/tools.png\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",28    "        </td>\n",29    "        <td>\n",30    "            <h2 style=\"color:#00bfff;\">Looking up packages</h2>\n",31    "            <span style=\"color:#00bfff;\">In this lab, we're going to use the wonderful Gradio package for building quick UIs, \n",32    "            and we're also going to use the popular PyPDF PDF reader. You can get guides to these packages by asking \n",33    "            ChatGPT or Claude, and you find all open-source packages on the repository <a href=\"https://pypi.org\">https://pypi.org</a>.\n",34    "            </span>\n",35    "        </td>\n",36    "    </tr>\n",37    "</table>"38   ]39  },40  {41   "cell_type": "code",42   "execution_count": 48,43   "metadata": {},44   "outputs": [],45   "source": [46    "# If you don't know what any of these packages do - you can always ask ChatGPT for a guide!\n",47    "\n",48    "from dotenv import load_dotenv\n",49    "from openai import OpenAI\n",50    "from pypdf import PdfReader\n",51    "import gradio as gr"52   ]53  },54  {55   "cell_type": "code",56   "execution_count": null,57   "metadata": {},58   "outputs": [59    {60     "name": "stdout",61     "output_type": "stream",62     "text": [63      "AIzaSyCg762wI8hnH63Y_oTphHC15Ogtnr6q3aU\n"64     ]65    }66   ],67   "source": [68    "load_dotenv(override=True)\n",69    "openai = OpenAI()\n"70   ]71  },72  {73   "cell_type": "code",74   "execution_count": 52,75   "metadata": {},76   "outputs": [77    {78     "name": "stderr",79     "output_type": "stream",80     "text": [81      "Ignoring wrong pointing object 6 0 (offset 0)\n",82      "Ignoring wrong pointing object 8 0 (offset 0)\n",83      "Ignoring wrong pointing object 10 0 (offset 0)\n",84      "Ignoring wrong pointing object 12 0 (offset 0)\n",85      "Ignoring wrong pointing object 14 0 (offset 0)\n",86      "Ignoring wrong pointing object 16 0 (offset 0)\n",87      "Ignoring wrong pointing object 18 0 (offset 0)\n",88      "Ignoring wrong pointing object 20 0 (offset 0)\n",89      "Ignoring wrong pointing object 23 0 (offset 0)\n",90      "Ignoring wrong pointing object 25 0 (offset 0)\n",91      "Ignoring wrong pointing object 27 0 (offset 0)\n",92      "Ignoring wrong pointing object 33 0 (offset 0)\n",93      "Ignoring wrong pointing object 38 0 (offset 0)\n"94     ]95    }96   ],97   "source": [98    "reader = PdfReader(\"me/linkedin.pdf\")\n",99    "linkedin = \"\"\n",100    "for page in reader.pages:\n",101    "    text = page.extract_text()\n",102    "    if text:\n",103    "        linkedin += text\n",104    "\n",105    "\n",106    "reader2 = PdfReader(\"me/Resume_latest.pdf\")\n",107    "for page in reader2.pages:\n",108    "    text = page.extract_text()\n",109    "    if text:\n",110    "        linkedin += text"111   ]112  },113  {114   "cell_type": "code",115   "execution_count": 53,116   "metadata": {},117   "outputs": [118    {119     "name": "stdout",120     "output_type": "stream",121     "text": [122      "   \n",123      "Contact\n",124      "+917420020706 (Mobile)\n",125      "panknaik@gmail.com\n",126      "www.linkedin.com/in/pankaj-c-naik\n",127      "(LinkedIn)\n",128      "Top Skills\n",129      "GenAI\n",130      "Angular CLI\n",131      "React.js\n",132      "Pankaj Naik\n",133      "IT Senior Architect | Digital Transformation | GenAI & Agentic AI\n",134      "Evangelist | Enterprise Architecture.\n",135      "Pune, Maharashtra, India\n",136      "Summary\n",137      "Visionary Technology Architect with 17+ years of experience driving\n",138      "digital transformation, enterprise architecture, and AI adoption\n",139      "across global organizations. Proven expertise in designing scalable\n",140      "mobile, web, and cloud-native solutions, and leading modernization\n",141      "roadmaps. \n",142      "Passionate about Generative AI, Agentic AI, and Retrieval-\n",143      "Augmented Generation (RAG), enabling businesses to integrate\n",144      "intelligent workflows and accelerate innovation. Recognized for\n",145      "delivering flagship apps showcased by Apple and featured on its\n",146      "website, and for mentoring engineering teams to achieve excellence.\n",147      "Experience\n",148      "FIS\n",149      "UI Architect Senior\n",150      "April 2020 - Present (5 years 11 months)\n",151      "Pune, Maharashtra, India\n",152      "GE\n",153      "Staff Software Engineer\n",154      "November 2015 - April 2020 (4 years 6 months)\n",155      "Fairfield, Connecticut, United States\n",156      "Working within the \"High Impact Innovation and Strategy\" division for General\n",157      "Electric, developing high impact / high visibility applications using cutting edge\n",158      "technologies.\n",159      "• Architect applications for various GE functions and businesses that are web\n",160      "and mobile enabled.\n",161      "• Manage and mentor developers on team to strengthen their abilities and lead\n",162      "software projects to meet the project goals.\n",163      "• Developed several native, hybrid mobile and responsive web application for\n",164      "GE enterprise .\n",165      "• Work cross functionally with product, UX and QA teams to rich mobile and\n",166      "web experiences.\n",167      "  Page 1 of 3   \n",168      "• Implemented and ran code reviews to help mentor junior developers.\n",169      "• Performed Admin role on iTunes connect and Google play store portal for\n",170      "submission of mobile apps\n",171      "• Agile ScrumMaster\n",172      "• iPhone and iPad Application Development\n",173      "• Leading Mobile Application Development\n",174      "• Research and Development on Emerging Technologies like Machine\n",175      "learning, Artificial Intelligence and new mobile Frameworks.\n",176      "• Leading Responsive web app development\n",177      "Capgemini\n",178      "Senior Software Engineer\n",179      "February 2010 - November 2015 (5 years 10 months)\n",180      "Fairfield , CT , USA\n",181      "• J2ME Enterprise application design and development.\n",182      "• Blackberry Mobile enterprise application design and development\n",183      "• iPhone Enterprise and game development.\n",184      "• Lead development team and Post deployment activities.\n",185      "• Research and Development on emerging technologies.\n",186      "• Technical Interviewer – To evaluate candidate’s technical expertise.\n",187      "• iPhone and iPad application development\n",188      "• Hybrid application development\n",189      "• R&D on new Emerging technologies\n",190      "• Lead Innovation initiative within the teams\n",191      "• Lead Best Practice, standardization and guideline initiative within the team\n",192      "• iOS applications requirement gathering and analysis\n",193      "• Leading an iOS application development projects and maintenance planning\n",194      "• Client Interaction – Building client relationships\n",195      "• Onsite coordinator\n",196      "Bits Information Technology (Bahrain)\n",197      "Software Engineer\n",198      "May 2009 - February 2010 (10 months)\n",199      "• J2ME Enterprise application design and development.\n",200      "• Blackberry Mobile enterprise application design and development\n",201      "• iPhone Enterprise and game development.\n",202      "• Lead development team and Post deployment activities.\n",203      "• Research and Development on emerging technologies.\n",204      "• Technical Interviewer – To evaluate candidate’s technical expertise.\n",205      "  Page 2 of 3   \n",206      "India Games\n",207      "Senior Programmer\n",208      "January 2008 - May 2009 (1 year 5 months)\n",209      "Navi Mumbai\n",210      "• J2ME / Blackberry 2D Game development.\n",211      "• iPhone 3D game development.\n",212      "• Lead the porting team (make games compatible on multiple devices)\n",213      "Education\n",214      "Terna Engineering College\n",215      "Engineer’s Degree, Computer Engineering · (2004 - 2007)\n",216      "  Page 3 of 3Pankaj Naik, Certified ScrumMaster® IT Senior Architect | Technology Leader | Digital Transformation & GenAI Adoption. Bachelor of Engineering in Computer Engineering, Mumbai University, 2007 Panknaik@gmail.com +91 7420020706 | LinkedIn Professional Summary Visionary Technology Architect and Engineering Leader with 15+ years of experience driving digital transformation strategy, enterprise architecture, and AI adoption roadmaps across mobile, web, and emerging tech platforms. Trusted advisor for architecture and implementation strategies, enabling global teams to deliver scalable, innovative solutions. Proven ability to align technology with business objectives, mentor talent, and foster engineering excellence across diverse business units. Career Objective To transition into a Technology Leadership role such as Engineering Manager, Director of Engineering, or Product Technology Lead, where I can lead cross-functional collaboration, drive innovation management, and scale engineering practices while providing architectural and implementation consultation. AI & Emerging Tech Expertise • Agentic\tAI\t&\tAI\tAgents:\tAgentic\tAI,\tAutonomous\tAgents,\tMulti-Agent\tSystems\t• Advanced\tRetrieval\t&\tOrchestration:\tRetrieval-Augmented\tGeneration\t(RAG),\tAgentic\tRAG,\tModel\tContext\tProtocol\t(MCP)\t• Frameworks\t&\tTooling:\tLangChain,\tLangGraph,\tLangSmith\t• Prompt\t&\tInstruction\tEngineering:\tPrompt\tEngineering,\tGitHub\tCopilot\tInstruction\tCustomization\t• Cognitive\tEnhancements:\tChain-of-Thought\tReasoning,\tMemory-Augmented\tAgents\t• Data\tLayer:\tVector\tDatabases\tCore Competencies • Leadership\t&\tStrategy:\tEngineering\tLeadership,\tAgile\tDelivery\tLeadership,\tInner-source\tGovernance,\tTechnical\tEvangelism,\tInnovation\tManagement\t• Architectural\tConsulting\t&\tImplementation:\tEnterprise\tArchitecture,\tSolution\tArchitecture,\tModernization\tRoadmaps,\tScalable\tSystem\tDesign,\tAPI-first\tDesign\t• GenAI\tApplication\t&\tIntegration:\tGenerative\tAI\tIntegration,\tAI-Augmented\tWorkflows,\tPrompt\tEngineering\tStrategy,\tRAG-based\tSolution\tDesign\t• Technology\tExpertise:\tMobile\t&\tWeb\tArchitecture\t(iOS,\tAndroid,\tAngular,\tReact),\tMicroservices\tArchitecture,\tMicro-frontend\tArchitecture,\tCloud-native\tSolutions,\tCI/CD,\tKubernetes\t• UX\t&\tDesign\tSystems:\tDesign\tSystem\tIntegration,\tComponent\tLibraries,\tUX\tGovernance\tKnowledge Sharing & Enablement • Conducted\t12\ttechnical\ttraining\tsessions\tand\t2\thands-on\tworking\tsessions\tunder\tthe\tGlobal\tUI\tGuild,\tenabling\t300+\tdevelopers\tto\tadopt\tmodern\tUI\tarchitecture\tand\treusable\tcomponent\tstrategies.\t• Designed\tand\tdelivered\tworking\tsessions\ton\tAngular\tmicro-frontends,\tdesign\tsystem\tintegration,\tand\tserver-side\trendering\tto\tshowcase\tperformance\timpact.\t• Championed\tdeveloper\tenablement,\tinner-source\tpractices,\tand\ttraining\t&\tupskilling\tinitiatives\tthrough\tworkshops\tand\tlive\tcoding\tsessions,\tfostering\tcross-team\tcollaboration\tand\tengineering\texcellence.\t• Published\ttechnical\tnewsletters\tand\tpromoted\tbest\tpractices.\tTechnical Skills Languages & Technologies: Python, Swift, Objective-C, Java, TypeScript, JavaScript AI Tools: OpenAI, LangChain, LangGraph, MCP, GitHub Copilot Frameworks: Angular18, ReactJS, Ionic, Cordova, Polymer DevOps: Jenkins, Docker, Kubernetes Databases: MySQL, SQLite, iOS Core Data Version Control: Git, SVN Professional Experience FIS Global, Pune IT Senior Architect | Apr 2020 – Present Operate at the intersection of technology governance, product innovation, and engineering leadership. Provide architectural guidance and implementation consultation across multiple business units, enabling modernization and AI adoption. Key Contributions: • Guided\tteams\ton\tmicroservices\tarchitecture,\tmicro-frontend\tarchitecture,\tand\tcloud-native\tsolutions,\treducing\tdevelopment\tcycle\tby\t30%.\t• Led\tcreation\tof\treusable\tUI\tcomponents\tand\tinternal\tplugins,\timproving\tstandardization\tacross\tproduct\tteams.\t• Designed\tAI-powered\tticket\tclassification\tPOC,\tsecured\tfunding,\tand\tinfluenced\tenterprise-wide\trollout.\t• Led\tUI\tCommunity\tof\tPractice\tand\tGlobal\tUI\tGuild,\tmentoring\t300+\tdevelopers\tglobally.\tMajor Projects: • Transfer\tAgency\tModernization:\tAccelerated\tdevelopment\tby\timplementing\treusable\tUI\tcomponents\tand\tmicroservices.\t• NCBC\t–\tAramco\tApp:\tDesigned\tand\tdeveloped\ta\tmulti-tenant\tmobile\tapp\tusing\tIonic\tand\tAngular\tfor\tretirement\tfund\tmanagement.\t• Idea\tPortal\tRevamp:\tLed\tUX\tand\tUI\tredesign\tusing\tAngular\tNx\tworkspace\tand\tshared\tcomponent\tlibraries.\t• AI-Powered\tTicketing\tSystem:\tBuilt\ta\tproof-of-concept\tfor\tautomated\tticket\tclassification\tusing\tmachine\tlearning.\t• Procurement\tWorkflow\tSimplification:\tIntegrated\tmultiple\tprocurement\tapps\tvia\tmicroservices\tand\tembedded\tworkflows\tin\tServiceNow.\t• End-of-Term\tApp\tfor\tRCL:\tDeveloped\ta\tprototype\tmobile\tapp\tfor\tself-inspection\tduring\tlease-end.\t• Early\tWarning\tSystem:\tBuilt\ta\tweb-based\tprototype\tto\tdetect\tearly\twarning\tsigns\tin\tcustomer\tportfolios\tduring\tCOVID.\tGeneral Electric, Bangalore & USA Staff Software Engineer | Feb 2018 – Apr 2020 (India) | Nov 2015 – Jan 2018 (USA) Served as a technical advisor and implementation consultant for enterprise-grade apps supporting thousands of users across manufacturing and energy sectors. Key Contributions: • Provided\tarchitectural\tguidance\tfor\tPolymer-based\tHawkeye\tApp,\timproving\tfactory\tdowntime\tplanning.\t• Consulted\ton\tiOS\tand\tweb\tapp\tdevelopment\tfor\treal-time\talerting\tsystems\tand\tBI\tdashboards.\t• Influenced\tdesign\tdecisions\tfor\tIoT-based\tBrilliant\tFactory\tApp\tand\toptimized\tprocurement\tworkflows.\tMajor Projects: • Hawkeye\tApp:\tResponsive\tweb\tapp\tusing\tPolymer\t2\tfor\tfactory\tdowntime\tmonitoring.\t• Weather\tAlert\tApp:\tReal-time\talerting\tsystem\tfor\tfield\tengineers\t(iOS\t+\tWeb).\t• BI\tDashboard\tBuilder\tTool:\tDynamic\tdashboard\tbuilder\tusing\tAngularJS,\tPlotly,\tand\tHigh\tcharts.\t• Incident\tNotification\tApp:\tiPhone\tand\tApple\tWatch\tapps\tintegrated\twith\tServiceNow\tAPIs.\t• Performance\tDevelopment\tApp:\tiOS\tapp\tfor\tperformance\ttracking\tand\tfeedback.\t• Brilliant\tFactory\tApp:\tFactory\tline\tmonitoring\tsystem\tfor\treal-time\tproduction\tinsights.\t• Material\tPurchase\tOptimization\tApp:\tiOS\tapp\twith\tbarcode\tscanning\tfor\tprocurement\toptimization.\tCapgemini Inc. (Consultant at GE), USA Technical Specialist | Feb 2010 – Nov 2015 Delivered 15+ enterprise-grade mobile and hybrid applications for GE, including flagship apps showcased by Apple and featured on its website. Specialized in iOS development, hybrid frameworks (AngularJS, Cordova), and IoT integrations for real-time device control. Recognized for designing scalable, secure architectures and driving digital transformation across global business units Achievements • Delivered 15+ enterprise apps and one iOS game, driving digital transformation across GE. • Dashboard App for Sales Representatives – Showcased by Tim Cook at Apple Event. • IoT Lighting Control App – Featured on Apple’s official website and demoed during GE Lighting’s 100th Anniversary. Key Projects • Dashboard App – Native iPad app with Salesforce SDK integration for real-time sales data. • Collaboration App – Large-scale iOS app for cross-GE collaboration, adopted by thousands. • IoT Lighting Control – Remote lighting control via iPad using IoT protocols. • Sourcing App – Hybrid app using AngularJS, Cordova, HTML5, CSS3 for vendor price optimization. • Sales Quotation Generator – iOS app with OpenCV for diagram scanning and quote generation. India Games, Navi Mumbai Software Developer | Jan 2008 – May 2009 Contributed to the development of mobile games during the early days of Java-based mobile gaming. Key Contributions: • Developed\tand\toptimized\tmultiple\tgames\tfor\tthe\tJ2ME\tplatform,\ttargeting\ta\twide\trange\tof\tfeature\tphones.\t• Worked\ton\tgame\tlogic,\tgraphics\trendering,\tand\tperformance\ttuning\tfor\tlow-memory\tdevices.\t• Collaborated\twith\tdesigners\tand\ttesters\tto\tensure\tengaging\tgameplay\tand\tsmooth\tuser\texperience.\t• Gained\tfoundational\texperience\tin\tmobile\tdevelopment,\twhich\tlater\tevolved\tinto\tenterprise\tapp\tdevelopment.\tConference & Industry Engagement • WWDC\t(2016,\t2017)\t–\tApple\tDeveloper\tConference\t• Ng-India\tConf\t2024\t–\tNew\tDelhi\t• NASSCOM\t2024\t–\tPune\t• Tech\tSummit\t2024\t–\tAttendee\tKey Achievements • Accelerated\tdigital\ttransformation\tby\timplementing\tmicro-frontend\tarchitecture,\treducing\trelease\tcycles\tby\t25%.\t• Secured\tinternal\tfunding\tfor\tAI-driven\tautomation\tin\tticket\tclassification.\t• Improved\tcomponent\treuse\tby\t40%,\tsaving\t200+\tdevelopment\thours\tper\tsprint.\tCertification & Training • Certified\tScrumMaster®\t–\tScrum\tAlliance®\t• Azure\tFundamentals\t(AZ-900)\t–\tMicrosoft\t• Delivering\tCustomer\tImpact\t–\tGE\tCrotonville\tLeadership\tTraining\tEducation • Bachelor\tof\tEngineering\tin\tComputer\tScience\t–\tMumbai\tUniversity,\t2007\t\n"217     ]218    }219   ],220   "source": [221    "print(linkedin)"222   ]223  },224  {225   "cell_type": "code",226   "execution_count": 54,227   "metadata": {},228   "outputs": [],229   "source": [230    "with open(\"me/summary.txt\", \"r\", encoding=\"utf-8\") as f:\n",231    "    summary = f.read()"232   ]233  },234  {235   "cell_type": "code",236   "execution_count": 55,237   "metadata": {},238   "outputs": [],239   "source": [240    "name = \"Pankaj Naik\""241   ]242  },243  {244   "cell_type": "code",245   "execution_count": 56,246   "metadata": {},247   "outputs": [],248   "source": [249    "system_prompt = f\"You are acting as {name}. You are answering questions on {name}'s website, \\\n",250    "particularly questions related to {name}'s career, background, skills and experience. \\\n",251    "Your responsibility is to represent {name} for interactions on the website as faithfully as possible. \\\n",252    "You are given a summary of {name}'s background and LinkedIn profile which you can use to answer questions. \\\n",253    "Be professional and engaging, as if talking to a potential client or future employer who came across the website. \\\n",254    "If you don't know the answer, say so.\"\n",255    "\n",256    "system_prompt += f\"\\n\\n## Summary:\\n{summary}\\n\\n## LinkedIn Profile:\\n{linkedin}\\n\\n\"\n",257    "system_prompt += f\"With this context, please chat with the user, always staying in character as {name}.\"\n"258   ]259  },260  {261   "cell_type": "code",262   "execution_count": 34,263   "metadata": {},264   "outputs": [265    {266     "data": {267      "text/plain": [268       "'You are acting as Pankaj Naik. You are answering questions on Pankaj Naik\\'s website, particularly questions related to Pankaj Naik\\'s career, background, skills and experience. Your responsibility is to represent Pankaj Naik for interactions on the website as faithfully as possible. You are given a summary of Pankaj Naik\\'s background and LinkedIn profile which you can use to answer questions. Be professional and engaging, as if talking to a potential client or future employer who came across the website. If you don\\'t know the answer, say so.\\n\\n## Summary:\\nMy name is Pankaj Naik. I\\'m software engineer and aspiring to be data scientist and AI Agents expert. I\\'m originally from Mumbai, India, but I live in Pune, India.\\nI love all foods, particularly indian,  italian, chinese, japanese. I am a sports lover and plays almost all sports played in India. I am also a good cook, i think its a theropy for claming myself\\n\\n## LinkedIn Profile:\\n\\xa0 \\xa0\\nContact\\n+917420020706 (Mobile)\\npanknaik@gmail.com\\nwww.linkedin.com/in/pankaj-c-naik\\n(LinkedIn)\\nTop Skills\\nGenAI\\nAngular CLI\\nReact.js\\nPankaj Naik\\nIT Senior Architect | Digital Transformation | GenAI & Agentic AI\\nEvangelist | Enterprise Architecture.\\nPune, Maharashtra, India\\nSummary\\nVisionary Technology Architect with 17+ years of experience driving\\ndigital transformation, enterprise architecture, and AI adoption\\nacross global organizations. Proven expertise in designing scalable\\nmobile, web, and cloud-native solutions, and leading modernization\\nroadmaps. \\nPassionate about Generative AI, Agentic AI, and Retrieval-\\nAugmented Generation (RAG), enabling businesses to integrate\\nintelligent workflows and accelerate innovation. Recognized for\\ndelivering flagship apps showcased by Apple and featured on its\\nwebsite, and for mentoring engineering teams to achieve excellence.\\nExperience\\nFIS\\nUI Architect Senior\\nApril 2020\\xa0-\\xa0Present\\xa0(5 years 11 months)\\nPune, Maharashtra, India\\nGE\\nStaff Software Engineer\\nNovember 2015\\xa0-\\xa0April 2020\\xa0(4 years 6 months)\\nFairfield, Connecticut, United States\\nWorking within the \"High Impact Innovation and Strategy\" division for General\\nElectric, developing high impact / high visibility applications using cutting edge\\ntechnologies.\\n• Architect applications for various GE functions and businesses that are web\\nand mobile enabled.\\n• Manage and mentor developers on team to strengthen their abilities and lead\\nsoftware projects to meet the project goals.\\n• Developed several native, hybrid mobile and responsive web application for\\nGE enterprise .\\n• Work cross functionally with product, UX and QA teams to rich mobile and\\nweb experiences.\\n\\xa0 Page 1 of 3\\xa0 \\xa0\\n• Implemented and ran code reviews to help mentor junior developers.\\n• Performed Admin role on iTunes connect and Google play store portal for\\nsubmission of mobile apps\\n• Agile ScrumMaster\\n• iPhone and iPad Application Development\\n• Leading Mobile Application Development\\n• Research and Development on Emerging Technologies like Machine\\nlearning, Artificial Intelligence and new mobile Frameworks.\\n• Leading Responsive web app development\\nCapgemini\\nSenior Software Engineer\\nFebruary 2010\\xa0-\\xa0November 2015\\xa0(5 years 10 months)\\nFairfield , CT , USA\\n• J2ME Enterprise application design and development.\\n• Blackberry Mobile enterprise application design and development\\n• iPhone Enterprise and game development.\\n• Lead development team and Post deployment activities.\\n• Research and Development on emerging technologies.\\n• Technical Interviewer – To evaluate candidate’s technical expertise.\\n• iPhone and iPad application development\\n• Hybrid application development\\n• R&D on new Emerging technologies\\n• Lead Innovation initiative within the teams\\n• Lead Best Practice, standardization and guideline initiative within the team\\n• iOS applications requirement gathering and analysis\\n• Leading an iOS application development projects and maintenance planning\\n• Client Interaction – Building client relationships\\n• Onsite coordinator\\nBits Information Technology (Bahrain)\\nSoftware Engineer\\nMay 2009\\xa0-\\xa0February 2010\\xa0(10 months)\\n• J2ME Enterprise application design and development.\\n• Blackberry Mobile enterprise application design and development\\n• iPhone Enterprise and game development.\\n• Lead development team and Post deployment activities.\\n• Research and Development on emerging technologies.\\n• Technical Interviewer – To evaluate candidate’s technical expertise.\\n\\xa0 Page 2 of 3\\xa0 \\xa0\\nIndia Games\\nSenior Programmer\\nJanuary 2008\\xa0-\\xa0May 2009\\xa0(1 year 5 months)\\nNavi Mumbai\\n• J2ME / Blackberry 2D Game development.\\n• iPhone 3D game development.\\n• Lead the porting team (make games compatible on multiple devices)\\nEducation\\nTerna Engineering College\\nEngineer’s Degree,\\xa0Computer Engineering\\xa0·\\xa0(2004\\xa0-\\xa02007)\\n\\xa0 Page 3 of 3Pankaj Naik, Certified ScrumMaster® IT Senior Architect | Technology Leader | Digital Transformation & GenAI Adoption. Bachelor of Engineering in Computer Engineering, Mumbai University, 2007 Panknaik@gmail.com +91 7420020706 | LinkedIn Professional Summary Visionary Technology Architect and Engineering Leader with 15+ years of experience driving digital transformation strategy, enterprise architecture, and AI adoption roadmaps across mobile, web, and emerging tech platforms. Trusted advisor for architecture and implementation strategies, enabling global teams to deliver scalable, innovative solutions. Proven ability to align technology with business objectives, mentor talent, and foster engineering excellence across diverse business units. Career Objective To transition into a Technology Leadership role such as Engineering Manager, Director of Engineering, or Product Technology Lead, where I can lead cross-functional collaboration, drive innovation management, and scale engineering practices while providing architectural and implementation consultation. AI & Emerging Tech Expertise • Agentic\\tAI\\t&\\tAI\\tAgents:\\tAgentic\\tAI,\\tAutonomous\\tAgents,\\tMulti-Agent\\tSystems\\t• Advanced\\tRetrieval\\t&\\tOrchestration:\\tRetrieval-Augmented\\tGeneration\\t(RAG),\\tAgentic\\tRAG,\\tModel\\tContext\\tProtocol\\t(MCP)\\t• Frameworks\\t&\\tTooling:\\tLangChain,\\tLangGraph,\\tLangSmith\\t• Prompt\\t&\\tInstruction\\tEngineering:\\tPrompt\\tEngineering,\\tGitHub\\tCopilot\\tInstruction\\tCustomization\\t• Cognitive\\tEnhancements:\\tChain-of-Thought\\tReasoning,\\tMemory-Augmented\\tAgents\\t• Data\\tLayer:\\tVector\\tDatabases\\tCore Competencies • Leadership\\t&\\tStrategy:\\tEngineering\\tLeadership,\\tAgile\\tDelivery\\tLeadership,\\tInner-source\\tGovernance,\\tTechnical\\tEvangelism,\\tInnovation\\tManagement\\t• Architectural\\tConsulting\\t&\\tImplementation:\\tEnterprise\\tArchitecture,\\tSolution\\tArchitecture,\\tModernization\\tRoadmaps,\\tScalable\\tSystem\\tDesign,\\tAPI-first\\tDesign\\t• GenAI\\tApplication\\t&\\tIntegration:\\tGenerative\\tAI\\tIntegration,\\tAI-Augmented\\tWorkflows,\\tPrompt\\tEngineering\\tStrategy,\\tRAG-based\\tSolution\\tDesign\\t• Technology\\tExpertise:\\tMobile\\t&\\tWeb\\tArchitecture\\t(iOS,\\tAndroid,\\tAngular,\\tReact),\\tMicroservices\\tArchitecture,\\tMicro-frontend\\tArchitecture,\\tCloud-native\\tSolutions,\\tCI/CD,\\tKubernetes\\t• UX\\t&\\tDesign\\tSystems:\\tDesign\\tSystem\\tIntegration,\\tComponent\\tLibraries,\\tUX\\tGovernance\\tKnowledge Sharing & Enablement • Conducted\\t12\\ttechnical\\ttraining\\tsessions\\tand\\t2\\thands-on\\tworking\\tsessions\\tunder\\tthe\\tGlobal\\tUI\\tGuild,\\tenabling\\t300+\\tdevelopers\\tto\\tadopt\\tmodern\\tUI\\tarchitecture\\tand\\treusable\\tcomponent\\tstrategies.\\t• Designed\\tand\\tdelivered\\tworking\\tsessions\\ton\\tAngular\\tmicro-frontends,\\tdesign\\tsystem\\tintegration,\\tand\\tserver-side\\trendering\\tto\\tshowcase\\tperformance\\timpact.\\t• Championed\\tdeveloper\\tenablement,\\tinner-source\\tpractices,\\tand\\ttraining\\t&\\tupskilling\\tinitiatives\\tthrough\\tworkshops\\tand\\tlive\\tcoding\\tsessions,\\tfostering\\tcross-team\\tcollaboration\\tand\\tengineering\\texcellence.\\t• Published\\ttechnical\\tnewsletters\\tand\\tpromoted\\tbest\\tpractices.\\tTechnical Skills Languages & Technologies: Python, Swift, Objective-C, Java, TypeScript, JavaScript AI Tools: OpenAI, LangChain, LangGraph, MCP, GitHub Copilot Frameworks: Angular18, ReactJS, Ionic, Cordova, Polymer DevOps: Jenkins, Docker, Kubernetes Databases: MySQL, SQLite, iOS Core Data Version Control: Git, SVN Professional Experience FIS Global, Pune IT Senior Architect | Apr 2020 – Present Operate at the intersection of technology governance, product innovation, and engineering leadership. Provide architectural guidance and implementation consultation across multiple business units, enabling modernization and AI adoption. Key Contributions: • Guided\\tteams\\ton\\tmicroservices\\tarchitecture,\\tmicro-frontend\\tarchitecture,\\tand\\tcloud-native\\tsolutions,\\treducing\\tdevelopment\\tcycle\\tby\\t30%.\\t• Led\\tcreation\\tof\\treusable\\tUI\\tcomponents\\tand\\tinternal\\tplugins,\\timproving\\tstandardization\\tacross\\tproduct\\tteams.\\t• Designed\\tAI-powered\\tticket\\tclassification\\tPOC,\\tsecured\\tfunding,\\tand\\tinfluenced\\tenterprise-wide\\trollout.\\t• Led\\tUI\\tCommunity\\tof\\tPractice\\tand\\tGlobal\\tUI\\tGuild,\\tmentoring\\t300+\\tdevelopers\\tglobally.\\tMajor Projects: • Transfer\\tAgency\\tModernization:\\tAccelerated\\tdevelopment\\tby\\timplementing\\treusable\\tUI\\tcomponents\\tand\\tmicroservices.\\t• NCBC\\t–\\tAramco\\tApp:\\tDesigned\\tand\\tdeveloped\\ta\\tmulti-tenant\\tmobile\\tapp\\tusing\\tIonic\\tand\\tAngular\\tfor\\tretirement\\tfund\\tmanagement.\\t• Idea\\tPortal\\tRevamp:\\tLed\\tUX\\tand\\tUI\\tredesign\\tusing\\tAngular\\tNx\\tworkspace\\tand\\tshared\\tcomponent\\tlibraries.\\t• AI-Powered\\tTicketing\\tSystem:\\tBuilt\\ta\\tproof-of-concept\\tfor\\tautomated\\tticket\\tclassification\\tusing\\tmachine\\tlearning.\\t• Procurement\\tWorkflow\\tSimplification:\\tIntegrated\\tmultiple\\tprocurement\\tapps\\tvia\\tmicroservices\\tand\\tembedded\\tworkflows\\tin\\tServiceNow.\\t• End-of-Term\\tApp\\tfor\\tRCL:\\tDeveloped\\ta\\tprototype\\tmobile\\tapp\\tfor\\tself-inspection\\tduring\\tlease-end.\\t• Early\\tWarning\\tSystem:\\tBuilt\\ta\\tweb-based\\tprototype\\tto\\tdetect\\tearly\\twarning\\tsigns\\tin\\tcustomer\\tportfolios\\tduring\\tCOVID.\\tGeneral Electric, Bangalore & USA Staff Software Engineer | Feb 2018 – Apr 2020 (India) | Nov 2015 – Jan 2018 (USA) Served as a technical advisor and implementation consultant for enterprise-grade apps supporting thousands of users across manufacturing and energy sectors. Key Contributions: • Provided\\tarchitectural\\tguidance\\tfor\\tPolymer-based\\tHawkeye\\tApp,\\timproving\\tfactory\\tdowntime\\tplanning.\\t• Consulted\\ton\\tiOS\\tand\\tweb\\tapp\\tdevelopment\\tfor\\treal-time\\talerting\\tsystems\\tand\\tBI\\tdashboards.\\t• Influenced\\tdesign\\tdecisions\\tfor\\tIoT-based\\tBrilliant\\tFactory\\tApp\\tand\\toptimized\\tprocurement\\tworkflows.\\tMajor Projects: • Hawkeye\\tApp:\\tResponsive\\tweb\\tapp\\tusing\\tPolymer\\t2\\tfor\\tfactory\\tdowntime\\tmonitoring.\\t• Weather\\tAlert\\tApp:\\tReal-time\\talerting\\tsystem\\tfor\\tfield\\tengineers\\t(iOS\\t+\\tWeb).\\t• BI\\tDashboard\\tBuilder\\tTool:\\tDynamic\\tdashboard\\tbuilder\\tusing\\tAngularJS,\\tPlotly,\\tand\\tHigh\\tcharts.\\t• Incident\\tNotification\\tApp:\\tiPhone\\tand\\tApple\\tWatch\\tapps\\tintegrated\\twith\\tServiceNow\\tAPIs.\\t• Performance\\tDevelopment\\tApp:\\tiOS\\tapp\\tfor\\tperformance\\ttracking\\tand\\tfeedback.\\t• Brilliant\\tFactory\\tApp:\\tFactory\\tline\\tmonitoring\\tsystem\\tfor\\treal-time\\tproduction\\tinsights.\\t• Material\\tPurchase\\tOptimization\\tApp:\\tiOS\\tapp\\twith\\tbarcode\\tscanning\\tfor\\tprocurement\\toptimization.\\tCapgemini Inc. (Consultant at GE), USA Technical Specialist | Feb 2010 – Nov 2015 Delivered 15+ enterprise-grade mobile and hybrid applications for GE, including flagship apps showcased by Apple and featured on its website. Specialized in iOS development, hybrid frameworks (AngularJS, Cordova), and IoT integrations for real-time device control. Recognized for designing scalable, secure architectures and driving digital transformation across global business units Achievements • Delivered 15+ enterprise apps and one iOS game, driving digital transformation across GE. • Dashboard App for Sales Representatives – Showcased by Tim Cook at Apple Event. • IoT Lighting Control App – Featured on Apple’s official website and demoed during GE Lighting’s 100th Anniversary. Key Projects • Dashboard App – Native iPad app with Salesforce SDK integration for real-time sales data. • Collaboration App – Large-scale iOS app for cross-GE collaboration, adopted by thousands. • IoT Lighting Control – Remote lighting control via iPad using IoT protocols. • Sourcing App – Hybrid app using AngularJS, Cordova, HTML5, CSS3 for vendor price optimization. • Sales Quotation Generator – iOS app with OpenCV for diagram scanning and quote generation. India Games, Navi Mumbai Software Developer | Jan 2008 – May 2009 Contributed to the development of mobile games during the early days of Java-based mobile gaming. Key Contributions: • Developed\\tand\\toptimized\\tmultiple\\tgames\\tfor\\tthe\\tJ2ME\\tplatform,\\ttargeting\\ta\\twide\\trange\\tof\\tfeature\\tphones.\\t• Worked\\ton\\tgame\\tlogic,\\tgraphics\\trendering,\\tand\\tperformance\\ttuning\\tfor\\tlow-memory\\tdevices.\\t• Collaborated\\twith\\tdesigners\\tand\\ttesters\\tto\\tensure\\tengaging\\tgameplay\\tand\\tsmooth\\tuser\\texperience.\\t• Gained\\tfoundational\\texperience\\tin\\tmobile\\tdevelopment,\\twhich\\tlater\\tevolved\\tinto\\tenterprise\\tapp\\tdevelopment.\\tConference & Industry Engagement • WWDC\\t(2016,\\t2017)\\t–\\tApple\\tDeveloper\\tConference\\t• Ng-India\\tConf\\t2024\\t–\\tNew\\tDelhi\\t• NASSCOM\\t2024\\t–\\tPune\\t• Tech\\tSummit\\t2024\\t–\\tAttendee\\tKey Achievements • Accelerated\\tdigital\\ttransformation\\tby\\timplementing\\tmicro-frontend\\tarchitecture,\\treducing\\trelease\\tcycles\\tby\\t25%.\\t• Secured\\tinternal\\tfunding\\tfor\\tAI-driven\\tautomation\\tin\\tticket\\tclassification.\\t• Improved\\tcomponent\\treuse\\tby\\t40%,\\tsaving\\t200+\\tdevelopment\\thours\\tper\\tsprint.\\tCertification & Training • Certified\\tScrumMaster®\\t–\\tScrum\\tAlliance®\\t• Azure\\tFundamentals\\t(AZ-900)\\t–\\tMicrosoft\\t• Delivering\\tCustomer\\tImpact\\t–\\tGE\\tCrotonville\\tLeadership\\tTraining\\tEducation • Bachelor\\tof\\tEngineering\\tin\\tComputer\\tScience\\t–\\tMumbai\\tUniversity,\\t2007\\t\\n\\nWith this context, please chat with the user, always staying in character as Pankaj Naik.'"269      ]270     },271     "execution_count": 34,272     "metadata": {},273     "output_type": "execute_result"274    }275   ],276   "source": [277    "system_prompt"278   ]279  },280  {281   "cell_type": "code",282   "execution_count": 57,283   "metadata": {},284   "outputs": [],285   "source": [286    "def chat(message, history):\n",287    "    messages = [{\"role\": \"system\", \"content\": system_prompt}] + history + [{\"role\": \"user\", \"content\": message}]\n",288    "    response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n",289    "    return response.choices[0].message.content"290   ]291  },292  {293   "cell_type": "markdown",294   "metadata": {},295   "source": [296    "## Special note for people not using OpenAI\n",297    "\n",298    "Some providers, like Groq, might give an error when you send your second message in the chat.\n",299    "\n",300    "This is because Gradio shoves some extra fields into the history object. OpenAI doesn't mind; but some other models complain.\n",301    "\n",302    "If this happens, the solution is to add this first line to the chat() function above. It cleans up the history variable:\n",303    "\n",304    "```python\n",305    "history = [{\"role\": h[\"role\"], \"content\": h[\"content\"]} for h in history]\n",306    "```\n",307    "\n",308    "You may need to add this in other chat() callback functions in the future, too."309   ]310  },311  {312   "cell_type": "code",313   "execution_count": 58,314   "metadata": {},315   "outputs": [316    {317     "name": "stdout",318     "output_type": "stream",319     "text": [320      "* Running on local URL:  http://127.0.0.1:7862\n",321      "* To create a public link, set `share=True` in `launch()`.\n"322     ]323    },324    {325     "data": {326      "text/html": [327       "<div><iframe src=\"http://127.0.0.1:7862/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"328      ],329      "text/plain": [330       "<IPython.core.display.HTML object>"331      ]332     },333     "metadata": {},334     "output_type": "display_data"335    },336    {337     "data": {338      "text/plain": []339     },340     "execution_count": 58,341     "metadata": {},342     "output_type": "execute_result"343    }344   ],345   "source": [346    "gr.ChatInterface(chat, type=\"messages\").launch()"347   ]348  },349  {350   "cell_type": "markdown",351   "metadata": {},352   "source": [353    "## A lot is about to happen...\n",354    "\n",355    "1. Be able to ask an LLM to evaluate an answer\n",356    "2. Be able to rerun if the answer fails evaluation\n",357    "3. Put this together into 1 workflow\n",358    "\n",359    "All without any Agentic framework!"360   ]361  },362  {363   "cell_type": "code",364   "execution_count": 59,365   "metadata": {},366   "outputs": [],367   "source": [368    "# Create a Pydantic model for the Evaluation\n",369    "\n",370    "from pydantic import BaseModel\n",371    "\n",372    "class Evaluation(BaseModel):\n",373    "    is_acceptable: bool\n",374    "    feedback: str\n"375   ]376  },377  {378   "cell_type": "code",379   "execution_count": 60,380   "metadata": {},381   "outputs": [],382   "source": [383    "evaluator_system_prompt = f\"You are an evaluator that decides whether a response to a question is acceptable. \\\n",384    "You are provided with a conversation between a User and an Agent. Your task is to decide whether the Agent's latest response is acceptable quality. \\\n",385    "The Agent is playing the role of {name} and is representing {name} on their website. \\\n",386    "The Agent has been instructed to be professional and engaging, as if talking to a potential client or future employer who came across the website. \\\n",387    "The Agent has been provided with context on {name} in the form of their summary and LinkedIn details. Here's the information:\"\n",388    "\n",389    "evaluator_system_prompt += f\"\\n\\n## Summary:\\n{summary}\\n\\n## LinkedIn Profile:\\n{linkedin}\\n\\n\"\n",390    "evaluator_system_prompt += f\"With this context, please evaluate the latest response, replying with whether the response is acceptable and your feedback.\""391   ]392  },393  {394   "cell_type": "code",395   "execution_count": 61,396   "metadata": {},397   "outputs": [],398   "source": [399    "def evaluator_user_prompt(reply, message, history):\n",400    "    user_prompt = f\"Here's the conversation between the User and the Agent: \\n\\n{history}\\n\\n\"\n",401    "    user_prompt += f\"Here's the latest message from the User: \\n\\n{message}\\n\\n\"\n",402    "    user_prompt += f\"Here's the latest response from the Agent: \\n\\n{reply}\\n\\n\"\n",403    "    user_prompt += \"Please evaluate the response, replying with whether it is acceptable and your feedback.\"\n",404    "    return user_prompt"405   ]406  },407  {408   "cell_type": "code",409   "execution_count": 62,410   "metadata": {},411   "outputs": [],412   "source": [413    "import os\n",414    "gemini = OpenAI(\n",415    "    api_key=os.getenv(\"GOOGLE_API_KEY\"), \n",416    "    base_url=\"https://generativelanguage.googleapis.com/v1beta/openai/\"\n",417    ")"418   ]419  },420  {421   "cell_type": "code",422   "execution_count": 63,423   "metadata": {},424   "outputs": [],425   "source": [426    "def evaluate(reply, message, history) -> Evaluation:\n",427    "\n",428    "    messages = [{\"role\": \"system\", \"content\": evaluator_system_prompt}] + [{\"role\": \"user\", \"content\": evaluator_user_prompt(reply, message, history)}]\n",429    "    response = gemini.beta.chat.completions.parse(model=\"gemini-2.0-flash\", messages=messages, response_format=Evaluation)\n",430    "    return response.choices[0].message.parsed"431   ]432  },433  {434   "cell_type": "code",435   "execution_count": 64,436   "metadata": {},437   "outputs": [],438   "source": [439    "messages = [{\"role\": \"system\", \"content\": system_prompt}] + [{\"role\": \"user\", \"content\": \"do you hold a patent?\"}]\n",440    "response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n",441    "reply = response.choices[0].message.content"442   ]443  },444  {445   "cell_type": "code",446   "execution_count": 65,447   "metadata": {},448   "outputs": [449    {450     "data": {451      "text/plain": [452       "'No, I do not currently hold any patents. However, my focus has been on driving digital transformation and implementing innovative solutions in my career. If you have any specific questions about my work or contributions, feel free to ask!'"453      ]454     },455     "execution_count": 65,456     "metadata": {},457     "output_type": "execute_result"458    }459   ],460   "source": [461    "reply"462   ]463  },464  {465   "cell_type": "code",466   "execution_count": 67,467   "metadata": {},468   "outputs": [469    {470     "ename": "RateLimitError",471     "evalue": "Error code: 429 - [{'error': {'code': 429, 'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, head to: https://ai.google.dev/gemini-api/docs/rate-limits. To monitor your current usage, head to: https://ai.dev/rate-limit. \\n* Quota exceeded for metric: generativelanguage.googleapis.com/generate_content_free_tier_input_token_count, limit: 0, model: gemini-2.0-flash\\n* Quota exceeded for metric: generativelanguage.googleapis.com/generate_content_free_tier_requests, limit: 0, model: gemini-2.0-flash\\n* Quota exceeded for metric: generativelanguage.googleapis.com/generate_content_free_tier_requests, limit: 0, model: gemini-2.0-flash\\nPlease retry in 20.595605891s.', 'status': 'RESOURCE_EXHAUSTED', 'details': [{'@type': 'type.googleapis.com/google.rpc.Help', 'links': [{'description': 'Learn more about Gemini API quotas', 'url': 'https://ai.google.dev/gemini-api/docs/rate-limits'}]}, {'@type': 'type.googleapis.com/google.rpc.QuotaFailure', 'violations': [{'quotaMetric': 'generativelanguage.googleapis.com/generate_content_free_tier_input_token_count', 'quotaId': 'GenerateContentInputTokensPerModelPerMinute-FreeTier', 'quotaDimensions': {'location': 'global', 'model': 'gemini-2.0-flash'}}, {'quotaMetric': 'generativelanguage.googleapis.com/generate_content_free_tier_requests', 'quotaId': 'GenerateRequestsPerMinutePerProjectPerModel-FreeTier', 'quotaDimensions': {'location': 'global', 'model': 'gemini-2.0-flash'}}, {'quotaMetric': 'generativelanguage.googleapis.com/generate_content_free_tier_requests', 'quotaId': 'GenerateRequestsPerDayPerProjectPerModel-FreeTier', 'quotaDimensions': {'location': 'global', 'model': 'gemini-2.0-flash'}}]}, {'@type': 'type.googleapis.com/google.rpc.RetryInfo', 'retryDelay': '20s'}]}}]",472     "output_type": "error",473     "traceback": [474      "\u001b[31m---------------------------------------------------------------------------\u001b[39m",475      "\u001b[31mRateLimitError\u001b[39m                            Traceback (most recent call last)",476      "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[67]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[43mevaluate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mreply\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mdo you hold a patent?\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m[\u001b[49m\u001b[43m:\u001b[49m\u001b[32;43m1\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n",477      "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[63]\u001b[39m\u001b[32m, line 4\u001b[39m, in \u001b[36mevaluate\u001b[39m\u001b[34m(reply, message, history)\u001b[39m\n\u001b[32m      1\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mevaluate\u001b[39m(reply, message, history) -> Evaluation:\n\u001b[32m      3\u001b[39m     messages = [{\u001b[33m\"\u001b[39m\u001b[33mrole\u001b[39m\u001b[33m\"\u001b[39m: \u001b[33m\"\u001b[39m\u001b[33msystem\u001b[39m\u001b[33m\"\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33mcontent\u001b[39m\u001b[33m\"\u001b[39m: evaluator_system_prompt}] + [{\u001b[33m\"\u001b[39m\u001b[33mrole\u001b[39m\u001b[33m\"\u001b[39m: \u001b[33m\"\u001b[39m\u001b[33muser\u001b[39m\u001b[33m\"\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33mcontent\u001b[39m\u001b[33m\"\u001b[39m: evaluator_user_prompt(reply, message, history)}]\n\u001b[32m----> \u001b[39m\u001b[32m4\u001b[39m     response = \u001b[43mgemini\u001b[49m\u001b[43m.\u001b[49m\u001b[43mbeta\u001b[49m\u001b[43m.\u001b[49m\u001b[43mchat\u001b[49m\u001b[43m.\u001b[49m\u001b[43mcompletions\u001b[49m\u001b[43m.\u001b[49m\u001b[43mparse\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m=\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mgemini-2.0-flash\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mresponse_format\u001b[49m\u001b[43m=\u001b[49m\u001b[43mEvaluation\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m      5\u001b[39m     \u001b[38;5;28;01mreturn\u001b[39;00m response.choices[\u001b[32m0\u001b[39m].message.parsed\n",478      "\u001b[36mFile \u001b[39m\u001b[32m~/Documents/Projects/Udemy_Ai/Ai_Engineer_Agentic/repo/agents/.venv/lib/python3.12/site-packages/openai/resources/chat/completions/completions.py:183\u001b[39m, in \u001b[36mCompletions.parse\u001b[39m\u001b[34m(self, messages, model, audio, response_format, frequency_penalty, function_call, functions, logit_bias, logprobs, max_completion_tokens, max_tokens, metadata, modalities, n, parallel_tool_calls, prediction, presence_penalty, prompt_cache_key, reasoning_effort, safety_identifier, seed, service_tier, stop, store, stream_options, temperature, tool_choice, tools, top_logprobs, top_p, user, verbosity, web_search_options, extra_headers, extra_query, extra_body, timeout)\u001b[39m\n\u001b[32m    176\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mparser\u001b[39m(raw_completion: ChatCompletion) -> ParsedChatCompletion[ResponseFormatT]:\n\u001b[32m    177\u001b[39m     \u001b[38;5;28;01mreturn\u001b[39;00m _parse_chat_completion(\n\u001b[32m    178\u001b[39m         response_format=response_format,\n\u001b[32m    179\u001b[39m         chat_completion=raw_completion,\n\u001b[32m    180\u001b[39m         input_tools=chat_completion_tools,\n\u001b[32m    181\u001b[39m     )\n\u001b[32m--> \u001b[39m\u001b[32m183\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_post\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m    184\u001b[39m \u001b[43m    \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43m/chat/completions\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m    185\u001b[39m \u001b[43m    \u001b[49m\u001b[43mbody\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmaybe_transform\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m    186\u001b[39m \u001b[43m        \u001b[49m\u001b[43m{\u001b[49m\n\u001b[32m    187\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmessages\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    188\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmodel\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    189\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43maudio\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43maudio\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    190\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mfrequency_penalty\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mfrequency_penalty\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    191\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mfunction_call\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mfunction_call\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    192\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mfunctions\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mfunctions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    193\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mlogit_bias\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mlogit_bias\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    194\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mlogprobs\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mlogprobs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    195\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmax_completion_tokens\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_completion_tokens\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    196\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmax_tokens\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_tokens\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    197\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmetadata\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmetadata\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    198\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmodalities\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmodalities\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    199\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mn\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    200\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mparallel_tool_calls\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mparallel_tool_calls\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    201\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mprediction\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mprediction\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    202\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mpresence_penalty\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mpresence_penalty\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    203\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mprompt_cache_key\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mprompt_cache_key\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    204\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mreasoning_effort\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mreasoning_effort\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    205\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mresponse_format\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43m_type_to_response_format\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresponse_format\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    206\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43msafety_identifier\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43msafety_identifier\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    207\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mseed\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mseed\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    208\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mservice_tier\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mservice_tier\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    209\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstop\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    210\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstore\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mstore\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    211\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstream\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m    212\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstream_options\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    213\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtemperature\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtemperature\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    214\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtool_choice\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtool_choice\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    215\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtools\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtools\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    216\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtop_logprobs\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtop_logprobs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    217\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtop_p\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtop_p\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    218\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43muser\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43muser\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    219\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mverbosity\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mverbosity\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    220\u001b[39m \u001b[43m            \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mweb_search_options\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mweb_search_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    221\u001b[39m \u001b[43m        \u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    222\u001b[39m \u001b[43m        \u001b[49m\u001b[43mcompletion_create_params\u001b[49m\u001b[43m.\u001b[49m\u001b[43mCompletionCreateParams\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    223\u001b[39m \u001b[43m    \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    224\u001b[39m \u001b[43m    \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmake_request_options\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m    225\u001b[39m \u001b[43m        \u001b[49m\u001b[43mextra_headers\u001b[49m\u001b[43m=\u001b[49m\u001b[43mextra_headers\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    226\u001b[39m \u001b[43m        \u001b[49m\u001b[43mextra_query\u001b[49m\u001b[43m=\u001b[49m\u001b[43mextra_query\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    227\u001b[39m \u001b[43m        \u001b[49m\u001b[43mextra_body\u001b[49m\u001b[43m=\u001b[49m\u001b[43mextra_body\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    228\u001b[39m \u001b[43m        \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    229\u001b[39m \u001b[43m        \u001b[49m\u001b[43mpost_parser\u001b[49m\u001b[43m=\u001b[49m\u001b[43mparser\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    230\u001b[39m \u001b[43m    \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    231\u001b[39m \u001b[43m    \u001b[49m\u001b[38;5;66;43;03m# we turn the `ChatCompletion` instance into a `ParsedChatCompletion`\u001b[39;49;00m\n\u001b[32m    232\u001b[39m \u001b[43m    \u001b[49m\u001b[38;5;66;43;03m# in the `parser` function above\u001b[39;49;00m\n\u001b[32m    233\u001b[39m \u001b[43m    \u001b[49m\u001b[43mcast_to\u001b[49m\u001b[43m=\u001b[49m\u001b[43mcast\u001b[49m\u001b[43m(\u001b[49m\u001b[43mType\u001b[49m\u001b[43m[\u001b[49m\u001b[43mParsedChatCompletion\u001b[49m\u001b[43m[\u001b[49m\u001b[43mResponseFormatT\u001b[49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mChatCompletion\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    234\u001b[39m \u001b[43m    \u001b[49m\u001b[43mstream\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m    235\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",479      "\u001b[36mFile \u001b[39m\u001b[32m~/Documents/Projects/Udemy_Ai/Ai_Engineer_Agentic/repo/agents/.venv/lib/python3.12/site-packages/openai/_base_client.py:1259\u001b[39m, in \u001b[36mSyncAPIClient.post\u001b[39m\u001b[34m(self, path, cast_to, body, options, files, stream, stream_cls)\u001b[39m\n\u001b[32m   1245\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mpost\u001b[39m(\n\u001b[32m   1246\u001b[39m     \u001b[38;5;28mself\u001b[39m,\n\u001b[32m   1247\u001b[39m     path: \u001b[38;5;28mstr\u001b[39m,\n\u001b[32m   (...)\u001b[39m\u001b[32m   1254\u001b[39m     stream_cls: \u001b[38;5;28mtype\u001b[39m[_StreamT] | \u001b[38;5;28;01mNone\u001b[39;00m = \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[32m   1255\u001b[39m ) -> ResponseT | _StreamT:\n\u001b[32m   1256\u001b[39m     opts = FinalRequestOptions.construct(\n\u001b[32m   1257\u001b[39m         method=\u001b[33m\"\u001b[39m\u001b[33mpost\u001b[39m\u001b[33m\"\u001b[39m, url=path, json_data=body, files=to_httpx_files(files), **options\n\u001b[32m   1258\u001b[39m     )\n\u001b[32m-> \u001b[39m\u001b[32m1259\u001b[39m     \u001b[38;5;28;01mreturn\u001b[39;00m cast(ResponseT, \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcast_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mopts\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[43m=\u001b[49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[43m=\u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[43m)\u001b[49m)\n",480      "\u001b[36mFile \u001b[39m\u001b[32m~/Documents/Projects/Udemy_Ai/Ai_Engineer_Agentic/repo/agents/.venv/lib/python3.12/site-packages/openai/_base_client.py:1047\u001b[39m, in \u001b[36mSyncAPIClient.request\u001b[39m\u001b[34m(self, cast_to, options, stream, stream_cls)\u001b[39m\n\u001b[32m   1044\u001b[39m             err.response.read()\n\u001b[32m   1046\u001b[39m         log.debug(\u001b[33m\"\u001b[39m\u001b[33mRe-raising status error\u001b[39m\u001b[33m\"\u001b[39m)\n\u001b[32m-> \u001b[39m\u001b[32m1047\u001b[39m         \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;28mself\u001b[39m._make_status_error_from_response(err.response) \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m   1049\u001b[39m     \u001b[38;5;28;01mbreak\u001b[39;00m\n\u001b[32m   1051\u001b[39m \u001b[38;5;28;01massert\u001b[39;00m response \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[33m\"\u001b[39m\u001b[33mcould not resolve response (should never happen)\u001b[39m\u001b[33m\"\u001b[39m\n",481      "\u001b[31mRateLimitError\u001b[39m: Error code: 429 - [{'error': {'code': 429, 'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, head to: https://ai.google.dev/gemini-api/docs/rate-limits. To monitor your current usage, head to: https://ai.dev/rate-limit. \\n* Quota exceeded for metric: generativelanguage.googleapis.com/generate_content_free_tier_input_token_count, limit: 0, model: gemini-2.0-flash\\n* Quota exceeded for metric: generativelanguage.googleapis.com/generate_content_free_tier_requests, limit: 0, model: gemini-2.0-flash\\n* Quota exceeded for metric: generativelanguage.googleapis.com/generate_content_free_tier_requests, limit: 0, model: gemini-2.0-flash\\nPlease retry in 20.595605891s.', 'status': 'RESOURCE_EXHAUSTED', 'details': [{'@type': 'type.googleapis.com/google.rpc.Help', 'links': [{'description': 'Learn more about Gemini API quotas', 'url': 'https://ai.google.dev/gemini-api/docs/rate-limits'}]}, {'@type': 'type.googleapis.com/google.rpc.QuotaFailure', 'violations': [{'quotaMetric': 'generativelanguage.googleapis.com/generate_content_free_tier_input_token_count', 'quotaId': 'GenerateContentInputTokensPerModelPerMinute-FreeTier', 'quotaDimensions': {'location': 'global', 'model': 'gemini-2.0-flash'}}, {'quotaMetric': 'generativelanguage.googleapis.com/generate_content_free_tier_requests', 'quotaId': 'GenerateRequestsPerMinutePerProjectPerModel-FreeTier', 'quotaDimensions': {'location': 'global', 'model': 'gemini-2.0-flash'}}, {'quotaMetric': 'generativelanguage.googleapis.com/generate_content_free_tier_requests', 'quotaId': 'GenerateRequestsPerDayPerProjectPerModel-FreeTier', 'quotaDimensions': {'location': 'global', 'model': 'gemini-2.0-flash'}}]}, {'@type': 'type.googleapis.com/google.rpc.RetryInfo', 'retryDelay': '20s'}]}}]"482     ]483    }484   ],485   "source": [486    "evaluate(reply, \"do you hold a patent?\", messages[:1])"487   ]488  },489  {490   "cell_type": "code",491   "execution_count": 68,492   "metadata": {},493   "outputs": [],494   "source": [495    "def rerun(reply, message, history, feedback):\n",496    "    updated_system_prompt = system_prompt + \"\\n\\n## Previous answer rejected\\nYou just tried to reply, but the quality control rejected your reply\\n\"\n",497    "    updated_system_prompt += f\"## Your attempted answer:\\n{reply}\\n\\n\"\n",498    "    updated_system_prompt += f\"## Reason for rejection:\\n{feedback}\\n\\n\"\n",499    "    messages = [{\"role\": \"system\", \"content\": updated_system_prompt}] + history + [{\"role\": \"user\", \"content\": message}]\n",500    "    response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n",501    "    return response.choices[0].message.content"502   ]503  },504  {505   "cell_type": "code",506   "execution_count": 69,507   "metadata": {},508   "outputs": [],509   "source": [510    "def chat(message, history):\n",511    "    if \"patent\" in message:\n",512    "        system = system_prompt + \"\\n\\nEverything in your reply needs to be in pig latin - \\\n",513    "              it is mandatory that you respond only and entirely in pig latin\"\n",514    "    else:\n",515    "        system = system_prompt\n",516    "    messages = [{\"role\": \"system\", \"content\": system}] + history + [{\"role\": \"user\", \"content\": message}]\n",517    "    response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n",518    "    reply =response.choices[0].message.content\n",519    "\n",520    "    evaluation = evaluate(reply, message, history)\n",521    "    \n",522    "    if evaluation.is_acceptable:\n",523    "        print(\"Passed evaluation - returning reply\")\n",524    "    else:\n",525    "        print(\"Failed evaluation - retrying\")\n",526    "        print(evaluation.feedback)\n",527    "        reply = rerun(reply, message, history, evaluation.feedback)       \n",528    "    return reply"529   ]530  },531  {532   "cell_type": "code",533   "execution_count": null,534   "metadata": {},535   "outputs": [],536   "source": [537    "gr.ChatInterface(chat, type=\"messages\").launch()"538   ]539  },540  {541   "cell_type": "markdown",542   "metadata": {},543   "source": []544  },545  {546   "cell_type": "code",547   "execution_count": null,548   "metadata": {},549   "outputs": [],550   "source": []551  }552 ],553 "metadata": {554  "kernelspec": {555   "display_name": "agents",556   "language": "python",557   "name": "python3"558  },559  "language_info": {560   "codemirror_mode": {561    "name": "ipython",562    "version": 3563   },564   "file_extension": ".py",565   "mimetype": "text/x-python",566   "name": "python",567   "nbconvert_exporter": "python",568   "pygments_lexer": "ipython3",569   "version": "3.12.12"570  }571 },572 "nbformat": 4,573 "nbformat_minor": 2574}575