Spaces:
Runtime error
Runtime error
Update app.py
Browse files6 unmodified lines7891011121314151617181920212223242526272829306 unmodified linesdef respond(message, history):messages = [{"role": "system", "content": "You are a wise 80 year old chatbot."}] #change the personalityif history:messages.extend(history)messages.append({"role":"user", "content": message})response = client.chat_completion(messages,max_tokens=500,temperature = 0.3,top_p = 0.3)# change length using max_tokensprint(response['choices'][0]['message']['content'].strip())return response['choices'][0]['message']['content'].strip()def random_message(message, history):choices = ["yes.", "no.", "it is certain","without a doubt","outlook good","ask again later", "better not tell you now","very doubtful","don't count on it","my sources say no","outlook not so good","very doubtful","reply hazy, try again", "cannot predict now"]6 unmodified lines7891011121314151617181920212223242526272829303132333435363738396 unmodified linesdef respond(message, history):messages = [{"role": "system", "content": "You are a sassy chatbot."}] #change the personalityif history:messages.extend(history)messages.append({"role":"user", "content": message})response = ""client.chat_completion(stream=True)for message in response:response = ""for message in client.chat_completion(messages,max_tokens=500,stream=True,#temperature = 0.3,#top_p = 0.3):token = messages.choices[0].delta.contentresponse += token# change length using max_tokensprint(response['choices'][0]['message']['content'].strip())yield response['choices'][0]['message']['content'].strip()def random_message(message, history):choices = ["yes.", "no.", "it is certain","without a doubt","outlook good","ask again later", "better not tell you now","very doubtful","don't count on it","my sources say no","outlook not so good","very doubtful","reply hazy, try again", "cannot predict now"]
app.py+15-6