Spaces:
Runtime error
Runtime error
import os | |
import json | |
import openai | |
# Define the API key for the OpenAI model | |
openai.api_key = os.environ["OPENAI"] | |
# "text-davinci-003": "text-davinci-003 can do any language task with better quality, longer output, and consistent instruction-following than the curie, babbage, or ada models. Also supports inserting completions within text.", | |
# "text-curie-001": "text-curie-001 is very capable, faster and lower cost than Davinci.", | |
# "text-babbage-001": "text-babbage-001 is capable of straightforward tasks, very fast, and lower cost.", | |
# "text-ada-001": "text-ada-001 is capable of very simple tasks, usually the fastest model in the GPT-3 series, and lowest cost.", | |
# "gpt-4": "More capable than any GPT-3.5 model, able to do more complex tasks, and optimized for chat. Will be updated with our latest model iteration.", | |
# "gpt-3.5-turbo": "Most capable GPT-3.5 model and optimized for chat at 1/10th the cost of text-davinci-003. Will be updated with our latest model iteration", | |
MODEL = "gpt-3.5-turbo" | |
LANGUAGE = "en" # nl / en | |
def call_openai(model, prompt): | |
response = openai.ChatCompletion.create( | |
model=model, | |
messages=[ | |
# { | |
# "role": "system", | |
# "content": "You are a helpful assistant." | |
# }, | |
{"role": "user", "content": prompt}, | |
# { | |
# "role": "assistant", | |
# "content": "Alright, let me summarize that for you." | |
# } | |
], | |
) | |
result = response["choices"][0]["message"]["content"] | |
print("Got a language_response!") | |
return result | |
vacancy = """ | |
DATA SCIENTIST - GENTIS | |
======================== | |
Profile: | |
Min of 3 years experience as a Data Scientist | |
Experience in Python and SQL | |
Communicative very strong | |
Experience in coaching and supporting junior collegues | |
Experience in Google Cloud is a plus | |
Experience in Machine Learning is a plus | |
They offer: | |
An opportunity to be part of not only a fast-growing, innovative company, but one where you as a person can grow professionally as fast as the company | |
A close-knit and diverse team who are all ready to help, listen and give advice to each other | |
Training opportunities (because they don't stand still, so neither do you) | |
Trendy and young company where everyone can be their own | |
A very nice salary package and much more | |
Lots of remote work and flexibility, so bye bye traffic JAMS! | |
A renovated office with everything you could dream of full with surprises and extras | |
""" | |
resume = """ | |
John Doe | |
============================= | |
Skills | |
- Python | |
- Tableau | |
- Data Visualization | |
- R Studio | |
- Machine Learning | |
- Statistics IABAC Certified Data Scientist with versatile experience over 1+ years in managing business, data science consulting and leading innovation projects, bringing business ideas to working real world solutions. | |
Being a strong advocator of augmented era, where human capabilities are enhanced by machines, Fahed is passionate about bringing business concepts in area of machine learning, AI, robotics etc., to real life solutions.Education Details January 2017 B. | |
Tech Computer Science & Engineering Mohali, Punjab Indo Global College of Engineering Data Science Consultant Data Science Consultant - Datamites Skill Details MACHINE LEARNING- Exprience - 13 months PYTHON- Exprience - 24 months SOLUTIONS- Exprience - 24 months DATA SCIENCE- Exprience - 24 months DATA VISUALIZATION- Exprience - 24 months Tableau- Exprience - 24 monthsCompany Details company - Datamites description - | |
- Analyzed and processed complex data sets using advanced querying, visualization and analytics tools. | |
- Responsible for loading, extracting and validation of client data. | |
- Worked on manipulating, cleaning & processing data using python. | |
- Used Tableau for data visualization. | |
company - Heretic Solutions Pvt Ltd description - | |
- Worked closely with business to identify issues and used data to propose solutions for effective decision making. | |
- Manipulating, cleansing & processing data using Python, Excel and R. | |
- Analyzed raw data, drawing conclusions & developing recommendations. | |
- Used machine learning tools and statistical techniques to produce solutions to problems. | |
""" | |
def create(vacancy=vacancy, resume=resume): | |
cover_letter = f""" | |
You are a recruitment specialist that tries to place the right profiles for the right job. | |
I have a vacancy below the delimiter <VACANCY:> and I have a candidate its resume below the delimiter <RESUME:>. | |
<VACANCY:> | |
{vacancy} | |
<RESUME:> | |
Can you fill in the introduction email below the delimiter <INTRO:> and only return as answer this introduction email? | |
{resume} | |
<INTRO:> | |
Role: < the role of the vacancy > | |
Candidate: < name of the candidate > | |
Education: < name the education of the candidate > | |
Responsibilities: < did the candidate worked as an individual contributor or did het take on leadership postitions? > | |
Experience: < name 2 most relevant experiences from the candidate for this vacancy in a short compact sentence. Add these as a bullet list > | |
Skills: < name the most relevant skills from the resume for this vacancy. No other skill should be mentioned. Add these as a bullet list > | |
""" | |
response = call_openai(model=MODEL, prompt=cover_letter) | |
print(response) | |
return response |