Skip to content

Instantly share code, notes, and snippets.

@nicobrenner
Created February 28, 2024 06:30
Show Gist options
  • Save nicobrenner/dc1e6968dcd396c6367a63ac4c61f5d3 to your computer and use it in GitHub Desktop.
Save nicobrenner/dc1e6968dcd396c6367a63ac4c61f5d3 to your computer and use it in GitHub Desktop.
Allows quick personalized filtering of hundreds of job listings to find the best jobs to apply to (uses GPT to match resume to listings)
# This allows you to easily filter hundreds of jobs listings
# to quickly determine which are the best fit for your resume
# It enriches job listings descriptions by doing two things:
# 1) extracts structured data from the description (eg. company name)
# 2) getting answers about selection criteria (eg. is the job remote?)
# It first gets job listing descriptions from a job_listings table
# then assembles a prompt using a template, a resume and the
# job listing
# Running it through GPT4, it gets answers to the questions in the prompt
# The answers come in json format (formatting fails about 2 of 150 requests)
# Example answer in json format
# {
# "company_name": "CodeWeavers",
# "available_positions": [
# {
# "position": "Wine and General Open Source Developers",
# "link": "https://www.codeweavers.com/about/jobs"
# }
# ],
# "tech_stack_description": "C-language systems programming",
# "use_rails": "No",
# "use_python": "No",
# "remote_positions": "Yes",
# "hiring_in_us": "Yes",
# "how_to_apply": "Apply through our website, here is the link: https://www.codeweavers.com/about/jobs",
# "back_ground_with_priority": null,
# "fit_for_resume": "No",
# "fit_justification": "The position is for Wine and Open Source developers, neither of which the resume has experience with. The job is remote in the US"
# }
# All of that data is saved to the db in the table gpt_interactions
# Having the data, you can then run a query like this one:
# https://gist.github.com/nicobrenner/f8da15c99c45c229c03c89dae1ed94d6
# And get a table like this:
# |job_id |fit_for_resume |company_name |how_to_apply |fit_justification |available_positions |remote_positions |hiring_in_us
# |33 |Yes |Obsidian Security |Apply through... |The position is ...|[{"position":"Threat Backend Engineer","link":"https://obsidiansecurity.applytojob.com/apply/wK0pJCTaKO/Threat-Backend-Engineer"}] |Yes |Yes
import sqlite3
import os
import asyncio
from openai import AsyncOpenAI
client = AsyncOpenAI(
# Remember to add your own OpenAI api key here
api_key='YOUR_API_KEY',
)
# Connect to the SQLite database
# This db should have the structure from here:
# https://gist.github.com/nicobrenner/88cc2aaf4fde7cbb119c6ca67fd50bc2
conn = sqlite3.connect('job_listings.db')
cursor = conn.cursor()
# Ensure the gpt_interactions table exists
cursor.execute('''
CREATE TABLE IF NOT EXISTS gpt_interactions (
id INTEGER PRIMARY KEY,
job_id INTEGER,
prompt TEXT,
answer TEXT
)
''')
conn.commit()
async def main() -> None:
# Query the job listings from the database
cursor.execute("SELECT id, original_text, original_html FROM job_listings")
job_listings = cursor.fetchall()
for job_id, job_text, job_html in job_listings:
print(f'Processing job_id: {job_id}')
# Generate a prompt for GPT based on the job listing
resume="""Skills
10+ years: Ruby on Rails | Backend | Frontend | Full-stack | AWS | Postgres | Redis | CI/CD | CircleCI | Javascript | RSpec
5+ years: Docker | Python | SMS | Twilio | VOIP | SIP
Experience
CTO/Co-founder ThirdCo San Francisco / Los Angeles 10/2014 - Present
· Cultivated a robust engineering culture, leading to the successful recruitment and management of a high-performing team
· Pioneered the integration of Twilio + A2P10DLC for delivering millions of text messages
· Spearheaded the development of a highly scalable survey SaaS product (Ruby on Rails/PostgreSQL/Redis + JavaScript)
· Led and managed team to setup AWS infrastructure, CI/CD and Agile processes for development
· Drove the development of multiple backend integrations using Python and Selenium
Founding Engineer SomeYCCo (YC W13) San Francisco 09/2013 - 09/2014
· Instrumental in scaling the infrastructure of a Ruby on Rails/PostgreSQL + Angular + Node/Redis stack to support over 1 million registered users and 5,000 concurrent connections
· Played a key role in enhancing team capabilities through strategic recruitment and fostering a collaborative environment
· Optimized Postgres performance for high-speed data processing and management, directly contributing to the platform's scalability and efficiency
· Built and deployed in-house sensitive media detector, which was fundamental to Padlet’s capacity to grow
CTO/Co-founder SecondCo 03/2008 - 08/2013
· Led the architectural design and server infrastructure setup, incorporating SIP/voice integrations with telecom providers to create the most advanced online SaaS phone platform in Latin America at the time
· Built a REST API for voice applications, using Ruby on Rails/PostgreSQL
· Typical clients were top brands in Insurance, Banking, Finance, Retail, Telecommunications
Founding Engineer SomeCo (acquired by Groupon) 03/2007 - 01/2008
· First hire, wrote first few versions of the application using CakePHP, setup Postgres database and server infrastructure as well as testing
Education
UC Berkeley 2005
CS / IEOR
Supervised Machine Learning, by Andrew Ng - Coursera 2017"""
output_format="""{
"company_name": "CodeWeavers",
"available_positions": [
{
"position": "Wine and General Open Source Developers",
"link": "https://www.codeweavers.com/about/jobs"
}
],
"tech_stack_description": "C-language systems programming",
"use_rails": "No",
"use_python": "No",
"remote_positions": "Yes",
"hiring_in_us": "Yes",
"how_to_apply": "Apply through our website, here is the link: https://www.codeweavers.com/about/jobs",
"back_ground_with_priority": null,
"fit_for_resume": "No",
"fit_justification": "The position is for Wine and Open Source developers, neither of which the resume has experience with. The job is remote in the US"
}"""
roles="backend engineer, or fullstack engineer, or senior engineer, or senior tech lead, or engineering manager, or senior enginering manager, or founding engineer, or founding fullstack engineer, or something like similar"
ideal_job_questions="and the company uses either Ruby, Rails, Ruby on Rails, or Python (not Java, not C++, not C#, not Grails), the role doesn't require knowledge of [ML, Machine Learning, PyTorch, training models], the position is remote, it's for the US and the description matches the resume? (Yes or No), justify the Yes or No about the role being a good fit for the experience of the resume in one sentence."
prompt=f"Given the below text of a job listing and resume, please provide the following information about the listing (output in JSON format, use this example for reference, always with the same keys: \n{output_format}): company name, [list of available positions, with individual corresponding links if available], tech stack description, do they use rails? (Yes or No), do they use python? (Yes or No), are the positions remote (not hybrid, not onsite)? (Yes or No), are they hiring in the US? (Yes or No), how to apply to the job? (provide 1 sentence max description, include link or email address if necessary), Does the role prioritize candidates with a background in a specific industry sector (e.g., tech, finance, healthcare)?, does the job seem like a good fit for the resume (Only say Yes if the role is for {roles} {ideal_job_questions}\n\njob listing:\n{job_text}\n\nhtml of job listing (extract full url for links from here):\n{job_html}\n\nresume:\n{resume}\n"
chat_completion = await client.chat.completions.create(
messages=[
{
"role": "user",
"content": prompt,
}
],
model="gpt-3.5-turbo",
)
answer = chat_completion.choices[0].message.content
print(answer)
# Save the GPT interaction to the database
cursor.execute("INSERT INTO gpt_interactions (job_id, prompt, answer) VALUES (?, ?, ?)", (job_id, prompt, answer))
conn.commit()
asyncio.run(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment