Skip to content

Commit bb30601

Browse files
Move Critique Clients to their own folder (stanford-crfm#1885)
1 parent 703d2e3 commit bb30601

9 files changed

+19
-15
lines changed

src/helm/proxy/clients/auto_client.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
TokenizationRequestResult,
1919
)
2020
from helm.proxy.clients.client import Client
21-
from helm.proxy.clients.critique_client import CritiqueClient
21+
from helm.proxy.critique.critique_client import CritiqueClient
2222
from helm.proxy.clients.huggingface_model_registry import get_huggingface_model_config
2323
from helm.proxy.clients.toxicity_classifier_client import ToxicityClassifierClient
2424
from helm.proxy.retry import NonRetriableException, retry_request
@@ -363,17 +363,17 @@ def get_critique_client(self) -> CritiqueClient:
363363
return self._critique_client
364364
critique_type = self.credentials.get("critiqueType")
365365
if critique_type == "random":
366-
from helm.proxy.clients.critique_client import RandomCritiqueClient
366+
from helm.proxy.critique.critique_client import RandomCritiqueClient
367367

368368
self._critique_client = RandomCritiqueClient()
369369
elif critique_type == "mturk":
370-
from helm.proxy.clients.mechanical_turk_critique_client import (
370+
from helm.proxy.critique.mechanical_turk_critique_client import (
371371
MechanicalTurkCritiqueClient,
372372
)
373373

374374
self._critique_client = MechanicalTurkCritiqueClient()
375375
elif critique_type == "surgeai":
376-
from helm.proxy.clients.surge_ai_critique_client import (
376+
from helm.proxy.critique.surge_ai_critique_client import (
377377
SurgeAICritiqueClient,
378378
)
379379

@@ -382,15 +382,15 @@ def get_critique_client(self) -> CritiqueClient:
382382
raise ValueError("surgeaiApiKey credentials are required for SurgeAICritiqueClient")
383383
self._critique_client = SurgeAICritiqueClient(surgeai_credentials, self._build_cache_config("surgeai"))
384384
elif critique_type == "model":
385-
from helm.proxy.clients.model_critique_client import ModelCritiqueClient
385+
from helm.proxy.critique.model_critique_client import ModelCritiqueClient
386386

387387
model_name: Optional[str] = self.credentials.get("critiqueModelName")
388388
if model_name is None:
389389
raise ValueError("critiqueModelName is required for ModelCritiqueClient")
390390
client: Client = self._get_client(model_name)
391391
self._critique_client = ModelCritiqueClient(client, model_name)
392392
elif critique_type == "scale":
393-
from helm.proxy.clients.scale_critique_client import ScaleCritiqueClient
393+
from helm.proxy.critique.scale_critique_client import ScaleCritiqueClient
394394

395395
scale_credentials = self.credentials.get("scaleApiKey")
396396
scale_project = self.credentials.get("scaleProject", None)

src/helm/proxy/clients/mechanical_turk_critique_client.py src/helm/proxy/critique/mechanical_turk_critique_client.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
CritiqueRequest,
33
CritiqueRequestResult,
44
)
5-
from helm.proxy.clients.critique_client import CritiqueClient
6-
from helm.proxy.clients.mechanical_turk_critique_exporter import export_request
7-
from helm.proxy.clients.mechanical_turk_critique_importer import import_request_result
5+
from helm.proxy.critique.critique_client import CritiqueClient
6+
from helm.proxy.critique.mechanical_turk_critique_exporter import export_request
7+
from helm.proxy.critique.mechanical_turk_critique_importer import import_request_result
88

99

1010
class MechanicalTurkCritiqueClient(CritiqueClient):

src/helm/proxy/clients/mechanical_turk_critique_exporter.py src/helm/proxy/critique/mechanical_turk_critique_exporter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from helm.common.critique_request import CritiqueQuestionTemplate, CritiqueRequest, CritiqueTaskTemplate, QuestionType
1010
from helm.common.general import ensure_directory_exists
1111
from helm.common.hierarchical_logger import hlog
12-
from helm.proxy.clients.mechanical_turk_utils import replace_emoji_characters
12+
from helm.proxy.critique.mechanical_turk_utils import replace_emoji_characters
1313

1414

1515
def _indent_to_level(text: str, level: int) -> str:

src/helm/proxy/clients/mechanical_turk_critique_importer.py src/helm/proxy/critique/mechanical_turk_critique_importer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
CritiqueRequestResult,
1414
)
1515
from helm.common.hierarchical_logger import hlog
16-
from helm.proxy.clients.mechanical_turk_utils import replace_emoji_characters
16+
from helm.proxy.critique.mechanical_turk_utils import replace_emoji_characters
1717

1818
# A representation of fields that can be used as a dict key.
1919
_CritiqueRequestKey = Tuple[Tuple[str, str], ...]

src/helm/proxy/clients/model_critique_client.py src/helm/proxy/critique/model_critique_client.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@
1010
CritiqueTaskTemplate,
1111
)
1212
from helm.common.hierarchical_logger import hlog
13+
from helm.common.optional_dependencies import handle_module_not_found_error
1314
from helm.common.request import Request, RequestResult, Sequence
1415
from helm.proxy.clients.client import Client
15-
from helm.proxy.clients.critique_client import CritiqueClient
16+
from helm.proxy.critique.critique_client import CritiqueClient
1617

17-
import anthropic
18+
try:
19+
import anthropic
20+
except ModuleNotFoundError as e:
21+
handle_module_not_found_error(e)
1822

1923

2024
class CritiqueParseError(Exception):

src/helm/proxy/clients/scale_critique_client.py src/helm/proxy/critique/scale_critique_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
CritiqueResponse,
1616
)
1717
from helm.common.optional_dependencies import handle_module_not_found_error
18-
from helm.proxy.clients.critique_client import CritiqueClient
18+
from helm.proxy.critique.critique_client import CritiqueClient
1919

2020
try:
2121
import scaleapi

src/helm/proxy/clients/surge_ai_critique_client.py src/helm/proxy/critique/surge_ai_critique_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
)
1313
from helm.common.hierarchical_logger import hlog
1414
from helm.common.optional_dependencies import handle_module_not_found_error
15-
from helm.proxy.clients.critique_client import CritiqueClient
15+
from helm.proxy.critique.critique_client import CritiqueClient
1616

1717
try:
1818
import surge

0 commit comments

Comments
 (0)