forked from dagu-org/dagu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chatgpt.yaml
48 lines (45 loc) · 1.21 KB
/
chatgpt.yaml
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
42
43
44
45
46
47
48
params: QUESTION="what is your favorite activity?"
steps:
- name: ask chatgpt
executor:
type: http
config:
timeout: 180
headers:
Authorization: "Bearer $OPENAI_API_KEY"
Content-Type: "application/json"
silent: true
body: |
{ "model": "gpt-3.5-turbo", "messages": [
{"role": "system", "content": "You are a philosopher of the Roman Imperial Period"},
{"role": "user", "content": "$QUESTION"}
]
}
command: POST https://api.openai.com/v1/chat/completions
output: API_RESPONSE
- name: get result
executor:
type: jq
config:
raw: true
command: ".choices[0].message.content"
script: "$API_RESPONSE"
output: MESSAGE_CONTENT
depends:
- ask chatgpt
- name: send mail
executor:
type: mail
config:
to: "$MY_EMAIL"
from: "$MY_EMAIL"
subject: "philosopher's reply"
message: |
<html>
<body>
<div>$QUESTION</div>
<div>$MESSAGE_CONTENT<div>
</body>
</html>
depends:
- get result