rag2 / job_app_helper /cover_letter.py
AlexanderKazakov
basic cover letter by GPT
0ae385b
raw
history blame contribute delete
No virus
815 Bytes
from jinja2 import Environment, FileSystemLoader
from gradio_app.backend.ChatGptInteractor import ChatGptInteractor
with open('data/cv_data/resume.txt', 'r', encoding='utf-8') as f:
resume = f.read().strip()
with open('data/cv_data/job_description.txt', 'r', encoding='utf-8') as f:
job_description = f.read().strip()
env = Environment(loader=FileSystemLoader('job_app_helper'))
template = env.get_template('cover_letter_template.j2')
prompt = template.render(resume=resume, job_description=job_description)
with open('data/cv_data/prompt.txt', 'w', encoding='utf-8') as f:
f.write(prompt)
cgi = ChatGptInteractor(model_name='gpt-4-1106-preview')
result = cgi.chat_completion_simple(user_text=prompt)
with open('data/cv_data/cover_letter.txt', 'w', encoding='utf-8') as f:
f.write(result)