Spaces:
Sleeping
Sleeping
Update modules/prompts.py
Browse files- modules/prompts.py +12 -10
modules/prompts.py
CHANGED
@@ -15,8 +15,8 @@ DISCLAIMER = (
|
|
15 |
)
|
16 |
|
17 |
|
18 |
-
# (This function remains the same)
|
19 |
def get_query_correction_prompt(user_text: str) -> str:
|
|
|
20 |
return f"""
|
21 |
You are an expert medical transcriptionist. Your task is to correct and clarify the following user query for a medical database search.
|
22 |
- Correct all spelling and grammatical errors.
|
@@ -27,8 +27,8 @@ def get_query_correction_prompt(user_text: str) -> str:
|
|
27 |
Response:
|
28 |
"""
|
29 |
|
30 |
-
# (This function remains the same)
|
31 |
def get_term_extraction_prompt(user_text: str) -> str:
|
|
|
32 |
return f"""
|
33 |
From the user's corrected query below, extract the most relevant medical concepts, symptoms, or conditions.
|
34 |
Return ONLY a Python-style list of strings.
|
@@ -36,10 +36,15 @@ def get_term_extraction_prompt(user_text: str) -> str:
|
|
36 |
Response:
|
37 |
"""
|
38 |
|
39 |
-
|
40 |
-
# V1.2 UPGRADE: The Symptom Synthesis prompt is now a "Narrative Briefing"
|
41 |
-
# ==============================================================================
|
42 |
def get_synthesis_prompt(user_query: str, concepts: list, pubmed_data: str, trials_data: str, fda_data: str, vision_analysis: str = "") -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
return f"""
|
44 |
You are Asclepius, an expert medical information analyst. Your task is to transform raw medical data into a coherent, insightful, and beautifully formatted narrative report for a user.
|
45 |
|
@@ -66,16 +71,13 @@ def get_synthesis_prompt(user_query: str, concepts: list, pubmed_data: str, tria
|
|
66 |
(Introduce this section by explaining this data comes from OpenFDA. Then, list the findings or state that none were found.)
|
67 |
{fda_data if fda_data else "No specific adverse event data was found for this query."}
|
68 |
|
69 |
-
{
|
70 |
|
71 |
**Begin your report now. Adhere strictly to these directives.**
|
72 |
"""
|
73 |
|
74 |
-
|
75 |
-
# ==============================================================================
|
76 |
-
# V1.2 UPGRADE: The Drug Interaction prompt is now an "Executive Safety Briefing"
|
77 |
-
# ==============================================================================
|
78 |
def get_drug_interaction_synthesis_prompt(drug_names: list[str], interaction_data: str, safety_data: str) -> str:
|
|
|
79 |
return f"""
|
80 |
You are a specialist AI focused on drug safety analysis. Your task is to act as a clear, cautious, and organized pharmacist, explaining raw API data to a user.
|
81 |
|
|
|
15 |
)
|
16 |
|
17 |
|
|
|
18 |
def get_query_correction_prompt(user_text: str) -> str:
|
19 |
+
"""(V1.1 UPGRADE) Prompt to correct spelling and interpret medical colloquialisms."""
|
20 |
return f"""
|
21 |
You are an expert medical transcriptionist. Your task is to correct and clarify the following user query for a medical database search.
|
22 |
- Correct all spelling and grammatical errors.
|
|
|
27 |
Response:
|
28 |
"""
|
29 |
|
|
|
30 |
def get_term_extraction_prompt(user_text: str) -> str:
|
31 |
+
"""Prompt to pull structured medical concepts from a corrected user text."""
|
32 |
return f"""
|
33 |
From the user's corrected query below, extract the most relevant medical concepts, symptoms, or conditions.
|
34 |
Return ONLY a Python-style list of strings.
|
|
|
36 |
Response:
|
37 |
"""
|
38 |
|
39 |
+
|
|
|
|
|
40 |
def get_synthesis_prompt(user_query: str, concepts: list, pubmed_data: str, trials_data: str, fda_data: str, vision_analysis: str = "") -> str:
|
41 |
+
"""(V1.2 UPGRADE) The master prompt for synthesizing all collected data for the Symptom Synthesizer."""
|
42 |
+
|
43 |
+
# ==============================================================================
|
44 |
+
# THIS IS THE CORRECTED LINE THAT PREVENTS THE SYNTAX ERROR.
|
45 |
+
vision_section = f"## Analysis of Uploaded Image\n{vision_analysis}" if vision_analysis else ""
|
46 |
+
# ==============================================================================
|
47 |
+
|
48 |
return f"""
|
49 |
You are Asclepius, an expert medical information analyst. Your task is to transform raw medical data into a coherent, insightful, and beautifully formatted narrative report for a user.
|
50 |
|
|
|
71 |
(Introduce this section by explaining this data comes from OpenFDA. Then, list the findings or state that none were found.)
|
72 |
{fda_data if fda_data else "No specific adverse event data was found for this query."}
|
73 |
|
74 |
+
{vision_section}
|
75 |
|
76 |
**Begin your report now. Adhere strictly to these directives.**
|
77 |
"""
|
78 |
|
|
|
|
|
|
|
|
|
79 |
def get_drug_interaction_synthesis_prompt(drug_names: list[str], interaction_data: str, safety_data: str) -> str:
|
80 |
+
"""(V1.2 UPGRADE) The master prompt for the Drug Interaction & Safety Analyzer."""
|
81 |
return f"""
|
82 |
You are a specialist AI focused on drug safety analysis. Your task is to act as a clear, cautious, and organized pharmacist, explaining raw API data to a user.
|
83 |
|