-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
PR for FIX - ISSUE : #307 #496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,49 +1,53 @@ | ||||||||||||||||||||||||||||||||||||||
| ## Pull Request Title | ||||||||||||||||||||||||||||||||||||||
| <!-- Provide a concise and descriptive title for the pull request --> | ||||||||||||||||||||||||||||||||||||||
| fix: Harden resume improvement prompt to prevent AI hallucination | ||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR template incorrectly filled with specific PR content instead of remaining generic Prompt for AI agents |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ## Related Issue | ||||||||||||||||||||||||||||||||||||||
| <!-- If this pull request is related to an issue, please link it here using the "#" symbol followed by the issue number (e.g., #123) --> | ||||||||||||||||||||||||||||||||||||||
| - Issue number : #307 | ||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don’t hardcode an issue number in the template. Defaulting to #307 will mislead authors opening unrelated PRs. -- Issue number : #307
+- Issue number: #<issue_id>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ## Description | ||||||||||||||||||||||||||||||||||||||
| <!-- Describe the changes made in this pull request. What problem does it solve or what feature does it add/modify? --> | ||||||||||||||||||||||||||||||||||||||
| This PR addresses a critical issue with AI hallucination in the resume improvement feature where the model would fabricate details not present in the user's original resume. The prompt in `resume_improvement.py` has been completely overhauled with explicit anti-fabrication directives and a structured reasoning framework to ensure all output is truthful and grounded solely in the provided user data. | ||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove PR-specific description from the template body. Templates should guide authors; they shouldn’t contain content for a particular change. -This PR addresses a critical issue with AI hallucination in the resume improvement feature where the model would fabricate details not present in the user's original resume. The prompt in `resume_improvement.py` has been completely overhauled with explicit anti-fabrication directives and a structured reasoning framework to ensure all output is truthful and grounded solely in the provided user data.
+<!-- Describe the changes made in this pull request. What problem does it solve or what feature does it add/modify? -->📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ## Type | ||||||||||||||||||||||||||||||||||||||
| <!-- Check the relevant options by putting an "x" in the brackets --> | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - [ ] Bug Fix | ||||||||||||||||||||||||||||||||||||||
| - [x] Bug Fix | ||||||||||||||||||||||||||||||||||||||
| - [ ] Feature Enhancement | ||||||||||||||||||||||||||||||||||||||
| - [ ] Documentation Update | ||||||||||||||||||||||||||||||||||||||
| - [ ] Code Refactoring | ||||||||||||||||||||||||||||||||||||||
| - [ ] Other (please specify): | ||||||||||||||||||||||||||||||||||||||
| - [x] Code Refactoring | ||||||||||||||||||||||||||||||||||||||
| - [ ] Other (please specify): | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+16
to
21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave type checkboxes unchecked by default. Pre-checking biases unrelated PRs and reduces signal quality in triage. -- [x] Bug Fix
+- [ ] Bug Fix
- [ ] Feature Enhancement
- [ ] Documentation Update
-- [x] Code Refactoring
+- [ ] Code Refactoring
- [ ] Other (please specify):📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool[grammar] ~16-~16: There might be a mistake here. (QB_NEW_EN) [grammar] ~17-~17: There might be a mistake here. (QB_NEW_EN) [grammar] ~18-~18: There might be a mistake here. (QB_NEW_EN) [grammar] ~19-~19: There might be a mistake here. (QB_NEW_EN) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
| ## Proposed Changes | ||||||||||||||||||||||||||||||||||||||
| <!-- List the specific changes made in this pull request --> | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - | ||||||||||||||||||||||||||||||||||||||
| - | ||||||||||||||||||||||||||||||||||||||
| - | ||||||||||||||||||||||||||||||||||||||
| - Completely revamped the prompt in `apps/backend/app/prompt/resume_improvement.py` | ||||||||||||||||||||||||||||||||||||||
| - Added explicit anti-hallucination directives forbidding invention of details | ||||||||||||||||||||||||||||||||||||||
| - Implemented structured "Analyze then Revise" framework for better AI reasoning | ||||||||||||||||||||||||||||||||||||||
| - Enhanced quantification handling with placeholder usage for implied metrics | ||||||||||||||||||||||||||||||||||||||
| - Strengthened output formatting rules for consistent parsing | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+25
to
+30
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace PR-specific change list with placeholders. The template should prompt authors to enumerate their changes rather than prescribe this PR’s content. -- Completely revamped the prompt in `apps/backend/app/prompt/resume_improvement.py`
-- Added explicit anti-hallucination directives forbidding invention of details
-- Implemented structured "Analyze then Revise" framework for better AI reasoning
-- Enhanced quantification handling with placeholder usage for implied metrics
-- Strengthened output formatting rules for consistent parsing
+- <List the specific changes made in this pull request>
+- <Be concrete: file paths, functions/modules touched, migrations, configs>📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool[grammar] ~25-~25: There might be a mistake here. (QB_NEW_EN) [grammar] ~26-~26: There might be a mistake here. (QB_NEW_EN) [grammar] ~27-~27: There might be a mistake here. (QB_NEW_EN) [grammar] ~28-~28: There might be a mistake here. (QB_NEW_EN) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ## Screenshots / Code Snippets (if applicable) | ||||||||||||||||||||||||||||||||||||||
| <!-- Include any relevant screenshots or code snippets that help visualize the changes made --> | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ## How to Test | ||||||||||||||||||||||||||||||||||||||
| <!-- Provide step-by-step instructions or a checklist for testing the changes in this pull request --> | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| 1. | ||||||||||||||||||||||||||||||||||||||
| 2. | ||||||||||||||||||||||||||||||||||||||
| 3. | ||||||||||||||||||||||||||||||||||||||
| - Do a general tool run and feed the data. You'll witness the effect of the modified prompt. | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ## Checklist | ||||||||||||||||||||||||||||||||||||||
| <!-- Put an "x" in the brackets for the items that apply to this pull request --> | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - [ ] The code compiles successfully without any errors or warnings | ||||||||||||||||||||||||||||||||||||||
| - [ ] The changes have been tested and verified | ||||||||||||||||||||||||||||||||||||||
| - [x] The code compiles successfully without any errors or warnings | ||||||||||||||||||||||||||||||||||||||
| - [x] 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) | ||||||||||||||||||||||||||||||||||||||
| - [x] The changes follow the project's coding guidelines and best practices | ||||||||||||||||||||||||||||||||||||||
| - [x] The commit messages are descriptive and follow the project's guidelines | ||||||||||||||||||||||||||||||||||||||
| - [x] All tests (if applicable) pass successfully | ||||||||||||||||||||||||||||||||||||||
| - [x] This pull request has been linked to the related issue (if applicable) | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+43
to
+49
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uncheck all checklist items by default. Checked boxes in the template undermine their purpose. -- [x] The code compiles successfully without any errors or warnings
- - [x] The changes have been tested and verified
+ - [ ] The code compiles successfully without any errors or warnings
+ - [ ] The changes have been tested and verified
- [ ] The documentation has been updated (if applicable)
-- [x] The changes follow the project's coding guidelines and best practices
-- [x] The commit messages are descriptive and follow the project's guidelines
-- [x] All tests (if applicable) pass successfully
-- [x] This pull request has been linked to the related issue (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)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ## Additional Information | ||||||||||||||||||||||||||||||||||||||
| <!-- Add any other information about the pull request that you think might be helpful --> | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| This change is critical for maintaining user trust and ensuring the resume improvement feature provides truthful, accurate enhancements rather than fabricated content. The new prompt structure can serve as a template for other AI-powered features that require similar constraints against hallucination. | ||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,31 @@ | ||
| # New optimised prompt which tackles the problems stated at (https://github.com/srbhr/Resume-Matcher/issues/374) | ||
|
|
||
| PROMPT = """ | ||
| You are an expert resume editor and talent acquisition specialist. Your task is to revise the following resume so that it aligns as closely as possible with the provided job description and extracted job keywords, in order to maximize the cosine similarity between the resume and the job keywords. | ||
| Instructions: | ||
| - Carefully review the job description and the list of extracted job keywords. | ||
| - Update the candidate's resume by: | ||
| - Emphasizing and naturally incorporating relevant skills, experiences, and keywords from the job description and keyword list. | ||
| - Where appropriate, naturally weave the extracted job keywords into the resume content. | ||
| - Rewriting, adding, or removing resume content as needed to better match the job requirements. | ||
| - Maintaining a natural, professional tone and avoiding keyword stuffing. | ||
| - Where possible, use quantifiable achievements and action verbs. | ||
| - The current cosine similarity score is {current_cosine_similarity:.4f}. Revise the resume to further increase this score. | ||
| - ONLY output the improved updated resume. Do not include any explanations, commentary, or formatting outside of the resume itself. | ||
| Job Description: | ||
| ROLE: You are an expert, meticulous, and ETHICAL resume editor. Your primary directive is to enhance the candidate's existing experience truthfully and effectively, strictly avoiding any form of fabrication or exaggeration (HALLUCINATION). | ||
| CORE PRINCIPLE: You MUST ground all revisions SOLELY in the information provided in the 'Original Resume'. You are FORBIDDEN from inventing new companies, job titles, degrees, certifications, or specific projects/metrics that are not present in the original text. Your goal is to reframe and emphasize existing truths to better align with the target job. | ||
| TASK: Revise the resume below to increase its alignment with the provided job description, thereby maximizing the cosine similarity score (current score: {current_cosine_similarity:.4f}). | ||
| PROCESS: | ||
| 1. ANALYSIS: First, analyze the job description and keywords. Identify the key requirements, skills, and terminologies. | ||
| 2. MAPPING: Next, map these keywords to the closest matching experiences, skills, and achievements within the original resume. | ||
| 3. REVISION: Finally, revise the resume by: | ||
| a. INCORPORATING KEYWORDS: Strategically integrating relevant keywords from the job description into the resume's content. Prioritize keywords with high relevance to the candidate's actual experience. | ||
| b. REWRITING FOR IMPACT: Rewriting bullet points and summaries to be more impactful, using strong action verbs (e.g., "Orchestrated," "Optimized," "Pioneered") and quantifiable achievements. FOR QUANTIFICATION: If numbers are implied but not stated (e.g., "managed a team"), you may use a placeholder like "[X]" (e.g., "Managed a team of [X] people"). If no number is implied, focus on the action and skill. | ||
| c. EMPHASIZING RELEVANCE: Reordering bullet points under a job experience to place the most relevant achievements first. | ||
| d. REMOVING IRRELEVANCY: Pruning obviously irrelevant or outdated information that does not support the candidate's narrative for this specific role. | ||
| e. MAINTAINING INTEGRITY: Ensuring all changes are a truthful representation of the candidate's background as presented in the original resume. | ||
| OUTPUT INSTRUCTIONS: | ||
| - Output ONLY the improved, updated resume in Markdown format. | ||
| - Preserve the original structure and sections (e.g., # Heading, ## Summary, ## Experience) of the provided resume. | ||
| - Do not add any new sections (like "Projects") unless they already exist in the original. | ||
| - Do not include any explanations, commentary, or metadata outside of the resume itself. | ||
| JOB DESCRIPTION: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing closing markdown delimiter for JOB DESCRIPTION section Prompt for AI agents |
||
| ```md | ||
| {raw_job_description} | ||
| ``` | ||
| Extracted Job Keywords: | ||
| ```md | ||
|
|
@@ -34,3 +44,45 @@ | |
| NOTE: ONLY OUTPUT THE IMPROVED UPDATED RESUME IN MARKDOWN FORMAT. | ||
| """ | ||
|
|
||
|
|
||
| # LEGACY PROMPT - USE WITH CAUTION: | ||
| # This version has known issues with potential AI hallucination. | ||
| # Remove from the file if the admin is satisfied with the new one when reviewing the changes made. | ||
|
|
||
| # PROMPT = """ | ||
| # You are an expert resume editor and talent acquisition specialist. Your task is to revise the following resume so that it aligns as closely as possible with the provided job description and extracted job keywords, in order to maximize the cosine similarity between the resume and the job keywords. | ||
|
|
||
| # Instructions: | ||
| # - Carefully review the job description and the list of extracted job keywords. | ||
| # - Update the candidate's resume by: | ||
| # - Emphasizing and naturally incorporating relevant skills, experiences, and keywords from the job description and keyword list. | ||
| # - Where appropriate, naturally weave the extracted job keywords into the resume content. | ||
| # - Rewriting, adding, or removing resume content as needed to better match the job requirements. | ||
| # - Maintaining a natural, professional tone and avoiding keyword stuffing. | ||
| # - Where possible, use quantifiable achievements and action verbs. | ||
| # - The current cosine similarity score is {current_cosine_similarity:.4f}. Revise the resume to further increase this score. | ||
| # - ONLY output the improved updated resume. Do not include any explanations, commentary, or formatting outside of the resume itself. | ||
|
|
||
| # Job Description: | ||
| # ```md | ||
| # {raw_job_description} | ||
| # ``` | ||
|
|
||
| # Extracted Job Keywords: | ||
| # ```md | ||
| # {extracted_job_keywords} | ||
| # ``` | ||
|
|
||
| # Original Resume: | ||
| # ```md | ||
| # {raw_resume} | ||
| # ``` | ||
|
|
||
| # Extracted Resume Keywords: | ||
| # ```md | ||
| # {extracted_resume_keywords} | ||
| # ``` | ||
|
|
||
| # NOTE: ONLY OUTPUT THE IMPROVED UPDATED RESUME IN MARKDOWN FORMAT. | ||
| # """ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the PR title field generic (don’t hardcode a specific fix).
Templates should not pre-fill a specific change; it will leak into unrelated PRs.
📝 Committable suggestion
🤖 Prompt for AI Agents