alibicer commited on
Commit
5f0fa84
·
verified ·
1 Parent(s): 7baa067

Update prompts/main_prompt.py

Browse files
Files changed (1) hide show
  1. prompts/main_prompt.py +81 -38
prompts/main_prompt.py CHANGED
@@ -2,6 +2,18 @@ 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"
@@ -9,53 +21,84 @@ PROMPTS = [
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 hours135 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
@@ -72,18 +115,18 @@ with gr.Blocks() as app:
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()
 
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"
 
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
+ " - **½ hour22.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
 
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()