Spaces:
Sleeping
Sleeping
File size: 697 Bytes
81ea4dd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import os
import openai
openai.api_key = os.getenv("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")
def helpTalk(input):
response = openai.Completion.create(
model="text-davinci-003",
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 :",
temperature=0.7,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0,
stop=["/#/#"]
)
text = response["choices"][0]["text"]
text = text.replace("\n","")
start = text.find("Output:") + 5
end = len(text)
text = text[start:end].strip()
return text |