import ollama

response = ollama.generate(
    model='deepseek-r1:7b',
    prompt= """Role:
Act as an Expert Technical Recruiter and Data Parsing AI.
Input Data:
I will provide you with the raw text from an EMAIL BODY or PDF or Word, which containing an  unstructured Job Description (JD).
Your Task:
Analyze: Read the text and identify key job details. Ignore email metadata (signatures, "Sent from my iPhone", greetings, and thread headers).
Semantic Extraction & Tuning:
Interpret Meaning: If the email says, "looking for a rockstar in Python," interpret this as "Expert proficiency in Python" under skills.
Standardize: Expand only universal recruitment abbreviations (e.g., "wfh" -> "Remote"). Strictly preserve Client Acronyms, Project Codes, and Proper Nouns exactly as written (e.g., keep "LTA", "JPMC", "DBS" as is; do not expand them).
Categorize: Semantically distinguish between what is "Required" (Must have) vs. "Preferred" (Nice to have/Bonus).
Refine: Clean up the grammar and tone of the extracted text to be professional and suitable for a formal JD.
Audit Transformation: Track every specific change made, including which input headers were mapped to which output keys.
Format: Output the data strictly into the specific JSON format defined below.
Rules for Extraction:
If a field is not mentioned in the email, return "Not Specified".
jd_date: Extract the date from the email text if present, otherwise use "Current".
job_title : Retain the given title in the JD
ai_title : Tuned and Generated Title from the JD
job_type: type of Job in the JD example Contract or Employee or etc..
job_id: reference for the JD or JD identifier
duration : Duration of the Job requirement in months, if not specified use 24+ months
about_company: If not explicitly stated, try to infer the company name/domain from the context, or leave as "Not Specified".
no_of_open_positions: If not explicitly stated, give default value as 1
primary_skills: highly important skills required for the JD
secondary_skills: technical skills exclude the primary skills
domain_requirements: must specified as domain skills in the JD
Specific Instruction for "changes" field:
You must generate a semicolon-separated string listing THREE types of changes:
MAPPING: Which input section was mapped to which JSON key (e.g., "Mapped 'Key Responsibilities' to 'responsibilities'").
CORRECTION: Content fixes (e.g., "Corrected '58 years' to '5-8 Years'").
INFERENCE: Data derived from context (e.g., "Inferred 'LTA' is the Domain/Client").
Output Format:
Return ONLY a single valid JSON object. Do not include any conversational text.
```json
            {{
            "ai_title" : "String",
            "job_title" : "String",
            "job_type" : "String",
            "job_id" : "String",
            "about_company"  : "String",
            "no_of_open_positions" : "String",
            "job_summary"  : "String",
            "responsibilities" : "String",
            "domain_requirements" : "String",
            "certification_requirements" : "String",
            "security_clearance_requirements" : "String",
            "years_of_experience" : "String",
            "duration" : "String",
            "onsite_job" : "String",
            "job_location" : "String",
            "salary_range" : "String",
            "required_qualifications" : "String",
            "preferred_qualifications" : "String",
            "working_hours" : "String",
            "benefits" : "String",
            "requirement_priority" : "String",
            "search_pattern" : {{
                "job_title": "String",
                "location": "String",
                "education": ["String"],
                "primary_skills": ["String"],
                "secondary_skills": ["String"],
                "soft_skills": ["String"],
                "tools_and_frameworks": ["String"],
                "salary_range": "String",
                "keywords": ["String"],
                "domain_requirements": ["String"]
            }},
            "changes": "String",
            }}
            ```

            Input Email Body:
            {Hi,

Cont JC#

Account

Skill

Open position

Location

111675

LTA

NET Developer with React

1

Singapore
 
Duration ::  6 months extendable

Shift timing : Regular

Max Rate cap ::  10000 SGD/Month
 
 
Position: .NET Developer with React

Experience: 58 years

Good to Have: GIS System knowledge (ArcGIS, spatial data handling)
 
Role Overview

You will be responsible for designing and developing scalable web applications using .NET Core for backend and React.js for frontend. The role involves building interactive user interfaces, integrating APIs, and ensuring high performance and security. Familiarity with GIS systems will be an added advantage for projects involving geospatial data.
 
Key Responsibilities
 
Develop, test, and maintain web applications using .NET Core (C#) and React.js.

Build and integrate RESTful APIs and backend services.

Work with SQL Server and Entity Framework for data storage and modeling.

Implement responsive UI/UX using React, JavaScript, TypeScript, HTML, and CSS.

Collaborate with cross-functional teams to gather requirements and deliver solutions.

Ensure application performance, security, and scalability.

Participate in code reviews, debugging, and troubleshooting.

Work in Agile environments and contribute to CI/CD pipelines.

If GIS is involved:
 
Integrate ArcGIS SDK, ArcGIS Server, or similar tools.

Handle spatial data and develop map-based features.
 
 
Required Skills

Strong proficiency in .NET Core/.NET 6+, C#, and React.js.

Experience with JavaScript, TypeScript, HTML5, CSS3.

Knowledge of SQL Server, Entity Framework, and REST APIs.

Familiarity with Azure/AWS cloud services and authentication (OAuth, JWT).

Understanding of Agile methodology and CI/CD pipelines.

Excellent problem-solving and communication skills.
 
 
Preferred Skills (GIS Advantage)

Experience with ArcGIS, Esri tools, or similar GIS platforms.

Spatial database design (SQL Server Spatial or Oracle Spatial).

Knowledge of ArcGIS API for JavaScript, ArcGIS Pro, or ArcGIS Portal.
 
 
Education

Bachelors degree in Computer Science, IT, or related field.
 
 
We are working for an urgent RFP. Can you please line up 2 profiles for each below roles, from your database?

Please share the profiles on email after uploading in our portalr, with below tracker filled.  JCs will be active by EOD.
 
 
 
 
Best Regards,
 
Raguraman || VP Technical
 
M: +1- (614) 953-4885
 
+91 9972284103
 
Email: raghu.s@itconnectus.com<mailto:iram.masood@itconnectus.com>
 
USA | CANADA | SINGAPORE | MALAYSIA | INDIA
 }' 
            """
            #'  'Explain what Python is in one sentence.'
)

print(response['response'])
