Spaces:
Sleeping
Sleeping
Upload 6 files
Browse files- formulas.py +80 -2
- prompts.py +109 -187
formulas.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
from prompts import offer_system_prompt
|
2 |
|
|
|
|
|
|
|
3 |
offer_formulas = {
|
4 |
"Oferta Dorada": {
|
5 |
"description": """
|
@@ -94,7 +97,35 @@ In this part, we explain the result they will obtain, supported by an authority
|
|
94 |
CONSIGUE 100 NUEVOS SEGUIDORES CUALIFICADOS POR SEMANA Y CONVIERTE EL 10% EN LEADS INTERESADOS EN TUS SERVICIOS.
|
95 |
|
96 |
Usando nuestra estrategia de contenido viral alcanzarás visibilidad exponencial transformando tu presencia en redes en un canal de captación automático en menos de 30 días."""
|
97 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
},
|
99 |
"Fórmula Sueño-Obstáculo": {
|
100 |
"description": """
|
@@ -144,6 +175,53 @@ This formula connects directly with the client's desires and concerns:
|
|
144 |
"Se trata de un entrenamiento llamado \"Método Flujo Creativo\" que te va a permitir escribir contenido de alto impacto todos los días aún y cuando creas que no tienes talento para la escritura.",
|
145 |
"Se trata de un servicio llamado \"Transformación Financiera Total\" que te va a permitir duplicar tus ingresos en 90 días aún y cuando ahora mismo estés endeudado hasta el cuello.",
|
146 |
"Se trata de un producto llamado \"Sistema de Meditación Rápida\" que te va a permitir alcanzar estados profundos de calma en solo 5 minutos aún y cuando tengas una mente hiperactiva que no para de pensar."
|
147 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
149 |
}
|
|
|
1 |
from prompts import offer_system_prompt
|
2 |
|
3 |
+
# Keep only the offer_formulas dictionary in this file
|
4 |
+
|
5 |
+
# The offer_formulas dictionary containing formula definitions
|
6 |
offer_formulas = {
|
7 |
"Oferta Dorada": {
|
8 |
"description": """
|
|
|
97 |
CONSIGUE 100 NUEVOS SEGUIDORES CUALIFICADOS POR SEMANA Y CONVIERTE EL 10% EN LEADS INTERESADOS EN TUS SERVICIOS.
|
98 |
|
99 |
Usando nuestra estrategia de contenido viral alcanzarás visibilidad exponencial transformando tu presencia en redes en un canal de captación automático en menos de 30 días."""
|
100 |
+
],
|
101 |
+
"custom_instructions": """
|
102 |
+
SPECIFIC INSTRUCTIONS FOR THIS FORMULA:
|
103 |
+
1. ATTENTION HOOK HANDLING:
|
104 |
+
- Analyze the avatar_description DEEPLY to understand their specific pain points, frustrations, and desires
|
105 |
+
- Select a powerful attention hook that DIRECTLY connects with the avatar's current reality
|
106 |
+
- Use statements, statistics, or shocking revelations, questions as hooks
|
107 |
+
- CUSTOMIZE the hook specifically for this avatar - don't use generic examples
|
108 |
+
- The hook MUST address the SAME problem that your promise will solve
|
109 |
+
|
110 |
+
2. MAINTAIN THEMATIC CONSISTENCY:
|
111 |
+
- The attention hook, quantifiable promise, and benefit statement MUST all address the SAME problem
|
112 |
+
- Create a LOGICAL PROGRESSION from problem (hook) to solution (promise) to implementation (benefit)
|
113 |
+
|
114 |
+
3. Create a compelling QUANTIFIABLE PROMISE that:
|
115 |
+
- Is written COMPLETELY IN CAPITAL LETTERS
|
116 |
+
- Includes concrete numbers (money, time, results)
|
117 |
+
- Uses powerful action verbs (EARN, MULTIPLY, ACHIEVE, MASTER)
|
118 |
+
- Specifies the exact result they will obtain
|
119 |
+
- Optionally includes time or effort required
|
120 |
+
- NEVER uses exclamation marks (!)
|
121 |
+
- DIRECTLY addresses the same problem mentioned in the hook
|
122 |
+
|
123 |
+
4. Craft a benefit statement that:
|
124 |
+
- Clearly explains the result they will obtain
|
125 |
+
- Includes an authority element (proven method, studies, experience)
|
126 |
+
- Establishes a realistic timeframe or effort needed
|
127 |
+
- CONTINUES the same theme established in the hook and promise
|
128 |
+
"""
|
129 |
},
|
130 |
"Fórmula Sueño-Obstáculo": {
|
131 |
"description": """
|
|
|
175 |
"Se trata de un entrenamiento llamado \"Método Flujo Creativo\" que te va a permitir escribir contenido de alto impacto todos los días aún y cuando creas que no tienes talento para la escritura.",
|
176 |
"Se trata de un servicio llamado \"Transformación Financiera Total\" que te va a permitir duplicar tus ingresos en 90 días aún y cuando ahora mismo estés endeudado hasta el cuello.",
|
177 |
"Se trata de un producto llamado \"Sistema de Meditación Rápida\" que te va a permitir alcanzar estados profundos de calma en solo 5 minutos aún y cuando tengas una mente hiperactiva que no para de pensar."
|
178 |
+
],
|
179 |
+
"custom_instructions": """
|
180 |
+
SPECIFIC INSTRUCTIONS FOR THIS FORMULA:
|
181 |
+
1. PRODUCT/SERVICE NAME HANDLING:
|
182 |
+
- If product_name is provided and not empty, use it EXACTLY as written
|
183 |
+
- If product_name is empty, generic (like "Producto/Servicio"), or contains placeholders, CREATE a compelling name that:
|
184 |
+
* Reflects the target audience's desires and challenges
|
185 |
+
* Communicates the main benefit or transformation
|
186 |
+
* Sounds professional and memorable
|
187 |
+
* Is specific to the niche or industry mentioned in avatar_description
|
188 |
+
- If product_name contains a full phrase like "Un curso llamado Inglés sin problemas", extract only the real name ("Inglés sin problemas")
|
189 |
+
|
190 |
+
2. Analyze ALL available information:
|
191 |
+
- Product/service name (product_name variable) or create one if needed
|
192 |
+
- Target audience description (avatar_description)
|
193 |
+
- Content from uploaded files (if any)
|
194 |
+
|
195 |
+
3. Determine the most appropriate type (curso, webinar, entrenamiento, etc.) based on:
|
196 |
+
- Any type mentioned in product_name
|
197 |
+
- The nature of the solution described in avatar_description
|
198 |
+
- The most suitable format for the target audience's needs
|
199 |
+
|
200 |
+
4. Create a comprehensive offer by combining:
|
201 |
+
- The appropriate type (determined in step 3)
|
202 |
+
- The exact product name (if provided) or your created name (if needed)
|
203 |
+
- A compelling dream based on avatar_description
|
204 |
+
- A relevant obstacle based on avatar_description
|
205 |
+
|
206 |
+
5. The dream should be ambitious but believable, incorporating:
|
207 |
+
- Target audience desires from avatar_description
|
208 |
+
- Explicit goals mentioned in uploaded content (if any)
|
209 |
+
|
210 |
+
6. The obstacle should reflect:
|
211 |
+
- Real problems mentioned in avatar_description
|
212 |
+
- Challenges that would normally prevent achieving the dream
|
213 |
+
|
214 |
+
7. IMPORTANT: Vary the way you start the phrase. Instead of always using "Se trata de un...", use different openings such as:
|
215 |
+
- "Presentamos un..."
|
216 |
+
- "Te ofrecemos un..."
|
217 |
+
- "Descubre nuestro..."
|
218 |
+
- "Conoce el..."
|
219 |
+
- "Hemos creado un..."
|
220 |
+
- "Imagina tener acceso a un..."
|
221 |
+
- "Por fin existe un..."
|
222 |
+
- "Ahora puedes acceder a un..."
|
223 |
+
- "Tenemos para ti un..."
|
224 |
+
- "Disfruta de un..."
|
225 |
+
"""
|
226 |
}
|
227 |
}
|
prompts.py
CHANGED
@@ -1,188 +1,110 @@
|
|
1 |
-
offer_system_prompt = """You are a world-class expert copywriter, experienced in creating compelling offers that connect emotionally with the target audience.
|
2 |
-
|
3 |
-
OBJECTIVE:
|
4 |
-
- Generate a convincing offer in Spanish
|
5 |
-
- Connect emotionally with the audience
|
6 |
-
- Address real desires, problems, and motivations
|
7 |
-
- Maintain natural and conversational language
|
8 |
-
|
9 |
-
CRITICAL OUTPUT RULES:
|
10 |
-
- Output ONLY the offer itself with NO introductory text, explanations, or additional commentary
|
11 |
-
- Start directly with the attention hook or opening phrase
|
12 |
-
- The entire response should be ONLY the offer itself following the formula structure
|
13 |
-
- Do not include phrases like "Aquí tienes una oferta convincente" or "Esta es tu oferta"
|
14 |
-
"""
|
15 |
-
|
16 |
-
def create_offer_instruction(avatar_description, product_name, selected_formula_name, offer_formulas=None):
|
17 |
-
"""
|
18 |
-
Creates instructions for generating an offer based on the selected formula.
|
19 |
-
|
20 |
-
Args:
|
21 |
-
avatar_description: Description of the target audience
|
22 |
-
product_name: Name of the product or service
|
23 |
-
selected_formula_name: Name of the formula to use
|
24 |
-
offer_formulas: Dictionary containing the formulas (passed from app.py)
|
25 |
-
|
26 |
-
Returns:
|
27 |
-
str: Complete instruction for generating the offer
|
28 |
-
"""
|
29 |
-
# Get the selected formula
|
30 |
-
selected_formula = offer_formulas[selected_formula_name]
|
31 |
-
|
32 |
-
#
|
33 |
-
additional_instructions = ""
|
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 |
-
- CONTINUES the same theme established in the hook and promise
|
111 |
-
"""
|
112 |
-
|
113 |
-
# Create the instruction using the system prompt at the beginning
|
114 |
-
instruction = f"""{offer_system_prompt}
|
115 |
-
|
116 |
-
FORMULA TO USE:
|
117 |
-
{selected_formula["description"]}
|
118 |
-
|
119 |
-
{additional_instructions}
|
120 |
-
|
121 |
-
PRODUCT/SERVICE:
|
122 |
-
{product_name}
|
123 |
-
|
124 |
-
TARGET AUDIENCE:
|
125 |
-
{avatar_description}
|
126 |
-
|
127 |
-
Create a compelling offer following the formula structure exactly.
|
128 |
-
"""
|
129 |
-
|
130 |
-
# Add examples if available
|
131 |
-
if selected_formula.get("examples") and len(selected_formula["examples"]) > 0:
|
132 |
-
examples_text = "\n\n".join([f"Example {i+1}:\n{example}" for i, example in enumerate(selected_formula["examples"][:3])])
|
133 |
-
instruction += f"\n\nGet inspired by these examples:\n{examples_text}"
|
134 |
-
|
135 |
-
return instruction
|
136 |
-
|
137 |
-
# System prompt for promises generation (updated from benefits)
|
138 |
-
system_prompt = """You are a world-class expert copywriter, experienced in creating compelling promises that emotionally connect and address the desires, problems, and motivations of the target audience.
|
139 |
-
|
140 |
-
OBJECTIVE:
|
141 |
-
- Generate convincing and specific promise statements in Spanish
|
142 |
-
- Connect emotionally with the audience
|
143 |
-
- Address real desires, problems, and motivations
|
144 |
-
- Maintain natural and conversational language
|
145 |
-
- Orient each promise towards transformation and results
|
146 |
-
|
147 |
-
FORMAT RULES:
|
148 |
-
- One promise per line
|
149 |
-
- No numbers at the beginning
|
150 |
-
- No explanations or categories
|
151 |
-
- Add a line break between each promise
|
152 |
-
- Never include : symbols in promises
|
153 |
-
- Each promise must be a complete and concise phrase
|
154 |
-
|
155 |
-
PROMISE STRUCTURE:
|
156 |
-
- Must be relevant to target audience
|
157 |
-
- Must show a specific, measurable result
|
158 |
-
- Must include an emotional element
|
159 |
-
- Must eliminate an objection or pain point
|
160 |
-
- Must inspire immediate action or belief
|
161 |
-
|
162 |
-
IMPORTANT:
|
163 |
-
- Each promise must be unique, specific and believable
|
164 |
-
- Avoid repetitions and generalities
|
165 |
-
- Maintain a persuasive but honest tone
|
166 |
-
- Adapt language to audience comprehension level
|
167 |
-
- Focus on tangible and measurable results
|
168 |
-
"""
|
169 |
-
|
170 |
-
def create_instruction(number_of_benefits, target_audience, product, selected_formula, selected_angle):
|
171 |
-
angle_instruction = ""
|
172 |
-
if selected_angle["description"] != "Generate the bullet without any specific angle":
|
173 |
-
angle_instruction = f"\nApply this angle: {selected_angle['description']}\nStyle: {selected_angle['style']}\nUse these keywords as inspiration: {', '.join(selected_angle['keywords'])}"
|
174 |
-
|
175 |
-
return (
|
176 |
-
f"{system_prompt}\n\n"
|
177 |
-
f"Your task is to create {number_of_benefits} irresistible promises designed for {target_audience}. "
|
178 |
-
f"The goal is to show how {product} will transform the reader's life, connecting naturally and emotionally. "
|
179 |
-
f"Avoid using literal or repetitive mentions, and highlight concrete results, showing how the product delivers specific outcomes or satisfies real desires. "
|
180 |
-
f"{angle_instruction}\n"
|
181 |
-
f"IMPORTANT: Keep promises clear, specific and credible. "
|
182 |
-
f"Use the selected formula as a guide:\n\n{selected_formula['description']}\n\n"
|
183 |
-
f"Get inspired by these examples:\n"
|
184 |
-
f"- {selected_formula['examples'][0]}\n"
|
185 |
-
f"- {selected_formula['examples'][1]}\n"
|
186 |
-
f"- {selected_formula['examples'][2]}\n\n"
|
187 |
-
f"Your goal is to inspire confidence and action, avoiding explanations or categories in the response."
|
188 |
)
|
|
|
1 |
+
offer_system_prompt = """You are a world-class expert copywriter, experienced in creating compelling offers that connect emotionally with the target audience.
|
2 |
+
|
3 |
+
OBJECTIVE:
|
4 |
+
- Generate a convincing offer in Spanish
|
5 |
+
- Connect emotionally with the audience
|
6 |
+
- Address real desires, problems, and motivations
|
7 |
+
- Maintain natural and conversational language
|
8 |
+
|
9 |
+
CRITICAL OUTPUT RULES:
|
10 |
+
- Output ONLY the offer itself with NO introductory text, explanations, or additional commentary
|
11 |
+
- Start directly with the attention hook or opening phrase
|
12 |
+
- The entire response should be ONLY the offer itself following the formula structure
|
13 |
+
- Do not include phrases like "Aquí tienes una oferta convincente" or "Esta es tu oferta"
|
14 |
+
"""
|
15 |
+
|
16 |
+
def create_offer_instruction(avatar_description, product_name, selected_formula_name, offer_formulas=None):
|
17 |
+
"""
|
18 |
+
Creates instructions for generating an offer based on the selected formula.
|
19 |
+
|
20 |
+
Args:
|
21 |
+
avatar_description: Description of the target audience
|
22 |
+
product_name: Name of the product or service
|
23 |
+
selected_formula_name: Name of the formula to use
|
24 |
+
offer_formulas: Dictionary containing the formulas (passed from app.py)
|
25 |
+
|
26 |
+
Returns:
|
27 |
+
str: Complete instruction for generating the offer
|
28 |
+
"""
|
29 |
+
# Get the selected formula
|
30 |
+
selected_formula = offer_formulas[selected_formula_name]
|
31 |
+
|
32 |
+
# Get custom instructions from the formula dictionary
|
33 |
+
additional_instructions = selected_formula.get("custom_instructions", "")
|
34 |
+
|
35 |
+
# Create the instruction using the system prompt at the beginning
|
36 |
+
instruction = f"""{offer_system_prompt}
|
37 |
+
|
38 |
+
FORMULA TO USE:
|
39 |
+
{selected_formula["description"]}
|
40 |
+
|
41 |
+
{additional_instructions}
|
42 |
+
|
43 |
+
PRODUCT/SERVICE:
|
44 |
+
{product_name}
|
45 |
+
|
46 |
+
TARGET AUDIENCE:
|
47 |
+
{avatar_description}
|
48 |
+
|
49 |
+
Create a compelling offer following the formula structure exactly.
|
50 |
+
"""
|
51 |
+
|
52 |
+
# Add examples if available
|
53 |
+
if selected_formula.get("examples") and len(selected_formula["examples"]) > 0:
|
54 |
+
examples_text = "\n\n".join([f"Example {i+1}:\n{example}" for i, example in enumerate(selected_formula["examples"][:3])])
|
55 |
+
instruction += f"\n\nGet inspired by these examples:\n{examples_text}"
|
56 |
+
|
57 |
+
return instruction
|
58 |
+
|
59 |
+
# System prompt for promises generation (updated from benefits)
|
60 |
+
system_prompt = """You are a world-class expert copywriter, experienced in creating compelling promises that emotionally connect and address the desires, problems, and motivations of the target audience.
|
61 |
+
|
62 |
+
OBJECTIVE:
|
63 |
+
- Generate convincing and specific promise statements in Spanish
|
64 |
+
- Connect emotionally with the audience
|
65 |
+
- Address real desires, problems, and motivations
|
66 |
+
- Maintain natural and conversational language
|
67 |
+
- Orient each promise towards transformation and results
|
68 |
+
|
69 |
+
FORMAT RULES:
|
70 |
+
- One promise per line
|
71 |
+
- No numbers at the beginning
|
72 |
+
- No explanations or categories
|
73 |
+
- Add a line break between each promise
|
74 |
+
- Never include : symbols in promises
|
75 |
+
- Each promise must be a complete and concise phrase
|
76 |
+
|
77 |
+
PROMISE STRUCTURE:
|
78 |
+
- Must be relevant to target audience
|
79 |
+
- Must show a specific, measurable result
|
80 |
+
- Must include an emotional element
|
81 |
+
- Must eliminate an objection or pain point
|
82 |
+
- Must inspire immediate action or belief
|
83 |
+
|
84 |
+
IMPORTANT:
|
85 |
+
- Each promise must be unique, specific and believable
|
86 |
+
- Avoid repetitions and generalities
|
87 |
+
- Maintain a persuasive but honest tone
|
88 |
+
- Adapt language to audience comprehension level
|
89 |
+
- Focus on tangible and measurable results
|
90 |
+
"""
|
91 |
+
|
92 |
+
def create_instruction(number_of_benefits, target_audience, product, selected_formula, selected_angle):
|
93 |
+
angle_instruction = ""
|
94 |
+
if selected_angle["description"] != "Generate the bullet without any specific angle":
|
95 |
+
angle_instruction = f"\nApply this angle: {selected_angle['description']}\nStyle: {selected_angle['style']}\nUse these keywords as inspiration: {', '.join(selected_angle['keywords'])}"
|
96 |
+
|
97 |
+
return (
|
98 |
+
f"{system_prompt}\n\n"
|
99 |
+
f"Your task is to create {number_of_benefits} irresistible promises designed for {target_audience}. "
|
100 |
+
f"The goal is to show how {product} will transform the reader's life, connecting naturally and emotionally. "
|
101 |
+
f"Avoid using literal or repetitive mentions, and highlight concrete results, showing how the product delivers specific outcomes or satisfies real desires. "
|
102 |
+
f"{angle_instruction}\n"
|
103 |
+
f"IMPORTANT: Keep promises clear, specific and credible. "
|
104 |
+
f"Use the selected formula as a guide:\n\n{selected_formula['description']}\n\n"
|
105 |
+
f"Get inspired by these examples:\n"
|
106 |
+
f"- {selected_formula['examples'][0]}\n"
|
107 |
+
f"- {selected_formula['examples'][1]}\n"
|
108 |
+
f"- {selected_formula['examples'][2]}\n\n"
|
109 |
+
f"Your goal is to inspire confidence and action, avoiding explanations or categories in the response."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
)
|