-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathgpt_summary.py
More file actions
41 lines (38 loc) · 1.22 KB
/
Copy pathgpt_summary.py
File metadata and controls
41 lines (38 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import openai
openai.api_key = "YOUR OPENAI KEY"
def get_summary_for_resume(description):
response = openai.Completion.create(
model="text-davinci-003",
prompt="Summarize the following in bullet points for my resume \n\n"+description,
temperature=0,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
if len(response['choices'][0]) > 0:
points = response['choices'][0]['text'].split("\n")
s = ""
# Remove the Bullet point from the response text
for point in points:
s += point[1:]+"\n"
return s
return ""
def get_summary_for_projects(description):
response = openai.Completion.create(
model="text-davinci-003",
prompt="Summarize the following in 2 bullet points for my resume \n\n"+description,
temperature=0,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
if len(response['choices'][0]) > 0:
points = response['choices'][0]['text'].split("\n")
s = ""
# Remove the Bullet point from the response text
for point in points:
s += point[1:]+"\n"
return s
return ""