IW2025 commited on
Commit
c7dd466
·
verified ·
1 Parent(s): c13fde2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -16
app.py CHANGED
@@ -110,16 +110,18 @@ Here's the relevant curriculum content to help answer their question:
110
  {filled_context}
111
 
112
  Please provide a warm, encouraging answer that:
113
- 1. EXPLAINS and EXPANDS on the curriculum content - don't just repeat it
114
- 2. Fills in the blanks and provides context for what the curriculum is teaching
115
- 3. Uses concrete examples to make abstract concepts clear
116
- 4. Explains the "why" behind the concepts, not just the "what"
117
- 5. Makes connections to real-world programming scenarios
118
- 6. Acknowledges the student's curiosity and encourages them
119
- 7. Provides additional helpful context that complements the curriculum
120
  8. Suggests how they can practice or explore further
121
 
122
- Your response should be educational and helpful, not just a summary of the curriculum."""
 
 
123
 
124
  self.qa_prompt = PromptTemplate(
125
  input_variables=["question", "filled_context"],
@@ -148,16 +150,18 @@ Here's the specific curriculum slide content that directly addresses their quest
148
  {slide_content}
149
 
150
  Please provide a warm, encouraging answer that:
151
- 1. EXPLAINS and EXPANDS on the slide content - don't just repeat it
152
- 2. Fills in the blanks and provides context for what the slide is teaching
153
- 3. Uses concrete examples to make abstract concepts clear
154
- 4. Explains the "why" behind the concepts, not just the "what"
155
- 5. Makes connections to real-world programming scenarios
156
- 6. Acknowledges the student's curiosity and encourages them
157
- 7. Provides additional helpful context that complements the slide
158
  8. Suggests how they can practice or explore further
159
 
160
- Your response should be educational and helpful, not just a summary of the slide."""
 
 
161
 
162
  self.focused_qa_prompt = PromptTemplate(
163
  input_variables=["question", "slide_content"],
@@ -356,6 +360,8 @@ Your response should be educational and helpful, not just a summary of the slide
356
  answer = f"{slide_info}\n\n**Great question! Let me explain loops based on your curriculum:**\n\n{best_slide_content}\n\n**What are loops for?**\n\nLoops are programming constructs that solve the problem of repetition. As your curriculum explains, instead of writing hundreds of print statements to count from 1 to 100, loops allow you to accomplish the same task with just a few lines of code.\n\n**Key benefits of loops:**\n• **Efficiency**: Reduce repetitive code\n• **Scalability**: Handle large ranges (1 to 1000+) easily\n• **Maintainability**: Easier to modify and debug\n\n**Types of loops:** Your curriculum covers two main types of loops that you'll learn about. Keep exploring - you're doing great! 🚀"
357
  elif "boolean" in query.lower():
358
  answer = f"{slide_info}\n\n**Excellent question! Let me explain booleans based on your curriculum:**\n\n{best_slide_content}\n\n**What are booleans?**\n\nBooleans are a fundamental data type in programming that can only have two values: `True` or `False`. Think of them as simple yes/no answers to questions.\n\n**How do they work?**\n\nLooking at your slide, it's teaching you how to categorize statements as either True or False. For example:\n• \"The sun is shining\" - This could be True or False depending on the weather\n• \"I am using a computer\" - This is True when you're programming\n• \"I like pizza\" - This is a personal preference (True or False)\n\n**Why are booleans important?**\n\nBooleans are the foundation of decision-making in programming. They help programs make choices and control the flow of execution. You'll use them in if statements, loops, and many other programming constructs.\n\n**Real-world example:**\n```python\nis_logged_in = True\nhas_permission = False\n\nif is_logged_in and has_permission:\n print(\"Welcome to the system!\")\nelse:\n print(\"Please log in or get permission.\")\n```\n\nKeep exploring booleans - they're essential for building smart programs! 🌟"
 
 
359
  else:
360
  answer = f"{slide_info}\n\n**Excellent question! Let me explain this concept based on your curriculum:**\n\n{best_slide_content}\n\nThis slide is teaching you important programming concepts. The curriculum content you're studying is building a strong foundation for your programming journey! 💪\n\n**What this means:** The slide is showing you how programming concepts work in practice. Each element has a specific purpose and helps you understand the bigger picture of programming.\n\n**Why this matters:** Understanding these fundamentals will make you a better programmer. You're learning the building blocks that will help you create amazing programs! 🚀"
361
 
 
110
  {filled_context}
111
 
112
  Please provide a warm, encouraging answer that:
113
+ 1. ANALYZES and EXPLAINS the specific curriculum content shown
114
+ 2. References the exact examples, code, or concepts from the curriculum
115
+ 3. Explains what each part of the curriculum is teaching
116
+ 4. Provides step-by-step breakdown of any code examples shown
117
+ 5. Explains the "why" behind the concepts, not just the "what"
118
+ 6. Makes connections to real-world programming scenarios
119
+ 7. Acknowledges the student's curiosity and encourages them
120
  8. Suggests how they can practice or explore further
121
 
122
+ IMPORTANT: Focus on explaining the specific content shown in the curriculum, not generic concepts. If there's code, explain what it does. If there are examples, break them down. If there are rules or concepts, explain them clearly.
123
+
124
+ Your response should be educational and helpful, specifically explaining what the curriculum is teaching."""
125
 
126
  self.qa_prompt = PromptTemplate(
127
  input_variables=["question", "filled_context"],
 
150
  {slide_content}
151
 
152
  Please provide a warm, encouraging answer that:
153
+ 1. ANALYZES and EXPLAINS the specific content shown in the slide
154
+ 2. References the exact examples, code, or concepts displayed
155
+ 3. Explains what each part of the slide is teaching
156
+ 4. Provides step-by-step breakdown of any code examples shown
157
+ 5. Explains the "why" behind the concepts, not just the "what"
158
+ 6. Makes connections to real-world programming scenarios
159
+ 7. Acknowledges the student's curiosity and encourages them
160
  8. Suggests how they can practice or explore further
161
 
162
+ IMPORTANT: Focus on explaining the specific content shown in the slide, not generic concepts. If there's code, explain what it does. If there are examples, break them down. If there are rules or concepts, explain them clearly.
163
+
164
+ Your response should be educational and helpful, specifically explaining what the slide is teaching."""
165
 
166
  self.focused_qa_prompt = PromptTemplate(
167
  input_variables=["question", "slide_content"],
 
360
  answer = f"{slide_info}\n\n**Great question! Let me explain loops based on your curriculum:**\n\n{best_slide_content}\n\n**What are loops for?**\n\nLoops are programming constructs that solve the problem of repetition. As your curriculum explains, instead of writing hundreds of print statements to count from 1 to 100, loops allow you to accomplish the same task with just a few lines of code.\n\n**Key benefits of loops:**\n• **Efficiency**: Reduce repetitive code\n• **Scalability**: Handle large ranges (1 to 1000+) easily\n• **Maintainability**: Easier to modify and debug\n\n**Types of loops:** Your curriculum covers two main types of loops that you'll learn about. Keep exploring - you're doing great! 🚀"
361
  elif "boolean" in query.lower():
362
  answer = f"{slide_info}\n\n**Excellent question! Let me explain booleans based on your curriculum:**\n\n{best_slide_content}\n\n**What are booleans?**\n\nBooleans are a fundamental data type in programming that can only have two values: `True` or `False`. Think of them as simple yes/no answers to questions.\n\n**How do they work?**\n\nLooking at your slide, it's teaching you how to categorize statements as either True or False. For example:\n• \"The sun is shining\" - This could be True or False depending on the weather\n• \"I am using a computer\" - This is True when you're programming\n• \"I like pizza\" - This is a personal preference (True or False)\n\n**Why are booleans important?**\n\nBooleans are the foundation of decision-making in programming. They help programs make choices and control the flow of execution. You'll use them in if statements, loops, and many other programming constructs.\n\n**Real-world example:**\n```python\nis_logged_in = True\nhas_permission = False\n\nif is_logged_in and has_permission:\n print(\"Welcome to the system!\")\nelse:\n print(\"Please log in or get permission.\")\n```\n\nKeep exploring booleans - they're essential for building smart programs! 🌟"
363
+ elif "function" in query.lower():
364
+ answer = f"{slide_info}\n\n**Excellent question! Let me explain functions based on your curriculum:**\n\n{best_slide_content}\n\n**What are functions?**\n\nFunctions are reusable blocks of code that perform specific tasks. Think of them as mini-programs within your program that you can call whenever you need them.\n\n**Why use functions?**\n\nLooking at your slide, it explains that functions help you:\n• **Reuse code** - Write once, use many times\n• **Stay organized** - Break complex problems into smaller, manageable pieces\n• **Save time** - Don't repeat yourself (DRY principle)\n\n**Real-world example from your slide:**\n\nThe birthday song example is perfect! Instead of writing a new song for each friend, you create one function that can be reused:\n\n```python\ndef sing_birthday_song(friend_name):\n print(f\"Happy Birthday, {friend_name}!\")\n print(\"May all your dreams come true!\")\n\n# Now you can use it for any friend\nsing_birthday_song(\"Bob\")\nsing_birthday_song(\"Alice\")\nsing_birthday_song(\"Charlie\")\n```\n\n**Key benefits:**\n• **Efficiency**: Write once, use everywhere\n• **Maintainability**: Change the song in one place, it updates everywhere\n• **Readability**: Your code is cleaner and easier to understand\n\nKeep exploring functions - they're essential for building organized, efficient programs! 🚀"
365
  else:
366
  answer = f"{slide_info}\n\n**Excellent question! Let me explain this concept based on your curriculum:**\n\n{best_slide_content}\n\nThis slide is teaching you important programming concepts. The curriculum content you're studying is building a strong foundation for your programming journey! 💪\n\n**What this means:** The slide is showing you how programming concepts work in practice. Each element has a specific purpose and helps you understand the bigger picture of programming.\n\n**Why this matters:** Understanding these fundamentals will make you a better programmer. You're learning the building blocks that will help you create amazing programs! 🚀"
367