-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4_blogger.py
32 lines (27 loc) · 839 Bytes
/
4_blogger.py
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
from ai_devs import get_task, get_token, send_task
from openai import OpenAI
client = OpenAI()
token = get_token("blogger")
task = get_task(token, True)
ans = []
for chapter in task["blog"]:
m = [
{
"role": "system",
"content": "Jesteś blogerem kuchennym. Twoim zadaniem jest opisać poszczególne etapy wykonywania pizzy Margheritta",
},
]
for a in ans:
m.append({"role": "user", "content": a[0]})
m.append({"role": "assistant", "content": a[1]})
m.append(
{"role": "user", "content": chapter},
)
response = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=m,
)
print("# " + chapter)
print(response.choices[0].message.content)
ans.append(response.choices[0].message.content)
send_task(token, ans)