Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions MyIA.AI.Notebooks/GenAI/Audio/04-Applications/v4/p5_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]] = [
Expand Down Expand Up @@ -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.
Expand All @@ -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 "
Expand Down
3 changes: 2 additions & 1 deletion scripts/livecoding_video_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading