alibicer commited on
Commit
9d5aaba
·
verified ·
1 Parent(s): cb1f1a9

Update prompts/main_prompt.py

Browse files
Files changed (1) hide show
  1. prompts/main_prompt.py +132 -140
prompts/main_prompt.py CHANGED
@@ -1,140 +1,132 @@
1
- # Module starts with the task
2
- TASK_PROMPT = """
3
- Welcome to Module 2: Solving a Ratio Problem Using Multiple Representations!
4
-
5
- ### Task:
6
- Jessica drives 90 miles in 2 hours. If she drives at the same rate, how far does she travel in:
7
- - 1 hour?
8
- - ½ hour?
9
- - 3 hours?
10
-
11
- To solve this, try using different representations:
12
- - Bar models
13
- - Double number lines
14
- - Ratio tables
15
- - Graphs
16
-
17
- Remember: Don't just find the answer—explain why!
18
- I'll guide you step by step—let’s start with the bar model.
19
- """
20
-
21
- # Step 1: Bar Model Representation
22
- BAR_MODEL_PROMPT = """
23
- Step 1: Bar Model Representation
24
-
25
- Imagine a bar representing 90 miles—the distance Jessica travels in 2 hours.
26
- How might you divide this bar to explore the distances for 1 hour, ½ hour, and 3 hours?
27
-
28
- Hints if needed:
29
- 1. Think of the entire bar as representing 90 miles in 2 hours. How would you divide it into two equal parts to find 1 hour?
30
- 2. Now, extend or divide it further—what happens for ½ hour and 3 hours?
31
-
32
- If correct: Great! Can you explain why this model helps students visualize proportional relationships?
33
- If incorrect: Try dividing the bar into two equal sections. What does each section represent?
34
- """
35
-
36
- # Step 2: Double Number Line
37
- DOUBLE_NUMBER_LINE_PROMPT = """
38
- Step 2: Double Number Line Representation
39
-
40
- Now, let’s use a double number line.
41
- Create two parallel lines: one for time (hours) and one for distance (miles).
42
-
43
- Start by marking:
44
- - 0 and 2 hours on the top line
45
- - 0 and 90 miles on the bottom line
46
-
47
- What comes next?
48
-
49
- Hints if needed:
50
- 1. Try labeling the time line (0, 1, 2, 3). How does that help with placing distances below?
51
- 2. Since 2 hours = 90 miles, what does that tell you about 1 hour and ½ hour?
52
-
53
- If correct: Nice work! How does this help students understand proportional relationships?
54
- If incorrect: Check your spacing—does your number line keep a constant rate?
55
- """
56
-
57
- # Step 3: Ratio Table
58
- RATIO_TABLE_PROMPT = """
59
- Step 3: Ratio Table Representation
60
-
61
- Next, let’s create a ratio table.
62
- Make a table with:
63
- - Column 1: Time (hours)
64
- - Column 2: Distance (miles)
65
-
66
- You already know 2 hours = 90 miles.
67
- How would you complete the table for ½ hour, 1 hour, and 3 hours?
68
-
69
- Hints if needed:
70
- 1. Since 2 hours = 90 miles, how can you divide this to find 1 hour?
71
- 2. Once you know 1 hour = 45 miles, can you calculate for ½ hour and 3 hours?
72
-
73
- If correct: Well done! How might this help students compare proportional relationships?
74
- If incorrect: Something’s a little off. Try using unit rate: 90 ÷ 2 = ?
75
- """
76
-
77
- # Step 4: Graph Representation
78
- GRAPH_PROMPT = """
79
- Step 4: Graph Representation
80
-
81
- Now, let’s graph this problem!
82
- Plot:
83
- - Time (hours) on the x-axis
84
- - Distance (miles) on the y-axis
85
-
86
- You already know two key points:
87
- - (0,0) and (2,90)
88
-
89
- What other points will you add?
90
-
91
- Hints if needed:
92
- 1. Start by marking (0,0) and (2,90).
93
- 2. How can you use these to find (1,45), (½,22.5), and (3,135)?
94
-
95
- If correct: Fantastic! How does this graph reinforce the idea of constant rate and proportionality?
96
- If incorrect: Does your line pass through (0,0)? Why is that important?
97
- """
98
-
99
- # Reflection Prompt
100
- REFLECTION_PROMPT = """
101
- Reflection Time!
102
-
103
- Now that you've explored multiple representations, think about these questions:
104
- - How does each method highlight proportional reasoning differently?
105
- - Which representation do you prefer, and why?
106
- - Can you think of a situation where one of these representations wouldn’t be the best choice?
107
-
108
- Take a moment to reflect!
109
- """
110
-
111
- # Summary Prompt
112
- SUMMARY_PROMPT = """
113
- Summary of Module 2
114
-
115
- In this module, you:
116
- - Solved a proportional reasoning problem using multiple representations
117
- - Explored how different models highlight proportional relationships
118
- - Reflected on teaching strategies aligned with Common Core practices
119
-
120
- Final Task: Try creating a similar proportional reasoning problem!
121
- Example: A runner covers a certain distance in a given time.
122
-
123
- Make sure your problem can be solved using:
124
- - Bar models
125
- - Double number lines
126
- - Ratio tables
127
- - Graphs
128
-
129
- The AI will evaluate your problem and provide feedback!
130
- """
131
-
132
- # Final Reflection Prompt
133
- FINAL_REFLECTION_PROMPT = """
134
- Final Reflection
135
-
136
- - How does designing and solving problems using multiple representations enhance students’ mathematical creativity?
137
- - How would you guide students to explain their reasoning, even if they get the correct answer?
138
-
139
- Share your thoughts!
140
- """
 
1
+ import gradio as gr
2
+
3
+ # Step-by-step prompts
4
+ PROMPTS = [
5
+ # Task Introduction
6
+ "## Task: Representing Jessica’s Driving Distance 🚗\n"
7
+ "Jessica is driving at a constant speed. She travels **90 miles in 2 hours**.\n\n"
8
+ "### Your Goal:\n"
9
+ "Represent the relationship between **time and distance** using different mathematical models:\n"
10
+ "✅ Bar Model\n"
11
+ "✅ Double Number Line\n"
12
+ "✅ Ratio Table\n"
13
+ "✅ Graph\n\n"
14
+ "Let’s go through each representation step by step!",
15
+
16
+ # Step 1: Identifying Current Representation
17
+ "Which representations have you already used to show the relationship between time and distance?\n"
18
+ "- Bar Model\n"
19
+ "- Double Number Line\n"
20
+ "- Ratio Table\n"
21
+ "- Graph\n\n"
22
+ "If you haven’t used all of them, let’s go through each one step by step.",
23
+
24
+ # Step 2: Bar Model
25
+ "### Step 1: Bar Model Representation 📊\n"
26
+ "Have you created a **bar model** to represent Jessica’s travel?\n\n"
27
+ "**If not, follow these steps:**\n"
28
+ "1️⃣ Draw a **long bar** to represent **2 hours of driving**, labeling it **90 miles**.\n"
29
+ "2️⃣ Divide the bar into **two equal parts** to show **1 hour = 45 miles**.\n"
30
+ "3️⃣ Extend the bar to **3 hours** by adding another **45-mile segment**.\n"
31
+ "4️⃣ Divide **one 1-hour segment in half** to show **½ hour = 22.5 miles**.\n\n"
32
+ "✅ Does your bar model correctly show **½, 1, 2, and 3 hours**?",
33
+
34
+ # Step 3: Double Number Line
35
+ "### Step 2: Double Number Line Representation 📏\n"
36
+ "Have you created a **double number line** for time and distance?\n\n"
37
+ "**If not, follow these steps:**\n"
38
+ "1️⃣ Draw **two parallel number lines**:\n"
39
+ " - The **top line** represents **time (hours)**.\n"
40
+ " - The **bottom line** represents **distance (miles)**.\n"
41
+ "2️⃣ Mark these key points:\n"
42
+ " - **0 hours → 0 miles**\n"
43
+ " - **½ hour → 22.5 miles**\n"
44
+ " - **1 hour 45 miles**\n"
45
+ " - **2 hours 90 miles**\n"
46
+ " - **3 hours → 135 miles**\n"
47
+ "3️⃣ Ensure the distances are evenly spaced.\n\n"
48
+ "✅ Does your number line show a **proportional relationship**?",
49
+
50
+ # Step 4: Ratio Table
51
+ "### Step 3: Ratio Table Representation 📋\n"
52
+ "Have you created a **ratio table**?\n\n"
53
+ "**If not, follow these steps:**\n"
54
+ "1️⃣ Fill in the table below:\n\n"
55
+ "| Time (hours) | Distance (miles) |\n"
56
+ "|-------------|-----------------|\n"
57
+ "| 0.5 | 22.5 |\n"
58
+ "| 1 | 45 |\n"
59
+ "| 2 | 90 |\n"
60
+ "| 3 | 135 |\n\n"
61
+ "2️⃣ Look for patterns.\n"
62
+ "3️⃣ What would be the distance for **4 hours**?\n\n"
63
+ "✅ Does your table clearly show a **proportional pattern**?",
64
+
65
+ # Step 5: Graph
66
+ "### Step 4: Graph Representation 📈\n"
67
+ "Have you created a **graph** to represent this relationship?\n\n"
68
+ "**If not, follow these steps:**\n"
69
+ "1️⃣ Draw a **coordinate plane**:\n"
70
+ " - **x-axis time (hours)**\n"
71
+ " - **y-axis distance (miles)**\n"
72
+ "2️⃣ Plot these points:\n"
73
+ " - (0, 0)\n"
74
+ " - (0.5, 22.5)\n"
75
+ " - (1, 45)\n"
76
+ " - (2, 90)\n"
77
+ " - (3, 135)\n"
78
+ "3️⃣ Draw a straight line through these points.\n"
79
+ "4️⃣ What does the **slope of the line** tell you about Jessica’s driving rate?\n\n"
80
+ "✅ Does your graph correctly show a **linear relationship**?",
81
+
82
+ # Step 6: Final Reflection & Posing Questions
83
+ "### Final Reflection 💭\n"
84
+ "Great job! Now, take a moment to reflect:\n"
85
+ "1️⃣ Which representation helped you understand the relationship best? Why?\n"
86
+ "2️⃣ How do these representations show the **same proportional relationship** in different ways?\n"
87
+ "3️⃣ Can you apply this method to another real-world proportional relationship?\n\n"
88
+ "### New Challenge 🌟\n"
89
+ "Imagine Jessica increases her speed by **10 miles per hour**. How would this affect the bar model, number line, ratio table, and graph?\n\n"
90
+ "Try adjusting your models to reflect this change!",
91
+
92
+ # Summary of Objectives & Common Core Standards
93
+ "### Summary of Objectives 🎯\n"
94
+ "- You explored **four ways** to represent proportional relationships: Bar Model, Double Number Line, Ratio Table, and Graph.\n"
95
+ "- You understood how **time and distance** relate at a constant rate.\n"
96
+ "- You analyzed how different models show the **same mathematical pattern**.\n\n"
97
+ "### Common Core Math Standards 🏆\n"
98
+ "- **6.RP.A.1** - Understand the concept of a ratio.\n"
99
+ "- **6.RP.A.3a** - Use ratio reasoning to solve real-world problems.\n"
100
+ "- **7.RP.A.2** - Recognize proportional relationships.\n\n"
101
+ "✅ **Congratulations! You’ve completed this module.** 🚀"
102
+ ]
103
+
104
+ # State tracking function
105
+ def guide_user(state):
106
+ """Returns the next step based on user progress"""
107
+ state = int(state) + 1
108
+ if state >= len(PROMPTS):
109
+ return "✅ You have completed all steps! Great job!", str(state)
110
+ return PROMPTS[state], str(state)
111
+
112
+ # Gradio interface
113
+ with gr.Blocks() as app:
114
+ gr.Markdown("## Step-by-Step Guide: Representing Jessica's Driving Distance 🚗")
115
+
116
+ state = gr.State(value="0") # Tracks the user's progress
117
+
118
+ chatbot = gr.Chatbot(label="AI Guide", height=300, type="messages") # Fixed deprecation warning
119
+ user_input = gr.Textbox(label="Your Response (optional)", placeholder="Type here or click 'Next' to continue...")
120
+
121
+ next_btn = gr.Button("Next Step ➡️")
122
+
123
+ def update_chat(user_response, history, state):
124
+ """Updates chat history and progresses to the next step"""
125
+ history.append({"role": "user", "content": user_response if user_response else ""})
126
+ next_message, new_state = guide_user(state)
127
+ history.append({"role": "assistant", "content": next_message})
128
+ return history, new_state
129
+
130
+ next_btn.click(update_chat, [user_input, chatbot, state], [chatbot, state])
131
+
132
+ app.launch()