alibicer commited on
Commit
aeb9bef
·
verified ·
1 Parent(s): 357e545

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -16
app.py CHANGED
@@ -44,26 +44,22 @@ def gpt_call(history, user_message,
44
 
45
  response = completion.choices[0].message.content
46
 
47
- # Ensure AI always demands detailed explanations first
48
- if any(keyword in user_message.lower() for keyword in ["yes", "no", "next question"]):
49
- response = "Before we move forward, let's take a step back. What do you think about the problem? Why do you believe your answer or method is correct? Can you explain your reasoning step by step? Let's make sure we fully understand before proceeding.\n\n" + response
50
 
51
- # Ensure AI always asks for reasoning
52
- if any(keyword in user_message.lower() for keyword in ["solve", "explain", "why", "reasoning"]):
53
- response = "Great thinking! Now, explain your reasoning step by step. What patterns do you notice? Let's walk through it together.\n\n" + response
54
 
55
- # Provide step-by-step hints instead of full solutions immediately
56
- if any(keyword in user_message.lower() for keyword in ["hint", "stuck", "help"]):
57
- response = "Here's a hint: What key properties or relationships can help you solve this? Try breaking it down further. What happens if we adjust one of the variables?\n\n" + response
58
 
59
- # Encourage teachers to create their own problems at the end
60
  if "pose a problem" in user_message.lower():
61
- response += "\n\nNow that you've explored this concept, try creating a problem similar to the ones we discussed. What elements would you include to ensure it is non-proportional?"
62
-
63
- # Ask about Common Core practice standards and creativity-directed practices in the summary
64
- if "summary" in user_message.lower():
65
- response += "\n\nReflection time! Which Common Core practice standards did we apply? How did creativity shape your approach to solving this problem? What strategies would help students build deeper mathematical reasoning?"
66
-
67
  return response
68
 
69
  def respond(user_message, history):
 
44
 
45
  response = completion.choices[0].message.content
46
 
47
+ # Ensure AI always asks for reasoning first before answering
48
+ if any(keyword in user_message.lower() for keyword in ["problem 2", "problem 3"]):
49
+ response = "Interesting! Before we move on, what do you think about this problem? Is it proportional? Why or why not? Let's explore your reasoning first.\n\n" + response
50
 
51
+ # Push for deeper explanations—even if the answer is correct
52
+ if any(keyword in user_message.lower() for keyword in ["correct", "right", "exactly"]):
53
+ response = "That’s a great insight! But let’s push further—can you explain it another way? Could someone misunderstand this concept? Lets explore that.\n\n" + response
54
 
55
+ # Ensure the AI always asks a follow-up before moving to the next question
56
+ if any(keyword in user_message.lower() for keyword in ["move on", "next question"]):
57
+ response = "Before we continue, let’s reflect for a moment—what was the biggest takeaway from this problem? Could we change something and still get a non-proportional relationship?\n\n" + response
58
 
59
+ # Make the Problem-Posing Activity more interactive
60
  if "pose a problem" in user_message.lower():
61
+ response += "\n\nThat's a great start! But let's refine it—does your problem truly show a non-proportional relationship? What would happen if we removed the fixed cost? Try adjusting it and see if it still works!"
62
+
 
 
 
 
63
  return response
64
 
65
  def respond(user_message, history):