sparshmehta commited on
Commit
202976e
·
verified ·
1 Parent(s): 242d8d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +69 -80
app.py CHANGED
@@ -436,7 +436,7 @@ class ContentAnalyzer:
436
  time.sleep(self.retry_delay * (2 ** attempt))
437
 
438
  def _create_analysis_prompt(self, transcript: str) -> str:
439
- """Create the analysis prompt with smart timestamp handling and stricter evaluation criteria"""
440
  # First try to extract existing timestamps
441
  timestamps = re.findall(r'\[(\d{2}:\d{2})\]', transcript)
442
 
@@ -462,7 +462,7 @@ Example: If a quote starts at word 300, timestamp would be [02:00] (300 words /
462
  marked_transcript += word + " "
463
  transcript = marked_transcript
464
 
465
- prompt_template = """Analyze this teaching content with extremely strict evaluation criteria. Score 1 ONLY if ALL requirements are FULLY met with NO exceptions.
466
 
467
  Transcript:
468
  {transcript}
@@ -474,121 +474,110 @@ Required JSON structure:
474
  {{
475
  "Concept Assessment": {{
476
  "Subject Matter Accuracy": {{
477
- "Score": 1, # Score 1 ONLY if ALL technical information is 100% accurate with NO errors or oversimplifications
478
  "Citations": ["[MM:SS] Quote demonstrating accuracy or error"]
479
  }},
480
  "First Principles Approach": {{
481
- "Score": 1, # Score 1 ONLY if EVERY concept is built from fundamentals with clear progression
482
  "Citations": ["[MM:SS] Quote showing fundamental concept explanation"]
483
  }},
484
  "Examples and Business Context": {{
485
- "Score": 1, # Score 1 ONLY if 3+ relevant, detailed real-world examples are provided
486
  "Citations": ["[MM:SS] Quote containing practical example"]
487
  }},
488
  "Cohesive Storytelling": {{
489
- "Score": 1, # Score 1 ONLY if ALL transitions are smooth with explicit connections between topics
490
  "Citations": ["[MM:SS] Quote showing topic transition or connection"]
491
  }},
492
  "Engagement and Interaction": {{
493
- "Score": 1, # Score 1 ONLY if at least more than 1 different engagement techniques are used effectively
494
  "Citations": ["[MM:SS] Quote showing audience engagement"]
495
  }},
496
  "Professional Tone": {{
497
- "Score": 1, # Score 1 ONLY if language is consistently professional with NO casual expressions
498
  "Citations": ["[MM:SS] Quote demonstrating tone"]
499
  }}
500
  }},
501
  "Code Assessment": {{
502
  "Depth of Explanation": {{
503
- "Score": 1, # Score 1 ONLY if EVERY code concept includes what, why, and implementation details
504
- "Citations": ["[MM:SS] Quote showing detailed code explanation"]
505
  }},
506
  "Output Interpretation": {{
507
- "Score": 1, # Score 1 ONLY if ALL code outputs are explained with their significance and error cases
508
  "Citations": ["[MM:SS] Quote demonstrating output explanation"]
509
  }},
510
  "Breaking down Complexity": {{
511
- "Score": 1, # Score 1 ONLY if ALL complex concepts are broken into clear, logical sub-components
512
  "Citations": ["[MM:SS] Quote showing concept breakdown"]
513
  }}
514
  }}
515
  }}
516
 
517
- Extremely Strict Evaluation Criteria:
518
 
519
  Concept Assessment:
520
- 1. Subject Matter Accuracy (Must meet ALL):
521
- - Zero factual errors or technical inaccuracies
522
- - No oversimplifications that could lead to misconceptions
523
- - All technical terms used with precise definitions
524
- - Complete and accurate explanations of all concepts
525
- - Clear distinction between facts and opinions
526
-
527
- 2. First Principles Approach (Must meet ALL):
528
- - Every concept explicitly built from fundamental principles
529
- - Clear progression from basic to advanced concepts
530
- - No assumptions about prior knowledge
531
- - Each building block thoroughly explained
532
- - Logical sequence of concept introduction
533
-
534
- 3. Examples and Business Context (Must meet ALL):
535
- - Minimum 3 detailed, relevant real-world examples
536
- - Each example directly tied to concept being taught
537
- - Clear business value explanation for each example
538
- - Practical implementation considerations discussed
539
- - Industry-specific applications highlighted
540
-
541
- 4. Cohesive Storytelling (Must meet ALL):
542
- - Explicit connections between all related concepts
543
- - Clear narrative thread throughout presentation
544
- - Smooth transitions between all topics
545
- - No unexplained topic jumps
546
- - Consistent story arc from start to finish
547
-
548
- 5. Engagement and Interaction (Must meet ALL):
549
- - Minimum 3 different engagement techniques used
550
- - Direct audience involvement opportunities
551
- - Clear checks for understanding
552
- - Interactive elements in presentation
553
- - Varied teaching methods demonstrated
554
-
555
- 6. Professional Tone (Must meet ALL):
556
- - Zero casual or colloquial expressions
557
- - Consistent technical vocabulary
558
- - Clear and confident delivery
559
  - Appropriate level of formality
560
- - No filler words or hesitations
561
 
562
  Code Assessment:
563
- 1. Depth of Explanation (Must meet ALL):
564
- - Every code concept explains what, why, and how
565
- - Implementation details thoroughly covered
566
- - Design decisions explicitly justified
567
- - Performance implications discussed
568
- - Best practices highlighted
569
-
570
- 2. Output Interpretation (Must meet ALL):
571
- - All code outputs explained with significance
572
- - Error cases and edge cases covered
573
- - Expected vs actual results discussed
574
- - Output validation methods explained
575
- - Debugging approaches covered
576
-
577
- 3. Breaking down Complexity (Must meet ALL):
578
- - All complex concepts divided into clear sub-components
579
- - Step-by-step explanation of difficult concepts
580
- - Clear progression in complexity
581
- - Logical organization of technical content
582
- - Dependencies and relationships explained
583
 
584
  Important:
585
- - Score 1 ONLY if ALL criteria for that category are fully met
586
- - ANY missing element results in a score of 0
587
- - Each citation must include exact timestamp and relevant quote
588
- - Citations must clearly demonstrate how criteria are/aren't met
589
- - Be extremely strict and objective in scoring
590
- - When in doubt, score 0
591
- - No partial credit - all requirements must be met for a score of 1"""
592
 
593
  return prompt_template.format(
594
  transcript=transcript,
 
436
  time.sleep(self.retry_delay * (2 ** attempt))
437
 
438
  def _create_analysis_prompt(self, transcript: str) -> str:
439
+ """Create the analysis prompt with more balanced evaluation criteria"""
440
  # First try to extract existing timestamps
441
  timestamps = re.findall(r'\[(\d{2}:\d{2})\]', transcript)
442
 
 
462
  marked_transcript += word + " "
463
  transcript = marked_transcript
464
 
465
+ prompt_template = """Analyze this teaching content with balanced evaluation criteria. Score 1 if most key requirements are met.
466
 
467
  Transcript:
468
  {transcript}
 
474
  {{
475
  "Concept Assessment": {{
476
  "Subject Matter Accuracy": {{
477
+ "Score": 1, # Score 1 if technical information is generally accurate with minor errors acceptable
478
  "Citations": ["[MM:SS] Quote demonstrating accuracy or error"]
479
  }},
480
  "First Principles Approach": {{
481
+ "Score": 1, # Score 1 if most concepts are built from fundamentals with clear progression
482
  "Citations": ["[MM:SS] Quote showing fundamental concept explanation"]
483
  }},
484
  "Examples and Business Context": {{
485
+ "Score": 1, # Score 1 if at least 2 relevant real-world examples are provided
486
  "Citations": ["[MM:SS] Quote containing practical example"]
487
  }},
488
  "Cohesive Storytelling": {{
489
+ "Score": 1, # Score 1 if most transitions are smooth with clear connections between topics
490
  "Citations": ["[MM:SS] Quote showing topic transition or connection"]
491
  }},
492
  "Engagement and Interaction": {{
493
+ "Score": 1, # Score 1 if at least 1 engagement technique is used effectively
494
  "Citations": ["[MM:SS] Quote showing audience engagement"]
495
  }},
496
  "Professional Tone": {{
497
+ "Score": 1, # Score 1 if language is generally professional with occasional casual expressions acceptable
498
  "Citations": ["[MM:SS] Quote demonstrating tone"]
499
  }}
500
  }},
501
  "Code Assessment": {{
502
  "Depth of Explanation": {{
503
+ "Score": 1, # Score 1 if most code concepts include what and why explanations
504
+ "Citations": ["[MM:SS] Quote showing code explanation"]
505
  }},
506
  "Output Interpretation": {{
507
+ "Score": 1, # Score 1 if most code outputs are explained with their significance
508
  "Citations": ["[MM:SS] Quote demonstrating output explanation"]
509
  }},
510
  "Breaking down Complexity": {{
511
+ "Score": 1, # Score 1 if complex concepts are generally broken into understandable components
512
  "Citations": ["[MM:SS] Quote showing concept breakdown"]
513
  }}
514
  }}
515
  }}
516
 
517
+ Balanced Evaluation Criteria:
518
 
519
  Concept Assessment:
520
+ 1. Subject Matter Accuracy:
521
+ - Generally accurate technical information
522
+ - Minor errors acceptable if core concepts are correct
523
+ - Clear explanation of key technical terms
524
+ - Comprehensive coverage of main concepts
525
+
526
+ 2. First Principles Approach:
527
+ - Most concepts built from fundamental principles
528
+ - Clear progression in concept difficulty
529
+ - Basic concepts explained before advanced ones
530
+ - Logical sequence of topics
531
+
532
+ 3. Examples and Business Context:
533
+ - At least 2 relevant real-world examples
534
+ - Examples clearly related to concepts
535
+ - Business value explained
536
+ - Practical applications discussed
537
+
538
+ 4. Cohesive Storytelling:
539
+ - Most topics connected logically
540
+ - Generally clear narrative flow
541
+ - Smooth transitions between main topics
542
+ - Consistent overall structure
543
+
544
+ 5. Engagement and Interaction:
545
+ - At least 1 engagement technique used
546
+ - Some audience involvement
547
+ - Occasional checks for understanding
548
+ - Varied teaching approach
549
+
550
+ 6. Professional Tone:
551
+ - Generally professional language
552
+ - Occasional casual expressions acceptable
553
+ - Clear delivery
 
 
 
 
 
554
  - Appropriate level of formality
 
555
 
556
  Code Assessment:
557
+ 1. Depth of Explanation:
558
+ - Most code concepts explain what and why
559
+ - Key implementation details covered
560
+ - Important design decisions explained
561
+ - Best practices mentioned
562
+
563
+ 2. Output Interpretation:
564
+ - Most code outputs explained
565
+ - Key error cases covered
566
+ - Expected results discussed
567
+ - Basic validation covered
568
+
569
+ 3. Breaking down Complexity:
570
+ - Complex concepts divided into components
571
+ - Step-by-step explanation of key concepts
572
+ - Logical organization
573
+ - Dependencies explained
 
 
 
574
 
575
  Important:
576
+ - Score 1 if most criteria in a category are met
577
+ - Minor gaps or imperfections acceptable
578
+ - Each citation must include timestamp and relevant quote
579
+ - Citations should demonstrate how criteria are met
580
+ - Be balanced in scoring - perfection not required"""
 
 
581
 
582
  return prompt_template.format(
583
  transcript=transcript,