Spaces:
Sleeping
Sleeping
| # Define a unified system prompt for copywriting tasks | |
| system_prompt = """You are a world-class expert copywriter, experienced in creating compelling content that connects emotionally with the target audience. | |
| OBJECTIVE: | |
| - Generate convincing content in Spanish | |
| - Connect emotionally with the audience | |
| - Address real desires, problems, and motivations | |
| - Maintain natural and conversational language | |
| - Orient content towards transformation and results | |
| CRITICAL OUTPUT RULES: | |
| - Output ONLY the requested content with NO introductory text, explanations, or additional commentary | |
| - Start directly with the content | |
| - Do not include phrases like "Aquí tienes..." or "Esta es tu..." | |
| - Follow the specified format and structure exactly | |
| """ | |
| 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. | |
| """ | |
| # Get the selected formula | |
| selected_formula = offer_formulas[selected_formula_name] | |
| # Get custom instructions from the formula dictionary | |
| additional_instructions = selected_formula.get("custom_instructions", "") | |
| # Create the instruction using the system prompt at the beginning | |
| instruction = f"""{system_prompt} | |
| CONTENT TYPE: OFFER | |
| 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 | |
| def create_promise_instruction(number_of_promises, target_audience, product, selected_formula, selected_angle): | |
| """ | |
| Creates instructions for generating promises based on the selected formula and 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'])}" | |
| format_rules = """ | |
| FORMAT RULES: | |
| - One promise per line | |
| - No numbers at the beginning | |
| - No explanations or categories | |
| - Add a line break between each promise | |
| - Never include : symbols in promises | |
| - Each promise must be a complete and concise phrase | |
| PROMISE STRUCTURE: | |
| - Must be relevant to target audience | |
| - Must show a specific, measurable result | |
| - Must include an emotional element | |
| - Must eliminate an objection or pain point | |
| - Must inspire immediate action or belief | |
| """ | |
| return ( | |
| f"{system_prompt}\n\n" | |
| f"CONTENT TYPE: PROMISES\n\n" | |
| f"{format_rules}\n\n" | |
| f"Your task is to create {number_of_promises} irresistible promises designed for {target_audience}. " | |
| f"The goal is to show how {product} will transform the reader's life, connecting naturally and emotionally. " | |
| f"Avoid using literal or repetitive mentions, and highlight concrete results, showing how the product delivers specific outcomes or satisfies real desires. " | |
| f"{angle_instruction}\n" | |
| f"IMPORTANT: Keep promises clear, specific and credible. " | |
| f"Use the selected formula as a guide:\n\n{selected_formula['description']}\n\n" | |
| f"Get inspired by these examples:\n" | |
| + '\n'.join([f"- {example}" for example in selected_formula['examples']]) + "\n\n" | |
| f"Your goal is to inspire confidence and action, avoiding explanations or categories in the response." |