alibicer commited on
Commit
840c5fe
·
verified ·
1 Parent(s): 85c7221

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -32
app.py CHANGED
@@ -12,48 +12,48 @@ if os.path.exists(".env"):
12
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
13
  client = OpenAI(api_key=OPENAI_API_KEY)
14
 
15
- # Define pre-video and post-video reflection steps
16
  REFLECTION_STEPS = [
17
  {
18
  "title": "Pre-Video Reflection",
19
- "question": "Before watching the video, let's reflect on your approach to the problem.\n\nHow did you solve the task? What strategies did you use?",
20
  "follow_up": "You used **{response}**—interesting! Why do you think this strategy is effective for solving proportional reasoning problems?",
21
  "next_step": "Watch the Video"
22
  },
23
  {
24
  "title": "Watch the Video",
25
- "question": "Now, please watch the video at the provided link and observe how the teacher facilitates problem-solving. Let me know when you're done watching.",
26
  "follow_up": "Great! Now that you've watched the video, let's reflect on key aspects of the lesson.",
27
- "next_step": "Post-Video Reflection - Observing Creativity-Directed Practices"
28
  },
29
  {
30
- "title": "Post-Video Reflection - Observing Creativity-Directed Practices",
31
- "question": "Let's start with **Observing Creativity-Directed Practices.**\n\nWhat stood out to you the most about how the teacher encouraged student creativity?",
32
  "follow_up": "You mentioned **{response}**. Can you explain how that supported students' creative problem-solving?",
33
- "next_step": "Post-Video Reflection - Small Group Interactions"
34
  },
35
  {
36
- "title": "Post-Video Reflection - Small Group Interactions",
37
- "question": "Now, let's reflect on **Small Group Interactions.**\n\nWhat did you notice about how the teacher guided student discussions?",
38
  "follow_up": "Interesting! You noted **{response}**. How do you think that helped students deepen their understanding?",
39
- "next_step": "Post-Video Reflection - Student Reasoning and Connections"
40
  },
41
  {
42
- "title": "Post-Video Reflection - Student Reasoning and Connections",
43
- "question": "Next, let’s discuss **Student Reasoning and Connections.**\n\nHow did students reason through the task? What connections did they make between percent relationships and fractions?",
44
  "follow_up": "That’s a great point about **{response}**. Can you explain why this was significant in their problem-solving?",
45
- "next_step": "Post-Video Reflection - Common Core Practice Standards"
46
  },
47
  {
48
- "title": "Post-Video Reflection - Common Core Practice Standards",
49
- "question": "Now, let’s reflect on **Common Core Practice Standards.**\n\nWhich Common Core practice standards do you think the teacher emphasized during the lesson?",
50
  "follow_up": "You mentioned **{response}**. How do you see this practice supporting students' proportional reasoning?",
51
  "next_step": "Problem Posing Activity"
52
  },
53
  {
54
  "title": "Problem Posing Activity",
55
- "question": "Let’s engage in a **Problem-Posing Activity.**\n\nBased on what you observed, pose a problem that encourages students to use visuals and proportional reasoning.",
56
- "follow_up": "That's an interesting problem! Does it allow for multiple solution paths? How does it connect to the Common Core practices we discussed?",
57
  "next_step": "Final Reflection"
58
  },
59
  {
@@ -64,21 +64,6 @@ REFLECTION_STEPS = [
64
  }
65
  ]
66
 
67
- def gpt_call(history, user_message, model="gpt-4o-mini", max_tokens=1024, temperature=0.7, top_p=0.95):
68
- messages = [{"role": "system", "content": MAIN_PROMPT}]
69
-
70
- for user_text, assistant_text in history:
71
- if user_text:
72
- messages.append({"role": "user", "content": user_text})
73
- if assistant_text:
74
- messages.append({"role": "assistant", "content": assistant_text})
75
-
76
- messages.append({"role": "user", "content": user_message})
77
-
78
- completion = client.chat.completions.create(model=model, messages=messages, max_tokens=max_tokens, temperature=temperature, top_p=top_p)
79
-
80
- return completion.choices[0].message.content
81
-
82
  def respond(user_message, history):
83
  if not user_message:
84
  return "", history
 
12
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
13
  client = OpenAI(api_key=OPENAI_API_KEY)
14
 
15
+ # Reflection steps appear one-by-one
16
  REFLECTION_STEPS = [
17
  {
18
  "title": "Pre-Video Reflection",
19
+ "question": "Before watching the video, how did you approach solving the task? What strategies did you use?",
20
  "follow_up": "You used **{response}**—interesting! Why do you think this strategy is effective for solving proportional reasoning problems?",
21
  "next_step": "Watch the Video"
22
  },
23
  {
24
  "title": "Watch the Video",
25
+ "question": "Now, please watch the video at the provided link. Let me know when you're done watching.",
26
  "follow_up": "Great! Now that you've watched the video, let's reflect on key aspects of the lesson.",
27
+ "next_step": "Observing Creativity-Directed Practices"
28
  },
29
  {
30
+ "title": "Observing Creativity-Directed Practices",
31
+ "question": "Let's start with **Creativity-Directed Practices**. What stood out to you about how the teacher encouraged student creativity?",
32
  "follow_up": "You mentioned **{response}**. Can you explain how that supported students' creative problem-solving?",
33
+ "next_step": "Small Group Interactions"
34
  },
35
  {
36
+ "title": "Small Group Interactions",
37
+ "question": "Now, let's reflect on **Small Group Interactions**. What did you notice about how the teacher guided student discussions?",
38
  "follow_up": "Interesting! You noted **{response}**. How do you think that helped students deepen their understanding?",
39
+ "next_step": "Student Reasoning and Connections"
40
  },
41
  {
42
+ "title": "Student Reasoning and Connections",
43
+ "question": "Next, let’s discuss **Student Reasoning and Connections**. How did students reason through the task?",
44
  "follow_up": "That’s a great point about **{response}**. Can you explain why this was significant in their problem-solving?",
45
+ "next_step": "Common Core Practice Standards"
46
  },
47
  {
48
+ "title": "Common Core Practice Standards",
49
+ "question": "Now, let’s reflect on **Common Core Practice Standards**. Which ones do you think were emphasized in the lesson?",
50
  "follow_up": "You mentioned **{response}**. How do you see this practice supporting students' proportional reasoning?",
51
  "next_step": "Problem Posing Activity"
52
  },
53
  {
54
  "title": "Problem Posing Activity",
55
+ "question": "Let’s engage in a **Problem-Posing Activity**. Pose a problem that encourages students to use visuals and proportional reasoning.",
56
+ "follow_up": "That's an interesting problem! Does it allow for multiple solution paths? How does it connect to Common Core practices we discussed?",
57
  "next_step": "Final Reflection"
58
  },
59
  {
 
64
  }
65
  ]
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  def respond(user_message, history):
68
  if not user_message:
69
  return "", history