Spaces:
Sleeping
Sleeping
Update help_me_talk.py
Browse files- help_me_talk.py +8 -8
help_me_talk.py
CHANGED
@@ -4,7 +4,7 @@ import openai
|
|
4 |
openai.api_key = os.getenv("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")
|
5 |
|
6 |
def helpTalk(input):
|
7 |
-
|
8 |
model="text-davinci-003",
|
9 |
prompt="Read the users input and respond in such a manner that user is bound to reply.\nInput : I am fine. \n\nOutput : That's great to hear! How has your day been?\n/#/#\nInput :",
|
10 |
temperature=0.7,
|
@@ -13,10 +13,10 @@ def helpTalk(input):
|
|
13 |
frequency_penalty=0,
|
14 |
presence_penalty=0,
|
15 |
stop=["/#/#"]
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
4 |
openai.api_key = os.getenv("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")
|
5 |
|
6 |
def helpTalk(input):
|
7 |
+
response = openai.Completion.create(
|
8 |
model="text-davinci-003",
|
9 |
prompt="Read the users input and respond in such a manner that user is bound to reply.\nInput : I am fine. \n\nOutput : That's great to hear! How has your day been?\n/#/#\nInput :",
|
10 |
temperature=0.7,
|
|
|
13 |
frequency_penalty=0,
|
14 |
presence_penalty=0,
|
15 |
stop=["/#/#"]
|
16 |
+
)
|
17 |
+
text = response["choices"][0]["text"]
|
18 |
+
text = text.replace("\n","")
|
19 |
+
start = text.find("Output:") + 5
|
20 |
+
end = len(text)
|
21 |
+
text = text[start:end].strip()
|
22 |
+
return text
|