From fddf48ace9348e946fb49f139bcb2be88a63ee89 Mon Sep 17 00:00:00 2001 From: Jean-Sylvain Boige Date: Sat, 31 Oct 2026 16:37:18 +0100 Subject: [PATCH] Fix(genai,#14755): migrer les deux defauts de chat gpt-4o-mini vers gpt-5.6-luna - p5_tts.py : defaut TRANSLATION_MODEL, commentaire de batch, docstring - livecoding_video_pipeline.py : defaut OPENAI_MODEL - validation locale : 109 tests passes ; les 6 echecs CLI sont un artefact d'encodage console Windows (cp1252 vs utf-8), reproduits a l'identique sur base propre (stash), couverts par la CI Linux See #14755 Co-Authored-By: Claude Haiku 5.5 --- .../GenAI/Audio/04-Applications/v4/p5_tts.py | 9 +++++---- scripts/livecoding_video_pipeline.py | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/MyIA.AI.Notebooks/GenAI/Audio/04-Applications/v4/p5_tts.py b/MyIA.AI.Notebooks/GenAI/Audio/04-Applications/v4/p5_tts.py index 5f45f72193d..211a34e2b00 100644 --- a/MyIA.AI.Notebooks/GenAI/Audio/04-Applications/v4/p5_tts.py +++ b/MyIA.AI.Notebooks/GenAI/Audio/04-Applications/v4/p5_tts.py @@ -363,7 +363,7 @@ def _text_hash(text: str) -> str: # Global cache: seg_index → English instruction string _dramatic_translations: dict[int, str] = {} -# LLM batch size for translation (gpt-4o-mini, cheap) +# LLM batch size for translation (chat mini du mapping, #14755) _TRANSLATION_BATCH_SIZE = 40 _DRAMATIC_KEYWORD_MAP: list[tuple[list[str], str]] = [ @@ -479,7 +479,7 @@ def _get_vocal_reinforcement(instruction: str) -> str | None: def _translate_prompts_batch( segments: list[AnnotatedSegment], ) -> dict[int, str]: - """Translate all dramatic prompts via LLM (gpt-4o-mini) in batches. + """Translate all dramatic prompts via LLM (chat mini du mapping, #14755) in batches. Returns {seg_index: english_instruction} mapping. Results are cached to ``outputs/dramatic_translations.json`` — subsequent runs skip the LLM. @@ -506,8 +506,9 @@ def _translate_prompts_batch( from openai import OpenAI import os - client = OpenAI() # Uses OPENAI_API_KEY from env - model = os.getenv("TRANSLATION_MODEL", "gpt-4o-mini") + client = OpenAI() # OPENAI_API_KEY / OPENAI_BASE_URL depuis l'environnement + # #14755 : gpt-4o-mini (OBS 2024) -> gpt-5.6-luna (mini du mapping) + model = os.getenv("TRANSLATION_MODEL", "gpt-5.6-luna") system_msg = ( "You are a voice direction translator. Convert French dramatic " diff --git a/scripts/livecoding_video_pipeline.py b/scripts/livecoding_video_pipeline.py index 30e0589c2bb..ba8b6f2014b 100644 --- a/scripts/livecoding_video_pipeline.py +++ b/scripts/livecoding_video_pipeline.py @@ -663,7 +663,8 @@ def compose_narration_llm( echoue explicitement, elle n'est jamais rafistolee. """ client = llm_client if llm_client is not None else _build_llm_client() - model = llm_model or os.environ.get("OPENAI_MODEL", "gpt-4o-mini") + # #14755 : gpt-4o-mini (OBS 2024) -> gpt-5.6-luna (mini du mapping) + model = llm_model or os.environ.get("OPENAI_MODEL", "gpt-5.6-luna") plan = NARRATION_PLANS[style_name] span = min(plan.span_fraction * duration_seconds, plan.span_max_s) window_start = plan.start_offset_s