Skip to content

Conversation

LuisaG
Copy link

@LuisaG LuisaG commented Jul 24, 2025

Pull Request Title

Expand employment_type and remote_status enums to support 'N/A'.

Related Issue

#445, #374

Description

This PR updates the EmploymentTypeEnum and RemoteStatusEnum to include 'N/A' as a valid value.
This change prevents 500 errors when job descriptions are missing or contain unrecognized values for these fields. It ensures the system can handle incomplete or ambiguous input data gracefully.

Rewrote job description prompt to improve prompt clarity to reduce hallucinations and enforce raw JSON output. This reduces the number of 500s cause of the incorrect JSON generated: [2025-07-25T14:35:43-0700 - app.agent.strategies.wrapper - ERROR] provider returned non-JSON. parsing error: Expecting ',' delimiter: line 56 column 2 (char 2529)

Type

  • Bug Fix
  • Feature Enhancement
  • Documentation Update
  • Code Refactoring
  • Other (please specify):

Proposed Changes

  • Added 'N/A' to EmploymentTypeEnum

  • Added 'N/A' to RemoteStatusEnum

  • Updated relevant validation logic to accept 'N/A'

  • Prevented crashes caused by missing or invalid values in job data

  • Improved the job prompt

Screenshots / Code Snippets (if applicable)

How to Test

  1. Submit a job description with 'N/A' for employment_type or remote_status.

  2. Click the "Improve" button.

  3. Verify that no error occurs and the system processes the resume correctly.

Checklist

  • The code compiles successfully without any errors or warnings
  • The changes have been tested and verified
  • The documentation has been updated (if applicable)
  • The changes follow the project's coding guidelines and best practices
  • The commit messages are descriptive and follow the project's guidelines
  • All tests (if applicable) pass successfully
  • This pull request has been linked to the related issue (if applicable)

Additional Information

This change improves resilience when dealing with third-party job data sources that may omit or generalize employment and location information.

Refactored the JSON extraction prompt to use clear positive instructions instead of relying on negative constraints. This helps the model produce more accurate and consistent outputs with fewer hallucinations.

We can also alter the prompt to force it to write Not Specified instead of N/A, but we should keep the prompt as simple and short as possible. Benefits: faster processing, easier to debug, long prompts with lots of conditions can make it harder for the model to prioritize the right ones.

Summary by CodeRabbit

  • New Features

    • Added "N/A" as an option for employment type and remote status fields in job data.
    • Made the remote status field optional for job locations.
  • Documentation

Copy link
Contributor

coderabbitai bot commented Jul 24, 2025

Walkthrough

The prompt string in PROMPT was reformatted using textwrap.dedent and rewritten into a clearer, numbered instruction list with labeled sections for instructions, schema, and job posting. Two enums, EmploymentTypeEnum and RemoteStatusEnum, replaced the member NOT_SPECIFIED with NOT_AVAILABLE = "N/A". The remote_status field in the Location model was changed from required to optional with a default of None.

Changes

File(s) Change Summary
apps/backend/app/prompt/structured_job.py Reformatted and expanded prompt string using textwrap.dedent; instructions rewritten as numbered list with clearer labels and formatting.
apps/backend/app/schemas/pydantic/structured_job.py Renamed enum member NOT_SPECIFIED to NOT_AVAILABLE = "N/A" in EmploymentTypeEnum and RemoteStatusEnum; made Location.remote_status optional with default None.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 In prompts refined with numbered grace,
Enums hopped to a clearer place.
“N/A” now stands where “Not Specified” fell,
Optional fields ring the clarity bell.
Cleaner code, a joyful sight—
Hopping forward, swift and bright! ✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c2d8e34 and 43fbd26.

📒 Files selected for processing (2)
  • apps/backend/app/prompt/structured_job.py (1 hunks)
  • apps/backend/app/schemas/pydantic/structured_job.py (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/backend/app/schemas/pydantic/structured_job.py
  • apps/backend/app/prompt/structured_job.py
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@LuisaG LuisaG changed the title fix(schema): add 'N/A' to employment_type and remote_status enums fix(schema): Fix 500 errors on job description parsing or improving Jul 25, 2025
@LuisaG LuisaG changed the title fix(schema): Fix 500 errors on job description parsing or improving fix(schema): Fix 500 errors on job description parsing/improving Jul 25, 2025
@rrvrs rrvrs moved this from Backlog to Ready in Resume Matcher Kanban Jul 26, 2025
@rrvrs rrvrs moved this from Ready to Backlog in Resume Matcher Kanban Jul 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

1 participant