TalentGydeOnHF / sq_and_query.py
tanujg78's picture
Update sq_and_query.py
a7b7525 verified
def generate_search_query(jd_text,keywords,pipe):
# jd_text = truncate_text(jd_data)
prompt = f"""
Given the following job description and search keywords, generate a comprehensive search query to find the best matching resumes. The query should include relevant skills, experiences, and qualifications that would be ideal for this position.
Job Description:
{jd_text}
Search Keywords:
{', '.join(keywords)}
Generate a search query that includes:
1. Required skills and technologies
2. Desired experience level
3. Relevant qualifications or certifications
4. Any specific industry knowledge
5. Soft skills that would be valuable for this role
Format the output as a JSON object with the following structure:
{{
"skills": ["skill1", "skill2", ...],
"experience": "description of desired experience",
"qualifications": ["qualification1", "qualification2", ...],
"industry_knowledge": ["knowledge1", "knowledge2", ...],
"soft_skills": ["soft_skill1", "soft_skill2", ...]
}}
"""
response = pipe(prompt,max_new_tokens=5000, do_sample=True, temperature=0.7)
return response, prompt
# return prompt
def generate_screening_question(jd_data,pipe):
# jd_text = truncate_text(jd_data)
prompt = f"""
Create screening questions for this role:
Job Title: {jd_data.get('title')}
Required Skills: {', '.join(jd_data.get('required_skills', []))}
Responsibilities: {', '.join(jd_data.get('responsibilities', []))}
Experience Requirements: {jd_data.get('experience_level')}
Technical Requirements: {jd_data.get('technical_requirements')}
Generate screening questions that:
1. Assess technical capabilities specific to this role
2. Evaluate relevant experience
3. Test domain knowledge
4. Assess problem-solving approach
5. Evaluate cultural fit
For each question include:
- Question text
- Question type (multiple_choice/open_ended/yes_no)
- Answer options (for multiple choice)
- Expected answer criteria
- Reasoning for the question
- Weight (1-5 based on importance)
- Category (technical/experience/domain/culture)
- Auto evaluable (boolean)
Return as JSON array.
Based on this job data, generate 7-8 screening questions in JSON format:
{{
"screening_questions": [
{{
"id": "unique_id",
"question": "",
"type": "multiple_choice/open_ended/yes_no",
"options": [],
"expected_answer": "",
"reasoning": "",
"weight": 0,
"category": "technical/experience/culture/role-specific",
"auto_evaluable": true/false
}}
]
}}
Please return only mentioned JSON
"""
response = pipe(prompt,max_new_tokens=5000, do_sample=True, temperature=0.7)
return response, prompt
# return prompt