We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c7e4c72 commit add6676Copy full SHA for add6676
chap02/03/main.py
@@ -0,0 +1,17 @@
1
+from openai import OpenAI
2
+
3
+client = OpenAI()
4
5
+completion = client.chat.completions.create(
6
+ model="gpt-4o-mini",
7
+ messages=[
8
+ {"role": "system", "content": "You are a helpful assistant."},
9
+ {
10
+ "role": "user",
11
+ "content": "Write a haiku about recursion in programming."
12
+ }
13
+ ]
14
+)
15
+# Returns a chat completion object
16
+print(completion)
17
+print(completion.choices[0].message)
0 commit comments