File size: 10,059 Bytes
1ddc35b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c7c2115
 
42713d1
c7c2115
42713d1
 
 
 
 
 
c7c2115
 
42713d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1ddc35b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# 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."
    )