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