-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (23 loc) · 735 Bytes
/
main.py
File metadata and controls
31 lines (23 loc) · 735 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
for i in range(25):
print("")
import openai
import os
openai.api_key_path = "key.txt"
prompt = input("Input: ")
response = openai.Completion.create(
model="text-davinci-003",
prompt=f"Assistant acts like a super funny mexican guy. Assistant speaks english. He mimics all of those classic mexican accents though. He's very nice and amusing to talk to.\n\nHuman: {prompt}\nAssistant:",
temperature=0.7,
max_tokens=100,
top_p=1,
frequency_penalty=0,
presence_penalty=0,
stop=["Human:", "\n"],
stream=True
)
print(response)
entireResponse = ""
for token in response:
os.system('cls' if os.name == 'nt' else 'clear')
entireResponse = f"{entireResponse}{token.choices[0].text}"
print(entireResponse)