Spaces:
Sleeping
Sleeping
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" | |
""" | |
def extract_product_name(product_name_input): | |
""" | |
Extracts the actual product name from user input, especially when it's enclosed in quotes. | |
Args: | |
product_name_input: The raw input string containing the product name | |
Returns: | |
str: The extracted product name, or empty string if generic | |
""" | |
import re | |
# If input is empty or None, return empty string | |
if not product_name_input or product_name_input.strip() == "": | |
return "" | |
# Check if there's a name in quotes | |
quote_pattern = r'"([^"]+)"' | |
matches = re.findall(quote_pattern, product_name_input) | |
if matches: | |
# Return the first quoted string found | |
return matches[0] | |
# If no quotes but contains "llamado" or similar phrases, extract what follows | |
called_patterns = [ | |
r'llamado\s+(.+?)(?:\s+que|\s+con|\s+para|\.$|$)', | |
r'titulado\s+(.+?)(?:\s+que|\s+con|\s+para|\.$|$)', | |
r'denominado\s+(.+?)(?:\s+que|\s+con|\s+para|\.$|$)', | |
r'nombrado\s+(.+?)(?:\s+que|\s+con|\s+para|\.$|$)' | |
] | |
for pattern in called_patterns: | |
matches = re.search(pattern, product_name_input, re.IGNORECASE) | |
if matches: | |
extracted = matches.group(1).strip() | |
# If the extracted text has quotes, remove them | |
if extracted.startswith('"') and extracted.endswith('"'): | |
extracted = extracted[1:-1] | |
return extracted | |
# Check if the input is generic (common course/product types without specific names) | |
generic_patterns = [ | |
r'^(curso|taller|programa|webinar|entrenamiento|sistema|método|servicio|producto|aplicación|comunidad|masterclass)(\s+de\s+.+)?$', | |
r'^(un|el|mi|nuestro)\s+(curso|taller|programa|webinar|entrenamiento|sistema|método|servicio|producto|aplicación|comunidad|masterclass)(\s+de\s+.+)?$' | |
] | |
for pattern in generic_patterns: | |
if re.match(pattern, product_name_input.lower(), re.IGNORECASE): | |
# This is a generic description, return empty string to trigger creative name generation | |
return "" | |
# If no patterns match, return the original input | |
return product_name_input.strip() | |
def create_offer_instruction(avatar_description, product_name, selected_formula_name): | |
""" | |
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 ("Fórmula Sueño-Obstáculo" or "Oferta Dorada") | |
Returns: | |
str: Complete instruction for generating the offer | |
""" | |
# Extract the actual product name if it's in quotes or after "llamado" | |
extracted_name = extract_product_name(product_name) | |
# 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: | |
- CRITICAL: If a product name is provided in quotes or after words like "llamado", "titulado", etc., | |
YOU MUST USE THAT EXACT NAME. This is non-negotiable. | |
- The extracted product name is: "{extracted_name}" | |
- If this extracted name is not empty, use it EXACTLY as provided with no modifications | |
- Only create a new name if the extracted name is empty or contains generic placeholders | |
2. Analyze ALL available information: | |
- Product/service name (use the extracted name provided above) | |
- 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 as extracted (if provided) | |
- 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..." | |
""".format(extracted_name=extracted_name) | |
elif selected_formula_name == "Oferta Dorada": | |
additional_instructions = """ | |
SPECIFIC INSTRUCTIONS FOR THIS FORMULA: | |
1. PRODUCT/SERVICE NAME HANDLING: | |
- CRITICAL: If a product name is provided in quotes or after words like "llamado", "titulado", etc., | |
YOU MUST USE THAT EXACT NAME. This is non-negotiable. | |
- The extracted product name is: "{extracted_name}" | |
- If this extracted name is not empty, use it EXACTLY as provided with no modifications | |
- Only create a new name if the extracted name is empty or contains generic placeholders | |
2. FOLLOW THE 6-STEP PROCESS FOR CREATING AN IRRESISTIBLE OFFER: | |
STEP 1: IDENTIFY THE MAIN PROBLEM (ATTENTION HOOK) | |
- Analyze the avatar_description DEEPLY to understand their specific pain points | |
- Create a powerful hook that directly addresses their biggest frustration or anxiety | |
- Use statements that make them think "this person understands my situation exactly" | |
- Focus on the emotional impact of their problem, not just the practical aspects | |
- Use statistics, shocking revelations, direct statements or questions | |
- The hook must create an immediate emotional connection | |
STEP 2: CRAFT A QUANTIFIABLE VALUE PROMISE | |
- Write a promise COMPLETELY IN CAPITAL LETTERS that includes: | |
* Concrete numbers (money, time, results) | |
* Powerful action verbs (EARN, MULTIPLY, ACHIEVE, MASTER) | |
* Specific timeframes (EN 30 DÍAS, EN SOLO 2 SEMANAS) | |
* Clear effort indicators (CON SOLO 15 MINUTOS DIARIOS) | |
- Follow this structure: CÓMO [LOGRAR RESULTADO DESEADO] SIN [OBJECIÓN O CREENCIA LIMITANTE] | |
- NEVER use exclamation marks (!) in this section | |
- Make the promise both ambitious and believable | |
STEP 3: DEMONSTRATE TRUST AND AUTHORITY | |
- Include elements that prove your system works: | |
* Personal results ("Así como he vendido más de $250,000 USD") | |
* Client results ("Mis clientes han vendido más de $5,000,000") | |
* Social proof (testimonials, case studies) | |
- Establish credibility through specific numbers and verifiable claims | |
- Connect your authority directly to the promised result | |
STEP 4: REDUCE DELIVERY TIME | |
- Clearly state how quickly they will see results | |
- Make the timeframe specific and believable | |
- Emphasize speed without sacrificing quality | |
- Use phrases like "en solo X días" or "desde la primera semana" | |
STEP 5: MINIMIZE CLIENT EFFORT | |
- Address the fear of complicated processes | |
- Use phrases like "sin necesidad de...", "solo con...", "sin invertir más tiempo..." | |
- Make the implementation process seem accessible and straightforward | |
- Emphasize results with minimal effort | |
STEP 6: COMBINE ALL ELEMENTS INTO A COHESIVE OFFER | |
- Ensure all elements address the SAME core problem | |
- Create a LOGICAL PROGRESSION from problem to solution to implementation | |
- Maintain thematic consistency throughout the entire offer | |
- Use one of the 5 structure formats for the final benefit statement | |
3. FINAL STRUCTURE FORMAT: | |
Choose one of these more concise formats for the benefit statement: | |
1. "[Feature] para [Benefit] + [prueba social/autoridad] en [tiempo específico]." | |
2. "Con [Feature] lograrás [Benefit] + [prueba social/autoridad] en [tiempo específico]." | |
3. "Gracias a [Feature] conseguirás [Benefit] + [prueba social/autoridad] en [tiempo específico]." | |
4. "Mediante [Feature] alcanzarás [Benefit] + [prueba social/autoridad] en [tiempo específico]." | |
5. "Usando [Feature] obtendrás [Benefit] + [prueba social/autoridad] en [tiempo específico]." | |
IMPORTANT: | |
- Keep this section under 30 words when possible | |
- Focus on ONE primary benefit rather than multiple | |
- Include ONE specific proof element (number, statistic, or result) | |
- Specify exact timeframe (días, semanas, meses) | |
- Eliminate redundant phrases and filler words | |
4. COMPLETE OFFER TEMPLATE: | |
Si [problema principal que enfrenta el cliente]… | |
DESCUBRE CÓMO [LOGRAR RESULTADO DESEADO] SIN [MIEDO, CREENCIA LIMITANTE O ESFUERZO INDESEADO]. | |
[Estructura concisa elegida del punto 3] + [prueba social/autoridad] + [tiempo de entrega] + [esfuerzo mínimo]. | |
""".format(extracted_name=extracted_name) | |
# 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 | |
def generate_complete_offer(avatar_description, product_name, selected_formula_name, include_bonuses=True): | |
""" | |
Generates a complete offer including the main offer and optional bonuses. | |
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 | |
include_bonuses: Whether to include bonuses in the offer | |
Returns: | |
dict: Instructions for generating the complete offer | |
""" | |
# Create main offer instruction | |
main_offer_instruction = create_offer_instruction(avatar_description, product_name, selected_formula_name) | |
# Create bonus instruction if requested | |
bonus_instruction = None | |
if include_bonuses: | |
# Import the bonus generator from the new module | |
from bonuses.generator import create_bonus_instruction | |
bonus_instruction = create_bonus_instruction(avatar_description, product_name, selected_formula_name) | |
return { | |
"main_offer_instruction": main_offer_instruction, | |
"bonus_instruction": bonus_instruction | |
} | |
# The rest of your offer_formulas dictionary remains unchanged | |
offer_formulas = { | |
"Oferta Dorada": { | |
"description": """ | |
Formula: [Attention Hook + QUANTIFIABLE PROMISE IN ALL CAPS + Benefit + Authority + Time or Effort] | |
This formula is designed to speak directly to the avatar, capturing their attention immediately, reflecting their current situation, and showing the transformation they desire. | |
### **How to apply it?** | |
#### 1 **Attention Hook** | |
The first step is to capture the avatar's attention with a powerful hook that can be a shocking revelation, an unexpected question, or a dramatic fact. IMPORTANT: CUSTOMIZE THE HOOK BASED ON THE AVATAR AND THEIR SPECIFIC PROBLEMS. Don't use generic examples, but adapt them to the client's situation. | |
Analyze first: | |
- What is the avatar's biggest pain or frustration? | |
- What are they trying to achieve without success? | |
- What limiting beliefs do they have? | |
--- | |
#### 2 **QUANTIFIABLE PROMISE IN ALL CAPS** | |
This is the most important part. You must create a specific, quantifiable promise written COMPLETELY IN CAPITAL LETTERS that immediately captures attention. It must include: | |
- Concrete numbers (money, time, results) | |
- Powerful action verbs (EARN, MULTIPLY, ACHIEVE, MASTER) | |
- The specific result they will obtain | |
- Optionally, the time or effort required | |
- IMPORTANT: DO NOT USE EXCLAMATION MARKS (!) IN THIS SECTION UNDER ANY CIRCUMSTANCES | |
**Incorrect example:** | |
"Improve your sales with our system." (Vague, no numbers, no impact). | |
"¡MULTIPLY YOUR SALES IN RECORD TIME!" (Uses exclamation marks, NEVER use them). | |
**Correct example:** | |
"FACTURA MAS DE $1.000 USD USANDO 15 EMAILS ESCRITOS EN 15 MINUTOS CADA UNO" (Specific, quantifiable, impactful). | |
"MULTIPLICA POR 3 TUS INTERACCIONES EN REDES SOCIALES EN SOLO 2 SEMANAS" (Clear, measurable, with defined time). | |
--- | |
#### 3 **Benefit + Authority + Time or Effort** | |
In this part, we explain the result they will obtain, supported by an authority factor (proven method, studies, experience, validations) and establishing a time frame or necessary effort to achieve it. | |
**Structure Formats:** | |
1. "[Feature] para que puedas [Benefit] con lo que [Meaning]" | |
2. "Con [Feature] podrás [Benefit] permitiéndote [Meaning]" | |
3. "Gracias a [Feature] lograrás [Benefit] haciendo que [Meaning]" | |
4. "Mediante [Feature] conseguirás [Benefit] lo que significa [Meaning]" | |
5. "Usando [Feature] alcanzarás [Benefit] transformando [Meaning]" | |
**Incorrect example:** | |
"Grow your business with our strategy." (Doesn't say how long it will take or how reliable the strategy is). | |
**Correct examples:** | |
"El Sistema de emails persuasivos para que puedas convertir lectores en clientes con lo que multiplicarás tus ventas en solo 30 días." | |
"Con nuestra metodología de copywriting podrás crear ofertas irresistibles permitiéndote aumentar tu tasa de conversión en un 200% con solo 15 minutos al día." | |
"Gracias a nuestro framework de contenido lograrás posicionarte como autoridad haciendo que tu audiencia te busque a ti en lugar de a tu competencia." | |
"Mediante nuestro sistema de automatización conseguirás generar ventas mientras duermes lo que significa libertad financiera real en menos de 90 días." | |
"Usando nuestra estrategia de redes sociales alcanzarás 10.000 seguidores cualificados transformando tu presencia digital en una máquina de generación de leads." | |
--- | |
### **Fixed structure:** | |
"[Varied Attention Hook] | |
[QUANTIFIABLE PROMISE IN ALL CAPS] | |
[Choose one of the 5 structure formats for Benefit + Authority + Time or Effort]" | |
""", | |
"examples": [ | |
# Example 1 | |
"""Si tus prospectos te preguntan, preguntan y preguntan... y nunca cierras la venta... | |
DESCUBRE CÓMO VENDER CON UNA SOLA LLAMADA PRODUCTOS DE MÁS DE $1,000 USD SIN MANIPULAR, MENTIR O FORZAR LA VENTA. | |
Con nuestro proceso de venta persuasiva podrás convertir objeciones en razones para comprar permitiéndote cerrar el 80% de tus llamadas, así como he vendido más de $250,000 USD solo con el poder de mi voz y una conexión de internet.""", | |
# Example 2 | |
"""Si tu negocio está estancado y cada mes es una lucha para llegar a fin de mes... | |
MULTIPLICA TUS INGRESOS POR 3 EN LOS PRÓXIMOS 90 DÍAS SIN TRABAJAR MÁS HORAS NI CONTRATAR PERSONAL ADICIONAL. | |
Mediante nuestro sistema de optimización de negocios conseguirás identificar y eliminar los 7 bloqueos de crecimiento lo que significa que podrás escalar tu empresa con los recursos que ya tienes, como han hecho más de 327 emprendedores que han pasado de facturar $3,000 a $10,000 mensuales en menos de un trimestre.""", | |
# Example 3 | |
"""Si has intentado perder peso una y otra vez, pero siempre recuperas lo perdido y más... | |
PIERDE ENTRE 5 Y 8 KILOS EN 30 DÍAS SIN DIETAS RESTRICTIVAS, SIN PASAR HAMBRE Y SIN EFECTO REBOTE. | |
Gracias a nuestro método de reprogramación metabólica lograrás activar tu quema de grasa natural haciendo que tu cuerpo se convierta en una máquina de quemar calorías 24/7, avalado por estudios clínicos que demuestran una efectividad del 94% en personas que habían fracasado con más de 5 dietas anteriores.""", | |
# Example 4 | |
"""Si pasas horas creando contenido para redes sociales pero nadie interactúa ni compra... | |
CONSIGUE 100 NUEVOS SEGUIDORES CUALIFICADOS POR SEMANA Y CONVIERTE EL 10% EN CLIENTES PAGANDO CON SOLO 3 PUBLICACIONES SEMANALES. | |
Usando nuestra estrategia de contenido de alto impacto alcanzarás visibilidad exponencial transformando tu presencia en redes en un canal de ventas automático en menos de 30 días, sin necesidad de invertir en publicidad ni pasar 8 horas diarias pegado a tu teléfono.""", | |
# Example 5 | |
"""Si te sientes agotado, sin energía y cada día es una lucha para levantarte de la cama... | |
AUMENTA TU ENERGÍA UN 65% Y RECUPERA 2 HORAS PRODUCTIVAS AL DÍA CON SOLO 15 MINUTOS DE RUTINA MATUTINA. | |
El Sistema de activación bioenergética para que puedas optimizar tu rendimiento físico y mental con lo que multiplicarás tu productividad desde la primera semana, basado en técnicas neurocientíficas utilizadas por los CEOs de las 100 empresas más exitosas del mundo.""" | |
] | |
}, | |
"Fórmula Sueño-Obstáculo": { | |
"description": """ | |
Formula: [Type + Name + Dream + Obstacle] | |
This formula connects directly with the client's desires and concerns: | |
1. Type: The type of solution (training, product, or service) | |
2. Name: The name of your solution | |
3. Dream: The big dream or result that the client wants to achieve | |
4. Obstacle: The obstacle that would normally prevent achieving that dream | |
**Suggested solution types:** | |
- Online course | |
- Webinar | |
- Training | |
- Program | |
- Workshop | |
- Mentorship | |
- Consulting | |
- Membership | |
- System | |
- Method | |
- Service | |
- Product | |
- Application | |
- Community | |
- Masterclass | |
**Suggested opening variations:** | |
- "Se trata de un..." | |
- "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..." | |
**Structure Format (Classic example):** | |
"Se trata de un (training, product or service) llamado ("name of your solution") que te va a permitir (big dream) aún y cuando (big obstacle)" | |
""", | |
"examples": [ | |
# Example 1 - Sales Training | |
"""Se trata de mi exclusivo entrenamiento llamado "Venta Express 3.0" con el que te convertirás en todo un Rockstar de las ventas con el que conectarás con tus clientes para inspirarlos al cierre de una forma fácil y divertida aún y cuando sea la primera vez que escuchen de ti.""", | |
# Example 2 - Fitness Program | |
"""Presentamos un programa de transformación física llamado "Metabolismo Activado" que te permitirá perder hasta 10 kilos en 8 semanas aún y cuando hayas intentado todas las dietas sin éxito.""", | |
# Example 3 - Digital Marketing | |
"""Descubre nuestro sistema de marketing digital llamado "Tráfico Convertidor" que te ayudará a multiplicar tus ventas online sin necesidad de gastar fortunas en publicidad aún y cuando no tengas experiencia previa en marketing.""", | |
# Example 4 - Personal Finance | |
"""Tenemos para ti un método financiero llamado "Libertad Financiera Acelerada" que te permitirá generar ingresos pasivos y construir patrimonio aún y cuando partas desde cero o tengas deudas actualmente.""", | |
# Example 5 - Language Learning | |
"""Imagina tener acceso a un curso de idiomas llamado "Inglés Sin Barreras Pro" con el que dominarás el inglés conversacional en solo 90 días aún y cuando hayas fracasado con métodos tradicionales en el pasado.""", | |
# Example 6 - Productivity | |
"""Hemos creado un workshop intensivo llamado "Productividad Imparable" que te enseñará a duplicar tus resultados trabajando menos horas aún y cuando tengas una agenda completamente saturada.""", | |
# Example 7 - Relationships | |
"""Por fin existe un programa de coaching llamado "Conexiones Profundas" que te ayudará a encontrar y mantener relaciones saludables y satisfactorias aún y cuando hayas tenido experiencias dolorosas en el pasado.""" | |
] | |
} | |
} |