Spaces:
Sleeping
Sleeping
Update formulas.py
Browse files- formulas.py +0 -128
formulas.py
CHANGED
|
@@ -1,133 +1,5 @@
|
|
| 1 |
-
# The function create_offer_instruction remains unchanged
|
| 2 |
-
# Remove the random import since we no longer need it
|
| 3 |
-
# import random
|
| 4 |
-
|
| 5 |
-
# Import the system prompt from prompts.py
|
| 6 |
from prompts import offer_system_prompt
|
| 7 |
|
| 8 |
-
def create_offer_instruction(avatar_description, product_name, selected_formula_name):
|
| 9 |
-
"""
|
| 10 |
-
Creates instructions for generating an offer based on the selected formula.
|
| 11 |
-
|
| 12 |
-
Args:
|
| 13 |
-
avatar_description: Description of the target audience
|
| 14 |
-
product_name: Name of the product or service
|
| 15 |
-
selected_formula_name: Name of the formula to use ("F贸rmula Sue帽o-Obst谩culo" or "Oferta Dorada")
|
| 16 |
-
|
| 17 |
-
Returns:
|
| 18 |
-
str: Complete instruction for generating the offer
|
| 19 |
-
"""
|
| 20 |
-
# Get the selected formula
|
| 21 |
-
selected_formula = offer_formulas[selected_formula_name]
|
| 22 |
-
|
| 23 |
-
# Add specific instructions for each formula
|
| 24 |
-
additional_instructions = ""
|
| 25 |
-
if selected_formula_name == "F贸rmula Sue帽o-Obst谩culo":
|
| 26 |
-
additional_instructions = """
|
| 27 |
-
SPECIFIC INSTRUCTIONS FOR THIS FORMULA:
|
| 28 |
-
1. PRODUCT/SERVICE NAME HANDLING:
|
| 29 |
-
- If product_name is provided and not empty, use it EXACTLY as written
|
| 30 |
-
- If product_name is empty, generic (like "Producto/Servicio"), or contains placeholders, CREATE a compelling name that:
|
| 31 |
-
* Reflects the target audience's desires and challenges
|
| 32 |
-
* Communicates the main benefit or transformation
|
| 33 |
-
* Sounds professional and memorable
|
| 34 |
-
* Is specific to the niche or industry mentioned in avatar_description
|
| 35 |
-
- If product_name contains a full phrase like "Un curso llamado Ingl茅s sin problemas", extract only the real name ("Ingl茅s sin problemas")
|
| 36 |
-
|
| 37 |
-
2. Analyze ALL available information:
|
| 38 |
-
- Product/service name (product_name variable) or create one if needed
|
| 39 |
-
- Target audience description (avatar_description)
|
| 40 |
-
- Content from uploaded files (if any)
|
| 41 |
-
|
| 42 |
-
3. Determine the most appropriate type (curso, webinar, entrenamiento, etc.) based on:
|
| 43 |
-
- Any type mentioned in product_name
|
| 44 |
-
- The nature of the solution described in avatar_description
|
| 45 |
-
- The most suitable format for the target audience's needs
|
| 46 |
-
|
| 47 |
-
4. Create a comprehensive offer by combining:
|
| 48 |
-
- The appropriate type (determined in step 3)
|
| 49 |
-
- The exact product name (if provided) or your created name (if needed)
|
| 50 |
-
- A compelling dream based on avatar_description
|
| 51 |
-
- A relevant obstacle based on avatar_description
|
| 52 |
-
|
| 53 |
-
5. The dream should be ambitious but believable, incorporating:
|
| 54 |
-
- Target audience desires from avatar_description
|
| 55 |
-
- Explicit goals mentioned in uploaded content (if any)
|
| 56 |
-
|
| 57 |
-
6. The obstacle should reflect:
|
| 58 |
-
- Real problems mentioned in avatar_description
|
| 59 |
-
- Challenges that would normally prevent achieving the dream
|
| 60 |
-
|
| 61 |
-
7. IMPORTANT: Vary the way you start the phrase. Instead of always using "Se trata de un...", use different openings such as:
|
| 62 |
-
- "Presentamos un..."
|
| 63 |
-
- "Te ofrecemos un..."
|
| 64 |
-
- "Descubre nuestro..."
|
| 65 |
-
- "Conoce el..."
|
| 66 |
-
- "Hemos creado un..."
|
| 67 |
-
- "Imagina tener acceso a un..."
|
| 68 |
-
- "Por fin existe un..."
|
| 69 |
-
- "Ahora puedes acceder a un..."
|
| 70 |
-
- "Tenemos para ti un..."
|
| 71 |
-
- "Disfruta de un..."
|
| 72 |
-
"""
|
| 73 |
-
|
| 74 |
-
elif selected_formula_name == "Oferta Dorada":
|
| 75 |
-
additional_instructions = """
|
| 76 |
-
SPECIFIC INSTRUCTIONS FOR THIS FORMULA:
|
| 77 |
-
1. ATTENTION HOOK HANDLING:
|
| 78 |
-
- Analyze the avatar_description DEEPLY to understand their specific pain points, frustrations, and desires
|
| 79 |
-
- Select a powerful attention hook that DIRECTLY connects with the avatar's current reality
|
| 80 |
-
- DO NOT use questions as hooks - use statements, statistics, or shocking revelations instead
|
| 81 |
-
- CUSTOMIZE the hook specifically for this avatar - don't use generic examples
|
| 82 |
-
- The hook MUST address the SAME problem that your promise will solve
|
| 83 |
-
|
| 84 |
-
2. MAINTAIN THEMATIC CONSISTENCY:
|
| 85 |
-
- The attention hook, quantifiable promise, and benefit statement MUST all address the SAME problem
|
| 86 |
-
- Create a LOGICAL PROGRESSION from problem (hook) to solution (promise) to implementation (benefit)
|
| 87 |
-
|
| 88 |
-
3. Create a compelling QUANTIFIABLE PROMISE that:
|
| 89 |
-
- Is written COMPLETELY IN CAPITAL LETTERS
|
| 90 |
-
- Includes concrete numbers (money, time, results)
|
| 91 |
-
- Uses powerful action verbs (EARN, MULTIPLY, ACHIEVE, MASTER)
|
| 92 |
-
- Specifies the exact result they will obtain
|
| 93 |
-
- Optionally includes time or effort required
|
| 94 |
-
- NEVER uses exclamation marks (!)
|
| 95 |
-
- DIRECTLY addresses the same problem mentioned in the hook
|
| 96 |
-
|
| 97 |
-
4. Craft a benefit statement that:
|
| 98 |
-
- Clearly explains the result they will obtain
|
| 99 |
-
- Includes an authority element (proven method, studies, experience)
|
| 100 |
-
- Establishes a realistic timeframe or effort needed
|
| 101 |
-
- CONTINUES the same theme established in the hook and promise
|
| 102 |
-
"""
|
| 103 |
-
|
| 104 |
-
# Create the instruction using the system prompt at the beginning
|
| 105 |
-
instruction = f"""{offer_system_prompt}
|
| 106 |
-
|
| 107 |
-
FORMULA TO USE:
|
| 108 |
-
{selected_formula["description"]}
|
| 109 |
-
|
| 110 |
-
{additional_instructions}
|
| 111 |
-
|
| 112 |
-
PRODUCT/SERVICE:
|
| 113 |
-
{product_name}
|
| 114 |
-
|
| 115 |
-
TARGET AUDIENCE:
|
| 116 |
-
{avatar_description}
|
| 117 |
-
|
| 118 |
-
Create a compelling offer following the formula structure exactly.
|
| 119 |
-
"""
|
| 120 |
-
|
| 121 |
-
# Add examples if available
|
| 122 |
-
if selected_formula.get("examples") and len(selected_formula["examples"]) > 0:
|
| 123 |
-
examples_text = "\n\n".join([f"Example {i+1}:\n{example}" for i, example in enumerate(selected_formula["examples"][:3])])
|
| 124 |
-
instruction += f"\n\nGet inspired by these examples:\n{examples_text}"
|
| 125 |
-
|
| 126 |
-
return instruction
|
| 127 |
-
|
| 128 |
-
# Keep only the offer_formulas dictionary in this file
|
| 129 |
-
|
| 130 |
-
# The offer_formulas dictionary containing formula definitions
|
| 131 |
offer_formulas = {
|
| 132 |
"Oferta Dorada": {
|
| 133 |
"description": """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from prompts import offer_system_prompt
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
offer_formulas = {
|
| 4 |
"Oferta Dorada": {
|
| 5 |
"description": """
|