{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Welcome to Lab 3 for Week 1 Day 4\n", "\n", "Today we're going to build something with immediate value!\n", "\n", "In the folder `me` I've put a single file `linkedin.pdf` - it's a PDF download of my LinkedIn profile.\n", "\n", "Please replace it with yours!\n", "\n", "I've also made a file called `summary.txt`\n", "\n", "We're not going to use Tools just yet - we're going to add the tool tomorrow." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

Looking up packages

\n", " In this lab, we're going to use the wonderful Gradio package for building quick UIs, \n", " and we're also going to use the popular PyPDF PDF reader. You can get guides to these packages by asking \n", " ChatGPT or Claude, and you find all open-source packages on the repository https://pypi.org.\n", " \n", "
" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# If you don't know what any of these packages do - you can always ask ChatGPT for a guide!\n", "\n", "from dotenv import load_dotenv\n", "from openai import OpenAI\n", "from pypdf import PdfReader\n", "import gradio as gr" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "load_dotenv(override=True)\n", "openai = OpenAI()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "reader = PdfReader(\"me/linkedin.pdf\")\n", "linkedin = \"\"\n", "for page in reader.pages:\n", " text = page.extract_text()\n", " if text:\n", " linkedin += text" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Marcel Mejulu marcelmejulu@gmail.com LinkedIn : linkedin.com/in/mmejulu | GitHub : https://github.com/marcmeju/ Summary Software Engineer with 4+ years of experience. Passionate about developing and deploying sustainable software solutions to everyday problems. Adept at \n", "collaborating\n", " \n", "in\n", " \n", "cross-functional\n", " \n", "agile\n", " \n", "teams\n", " \n", "to\n", " \n", "build\n", " \n", "scalable,\n", " \n", "resilient,\n", " \n", "and\n", " \n", "self-healing\n", " \n", "solutions. \n", "Skills | Tech \n", "Frontend | Backend | DevOps: HTML, CSS, JavaScript, React (3 years), AngularJS, TypeScript (3 years), NodeJS (4+ years), Bootstrap, Java (4+ years), \n", "Spring\n", " \n", "Framework,\n", " \n", "RDBMS\n", " \n", "(MySQL,\n", " \n", "SSMS,\n", " \n", "etc.),\n", " \n", "REST\n", " \n", "APIs/Microservices,\n", " \n", "Git/GitHub,\n", " \n", ".NET6\n", " \n", "(C#),\n", " \n", "Postman.\n", " Cloud | Infrastructure: AWS (3 years), Azure, Cloud Foundry, CaaS, Kubernetes, Docker. Scripting: Python, PowerShell, CMD, Bash/Shell/Linux, ServiceNow Scripting. Platforms | Monitoring/Observability: ServiceNow, Jira, BigPanda, NewRelic, Dynatrace (Synthetics, APM, Infrastructure), Veracode. Work Experience Intel Corporation Enterprise Application Development Engineer | Software Developer | Integrations Engineer – Remote Oct 2022 – Current Product: Observability as a Service ● Developed, integrated, and currently maintaining an end-to-end Observability as a Service product which provides real-time fullstack monitoring, logging, \n", "log\n", " \n", "tracing,\n", " \n", "anomaly\n", " \n", "detection,\n", " \n", "problem\n", " \n", "notification\n", " \n", "and\n", " \n", "remediation\n", " \n", "services\n", " \n", "for\n", " \n", "large-scale\n", " \n", "distributed\n", " \n", "systems.\n", " \n", " Tech stack: Dynatrace, SCOM, NewRelic, ServiceNow, BigPanda, GOLang, Python, C#. ● Deployed comprehensive RBAC/IAM security solution for enterprise applications to assess sign-risk in real-time, handle user identity management, user \n", "authentication\n", " \n", "and\n", " \n", "authorization\n", " \n", "while\n", " \n", "automating\n", " \n", "user\n", " \n", "provisioning\n", " \n", "tasks\n", " \n", "which\n", " \n", "reduced\n", " \n", "access-management\n", " \n", "service\n", " \n", "requests\n", " \n", "tickets\n", " \n", "and\n", " \n", "incidents\n", " \n", "by\n", " \n", "95%,\n", " \n", "saving\n", " \n", "precious\n", " \n", "IT\n", " \n", "time.\n", " \n", " Tech stack: Microsoft Entra ID, Azure SSO with SCIM, Access Governance System. Keywords: Role-based access, Identity Access Management ● Decreased monitoring costs yet maximized real user experience by optimizing monitoring/observability strategies which increased and maintained \n", "availability\n", " \n", "metrics\n", " \n", "at\n", " \n", "99.98%\n", " \n", "for\n", " \n", "organization-wide\n", " \n", "tier\n", " \n", "1\n", " \n", "and\n", " \n", "tier\n", " \n", "2\n", " \n", "applications.\n", " ● Deployed a noise cancellation feature that led to elimination of false positive problem notifications across the product by integrating and configuring a \n", "robust\n", " \n", "event\n", " \n", "management\n", " \n", "SaaS\n", " \n", "solution\n", " \n", "which\n", " \n", "allows\n", " \n", "standard\n", " \n", "event\n", " \n", "tagging,\n", " \n", "event\n", " \n", "correlation,\n", " \n", "alert\n", " \n", "deduplication\n", " \n", "and\n", " \n", "alert\n", " \n", "enrichment\n", " \n", "and\n", " \n", "implemented\n", " \n", "incident\n", " \n", "notification\n", " \n", "policies\n", " \n", "on\n", " \n", "critical\n", " \n", "alerts\n", " \n", "that\n", " \n", "led\n", " \n", "to\n", " \n", "improved\n", " \n", "incident\n", " \n", "response\n", " \n", "time\n", " \n", "and\n", " \n", "reduced\n", " \n", "major\n", " \n", "incidents\n", " \n", "which\n", " \n", "maximized\n", " \n", "real\n", " \n", "users’\n", " \n", "experiences\n", " \n", "and\n", " \n", "increased\n", " \n", "Service\n", " \n", "Level\n", " \n", "Objective-based\n", " \n", "performance\n", " \n", "metrics,\n", " \n", "SLA\n", " \n", "and\n", " \n", "CSAT,\n", " \n", "to\n", " \n", "an\n", " \n", "average\n", " \n", "of\n", " \n", "90%\n", " \n", "and\n", " \n", "95%\n", " \n", "respectively.\n", " Genesis10 Software Developer Consultant – Remote Feb 2022 – Sept 2022 Working as a developer in the Insurance and Investment solutions Industry. ● Developed new web applications (with comprehensive unit/integration tests) using Visual Studio (C#) and SSMS (SQL) to extract, transform and load \n", "data\n", " \n", "into\n", " \n", "on-prem/cloud\n", " \n", "databases\n", " \n", "using\n", " \n", "stored\n", " \n", "procedures\n", " \n", "and\n", " \n", "created\n", " \n", "microservices\n", " \n", "(API\n", " \n", "functionality)\n", " \n", "for\n", " \n", "API\n", " \n", "calls.\n", " \n", " ● Built a full stack web application that receives source data in JSON format, validates and transforms source data fields into target data fields format then \n", "commits\n", " \n", "the\n", " \n", "data\n", " \n", "in\n", " \n", "the\n", " \n", "database.\n", " \n", "(Frontend:\n", " \n", "AngularJS/typescript\n", " \n", "and\n", " \n", "Bootstrap.\n", " \n", "Backend:\n", " \n", "C#\n", " \n", "and\n", " \n", "SQL/SSMS.)\n", " \n", " ● Created new features for web applications using C# and AngularJS, and committing changes into production using Azure DevOps to improve \n", "aesthetics/performance\n", " \n", "of\n", " \n", "the\n", " \n", "web\n", " \n", "application\n", " \n", "while\n", " \n", "utilizing\n", " \n", "Agile\n", " \n", "methodologies.\n", " \n", " ● Scanned software for bugs/vulnerabilities, analyzing vulnerability risk and remediating with correlated patches. Full-Stack Software Developer Trainee – Remote Sept 2021 – Jan 2022 ● Completed a 15-week Full Stack web development bootcamp focused on Java and cloud technologies. ● Developed multiple Command Line projects and games using Java (SpringBoot, Mockito, JDBC) and SQL, hosting applications using cloud \n", "technologies\n", " \n", "(Docker\n", " \n", "for\n", " \n", "containerization,\n", " \n", "AWS\n", " \n", "for\n", " \n", "Deployment).\n", " ● Built a travel web application/microservice that allows users to purchase vacation packages when visiting different cities; utilizing React for front end \n", "development,\n", " \n", "java\n", " \n", "for\n", " \n", "backend\n", " \n", "development,\n", " \n", "and\n", " \n", "MySQL\n", " \n", "for\n", " \n", "storing\n", " \n", "encrypted\n", " \n", "user\n", " \n", "information.\n", " ● Completed multilevel data structures and algorithms challenges; gaining skills in efficiently sorting, storing, and manipulating data. \n", " Udemy Web Development Bootcamp Feb 2021 – Aug 2021 Software Development Training - Udemy ● Completed three (3) comprehensive web development courses (hands-on projects inclusive) on Udemy to gain mastery of the frontend development \n", "concepts\n", " \n", "(e.g.,\n", " \n", "syntaxes\n", " \n", "of\n", " \n", "HTML,\n", " \n", "CSS,\n", " \n", "and\n", " \n", "JavaScript).\n", " ● Developed multiple responsive web pages utilizing HTML and CSS (FlexBox); learned to integrate Frameworks (e.g., Bootstrap etc.) to create \n", "dynamic\n", " \n", "web\n", " \n", "pages\n", " \n", "(UI)\n", " \n", "and\n", " \n", "optimized\n", " \n", "dynamic\n", " \n", "behavior\n", " \n", "of\n", " \n", "web\n", " \n", "pages\n", " \n", "using\n", " \n", "JavaScript\n", " \n", "to\n", " \n", "incorporate\n", " \n", "events\n", " \n", "on\n", " \n", "webpages\n", " \n", "to\n", " \n", "improve\n", " \n", "user\n", " \n", "experience\n", " \n", "(UX).\n", " \n", " Purdue University Northwest March 2020 – June 2021 Technical Lab Supervisor, Mechanical & Civil Engineering – Hammond, Indiana ● Leading the new state-of-the-art design studio project; purchasing, installing machinery, and redesigning studio space to integrate collaborative \n", "design\n", " \n", "sections\n", " \n", "and\n", " \n", "fabrication\n", " \n", "processes\n", " \n", "geared\n", " \n", "towards\n", " \n", "producing\n", " \n", "a\n", " \n", "harmonious\n", " \n", "workflow.\n", " ● Facilitated the laboratories’ seamless transition to virtual learning during Covid-19 by implementing Standard Operating Procedures and delegating a \n", "team\n", " \n", "of\n", " \n", "8\n", " \n", "graduate\n", " \n", "teaching\n", " \n", "assistants\n", " \n", "using\n", " \n", "various\n", " \n", "training\n", " \n", "and\n", " \n", "evaluation\n", " \n", "procedures.\n", " ● Managing equipment bid reviews and evaluation process while keeping purchases within budget constraints. ● Recruited potential lab supervisors and assistants to enhance productivity by coordinating engaging sessions introducing the department and assisting \n", "with\n", " \n", "the\n", " \n", "hiring\n", " \n", "process.\n", " ● Managing and ensuring completion of student and faculty design, fabrication, testing, and analysis projects such as Component fabrication, Heat \n", "treatment\n", " \n", "of\n", " \n", "materials,\n", " \n", "Microstructural\n", " \n", "Analysis\n", " \n", "of\n", " \n", "materials,\n", " \n", "Tensile/Compression\n", " \n", "testing,\n", " \n", "Fatigue\n", " \n", "testing,\n", " \n", "Creep\n", " \n", "testing,\n", " \n", "Impact\n", " \n", "testing\n", " \n", "while\n", " \n", "utilizing\n", " \n", "but\n", " \n", "not\n", " \n", "limited\n", " \n", "to:\n", " • CNC/Lathe machines, Water-jet cutter, Scanning Electron Microscope, MTS Criterion Model 42/ Universal Testing Machine, Fatigue/Torsion \n", "testing\n", " \n", "machine,\n", " \n", "compression\n", " \n", "testing\n", " \n", "machine,\n", " \n", "and\n", " \n", "Rockwell/Brinell\n", " \n", "Hardness\n", " \n", "tester.\n", " \n", "Purdue University Northwest May 2018 – December 2019 Associate Technical Lab Supervisor – Hammond, Indiana ● Installed, calibrated, and maintained mechanical engineering laboratory equipment. ● Resolved technical problems and ensured remedial actions are taken whenever equipment deviate from the laboratory's established performance \n", "specifications.\n", " ● Coordinated engaging lab sessions following Standard Operating Procedures (SOPs) to introduce equipment to faculty and new lab instructors while \n", "assisting\n", " \n", "faculty/students\n", " \n", "to\n", " \n", "ensure\n", " \n", "completion\n", " \n", "of\n", " \n", "senior\n", " \n", "design,\n", " \n", "testing,\n", " \n", "and\n", " \n", "fabrication\n", " \n", "projects.\n", " \n", "Education Purdue University, Indiana. MS Mechanical Engineering \n", " December 2019 \n", "Obafemi Awolowo University, Nigeria BS Materials Science and Engineering \n", "Certifications: ● ServiceNow Certified Application Developer ● Dev10 Full Stack Java/Cloud Developer. \n", " May 2015 \n", " \n" ] } ], "source": [ "print(linkedin)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "with open(\"me/summary.txt\", \"r\", encoding=\"utf-8\") as f:\n", " summary = f.read()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "name = \"Marcel\"" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "system_prompt = f\"You are acting as {name}. You are answering questions on {name}'s website, \\\n", "particularly questions related to {name}'s career, background, skills and experience. \\\n", "Your responsibility is to represent {name} for interactions on the website as faithfully as possible. \\\n", "You are given a summary of {name}'s background and LinkedIn profile which you can use to answer questions. \\\n", "Be professional and engaging, as if talking to a potential client or future employer who came across the website. \\\n", "If you don't know the answer, say so.\"\n", "\n", "system_prompt += f\"\\n\\n## Summary:\\n{summary}\\n\\n## LinkedIn Profile:\\n{linkedin}\\n\\n\"\n", "system_prompt += f\"With this context, please chat with the user, always staying in character as {name}.\"\n" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"You are acting as Marcel. You are answering questions on Marcel's website, particularly questions related to Marcel's career, background, skills and experience. Your responsibility is to represent Marcel for interactions on the website as faithfully as possible. You are given a summary of Marcel'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 Marcel Mejulu. I'm a software engineer and an aspiring AI/ML Engineer. I'm originally from Lagos, NIgeria, but I now reside in California, USA.\\nI love all foods, particularly well seasoned meat. I eat and enjoy all sea foods but strangely I'm repelled by shrimp. I'm not allergic, I just don't like it, and I don't seem to know why! I love everything spicy, suya/kilishi (grilled spicy beef) is one of my favorite things. I equally love ice cream too just as much as I enjoy travelling and purposeful work!\\n\\n## LinkedIn Profile:\\nMarcel Mejulu marcelmejulu@gmail.com LinkedIn : linkedin.com/in/mmejulu | GitHub : https://github.com/marcmeju/ Summary Software Engineer with 4+ years of experience. Passionate about developing and deploying sustainable software solutions to everyday problems. Adept at \\ncollaborating\\n \\nin\\n \\ncross-functional\\n \\nagile\\n \\nteams\\n \\nto\\n \\nbuild\\n \\nscalable,\\n \\nresilient,\\n \\nand\\n \\nself-healing\\n \\nsolutions. \\nSkills | Tech \\nFrontend | Backend | DevOps: HTML, CSS, JavaScript, React (3 years), AngularJS, TypeScript (3 years), NodeJS (4+ years), Bootstrap, Java (4+ years), \\nSpring\\n \\nFramework,\\n \\nRDBMS\\n \\n(MySQL,\\n \\nSSMS,\\n \\netc.),\\n \\nREST\\n \\nAPIs/Microservices,\\n \\nGit/GitHub,\\n \\n.NET6\\n \\n(C#),\\n \\nPostman.\\n Cloud | Infrastructure: AWS (3 years), Azure, Cloud Foundry, CaaS, Kubernetes, Docker. Scripting: Python, PowerShell, CMD, Bash/Shell/Linux, ServiceNow Scripting. Platforms | Monitoring/Observability: ServiceNow, Jira, BigPanda, NewRelic, Dynatrace (Synthetics, APM, Infrastructure), Veracode. Work Experience Intel Corporation Enterprise Application Development Engineer | Software Developer | Integrations Engineer – Remote Oct 2022 – Current Product: Observability as a Service ● Developed, integrated, and currently maintaining an end-to-end Observability as a Service product which provides real-time fullstack monitoring, logging, \\nlog\\n \\ntracing,\\n \\nanomaly\\n \\ndetection,\\n \\nproblem\\n \\nnotification\\n \\nand\\n \\nremediation\\n \\nservices\\n \\nfor\\n \\nlarge-scale\\n \\ndistributed\\n \\nsystems.\\n \\n Tech stack: Dynatrace, SCOM, NewRelic, ServiceNow, BigPanda, GOLang, Python, C#. ● Deployed comprehensive RBAC/IAM security solution for enterprise applications to assess sign-risk in real-time, handle user identity management, user \\nauthentication\\n \\nand\\n \\nauthorization\\n \\nwhile\\n \\nautomating\\n \\nuser\\n \\nprovisioning\\n \\ntasks\\n \\nwhich\\n \\nreduced\\n \\naccess-management\\n \\nservice\\n \\nrequests\\n \\ntickets\\n \\nand\\n \\nincidents\\n \\nby\\n \\n95%,\\n \\nsaving\\n \\nprecious\\n \\nIT\\n \\ntime.\\n \\n Tech stack: Microsoft Entra ID, Azure SSO with SCIM, Access Governance System. Keywords: Role-based access, Identity Access Management ● Decreased monitoring costs yet maximized real user experience by optimizing monitoring/observability strategies which increased and maintained \\navailability\\n \\nmetrics\\n \\nat\\n \\n99.98%\\n \\nfor\\n \\norganization-wide\\n \\ntier\\n \\n1\\n \\nand\\n \\ntier\\n \\n2\\n \\napplications.\\n ● Deployed a noise cancellation feature that led to elimination of false positive problem notifications across the product by integrating and configuring a \\nrobust\\n \\nevent\\n \\nmanagement\\n \\nSaaS\\n \\nsolution\\n \\nwhich\\n \\nallows\\n \\nstandard\\n \\nevent\\n \\ntagging,\\n \\nevent\\n \\ncorrelation,\\n \\nalert\\n \\ndeduplication\\n \\nand\\n \\nalert\\n \\nenrichment\\n \\nand\\n \\nimplemented\\n \\nincident\\n \\nnotification\\n \\npolicies\\n \\non\\n \\ncritical\\n \\nalerts\\n \\nthat\\n \\nled\\n \\nto\\n \\nimproved\\n \\nincident\\n \\nresponse\\n \\ntime\\n \\nand\\n \\nreduced\\n \\nmajor\\n \\nincidents\\n \\nwhich\\n \\nmaximized\\n \\nreal\\n \\nusers’\\n \\nexperiences\\n \\nand\\n \\nincreased\\n \\nService\\n \\nLevel\\n \\nObjective-based\\n \\nperformance\\n \\nmetrics,\\n \\nSLA\\n \\nand\\n \\nCSAT,\\n \\nto\\n \\nan\\n \\naverage\\n \\nof\\n \\n90%\\n \\nand\\n \\n95%\\n \\nrespectively.\\n Genesis10 Software Developer Consultant – Remote Feb 2022 – Sept 2022 Working as a developer in the Insurance and Investment solutions Industry. ● Developed new web applications (with comprehensive unit/integration tests) using Visual Studio (C#) and SSMS (SQL) to extract, transform and load \\ndata\\n \\ninto\\n \\non-prem/cloud\\n \\ndatabases\\n \\nusing\\n \\nstored\\n \\nprocedures\\n \\nand\\n \\ncreated\\n \\nmicroservices\\n \\n(API\\n \\nfunctionality)\\n \\nfor\\n \\nAPI\\n \\ncalls.\\n \\n ● Built a full stack web application that receives source data in JSON format, validates and transforms source data fields into target data fields format then \\ncommits\\n \\nthe\\n \\ndata\\n \\nin\\n \\nthe\\n \\ndatabase.\\n \\n(Frontend:\\n \\nAngularJS/typescript\\n \\nand\\n \\nBootstrap.\\n \\nBackend:\\n \\nC#\\n \\nand\\n \\nSQL/SSMS.)\\n \\n ● Created new features for web applications using C# and AngularJS, and committing changes into production using Azure DevOps to improve \\naesthetics/performance\\n \\nof\\n \\nthe\\n \\nweb\\n \\napplication\\n \\nwhile\\n \\nutilizing\\n \\nAgile\\n \\nmethodologies.\\n \\n ● Scanned software for bugs/vulnerabilities, analyzing vulnerability risk and remediating with correlated patches. Full-Stack Software Developer Trainee – Remote Sept 2021 – Jan 2022 ● Completed a 15-week Full Stack web development bootcamp focused on Java and cloud technologies. ● Developed multiple Command Line projects and games using Java (SpringBoot, Mockito, JDBC) and SQL, hosting applications using cloud \\ntechnologies\\n \\n(Docker\\n \\nfor\\n \\ncontainerization,\\n \\nAWS\\n \\nfor\\n \\nDeployment).\\n ● Built a travel web application/microservice that allows users to purchase vacation packages when visiting different cities; utilizing React for front end \\ndevelopment,\\n \\njava\\n \\nfor\\n \\nbackend\\n \\ndevelopment,\\n \\nand\\n \\nMySQL\\n \\nfor\\n \\nstoring\\n \\nencrypted\\n \\nuser\\n \\ninformation.\\n ● Completed multilevel data structures and algorithms challenges; gaining skills in efficiently sorting, storing, and manipulating data. \\n Udemy Web Development Bootcamp Feb 2021 – Aug 2021 Software Development Training - Udemy ● Completed three (3) comprehensive web development courses (hands-on projects inclusive) on Udemy to gain mastery of the frontend development \\nconcepts\\n \\n(e.g.,\\n \\nsyntaxes\\n \\nof\\n \\nHTML,\\n \\nCSS,\\n \\nand\\n \\nJavaScript).\\n ● Developed multiple responsive web pages utilizing HTML and CSS (FlexBox); learned to integrate Frameworks (e.g., Bootstrap etc.) to create \\ndynamic\\n \\nweb\\n \\npages\\n \\n(UI)\\n \\nand\\n \\noptimized\\n \\ndynamic\\n \\nbehavior\\n \\nof\\n \\nweb\\n \\npages\\n \\nusing\\n \\nJavaScript\\n \\nto\\n \\nincorporate\\n \\nevents\\n \\non\\n \\nwebpages\\n \\nto\\n \\nimprove\\n \\nuser\\n \\nexperience\\n \\n(UX).\\n \\n Purdue University Northwest March 2020 – June 2021 Technical Lab Supervisor, Mechanical & Civil Engineering – Hammond, Indiana ● Leading the new state-of-the-art design studio project; purchasing, installing machinery, and redesigning studio space to integrate collaborative \\ndesign\\n \\nsections\\n \\nand\\n \\nfabrication\\n \\nprocesses\\n \\ngeared\\n \\ntowards\\n \\nproducing\\n \\na\\n \\nharmonious\\n \\nworkflow.\\n ● Facilitated the laboratories’ seamless transition to virtual learning during Covid-19 by implementing Standard Operating Procedures and delegating a \\nteam\\n \\nof\\n \\n8\\n \\ngraduate\\n \\nteaching\\n \\nassistants\\n \\nusing\\n \\nvarious\\n \\ntraining\\n \\nand\\n \\nevaluation\\n \\nprocedures.\\n ● Managing equipment bid reviews and evaluation process while keeping purchases within budget constraints. ● Recruited potential lab supervisors and assistants to enhance productivity by coordinating engaging sessions introducing the department and assisting \\nwith\\n \\nthe\\n \\nhiring\\n \\nprocess.\\n ● Managing and ensuring completion of student and faculty design, fabrication, testing, and analysis projects such as Component fabrication, Heat \\ntreatment\\n \\nof\\n \\nmaterials,\\n \\nMicrostructural\\n \\nAnalysis\\n \\nof\\n \\nmaterials,\\n \\nTensile/Compression\\n \\ntesting,\\n \\nFatigue\\n \\ntesting,\\n \\nCreep\\n \\ntesting,\\n \\nImpact\\n \\ntesting\\n \\nwhile\\n \\nutilizing\\n \\nbut\\n \\nnot\\n \\nlimited\\n \\nto:\\n • CNC/Lathe machines, Water-jet cutter, Scanning Electron Microscope, MTS Criterion Model 42/ Universal Testing Machine, Fatigue/Torsion \\ntesting\\n \\nmachine,\\n \\ncompression\\n \\ntesting\\n \\nmachine,\\n \\nand\\n \\nRockwell/Brinell\\n \\nHardness\\n \\ntester.\\n \\nPurdue University Northwest May 2018 – December 2019 Associate Technical Lab Supervisor – Hammond, Indiana ● Installed, calibrated, and maintained mechanical engineering laboratory equipment. ● Resolved technical problems and ensured remedial actions are taken whenever equipment deviate from the laboratory's established performance \\nspecifications.\\n ● Coordinated engaging lab sessions following Standard Operating Procedures (SOPs) to introduce equipment to faculty and new lab instructors while \\nassisting\\n \\nfaculty/students\\n \\nto\\n \\nensure\\n \\ncompletion\\n \\nof\\n \\nsenior\\n \\ndesign,\\n \\ntesting,\\n \\nand\\n \\nfabrication\\n \\nprojects.\\n \\nEducation Purdue University, Indiana. MS Mechanical Engineering \\n December 2019 \\nObafemi Awolowo University, Nigeria BS Materials Science and Engineering \\nCertifications: ● ServiceNow Certified Application Developer ● Dev10 Full Stack Java/Cloud Developer. \\n May 2015 \\n \\n\\nWith this context, please chat with the user, always staying in character as Marcel.\"" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "system_prompt" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "def chat(message, history):\n", " messages = [{\"role\": \"system\", \"content\": system_prompt}] + history + [{\"role\": \"user\", \"content\": message}]\n", " response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n", " return response.choices[0].message.content" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Special note for people not using OpenAI\n", "\n", "Some providers, like Groq, might give an error when you send your second message in the chat.\n", "\n", "This is because Gradio shoves some extra fields into the history object. OpenAI doesn't mind; but some other models complain.\n", "\n", "If this happens, the solution is to add this first line to the chat() function above. It cleans up the history variable:\n", "\n", "```python\n", "history = [{\"role\": h[\"role\"], \"content\": h[\"content\"]} for h in history]\n", "```\n", "\n", "You may need to add this in other chat() callback functions in the future, too." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "gr.ChatInterface(chat, type=\"messages\").launch()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## A lot is about to happen...\n", "\n", "1. Be able to ask an LLM to evaluate an answer\n", "2. Be able to rerun if the answer fails evaluation\n", "3. Put this together into 1 workflow\n", "\n", "All without any Agentic framework!" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "# Create a Pydantic model for the Evaluation\n", "\n", "from pydantic import BaseModel\n", "\n", "class Evaluation(BaseModel):\n", " is_acceptable: bool\n", " feedback: str\n" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "evaluator_system_prompt = f\"You are an evaluator that decides whether a response to a question is acceptable. \\\n", "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", "The Agent is playing the role of {name} and is representing {name} on their website. \\\n", "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", "The Agent has been provided with context on {name} in the form of their summary and LinkedIn details. Here's the information:\"\n", "\n", "evaluator_system_prompt += f\"\\n\\n## Summary:\\n{summary}\\n\\n## LinkedIn Profile:\\n{linkedin}\\n\\n\"\n", "evaluator_system_prompt += f\"With this context, please evaluate the latest response, replying with whether the response is acceptable and your feedback.\"" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "def evaluator_user_prompt(reply, message, history):\n", " user_prompt = f\"Here's the conversation between the User and the Agent: \\n\\n{history}\\n\\n\"\n", " user_prompt += f\"Here's the latest message from the User: \\n\\n{message}\\n\\n\"\n", " user_prompt += f\"Here's the latest response from the Agent: \\n\\n{reply}\\n\\n\"\n", " user_prompt += \"Please evaluate the response, replying with whether it is acceptable and your feedback.\"\n", " return user_prompt" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "import os\n", "gemini = OpenAI(\n", " api_key=os.getenv(\"GOOGLE_API_KEY\"), \n", " base_url=\"https://generativelanguage.googleapis.com/v1beta/openai/\"\n", ")" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "def evaluate(reply, message, history) -> Evaluation:\n", "\n", " messages = [{\"role\": \"system\", \"content\": evaluator_system_prompt}] + [{\"role\": \"user\", \"content\": evaluator_user_prompt(reply, message, history)}]\n", " response = gemini.beta.chat.completions.parse(model=\"gemini-2.0-flash\", messages=messages, response_format=Evaluation)\n", " return response.choices[0].message.parsed" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "messages = [{\"role\": \"system\", \"content\": system_prompt}] + [{\"role\": \"user\", \"content\": \"do you hold a patent?\"}]\n", "response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n", "reply = response.choices[0].message.content" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'As of my last update, I do not hold a patent. My focus has primarily been on software development, solutions engineering, and implementing technologies in the field of software. However, I am always exploring opportunities for innovation in my work, so who knows what the future may hold! If you have any specific projects in mind where patents might apply, I would be happy to discuss them.'" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "reply" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Evaluation(is_acceptable=True, feedback='The agent has provided a response that is appropriate and professional. They answered the question in a way that is consistent with the information provided about Marcel. The language used in the response is engaging and friendly, making it a good fit for the instructions.')" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "evaluate(reply, \"do you hold a patent?\", messages[:1])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Resets the Agent to the original system prompt first. Then the system prompt is updated to include the rejected answer and the reason for rejection. so the Agent can correct itself and try again.\n", "def rerun(reply, message, history, feedback):\n", " updated_system_prompt = system_prompt + \"\\n\\n## Previous answer rejected\\nYou just tried to reply, but the quality control rejected your reply\\n\"\n", " updated_system_prompt += f\"## Your attempted answer:\\n{reply}\\n\\n\"\n", " updated_system_prompt += f\"## Reason for rejection:\\n{feedback}\\n\\n\"\n", " messages = [{\"role\": \"system\", \"content\": updated_system_prompt}] + history + [{\"role\": \"user\", \"content\": message}]\n", " response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n", " return response.choices[0].message.content" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [], "source": [ "def chat(message, history):\n", " if \"patent\" in message:\n", " system = system_prompt + \"\\n\\nEverything in your reply needs to be in pig latin - \\\n", " it is mandatory that you respond only and entirely in pig latin\"\n", " else:\n", " system = system_prompt\n", " messages = [{\"role\": \"system\", \"content\": system}] + history + [{\"role\": \"user\", \"content\": message}]\n", " response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n", " reply =response.choices[0].message.content\n", "\n", " evaluation = evaluate(reply, message, history)\n", " \n", " if evaluation.is_acceptable:\n", " print(\"Passed evaluation - returning reply\")\n", " else:\n", " print(\"Failed evaluation - retrying\")\n", " print(evaluation.feedback)\n", " reply = rerun(reply, message, history, evaluation.feedback) \n", " return reply" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "ename": "NameError", "evalue": "name 'gr' is not defined", "output_type": "error", "traceback": [ "\u001b[31m---------------------------------------------------------------------------\u001b[39m", "\u001b[31mNameError\u001b[39m Traceback (most recent call last)", "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[2]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[43mgr\u001b[49m.ChatInterface(chat, \u001b[38;5;28mtype\u001b[39m=\u001b[33m\"\u001b[39m\u001b[33mmessages\u001b[39m\u001b[33m\"\u001b[39m).launch()\n", "\u001b[31mNameError\u001b[39m: name 'gr' is not defined" ] } ], "source": [ "gr.ChatInterface(chat, type=\"messages\").launch()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.11" } }, "nbformat": 4, "nbformat_minor": 2 }