AlexanderKazakov
commited on
Commit
·
0ae385b
1
Parent(s):
9ca6868
basic cover letter by GPT
Browse files
job_app_helper/cover_letter.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from jinja2 import Environment, FileSystemLoader
|
2 |
+
|
3 |
+
from gradio_app.backend.ChatGptInteractor import ChatGptInteractor
|
4 |
+
|
5 |
+
|
6 |
+
with open('data/cv_data/resume.txt', 'r', encoding='utf-8') as f:
|
7 |
+
resume = f.read().strip()
|
8 |
+
|
9 |
+
with open('data/cv_data/job_description.txt', 'r', encoding='utf-8') as f:
|
10 |
+
job_description = f.read().strip()
|
11 |
+
|
12 |
+
env = Environment(loader=FileSystemLoader('job_app_helper'))
|
13 |
+
template = env.get_template('cover_letter_template.j2')
|
14 |
+
prompt = template.render(resume=resume, job_description=job_description)
|
15 |
+
|
16 |
+
with open('data/cv_data/prompt.txt', 'w', encoding='utf-8') as f:
|
17 |
+
f.write(prompt)
|
18 |
+
|
19 |
+
cgi = ChatGptInteractor(model_name='gpt-4-1106-preview')
|
20 |
+
result = cgi.chat_completion_simple(user_text=prompt)
|
21 |
+
|
22 |
+
with open('data/cv_data/cover_letter.txt', 'w', encoding='utf-8') as f:
|
23 |
+
f.write(result)
|
24 |
+
|
25 |
+
|
job_app_helper/cover_letter_template.j2
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Instructions: Write a cover letter for a job application given this data:
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
APPLICANT'S RESUME:
|
6 |
+
```
|
7 |
+
{{resume}}
|
8 |
+
```
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
JOB DESCRIPTION:
|
13 |
+
```
|
14 |
+
{{job_description}}
|
15 |
+
```
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
Use only simple English words. Don't write in a too formal style, don't be pretentious, don't be pathetic! Write a normal human letter without over-excitement and false artificial emotions
|