Skip to content

Conversation

@Pranjalbharat
Copy link

@Pranjalbharat Pranjalbharat commented Nov 5, 2025

Overview

This PR address this issues #172
This PR enhances the Hiring Agent by introducing LeetCode profile enrichment and a new Problem Solving (0–15) evaluation category powered by LLM-based reasoning.

The system now fetches candidate statistics from the LeetCode GraphQL API, parses key metrics such as problems solved, contest rating, and activity consistency, and passes them as context to the LLM for evaluation.
The score is display-only and excluded from the total 100-point score, ensuring compatibility with previous versions.

What this feature adds:

  1. LeetCode Data Integration (leetcode.py)
    • Added support for fetching, caching, and parsing LeetCode profile data via the GraphQL API.
    • Introduced a LeetCodeProfile model for structured handling (similar to GitHubProfile).

  2. LLM-Based Problem Solving Evaluation
    • Integrated LeetCode data into the LLM evaluation pipeline.
    • Updated prompt template to include the Problem Solving (0–15) section, using LeetCode stats for reasoning.
    • Score is shown in output but excluded from total 100-point calculation.

  3. Error Handling Improvements
    • Handled all three possible cases cleanly:
    • ✅ Valid LeetCode profile → full scoring and cache creation.
    ⚠️ Invalid profile URL → prints a warning, sets score = 0.
    • 🚫 No LeetCode profile in resume → skips section safely.
    • Prevented crashes for bad or empty responses from the LeetCode API.

  4. Consistent Caching
    • Followed GitHub caching style — one JSON file per username.
    • Stored under /cache for development mode and loaded automatically if exists.

Files Changed:

1. leetcode.py
     - Added GraphQL fetching, parsing, and display for LeetCode user data. Implemented caching and validation.
2. models.py
     - Added LeetCodeProfile model (similar to GitHubProfile) for structured data representation.
3. transform.py
     - Introduced convert_leetcode_data_to_text() for formatted LLM input.
4. score.py
     - Integrated LeetCode fetching and caching logic before LLM evaluation.
5. prompts/resume_evaluation_criteria.txt
     - Updated the LLM evaluation template to include new Problem Solving scoring rules and examples.

Testing & Results

The feature has been tested with multiple resumes to verify correct handling of all cases.
Below are the test scenarios with expected behavior (screenshots are attached under each case):

✅ Case 1 — Valid LeetCode Profile
Description: Resume includes a valid LeetCode URL
Expected Behavior:
• Data fetched and cached correctly and Problem solving result shown.
Screenshot 2025-11-06 at 12 30 08 AM
Screenshot 2025-11-06 at 12 32 56 AM

⚠️ Case 2 — Invalid or Incorrect LeetCode Profile
Description: Resume includes a broken or incorrect URL
Expected Behavior:
• Warning printed: “⚠️ Failed to fetch LeetCode data”
• Problem Solving section still displayed but score = 0/15 with fallback evidence
Screenshot 2025-11-05 at 11 02 27 PM
Screenshot 2025-11-05 at 11 13 53 PM

🚫 Case 3 — No LeetCode Profile Provided
Description: Resume has no LeetCode link in basics section
Expected Behavior:
• Skips fetching
Screenshot 2025-11-05 at 11 14 22 PM

Cache File Verification

Description: Verified cache behavior after successful runs.
Expected Behavior:
• Only one cache file created per user → e.g., leetcodecache_username.json
• JSON contains parsed user data (problems solved, contest rating, etc.)
Screenshot 2025-11-05 at 7 04 13 PM

Workflow Summary

1.	Resume → Parse basics → Extract profile URLs (already existing)
2.	If LeetCode URL found → Fetch via GraphQL → Cache results
3.	Convert structured data to text → Pass to LLM for evaluation
4.	LLM evaluates and adds "problem_solving" field in output JSON
5.	Problem Solving score is displayed but excluded from total score(it can be included based on requirements)

@Pranjalbharat Pranjalbharat changed the title Add LeetCode Enrichment and Optional Problem-Solving Scoring Add LeetCode Enrichment and LLM-Based Problem-Solving Evaluation Nov 5, 2025
@Pranjalbharat
Copy link
Author

Pranjalbharat commented Nov 5, 2025

Hi @sp2hari and @anxkhn-hacker, I have added this feature. If it aligns with the project’s future direction, I’d love to continue expanding it by integrating other platforms like CodeChef, Codeforces, and more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant