Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added special case to support Anthropic Critique #1862

Merged
merged 1 commit into from
Oct 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/helm/proxy/clients/model_critique_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from helm.proxy.clients.client import Client
from helm.proxy.clients.critique_client import CritiqueClient

import anthropic
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle anthropic as an optional dependency like this.



class CritiqueParseError(Exception):
pass
Expand Down Expand Up @@ -61,6 +63,12 @@ def _task_to_requests(self, task: CritiqueTaskTemplate, fields: Dict[str, str])
max_tokens = len(question.options) * 2
else:
max_tokens = 1

# Special case for Anthropic to handle prefix and suffix.
# TODO(josselin): Fix this once refactor of HELM allows for automatic model prefix and suffix.
if self._model_name.startswith("anthropic"):
prompt = anthropic.HUMAN_PROMPT + prompt + anthropic.AI_PROMPT

request = Request(
model=self._model_name,
prompt=prompt,
Expand Down
Loading