Files
t2a_v2/docs/prompts.md
dom 909e051cc9 feat: architecture multi-modèles LLM + quality engine + benchmark
- Multi-modèles : 4 rôles LLM (coding=gemma3:27b-cloud, cpam=gemma3:27b-cloud,
  validation=deepseek-v3.2:cloud, qc=gemma3:12b) avec get_model(role)
- Prompts externalisés : 7 templates dans src/prompts/templates.py
- Cache Ollama : modèle stocké par entrée (migration auto ancien format)
- call_ollama() : paramètre role= (priorité: model > role > global)
- Quality engine : veto_engine + decision_engine + rules_router (YAML)
- Benchmark qualité : scripts/benchmark_quality.py (A/B, métriques CIM-10)
- Fix biologie : valeurs qualitatives (troponine négative) non filtrées
- Fix CPAM : gemma3:27b-cloud au lieu de deepseek (JSON tronqué par thinking)
- CPAM max_tokens 4000→6000, viewer admin multi-modèles
- Benchmark 10 dossiers : 100% DAS valides, 10/10 CPAM, 243s/dossier

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:21:09 +01:00

2.1 KiB

Prompts LLM — Pipeline T2A v2

7 prompts externalisés dans src/prompts/templates.py, importables via from src.prompts import ....

# Template Rôle LLM Modèle par défaut Temp. max_tokens Variables Appelant
1 CODING_CIM10 coding gemma3:27b-cloud 0.1 2500 texte, type_diag, ctx_str, sources_text rag_search._build_prompt()
2 CODING_CCAM coding gemma3:27b-cloud 0.1 2500 texte, ctx_str, sources_text rag_search._build_prompt_ccam()
3 DAS_EXTRACTION coding gemma3:27b-cloud 0.1 2000 dp_texte, existing_str, ctx_str, text_medical rag_search._build_prompt_das_extraction()
4 QC_VALIDATION qc gemma3:12b 0.1 2500 ctx_str, codes_section cim10_extractor._validate_justifications()
5 CPAM_EXTRACTION cpam deepseek-v3.2:cloud 0.0 1500 dp_str, das_str, tagged_text, titre, arg_ucr, decision_ucr, dp_ucr_line, da_ucr_line cpam_response._extraction_pass()
6 CPAM_ARGUMENTATION cpam deepseek-v3.2:cloud 0.1 4000 dossier_str, asymetrie_str, tagged_str, titre, arg_ucr, decision_ucr, codes_str, definitions_str, sources_text, extraction_str cpam_response._build_cpam_prompt()
7 CPAM_ADVERSARIAL validation deepseek-v3.2:cloud 0.0 800 response_json, factual_section, normes_section, dp_ucr_line, da_ucr_line cpam_response._validate_adversarial()

Rôles LLM (config.py)

OLLAMA_MODELS = {
    "coding":     "gemma3:27b-cloud",   # Codage CIM-10/CCAM, extraction DAS
    "cpam":       "deepseek-v3.2:cloud", # Passe 1 extraction + passe 2 argumentation CPAM
    "validation": "deepseek-v3.2:cloud", # Validation adversariale (DOIT différer du cpam en prod)
    "qc":         "gemma3:12b",          # Validation batch justifications, rapide
}

Surchargeable par env : T2A_MODEL_CODING, T2A_MODEL_CPAM, T2A_MODEL_VALIDATION, T2A_MODEL_QC.

Priorité de résolution du modèle

call_ollama(model=, role=) :

  1. model explicite (prioritaire)
  2. get_model(role) si role fourni
  3. OLLAMA_MODEL global (fallback)