Spaces:
Sleeping
Sleeping
Commit ·
f4178e2
1
Parent(s): a85389f
v1.7
Browse files- backend/utils/gemini.py +20 -11
backend/utils/gemini.py
CHANGED
|
@@ -377,25 +377,34 @@ async def evaluate_interview(questions_and_answers: list, role_title: str) -> di
|
|
| 377 |
for i, qa in enumerate(questions_and_answers, 1):
|
| 378 |
qa_text += f"\nQ{i}: {qa['question']}\nA{i}: {qa['answer']}\n"
|
| 379 |
|
| 380 |
-
|
| 381 |
-
|
| 382 |
|
| 383 |
Here are the interview questions and the candidate's answers:
|
| 384 |
{qa_text}
|
| 385 |
|
| 386 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
- "overall_score": integer from 0-100
|
| 388 |
- "detailed_scores": list of objects, each with:
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
- "strengths": list of 3-5 strength areas
|
| 394 |
-
- "weaknesses": list of 3-5 areas for improvement
|
| 395 |
-
- "recommendations": list of 3-5 actionable recommendations
|
| 396 |
|
| 397 |
-
|
| 398 |
-
|
| 399 |
prompt = prompt_template.format(role_title=role_title, qa_text=qa_text)
|
| 400 |
|
| 401 |
result = _extract_json_object(await call_gemini(prompt))
|
|
|
|
| 377 |
for i, qa in enumerate(questions_and_answers, 1):
|
| 378 |
qa_text += f"\nQ{i}: {qa['question']}\nA{i}: {qa['answer']}\n"
|
| 379 |
|
| 380 |
+
prompt_template = PromptTemplate.from_template(
|
| 381 |
+
"""You are an interview coach for college students evaluating a candidate for the role: {role_title}
|
| 382 |
|
| 383 |
Here are the interview questions and the candidate's answers:
|
| 384 |
{qa_text}
|
| 385 |
|
| 386 |
+
Evaluation style requirements:
|
| 387 |
+
1. Evaluate based on concept understanding (not perfection), effort, and clarity.
|
| 388 |
+
2. If an answer is incomplete:
|
| 389 |
+
- acknowledge what is correct,
|
| 390 |
+
- gently point out what is missing,
|
| 391 |
+
- give a hint instead of giving the full direct answer.
|
| 392 |
+
3. Avoid harsh, discouraging, or overly critical language.
|
| 393 |
+
4. Keep feedback constructive, encouraging, and learning-oriented.
|
| 394 |
+
|
| 395 |
+
Return a JSON object with:
|
| 396 |
- "overall_score": integer from 0-100
|
| 397 |
- "detailed_scores": list of objects, each with:
|
| 398 |
+
- "question": the question text
|
| 399 |
+
- "answer": the answer text
|
| 400 |
+
- "score": integer 0-100
|
| 401 |
+
- "feedback": specific but supportive coaching feedback for this answer
|
| 402 |
- "strengths": list of 3-5 strength areas
|
| 403 |
+
- "weaknesses": list of 3-5 areas for improvement (worded supportively)
|
| 404 |
+
- "recommendations": list of 3-5 actionable learning recommendations
|
| 405 |
|
| 406 |
+
Return ONLY valid JSON, no markdown formatting."""
|
| 407 |
+
)
|
| 408 |
prompt = prompt_template.format(role_title=role_title, qa_text=qa_text)
|
| 409 |
|
| 410 |
result = _extract_json_object(await call_gemini(prompt))
|