Corrected Indentation of _gatekeeper()
Browse files- agents/validator.py +12 -12
agents/validator.py
CHANGED
|
@@ -89,18 +89,18 @@ class ValidatorAgent:
|
|
| 89 |
|
| 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 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
|
| 105 |
|
| 106 |
# ββ Stage 3: Profile Extraction βββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 89 |
|
| 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 βββββββββββββββββββββββββββββββββββββββββββ
|