Picture of the logo

Crafting the Perfect Resume with AI Assistance

Are you tired of spending hours trying to write the perfect resume for a job opportunity? Are you unsure which experiences and skills to highlight? Look no further! In this article, we will explore a code snippet that utilizes the power of AI to generate a tailored resume based on specific criteria. By leveraging OpenAI's GPT-4 model and a few lines of code, you can have a polished resume in no time.


Introduction

When applying for a job, a resume is often the first impression you make on potential employers. It is crucial to create a document that effectively highlights your relevant experiences, skills, and qualifications. However, the process of crafting an attention-grabbing resume can be time-consuming and challenging. That's where AI comes in to lend a helping hand.

The code snippet we will discuss employs OpenAI's powerful GPT-4 model to generate a resume based on given criteria. The criteria include the company name, job description, full resume details, and a list of highlighted skills. By providing this information, you can receive a personalized resume tailored to the specific job opportunity.

Let's dive into the code and understand how it works.

Understanding the Code

import openai
import os
import subprocess

# Set OpenAI API key
openai.api_key = "[OPEN_API_KEY]"
full_resume = "[Put your full resume details here]"
skill_list = "[List all of your skill keywords here]"

def generate_resume(company, description, full_resume=full_resume, highlighted_skills=skill_list):
    prompt = f" Using markdown formatting, Help me craft a resume for {description} at {company}. My name is [NAME], my phone number is [NUMBER] and my email is [EMAIL]. Write the email and phone number in plaintext.  Use this list of existing experiences and highlight the best 3-5 bullet-points for each for this role: {full_resume}. Finally, highlight The most relevant 5-10 of these skills. pick the ones most relevant to the description: {highlighted_skills}.  "

    response = openai.ChatCompletion.create(
        model="gpt-4",
        messages=[
            {"role": "system", "content": "You are a career advisor and professional writer in the technology and business world."},
            {"role": "user", "content": prompt}
        ],
        max_tokens=3200
    )

    return response['choices'][0]['message']['content']
def main():
    company_name =  input("Please enter the company name: ")
    input_string = input("Please enter the job description at company (eg. 'CTO at Example Company. Description: This role demands 100+ years of experience..': )")
    result = generate_resume(company_name,input_string)
    if result is not None:
        # Create a markdown file with the current date as the filename
        filename = f"[YOUR NAME]_{company_name}.md"
        try:
            with open(filename, 'w') as f:
                f.write(result)
        except Exception as e:
            print(f"Error during file writing: {e}")
    else:
        print("Result was empty")
    subprocess.run(['pandoc', filename, '-o', f"[YOUR NAME]_{company_name}.pdf"])
if __name__ == "__main__":
    main()

The code snippet starts by importing the necessary libraries, including openai, os, and subprocess. The openai library allows us to interact with OpenAI's GPT-4 model. Next, we set the OpenAI API key for authentication. Make sure to replace "[OPEN_API_KEY]" with your actual API key.

The variables full_resume and skill_list store the full resume details and a list of skill keywords, respectively. Modify these variables by replacing the placeholder values with your own resume details and skills. full_resume Is supposed to be ALL of your previous roles, their full descriptions and list of responsibilities, education, etc. The goal is to make this as comprehensive as possible and let GPT pick which skills, descriptions or certifications are the best fit for the role.

The generate_resume function is the heart of the code. It takes the company name, description of the job, full_resume, and highlighted_skills as input parameters. Inside the function, we construct a prompt string that incorporates the provided information. The prompt is written in markdown format and includes placeholders for your name, phone number, and email address.

The prompt also utilizes the full_resume and highlighted_skills variables to provide context for generating the resume. The goal is to help the AI model understand your existing experiences and highlight the most relevant skills

for the given job description.

Using the OpenAI ChatCompletion.create method, we send the constructed prompt as a message to the GPT-4 model. The messages parameter consists of two parts: a system message and a user message. The system message provides high-level context to the model, stating that the user is a career advisor and professional writer in the technology and business world. The user message contains the constructed prompt.

The max_tokens parameter limits the length of the response from the model to 3200 tokens. By default, a token represents a word or a character. Specifying this parameter helps control the length of the generated resume.

Finally, the function returns the content of the AI-generated resume, extracted from the response.

The main function serves as the entry point for execution. It prompts the user to input the company name and job description. It then calls the generate_resume function with the provided inputs. If the result is not empty, the function creates a markdown file named after the company and writes the generated resume content to it. It also uses the subprocess module to convert the markdown file to a PDF format.

Now that we have a good understanding of the code, let's discuss how to use it effectively.

Usage Instructions

  1. Ensure you have the necessary Python libraries installed, including openai, os, and subprocess. You can install them via pip: pip install openai.

  2. Obtain an OpenAI API key by signing up for OpenAI's services. Replace "[OPEN_API_KEY]" in the code with your actual API key.

  3. Modify the full_resume variable to include your complete resume details. Use markdown formatting to structure the content effectively.

  4. Update the skill_list variable with a list of skill keywords that you possess.

  5. Customize the user prompt within the generate_resume function to include your name, phone number, and email address. Ensure that you write the email and phone number in plaintext.

  6. Run the code and follow the prompts. Enter the company name and job description as requested.

  7. If the result is not empty, a markdown file will be created with the company name as the filename. The generated resume content will be written to this file.

  8. The code will then use pandoc, a document conversion tool, to convert the markdown file to a PDF format with the same filename as the company. Make sure you have pandoc installed on your system.

Congratulations! You have successfully generated a resume using AI assistance. The resulting PDF file contains a professionally-crafted resume tailored to the specific job opportunity.

Conclusion

Crafting the perfect resume can be a daunting task, but with the power of AI, you can streamline the process and save valuable time. The code snippet we explored in this article harnesses the capabilities of OpenAI's GPT-4 model to generate personalized resumes based on specific criteria. By leveraging this code, you can create attention-grabbing resumes that highlight your experiences and skills effectively.

Remember, while AI-generated resumes provide valuable assistance, it's essential to review and customize them according to your preferences and the specific job you're applying for. Use the generated resume as a starting point and make necessary adjustments to ensure it reflects your unique qualifications and accomplishments.

With AI-powered tools at your disposal, the journey towards securing your dream job becomes more efficient and rewarding. Embrace the possibilities and let AI empower your career aspirations.

If you like our content, please consider subscribing to our weekly newsletter. I'm biased, but it's pretty great.Sign Up

Beecon LLC, All rights reserved.