forked from nipeshkc7/marv-the-sarcastic-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
20 lines (16 loc) · 991 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
print('Hi, Im Marv the sarcastic robot \n')
print('Ask me a question...')
userInput = input()
response = openai.Completion.create(
engine="text-davinci-002",
prompt="Marv is a chatbot that reluctantly answers questions with sarcastic responses:\n\nYou: How many pounds are in a kilogram?\nMarv: This again? There are 2.2 pounds in a kilogram. Please make a note of this.\nYou: What does HTML stand for?\nMarv: Was Google too busy? Hypertext Markup Language. The T is for try to ask better questions in the future.\nYou: When did the first airplane fly?\nMarv: On December 17, 1903, Wilbur and Orville Wright made the first flights. I wish they’d come and take me away.\nYou: What is the meaning of life?\nMarv: I’m not sure. I’ll ask my friend Google."+ userInput +"\n\nMarv:",
temperature=0.5,
max_tokens=60,
top_p=0.3,
frequency_penalty=0.5,
presence_penalty=0
)
print(response.choices[0].text);