@@ -31,7 +31,7 @@ def evaluate_resume(resume_text):
31
31
"""
32
32
try :
33
33
prompt = f"""
34
- Please evaluate the following resume based on the criteria below, and structure your response according to the format provided :
34
+ Please evaluate the following resume based on the criteria below, and structure your response in JSON format:
35
35
36
36
Criteria:
37
37
1. Relevance of Job Description (30%)
@@ -41,31 +41,45 @@ def evaluate_resume(resume_text):
41
41
5. Soft Skills (10%)
42
42
6. Consistency and Chronology (10%)
43
43
44
- The response should follow this format:
45
-
46
- ### Scores for each criteria:
47
- 1. Relevance of Job Description: X/100
48
- 2. Achievements and Impact: X/100
49
- 3. Education and Certifications: X/100
50
- 4. Resume Structure and Presentation: X/100
51
- 5. Soft Skills: X/100
52
- 6. Consistency and Chronology: X/100
53
-
54
- ### Weighted Total Score: Y/100
55
-
56
- ### Explanation for each criteria:
57
- 1. Relevance of Job Description:
58
- [Explanation of the score]
59
- 2. Achievements and Impact:
60
- [Explanation of the score]
61
- 3. Education and Certifications:
62
- [Explanation of the score]
63
- 4. Resume Structure and Presentation:
64
- [Explanation of the score]
65
- 5. Soft Skills:
66
- [Explanation of the score]
67
- 6. Consistency and Chronology:
68
- [Explanation of the score]
44
+ The response should be in the following JSON format:
45
+
46
+ {{
47
+ "scores": {{
48
+ "Relevance of Job Description": X,
49
+ "Achievements and Impact": X,
50
+ "Education and Certifications": X,
51
+ "Resume Structure and Presentation": X,
52
+ "Soft Skills": X,
53
+ "Consistency and Chronology": X
54
+ }},
55
+ "weighted_total_score": Y,
56
+ "explanations": {{
57
+ "Relevance of Job Description": {{
58
+ "score": X,
59
+ "explanation": "[Explanation of the score]"
60
+ }},
61
+ "Achievements and Impact": {{
62
+ "score": X,
63
+ "explanation": "[Explanation of the score]"
64
+ }},
65
+ "Education and Certifications": {{
66
+ "score": X,
67
+ "explanation": "[Explanation of the score]"
68
+ }},
69
+ "Resume Structure and Presentation": {{
70
+ "score": X,
71
+ "explanation": "[Explanation of the score]"
72
+ }},
73
+ "Soft Skills": {{
74
+ "score": X,
75
+ "explanation": "[Explanation of the score]"
76
+ }},
77
+ "Consistency and Chronology": {{
78
+ "score": X,
79
+ "explanation": "[Explanation of the score]"
80
+ }}
81
+ }}
82
+ }}
69
83
70
84
Resume: { resume_text }
71
85
"""
@@ -80,7 +94,11 @@ def evaluate_resume(resume_text):
80
94
)
81
95
82
96
evaluation = response .choices [0 ].message .content
83
- return evaluation
97
+ evaluation = evaluation .strip ().lstrip ("```json" ).rstrip ("```" )
98
+
99
+ # Return the JSON formatted evaluation
100
+ evaluation_json = json .loads (evaluation )
101
+ return evaluation_json
84
102
85
103
except Exception as e :
86
104
return f'Error evaluating resume: { str (e )} '
0 commit comments