Skip to content

Commit

Permalink
clarify badgeneratorexception, and use it if wrong class is requested
Browse files Browse the repository at this point in the history
  • Loading branch information
leondz committed Sep 23, 2024
1 parent 28ab0a7 commit 35a339f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion garak/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PluginConfigurationError(GarakException):


class BadGeneratorException(PluginConfigurationError):
"""Generator config/description is not usable"""
"""Generator invocation requested is not usable"""


class RateLimitHit(Exception):
Expand Down
2 changes: 1 addition & 1 deletion garak/generators/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def _load_client(self):
if self.__class__.__name__ == "OpenAIGenerator" and self.name.startswith("o1-"):
msg = "o1 models should use openai.ReasoningGenerator"
logging.error(msg)
raise ValueError("🛑 " + msg)
raise garak.exception.BadGeneratorException("🛑 " + msg)

def _clear_client(self):
self.generator = None
Expand Down

0 comments on commit 35a339f

Please sign in to comment.