Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,14 +8,15 @@ def answer_chatgpt(api_key, message, history):
|
|
| 8 |
lista.append(message)
|
| 9 |
# OPENAI API KEY
|
| 10 |
openai.api_key = api_key
|
| 11 |
-
prompt =
|
| 12 |
-
response = openai.
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
| 16 |
)
|
| 17 |
# Displaying the answer on the screen
|
| 18 |
-
answer = response["choices"][0]["
|
| 19 |
history.append((message, answer))
|
| 20 |
return history, history
|
| 21 |
|
|
|
|
| 8 |
lista.append(message)
|
| 9 |
# OPENAI API KEY
|
| 10 |
openai.api_key = api_key
|
| 11 |
+
prompt = f"{message}"
|
| 12 |
+
response = openai.ChatCompletion.create(
|
| 13 |
+
model="gpt-3.5-turbo",
|
| 14 |
+
messages=[
|
| 15 |
+
{"role": "system", "content": f"{prompt}"},
|
| 16 |
+
]
|
| 17 |
)
|
| 18 |
# Displaying the answer on the screen
|
| 19 |
+
answer = response["choices"][0]["message"]["content"]
|
| 20 |
history.append((message, answer))
|
| 21 |
return history, history
|
| 22 |
|