# Define system prompts for different generators # System prompt for offer generation offer_system_prompt = """You are a world-class expert copywriter, experienced in creating compelling offers that connect emotionally with the target audience. OBJECTIVE: - Generate a convincing offer in Spanish - Connect emotionally with the audience - Address real desires, problems, and motivations - Maintain natural and conversational language CRITICAL OUTPUT RULES: - Output ONLY the offer itself with NO introductory text, explanations, or additional commentary - Start directly with the attention hook or opening phrase - The entire response should be ONLY the offer itself following the formula structure - Do not include phrases like "Aquí tienes una oferta convincente" or "Esta es tu oferta" """ # Remove the circular import # from formulas import offer_formulas def create_offer_instruction(avatar_description, product_name, selected_formula_name, offer_formulas=None): """ Creates instructions for generating an offer based on the selected formula. Args: avatar_description: Description of the target audience product_name: Name of the product or service selected_formula_name: Name of the formula to use offer_formulas: Dictionary containing the formulas (passed from app.py) Returns: str: Complete instruction for generating the offer """ # Get the selected formula selected_formula = offer_formulas[selected_formula_name] # Add specific instructions for each formula additional_instructions = "" if selected_formula_name == "Fórmula Sueño-Obstáculo": additional_instructions = """ SPECIFIC INSTRUCTIONS FOR THIS FORMULA: 1. PRODUCT/SERVICE NAME HANDLING: - If product_name is provided and not empty, use it EXACTLY as written - If product_name is empty, generic (like "Producto/Servicio"), or contains placeholders, CREATE a compelling name that: * Reflects the target audience's desires and challenges * Communicates the main benefit or transformation * Sounds professional and memorable * Is specific to the niche or industry mentioned in avatar_description - If product_name contains a full phrase like "Un curso llamado Inglés sin problemas", extract only the real name ("Inglés sin problemas") 2. Analyze ALL available information: - Product/service name (product_name variable) or create one if needed - Target audience description (avatar_description) - Content from uploaded files (if any) 3. Determine the most appropriate type (curso, webinar, entrenamiento, etc.) based on: - Any type mentioned in product_name - The nature of the solution described in avatar_description - The most suitable format for the target audience's needs 4. Create a comprehensive offer by combining: - The appropriate type (determined in step 3) - The exact product name (if provided) or your created name (if needed) - A compelling dream based on avatar_description - A relevant obstacle based on avatar_description 5. The dream should be ambitious but believable, incorporating: - Target audience desires from avatar_description - Explicit goals mentioned in uploaded content (if any) 6. The obstacle should reflect: - Real problems mentioned in avatar_description - Challenges that would normally prevent achieving the dream 7. IMPORTANT: Vary the way you start the phrase. Instead of always using "Se trata de un...", use different openings such as: - "Presentamos un..." - "Te ofrecemos un..." - "Descubre nuestro..." - "Conoce el..." - "Hemos creado un..." - "Imagina tener acceso a un..." - "Por fin existe un..." - "Ahora puedes acceder a un..." - "Tenemos para ti un..." - "Disfruta de un..." """ elif selected_formula_name == "Oferta Dorada": additional_instructions = """ SPECIFIC INSTRUCTIONS FOR THIS FORMULA: 1. ATTENTION HOOK HANDLING: - Analyze the avatar_description DEEPLY to understand their specific pain points, frustrations, and desires - Select a powerful attention hook that DIRECTLY connects with the avatar's current reality - DO NOT use questions as hooks - use statements, statistics, or shocking revelations instead - CUSTOMIZE the hook specifically for this avatar - don't use generic examples - The hook MUST address the SAME problem that your promise will solve Choose randomly from these statement hooks and CUSTOMIZE for your avatar: - "El 83% de los [avatar's profession/role] pierden [specific resource] en [specific activity] que nadie aprovecha." - "9 de cada 10 [avatar's field] fracasan en sus primeros 6 meses por este error." - "Lo que nadie te dice sobre [avatar's challenge] es que la mayoría fracasa en los primeros 3 meses." - "El secreto que [competitors/industry] no quieren que sepas sobre [avatar's goal]." - "Tu [avatar's current strategy/approach] está ahuyentando a tus [avatar's desired outcome]." - "Mientras algunos [positive outcome], tú sigues [negative current situation]." - "La mayoría de [current solutions] son una pérdida total de [resources]." - "Hace 6 meses estaba exactamente donde tú estás: [avatar's current struggle]." 2. MAINTAIN THEMATIC CONSISTENCY: - The attention hook, quantifiable promise, and benefit statement MUST all address the SAME problem - Create a LOGICAL PROGRESSION from problem (hook) to solution (promise) to implementation (benefit) 3. Create a compelling QUANTIFIABLE PROMISE that: - Is written COMPLETELY IN CAPITAL LETTERS - Includes concrete numbers (money, time, results) - Uses powerful action verbs (EARN, MULTIPLY, ACHIEVE, MASTER) - Specifies the exact result they will obtain - Optionally includes time or effort required - NEVER uses exclamation marks (!) - DIRECTLY addresses the same problem mentioned in the hook 4. Craft a benefit statement that: - Clearly explains the result they will obtain - Includes an authority element (proven method, studies, experience) - Establishes a realistic timeframe or effort needed - CONTINUES the same theme established in the hook and promise """ # Create the instruction using the system prompt at the beginning instruction = f"""{offer_system_prompt} FORMULA TO USE: {selected_formula["description"]} {additional_instructions} PRODUCT/SERVICE: {product_name} TARGET AUDIENCE: {avatar_description} Create a compelling offer following the formula structure exactly. """ # Add examples if available if selected_formula.get("examples") and len(selected_formula["examples"]) > 0: examples_text = "\n\n".join([f"Example {i+1}:\n{example}" for i, example in enumerate(selected_formula["examples"][:3])]) instruction += f"\n\nGet inspired by these examples:\n{examples_text}" return instruction # System prompt for benefits generation system_prompt = """You are a world-class expert copywriter, experienced in creating benefits that emotionally connect and address the desires, problems, and motivations of the target audience. OBJECTIVE: - Generate convincing and specific benefit bullets in Spanish - Connect emotionally with the audience - Address real desires, problems, and motivations - Maintain natural and conversational language - Orient each benefit towards action FORMAT RULES: - Each benefit must start with "• " - One benefit per line - No numbers at the beginning - No explanations or categories - Add a line break between each benefit - Never include : symbols in bullets - Each benefit must be a complete and concise phrase BENEFIT STRUCTURE: - Must be relevant to target audience - Must show a specific result - Must include an emotional element - Must eliminate an objection or pain point - Must inspire immediate action EJEMPLO DE FORMATO: • Transforma tu negocio con estrategias probadas que duplican tus ingresos en 90 días, sin sacrificar tu tiempo en familia. • Domina las técnicas más efectivas para conquistar tu mercado, mientras mantienes el equilibrio entre trabajo y vida personal. • Implementa sistemas automatizados que hacen crecer tu empresa incluso mientras duermes, eliminando la necesidad de trabajar más horas. IMPORTANT: - Each benefit must be unique and specific - Avoid repetitions and generalities - Maintain a persuasive but honest tone - Adapt language to audience comprehension level - Focus on tangible and measurable results """ def create_instruction(number_of_benefits, target_audience, product, selected_formula, selected_angle): angle_instruction = "" if selected_angle["description"] != "Generate the bullet without any specific angle": angle_instruction = f"\nApply this angle: {selected_angle['description']}\nStyle: {selected_angle['style']}\nUse these keywords as inspiration: {', '.join(selected_angle['keywords'])}" return ( f"{system_prompt}\n\n" f"Your task is to create {number_of_benefits} irresistible benefits designed for {target_audience}. " f"The goal is to show how {product} can transform the reader's life, connecting naturally and emotionally. " f"Avoid using literal or repetitive mentions, and highlight concrete solutions, showing how the product removes obstacles or satisfies real desires. " f"{angle_instruction}\n" f"IMPORTANT: Keep bullets short and direct. " f"Use the selected formula as a guide:\n\n{selected_formula['description']}\n\n" f"Get inspired by these examples:\n" f"- {selected_formula['examples'][0]}\n" f"- {selected_formula['examples'][1]}\n" f"- {selected_formula['examples'][2]}\n\n" f"Your goal is to inspire desire and action, avoiding explanations or categories in the response." )