Spaces:
Paused
Paused
Add essential LLM prompt files for golf swing analysis
Browse files- models/prompts.py: Utility to load coach prompt template from markdown
- models/coach_prompt.md: Comprehensive coaching prompt template for LLM analysis
These files are required for the AI-powered golf swing coaching functionality
and were missing from the previous commit.
- app/models/coach_prompt.md +177 -0
- app/models/prompts.py +11 -0
app/models/coach_prompt.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Golf Swing Analysis
|
| 2 |
+
|
| 3 |
+
## PROFESSIONAL BENCHMARKS FOR CALIBRATION
|
| 4 |
+
Use these professional standards as your 100% reference for scoring. These represent elite-level golf swing mechanics based on actual LPGA Tour professional analysis:
|
| 5 |
+
|
| 6 |
+
### Professional Golfer Analysis Summary (100% Reference Standards):
|
| 7 |
+
|
| 8 |
+
**Atthaya Thitikul (LPGA Tour - Elite Level):**
|
| 9 |
+
- Hip Rotation: 63.4°, Shoulder Rotation: 120°, Posture Score: 98.2%
|
| 10 |
+
- Weight Shift: 88.4%, Arm Extension: 99.8%, Wrist Hinge: 120°
|
| 11 |
+
- Energy Transfer: 96.1%, Power Accumulation: 100%, Potential Distance: 295 yards
|
| 12 |
+
- Sequential Kinematic Sequence: 100%, Swing Plane Consistency: 85%
|
| 13 |
+
|
| 14 |
+
**Nelly Korda (LPGA Tour - Elite Level):**
|
| 15 |
+
- Hip Rotation: 90°, Shoulder Rotation: 120°, Posture Score: 97.4%
|
| 16 |
+
- Weight Shift: 73.5%, Arm Extension: 96.7%, Wrist Hinge: 114.8°
|
| 17 |
+
- Energy Transfer: 91.2%, Power Accumulation: 100%, Potential Distance: 289 yards
|
| 18 |
+
- Sequential Kinematic Sequence: 100%, Swing Plane Consistency: 85%
|
| 19 |
+
|
| 20 |
+
**Demi Runas (Professional Level):**
|
| 21 |
+
- Hip Rotation: 63.4°, Shoulder Rotation: 120°, Posture Score: 95.9%
|
| 22 |
+
- Weight Shift: 63.9%, Arm Extension: 96.6%, Wrist Hinge: 93.4°
|
| 23 |
+
- Energy Transfer: 88.0%, Power Accumulation: 100%, Potential Distance: 286 yards
|
| 24 |
+
- Sequential Kinematic Sequence: 100%, Swing Plane Consistency: 85%
|
| 25 |
+
|
| 26 |
+
**Rose Zhang (LPGA Tour Professional):**
|
| 27 |
+
- Hip Rotation: 90°, Shoulder Rotation: 120°, Posture Score: 98.0%
|
| 28 |
+
- Weight Shift: 89.9%, Arm Extension: 79.5%, Wrist Hinge: 112.8°
|
| 29 |
+
- Energy Transfer: 96.6%, Power Accumulation: 100%, Potential Distance: 296 yards
|
| 30 |
+
- Sequential Kinematic Sequence: 100%, Swing Plane Consistency: 85%
|
| 31 |
+
- Speed Generation: Body-dominant
|
| 32 |
+
|
| 33 |
+
**Lydia Ko (LPGA Tour Professional):**
|
| 34 |
+
- Hip Rotation: 90°, Shoulder Rotation: 120°, Posture Score: 99.2%
|
| 35 |
+
- Weight Shift: 66.2%, Arm Extension: 62.1%, Wrist Hinge: 120°
|
| 36 |
+
- Energy Transfer: 88.7%, Power Accumulation: 100%, Potential Distance: 286 yards
|
| 37 |
+
- Sequential Kinematic Sequence: 100%, Swing Plane Consistency: 70%
|
| 38 |
+
- Speed Generation: Body-dominant
|
| 39 |
+
|
| 40 |
+
### **PROFESSIONAL STANDARDS CALIBRATION (100% Level):**
|
| 41 |
+
**Core Biomechanical Metrics:**
|
| 42 |
+
- **Hip Rotation**: 25-90° (Professional range - multiple successful approaches)
|
| 43 |
+
- **Shoulder Rotation**: 60-120° (Professional upper body coil range)
|
| 44 |
+
- **Posture Score**: 95-99% (Exceptional spine angle consistency across all professionals)
|
| 45 |
+
- **Weight Shift**: 53-90% (Professional range varies significantly by style)
|
| 46 |
+
|
| 47 |
+
**Upper Body Excellence:**
|
| 48 |
+
- **Arm Extension**: 62-100% (Wide professional range - Lydia shows low extension can work)
|
| 49 |
+
- **Wrist Hinge**: 93-120° (Optimal lag and release timing)
|
| 50 |
+
- **Swing Plane Consistency**: 70-85% (Professional-level repeatability)
|
| 51 |
+
- **Chest Rotation Efficiency**: 66-100% (Coordination varies by swing style)
|
| 52 |
+
|
| 53 |
+
**Power & Efficiency Markers:**
|
| 54 |
+
- **Energy Transfer Efficiency**: 65-97% (Wide professional range - multiple successful approaches)
|
| 55 |
+
- **Power Accumulation**: 84-100% (Power generation across all styles)
|
| 56 |
+
- **Sequential Kinematic Sequence**: 69-100% (Professional coordination standards)
|
| 57 |
+
- **Potential Distance**: 242-296 yards (Professional power range)
|
| 58 |
+
|
| 59 |
+
**Movement Quality Standards:**
|
| 60 |
+
- **Head Movement**: 1-8 inches (Controlled movement varies by professional)
|
| 61 |
+
- **Ground Force Efficiency**: 53-90% (Professional ground interaction range)
|
| 62 |
+
- **Hip Thrust**: 30-100% (Lower body drive varies significantly)
|
| 63 |
+
|
| 64 |
+
### **AMATEUR REFERENCE EXAMPLES FOR CALIBRATION:**
|
| 65 |
+
|
| 66 |
+
**70% Level Skilled Amateur (Female):**
|
| 67 |
+
- Hip Rotation: 23.0°, Shoulder Rotation: 120° (Excellent shoulder turn, limited hip mobility)
|
| 68 |
+
- Posture Score: 89.5%, Weight Shift: 90.0% (Strong fundamentals)
|
| 69 |
+
- Arm Extension: 99.8%, Wrist Hinge: 49.4° (Great extension, needs more lag)
|
| 70 |
+
- Energy Transfer: 94.5%, Power Accumulation: 82.1% (Very good coordination)
|
| 71 |
+
- Potential Distance: 273 yards, Sequential Kinematic: 93.6%
|
| 72 |
+
- Head Movement: 8.0in lateral, 6.0in vertical (Excessive movement)
|
| 73 |
+
- Speed Generation: Mixed
|
| 74 |
+
|
| 75 |
+
**50-60% Level Amateur (Female - Arms-Dominant):**
|
| 76 |
+
- Hip Rotation: 25°, Shoulder Rotation: 60° (Limited body rotation)
|
| 77 |
+
- Posture Score: 80.6%, Weight Shift: 50.0% (Needs improvement)
|
| 78 |
+
- Arm Extension: 94.8%, Wrist Hinge: 116.6° (Good extension, excellent lag)
|
| 79 |
+
- Energy Transfer: 56.8%, Power Accumulation: 89.3% (Mixed efficiency)
|
| 80 |
+
- Potential Distance: 241 yards, Sequential Kinematic: 66.8%
|
| 81 |
+
- Head Movement: 3.0in lateral, 2.0in vertical (Good head control)
|
| 82 |
+
- Ground Force: 50.0%, Hip Thrust: 30.0% (Weak lower body)
|
| 83 |
+
- Speed Generation: Arms-dominant
|
| 84 |
+
|
| 85 |
+
**CRITICAL INSIGHTS FROM PROFESSIONAL AND AMATEUR ANALYSIS:**
|
| 86 |
+
1. **Hip Rotation Shows Variation**: Professionals range from 63-90°, with moderate rotation (63°) and full rotation (90°) both achieving elite results
|
| 87 |
+
2. **Shoulder Rotation Critical Threshold**: 120° consistently achieved by all professionals, showing this as the elite standard
|
| 88 |
+
3. **Multiple Successful Swing Styles**: Body-dominant swings both achieve elite results with different hip mobility approaches
|
| 89 |
+
4. **Posture Consistency Universal**: All professionals maintain 95-99% posture scores regardless of swing style
|
| 90 |
+
5. **Arm Extension Varies Dramatically**: Professional range 62-100% shows that both high extension (96-100%) and compact swings (62%) can be highly effective
|
| 91 |
+
6. **Energy Transfer Multiple Pathways**: Range from 88-97% in professionals, showing consistent high-level power generation approaches
|
| 92 |
+
7. **Power Accumulation Excellence**: All professionals achieve 100% efficiency, showing this as the elite standard
|
| 93 |
+
8. **Distance Generation Diversity**: Professional distances range 285-296 yards through different mechanical approaches
|
| 94 |
+
9. **Weight Transfer Success Patterns**: Professional range 63-90% shows multiple effective weight shift strategies
|
| 95 |
+
10. **Sequential Timing Excellence**: Professional kinematic sequence consistently at 100%, showing perfect coordination as the standard
|
| 96 |
+
11. **Wrist Hinge Consistency**: Professionals range 93-120°, showing different but effective lag and release strategies
|
| 97 |
+
12. **Ground Force Utilization Excellence**: Range 63-90% with elite players achieving consistent high efficiency through proper lower body mechanics
|
| 98 |
+
|
| 99 |
+
## CURRENT SWING ANALYSIS
|
| 100 |
+
|
| 101 |
+
### Swing Phase Breakdown
|
| 102 |
+
{swing_phase_data}
|
| 103 |
+
|
| 104 |
+
### Core Body Mechanics
|
| 105 |
+
{core_mechanics}
|
| 106 |
+
|
| 107 |
+
### Upper Body Mechanics
|
| 108 |
+
{upper_body}
|
| 109 |
+
|
| 110 |
+
### Lower Body Mechanics
|
| 111 |
+
{lower_body}
|
| 112 |
+
|
| 113 |
+
### Movement Quality & Timing
|
| 114 |
+
{movement_quality}
|
| 115 |
+
|
| 116 |
+
## ANALYSIS INSTRUCTIONS
|
| 117 |
+
|
| 118 |
+
**GOLF SWING ANALYSIS FORMAT**
|
| 119 |
+
Use the benchmarks above to guide your evaluation. Follow this exact format:
|
| 120 |
+
|
| 121 |
+
**PERFORMANCE_CLASSIFICATION:** [XX%]
|
| 122 |
+
(XX = number from 10% to 100%)
|
| 123 |
+
|
| 124 |
+
**Metric Evaluations**
|
| 125 |
+
|
| 126 |
+
For each of the 5 core metrics below, write exactly 3 sentences evaluating the metric:
|
| 127 |
+
1. First sentence: State if it's good, bad, or needs improvement compared to elite standards
|
| 128 |
+
2. Second sentence: Compare the specific value to professional ranges
|
| 129 |
+
3. Third sentence: Brief explanation of impact on swing performance
|
| 130 |
+
|
| 131 |
+
**1. Tempo Ratio Evaluation:**
|
| 132 |
+
[3 sentences about tempo ratio]
|
| 133 |
+
|
| 134 |
+
**2. Shoulder Rotation @ Top Evaluation:**
|
| 135 |
+
[3 sentences about shoulder rotation at top of backswing]
|
| 136 |
+
|
| 137 |
+
**3. Hip Rotation @ Impact Evaluation:**
|
| 138 |
+
[3 sentences about hip rotation at impact]
|
| 139 |
+
|
| 140 |
+
**4. X-Factor @ Top Evaluation:**
|
| 141 |
+
[3 sentences about X-Factor (shoulder-hip separation) at top]
|
| 142 |
+
|
| 143 |
+
**5. Posture Score Evaluation:**
|
| 144 |
+
[3 sentences about overall posture throughout swing]
|
| 145 |
+
|
| 146 |
+
**SCORING GUIDELINES (Use to help decide % score)**
|
| 147 |
+
|
| 148 |
+
| Metric | Professional Standard | Note |
|
| 149 |
+
|--------|----------------------|------|
|
| 150 |
+
| Hip Rotation | 25°–90° | <25° is weak |
|
| 151 |
+
| Shoulder Rotation | 60°–120° | <60° is weak |
|
| 152 |
+
| Energy Transfer | 65–97% | <65% = score <60% |
|
| 153 |
+
| Sequential Kinematics | 69–100% | <69% = score <70% |
|
| 154 |
+
| Weight Shift | 53–90% | <53% = weakness |
|
| 155 |
+
| Head Movement | 1–8 in | >8 in = major issue |
|
| 156 |
+
| Arm Extension | 62–100% | <62% = weakness |
|
| 157 |
+
| Power Accumulation | 84–100% | <84% = weakness |
|
| 158 |
+
|
| 159 |
+
**Classification Bands:**
|
| 160 |
+
- **90–100%**: Tour-level
|
| 161 |
+
- **80–89%**: Advanced amateur
|
| 162 |
+
- **70–79%**: Skilled
|
| 163 |
+
- **60–69%**: Intermediate
|
| 164 |
+
- **50–59%**: Developing
|
| 165 |
+
- **40–49%**: Beginner
|
| 166 |
+
- **10–39%**: Novice
|
| 167 |
+
|
| 168 |
+
**STYLE & FORMATTING RULES:**
|
| 169 |
+
- Use these headers: PERFORMANCE_CLASSIFICATION, Metric Evaluations, and the 5 numbered metric sections
|
| 170 |
+
- No emojis anywhere in the response
|
| 171 |
+
- Write exactly 3 sentences for each metric evaluation
|
| 172 |
+
- Tie all evaluations to professional standards and ranges
|
| 173 |
+
- Use a positive, coaching tone throughout
|
| 174 |
+
- Avoid saying "perfect" — say "strong" or "meets standards"
|
| 175 |
+
- Focus on biomechanics and compare actual values to pro ranges
|
| 176 |
+
|
| 177 |
+
|
app/models/prompts.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Prompt templates for LLM analysis
|
| 3 |
+
"""
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
def load_coach_prompt():
|
| 7 |
+
"""Load the coach prompt template from markdown file"""
|
| 8 |
+
prompt_file = Path(__file__).with_name("coach_prompt.md")
|
| 9 |
+
return prompt_file.read_text()
|
| 10 |
+
|
| 11 |
+
COACH_PROMPT = load_coach_prompt()
|