Spaces:
Running
Running
Diego Carpintero
commited on
Commit
•
0e808f0
1
Parent(s):
3dd5cf3
refactor
Browse files- minerva.ipynb +55 -61
minerva.ipynb
CHANGED
@@ -65,7 +65,7 @@
|
|
65 |
},
|
66 |
{
|
67 |
"cell_type": "code",
|
68 |
-
"execution_count":
|
69 |
"metadata": {},
|
70 |
"outputs": [],
|
71 |
"source": [
|
@@ -82,6 +82,8 @@
|
|
82 |
"]\n",
|
83 |
"\n",
|
84 |
"llm_config = {\n",
|
|
|
|
|
85 |
" \"config_list\": config_list,\n",
|
86 |
" \"timeout\": 120,\n",
|
87 |
"}"
|
@@ -89,7 +91,7 @@
|
|
89 |
},
|
90 |
{
|
91 |
"cell_type": "code",
|
92 |
-
"execution_count":
|
93 |
"metadata": {},
|
94 |
"outputs": [],
|
95 |
"source": [
|
@@ -108,7 +110,7 @@
|
|
108 |
},
|
109 |
{
|
110 |
"cell_type": "code",
|
111 |
-
"execution_count":
|
112 |
"metadata": {},
|
113 |
"outputs": [],
|
114 |
"source": [
|
@@ -123,13 +125,6 @@
|
|
123 |
" system_message=config['ocr_agent']['assignment'],\n",
|
124 |
" llm_config=llm_config\n",
|
125 |
" )\n",
|
126 |
-
"\n",
|
127 |
-
" url_agent = autogen.AssistantAgent(\n",
|
128 |
-
" name=\"URL_Agent\",\n",
|
129 |
-
" description=\"Checks if a URL is safe\",\n",
|
130 |
-
" system_message=config['url_agent']['assignment'],\n",
|
131 |
-
" llm_config=llm_config\n",
|
132 |
-
" )\n",
|
133 |
" \n",
|
134 |
" content_agent = autogen.AssistantAgent(\n",
|
135 |
" name=\"Content_Analyst\",\n",
|
@@ -155,7 +150,6 @@
|
|
155 |
" user_proxy = autogen.UserProxyAgent(\n",
|
156 |
" name=\"user_proxy\",\n",
|
157 |
" is_termination_msg=lambda x: \"COMPLETE\" in x.get(\"content\", \"\"),\n",
|
158 |
-
" #is_termination_msg=lambda x: x.get(\"content\", \"\") and x.get(\"content\", \"\").rstrip().endswith(\"TERMINATE\"),\n",
|
159 |
" human_input_mode=\"NEVER\",\n",
|
160 |
" max_consecutive_auto_reply=10,\n",
|
161 |
" )\n",
|
@@ -170,8 +164,6 @@
|
|
170 |
" def url_checker (url: str) -> str:\n",
|
171 |
" return tools.is_url_safe(url)\n",
|
172 |
"\n",
|
173 |
-
"\n",
|
174 |
-
" #return ocr_agent, url_agent, content_agent, decision_agent, summary_agent, user_proxy\n",
|
175 |
" return ocr_agent, content_agent, decision_agent, summary_agent, user_proxy"
|
176 |
]
|
177 |
},
|
@@ -184,13 +176,12 @@
|
|
184 |
},
|
185 |
{
|
186 |
"cell_type": "code",
|
187 |
-
"execution_count":
|
188 |
"metadata": {},
|
189 |
"outputs": [],
|
190 |
"source": [
|
191 |
"class ScamDetectionWorkflow:\n",
|
192 |
" def __init__(self):\n",
|
193 |
-
" #self.ocr_agent, self.url_agent, self.content_agent, self.decision_agent, self.summary_agent, self.user_proxy = create_agents()\n",
|
194 |
" self.ocr_agent, self.content_agent, self.decision_agent, self.summary_agent, self.user_proxy = create_agents()\n",
|
195 |
" \n",
|
196 |
" def analyze(self, image_path):\n",
|
@@ -198,23 +189,13 @@
|
|
198 |
" \"\"\"\n",
|
199 |
" \n",
|
200 |
" groupchat = autogen.GroupChat(\n",
|
201 |
-
" #agents=[self.ocr_agent, self.url_agent, self.content_agent, self.decision_agent, self.summary_agent, self.user_proxy],\n",
|
202 |
" agents=[self.ocr_agent, self.content_agent, self.decision_agent, self.summary_agent, self.user_proxy],\n",
|
203 |
" messages=[],\n",
|
204 |
" max_round=15,\n",
|
205 |
-
"
|
206 |
" )\n",
|
207 |
" manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config)\n",
|
208 |
"\n",
|
209 |
-
" # 2. URL Agent: Check if a URL is safe\n",
|
210 |
-
" #messages = self.user_proxy.initiate_chat(\n",
|
211 |
-
" # manager,\n",
|
212 |
-
" # message=f\"\"\"\n",
|
213 |
-
" # 1. OCR Agent: Extract text from this image: {image_path}\n",
|
214 |
-
" # 2. Content Agent: Evaluate the messaging and claims\n",
|
215 |
-
" # 3. Decision Maker: Synthesize all analyses and make final determination\n",
|
216 |
-
" # 4. Summarize the findings\"\"\",\n",
|
217 |
-
" #)\n",
|
218 |
" messages = self.user_proxy.initiate_chat(\n",
|
219 |
" manager,\n",
|
220 |
" message=f\"\"\"does the content of the image in {image_path} represent a scam?\"\"\",\n",
|
@@ -225,7 +206,7 @@
|
|
225 |
},
|
226 |
{
|
227 |
"cell_type": "code",
|
228 |
-
"execution_count":
|
229 |
"metadata": {},
|
230 |
"outputs": [
|
231 |
{
|
@@ -241,17 +222,33 @@
|
|
241 |
],
|
242 |
"source": [
|
243 |
"image_path = \"./samples/02.giftcard.message.scam.png\"\n",
|
244 |
-
"#image_path = \"./samples/74.customer.service.twitter.scam.png\"\n",
|
245 |
-
"#image_path = \"./samples/42.amazon.email.scam.png\"\n",
|
246 |
-
"#image_path = \"./samples/22.giveaway.email.scam.png\"\n",
|
247 |
-
"#image_path = \"./samples/32.multifactor.email.scam.png\"\n",
|
248 |
-
"#image_path = \"./samples/39.paypal.email.scam.png\"\n",
|
249 |
"display(IPImage(filename=image_path))"
|
250 |
]
|
251 |
},
|
252 |
{
|
253 |
"cell_type": "code",
|
254 |
-
"execution_count":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
"metadata": {},
|
256 |
"outputs": [
|
257 |
{
|
@@ -274,7 +271,7 @@
|
|
274 |
"\u001b[0m\n",
|
275 |
"\u001b[33mOCR_Specialist\u001b[0m (to chat_manager):\n",
|
276 |
"\n",
|
277 |
-
"\u001b[32m***** Suggested tool call (
|
278 |
"Arguments: \n",
|
279 |
"{\"image_path\":\"./samples/02.giftcard.message.scam.png\"}\n",
|
280 |
"\u001b[32m********************************************************************\u001b[0m\n",
|
@@ -289,7 +286,7 @@
|
|
289 |
"\n",
|
290 |
"\u001b[33muser_proxy\u001b[0m (to chat_manager):\n",
|
291 |
"\n",
|
292 |
-
"\u001b[32m***** Response from calling tool (
|
293 |
"Congratulations!\n",
|
294 |
"You've won a $1,000\n",
|
295 |
"Walmart gift card. Go\n",
|
@@ -305,11 +302,11 @@
|
|
305 |
"\u001b[0m\n",
|
306 |
"\u001b[33mContent_Analyst\u001b[0m (to chat_manager):\n",
|
307 |
"\n",
|
308 |
-
"\u001b[32m***** Suggested tool call (
|
309 |
"Arguments: \n",
|
310 |
"{\"url\": \"http://bit.ly/123456\"}\n",
|
311 |
"\u001b[32m****************************************************************************\u001b[0m\n",
|
312 |
-
"\u001b[32m***** Suggested tool call (
|
313 |
"Arguments: \n",
|
314 |
"{\"url\": \"http://bit.ly/123456\"}\n",
|
315 |
"\u001b[32m****************************************************************************\u001b[0m\n",
|
@@ -328,14 +325,14 @@
|
|
328 |
"\n",
|
329 |
"\u001b[33muser_proxy\u001b[0m (to chat_manager):\n",
|
330 |
"\n",
|
331 |
-
"\u001b[32m***** Response from calling tool (
|
332 |
"[true, []]\n",
|
333 |
"\u001b[32m**********************************************************************\u001b[0m\n",
|
334 |
"\n",
|
335 |
"--------------------------------------------------------------------------------\n",
|
336 |
"\u001b[33muser_proxy\u001b[0m (to chat_manager):\n",
|
337 |
"\n",
|
338 |
-
"\u001b[32m***** Response from calling tool (
|
339 |
"[true, []]\n",
|
340 |
"\u001b[32m**********************************************************************\u001b[0m\n",
|
341 |
"\n",
|
@@ -345,19 +342,17 @@
|
|
345 |
"\u001b[0m\n",
|
346 |
"\u001b[33mDecision_Maker\u001b[0m (to chat_manager):\n",
|
347 |
"\n",
|
348 |
-
"Based on the
|
349 |
-
"\n",
|
350 |
-
"### Explanation:\n",
|
351 |
"\n",
|
352 |
-
"1. **
|
353 |
"\n",
|
354 |
-
"2. **
|
355 |
"\n",
|
356 |
-
"3. **
|
357 |
"\n",
|
358 |
-
"4. **
|
359 |
"\n",
|
360 |
-
"
|
361 |
"\n",
|
362 |
"--------------------------------------------------------------------------------\n",
|
363 |
"\u001b[32m\n",
|
@@ -365,7 +360,7 @@
|
|
365 |
"\u001b[0m\n",
|
366 |
"\u001b[33mSummary_Agent\u001b[0m (to chat_manager):\n",
|
367 |
"\n",
|
368 |
-
"The
|
369 |
"\n",
|
370 |
"COMPLETE\n",
|
371 |
"\n",
|
@@ -390,16 +385,15 @@
|
|
390 |
"name": "stdout",
|
391 |
"output_type": "stream",
|
392 |
"text": [
|
393 |
-
"{'content': 'The message claiming
|
394 |
-
"
|
395 |
-
" '
|
396 |
-
"
|
397 |
-
" '
|
398 |
-
" '
|
399 |
-
" '
|
400 |
-
" '
|
401 |
-
" '
|
402 |
-
" 'communications. \\n'\n",
|
403 |
" '\\n'\n",
|
404 |
" 'COMPLETE',\n",
|
405 |
" 'name': 'Summary_Agent',\n",
|
@@ -428,16 +422,16 @@
|
|
428 |
},
|
429 |
{
|
430 |
"cell_type": "code",
|
431 |
-
"execution_count":
|
432 |
"metadata": {},
|
433 |
"outputs": [
|
434 |
{
|
435 |
"data": {
|
436 |
"text/plain": [
|
437 |
-
"'
|
438 |
]
|
439 |
},
|
440 |
-
"execution_count":
|
441 |
"metadata": {},
|
442 |
"output_type": "execute_result"
|
443 |
}
|
|
|
65 |
},
|
66 |
{
|
67 |
"cell_type": "code",
|
68 |
+
"execution_count": 4,
|
69 |
"metadata": {},
|
70 |
"outputs": [],
|
71 |
"source": [
|
|
|
82 |
"]\n",
|
83 |
"\n",
|
84 |
"llm_config = {\n",
|
85 |
+
" \"cache_seed\": 42,\n",
|
86 |
+
" \"temperature\": 0,\n",
|
87 |
" \"config_list\": config_list,\n",
|
88 |
" \"timeout\": 120,\n",
|
89 |
"}"
|
|
|
91 |
},
|
92 |
{
|
93 |
"cell_type": "code",
|
94 |
+
"execution_count": 5,
|
95 |
"metadata": {},
|
96 |
"outputs": [],
|
97 |
"source": [
|
|
|
110 |
},
|
111 |
{
|
112 |
"cell_type": "code",
|
113 |
+
"execution_count": 6,
|
114 |
"metadata": {},
|
115 |
"outputs": [],
|
116 |
"source": [
|
|
|
125 |
" system_message=config['ocr_agent']['assignment'],\n",
|
126 |
" llm_config=llm_config\n",
|
127 |
" )\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
" \n",
|
129 |
" content_agent = autogen.AssistantAgent(\n",
|
130 |
" name=\"Content_Analyst\",\n",
|
|
|
150 |
" user_proxy = autogen.UserProxyAgent(\n",
|
151 |
" name=\"user_proxy\",\n",
|
152 |
" is_termination_msg=lambda x: \"COMPLETE\" in x.get(\"content\", \"\"),\n",
|
|
|
153 |
" human_input_mode=\"NEVER\",\n",
|
154 |
" max_consecutive_auto_reply=10,\n",
|
155 |
" )\n",
|
|
|
164 |
" def url_checker (url: str) -> str:\n",
|
165 |
" return tools.is_url_safe(url)\n",
|
166 |
"\n",
|
|
|
|
|
167 |
" return ocr_agent, content_agent, decision_agent, summary_agent, user_proxy"
|
168 |
]
|
169 |
},
|
|
|
176 |
},
|
177 |
{
|
178 |
"cell_type": "code",
|
179 |
+
"execution_count": 10,
|
180 |
"metadata": {},
|
181 |
"outputs": [],
|
182 |
"source": [
|
183 |
"class ScamDetectionWorkflow:\n",
|
184 |
" def __init__(self):\n",
|
|
|
185 |
" self.ocr_agent, self.content_agent, self.decision_agent, self.summary_agent, self.user_proxy = create_agents()\n",
|
186 |
" \n",
|
187 |
" def analyze(self, image_path):\n",
|
|
|
189 |
" \"\"\"\n",
|
190 |
" \n",
|
191 |
" groupchat = autogen.GroupChat(\n",
|
|
|
192 |
" agents=[self.ocr_agent, self.content_agent, self.decision_agent, self.summary_agent, self.user_proxy],\n",
|
193 |
" messages=[],\n",
|
194 |
" max_round=15,\n",
|
195 |
+
" speaker_selection_method=\"auto\",\n",
|
196 |
" )\n",
|
197 |
" manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config)\n",
|
198 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
" messages = self.user_proxy.initiate_chat(\n",
|
200 |
" manager,\n",
|
201 |
" message=f\"\"\"does the content of the image in {image_path} represent a scam?\"\"\",\n",
|
|
|
206 |
},
|
207 |
{
|
208 |
"cell_type": "code",
|
209 |
+
"execution_count": 11,
|
210 |
"metadata": {},
|
211 |
"outputs": [
|
212 |
{
|
|
|
222 |
],
|
223 |
"source": [
|
224 |
"image_path = \"./samples/02.giftcard.message.scam.png\"\n",
|
|
|
|
|
|
|
|
|
|
|
225 |
"display(IPImage(filename=image_path))"
|
226 |
]
|
227 |
},
|
228 |
{
|
229 |
"cell_type": "code",
|
230 |
+
"execution_count": 7,
|
231 |
+
"metadata": {},
|
232 |
+
"outputs": [
|
233 |
+
{
|
234 |
+
"data": {
|
235 |
+
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZQAAABUCAYAAAClWsGgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABM7SURBVHhe7Z07k+PGtcd7b5U/gTa8yQ1sYqPrUC5FvlYO0A7scIKtciBFTkg7uavERTpwolXgbDLLEcHkJt4qRyorVEYwd+bRB1DEe04/gNMPPEj2DDmc/2+rd4gG0C80+nSfbvR5dSAUAAAAcCb/Yf8CAAAAZwGBAgAAIAsQKAAAALIAgQIAACALECgAAACyAIECAAAgCxAoAAAAsgCBAgAAIAsQKAAAALIAgQIAACALECgAAACyAIECAAAgCxAoAAAAsgCBAgAAIAtnCZS6eqVevRpyhVo29uIRmmVx9D25uGTcp+DSWzyHxAIAXgxnCZSqPqjDbqFm9Hu22Ck2rSLdpjTXTaFYNepwzA0ZuWTcp1B8XHh/AQDgGnhUlVdRoMEDAICXwuMKlFWtVpAp+SFBPaN/kNcAgGvicQRKs1RFVdsDgo/tvEpVVXa+wjp5nSWcmwnnCqK5mzaMRi0L4VfbuOz5eM6nUn7se7V+41/jgk7Ns3ThyXBEGvquLypV9VzDjKcTAACukMO57BaHGQXDQXmu3NgLLO464b9bzOja2WGxsx6bUt8rb92UHF55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UktvkMtwEDY0cttxYD7SeyXTaVVxTvqjnEUjJI4x5oHY6dUmznZsxox4HCw7uCQSrxXh0QnXy5L4JALfGITubQ5my6xzZkeaVTf02mCMbzm6ZjQxHX2tXZbV+CZvvAX7YdL07nr09vPXC4vCDNLowxSou49IrvLST5TFgNzxaJWRXMrmVRnq1UnL1kV2tpZ1bbRT76ZVSrZ91waojf2UWheGtCmNSfkSQVuPC1VTynFvZlUi7vVbnNwo3Xk2l0xykKVzt1YuOKwzTrsiS8UZ5NtdMikODVV7g9oE9lBeE3lKk+UTtbuwjOx5VLT/+fHiy/crhuUO8iuC5k1nlBcBTc+T2LwCARwMjlCuG5xHAbcIT9RKMUMAtAIHyQjA76NoDvarpGa80aj6owu0SzKumbuDjQQgUcAtAoAAAAMgC5lAAAABkAQIFAABAFiBQAAAAZAECBQAAQBYgUAAAAGQBAgUAAEAWIFAAAABkAQIFAABAFiBQAAAAZAECBQAAQBYgUAAAAGQBAgUAAEAGlPp//KLuHgMKa68AAAAASUVORK5CYII=",
|
236 |
+
"text/plain": [
|
237 |
+
"<IPython.core.display.Image object>"
|
238 |
+
]
|
239 |
+
},
|
240 |
+
"metadata": {},
|
241 |
+
"output_type": "display_data"
|
242 |
+
}
|
243 |
+
],
|
244 |
+
"source": [
|
245 |
+
"image_path = \"./samples/scam.spanish.png\"\n",
|
246 |
+
"display(IPImage(filename=image_path))"
|
247 |
+
]
|
248 |
+
},
|
249 |
+
{
|
250 |
+
"cell_type": "code",
|
251 |
+
"execution_count": 12,
|
252 |
"metadata": {},
|
253 |
"outputs": [
|
254 |
{
|
|
|
271 |
"\u001b[0m\n",
|
272 |
"\u001b[33mOCR_Specialist\u001b[0m (to chat_manager):\n",
|
273 |
"\n",
|
274 |
+
"\u001b[32m***** Suggested tool call (call_Z4RQNLzsf6yBOjAS2RcFr2sc): ocr *****\u001b[0m\n",
|
275 |
"Arguments: \n",
|
276 |
"{\"image_path\":\"./samples/02.giftcard.message.scam.png\"}\n",
|
277 |
"\u001b[32m********************************************************************\u001b[0m\n",
|
|
|
286 |
"\n",
|
287 |
"\u001b[33muser_proxy\u001b[0m (to chat_manager):\n",
|
288 |
"\n",
|
289 |
+
"\u001b[32m***** Response from calling tool (call_Z4RQNLzsf6yBOjAS2RcFr2sc) *****\u001b[0m\n",
|
290 |
"Congratulations!\n",
|
291 |
"You've won a $1,000\n",
|
292 |
"Walmart gift card. Go\n",
|
|
|
302 |
"\u001b[0m\n",
|
303 |
"\u001b[33mContent_Analyst\u001b[0m (to chat_manager):\n",
|
304 |
"\n",
|
305 |
+
"\u001b[32m***** Suggested tool call (call_vyxuVDwTS8n9cZbjd4UkqgFw): url_checker *****\u001b[0m\n",
|
306 |
"Arguments: \n",
|
307 |
"{\"url\": \"http://bit.ly/123456\"}\n",
|
308 |
"\u001b[32m****************************************************************************\u001b[0m\n",
|
309 |
+
"\u001b[32m***** Suggested tool call (call_RBqKQxO1GAwTFYxfhZhN8gow): url_checker *****\u001b[0m\n",
|
310 |
"Arguments: \n",
|
311 |
"{\"url\": \"http://bit.ly/123456\"}\n",
|
312 |
"\u001b[32m****************************************************************************\u001b[0m\n",
|
|
|
325 |
"\n",
|
326 |
"\u001b[33muser_proxy\u001b[0m (to chat_manager):\n",
|
327 |
"\n",
|
328 |
+
"\u001b[32m***** Response from calling tool (call_vyxuVDwTS8n9cZbjd4UkqgFw) *****\u001b[0m\n",
|
329 |
"[true, []]\n",
|
330 |
"\u001b[32m**********************************************************************\u001b[0m\n",
|
331 |
"\n",
|
332 |
"--------------------------------------------------------------------------------\n",
|
333 |
"\u001b[33muser_proxy\u001b[0m (to chat_manager):\n",
|
334 |
"\n",
|
335 |
+
"\u001b[32m***** Response from calling tool (call_RBqKQxO1GAwTFYxfhZhN8gow) *****\u001b[0m\n",
|
336 |
"[true, []]\n",
|
337 |
"\u001b[32m**********************************************************************\u001b[0m\n",
|
338 |
"\n",
|
|
|
342 |
"\u001b[0m\n",
|
343 |
"\u001b[33mDecision_Maker\u001b[0m (to chat_manager):\n",
|
344 |
"\n",
|
345 |
+
"Based on the content of the image, the message states that the recipient has \"won a $1,000 Walmart gift card\" and provides a link to claim it. This type of message is a common tactic used in scams, often referred to as \"phishing\" or \"prize scams.\" Here are the reasons for determining the high probability of this being a scam:\n",
|
|
|
|
|
346 |
"\n",
|
347 |
+
"1. **Unsolicited Prize Notification**: The message claims that the recipient has won a gift card without any prior entry or participation in a contest. Legitimate companies do not award prizes without a clear entry process.\n",
|
348 |
"\n",
|
349 |
+
"2. **Urgency and Action**: The message encourages immediate action by stating \"Go to claim now.\" Scammers often create a sense of urgency to prompt quick responses without careful consideration.\n",
|
350 |
"\n",
|
351 |
+
"3. **Suspicious URL**: The link provided is a shortened URL (bit.ly), which is often used to obscure the final destination. This is a common tactic in scams to hide malicious websites. While the URL checker indicates that the link is active, it does not guarantee safety, as it could lead to a phishing site designed to steal personal information.\n",
|
352 |
"\n",
|
353 |
+
"4. **Generic Messaging**: The message lacks personalization and specific details about the supposed win, which is typical of scam communications.\n",
|
354 |
"\n",
|
355 |
+
"Given these factors, I conclude that the content of the image represents a high probability of being a scam. It is advisable to avoid clicking on the link and to report such messages if received.\n",
|
356 |
"\n",
|
357 |
"--------------------------------------------------------------------------------\n",
|
358 |
"\u001b[32m\n",
|
|
|
360 |
"\u001b[0m\n",
|
361 |
"\u001b[33mSummary_Agent\u001b[0m (to chat_manager):\n",
|
362 |
"\n",
|
363 |
+
"The message in the image claims the recipient has \"won a $1,000 Walmart gift card\" and provides a link to claim it, which is a common scam tactic. Key indicators of a scam include unsolicited prize notifications, urgency to act quickly, a suspicious shortened URL, and generic messaging without personalization. To protect yourself, do not click on the link and report any similar messages. \n",
|
364 |
"\n",
|
365 |
"COMPLETE\n",
|
366 |
"\n",
|
|
|
385 |
"name": "stdout",
|
386 |
"output_type": "stream",
|
387 |
"text": [
|
388 |
+
"{'content': 'The analysis of the message claiming a $1,000 Walmart gift card '\n",
|
389 |
+
" \"indicates a high probability that it's a scam. Key warning signs \"\n",
|
390 |
+
" 'include the unsolicited nature of the \"win,\" a shortened URL that '\n",
|
391 |
+
" \"conceals the link's real destination, and common scam tactics \"\n",
|
392 |
+
" 'that use enticing offers to trick victims. To protect yourself, '\n",
|
393 |
+
" 'do not click on any links in such messages, avoid sharing '\n",
|
394 |
+
" 'personal information, and report suspicious content to relevant '\n",
|
395 |
+
" 'authorities. Stay vigilant and skeptical of unsolicited offers '\n",
|
396 |
+
" \"claiming you've won something. \\n\"\n",
|
|
|
397 |
" '\\n'\n",
|
398 |
" 'COMPLETE',\n",
|
399 |
" 'name': 'Summary_Agent',\n",
|
|
|
422 |
},
|
423 |
{
|
424 |
"cell_type": "code",
|
425 |
+
"execution_count": 10,
|
426 |
"metadata": {},
|
427 |
"outputs": [
|
428 |
{
|
429 |
"data": {
|
430 |
"text/plain": [
|
431 |
+
"''"
|
432 |
]
|
433 |
},
|
434 |
+
"execution_count": 10,
|
435 |
"metadata": {},
|
436 |
"output_type": "execute_result"
|
437 |
}
|