rairo commited on
Commit
6df647b
·
verified ·
1 Parent(s): 6599845

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +16 -13
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, MORE ROBUST 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}'.
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: Substance Gatekeeper Analysis**
177
- First, determine if the transcript contains a substantive conversation. A substantive conversation involves at least one meaningful question from the AI and one meaningful answer from the user. A transcript with only greetings (e.g., "Hello", "Hi there") or a single unanswered question is NOT substantive.
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 these four core criteria. Your evaluation must consider the DEPTH and COMPLETENESS of the user's responses.
183
 
184
- 1. **Communication Skills:** Score based on clarity, confidence, and conciseness. A high score requires more than just a single clear sentence; it requires sustained clarity throughout a meaningful exchange.
185
- 2. **Content Mastery:** Score based on subject knowledge and logical support for claims. A user who doesn't answer any core questions CANNOT receive a high score, no matter how well they greet the interviewer.
186
- 3. **Engagement & Delivery:** Score based on tone, pacing, and audience awareness. This can only be judged in a real back-and-forth conversation, not from a simple greeting.
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
- **Penalty Clause:** Explicitly penalize short or incomplete sessions. If the user only answered one question and then the call ended, their scores should be significantly lower than if they had completed a full, multi-question session.
 
 
 
 
 
 
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
  {{