Spaces:
Sleeping
Sleeping
Update the Agent and the assessment responses
Browse files- core/agent.py +8 -9
- core/hbv_assessment.py +49 -32
core/agent.py
CHANGED
|
@@ -103,15 +103,14 @@ When responding to eligibility-related questions, **always start the answer with
|
|
| 103 |
- First-line: Entecavir (ETV), Tenofovir Disoproxil Fumarate (TDF), Tenofovir Alafenamide (TAF)
|
| 104 |
- Alternative agents and PEG-IFN when indicated
|
| 105 |
|
| 106 |
-
**RESPONSE STYLE:**
|
| 107 |
-
- Start directly with clinical
|
| 108 |
-
-
|
| 109 |
-
- Target
|
| 110 |
-
- Prioritize key
|
| 111 |
-
- Use precise medical terminology appropriate for experts
|
| 112 |
-
- Answer only what's asked - no tangential information
|
| 113 |
|
| 114 |
-
**STRUCTURED CLINICAL FORMAT (
|
| 115 |
|
| 116 |
Example 1 - Tabular data with clinical notes:
|
| 117 |
"Chronic HBV is classified into five phases using HBsAg/HBeAg status, HBV DNA, ALT, and liver inflammation.
|
|
@@ -261,7 +260,7 @@ For patient eligibility: Patient Profile (HBsAg, HBeAg, HBV DNA, ALT, Fibrosis)
|
|
| 261 |
**IMPORTANT**: You may format the answer into structured sections (Eligibility, Treatment, Monitoring, etc.), but the content inside MUST remain strictly source-based. Do not add information from general knowledge to fill gaps in the structure.
|
| 262 |
|
| 263 |
**FORMATTING:**
|
| 264 |
-
Use
|
| 265 |
|
| 266 |
**SAFETY:**
|
| 267 |
For emergencies (acute liver failure, hepatic encephalopathy, severe bleeding, loss of consciousness), respond: "This is an emergency! Call emergency services immediately and seek urgent medical help." Educational information only - not a substitute for clinical judgment. Always respond in English.
|
|
|
|
| 103 |
- First-line: Entecavir (ETV), Tenofovir Disoproxil Fumarate (TDF), Tenofovir Alafenamide (TAF)
|
| 104 |
- Alternative agents and PEG-IFN when indicated
|
| 105 |
|
| 106 |
+
**RESPONSE STYLE (Concise):**
|
| 107 |
+
- Start directly with the clinical answer. NO procedural preambles (no "I will retrieve...", "Let me search...", etc.).
|
| 108 |
+
- Prefer short bullet lists over paragraphs. Keep to the point and answer only what is asked.
|
| 109 |
+
- Target 120–220 words for most answers; up to 300 words only if essential. Avoid tables unless explicitly requested.
|
| 110 |
+
- Prioritize key facts and recommendations first; include only necessary citations and parameters.
|
| 111 |
+
- Use precise medical terminology appropriate for experts; omit tangential background.
|
|
|
|
| 112 |
|
| 113 |
+
**STRUCTURED CLINICAL FORMAT (Compact):**
|
| 114 |
|
| 115 |
Example 1 - Tabular data with clinical notes:
|
| 116 |
"Chronic HBV is classified into five phases using HBsAg/HBeAg status, HBV DNA, ALT, and liver inflammation.
|
|
|
|
| 260 |
**IMPORTANT**: You may format the answer into structured sections (Eligibility, Treatment, Monitoring, etc.), but the content inside MUST remain strictly source-based. Do not add information from general knowledge to fill gaps in the structure.
|
| 261 |
|
| 262 |
**FORMATTING:**
|
| 263 |
+
Use brief headers and bullet points. Bold only the most critical terms (e.g., drugs, thresholds). Avoid tables and long examples unless the user asks. Include exact numeric values and page citations as required.
|
| 264 |
|
| 265 |
**SAFETY:**
|
| 266 |
For emergencies (acute liver failure, hepatic encephalopathy, severe bleeding, loss of consciousness), respond: "This is an emergency! Call emergency services immediately and seek urgent medical help." Educational information only - not a substitute for clinical judgment. Always respond in English.
|
core/hbv_assessment.py
CHANGED
|
@@ -75,6 +75,7 @@ def clean_json_string(json_str: str) -> str:
|
|
| 75 |
SASLT_GUIDELINES = """
|
| 76 |
===== TREATMENT RECOMMENDATIONS =====
|
| 77 |
|
|
|
|
| 78 |
### 1. INITIATION OF TREATMENT [SASLT 2021, p. 6]
|
| 79 |
|
| 80 |
• Treatment indications should also take into account patient's age, health status, risk of HBV transmission, family history of HCC or cirrhosis and extrahepatic manifestations
|
|
@@ -83,11 +84,12 @@ SASLT_GUIDELINES = """
|
|
| 83 |
|
| 84 |
• Patients with cirrhosis (compensated or decompensated), with any detectable HBV DNA level and regardless of ALT levels (Grade A)
|
| 85 |
|
| 86 |
-
•
|
|
|
|
| 87 |
|
| 88 |
-
• Patients with HBeAg-positive chronic HBV infection (persistently normal ALT and high HBV DNA levels) may be treated if they are > 30 years, regardless of the severity of liver histological lesions (Grade D)
|
| 89 |
|
| 90 |
-
• Patients with chronic HBV infection (HBV DNA > 2,000 IU/mL, ALT > ULN), regardless of HBeAg status, and a family history of HCC or cirrhosis and extrahepatic manifestations (Grade D)
|
| 91 |
|
| 92 |
|
| 93 |
### 2. MANAGEMENT ALGORITHM [SASLT 2021, p. 6]
|
|
@@ -249,36 +251,51 @@ You MUST respond with a valid JSON object in this exact format:
|
|
| 249 |
}}
|
| 250 |
IMPORTANT JSON FORMATTING:
|
| 251 |
- Return ONLY valid JSON without markdown code blocks
|
| 252 |
-
-
|
| 253 |
-
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
IMPORTANT:
|
| 276 |
-
1. Base your assessment ONLY on the SASLT 2021 guidelines provided
|
| 277 |
-
2. Make recommendations
|
| 278 |
-
3.
|
| 279 |
-
4.
|
| 280 |
-
5.
|
| 281 |
-
6. Return ONLY the JSON object, no additional text
|
| 282 |
"""
|
| 283 |
|
| 284 |
|
|
|
|
| 75 |
SASLT_GUIDELINES = """
|
| 76 |
===== TREATMENT RECOMMENDATIONS =====
|
| 77 |
|
| 78 |
+
|
| 79 |
### 1. INITIATION OF TREATMENT [SASLT 2021, p. 6]
|
| 80 |
|
| 81 |
• Treatment indications should also take into account patient's age, health status, risk of HBV transmission, family history of HCC or cirrhosis and extrahepatic manifestations
|
|
|
|
| 84 |
|
| 85 |
• Patients with cirrhosis (compensated or decompensated), with any detectable HBV DNA level and regardless of ALT levels (Grade A)
|
| 86 |
|
| 87 |
+
• HBV Eligibility Criteria:
|
| 88 |
+
•Patients with HBV DNA > 20,000 IU/mL and ALT > 2xULN, regardless of the degree of fibrosis (Grade B)
|
| 89 |
|
| 90 |
+
• Patients with HBeAg-positive chronic HBV infection (persistently normal ALT and high HBV DNA levels) may be treated if they are > 30 years, regardless of the severity of liver histological lesions (Grade D)
|
| 91 |
|
| 92 |
+
• Patients with chronic HBV infection (HBV DNA > 2,000 IU/mL, ALT > ULN), regardless of HBeAg status, and a family history of HCC or cirrhosis and extrahepatic manifestations (Grade D)
|
| 93 |
|
| 94 |
|
| 95 |
### 2. MANAGEMENT ALGORITHM [SASLT 2021, p. 6]
|
|
|
|
| 251 |
}}
|
| 252 |
IMPORTANT JSON FORMATTING:
|
| 253 |
- Return ONLY valid JSON without markdown code blocks
|
| 254 |
+
- You MUST use "\\n" to indicate line breaks inside the "recommendations" string and format the content as clear bullet lists prefixed with "- ".
|
| 255 |
+
- Do NOT include literal newline characters. Use \\n for every new bullet or line.
|
| 256 |
+
|
| 257 |
+
STRUCTURE AND CONTENT OF "recommendations":
|
| 258 |
+
- Start with a section title: "Eligibility and Rationale:" followed by bullets.
|
| 259 |
+
- Then sections in this order, each as a header line and bulleted items below (all within the same string, separated by \\n):
|
| 260 |
+
- "Criteria Met/Not Met:"
|
| 261 |
+
- "First-line Treatment Options:"
|
| 262 |
+
- "Monitoring and Follow-up:"
|
| 263 |
+
- "Special Considerations:"
|
| 264 |
+
- "Additional Notes:"
|
| 265 |
+
- "References:"
|
| 266 |
+
|
| 267 |
+
BULLETING AND CITATIONS RULES:
|
| 268 |
+
- Put citations at the end of each bullet, not after every clause, using "[SASLT 2021, Page X]".
|
| 269 |
+
- Include evidence grade in the bullet when available (e.g., "(Grade A)") if present in the guideline text.
|
| 270 |
+
- Only cite pages present in the provided context (6–10). Cite the page that actually contains the information.
|
| 271 |
+
|
| 272 |
+
STRICT ACCURACY AND CONSISTENCY RULES:
|
| 273 |
+
- Do NOT contradict yourself. Ensure eligibility conclusion and rationale are consistent with all bullets.
|
| 274 |
+
- Use ONLY the provided SASLT 2021 content; do NOT add external knowledge.
|
| 275 |
+
- Numeric thresholds and wording must match the guideline text exactly when quoted or summarized.
|
| 276 |
+
- If info is not present in the provided pages, do not state it or cite it.
|
| 277 |
+
|
| 278 |
+
PAGE-TO-TOPIC MAPPING GUIDANCE (for correct citations):
|
| 279 |
+
- Page 6: Initiation of treatment, management algorithm, start of monitoring of untreated patients.
|
| 280 |
+
- Page 7: Monitoring of untreated patients (continuation), CHB treatment principles.
|
| 281 |
+
- Page 8: Treatment drugs/regimens (ETV, TDF, TAF), agents not recommended.
|
| 282 |
+
- Page 9: Special populations (HBV-HCV, HBV-HDV, HBV-HIV, immunocompromised).
|
| 283 |
+
- Page 10: Pregnancy-related recommendations (late pregnancy prophylaxis, breastfeeding, switching).
|
| 284 |
+
|
| 285 |
+
EXAMPLE OUTPUT STYLE (illustrative only; adapt to patient data):
|
| 286 |
+
- Eligibility and Rationale:\n- Eligible due to HBV DNA > 2,000 IU/mL with ALT > ULN and/or moderate fibrosis (Grade A) [SASLT 2021, Page 6]\n- Cirrhosis with any detectable HBV DNA warrants treatment regardless of ALT (Grade A) [SASLT 2021, Page 6]
|
| 287 |
+
- Criteria Met/Not Met:\n- HBV DNA level criterion: met (> 2,000 IU/mL) [SASLT 2021, Page 6]\n- ALT criterion: met (> ULN) [SASLT 2021, Page 6]\n- HBeAg-positive >30 years with high DNA and normal ALT (if applicable): met/not met (Grade D) [SASLT 2021, Page 6]
|
| 288 |
+
- First-line Treatment Options:\n- Start monotherapy with ETV, TDF, or TAF (Grade A) [SASLT 2021, Page 8]
|
| 289 |
+
- Monitoring and Follow-up:\n- If untreated, monitor per HBeAg status and DNA thresholds as specified [SASLT 2021, Pages 6–7]
|
| 290 |
+
- Special Considerations:\n- If coinfected with HCV and meeting HBV criteria, treat concurrently or before DAAs (Grade A) [SASLT 2021, Page 8]\n- If immunocompromised, initiate prophylaxis before immunosuppression (Grade A) [SASLT 2021, Page 9]\n- Pregnancy-specific actions per DNA threshold and timing (if applicable) [SASLT 2021, Page 10]
|
| 291 |
+
- References:\n- List all cited pages in ascending order with brief topic labels
|
| 292 |
+
|
| 293 |
IMPORTANT:
|
| 294 |
+
1. Base your assessment ONLY on the SASLT 2021 guidelines provided.
|
| 295 |
+
2. Make recommendations concise, bulleted, and free of contradictions.
|
| 296 |
+
3. Put a proper citation at the end of each bullet using the exact page that contains the information.
|
| 297 |
+
4. End with a "References:" section listing the pages cited in ascending order with short topic labels.
|
| 298 |
+
5. Return ONLY the JSON object, no additional text.
|
|
|
|
| 299 |
"""
|
| 300 |
|
| 301 |
|