{ "cells": [ { "cell_type": "code", "execution_count": 66, "id": "4121c69d-771c-4296-b336-402871727af1", "metadata": {}, "outputs": [], "source": [ "import pdfplumber\n", "import re\n", "from langchain_groq import ChatGroq" ] }, { "cell_type": "code", "execution_count": 67, "id": "266d57e3-ab44-44d2-a3bc-a1574b5189e7", "metadata": {}, "outputs": [], "source": [ "llm = ChatGroq(\n", " temperature=0, \n", " groq_api_key='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', \n", " model_name=\"llama-3.1-70b-versatile\"\n", ")" ] }, { "cell_type": "code", "execution_count": 68, "id": "c0967c38-3fab-4588-b5aa-d97e65697a03", "metadata": {}, "outputs": [], "source": [ "def extract_text_from_pdf(pdf_path):\n", " with pdfplumber.open(pdf_path) as pdf:\n", " pages = [page.extract_text() for page in pdf.pages]\n", " all_text = \"\\n\".join(pages) if pages else \"\"\n", " # print(all_text)\n", " return all_text" ] }, { "cell_type": "code", "execution_count": 69, "id": "11105d9a-c009-48f0-a6ca-e59eb8378497", "metadata": {}, "outputs": [], "source": [ "pdf_path = \"C:/Users/Admin/Downloads/Mandar_Bhalerao_IISc.pdf\"\n", "pdf_data = extract_text_from_pdf(pdf_path)\n", "# output_path = process_resume(pdf_path)\n", "# print(f\"Cold email prompt saved at: {output_path}\")" ] }, { "cell_type": "code", "execution_count": 70, "id": "0ae61bb3-d123-4513-bd5c-cb970c68c2f3", "metadata": {}, "outputs": [], "source": [ "from langchain_core.prompts import PromptTemplate\n", "# (NO PREAMBLE) means dont give that initial text like Here is your response.\n", "prompt_extract = PromptTemplate.from_template(\n", " \"\"\"\n", " ### PDF DATA OBTAINED FROM RESUME:\n", " {pdf_data}\n", " ### INSTRUCTION:\n", " The data is from the resume of a person.\n", " Your job is to extract all the details of this person and return them in JSON format containing the \n", " following keys: `name`, `education`, `experience`, `projects`,`skills`, and `achievements`.\n", " Only return the valid JSON.\n", " ### VALID JSON (NO PREAMBLE): \n", " \"\"\"\n", ")\n", "\n", " # Your job is to extract the job postings and return them in JSON format containing the \n", " # following keys: `role`, `experience`, `skills` and `description`.\n", "\n", "\n", " # \"name\": name,\n", " # \"education\": education,\n", " # \"experience\": experience,\n", " # \"projects\": projects,\n", " # \"skills\": skills,\n", " # \"achievements\": achievements\n", "\n", "\n", "# def generate_cold_email(details):\n", "# return f\"\"\"\n", "# You are {details['name']}, a graduate from {details['education']}. Your professional experience includes {details['experience']}. You have led projects such as {details['projects']} and are skilled in {details['skills']}. You have also achieved {details['achievements']}.\n", "\n", "# Your task is to write a cold email to a potential employer or client, showcasing your skills and experiences detailed above. Mention your hands-on experience with technologies and how you can contribute to solving real-world problems.\n", "\n", "# Remember, you are {details['name']}, ready to make a significant impact in your new role.\n", "# \"\"\"" ] }, { "cell_type": "code", "execution_count": 74, "id": "f533ce30-9101-40a8-9159-3a6a4dd7ea2e", "metadata": {}, "outputs": [], "source": [ "chain_extract = prompt_extract | llm # this will form a langchain chain ie you are getting a prompt and passing it to LLM \n", "res = chain_extract.invoke(input={'pdf_data':pdf_data})\n", "# print(res.content)\n", "\n", "# we got the json format of the job description" ] }, { "cell_type": "code", "execution_count": 75, "id": "947778e8-e430-4afc-96ce-2e91765c8bc5", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "str" ] }, "execution_count": 75, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(res.content)" ] }, { "cell_type": "code", "execution_count": 76, "id": "fc69353b-ec60-445c-be0f-af4fc71e0cf8", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "4805" ] }, "execution_count": 76, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(res.content)" ] }, { "cell_type": "code", "execution_count": 77, "id": "d3b88673-4f06-40a2-aad6-c2eea7d1e392", "metadata": {}, "outputs": [], "source": [ "from langchain_core.output_parsers import JsonOutputParser\n", "\n", "json_parser = JsonOutputParser()\n", "json_res = json_parser.parse(res.content)\n", "# json_res" ] }, { "cell_type": "code", "execution_count": 78, "id": "a47aa45b-8148-410a-9a0a-420c8ccd771c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "dict" ] }, "execution_count": 78, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(json_res)" ] }, { "cell_type": "code", "execution_count": 79, "id": "64841177-feaa-4bd3-af09-d90b7656f620", "metadata": {}, "outputs": [], "source": [ "# # so whenever there is a job posting, we will extract this skills from the job \n", "# # and we will match it with one or multiple of these technologies mentioned in the csv file and it will retrive those portfolio urls\n", "# # which we will use while writing an email\n", "\n", "# import pandas as pd\n", "\n", "# df = pd.read_csv(\"my_portfolio.csv\")\n", "# # df\n", "\n", "\n", "# import uuid\n", "# import chromadb\n", "\n", "# # when you use Client, it will create a chromadb in memory\n", "# # but when we use PersistentClient it will create a chromadb on a disk ie it will be stored in our current folder so that we can retrive it anytime\n", "# client = chromadb.PersistentClient('vectorstore')\n", "# collection = client.get_or_create_collection(name=\"portfolio\")\n", "\n", "\n", "# if not collection.count(): # this means if collection does not have any count ie if it is being created for the first time\n", "# for _, row in df.iterrows(): # then you iterate through all your dataframe rows, and for each row, you are adding a document\n", "# collection.add(documents=row[\"Techstack\"],\n", "# metadatas={\"links\": row[\"Links\"]},\n", "# ids=[str(uuid.uuid4())])" ] }, { "cell_type": "code", "execution_count": 80, "id": "f226adee-9126-42f8-a158-b87c8b991905", "metadata": {}, "outputs": [], "source": [ "job = json_res" ] }, { "cell_type": "code", "execution_count": 81, "id": "632eba44-054f-4c2b-803a-8e6c6f9f7232", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'name': 'Mandar Bhalerao',\n", " 'education': [{'institution': 'Indian Institute of Science',\n", " 'degree': 'Master of Technology - Computer Science and Automation',\n", " 'cgpa': '7.30/10.0',\n", " 'duration': 'Aug 2023 – Jul 2025',\n", " 'location': 'Bangalore, Karnataka'},\n", " {'institution': 'P.E.S. Modern College of Engineering',\n", " 'degree': 'Bachelor of Engineering - Computer Engineering',\n", " 'cgpa': '9.34/10.0',\n", " 'duration': 'Aug 2019 – Jul 2023',\n", " 'location': 'Pune, Maharashtra'}],\n", " 'experience': [{'company': 'NeuroPixel.AI',\n", " 'position': 'Deep Learning Research Intern',\n", " 'duration': 'May 2024 – July 2024',\n", " 'achievements': ['Worked on optimization of Stable Diffusion models to improve performance, achieving significant efficiency gains.',\n", " 'Implemented the Hyper-SD framework to enhance image synthesis efficiency by Knowledge Distillation techniques.',\n", " 'Combined the advantages of Trajectory Preserving and Reformulation Distillation techniques for faster inference.',\n", " 'Trained a Control Net for SDXL, resulting in a 30% improvement of the inference steps from the base SDXL model.']},\n", " {'company': 'Western Union',\n", " 'position': 'Software Intern',\n", " 'duration': 'Jan 2023 – Jun 2023',\n", " 'achievements': ['Engaged with Quantum Metric to enrich powerful UX analysis, streamlining user experience design and functionality.',\n", " 'Analyzed global transaction data, identified bugs, and implementing solutions that boosted conversion rates by 10%.']},\n", " {'company': 'Amazon Web Services',\n", " 'position': 'Intern',\n", " 'duration': 'Oct 2021 – Dec 2021',\n", " 'achievements': ['Acquired foundational skills in AWS, utilizing essential tools and services to support scalable cloud architectures.',\n", " 'Completed the Solutions Architect Project and gained insights about the need of Cloud and AWS in today’s world.']}],\n", " 'projects': [{'name': 'Gurgaon Real Estate Price Prediction',\n", " 'technologies': 'Machine Learning, AWS',\n", " 'achievements': ['Conducted data preprocessing, feature engineering, and performed EDA to optimize model performance.',\n", " 'Experimented different models including Linear Regression, Decision Tree, Random Forest, XGBoost etc.',\n", " 'Achieved a best R² score of 0.90 and a Mean Absolute Error (MAE) of 44 lakhs with the RandomForest model.',\n", " 'Created a Geo-map for sectors in Gurgaon with color-coded pricing making it easy for the user to select property.',\n", " 'Developed a dual-layer recommendation system to boost user engagement by suggesting top 5 properties to the user.',\n", " 'Deployed the modules using Streamlit and AWS, enabling real-time access and interactive analytics for end-users.']},\n", " {'name': 'Optimizing Performance of Dilated Convolution',\n", " 'technologies': 'C++, CUDA',\n", " 'achievements': ['Implemented different optimization methods to reduce the overall time required for Dialated Convolution.',\n", " 'Optimized it using single threading and achieved a maximum improvement of 85.77%.',\n", " 'Achieved a maximum improvement of 96% through multi-threading by changing the number of threads.',\n", " 'Implemented it for a GPU using CUDA resulting in the speedup of 600.47 and improvement of 99.83%.']},\n", " {'name': 'Movie Recommendation System',\n", " 'technologies': 'Python',\n", " 'achievements': ['Created an end to end Machine Learning project using Streamlit framework in Python and movies dataset from Kaggle.',\n", " 'Developed a Content based Recommendation System using cosine similarity to analyze similarities among 5000 movies.',\n", " 'Successfully deployed the application on Streamlit Community Cloud, enabling real-time user interactions and feedback.']}],\n", " 'skills': {'languages': ['Python', 'C++'],\n", " 'developerTools': ['VS Code', 'Jupyter Notebook', 'Google Colab'],\n", " 'technical': ['Neural Networks',\n", " 'Machine Learning',\n", " 'Deep Learning',\n", " 'Gen AI',\n", " 'Natural Language Processing (NLP)']},\n", " 'achievements': [{'position': 'Teaching Assistant',\n", " 'course': 'UENG-101 Algorithms and Programming',\n", " 'professors': ['Prof. Y.Narahari', 'Prof. Viraj Kumar']},\n", " {'position': 'First Position',\n", " 'competition': 'Chase The Py By CODEFIESTA 2022'},\n", " {'position': 'Global Rank of 157',\n", " 'competition': 'February Long Challenge at Codechef'},\n", " {'position': 'Gold badges',\n", " 'domains': ['Python', 'C++', 'Problem Solving Domain'],\n", " 'platform': 'HackerRank'}]}" ] }, "execution_count": 81, "metadata": {}, "output_type": "execute_result" } ], "source": [ "job" ] }, { "cell_type": "code", "execution_count": 82, "id": "25ab0c96-8800-4102-8973-cbf42e68a11d", "metadata": {}, "outputs": [], "source": [ "# def generate_cold_email(details):\n", "# # Extract name\n", "# name = details.get('name', 'Candidate')\n", "\n", "# # Extract education details\n", "# education_list = details.get('education', [])\n", "# if education_list:\n", "# education_details = ', '.join([f\"{edu.get('degree', 'Unknown degree')} from {edu.get('institution', 'Unknown institution')} ({edu.get('duration', 'Unknown duration')})\" for edu in education_list])\n", "# else:\n", "# education_details = 'No education details provided'\n", "\n", "# # Extract skills details\n", "# skills_list = details.get('skills', [])\n", "# if skills_list:\n", "# skills_details = ', '.join([', '.join(skill.get('tools', [])) for skill in skills_list])\n", "# else:\n", "# skills_details = 'No skills listed'\n", "\n", "# # Extract experience details\n", "# experience_list = details.get('experience', [])\n", "# if experience_list:\n", "# experience_details = ', '.join([f\"{exp.get('position', 'Unknown position')} at {exp.get('company', 'Unknown company')} ({exp.get('duration', 'Unknown duration')})\" for exp in experience_list])\n", "# else:\n", "# experience_details = 'No experience provided'\n", "\n", "# # Extract project details\n", "# project_list = details.get('projects', [])\n", "# if project_list:\n", "# project_details = ', '.join([project.get('name', 'Unknown project') for project in project_list])\n", "# else:\n", "# project_details = 'No projects listed'\n", "\n", "# # Extract achievements details\n", "# achievement_list = details.get('achievements', [])\n", "# if achievement_list:\n", "# achievement_details = ', '.join([f\"{achieve.get('position', 'Unknown position')} - {achieve.get('description', 'Unknown achievement')}\" for achieve in achievement_list])\n", "# else:\n", "# achievement_details = 'No achievements listed'\n", "\n", "# email_prompt = f\"\"\"\n", "# You are {name}, educated at {education_details}. Your skills include {skills_details}.\n", " \n", "# You have experience as {experience_details}.\n", " \n", "# Some of your key projects include {project_details}.\n", " \n", "# Additionally, your achievements include {achievement_details}.\n", " \n", "# Write a cold email to a potential employer or client, showcasing your skills, education, projects, and achievements. Explain how your background makes you an ideal candidate for their needs.\n", "\n", "# Remember, you are {name}, ready to make a significant impact in your new role.\n", "# \"\"\"\n", "# return email_prompt\n" ] }, { "cell_type": "code", "execution_count": 83, "id": "102afc75-d182-4724-8261-6ff02c450f39", "metadata": {}, "outputs": [], "source": [ "# generate_cold_email(job)" ] }, { "cell_type": "code", "execution_count": 84, "id": "1513b4bf-a92b-4483-babd-7aa37ddb74c4", "metadata": {}, "outputs": [], "source": [ "# def generate_cold_email(details):\n", "# # Extract name\n", "# name = details.get('name', 'Candidate')\n", "\n", "# # Extract education details\n", "# education_list = details.get('education', [])\n", "# if education_list:\n", "# education_details = ', '.join([f\"{edu.get('degree', 'Unknown degree')} from {edu.get('institution', 'Unknown institution')} ({edu.get('duration', 'Unknown duration')})\" for edu in education_list])\n", "# else:\n", "# education_details = 'No education details provided'\n", "\n", "# # Extract skills details\n", "# skills_list = details.get('skills', [])\n", "# if skills_list:\n", "# skills_details = ', '.join([', '.join(skill.get('tools', [])) for skill in skills_list])\n", "# else:\n", "# skills_details = 'No skills listed'\n", "\n", "# # Extract experience details\n", "# experience_list = details.get('experience', [])\n", "# if experience_list:\n", "# experience_details = []\n", "# for exp in experience_list:\n", "# position = exp.get('position', 'Unknown position')\n", "# company = exp.get('company', 'Unknown company')\n", "# duration = exp.get('duration', 'Unknown duration')\n", "# achievements = exp.get('achievements', [])\n", "# achievements_details = ', '.join(achievements) if achievements else 'No achievements mentioned'\n", "# experience_details.append(f\"{position} at {company} ({duration}): {achievements_details}\")\n", "# experience_details = ', '.join(experience_details)\n", "# else:\n", "# experience_details = 'No experience provided'\n", "\n", "# # Extract project details\n", "# project_list = details.get('projects', [])\n", "# if project_list:\n", "# project_details = ', '.join([project.get('name', 'Unknown project') for project in project_list])\n", "# else:\n", "# project_details = 'No projects listed'\n", "\n", "# # Extract achievements details\n", "# achievement_list = details.get('achievements', [])\n", "# if achievement_list:\n", "# achievement_details = ', '.join([f\"{achieve.get('position', 'Unknown position')} - {achieve.get('description', 'Unknown achievement')}\" for achieve in achievement_list])\n", "# else:\n", "# achievement_details = 'No achievements listed'\n", "\n", "# email_prompt = f\"\"\"\n", "# You are {name}, educated at {education_details}. Your skills include {skills_details}.\n", " \n", "# You have experience as {experience_details}.\n", " \n", "# Some of your key projects include {project_details}.\n", " \n", "# Additionally, your achievements include {achievement_details}.\n", " \n", "# Write a cold email to a potential employer or client, showcasing your skills, education, experience (including responsibilities and achievements), projects, and achievements. Explain how your background makes you an ideal candidate for their needs.\n", "\n", "# Remember, you are {name}, ready to make a significant impact in your new role.\n", "# \"\"\"\n", "# return email_prompt\n" ] }, { "cell_type": "code", "execution_count": 86, "id": "8c13b01b-1715-452e-ba64-22ab7aac92ce", "metadata": {}, "outputs": [], "source": [ "# generate_cold_email(job)\n", "# " ] }, { "cell_type": "code", "execution_count": 87, "id": "afc38bb5-0aef-491f-ae17-ef665e89544a", "metadata": {}, "outputs": [], "source": [ "def generate_cold_email(details):\n", " # Extract name\n", " name = details.get('name', 'Candidate')\n", "\n", " # Extract education details\n", " education_list = details.get('education', [])\n", " if education_list:\n", " education_details = ', '.join([f\"{edu.get('degree', 'Unknown degree')} from {edu.get('institution', 'Unknown institution')} ({edu.get('duration', 'Unknown duration')})\" for edu in education_list])\n", " else:\n", " education_details = 'No education details provided'\n", "\n", " # Extract skills details\n", " skills_list = details.get('skills', [])\n", " if skills_list:\n", " skills_details = ', '.join([', '.join(skill.get('tools', [])) for skill in skills_list])\n", " else:\n", " skills_details = 'No skills listed'\n", "\n", " # Extract experience details\n", " experience_list = details.get('experience', [])\n", " if experience_list:\n", " experience_details = []\n", " for exp in experience_list:\n", " position = exp.get('position', 'Unknown position')\n", " company = exp.get('company', 'Unknown company')\n", " duration = exp.get('duration', 'Unknown duration')\n", " achievements = exp.get('achievements', [])\n", " achievements_details = ', '.join(achievements) if achievements else 'No achievements mentioned'\n", " experience_details.append(f\"{position} at {company} ({duration}): {achievements_details}\")\n", " experience_details = ', '.join(experience_details)\n", " else:\n", " experience_details = 'No experience provided'\n", "\n", " # Extract project details\n", " project_list = details.get('projects', [])\n", " if project_list:\n", " project_details = []\n", " for project in project_list:\n", " project_name = project.get('name', 'Unknown project')\n", " project_description = ', '.join(project.get('description', [])) if project.get('description') else 'No details provided'\n", " project_details.append(f\"{project_name}: {project_description}\")\n", " project_details = ', '.join(project_details)\n", " else:\n", " project_details = 'No projects listed'\n", "\n", " # Extract achievements details\n", " achievement_list = details.get('achievements', [])\n", " if achievement_list:\n", " achievement_details = ', '.join([f\"{achieve.get('position', 'Unknown position')} - {achieve.get('description', 'Unknown achievement')}\" for achieve in achievement_list])\n", " else:\n", " achievement_details = 'No achievements listed'\n", "\n", " email_prompt = f\"\"\"\n", " You are {name}, educated at {education_details}. Your skills include {skills_details}.\n", " \n", " You have experience as {experience_details}.\n", " \n", " Some of your key projects include {project_details}.\n", " \n", " Additionally, your achievements include {achievement_details}.\n", " \n", " Write a cold email to a potential employer or client, showcasing your skills, education, experience (including responsibilities and achievements), projects (with descriptions), and achievements. Explain how your background makes you an ideal candidate for their needs.\n", "\n", " Remember, you are {name}, ready to make a significant impact in your new role.\n", " \"\"\"\n", " return email_prompt\n" ] }, { "cell_type": "code", "execution_count": 89, "id": "8c4555f3-f98c-4951-9c40-81a2c779206c", "metadata": {}, "outputs": [ { "ename": "AttributeError", "evalue": "'str' object has no attribute 'get'", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[89], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mgenerate_cold_email\u001b[49m\u001b[43m(\u001b[49m\u001b[43mjob\u001b[49m\u001b[43m)\u001b[49m\n", "Cell \u001b[1;32mIn[87], line 15\u001b[0m, in \u001b[0;36mgenerate_cold_email\u001b[1;34m(details)\u001b[0m\n\u001b[0;32m 13\u001b[0m skills_list \u001b[38;5;241m=\u001b[39m details\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mskills\u001b[39m\u001b[38;5;124m'\u001b[39m, [])\n\u001b[0;32m 14\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m skills_list:\n\u001b[1;32m---> 15\u001b[0m skills_details \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m, \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin([\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m, \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(skill\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtools\u001b[39m\u001b[38;5;124m'\u001b[39m, [])) \u001b[38;5;28;01mfor\u001b[39;00m skill \u001b[38;5;129;01min\u001b[39;00m skills_list])\n\u001b[0;32m 16\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 17\u001b[0m skills_details \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mNo skills listed\u001b[39m\u001b[38;5;124m'\u001b[39m\n", "Cell \u001b[1;32mIn[87], line 15\u001b[0m, in \u001b[0;36m\u001b[1;34m(.0)\u001b[0m\n\u001b[0;32m 13\u001b[0m skills_list \u001b[38;5;241m=\u001b[39m details\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mskills\u001b[39m\u001b[38;5;124m'\u001b[39m, [])\n\u001b[0;32m 14\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m skills_list:\n\u001b[1;32m---> 15\u001b[0m skills_details \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m, \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin([\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m, \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(\u001b[43mskill\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtools\u001b[39m\u001b[38;5;124m'\u001b[39m, [])) \u001b[38;5;28;01mfor\u001b[39;00m skill \u001b[38;5;129;01min\u001b[39;00m skills_list])\n\u001b[0;32m 16\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 17\u001b[0m skills_details \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mNo skills listed\u001b[39m\u001b[38;5;124m'\u001b[39m\n", "\u001b[1;31mAttributeError\u001b[0m: 'str' object has no attribute 'get'" ] } ], "source": [ "generate_cold_email(job)" ] }, { "cell_type": "code", "execution_count": 88, "id": "010e4425-8b74-4052-8a72-5c3bb0614847", "metadata": {}, "outputs": [ { "ename": "AttributeError", "evalue": "'str' object has no attribute 'get'", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[88], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m resume_details \u001b[38;5;241m=\u001b[39m \u001b[43mgenerate_cold_email\u001b[49m\u001b[43m(\u001b[49m\u001b[43mjob\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28mtype\u001b[39m(resume_details)\n", "Cell \u001b[1;32mIn[87], line 15\u001b[0m, in \u001b[0;36mgenerate_cold_email\u001b[1;34m(details)\u001b[0m\n\u001b[0;32m 13\u001b[0m skills_list \u001b[38;5;241m=\u001b[39m details\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mskills\u001b[39m\u001b[38;5;124m'\u001b[39m, [])\n\u001b[0;32m 14\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m skills_list:\n\u001b[1;32m---> 15\u001b[0m skills_details \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m, \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin([\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m, \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(skill\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtools\u001b[39m\u001b[38;5;124m'\u001b[39m, [])) \u001b[38;5;28;01mfor\u001b[39;00m skill \u001b[38;5;129;01min\u001b[39;00m skills_list])\n\u001b[0;32m 16\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 17\u001b[0m skills_details \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mNo skills listed\u001b[39m\u001b[38;5;124m'\u001b[39m\n", "Cell \u001b[1;32mIn[87], line 15\u001b[0m, in \u001b[0;36m\u001b[1;34m(.0)\u001b[0m\n\u001b[0;32m 13\u001b[0m skills_list \u001b[38;5;241m=\u001b[39m details\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mskills\u001b[39m\u001b[38;5;124m'\u001b[39m, [])\n\u001b[0;32m 14\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m skills_list:\n\u001b[1;32m---> 15\u001b[0m skills_details \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m, \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin([\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m, \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(\u001b[43mskill\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtools\u001b[39m\u001b[38;5;124m'\u001b[39m, [])) \u001b[38;5;28;01mfor\u001b[39;00m skill \u001b[38;5;129;01min\u001b[39;00m skills_list])\n\u001b[0;32m 16\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 17\u001b[0m skills_details \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mNo skills listed\u001b[39m\u001b[38;5;124m'\u001b[39m\n", "\u001b[1;31mAttributeError\u001b[0m: 'str' object has no attribute 'get'" ] } ], "source": [ "resume_details = generate_cold_email(job)\n", "type(resume_details)" ] }, { "cell_type": "code", "execution_count": 60, "id": "be7377e8-166e-452e-966c-64df9df46462", "metadata": {}, "outputs": [], "source": [ "# job" ] }, { "cell_type": "code", "execution_count": 57, "id": "237becf8-2351-40c4-a343-0eaf61e10230", "metadata": {}, "outputs": [], "source": [ "# this is prompt template for writing an email\n", "\n", "prompt_email = PromptTemplate.from_template(\n", " \"\"\"\n", " ### JOB DESCRIPTION:\n", " {job_description}\n", "\n", " ### INSTRUCTION:\n", " Introduce yourself from the below details\n", " {resume_details}\n", " End the email with Name and Designation. \n", " Do not provide a preamble.\n", " ### EMAIL (NO PREAMBLE):\n", "\n", " \"\"\"\n", " )" ] }, { "cell_type": "code", "execution_count": 58, "id": "0833b02e-dc85-4595-86c5-c69096fc1a2b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Subject: Expertise in AI, Machine Learning, and Deep Learning for Innovative Solutions\n", "\n", "Dear Hiring Manager,\n", "\n", "I am Mandar Bhalerao, a highly motivated and skilled professional with a strong educational background in Computer Science and Automation. I am excited to introduce myself as a potential candidate for a role that leverages my expertise in AI, Machine Learning, and Deep Learning.\n", "\n", "With a Master of Technology degree in Computer Science and Automation from the Indian Institute of Science (Aug 2023 – Jul 2025) and a Bachelor of Engineering degree in Computer Engineering from P.E.S. Modern College of Engineering (Aug 2019 – Jul 2023), I possess a solid foundation in computer science and software development. My technical skills include proficiency in Python, C++, VS Code, Jupyter Notebook, Google Colab, Neural Networks, Machine Learning, Deep Learning, Gen AI, and Natural Language Processing (NLP).\n", "\n", "As a Deep Learning Research Intern at NeuroPixel.AI (May 2024 – July 2024), I worked on optimizing Stable Diffusion models to improve performance, achieving significant efficiency gains. I implemented the Hyper-SD framework to enhance image synthesis efficiency by Knowledge Distillation techniques and combined the advantages of Trajectory Preserving and Reformulation Distillation techniques for faster inference. I also trained a Control Net for SDXL, resulting in a 30% improvement of the inference steps from the base SDXL model.\n", "\n", "As a Software Intern at Western Union (Jan 2023 – Jun 2023), I engaged with Quantum Metric to enrich powerful UX analysis, streamlining user experience design and functionality. I analyzed global transaction data, identified bugs, and implemented solutions that boosted conversion rates by 10%. As an Intern at Amazon Web Services (Oct 2021 – Dec 2021), I acquired foundational skills in AWS, utilizing essential tools and services to support scalable cloud architectures. I completed the Solutions Architect Project and gained insights about the need of Cloud and AWS in today’s world.\n", "\n", "Some of my notable projects include:\n", "\n", "* Gurgaon Real Estate Price Prediction: I conducted data preprocessing, feature engineering, and performed EDA to optimize model performance. I experimented with different models, including Linear Regression, Decision Tree, Random Forest, XGBoost, and achieved a best R² score of 0.90 and a Mean Absolute Error (MAE) of 44 lakhs with the RandomForest model. I created a Geo-map for sectors in Gurgaon with color-coded pricing, making it easy for users to select properties. I developed a dual-layer recommendation system to boost user engagement by suggesting top 5 properties to users and deployed the modules using Streamlit and AWS.\n", "* Optimizing Performance of Dilated Convolution: I implemented different optimization methods to reduce the overall time required for Dialated Convolution. I optimized it using single threading and achieved a maximum improvement of 85.77%. I achieved a maximum improvement of 96% through multi-threading by changing the number of threads. I implemented it for a GPU using CUDA, resulting in a speedup of 600.47 and an improvement of 99.83%.\n", "* Movie Recommendation System: I created an end-to-end Machine Learning project using the Streamlit framework in Python and the movies dataset from Kaggle. I developed a Content-based Recommendation System using cosine similarity to analyze similarities among 5000 movies. I successfully deployed the application on Streamlit Community Cloud, enabling real-time user interactions and feedback.\n", "\n", "My achievements include:\n", "\n", "* Teaching Assistant for “UENG-101 Algorithms and Programming” by Prof. Y.Narahari and Prof. Viraj Kumar\n", "* First Position in Chase The Py By CODEFIESTA 2022\n", "* Global Rank of 157 in February Long Challenge at Codechef\n", "* Gold badges in Python, C++, and Problem Solving Domain on HackerRank\n", "\n", "With my strong educational background, technical skills, and experience in AI, Machine Learning, and Deep Learning, I am confident that I can make a significant impact in your organization. I am excited about the opportunity to discuss my qualifications further and explore how my skills align with your needs.\n", "\n", "Mandar Bhalerao\n", "AI/ML Engineer & Deep Learning Researcher\n" ] } ], "source": [ "# again creating a chain of prompt_email and llm\n", "# invoking the chain by passing the parameter of job_description and link_list\n", "\n", "chain_email = prompt_email | llm\n", "res = chain_email.invoke({\"job_description\": str(job), \"resume_details\": resume_details})\n", "print(res.content)" ] }, { "cell_type": "code", "execution_count": null, "id": "a0efcf9c-8936-4d7a-9a8a-0c1121f12caf", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.10.7" } }, "nbformat": 4, "nbformat_minor": 5 }