Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -199,7 +199,15 @@ prompt_templates = {
|
|
199 |
Provide a comprehensive guide on securing wireless networks and IoT devices, including the use of encryption, network segmentation, and regular vulnerability assessments.
|
200 |
"""
|
201 |
),
|
202 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
}
|
204 |
|
205 |
# Initialize chains for each prompt
|
@@ -252,7 +260,7 @@ def classify_query(query: str) -> str:
|
|
252 |
return "patch_management"
|
253 |
elif "wireless and IoT security" in query.lower():
|
254 |
return "wireless_iot_security"
|
255 |
-
#
|
256 |
else:
|
257 |
return "general"
|
258 |
|
@@ -269,7 +277,7 @@ async def process_search(search_query: SearchQuery):
|
|
269 |
if query_type in chains:
|
270 |
response = chains[query_type].run(query=search_query.query, context=context)
|
271 |
else:
|
272 |
-
response = "
|
273 |
|
274 |
return {
|
275 |
"status": "success",
|
|
|
199 |
Provide a comprehensive guide on securing wireless networks and IoT devices, including the use of encryption, network segmentation, and regular vulnerability assessments.
|
200 |
"""
|
201 |
),
|
202 |
+
# General Prompt
|
203 |
+
"general": PromptTemplate(
|
204 |
+
input_variables=["query", "context"],
|
205 |
+
template="""
|
206 |
+
Context: You are a cybersecurity expert with extensive experience in all sub-streams of the industry, including but not limited to network security, application security, cloud security, threat intelligence, penetration testing, and incident response. {context}
|
207 |
+
Query: {query}
|
208 |
+
Please provide a detailed and professional response to the query based on your expertise in cybersecurity and the provided context.
|
209 |
+
"""
|
210 |
+
),
|
211 |
}
|
212 |
|
213 |
# Initialize chains for each prompt
|
|
|
260 |
return "patch_management"
|
261 |
elif "wireless and IoT security" in query.lower():
|
262 |
return "wireless_iot_security"
|
263 |
+
# Default to the general prompt
|
264 |
else:
|
265 |
return "general"
|
266 |
|
|
|
277 |
if query_type in chains:
|
278 |
response = chains[query_type].run(query=search_query.query, context=context)
|
279 |
else:
|
280 |
+
response = chains["general"].run(query=search_query.query, context=context)
|
281 |
|
282 |
return {
|
283 |
"status": "success",
|