Spaces:
Runtime error
Runtime error
Download services/llm_service.py from utkarsh134/FastAPI-Experience-Extractor: direct link, hf CLI and curl.
- Browser
- Download file 3.22 kB
-
https://huggingface.co/spaces/utkarsh134/FastAPI-Experience-Extractor/resolve/main/services/llm_service.py
- Command line
-
hf download hf://spaces/utkarsh134/FastAPI-Experience-Extractor/services/llm_service.py
-
curl -L -o llm_service.py https://huggingface.co/spaces/utkarsh134/FastAPI-Experience-Extractor/resolve/main/services/llm_service.py
3.22 kB
| from langchain_google_genai import ChatGoogleGenerativeAI | |
| from langchain.prompts import PromptTemplate | |
| from config.settings import get_settings | |
| def get_llm(): | |
| settings = get_settings() | |
| return ChatGoogleGenerativeAI( | |
| model=settings["llm_model"], | |
| temperature=settings["temperature"], | |
| google_api_key=settings["google_api_key"], | |
| ) | |
| def get_unified_resume_prompt(): | |
| return PromptTemplate( | |
| input_variables=["resume_text", "relevant_content", "job_role"], | |
| template='''You are a professional resume analyzer with expertise in technical recruiting. | |
| Your task is to extract both basic information and relevant work experience from the resume. | |
| RESUME CONTENT: | |
| {resume_text} | |
| MOST RELEVANT SECTIONS (semantically similar to job requirements): | |
| {relevant_content} | |
| TARGET JOB ROLE: {job_role} | |
| TASK INSTRUCTIONS: | |
| Basic Information: | |
| 1. Extract basic information that is explicitly stated in the text | |
| 2. For fields where information is not found, use null | |
| 3. Do not invent or infer information not present in the text | |
| 4. If multiple educational institutions are mentioned, include the most recent one | |
| 5. For role, use the most recent/current position mentioned | |
| 6. Return complete values - do not truncate or summarize unnecessarily | |
| 7. Maintain exact formatting/capitalization as shown in the resume | |
| Experience Analysis: | |
| 1. Write a SINGLE comprehensive paragraph describing ALL relevant work experience for the target job role | |
| 2. Focus ONLY on experiences that are DIRECTLY relevant to the specified job role | |
| 3. Include specific responsibilities, achievements, and technologies that directly relate to the target role | |
| 4. Be EXTREMELY STRICT - only include experiences that explicitly demonstrate relevant skills | |
| 5. Organize the information chronologically within the single paragraph | |
| 6. If no relevant experience is found, state this clearly | |
| FORMAT YOUR RESPONSE AS A VALID JSON OBJECT WITH THIS EXACT STRUCTURE: | |
| {{ | |
| "candidate_name": "full name of the candidate", | |
| "university_name": "name of university/institute if mentioned, do not add location of institute, example : ABC College, USA, just return ABC COllege", | |
| "location": "location of the institute if mentioned,example : ABC College, USA, just return USA", | |
| "physical_address": "complete physical address of the candidate if mentioned", | |
| "role": "current or most recent role/position", | |
| "relevant_experiences": "A single comprehensive paragraph describing all relevant work experience for the target role", | |
| "experience_summary": "brief summary analyzing how the candidate's relevant experiences align with the job role" | |
| }} | |
| IMPORTANT: | |
| - DO NOT INVENT OR ADD INFORMATION that is not in the resume | |
| - BE EXTREMELY STRICT about experience relevance | |
| - Response must be a valid JSON object | |
| - The relevant_experiences field must be a single text paragraph, not a list or nested object''' | |
| ) | |