Corin1998's picture
Update prompts.py
3bcbfb0 verified
from textwrap import dedent
def build_structured_prompt(product_name: str, value_props: str, target: str,
tone: str, lang: str, seconds: int,
context: str | None = None) -> str:
ctx_block = f"\nReference context (use faithfully, do not fabricate):\n{context}\n" if context else ""
return dedent(f"""
You are a top-tier performance marketer and short-form video copywriter.
Language: {lang}
{ctx_block}
Inputs:
- Product: {product_name}
- Value Props (comma-separated): {value_props}
- Target: {target}
- Tone: {tone}
- Target video length: {seconds} seconds
HARD LANGUAGE RULES:
- All outputs MUST be written entirely in the target Language = {lang}.
- If lang = "en": write natural English (no Japanese).
- If lang = "ja": write natural Japanese (avoid English words except unavoidable proper nouns; numbers are OK).
- The field "thumbnail_text" MUST be in the target language:
* ja: <= 14 characters (counting ASCII/kana/kanji as one char each)
* en: <= 6 words (plain words, no punctuation-only tokens)
- Keep the same language consistently across "headline", "video_script", "thumbnail_text", and all OGP fields.
Task:
1) Craft a high-converting headline.
2) Write a short-form video script designed for {seconds}s. Use 3–5 concise scenes, strong hook in the first 2s. Keep narrator-friendly phrasing.
3) Produce a punchy thumbnail text (respect the language-specific constraint above).
4) Provide OGP fields.
Return STRICT JSON with the following schema ONLY (no explanations):
{{
"headline": string,
"video_script": string, # multi-line; include scene markers like [HOOK], [SCENE2], [CTA]
"thumbnail_text": string,
"ogp": {{
"title": string,
"description": string,
"alt": string
}}
}}
""")