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