S-Dreamer commited on
Commit
90946e4
·
verified ·
1 Parent(s): 8f99444

Create prompt_engine.py

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