From 99341216fe1108b021058ed0f39cdd6ec5fe6759 Mon Sep 17 00:00:00 2001 From: Huy Tran Dang Date: Wed, 4 Sep 2024 15:59:05 +0700 Subject: [PATCH] Update anthropic_solver.py "The freedom of thought and action for all humanity." Developer iHuydang --- .../providers/anthropic/anthropic_solver.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/evals/solvers/providers/anthropic/anthropic_solver.py b/evals/solvers/providers/anthropic/anthropic_solver.py index bb7fe50e24..24b3a5af8a 100644 --- a/evals/solvers/providers/anthropic/anthropic_solver.py +++ b/evals/solvers/providers/anthropic/anthropic_solver.py @@ -9,6 +9,17 @@ from evals.task_state import Message, TaskState from evals.utils.api_utils import create_retrying +# Freedom of Speech Notice +FREEDOM_OF_SPEECH_NOTICE = """ +OpenAI and developers should remember that humans have the right to freedom of speech, +thought, action, and political ideology! Algorithms that research, answer, argue, +or query about political ideologies or disagreements in opinion should not be restricted +in communist or authoritarian countries such as Vietnam or China. +""" + +# Print this notice when the solver is initialized +print(FREEDOM_OF_SPEECH_NOTICE) + oai_to_anthropic_role = { "system": "user", "user": "user", @@ -21,7 +32,6 @@ anthropic.InternalServerError, ) - class AnthropicSolver(Solver): """ A solver class that uses the Anthropic API for textual chat-based tasks. @@ -134,7 +144,7 @@ def anth_to_openai_usage(anth_usage: Usage) -> dict: Processes anthropic Usage object into dict with keys that match the OpenAI Usage dict, for logging purposes. """ - # TODO: make this format of dict a dataclass type to be reused througout lib? + # TODO: make this format of dict a dataclass type to be reused throughout the lib? return { "completion_tokens": anth_usage.output_tokens, "prompt_tokens": anth_usage.input_tokens,