-
Notifications
You must be signed in to change notification settings - Fork 0
/
openaitext.py
39 lines (36 loc) · 1.18 KB
/
openaitext.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
33
34
35
36
37
38
39
import os
import openai
from config import apikey
openai.api_key = apikey
response = openai.ChatCompletion.create(
model="text-davinci-003",
prompt= "Write an email",
# messages=[],
temperature=1,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
print(response)
'''
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"text": "\n\nSubject: Resignation\n\nDear [Name],\n\nI am writing to inform you of my intention to resign from my current position at [Company]. My last day of work will be [date].\n\nI have enjoyed my time at [Company], and I am grateful for the opportunity to work here. I have learned a great deal during my time in this position, and I am grateful for the experience.\n\nIf I can be of any assistance during this transition, please do not hesitate to ask.\n\nThank you for your understanding.\n\nSincerely,\n[Your Name]"
}
],
"created": 1683815400,
"id": "cmpl-7F1aqg7BkzIY8vBnCxYQh8Xp4wO85",
"model": "text-davinci-003",
"object": "text_completion",
"usage": {
"completion_tokens": 125,
"prompt_tokens": 9,
"total_tokens": 134
}
}
'''