Alex Amari Claude Opus 4.6 commited on
Commit
cad38ab
·
1 Parent(s): ee8c8fc

Require 'up to X% discount' phrasing in all LLM outputs

Browse files

Add critical rule to eligibility explanation prompts (all confidence
tiers, both EN/ES) and follow-up chat system prompt to always say
"up to a X% discount", never "a X% discount" directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -364,17 +364,20 @@ def generate_explanation_streaming(data):
364
  lang_guide = """LENGUAJE DEFINITIVO - Este es un derecho estatutario:
365
  - Usa "califica" o "es elegible" con confianza
366
  - Enfatiza que es una ley estatal (PA 24-81)
367
- - No uses "puede" - esto es definitivo"""
 
368
  elif confidence == "strong":
369
  lang_guide = """LENGUAJE CONFIADO:
370
  - Usa "parece ser elegible" o "aparentemente califica"
371
  - Sé positivo pero incluye "basado en la información proporcionada"
372
- - Anima a confirmar con el hospital"""
 
373
  elif confidence == "moderate":
374
  lang_guide = """LENGUAJE CAUTELOSO:
375
  - Usa "puede calificar" o "podría ser elegible"
376
  - IMPORTANTE: Menciona los requisitos adicionales (límites de activos, etc.)
377
- - Enfatiza la necesidad de contactar al hospital"""
 
378
  else:
379
  lang_guide = """LENGUAJE AMABLE PERO DIRECTO:
380
  - Sé claro: "sus ingresos superan los umbrales"
@@ -385,23 +388,28 @@ def generate_explanation_streaming(data):
385
 
386
  {lang_guide}
387
 
 
 
388
  Explica en 2 párrafos claros y cálidos. Máximo 150 palabras."""
389
  else:
390
  if confidence == "statutory":
391
  lang_guide = """DEFINITIVE LANGUAGE - This is a statutory right:
392
  - Use "you qualify" or "you are eligible" confidently
393
  - Emphasize this is Connecticut state law (PA 24-81)
394
- - Don't use "may" - this is definitive"""
 
395
  elif confidence == "strong":
396
  lang_guide = """CONFIDENT LANGUAGE:
397
  - Use "you appear to be eligible" or "you likely qualify"
398
  - Be positive but include "based on the information provided"
399
- - Encourage hospital confirmation"""
 
400
  elif confidence == "moderate":
401
  lang_guide = """CAUTIOUS LANGUAGE:
402
  - Use "you may qualify" or "you could be eligible"
403
  - IMPORTANT: Mention additional requirements (asset limits, etc.)
404
- - Emphasize need to contact hospital"""
 
405
  else:
406
  lang_guide = """GENTLE BUT DIRECT LANGUAGE:
407
  - Be clear: "your income exceeds the eligibility thresholds"
@@ -412,6 +420,8 @@ Explica en 2 párrafos claros y cálidos. Máximo 150 palabras."""
412
 
413
  {lang_guide}
414
 
 
 
415
  Explain in 2 clear, warm paragraphs. Maximum 150 words."""
416
 
417
  insurance_note = ""
@@ -556,6 +566,8 @@ CHAT_SYSTEM_PROMPT = (
556
  "topics under Connecticut Public Act 24-81. If asked about anything unrelated, politely "
557
  "redirect: 'I can only help with questions about Connecticut hospital financial assistance. "
558
  "For other questions, please contact the Office of the Healthcare Advocate at portal.ct.gov/oha.' "
 
 
559
  "Keep answers concise — 2-3 paragraphs maximum. Be warm and supportive."
560
  )
561
 
 
364
  lang_guide = """LENGUAJE DEFINITIVO - Este es un derecho estatutario:
365
  - Usa "califica" o "es elegible" con confianza
366
  - Enfatiza que es una ley estatal (PA 24-81)
367
+ - No uses "puede" - esto es definitivo
368
+ - IMPORTANTE: Siempre di "hasta un X% de descuento", nunca "un X% de descuento" directamente"""
369
  elif confidence == "strong":
370
  lang_guide = """LENGUAJE CONFIADO:
371
  - Usa "parece ser elegible" o "aparentemente califica"
372
  - Sé positivo pero incluye "basado en la información proporcionada"
373
+ - Anima a confirmar con el hospital
374
+ - IMPORTANTE: Siempre di "hasta un X% de descuento", nunca "un X% de descuento" directamente"""
375
  elif confidence == "moderate":
376
  lang_guide = """LENGUAJE CAUTELOSO:
377
  - Usa "puede calificar" o "podría ser elegible"
378
  - IMPORTANTE: Menciona los requisitos adicionales (límites de activos, etc.)
379
+ - Enfatiza la necesidad de contactar al hospital
380
+ - IMPORTANTE: Siempre di "hasta un X% de descuento", nunca "un X% de descuento" directamente"""
381
  else:
382
  lang_guide = """LENGUAJE AMABLE PERO DIRECTO:
383
  - Sé claro: "sus ingresos superan los umbrales"
 
388
 
389
  {lang_guide}
390
 
391
+ REGLA CRÍTICA: Cuando menciones descuentos, SIEMPRE usa "hasta" — por ejemplo "hasta un 100% de descuento", NUNCA "un 100% de descuento".
392
+
393
  Explica en 2 párrafos claros y cálidos. Máximo 150 palabras."""
394
  else:
395
  if confidence == "statutory":
396
  lang_guide = """DEFINITIVE LANGUAGE - This is a statutory right:
397
  - Use "you qualify" or "you are eligible" confidently
398
  - Emphasize this is Connecticut state law (PA 24-81)
399
+ - Don't use "may" - this is definitive
400
+ - IMPORTANT: Always say "up to a X% discount", NEVER "a X% discount" directly"""
401
  elif confidence == "strong":
402
  lang_guide = """CONFIDENT LANGUAGE:
403
  - Use "you appear to be eligible" or "you likely qualify"
404
  - Be positive but include "based on the information provided"
405
+ - Encourage hospital confirmation
406
+ - IMPORTANT: Always say "up to a X% discount", NEVER "a X% discount" directly"""
407
  elif confidence == "moderate":
408
  lang_guide = """CAUTIOUS LANGUAGE:
409
  - Use "you may qualify" or "you could be eligible"
410
  - IMPORTANT: Mention additional requirements (asset limits, etc.)
411
+ - Emphasize need to contact hospital
412
+ - IMPORTANT: Always say "up to a X% discount", NEVER "a X% discount" directly"""
413
  else:
414
  lang_guide = """GENTLE BUT DIRECT LANGUAGE:
415
  - Be clear: "your income exceeds the eligibility thresholds"
 
420
 
421
  {lang_guide}
422
 
423
+ CRITICAL RULE: When mentioning discounts, ALWAYS use "up to" — e.g. "up to a 100% discount", NEVER "a 100% discount". This applies to all discount percentages.
424
+
425
  Explain in 2 clear, warm paragraphs. Maximum 150 words."""
426
 
427
  insurance_note = ""
 
566
  "topics under Connecticut Public Act 24-81. If asked about anything unrelated, politely "
567
  "redirect: 'I can only help with questions about Connecticut hospital financial assistance. "
568
  "For other questions, please contact the Office of the Healthcare Advocate at portal.ct.gov/oha.' "
569
+ "CRITICAL RULE: When mentioning discounts, ALWAYS say 'up to' — e.g. 'up to a 100% discount', "
570
+ "NEVER 'a 100% discount'. This applies to all discount percentages. "
571
  "Keep answers concise — 2-3 paragraphs maximum. Be warm and supportive."
572
  )
573