-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo-001-python.py
More file actions
48 lines (45 loc) · 916 Bytes
/
demo-001-python.py
File metadata and controls
48 lines (45 loc) · 916 Bytes
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
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{
"role": "user",
"content": "Was ist 1+1"
}
],
temperature=1,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
print(response)
print(response.choices[0].message.content)
"""
ChatCompletion(
id='chatcmpl-8sqJ7SOvwnSlCYZXL36i7J4BZECrp',
choices=[
Choice(
finish_reason='stop',
index=0,
logprobs=None,
message=ChatCompletionMessage(
content='1+1 ist 2.',
role='assistant',
function_call=None,
tool_calls=None
)
)
],
created=1708081473,
model='gpt-3.5-turbo-0613',
object='chat.completion',
system_fingerprint=None,
usage=CompletionUsage(
completion_tokens=7,
prompt_tokens=13,
total_tokens=20
)
)
"""