ishan-25 commited on
Commit
704605a
Β·
verified Β·
1 Parent(s): 215d5f8

Updated validator.py to be Qwn compatible

Browse files

Since Qwen doesnt use mistral's token tags(like <s>[INST]), we remove them to ensure clean text gen

Files changed (1) hide show
  1. agents/validator.py +19 -11
agents/validator.py CHANGED
@@ -90,17 +90,25 @@ class ValidatorAgent:
90
  # ── Stage 2: LLM Gatekeeper ───────────────────────────────────────────────
91
  # Making _gatekeeper Mistral 7B v02 compatible(it accepts inside <s>[INST] tags only)
92
  def _gatekeeper(self, clean_text: str) -> bool:
93
- """Returns True only if the LLM classifies the text as a legitimate JD."""
94
- # Wrap the query in official Mistral v0.2 instruction tags
95
- prompt = f"<s>[INST] You are a security verification filter. Your only task is to classify whether the input text is a legitimate job description detailing corporate roles or requirements. Reply with exactly one word: VALID or INVALID.\n\nText:\n{clean_text[:1200]}\n\nResponse: [/INST]"
96
-
97
- # Give the model up to 40 tokens to output its response clearly
98
- raw_response = self._ask(prompt, temperature=0.0, max_tokens=40)
99
-
100
- print(f"\n--- GATEKEEPER DEBUG --- \nRaw Model Output: '{raw_response}'\n-------------------------\n")
101
-
102
- verdict = raw_response.strip().upper()
103
- return "VALID" in verdict and "INVALID" not in verdict
 
 
 
 
 
 
 
 
104
 
105
 
106
  # ── Stage 3: Profile Extraction ───────────────────────────────────────────
 
90
  # ── Stage 2: LLM Gatekeeper ───────────────────────────────────────────────
91
  # Making _gatekeeper Mistral 7B v02 compatible(it accepts inside <s>[INST] tags only)
92
  def _gatekeeper(self, clean_text: str) -> bool:
93
+ """Returns True only if the LLM classifies the text as a legitimate JD."""
94
+ # Standardized to plain English text layout for cross-model compatibility
95
+ prompt = f"""You are a security-hardened automated recruitment verification filter.
96
+ Your ONLY task is to classify whether the text inside the input tags is a legitimate, fully-structured job description containing real duties and organizational requirements.
97
+
98
+ If legitimate, reply with the exact word: VALID
99
+ If not legitimate, reply with the exact word: INVALID
100
+
101
+ Text to analyze:
102
+ {clean_text[:1200]}
103
+
104
+ Your response (VALID or INVALID):"""
105
+
106
+ raw_response = self._ask(prompt, temperature=0.0, max_tokens=40)
107
+
108
+ print(f"\n--- GATEKEEPER DEBUG --- \nRaw Model Output: '{raw_response}'\n-------------------------\n")
109
+
110
+ verdict = raw_response.strip().upper()
111
+ return "VALID" in verdict and "INVALID" not in verdict
112
 
113
 
114
  # ── Stage 3: Profile Extraction ───────────────────────────────────────────