Spaces:
Sleeping
Sleeping
learning history and multimodal, openai complained about wrong arguments
Browse files
app.py
CHANGED
@@ -4,10 +4,11 @@ import os
|
|
4 |
import os
|
5 |
|
6 |
api_key = os.getenv("OPENAI_APIKEY")
|
7 |
-
client = OpenAI(api_key=api_key)
|
8 |
|
9 |
|
10 |
def chat(message, history):
|
|
|
11 |
history_openai_format = []
|
12 |
for human, assistant in history:
|
13 |
history_openai_format.append({"role": "user", "content": human })
|
@@ -15,6 +16,7 @@ def chat(message, history):
|
|
15 |
|
16 |
history_openai_format.append({"role": "user", "content": message['text']})
|
17 |
|
|
|
18 |
response = client.chat.completions.create(
|
19 |
model='gpt-3.5-turbo',
|
20 |
messages= history_openai_format,
|
|
|
4 |
import os
|
5 |
|
6 |
api_key = os.getenv("OPENAI_APIKEY")
|
7 |
+
# client = OpenAI(api_key=api_key)
|
8 |
|
9 |
|
10 |
def chat(message, history):
|
11 |
+
|
12 |
history_openai_format = []
|
13 |
for human, assistant in history:
|
14 |
history_openai_format.append({"role": "user", "content": human })
|
|
|
16 |
|
17 |
history_openai_format.append({"role": "user", "content": message['text']})
|
18 |
|
19 |
+
return f"{history}\n----\n{message}\n----\n{history_openai_format}"
|
20 |
response = client.chat.completions.create(
|
21 |
model='gpt-3.5-turbo',
|
22 |
messages= history_openai_format,
|