Skip to content

Commit

Permalink
Print inference error message in log
Browse files Browse the repository at this point in the history
  • Loading branch information
orangetin committed Jul 13, 2023
1 parent 76cb412 commit bb0c619
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/together/commands/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,13 @@ def _run_complete(args: argparse.Namespace) -> None:
# TODO Add exception when generated_text has error, See together docs
try:
text = str(response["output"]["choices"][0]["text"])
except Exception as e:
logger.critical(f"Error raised: {e}")
exit_1(logger)
except Exception:
try:
logger.critical(f"Error raised: {response['output']['error']}")
exit_1(logger)
except Exception as e:
logger.critical(f"Error raised: {e}")
exit_1(logger)

if args.stop is not None:
# TODO remove this and permanently implement api stop_word
Expand Down

0 comments on commit bb0c619

Please sign in to comment.