testing Anthropic Sonnet 3.7 reasoning
Browse files
app/helpers/exercise_standardizer.py
CHANGED
|
@@ -72,13 +72,13 @@ async def structurize_exercise(
|
|
| 72 |
|
| 73 |
return exercise_set
|
| 74 |
|
| 75 |
-
|
| 76 |
def exercise_to_string(ex):
|
| 77 |
choices = [ex.choice_id_1, ex.choice_id_2, ex.choice_id_3, ex.choice_id_4]
|
| 78 |
-
choice_texts = [f" {idx + 1}) {choice}" for idx, choice in enumerate(choices) if choice]
|
| 79 |
|
| 80 |
correct_choice_text = next(
|
| 81 |
-
(f" Correct answer: {idx + 1}
|
| 82 |
for idx, choice in enumerate(choices) if choice == ex.correct_answer_id),
|
| 83 |
" Correct answer: Unknown"
|
| 84 |
)
|
|
|
|
| 72 |
|
| 73 |
return exercise_set
|
| 74 |
|
| 75 |
+
# unpacking a structurized exercise for display
|
| 76 |
def exercise_to_string(ex):
|
| 77 |
choices = [ex.choice_id_1, ex.choice_id_2, ex.choice_id_3, ex.choice_id_4]
|
| 78 |
+
choice_texts = [f" {idx + 1}) {choice}" for idx, choice in enumerate(choices) if choice and choice != 'None']
|
| 79 |
|
| 80 |
correct_choice_text = next(
|
| 81 |
+
(f" Correct answer: {idx + 1}. {choice}"
|
| 82 |
for idx, choice in enumerate(choices) if choice == ex.correct_answer_id),
|
| 83 |
" Correct answer: Unknown"
|
| 84 |
)
|
config/llm_config.py
CHANGED
|
@@ -29,6 +29,13 @@ def create_openai_reasoning_llm(model_name: str, reasoning_effort: str = None):
|
|
| 29 |
def create_anthropic_llm(model_name: str, temperature: float):
|
| 30 |
return ChatAnthropic(api_key=ANTHROPIC_API_KEY, model_name=model_name, temperature=temperature)
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
def create_deepseek_llm(model_name: str, temperature: float):
|
| 33 |
return ChatAnthropic(api_key=ANTHROPIC_API_KEY, model_name=model_name, temperature=temperature)
|
| 34 |
|
|
@@ -57,6 +64,7 @@ llms = {
|
|
| 57 |
"Claude 3.5 (high temp)": create_anthropic_llm("claude-3-5-sonnet-latest", HIGH),
|
| 58 |
"Claude 3.5 Haiku (zero temp)": create_anthropic_llm("claude-3-5-haiku-latest", ZERO),
|
| 59 |
"Claude 3.5 Haiku (low temp)": create_anthropic_llm("claude-3-5-haiku-latest", LOW),
|
|
|
|
| 60 |
|
| 61 |
# DeepSeek
|
| 62 |
"Deepseek R1 (zero temp)🚧": create_anthropic_llm("deepseek-reasoner", ZERO),
|
|
|
|
| 29 |
def create_anthropic_llm(model_name: str, temperature: float):
|
| 30 |
return ChatAnthropic(api_key=ANTHROPIC_API_KEY, model_name=model_name, temperature=temperature)
|
| 31 |
|
| 32 |
+
def create_anthropic_reasoning_llm(model_name: str, reasoning_effort: str = None):
|
| 33 |
+
# If reasoning_effort is provided, pass it; otherwise, avoid sending the parameter.
|
| 34 |
+
if reasoning_effort:
|
| 35 |
+
return ChatAnthropic(api_key=ANTHROPIC_API_KEY, model_name=model_name, reasoning_effort=reasoning_effort)
|
| 36 |
+
else:
|
| 37 |
+
return ChatAnthropic(api_key=ANTHROPIC_API_KEY, model_name=model_name)
|
| 38 |
+
|
| 39 |
def create_deepseek_llm(model_name: str, temperature: float):
|
| 40 |
return ChatAnthropic(api_key=ANTHROPIC_API_KEY, model_name=model_name, temperature=temperature)
|
| 41 |
|
|
|
|
| 64 |
"Claude 3.5 (high temp)": create_anthropic_llm("claude-3-5-sonnet-latest", HIGH),
|
| 65 |
"Claude 3.5 Haiku (zero temp)": create_anthropic_llm("claude-3-5-haiku-latest", ZERO),
|
| 66 |
"Claude 3.5 Haiku (low temp)": create_anthropic_llm("claude-3-5-haiku-latest", LOW),
|
| 67 |
+
"Claude 3.7": create_anthropic_reasoning_llm("claude-3-7-sonnet-latest"),
|
| 68 |
|
| 69 |
# DeepSeek
|
| 70 |
"Deepseek R1 (zero temp)🚧": create_anthropic_llm("deepseek-reasoner", ZERO),
|