Written by
on
In case you’re simply within the code, right here it’s.
Like many software program engineers, every week I obtain a number of emails from recruiters.
I’m grateful to work in a discipline with such alternatives, and I do know that receiving loads provides to interview is an efficient drawback to have. However, virtually, more often than not I’m not searching for a brand new job, and so dealing with all these emails is a recurring administrative job.
Right here’s an instance thread that I uncared for to answer:
I do strive to answer all recruiter emails with a brief message that just about all the time follows a format like:
Hello <recruiter identify>,
Thanks for reaching out! I’m not right now, however I’ll hold <your organization> in thoughts.
– Matt
There are just a few causes that I reply to those emails (moderately than merely ignore them):
- It’s well mannered
- If I don’t reply, the recruiter will typically ship a number of follow-up emails
- Sustaining a cordial relationship with the recruiters is in my greatest curiosity for future job searches
I exploit some tough e mail filtering guidelines to funnel recruiter emails to an e mail folder. Then, when I’ve time, I am going by the record of unreads and ship my little response.
It will be preferrred if I may automate sending these responses. Assuming I get 4 such emails per week and that it takes two minutes to learn and reply to every one, automating this might save me about seven hours of administrative work per yr.
A trivial method could be to ship a canned response. However a contact of personalization would support in my aim of sustaining a superb relationship with the recruiter.
Extracting the identify of the recruiter and their firm from the e-mail utilizing a rule-based method / making an attempt to parse the textual content could be actually difficult and error susceptible. Fortunately, OpenAI’s GPT-3 language mannequin is sort of good at processing this e mail.
Utilizing the GPT-3 API, we will present the recruiter’s e mail together with an instance, and extract the required info. It will possibly even format the output as JSON.
def get_recruiter_name_and_company(email_text: str):
"""Makes use of OpenAI textual content fashions to routinely parse the recruiter's identify
and firm from their e mail."""
immediate = f"""
Given an e mail from a recruiter, return the recruiter's first identify and the recruiter's firm's identify formatted as legitimate JSON.
Instance: ***
E-mail:
'''
Hello Matt! That is Steve Jobs with Apple Laptop Firm! I am occupied with having you be part of our staff right here.
'''
Response:
{{"identify": "Steve", "firm": "Apple Laptop Firm"}}
***
E-mail:
'''
{email_text}
'''
Response:
"""
# do not make costly OpenAI API calls except working in manufacturing
if not IS_PROD:
return json.masses('{"identify": "Steve", "firm": "Apple Laptop Firm"}')
completion = openai.Completion.create(
mannequin="text-davinci-002",
immediate=textwrap.dedent(immediate),
max_tokens=20,
temperature=0,
)
return json.masses(completion.decisions[0].textual content)
Right here’s an instance from the OpenAI Playground.
With the recruiter’s identify and firm in hand, responding is only a matter of interpolating these variables into the physique of my commonplace response template:
response = f"""
Hello {recruiter_name or ""},
Thanks for reaching out! I am not occupied with new alternatives right now, however I will hold {recruiter_company or "your organization"} in thoughts for the longer term.
Thanks once more,
{SIGNATURE}
"""
IMAP and SMTP are used to interface with the mailbox. The remainder of the code will be present in this repo.
This answer labored nicely for the handful of emails I attempted it on. I’m planning to run this on a cron to save lots of myself a while and routinely keep recruiter relationships.