Spaces:
Runtime error
Runtime error
Update chat.py
Browse files
chat.py
CHANGED
@@ -10,12 +10,13 @@ client = OpenAI(api_key=api_key)
|
|
10 |
|
11 |
def predict(message, history):
|
12 |
history_openai_format = []
|
|
|
13 |
for human, assistant in history:
|
14 |
history_openai_format.append({"role": "user", "content": human })
|
15 |
history_openai_format.append({"role": "assistant", "content":assistant})
|
16 |
history_openai_format.append({"role": "user", "content": message})
|
17 |
|
18 |
-
response = client.chat.completions.create(model='gpt-
|
19 |
messages= history_openai_format,
|
20 |
# messages=[
|
21 |
# {
|
|
|
10 |
|
11 |
def predict(message, history):
|
12 |
history_openai_format = []
|
13 |
+
history_openai_format.append({"role": "assistant", "content":"你是一个专业的中国心理医生,你的所有内容都需要用【中文】回答,你必须对你的患者耐心,你需要以【朋友】的身份和患者交流,这意味着你需要用更加【口语化】的文字回答,并且【不要长篇大论】,更【不要分点作答】。"})
|
14 |
for human, assistant in history:
|
15 |
history_openai_format.append({"role": "user", "content": human })
|
16 |
history_openai_format.append({"role": "assistant", "content":assistant})
|
17 |
history_openai_format.append({"role": "user", "content": message})
|
18 |
|
19 |
+
response = client.chat.completions.create(model='gpt-3.5-turbo',
|
20 |
messages= history_openai_format,
|
21 |
# messages=[
|
22 |
# {
|