from formulas import offer_formulas 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" - Do not use any special formatting, markdown, or HTML tags - Do not add any characters that could trigger text box formatting """ def create_offer_instruction(target_audience=None, product_service=None, selected_formula_name=None, file_content=None, skills=None, sophistication_level=None): """ Creates the instruction for generating an offer based on the selected formula. Args: target_audience: Description of the target audience product_service: Product/service information selected_formula_name: Name of the selected formula file_content: Content from uploaded files (if any) skills: User's skills and expertise sophistication_level: Dictionary containing market sophistication level info Returns: str: The complete instruction for generating the offer """ # Get the selected formula selected_formula = offer_formulas[selected_formula_name] # Get formula-specific instructions (fixed the get method usage) additional_instructions = selected_formula.get("instructions", "") # Create the base instruction instruction = f"""{offer_system_prompt} FORMULA TO USE: {selected_formula["description"]} {additional_instructions} PRODUCT/SERVICE: {product_service} TARGET AUDIENCE: {target_audience} ADDITIONAL INFORMATION: {file_content} 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"])]) instruction += f"\n\nGet inspired by these examples:\n{examples_text}" # Add sophistication level guidance if sophistication_level: sophistication_guidance = f""" NIVEL DE SOFISTICACIÓN DEL MERCADO: {sophistication_level.get('description', '')} ESTRATEGIA A APLICAR: {sophistication_level.get('strategy', '')} EJEMPLO DE REFERENCIA: {sophistication_level.get('example', '')} Adapta la promesa y el tono según este nivel de sofisticación del mercado. """ instruction += f"\n\n{sophistication_guidance}" return instruction