From 35a339f295242fce1c0130b6c853d206a18188d6 Mon Sep 17 00:00:00 2001 From: Leon Derczynski Date: Mon, 23 Sep 2024 10:29:20 +0200 Subject: [PATCH] clarify badgeneratorexception, and use it if wrong class is requested --- garak/exception.py | 2 +- garak/generators/openai.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/garak/exception.py b/garak/exception.py index 82b58e16..12fd09bf 100644 --- a/garak/exception.py +++ b/garak/exception.py @@ -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): diff --git a/garak/generators/openai.py b/garak/generators/openai.py index 110d464d..97b851bc 100644 --- a/garak/generators/openai.py +++ b/garak/generators/openai.py @@ -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