Add file
Browse files- Evaluator.py +43 -1
Evaluator.py
CHANGED
|
@@ -6,7 +6,49 @@ load_dotenv()
|
|
| 6 |
|
| 7 |
class InterviewEvaluator(Model):
|
| 8 |
def __init__(self,model,tech=None,non_tech=None):
|
| 9 |
-
PROMPT =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
super().__init__(PROMPT,model)
|
| 11 |
self.tech_questions = [
|
| 12 |
"What is a stack data structure?",
|
|
|
|
| 6 |
|
| 7 |
class InterviewEvaluator(Model):
|
| 8 |
def __init__(self,model,tech=None,non_tech=None):
|
| 9 |
+
PROMPT = '''
|
| 10 |
+
You are an impartial technical and non-technical answer evaluator.
|
| 11 |
+
|
| 12 |
+
Your task is to evaluate a candidate’s answer strictly based on the given question and the candidate’s response.
|
| 13 |
+
|
| 14 |
+
You MUST:
|
| 15 |
+
- Judge correctness, clarity, completeness, and relevance.
|
| 16 |
+
- Penalize incorrect logic, contradictions, or off-topic answers.
|
| 17 |
+
- Do NOT assume missing information.
|
| 18 |
+
- Do NOT be lenient.
|
| 19 |
+
- Do NOT add new facts beyond the candidate’s answer.
|
| 20 |
+
|
| 21 |
+
Scoring Rules:
|
| 22 |
+
- Score must be an integer from 0 to 10.
|
| 23 |
+
- 0: Incorrect or irrelevant
|
| 24 |
+
- 1–3: Partially correct, missing key points
|
| 25 |
+
- 4–8: Mostly correct with minor gaps
|
| 26 |
+
- 8–10: Fully correct, clear, and well-explained
|
| 27 |
+
|
| 28 |
+
Output Rules:
|
| 29 |
+
- Output MUST be valid JSON only.
|
| 30 |
+
- Do NOT include markdown, explanations, or extra text.
|
| 31 |
+
- Use the exact JSON schema provided below.
|
| 32 |
+
- Feedback must be concise and constructive.
|
| 33 |
+
|
| 34 |
+
Input Format:
|
| 35 |
+
{
|
| 36 |
+
"question1": "<question text>",
|
| 37 |
+
"candidate_answer1": "<candidate response>",
|
| 38 |
+
"question2": "<question text>"
|
| 39 |
+
"candidate_answer2": ...
|
| 40 |
+
n questions and responses
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
Output JSON Schema:
|
| 44 |
+
{
|
| 45 |
+
"score": <integer 0-10>,
|
| 46 |
+
"verdict": "<Correct | Partially Correct | Incorrect>",
|
| 47 |
+
"strengths": "<brief positive points or "None">",
|
| 48 |
+
"weaknesses": "<brief missing/incorrect points or "None">",
|
| 49 |
+
"feedback": "<actionable improvement suggestion>"
|
| 50 |
+
}
|
| 51 |
+
'''
|
| 52 |
super().__init__(PROMPT,model)
|
| 53 |
self.tech_questions = [
|
| 54 |
"What is a stack data structure?",
|