-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopen_ai_api.py
More file actions
31 lines (24 loc) · 1.19 KB
/
open_ai_api.py
File metadata and controls
31 lines (24 loc) · 1.19 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
from openai import OpenAI
client = OpenAI(api_key='')
completion = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": '''Summarize the given doc:
The Flutter project expects Flutter's contributors to act professionally
and respectfully. Flutter contributors are expected to maintain the safety
and dignity of Flutter's social environments (such as GitHub and Discord).
Specifically:
* Respect people, their identities, their culture, and their work.
* Be kind. Be courteous. Be welcoming.
* Listen. Consider and acknowledge people's points before responding.
Should you experience anything that makes you feel unwelcome in Flutter's
community, please contact [conduct@flutter.dev](mailto:conduct@flutter.dev)
or, if you prefer, directly contact someone on the project, for instance
[Hixie](mailto:ian@hixie.ch).
The Flutter project will not tolerate harassment in Flutter's
community, even outside of Flutter's public communication channels.
'''},
{"role": "user", "content": "Compose a poem that explains the concept of recursion in programming."}
]
)
print(completion.choices[0].message)