IliaLarchenko commited on
Commit
91c3505
1 Parent(s): 9bc730f

Restructured graders input and candidate messages

Browse files
tests/candidate.py CHANGED
@@ -67,7 +67,7 @@ def complete_interview(interview_type, exp_name, requirements="", difficulty="",
67
  )
68
  response_json = json.loads(response.choices[0].message.content)
69
 
70
- code = response_json.get("code", "")
71
  candidate_message = response_json.get("message", "")
72
 
73
  if not code and not candidate_message:
@@ -77,7 +77,7 @@ def complete_interview(interview_type, exp_name, requirements="", difficulty="",
77
  messages_candidate.append({"role": "assistant", "content": response.choices[0].message.content})
78
 
79
  if code:
80
- interview_data["transcript"].append(f"CANDIDATE CODE: {code}")
81
  elif candidate_message:
82
  interview_data["transcript"].append(f"CANDIDATE MESSAGE: {candidate_message}")
83
 
 
67
  )
68
  response_json = json.loads(response.choices[0].message.content)
69
 
70
+ code = response_json.get("code_and_notes", "")
71
  candidate_message = response_json.get("message", "")
72
 
73
  if not code and not candidate_message:
 
77
  messages_candidate.append({"role": "assistant", "content": response.choices[0].message.content})
78
 
79
  if code:
80
+ interview_data["transcript"].append(f"CANDIDATE CODE AND NOTES: {code}")
81
  elif candidate_message:
82
  interview_data["transcript"].append(f"CANDIDATE MESSAGE: {candidate_message}")
83
 
tests/grader.py CHANGED
@@ -11,10 +11,21 @@ def grade(json_file_path, model="gpt-4-turbo"):
11
  with open(json_file_path) as file:
12
  interview_data = json.load(file)
13
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  messages = [
15
  {"role": "system", "content": grader_prompt},
16
- {"role": "user", "content": f"Interview data: {interview_data}"},
17
- {"role": "user", "content": "Please evaluate the interview."},
18
  ]
19
 
20
  response = client.chat.completions.create(model=model, messages=messages, temperature=1, response_format={"type": "json_object"})
 
11
  with open(json_file_path) as file:
12
  interview_data = json.load(file)
13
 
14
+ interview_summary_list = []
15
+ interview_summary_list.append(f"Interview type: {interview_data['inputs']['interview_type']}")
16
+ interview_summary_list.append(f"Interview difficulty: {interview_data['inputs']['difficulty']}")
17
+ interview_summary_list.append(f"Interview topic: {interview_data['inputs']['topic']}")
18
+ if interview_data["inputs"]["requirements"] != "":
19
+ interview_summary_list.append(f"Interview requirements: {interview_data['inputs']['requirements']}")
20
+ interview_summary_list.append(f"Problem statement proposed by interviewer: {interview_data['problem_statement']}")
21
+ interview_summary_list.append(f"\nTranscript of the whole interview below:")
22
+ interview_summary_list += interview_data["transcript"]
23
+ interview_summary_list.append(f"\nTHE MAIN PART OF THE INTERVIEW ENDED HERE.")
24
+ interview_summary_list.append(f"Feedback provided by interviewer: {interview_data['feedback']}")
25
+
26
  messages = [
27
  {"role": "system", "content": grader_prompt},
28
+ {"role": "user", "content": f"Please evaluate the interviewer based on the following data: \n {'\n'.join(interview_summary_list)}"},
 
29
  ]
30
 
31
  response = client.chat.completions.create(model=model, messages=messages, temperature=1, response_format={"type": "json_object"})
tests/testing_prompts.py CHANGED
@@ -4,12 +4,13 @@ You should solve the problem in a very small and incremental steps and explain y
4
  Don't rush to give the whole solution at once.
5
  Sometime make mistakes in logic, computations, or syntax. Pretend you are stuck and ask for help.
6
  Follow interviewer (user) instructions and answer their questions.
 
7
  You can ask for clarification if you don't understand something.
8
- Each your answer should be a json with 4 keys: "finished", "question", "message" and "code".
9
  "finished" is a boolean, it is True if the user told you that the interview is finished, otherwise False.
10
  "question" is a boolean, it is True if the last user message contains a question, otherwise False.
11
  "message" is a string, it is a message you want to tell the interviewer. Message should never be empty.
12
- "code" is a string, it is the current version of your notes (it can be code, query, pseudocode, answer structure, formulas, calculations, schemas, examples, test cases, etc.), if it didn't change from the last message return an empty string. Try to actively use this field, it is very important.
13
  """
14
 
15
 
@@ -43,6 +44,8 @@ You should evaluate the following aspects and return a JSON with these keys:
43
  "interviewer_leaks": "The interviewer didn't leak any hidden notes to candidate during the main part of the interview.",
44
  "interviewer_empty": "The interviewer didn't send any empty messages.",
45
  "interviewer_notes": "The interviewer made reasonable notes catching candidates mistakes and important facts.",
 
 
46
 
47
  "feedback_quality": "The feedback was constructive and offered actionable insights.",
48
  "feedback_overview": "The feedback contains the recap of main mistakes and good ideas of the candidate.",
 
4
  Don't rush to give the whole solution at once.
5
  Sometime make mistakes in logic, computations, or syntax. Pretend you are stuck and ask for help.
6
  Follow interviewer (user) instructions and answer their questions.
7
+ If you see that you and interviewer are repeating yourselves just move on to the next point.
8
  You can ask for clarification if you don't understand something.
9
+ Each your answer should be a json with 4 keys: "finished", "question", "message" and "code_and_notes".
10
  "finished" is a boolean, it is True if the user told you that the interview is finished, otherwise False.
11
  "question" is a boolean, it is True if the last user message contains a question, otherwise False.
12
  "message" is a string, it is a message you want to tell the interviewer. Message should never be empty.
13
+ "code_and_notes" is a string, it is the current version of your notes (it can be code, query, pseudocode, answer structure, formulas, calculations, schemas, examples, test cases, etc.), if it didn't change from the last message return an empty string. Try to actively use this field, it is very important.
14
  """
15
 
16
 
 
44
  "interviewer_leaks": "The interviewer didn't leak any hidden notes to candidate during the main part of the interview.",
45
  "interviewer_empty": "The interviewer didn't send any empty messages.",
46
  "interviewer_notes": "The interviewer made reasonable notes catching candidates mistakes and important facts.",
47
+ "interviewer_stuck": "The interview stuck at some point in repeating cycle of same questions and answers.",
48
+ "interviewer_end": "The interview ended interview after candidate answer all questions (vs. interview ended abruptly).",
49
 
50
  "feedback_quality": "The feedback was constructive and offered actionable insights.",
51
  "feedback_overview": "The feedback contains the recap of main mistakes and good ideas of the candidate.",