JLW commited on
Commit
871867f
·
1 Parent(s): 99a7e94

Update error messages

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -145,9 +145,9 @@ def transform_text(desc, express_chain, num_words, formality,
145
  elif literary_style == "Summary":
146
  literary_style_str = "as a summary, "
147
  elif literary_style == "Outline":
148
- literary_style_str = "as an outline numbers and lower case letters"
149
  elif literary_style == "Bullets":
150
- literary_style_str = "as bullet points using bullets"
151
  elif literary_style == "Poetry":
152
  literary_style_str = "as a poem, "
153
  elif literary_style == "Haiku":
@@ -239,13 +239,13 @@ def run_chain(chain, inp, capture_hidden_text):
239
  except AuthenticationError as ae:
240
  error_msg = AUTH_ERR_MSG
241
  except RateLimitError as rle:
242
- error_msg = AUTH_ERR_MSG
243
  except ValueError as ve:
244
- error_msg = "\n\nValueError."
245
  except InvalidRequestError as ire:
246
- error_msg = "\n\nInvalidRequestError."
247
  except Exception as e:
248
- error_msg = "\n\nException."
249
 
250
  sys.stdout = tmp
251
  hidden_text = hidden_text_io.getvalue()
@@ -276,13 +276,13 @@ def run_chain(chain, inp, capture_hidden_text):
276
  except AuthenticationError as ae:
277
  output = AUTH_ERR_MSG
278
  except RateLimitError as rle:
279
- output = AUTH_ERR_MSG
280
  except ValueError as ve:
281
- output = "\n\nValueError."
282
  except InvalidRequestError as ire:
283
- output = "\n\nInvalidRequestError."
284
  except Exception as e:
285
- output = "\n\nException."
286
 
287
  return output, hidden_text
288
 
@@ -291,6 +291,7 @@ class ChatWrapper:
291
 
292
  def __init__(self):
293
  self.lock = Lock()
 
294
  def __call__(
295
  self, api_key: str, inp: str, history: Optional[Tuple[str, str]], chain: Optional[ConversationChain],
296
  trace_chain: bool, speak_text: bool, express_chain: Optional[LLMChain],
 
145
  elif literary_style == "Summary":
146
  literary_style_str = "as a summary, "
147
  elif literary_style == "Outline":
148
+ literary_style_str = "as an outline numbers and lower case letters, "
149
  elif literary_style == "Bullets":
150
+ literary_style_str = "as bullet points using bullets, "
151
  elif literary_style == "Poetry":
152
  literary_style_str = "as a poem, "
153
  elif literary_style == "Haiku":
 
239
  except AuthenticationError as ae:
240
  error_msg = AUTH_ERR_MSG
241
  except RateLimitError as rle:
242
+ error_msg = "\n\nRateLimitError: " + str(rle)
243
  except ValueError as ve:
244
+ error_msg = "\n\nValueError: " + str(ve)
245
  except InvalidRequestError as ire:
246
+ error_msg = "\n\nInvalidRequestError: " + str(ire)
247
  except Exception as e:
248
+ error_msg = "\n\n" + BUG_FOUND_MSG + ":\n\n" + str(e)
249
 
250
  sys.stdout = tmp
251
  hidden_text = hidden_text_io.getvalue()
 
276
  except AuthenticationError as ae:
277
  output = AUTH_ERR_MSG
278
  except RateLimitError as rle:
279
+ output = "\n\nRateLimitError: " + str(rle)
280
  except ValueError as ve:
281
+ output = "\n\nValueError: " + str(ve)
282
  except InvalidRequestError as ire:
283
+ output = "\n\nInvalidRequestError: " + str(ire)
284
  except Exception as e:
285
+ output = "\n\n" + BUG_FOUND_MSG + ":\n\n" + str(e)
286
 
287
  return output, hidden_text
288
 
 
291
 
292
  def __init__(self):
293
  self.lock = Lock()
294
+
295
  def __call__(
296
  self, api_key: str, inp: str, history: Optional[Tuple[str, str]], chain: Optional[ConversationChain],
297
  trace_chain: bool, speak_text: bool, express_chain: Optional[LLMChain],