Update app.py
Browse files
app.py
CHANGED
|
@@ -36,12 +36,12 @@ def call_openai_api(user_prompt):
|
|
| 36 |
try:
|
| 37 |
response = openai.ChatCompletion.create(
|
| 38 |
model="gpt-3.5-turbo",
|
|
|
|
| 39 |
messages=[
|
| 40 |
{"role": "system", "content": "You are a research assistant. Provide factual short answers to your prompts."},
|
| 41 |
{"role": "user", "content": f"{text}\n\n{user_prompt}"},
|
| 42 |
],
|
| 43 |
-
|
| 44 |
-
)
|
| 45 |
ai_response = response.choices[0].message['content']
|
| 46 |
chat_history += f"\nUser: {user_prompt}\nAI: {ai_response}"
|
| 47 |
return chat_history
|
|
|
|
| 36 |
try:
|
| 37 |
response = openai.ChatCompletion.create(
|
| 38 |
model="gpt-3.5-turbo",
|
| 39 |
+
stream="true",
|
| 40 |
messages=[
|
| 41 |
{"role": "system", "content": "You are a research assistant. Provide factual short answers to your prompts."},
|
| 42 |
{"role": "user", "content": f"{text}\n\n{user_prompt}"},
|
| 43 |
],
|
| 44 |
+
)
|
|
|
|
| 45 |
ai_response = response.choices[0].message['content']
|
| 46 |
chat_history += f"\nUser: {user_prompt}\nAI: {ai_response}"
|
| 47 |
return chat_history
|