modified: app.py

modified:   research/activity23-math.yaml
This commit is contained in:
Russell Ballestrini 2024-08-11 13:39:30 -04:00
parent f09d24aefc
commit 5c9ef230ae
2 changed files with 30 additions and 26 deletions

6
app.py
View file

@ -1870,6 +1870,8 @@ def loop_through_steps_until_question(
if not step:
break
feedback_tokens_for_ai = step.get("feedback_tokens_for_ai", "")
# Emit the current step content blocks
if "content_blocks" in step:
content = "\n\n".join(step["content_blocks"])
@ -2078,6 +2080,8 @@ def handle_activity_response(room_name, user_response, username):
s for s in section["steps"] if s["step_id"] == activity_state.step_id
)
feedback_tokens_for_ai = step.get("feedback_tokens_for_ai", "")
# Check if the step has a question
if "question" in step:
# Categorize the user's response
@ -2288,7 +2292,7 @@ def handle_activity_response(room_name, user_response, username):
transition,
category,
step["question"],
step.get("feedback_tokens_for_ai", ""),
feedback_tokens_for_ai,
user_response,
user_language,
username,

View file

@ -30,7 +30,7 @@ sections:
next_section_and_step: "section_1:step_2"
incorrect:
ai_feedback:
tokens_for_ai: "That's not quite right. Try again."
tokens_for_ai: "The answer is not right. Thanks the user for showing work. Catch mistakes and suggest next steps. Remember give a separate example to show how to solve the answer, never reveal it."
metadata_add:
attempts: "n+1"
next_section_and_step: "section_1:step_1"
@ -41,8 +41,8 @@ sections:
user_work: "the-users-response"
next_section_and_step: "section_1:step_1"
set_language:
ai_feedback:
tokens_for_ai: "Language preference updated. Please continue in your preferred language."
content_blocks:
- "language updated!"
metadata_add:
language: "the-users-response"
counts_as_attempt: false
@ -75,7 +75,7 @@ sections:
next_section_and_step: "section_1:step_3"
incorrect:
ai_feedback:
tokens_for_ai: "That's not quite right. Try again."
tokens_for_ai: "The answer is not right. Thanks the user for showing work. Catch mistakes and suggest next steps. Remember give a separate example to show how to solve the answer, never reveal it."
metadata_add:
attempts: "n+1"
next_section_and_step: "section_1:step_2"
@ -86,8 +86,8 @@ sections:
user_work: "the-users-response"
next_section_and_step: "section_1:step_2"
set_language:
ai_feedback:
tokens_for_ai: "Language preference updated. Please continue in your preferred language."
content_blocks:
- "language updated!"
metadata_add:
language: "the-users-response"
counts_as_attempt: false
@ -120,7 +120,7 @@ sections:
next_section_and_step: "section_1:step_4"
incorrect:
ai_feedback:
tokens_for_ai: "That's not quite right. Try again."
tokens_for_ai: "The answer is not right. Thanks the user for showing work. Catch mistakes and suggest next steps. Remember give a separate example to show how to solve the answer, never reveal it."
metadata_add:
attempts: "n+1"
next_section_and_step: "section_1:step_3"
@ -131,8 +131,8 @@ sections:
user_work: "the-users-response"
next_section_and_step: "section_1:step_3"
set_language:
ai_feedback:
tokens_for_ai: "Language preference updated. Please continue in your preferred language."
content_blocks:
- "language updated!"
metadata_add:
language: "the-users-response"
counts_as_attempt: false
@ -165,7 +165,7 @@ sections:
next_section_and_step: "section_1:step_5"
incorrect:
ai_feedback:
tokens_for_ai: "That's not quite right. Try again."
tokens_for_ai: "The answer is not right. Thanks the user for showing work. Catch mistakes and suggest next steps. Remember give a separate example to show how to solve the answer, never reveal it."
metadata_add:
attempts: "n+1"
next_section_and_step: "section_1:step_4"
@ -176,8 +176,8 @@ sections:
user_work: "the-users-response"
next_section_and_step: "section_1:step_4"
set_language:
ai_feedback:
tokens_for_ai: "Language preference updated. Please continue in your preferred language."
content_blocks:
- "language updated!"
metadata_add:
language: "the-users-response"
counts_as_attempt: false
@ -210,7 +210,7 @@ sections:
next_section_and_step: "section_1:step_6"
incorrect:
ai_feedback:
tokens_for_ai: "That's not quite right. Try again."
tokens_for_ai: "The answer is not right. Thanks the user for showing work. Catch mistakes and suggest next steps. Remember give a separate example to show how to solve the answer, never reveal it."
metadata_add:
attempts: "n+1"
next_section_and_step: "section_1:step_5"
@ -221,8 +221,8 @@ sections:
user_work: "the-users-response"
next_section_and_step: "section_1:step_5"
set_language:
ai_feedback:
tokens_for_ai: "Language preference updated. Please continue in your preferred language."
content_blocks:
- "language updated!"
metadata_add:
language: "the-users-response"
counts_as_attempt: false
@ -255,7 +255,7 @@ sections:
next_section_and_step: "section_1:step_7"
incorrect:
ai_feedback:
tokens_for_ai: "That's not quite right. Try again."
tokens_for_ai: "The answer is not right. Thanks the user for showing work. Catch mistakes and suggest next steps. Remember give a separate example to show how to solve the answer, never reveal it."
metadata_add:
attempts: "n+1"
next_section_and_step: "section_1:step_6"
@ -266,8 +266,8 @@ sections:
user_work: "the-users-response"
next_section_and_step: "section_1:step_6"
set_language:
ai_feedback:
tokens_for_ai: "Language preference updated. Please continue in your preferred language."
content_blocks:
- "language updated!"
metadata_add:
language: "the-users-response"
counts_as_attempt: false
@ -300,7 +300,7 @@ sections:
next_section_and_step: "section_1:step_8"
incorrect:
ai_feedback:
tokens_for_ai: "That's not quite right. Try again."
tokens_for_ai: "The answer is not right. Thanks the user for showing work. Catch mistakes and suggest next steps. Remember give a separate example to show how to solve the answer, never reveal it."
metadata_add:
attempts: "n+1"
next_section_and_step: "section_1:step_7"
@ -311,8 +311,8 @@ sections:
user_work: "the-users-response"
next_section_and_step: "section_1:step_7"
set_language:
ai_feedback:
tokens_for_ai: "Language preference updated. Please continue in your preferred language."
content_blocks:
- "language updated!"
metadata_add:
language: "the-users-response"
counts_as_attempt: false
@ -325,7 +325,7 @@ sections:
- "You can show your work and provide the final answer."
question: "What is the simplified form of the expression 3(x + 2) - 4x? Show your work and provide the answer."
tokens_for_ai: |
Determine if the user's response is correct by checking if the final answer is 2 - x.
Determine if the user's response is correct by checking if the final answer is: 6 - x or -x + 6
If the user shows their work but doesn't provide a final answer, categorize as 'show_work'.
If the answer is incorrect, categorize as 'incorrect'.
If the user wants to change the language, categorize as 'set_language'.
@ -345,7 +345,7 @@ sections:
next_section_and_step: "section_2:step_1"
incorrect:
ai_feedback:
tokens_for_ai: "That's not quite right. Try again."
tokens_for_ai: "The answer is not right. Thanks the user for showing work. Catch mistakes and suggest next steps. Remember give a separate example to show how to solve the answer, never reveal it."
metadata_add:
attempts: "n+1"
next_section_and_step: "section_1:step_8"
@ -356,8 +356,8 @@ sections:
user_work: "the-users-response"
next_section_and_step: "section_1:step_8"
set_language:
ai_feedback:
tokens_for_ai: "Language preference updated. Please continue in your preferred language."
content_blocks:
- "language updated!"
metadata_add:
language: "the-users-response"
counts_as_attempt: false