Create main_agents.py
Browse files- agents/main_agents.py +40 -0
agents/main_agents.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Any, Dict
|
2 |
+
from base_agent import MainAgent
|
3 |
+
|
4 |
+
class SummarizeAgent(MainAgent):
|
5 |
+
async def process(self, input_data: str) -> Dict[str, Any]:
|
6 |
+
prompt = f"Summarize the following medical text:\n\n{input_data}"
|
7 |
+
summary = await self.get_completion(prompt)
|
8 |
+
return {"summary": summary}
|
9 |
+
|
10 |
+
class WriteArticleAgent(MainAgent):
|
11 |
+
async def process(self, input_data: Dict[str, str]) -> Dict[str, Any]:
|
12 |
+
prompt = f"""Write a research article with the following:
|
13 |
+
Topic: {input_data['topic']}
|
14 |
+
Key points: {input_data['key_points']}"""
|
15 |
+
article = await self.get_completion(prompt)
|
16 |
+
return {"article": article}
|
17 |
+
|
18 |
+
class SanitizeDataAgent(MainAgent):
|
19 |
+
async def process(self, input_data: str) -> Dict[str, Any]:
|
20 |
+
prompt = """Mask all Protected Health Information (PHI) in the following text.
|
21 |
+
Replace with appropriate masks:
|
22 |
+
- Patient names with [PATIENT_NAME]
|
23 |
+
- Doctor/Provider names with [PROVIDER_NAME]
|
24 |
+
- Dates with [DATE]
|
25 |
+
- Locations/Addresses with [LOCATION]
|
26 |
+
- Phone numbers with [PHONE]
|
27 |
+
- Email addresses with [EMAIL]
|
28 |
+
- Medical record numbers with [MRN]
|
29 |
+
- Social Security numbers with [SSN]
|
30 |
+
- Device identifiers with [DEVICE_ID]
|
31 |
+
- Any other identifying numbers with [ID]
|
32 |
+
- Physical health conditions with [HEALTH_CONDITION]
|
33 |
+
- Medications with [MEDICATION]
|
34 |
+
- Lab results with [LAB_RESULT]
|
35 |
+
- Vital signs with [VITAL_SIGN]
|
36 |
+
- Procedures with [PROCEDURE]
|
37 |
+
|
38 |
+
Text to mask:\n\n""" + input_data
|
39 |
+
sanitized_data = await self.get_completion(prompt)
|
40 |
+
return {"sanitized_data": sanitized_data}
|