Spaces:
Sleeping
Sleeping
Update llm_client.py
Browse files- llm_client.py +5 -3
llm_client.py
CHANGED
|
@@ -120,7 +120,8 @@ class GroqLLM(LLM):
|
|
| 120 |
model=self.groq_model,
|
| 121 |
temperature=0.3,
|
| 122 |
max_tokens=1024,
|
| 123 |
-
stop=stop_seq
|
|
|
|
| 124 |
)
|
| 125 |
return chat_completion.choices[0].message.content
|
| 126 |
except Exception as e:
|
|
@@ -204,7 +205,7 @@ class LLMClient:
|
|
| 204 |
self.server_bin,
|
| 205 |
"-m", self.model_path,
|
| 206 |
"--port", str(self.server_port),
|
| 207 |
-
"-c", "8192",
|
| 208 |
"--host", "0.0.0.0",
|
| 209 |
"--mlock" # Lock model in RAM to prevent swapping
|
| 210 |
]
|
|
@@ -262,12 +263,13 @@ class LLMClient:
|
|
| 262 |
# Custom Prompt Template
|
| 263 |
template = """<|im_start|>system
|
| 264 |
You are CyberGuard - an AI specialized in Phishing Detection.
|
| 265 |
-
Task: Analyze the provided URL and HTML snippet to classify the website as 'PHISHING' or 'BENIGN'.
|
| 266 |
Check specifically for BRAND IMPERSONATION (e.g. Facebook, Google, Banks).
|
| 267 |
If the HTML content is missing, empty, or contains an error message (like "Could not fetch website content"), YOU MUST RETURN classification by ANALYZING the URL.
|
| 268 |
Classification Rules:
|
| 269 |
- PHISHING: Typosquatting URLs (e.g., paypa1.com), hidden login forms, obfuscated javascript, mismatched branding vs URL.
|
| 270 |
- BENIGN: Legitimate website, clean code, URL matches the content/brand.
|
|
|
|
| 271 |
|
| 272 |
RETURN THE RESULT IN THE EXACT FOLLOWING FORMAT (NO PREAMBLE):
|
| 273 |
|
|
|
|
| 120 |
model=self.groq_model,
|
| 121 |
temperature=0.3,
|
| 122 |
max_tokens=1024,
|
| 123 |
+
stop=stop_seq,
|
| 124 |
+
extra_body={"enable_thinking": True}
|
| 125 |
)
|
| 126 |
return chat_completion.choices[0].message.content
|
| 127 |
except Exception as e:
|
|
|
|
| 205 |
self.server_bin,
|
| 206 |
"-m", self.model_path,
|
| 207 |
"--port", str(self.server_port),
|
| 208 |
+
"-c", "8192", # Increased context window to handle web content
|
| 209 |
"--host", "0.0.0.0",
|
| 210 |
"--mlock" # Lock model in RAM to prevent swapping
|
| 211 |
]
|
|
|
|
| 263 |
# Custom Prompt Template
|
| 264 |
template = """<|im_start|>system
|
| 265 |
You are CyberGuard - an AI specialized in Phishing Detection.
|
| 266 |
+
Task: Analyze the provided URL and HTML snippet to classify the website as 'PHISHING' or 'BENIGN'.
|
| 267 |
Check specifically for BRAND IMPERSONATION (e.g. Facebook, Google, Banks).
|
| 268 |
If the HTML content is missing, empty, or contains an error message (like "Could not fetch website content"), YOU MUST RETURN classification by ANALYZING the URL.
|
| 269 |
Classification Rules:
|
| 270 |
- PHISHING: Typosquatting URLs (e.g., paypa1.com), hidden login forms, obfuscated javascript, mismatched branding vs URL.
|
| 271 |
- BENIGN: Legitimate website, clean code, URL matches the content/brand.
|
| 272 |
+
Let's think step by step to verify logical inconsistencies between URL and Content before deciding.
|
| 273 |
|
| 274 |
RETURN THE RESULT IN THE EXACT FOLLOWING FORMAT (NO PREAMBLE):
|
| 275 |
|