feat: mode JSON natif Ollama + modèle gemma3:12b + retry

- Ajout format:"json" dans l'appel API Ollama (force sortie JSON valide)
- Prompt restructuré : raisonnement en champs JSON structurés
  (analyse_clinique, codes_candidats, discrimination, regle_pmsi)
- Parser simplifié : json.loads direct + reconstitution du raisonnement
- Suppression du marqueur ###RESULT### (obsolète avec mode JSON)
- Retry automatique (1 tentative) si parsing échoue
- Stripping des blocs markdown ```json pour compatibilité multi-modèles
- num_predict 1200→2500, modèle gemma3:12b (tient en 12Go VRAM)
- Résultat : 0% échec parsing (était 11% avant)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
dom
2026-02-12 02:19:09 +01:00
parent 931b6c5d1c
commit 86d7ec5ea4
3 changed files with 106 additions and 109 deletions

View File

@@ -31,7 +31,7 @@ NER_CONFIDENCE_THRESHOLD = 0.80
# --- Configuration Ollama ---
OLLAMA_URL = "http://localhost:11434"
OLLAMA_MODEL = "mistral-large-3:675b-cloud"
OLLAMA_MODEL = "gemma3:12b"
OLLAMA_TIMEOUT = 120