Spaces:
Sleeping
Sleeping
File size: 4,625 Bytes
0943fed 520c50f 0943fed bf165e3 0943fed bf165e3 0943fed bf165e3 81df141 bf165e3 e74b643 26ce1d0 81df141 e74b643 520c50f e74b643 bf165e3 81df141 4362780 0625c7b 40b0916 0943fed bf165e3 81df141 bf165e3 b53d55e bf165e3 26ce1d0 c3badaa bf165e3 40b0916 bf165e3 520c50f e74b643 369b989 e74b643 0943fed |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 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 |
from formulas import offer_formulas
from sophistication.generator import create_sophistication_instruction
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"
- Do not use any special formatting, markdown, or HTML tags
- Do not add any characters that could trigger text box formatting
"""
def create_offer_instruction(target_audience=None, product_service=None, selected_formula_name=None, file_content=None, skills=None, sophistication_level=None):
"""
Creates the instruction for generating an offer based on the selected formula.
Args:
target_audience: Description of the target audience
product_service: Product/service information
selected_formula_name: Name of the selected formula
file_content: Content from uploaded files (if any)
skills: User's skills and expertise
sophistication_level: String key for the market sophistication level
Returns:
str: The complete instruction for generating the offer
"""
# Get the selected formula
selected_formula = offer_formulas[selected_formula_name]
# Get formula-specific instructions (fixed the get method usage)
additional_instructions = selected_formula.get("instructions", "")
# Create the base instruction
instruction = f"""{offer_system_prompt}
FORMULA TO USE:
{selected_formula["description"]}
{additional_instructions}
PRODUCT/SERVICE:
{product_service}
TARGET AUDIENCE:
{target_audience}
ADDITIONAL INFORMATION:
{file_content}
Create a compelling offer following the formula structure exactly, adapting it to the sophistication level provided.
"""
# 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"])])
instruction += f"\n\nGet inspired by these examples:\n{examples_text}"
# Add sophistication level guidance using the dedicated function
if sophistication_level:
# Get basic sophistication guidance
base_sophistication_guidance = create_sophistication_instruction(sophistication_level)
# Add formula-specific sophistication guidance
formula_specific_guidance = ""
# Apply conditional logic based on formula name
if selected_formula_name == "Oferta Dorada":
formula_specific_guidance = f"\n\nFor the Oferta Dorada formula specifically:\n- Gancho: Create a hook that matches {sophistication_level} awareness level. For higher sophistication, use more specific data or challenge established beliefs.\n- Promesa: Craft a promise that addresses the skepticism level of this market. For higher sophistication, focus on unique mechanisms or emotional transformation.\n- Beneficio con Autoridad: Provide proof elements appropriate for this sophistication level. For higher sophistication, include more specific data, studies, or transparent evidence."
elif selected_formula_name == "Fórmula Sueño-Obstáculo":
formula_specific_guidance = f"\n\nFor the Fórmula Sueño-Obstáculo specifically:\n- Type: Select a solution type that resonates with {sophistication_level} markets.\n- Dream: For higher sophistication levels, make the dream more specific and emotionally resonant rather than generic.\n- Obstacle: For higher sophistication, address more complex or specific obstacles that show deep understanding of the market's challenges."
# Add more conditionals for other formulas as they are added to the system
# Combine the base guidance with formula-specific guidance
instruction += f"\n\nMARKET SOPHISTICATION GUIDANCE:\n{base_sophistication_guidance}{formula_specific_guidance}\n\nEnsure the entire offer maintains consistency with this sophistication level while following the formula structure."
return instruction |