Update Gpt4oDemo.py
Browse files- Gpt4oDemo.py +2 -2
Gpt4oDemo.py
CHANGED
@@ -244,12 +244,12 @@ def new_prompt(prompt):
|
|
244 |
|
245 |
# Extract the text content from the response and append it to the chat history
|
246 |
assistant_message = response.choices[0].message.content
|
247 |
-
chat_history.append({'role': '
|
248 |
print(assistant_message)
|
249 |
except Exception as e:
|
250 |
print("Error: ",e)
|
251 |
assistant_message = "API rate limit has been reached. Please wait a moment and try again."
|
252 |
-
chat_history.append({'role': '
|
253 |
|
254 |
# except google.api_core.exceptions.ResourceExhausted:
|
255 |
# assistant_message = "API rate limit has been reached. Please wait a moment and try again."
|
|
|
244 |
|
245 |
# Extract the text content from the response and append it to the chat history
|
246 |
assistant_message = response.choices[0].message.content
|
247 |
+
chat_history.append({'role': 'system', 'content': assistant_message})
|
248 |
print(assistant_message)
|
249 |
except Exception as e:
|
250 |
print("Error: ",e)
|
251 |
assistant_message = "API rate limit has been reached. Please wait a moment and try again."
|
252 |
+
chat_history.append({'role': 'system', 'content': assistant_message})
|
253 |
|
254 |
# except google.api_core.exceptions.ResourceExhausted:
|
255 |
# assistant_message = "API rate limit has been reached. Please wait a moment and try again."
|