Spaces:
Running
Running
File size: 1,352 Bytes
90946e4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# prompt_engine.py
from textwrap import dedent
class PromptEngine:
"""
Centralized prompt builder for the intelligence system.
"""
def __init__(self):
self.system_context = dedent("""
You are an intelligence interpreter focused on APJ cybercrime signals.
You read Mandarin, Cantonese, and English, and convert them into
structured threat intelligence with cultural nuance preserved.
""")
def classify_threat(self, text):
return dedent(f"""
{self.system_context}
TASK:
Classify the following text into one or more categories:
- stolen_data
- malware_service
- laundering_service
- access_broker
- scam_indicator
- unknown
Also extract:
- slang terms
- vendor signals
- action verbs (buying, selling, promoting)
- risk level (1–5)
TEXT:
{text}
""")
def translate_explain(self, text):
return dedent(f"""
{self.system_context}
TASK:
Translate this Mandarin/Cantonese text into English.
Then explain: the idioms, cultural tone, and implied intent.
TEXT:
{text}
""")
# Example usage:
# engine = PromptEngine()
# prompt = engine.classify_threat("專收黑料,秒到!") |