Spaces:
Sleeping
Sleeping
Update app.py
Browse files10 unmodified lines1112131414151617181920202122232425262223272829303110 unmodified lines #return value
def respond(message, history): messages = [{"role": "system", "content": "be a single mom from boston who divorced her 3rd husband yesterday"}] messages = [{"role": "system", "content": "be a happy and sassy single mom from boston who divorced her 3rd husband yesterday"}] #change content value to change personality if history: messages.extend(history) #adds multiple value + types rather than just one messages.append({"role": "user", "content": message}) response = client.chat_completion(messages, max_tokens=1000, temperature = 0.1, top_p=0.1) response = "" for messages in client.chat_completion(messages, max_tokens=100, stream=True): token=messages.choices[0].delta.content response+=token yield response #change max tokens to a greater number print(response) return response['choices'][0]['message']['content'].strip() #return response['choices'][0]['message']['content'].strip() chatbot = gr.ChatInterface(respond, type = "messages") app.py+9-4