Update main.py
Browse files
main.py
CHANGED
|
@@ -166,27 +166,30 @@ def analyze_transcript_with_gemini(uid, project_id, transcript, duration_seconds
|
|
| 166 |
use_case = project_data.get('detectedUseCase', 'General')
|
| 167 |
context_text = project_data.get('key_points', project_data.get('originalBriefingText', ''))
|
| 168 |
|
| 169 |
-
# --- NEW,
|
| 170 |
prompt = f"""
|
| 171 |
-
You are an expert performance coach and communication analyst. Your task is to analyze the following transcript of a mock '{use_case}'.
|
| 172 |
The user's session was based on a document with these key points: "{context_text}"
|
| 173 |
|
| 174 |
Your analysis must be structured as a valid JSON object. Do not include any text before or after the JSON object.
|
| 175 |
|
| 176 |
-
**Step 1:
|
| 177 |
-
First,
|
| 178 |
-
- If the conversation is NOT substantive, you MUST return a JSON object where all scores are 5, and the feedback fields explain that the session was too short to analyze.
|
| 179 |
-
- If the conversation IS substantive, proceed to Step 2.
|
| 180 |
|
| 181 |
-
**Step 2: Detailed Performance Evaluation**
|
| 182 |
-
Evaluate the user's performance on
|
| 183 |
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
4. **Resilience Under Pressure:** Score based on the ability to handle challenging follow-up questions. If no such questions were asked or answered, this score should be low by default.
|
| 188 |
|
| 189 |
-
**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
The JSON structure MUST be:
|
| 192 |
{{
|
|
|
|
| 166 |
use_case = project_data.get('detectedUseCase', 'General')
|
| 167 |
context_text = project_data.get('key_points', project_data.get('originalBriefingText', ''))
|
| 168 |
|
| 169 |
+
# --- NEW, FAIRER PROMPT ---
|
| 170 |
prompt = f"""
|
| 171 |
+
You are an expert performance coach and communication analyst. Your task is to analyze the following transcript of a mock '{use_case}' with fairness and a focus on constructive feedback.
|
| 172 |
The user's session was based on a document with these key points: "{context_text}"
|
| 173 |
|
| 174 |
Your analysis must be structured as a valid JSON object. Do not include any text before or after the JSON object.
|
| 175 |
|
| 176 |
+
**Step 1: Assess Conversation Depth and Effort**
|
| 177 |
+
First, evaluate the substance of the conversation. Crucially, you must differentiate between a user who makes a **good-faith effort but struggles** (e.g., gives a short, nervous, or incomplete but relevant answer) and a user who provides **no substantive response at all** (e.g., only says "hello" or hangs up). A good-faith effort, even if imperfect, should be scored higher than no effort.
|
|
|
|
|
|
|
| 178 |
|
| 179 |
+
**Step 2: Detailed Performance Evaluation with Scoring Rubric**
|
| 180 |
+
Evaluate the user's performance on the four core criteria. Use the following scoring rubric to guide your scores:
|
| 181 |
|
| 182 |
+
* **0-40 (Needs Significant Work):** Use this range for sessions that are extremely short with no real answers, or for responses that are completely off-topic or incoherent.
|
| 183 |
+
* **41-70 (Developing):** This is for users who are making a good-faith effort but are still developing their skills. Their answers might be relevant but lack depth, confidence, or clarity. This is the range for a "struggling" user.
|
| 184 |
+
* **71-100 (Proficient to Excellent):** Use this range for users who provide clear, confident, and well-supported answers to one or more questions.
|
|
|
|
| 185 |
|
| 186 |
+
**Core Criteria Definitions:**
|
| 187 |
+
1. **Communication Skills:** Score based on clarity and confidence.
|
| 188 |
+
2. **Content Mastery:** Score based on relevance and support for claims. An answer must be on-topic to score above 40.
|
| 189 |
+
3. **Engagement & Delivery:** Score based on tone and pacing. Can only be reasonably scored in a back-and-forth exchange.
|
| 190 |
+
4. **Resilience Under Pressure:** Score based on handling follow-up questions. If no follow-up was possible, this score should reflect that, typically in the lower-mid range.
|
| 191 |
+
|
| 192 |
+
**Final Instruction:** Your primary goal is to be a constructive coach. If the scores are low because the session was too short, the qualitative feedback fields MUST explain this clearly and encourage the user to try a longer session to get a more accurate analysis.
|
| 193 |
|
| 194 |
The JSON structure MUST be:
|
| 195 |
{{
|