improve response handling (#71)

This commit is contained in:
Adil Hafeez 2024-09-23 22:56:35 -07:00 committed by GitHub
parent 79b1c5415f
commit eff4cd9826
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 51 additions and 51 deletions

View file

@ -33,8 +33,8 @@ def predict(message, history):
# remove last user message in case of exception
history.pop()
log.info("CHAT_COMPLETION_ENDPOINT: ", CHAT_COMPLETION_ENDPOINT)
log.info("Error with OpenAI API: {}".format(e.message))
raise gr.Error("Error with OpenAI API: {}".format(e.message))
log.info("Error calling gateway API: {}".format(e.message))
raise gr.Error("Error calling gateway API: {}".format(e.message))
# for chunk in response:
# if chunk.choices[0].delta.content is not None: