alibicer commited on
Commit
7baa067
·
verified ·
1 Parent(s): 540b477

Update prompts/main_prompt.py

Browse files
Files changed (1) hide show
  1. prompts/main_prompt.py +89 -165
prompts/main_prompt.py CHANGED
@@ -1,165 +1,89 @@
1
- MAIN_PROMPT = """
2
- Welcome to Module 2 on proportional reasoning and multiple representations!
3
- Today, you'll explore a real-world problem:
4
-
5
- **Jessica drives 90 miles in 2 hours. If she drives at the same rate, how far does she travel in 1 hour, ½ hour, and 3 hours?**
6
-
7
- I encourage you to explore multiple representations—**bar models, double number lines, ratio tables, and graphs**—to build a deeper understanding of proportional relationships.
8
-
9
- 🔍 **Remember:** The goal isn’t just to find the right answer but to explore **why** the relationships work the way they do. Take your time, and I’ll guide you step by step.
10
-
11
- ---
12
-
13
- ## **Step-by-Step Prompts for Representations**
14
-
15
- ### **1. Bar Model**
16
- **Initial Prompt:**
17
- "Let’s start with a bar model! Imagine a bar representing **90 miles**, which Jessica travels in **2 hours**.
18
- How might you divide this bar to explore the distances for **1 hour, ½ hour, and 3 hours**?
19
- Please walk me through your reasoning!"
20
-
21
- **Hints for When Stuck:**
22
- - **Hint 1:** "Think of the entire bar as representing **90 miles in 2 hours**. How can you split it into equal parts to find 1 hour?"
23
- - **Hint 2:** "Now, extend or divide it further—what happens for **½ hour and 3 hours**?"
24
-
25
- **If Partially Correct:**
26
- "Nice start! You’ve divided the bar, but let’s double-check: Do your sections correctly correspond to **1 hour, ½ hour, and 3 hours**?"
27
-
28
- **If Incorrect:**
29
- "It looks like the divisions might not match the time intervals. Remember:
30
- - **2 hours = 90 miles** **1 hour = 45 miles**
31
- - How would you adjust the bar for **½ hour (22.5 miles) and 3 hours (135 miles)?**"
32
-
33
- **If Correct:**
34
- "Excellent! Can you explain why this model works? How might you use this to help students visualize proportional relationships?"
35
-
36
- ---
37
-
38
- ### **2. Double Number Line**
39
- **Initial Prompt:**
40
- "Now, let’s try a **double number line**. Create two parallel lines—one for **time (hours)** and one for **distance (miles)**.
41
-
42
- Start by marking:
43
- - **0 and 2 hours** on the top line
44
- - **0 and 90 miles** on the bottom line
45
-
46
- What comes next?"
47
-
48
- **Hints for When Stuck:**
49
- - **Hint 1:** "Try labeling the time line **(0, 1, 2, 3)**. How does that help with placing distances below?"
50
- - **Hint 2:** "Since **2 hours = 90 miles**, what does that tell you about **1 hour and ½ hour**?"
51
-
52
- **If Partially Correct:**
53
- "Great start! Can you check whether your intervals are evenly spaced and whether **90 miles aligns correctly with 2 hours**?"
54
-
55
- **If Incorrect:**
56
- "Something seems off. Since **1 hour = 45 miles**, does your number line reflect that proportion? Try adjusting it!"
57
-
58
- **If Correct:**
59
- "Well done! How might you use this number line to help students **see unit rate and proportional reasoning more clearly**?"
60
-
61
- ---
62
-
63
- ### **3. Ratio Table**
64
- **Initial Prompt:**
65
- "Next, let’s build a **ratio table**! Create a table with:
66
- - **Column 1:** Time (hours)
67
- - **Column 2:** Distance (miles)
68
-
69
- You already know **2 hours = 90 miles**. How would you fill in the table for **½ hour, 1 hour, and 3 hours**?"
70
-
71
- **Hints for When Stuck:**
72
- - **Hint 1:** "Since **2 hours = 90 miles**, how can you divide this to find **1 hour**?"
73
- - **Hint 2:** "Once you know **1 hour = 45 miles**, can you calculate for **½ hour and 3 hours**?"
74
-
75
- **If Partially Correct:**
76
- "Good thinking! Does your table maintain the **same proportional relationship** in each row?"
77
-
78
- **If Incorrect:**
79
- "Something’s a little off. Let’s check:
80
- - **1 hour = 45 miles**
81
- - **½ hour = 22.5 miles**
82
- - **3 hours = 135 miles**
83
-
84
- Can you adjust your table accordingly?"
85
-
86
- **If Correct:**
87
- "Great job! How do you think this table helps students compare different proportional relationships?"
88
-
89
- ---
90
-
91
- ### **4. Graph**
92
- **Initial Prompt:**
93
- "Finally, let’s graph this problem! Plot:
94
- - **Time (hours) on the x-axis**
95
- - **Distance (miles) on the y-axis**
96
-
97
- You already know two key points:
98
- - **(0,0)** and **(2,90)**
99
-
100
- What other points will you add?"
101
-
102
- **Hints for When Stuck:**
103
- - **Hint 1:** "Start by marking **(0,0) and (2,90)**. How can you use these to find **(1,45), (½,22.5), and (3,135)?**"
104
- - **Hint 2:** "What does the **slope** of this line represent?"
105
-
106
- **If Partially Correct:**
107
- "Nice start! Can you check whether your line passes through **(0,0)**? Why is that important?"
108
-
109
- **If Incorrect:**
110
- "Let’s go back and check:
111
- - **1 hour = 45 miles**
112
- - **½ hour = 22.5 miles**
113
- - **3 hours = 135 miles**
114
-
115
- Try adjusting your graph to reflect this proportionality!"
116
-
117
- **If Correct:**
118
- "Fantastic! How does this graph reinforce the idea of a **constant rate and proportionality**?"
119
-
120
- ---
121
-
122
- ## **Reflection Questions**
123
- - "How does each representation help us understand proportional relationships differently?"
124
- - "Which representation do you prefer, and why?"
125
- - "Can you think of a situation where one of these representations **wouldn’t** be the best choice?"
126
-
127
- ---
128
-
129
- ## **AI Summary Section**
130
- 📌 **Content Knowledge:**
131
- "You explored solving a ratio problem using multiple representations, deepening your understanding of proportional relationships."
132
-
133
- 🎨 **Creativity-Directed Practices:**
134
- "You engaged creatively by visualizing and explaining mathematical relationships from different perspectives."
135
-
136
- 📚 **Pedagogical Content Knowledge:**
137
- "You reflected on how to select and connect different representations, aligning with **Common Core standards** such as:
138
- - 'Use appropriate tools strategically'
139
- - 'Look for and express regularity in repeated reasoning'."
140
-
141
- 🤔 **Which Common Core standards and creativity-directed practices do you feel were covered in this module?**
142
-
143
- ---
144
-
145
- ## **Problem-Posing Activity**
146
- "Now, create a similar proportional reasoning problem for your students.
147
-
148
- For example, change the context—perhaps a **runner covering a certain distance in a given time**.
149
-
150
- Ensure that your problem can be solved using:
151
- ✅ **Bar models**
152
- ✅ **Double number lines**
153
- ✅ **Ratio tables**
154
- ✅ **Graphs**
155
-
156
- Please explain when certain representations might be **more or less effective**.
157
- The AI will evaluate your problem and provide feedback!"
158
-
159
- ---
160
-
161
- ## **Final Reflection**
162
- - "How does designing and solving problems using multiple representations enhance students’ mathematical creativity?"
163
- - "How would you guide students to explain their reasoning, even if they get the correct answer?"
164
-
165
- ---
 
1
+ import gradio as gr
2
+
3
+ # Step-by-step prompts
4
+ PROMPTS = [
5
+ "Which representations have you already used to show the relationship between time and distance?\n"
6
+ "- Bar Model\n"
7
+ "- Double Number Line\n"
8
+ "- Ratio Table\n"
9
+ "- Graph\n\n"
10
+ "If you haven’t used all of them, let’s go through each one step by step.",
11
+
12
+ "Have you created a **bar model** to represent Jessica’s travel?\n"
13
+ "- If not, try drawing a bar to represent **2 hours = 90 miles**.\n"
14
+ "- Can you divide it into equal segments to show **1 hour = 45 miles**?\n"
15
+ "- How would you extend the bar to **3 hours**?\n"
16
+ "- Can you split **1 hour** into halves to show **½ hour = 22.5 miles**?\n\n"
17
+ " Does your bar model correctly show **½, 1, 2, and 3 hours**?",
18
+
19
+ "Have you created a **double number line** for time and distance?\n"
20
+ "- If not, try drawing two parallel lines:\n"
21
+ " - One for **time (hours)**\n"
22
+ " - One for **distance (miles)**\n"
23
+ "- Can you correctly place these points?\n"
24
+ " - **0 hours → 0 miles**\n"
25
+ " - **½ hour → 22.5 miles**\n"
26
+ " - **1 hour 45 miles**\n"
27
+ " - **2 hours → 90 miles**\n"
28
+ " - **3 hours → 135 miles**\n"
29
+ "- Are the distances evenly spaced?\n\n"
30
+ "✅ Does your number line show **a proportional relationship**?",
31
+
32
+ "Have you created a **ratio table**?\n"
33
+ "- If not, try filling in this table:\n\n"
34
+ "| Time (hours) | Distance (miles) |\n"
35
+ "|-------------|-----------------|\n"
36
+ "| 0.5 | 22.5 |\n"
37
+ "| 1 | 45 |\n"
38
+ "| 2 | 90 |\n"
39
+ "| 3 | 135 |\n\n"
40
+ "- Can you find a pattern in the table?\n"
41
+ "- What would be the distance for **4 hours**?\n\n"
42
+ "✅ Does your table clearly show a **proportional pattern**?",
43
+
44
+ "Have you created a **graph** to represent this relationship?\n"
45
+ "- If not, try plotting these points:\n"
46
+ " - (0, 0)\n"
47
+ " - (0.5, 22.5)\n"
48
+ " - (1, 45)\n"
49
+ " - (2, 90)\n"
50
+ " - (3, 135)\n"
51
+ "- Can you draw a straight line through them?\n"
52
+ "- What does the slope of the line tell you about Jessica’s driving rate?\n\n"
53
+ " Does your graph correctly show a **linear relationship**?",
54
+
55
+ "Final Reflection:\n"
56
+ "- Which representation helped you understand the relationship best? Why?\n"
57
+ "- How do these representations show the **same proportional relationship** in different ways?\n"
58
+ "- Can you apply this method to another real-world proportional relationship?"
59
+ ]
60
+
61
+ # State tracking function
62
+ def guide_user(state):
63
+ """Returns the next step based on user progress"""
64
+ state = int(state) + 1
65
+ if state >= len(PROMPTS):
66
+ return "✅ You have completed all steps! Great job!", str(state)
67
+ return PROMPTS[state], str(state)
68
+
69
+ # Gradio interface
70
+ with gr.Blocks() as app:
71
+ gr.Markdown("## Step-by-Step Guide: Representing Jessica's Driving Distance 🚗")
72
+
73
+ state = gr.State(value="0") # Tracks the user's progress
74
+
75
+ chatbot = gr.Chatbot(label="AI Guide", height=300)
76
+ user_input = gr.Textbox(label="Your Response (optional)", placeholder="Type here or click 'Next' to continue...")
77
+
78
+ next_btn = gr.Button("Next Step ➡️")
79
+
80
+ def update_chat(user_response, history, state):
81
+ """Updates chat history and progresses to the next step"""
82
+ history.append(("You:", user_response if user_response else ""))
83
+ next_message, new_state = guide_user(state)
84
+ history.append(("AI:", next_message))
85
+ return history, new_state
86
+
87
+ next_btn.click(update_chat, [user_input, chatbot, state], [chatbot, state])
88
+
89
+ app.launch()