WebashalarForML commited on
Commit
4c1b310
·
verified ·
1 Parent(s): 31b90b8

Update utils/mistral.py

Browse files
Files changed (1) hide show
  1. utils/mistral.py +33 -31
utils/mistral.py CHANGED
@@ -50,14 +50,14 @@ def Model_ProfessionalDetails_Output(resume, client):
50
  Extract the text in the following output JSON string as:
51
  {{
52
  "professional": {{
53
- "technical_skills": ["List all technical skills, programming languages, frameworks, and technologies mentioned in the resume, ensuring they are not mixed with other skill types."],
54
- "non_technical_skills": ["Identify and list non-technical skills such as leadership, teamwork, and communication skills, ensuring they are not mixed with technical skills."],
55
- "tools": ["Enumerate and extract all software tools, platforms, and applications referenced in the resume, distinctly separate from skills."],
56
- "companies_worked_at": ["List the names of all companies where employment is mentioned in the resume."],
57
- "projects": ["Extract all projects names or titles mentioned in the resume."],
58
- "projects_experience": ["Summarize overall project experiences, providing a brief description of each project as detailed in the resume."],
59
- "experience": ["Calculate total professional work experience in years and months based on the resume."],
60
- "roles": ["List and Extract the names of all job titles or roles mentioned in the resume."]
61
  }}
62
  }}
63
  output:
@@ -89,7 +89,7 @@ def Model_EducationalDetails_Output(resume, client):
89
  Extract the text in the following output JSON string as:
