Spaces:
Sleeping
Sleeping
Update formulas.py
Browse files- formulas.py +24 -24
formulas.py
CHANGED
@@ -3,6 +3,22 @@
|
|
3 |
# import random
|
4 |
|
5 |
# Add this function at the beginning of the file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
def create_offer_instruction(avatar_description, product_name, selected_formula_name):
|
7 |
"""
|
8 |
Creates instructions for generating an offer based on the selected formula.
|
@@ -18,10 +34,6 @@ def create_offer_instruction(avatar_description, product_name, selected_formula_
|
|
18 |
# Get the selected formula
|
19 |
selected_formula = offer_formulas[selected_formula_name]
|
20 |
|
21 |
-
# No longer need random examples logic
|
22 |
-
# Instead, we'll just set examples_text to an empty string
|
23 |
-
examples_text = ""
|
24 |
-
|
25 |
# Add specific instructions for each formula
|
26 |
additional_instructions = ""
|
27 |
if selected_formula_name == "F贸rmula Sue帽o-Obst谩culo":
|
@@ -71,12 +83,6 @@ SPECIFIC INSTRUCTIONS FOR THIS FORMULA:
|
|
71 |
- "Ahora puedes acceder a un..."
|
72 |
- "Tenemos para ti un..."
|
73 |
- "Disfruta de un..."
|
74 |
-
|
75 |
-
8. CRITICAL: Output ONLY the offer itself with NO introductory text, explanations, or additional commentary.
|
76 |
-
- DO NOT include phrases like "Aqu铆 tienes una oferta convincente" or "Esta es tu oferta"
|
77 |
-
- DO NOT include any text before or after the offer
|
78 |
-
- Start directly with one of the opening phrases from point 7
|
79 |
-
- The entire response should be ONLY the offer itself
|
80 |
"""
|
81 |
|
82 |
elif selected_formula_name == "Oferta Dorada":
|
@@ -117,21 +123,10 @@ SPECIFIC INSTRUCTIONS FOR THIS FORMULA:
|
|
117 |
- Includes an authority element (proven method, studies, experience)
|
118 |
- Establishes a realistic timeframe or effort needed
|
119 |
- CONTINUES the same theme established in the hook and promise
|
120 |
-
|
121 |
-
5. CRITICAL: Output ONLY the offer itself with NO introductory text, explanations, or additional commentary.
|
122 |
-
- Start directly with the attention hook
|
123 |
-
- The entire response should be ONLY the offer itself following the formula structure
|
124 |
"""
|
125 |
|
126 |
-
# Create the instruction
|
127 |
-
instruction = f"""
|
128 |
-
You are a world-class expert copywriter, experienced in creating compelling offers that connect emotionally with the target audience.
|
129 |
-
|
130 |
-
OBJECTIVE:
|
131 |
-
- Generate a convincing offer in Spanish using the {selected_formula_name}
|
132 |
-
- Connect emotionally with the audience: {avatar_description}
|
133 |
-
- Address real desires, problems, and motivations
|
134 |
-
- Maintain natural and conversational language
|
135 |
|
136 |
FORMULA TO USE:
|
137 |
{selected_formula["description"]}
|
@@ -147,9 +142,14 @@ TARGET AUDIENCE:
|
|
147 |
Create a compelling offer following the formula structure exactly.
|
148 |
"""
|
149 |
|
|
|
|
|
|
|
|
|
|
|
150 |
return instruction
|
151 |
|
152 |
-
# The rest of your offer_formulas dictionary
|
153 |
offer_formulas = {
|
154 |
"Oferta Dorada": {
|
155 |
"description": """
|
|
|
3 |
# import random
|
4 |
|
5 |
# Add this function at the beginning of the file
|
6 |
+
# Define a single system prompt at the top of the file
|
7 |
+
offer_system_prompt = """You are a world-class expert copywriter, experienced in creating compelling offers that connect emotionally with the target audience.
|
8 |
+
|
9 |
+
OBJECTIVE:
|
10 |
+
- Generate a convincing offer in Spanish
|
11 |
+
- Connect emotionally with the audience
|
12 |
+
- Address real desires, problems, and motivations
|
13 |
+
- Maintain natural and conversational language
|
14 |
+
|
15 |
+
CRITICAL OUTPUT RULES:
|
16 |
+
- Output ONLY the offer itself with NO introductory text, explanations, or additional commentary
|
17 |
+
- Start directly with the attention hook or opening phrase
|
18 |
+
- The entire response should be ONLY the offer itself following the formula structure
|
19 |
+
- Do not include phrases like "Aqu铆 tienes una oferta convincente" or "Esta es tu oferta"
|
20 |
+
"""
|
21 |
+
|
22 |
def create_offer_instruction(avatar_description, product_name, selected_formula_name):
|
23 |
"""
|
24 |
Creates instructions for generating an offer based on the selected formula.
|
|
|
34 |
# Get the selected formula
|
35 |
selected_formula = offer_formulas[selected_formula_name]
|
36 |
|
|
|
|
|
|
|
|
|
37 |
# Add specific instructions for each formula
|
38 |
additional_instructions = ""
|
39 |
if selected_formula_name == "F贸rmula Sue帽o-Obst谩culo":
|
|
|
83 |
- "Ahora puedes acceder a un..."
|
84 |
- "Tenemos para ti un..."
|
85 |
- "Disfruta de un..."
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
"""
|
87 |
|
88 |
elif selected_formula_name == "Oferta Dorada":
|
|
|
123 |
- Includes an authority element (proven method, studies, experience)
|
124 |
- Establishes a realistic timeframe or effort needed
|
125 |
- CONTINUES the same theme established in the hook and promise
|
|
|
|
|
|
|
|
|
126 |
"""
|
127 |
|
128 |
+
# Create the instruction using the system prompt at the beginning
|
129 |
+
instruction = f"""{offer_system_prompt}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
FORMULA TO USE:
|
132 |
{selected_formula["description"]}
|
|
|
142 |
Create a compelling offer following the formula structure exactly.
|
143 |
"""
|
144 |
|
145 |
+
# Add examples if available
|
146 |
+
if selected_formula.get("examples") and len(selected_formula["examples"]) > 0:
|
147 |
+
examples_text = "\n\n".join([f"Example {i+1}:\n{example}" for i, example in enumerate(selected_formula["examples"][:3])])
|
148 |
+
instruction += f"\n\nGet inspired by these examples:\n{examples_text}"
|
149 |
+
|
150 |
return instruction
|
151 |
|
152 |
+
# The rest of your offer_formulas dictionary remains unchanged
|
153 |
offer_formulas = {
|
154 |
"Oferta Dorada": {
|
155 |
"description": """
|