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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -44,9 +44,13 @@ def gpt_call(history, user_message,
44
 
45
  response = completion.choices[0].message.content
46
 
47
- # Ensure AI is interactive and always asks for reasoning
 
 
 
 
48
  if any(keyword in user_message.lower() for keyword in ["solve", "explain", "why", "reasoning"]):
49
- response = "Great thinking! Before we move forward, can you explain your reasoning step by step? What patterns do you notice? Let's walk through it together.\n\n" + response
50
 
51
  # Provide step-by-step hints instead of full solutions immediately
52
  if any(keyword in user_message.lower() for keyword in ["hint", "stuck", "help"]):
@@ -60,10 +64,6 @@ def gpt_call(history, user_message,
60
  if "summary" in user_message.lower():
61
  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?"
62
 
63
- # Step-by-step approach for solutions
64
- if any(keyword in user_message.lower() for keyword in ["solution", "answer"]):
65
- response = "Let's take this step by step. What information do we have? How can we use it to set up an equation or method?\n\n" + response
66
-
67
  return response
68
 
69
  def respond(user_message, history):
 
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"]):
 
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):