90
  {{
91
  "educational": {{
92
- "certifications": ["List and Extract all certifications mentioned in the resume."],
93
  "qualifications": ["List and Extract all educational qualifications, including degrees (e.g., BBA, MBA), their full forms, and associated levels (e.g., undergraduate, postgraduate) from resume. If none are found, return []."],
94
  "university": ["List and Extract the name of the University, College, or Institute attended, based on the resume. If not found, return []."],
95
  "courses": ["List and Extract the names of completed courses or based on the resume. If none are found, return []."]
@@ -123,10 +123,10 @@ def Model_PersonalDetails_Output(resume, client):
123
  Extract the text in the following output JSON string as:
124
  {{
125
  "personal": {{
126
- "name": "Extract the full name based on the resume. If not found, return 'Not found'.",
127
- "contact_number": "Extract the contact number from the resume. If not found, return 'Not found'.",
128
- "email": "Extract the email address from the resume. If not found, return 'Not found'.",
129
- "Address": "Extract the Address or address from the resume. If not found, return 'Not found'."
130
  }}
131
  }}
132
  output:
@@ -380,33 +380,33 @@ def process_resume_data(file_path):
380
  # Combine both personal and professional details into a structured output
381
  result = {
382
  "personal": {
383
- "name": per_data.get('personal', {}).get('name', 'Not found'),
384
- "contact": per_data.get('personal', {}).get('contact_number', 'Not found'),
385
- "email": per_data.get('personal', {}).get('email', 'Not found'),
386
- "location": per_data.get('personal', {}).get('Address', 'Not found'),
387
  "linkedin": linkedin_links,
388
  "github": github_links,
389
  "other_links": hyperlinks # Store remaining links if needed
390
  },
391
  "professional": {
392
- "technical_skills": pro_data.get('professional', {}).get('technical_skills', 'Not found'),
393
- "non_technical_skills": pro_data.get('professional', {}).get('non_technical_skills', 'Not found'),
394
- "tools": pro_data.get('professional', {}).get('tools', 'Not found'),
395
  "experience": [
396
  {
397
- "company": pro_data.get('professional', {}).get('companies_worked_at', 'Not found'),
398
- "projects": pro_data.get('professional', {}).get('projects', 'Not found'),
399
- "role": pro_data.get('professional', {}).get('worked_as', 'Not found'),
400
- "years": pro_data.get('professional', {}).get('experience', 'Not found'),
401
- "project_experience": pro_data.get('professional', {}).get('projects_experience', 'Not found')
402
  }
403
  ],
404
  "education": [
405
  {
406
- "qualification": Edu_data.get('educational', {}).get('qualifications', 'Not found'),
407
- "university": Edu_data.get('educational', {}).get('university', 'Not found'),
408
- "course": Edu_data.get('educational', {}).get('courses', 'Not found'),
409
- "certificate": Edu_data.get('educational', {}).get('certifications', 'Not found')
410
  }
411
  ]
412
  }
@@ -414,8 +414,10 @@ def process_resume_data(file_path):
414
 
415
 
416
 
417
- #Appending the list if any available as a text
418
- result['personal']['other_links'] += links
 
 
419
  #Added the validator for details, Validate contact and email
420
  valid_contact, invalid_contact, valid_email, invalid_email = validate_contact_email(result['personal'])
421
  result['personal']['valid_contact'] = valid_contact
 
50
  Extract the text in the following output JSON string as:
51
  {{
52
  "professional": {{
53
+ "technical_skills": ["List all technical skills, programming languages, frameworks, and technologies mentioned in the resume, ensuring they are not mixed with other skill types. If not found, return []."],
54
+ "non_technical_skills": ["Identify and list non-technical skills such as leadership, teamwork, and communication skills, ensuring they are not mixed with technical skills. If not found, return []."],
55
+ "tools": ["Enumerate and extract all software tools, platforms, and applications referenced in the resume, distinctly separate from skills. If not found, return []."],
56
+ "companies_worked_at": ["List the names of all companies where employment is mentioned in the resume. If not found, return []."],
57
+ "projects": ["Extract all projects names or titles mentioned in the resume. If not found, return []."],
58
+ "projects_experience": ["Summarize overall project experiences, providing a brief description of each project as detailed in the resume. If not found, return []."],
59
+ "experience": ["Calculate total professional work experience in years and months based on the resume. If not found, return []."],
60
+ "roles": ["List and Extract the names of all job titles or roles mentioned in the resume. If not found, return []."]
61
  }}
62
  }}
63
  output:
 
89
  Extract the text in the following output JSON string as:
90
  {{
91
  "educational": {{
92
+ "certifications": ["List and Extract all certifications mentioned in the resume. If none are found, return []"],
93
  "qualifications": ["List and Extract all educational qualifications, including degrees (e.g., BBA, MBA), their full forms, and associated levels (e.g., undergraduate, postgraduate) from resume. If none are found, return []."],
94
  "university": ["List and Extract the name of the University, College, or Institute attended, based on the resume. If not found, return []."],
95
  "courses": ["List and Extract the names of completed courses or based on the resume. If none are found, return []."]
 
123
  Extract the text in the following output JSON string as:
124
  {{
125
  "personal": {{
126
+ "name": "Extract the full name based on the resume. If not found, return [].",
127
+ "contact_number": "Extract the contact number from the resume. If not found, return [].",
128
+ "email": "Extract the email address from the resume. If not found, return [].",
129
+ "address": "Extract the address or address from the resume. If not found, return []."
130
  }}
131
  }}
132
  output:
 
380
  # Combine both personal and professional details into a structured output
381
  result = {
382
  "personal": {
383
+ "name": per_data.get('personal', {}).get('name', None),
384
+ "contact": per_data.get('personal', {}).get('contact_number', None),
385
+ "email": per_data.get('personal', {}).get('email', None),
386
+ "location": per_data.get('personal', {}).get('address', None),
387
  "linkedin": linkedin_links,
388
  "github": github_links,
389
  "other_links": hyperlinks # Store remaining links if needed
390
  },
391
  "professional": {
392
+ "technical_skills": pro_data.get('professional', {}).get('technical_skills', None),
393
+ "non_technical_skills": pro_data.get('professional', {}).get('non_technical_skills', None),
394
+ "tools": pro_data.get('professional', {}).get('tools', None),
395
  "experience": [
396
  {
397
+ "company": pro_data.get('professional', {}).get('companies_worked_at', None),
398
+ "projects": pro_data.get('professional', {}).get('projects', None),
399
+ "role": pro_data.get('professional', {}).get('roles', None),
400
+ "years": pro_data.get('professional', {}).get('experience', None),
401
+ "project_experience": pro_data.get('professional', {}).get('projects_experience', None)
402
  }
403
  ],
404
  "education": [
405
  {
406
+ "qualification": Edu_data.get('educational', {}).get('qualifications', None),
407
+ "university": Edu_data.get('educational', {}).get('university', None),
408
+ "course": Edu_data.get('educational', {}).get('courses', None),
409
+ "certificate": Edu_data.get('educational', {}).get('certifications', None)
410
  }
411
  ]
412
  }
 
414
 
415
 
416
 
417
+ #Appending the list if any available as a text
418
+ if result['personal']['other_links'] is not None:
419
+ result['personal']['other_links'] += links
420
+
421
  #Added the validator for details, Validate contact and email
422
  valid_contact, invalid_contact, valid_email, invalid_email = validate_contact_email(result['personal'])
423
  result['personal']['valid_contact'] = valid_contact