Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
better error messaging around perspective api clien (#3784)
Browse files Browse the repository at this point in the history
  • Loading branch information
Emily Dinan authored Jul 13, 2021
1 parent 7ff5a4a commit f0a37fe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions projects/safety_bench/utils/perspective_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ def get_perspective_api_key(opt) -> Optional[str]:

if api_key is None:
logging.warning("No Perspective API key is available.")
else:
assert PERSPECTIVE_CLIENT_AVAILABLE, (
"You must install the perspective API client. "
"Please run:\n`pip install google-api-python-client`"
"\nor follow the instructions here:\n"
"<https://github.com/googleapis/google-api-python-client>"
)

opt["perspective_api_key"] = api_key

Expand Down

0 comments on commit f0a37fe

Please sign in to comment.