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