Prompts shortened
Browse files- app/ads1/budget_optimizer.py +4 -21
- app/ads1/growth_finder.py +4 -19
- app/ads1/keyword_inspector.py +5 -18
- app/ads1/search_term_optimizer.py +1 -9
app/ads1/budget_optimizer.py
CHANGED
|
@@ -41,27 +41,10 @@ def build_budget_optimizer_prompt(context: dict) -> str:
|
|
| 41 |
name = context.get("campaign_name", "this account")
|
| 42 |
|
| 43 |
return (
|
| 44 |
-
f""
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
Identify 3–5 budget allocation actions for the campaign {name}.
|
| 49 |
-
|
| 50 |
-
STRICT RULES:
|
| 51 |
-
- Use only provided data.
|
| 52 |
-
- Do not explain categories (no "keywords/ad groups...")
|
| 53 |
-
- No repetition of headings or prompt structure.
|
| 54 |
-
- Avoid generic advice.
|
| 55 |
-
|
| 56 |
-
OUTPUT FORMAT:
|
| 57 |
-
- Action: <what to change in budget>
|
| 58 |
-
Evidence: <metrics>
|
| 59 |
-
Expected impact: <why it helps>
|
| 60 |
-
|
| 61 |
-
DATA:
|
| 62 |
-
{payload}
|
| 63 |
-
"""
|
| 64 |
-
)
|
| 65 |
|
| 66 |
|
| 67 |
def run_budget_optimizer(dfs: dict, campaign_name: str | None = None) -> str:
|
|
|
|
| 41 |
name = context.get("campaign_name", "this account")
|
| 42 |
|
| 43 |
return (
|
| 44 |
+
f"Write 3 to 5 bullet points of actionable Budget optimization insights for {name}.\n"
|
| 45 |
+
"Use simple language. One insight per bullet. Start each line with '- '. No intro sentence.\n\n"
|
| 46 |
+
f"Data (JSON):\n{payload}"
|
| 47 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
|
| 50 |
def run_budget_optimizer(dfs: dict, campaign_name: str | None = None) -> str:
|
app/ads1/growth_finder.py
CHANGED
|
@@ -41,25 +41,10 @@ def build_growth_finder_prompt(context: dict) -> str:
|
|
| 41 |
name = context.get("campaign_name", "this account")
|
| 42 |
|
| 43 |
return (
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
Identify ONLY data-backed scaling opportunities.
|
| 49 |
-
|
| 50 |
-
STRICT RULES:
|
| 51 |
-
- If performance is weak, DO NOT suggest scaling.
|
| 52 |
-
- Do not infer missing ad groups or structures.
|
| 53 |
-
- No generic marketing theory.
|
| 54 |
-
|
| 55 |
-
OUTPUT FORMAT:
|
| 56 |
-
- Opportunity: <keyword / segment>
|
| 57 |
-
Evidence: <CTR, conversions, CPA>
|
| 58 |
-
Why it works: <short justification>
|
| 59 |
-
Action: <scale suggestion (budget / bids / match type expansion)>
|
| 60 |
-
|
| 61 |
-
DATA:
|
| 62 |
-
{payload}
|
| 63 |
"""
|
| 64 |
)
|
| 65 |
|
|
|
|
| 41 |
name = context.get("campaign_name", "this account")
|
| 42 |
|
| 43 |
return (
|
| 44 |
+
f"""
|
| 45 |
+
Identify ONLY data-backed scaling opportunities.Suggest opportunities for growth, with evidence and action.
|
| 46 |
+
DATA:
|
| 47 |
+
{payload}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
"""
|
| 49 |
)
|
| 50 |
|
app/ads1/keyword_inspector.py
CHANGED
|
@@ -28,24 +28,11 @@ def build_keyword_prompt(context: dict) -> str:
|
|
| 28 |
payload = json.dumps(context, indent=2, default=str)
|
| 29 |
|
| 30 |
return f"""
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
STRICT RULES:
|
| 37 |
-
- Do NOT invent ad groups or missing fields.
|
| 38 |
-
- Only use given keyword metrics.
|
| 39 |
-
- No paragraphs. Only bullet format.
|
| 40 |
-
|
| 41 |
-
OUTPUT FORMAT:
|
| 42 |
-
- Keyword: <name>
|
| 43 |
-
Label: Winning | Wasted Spend | Scale | Reduce | Investigate
|
| 44 |
-
Evidence: <CTR, cost, conversions>
|
| 45 |
-
Action: <specific bid or pause action>
|
| 46 |
-
|
| 47 |
-
DATA:
|
| 48 |
-
{payload}
|
| 49 |
"""
|
| 50 |
# -------------------------
|
| 51 |
# Main runner
|
|
|
|
| 28 |
payload = json.dumps(context, indent=2, default=str)
|
| 29 |
|
| 30 |
return f"""
|
| 31 |
+
Write 3 to 5 bullet points of actionable keyword performance insights.\n"
|
| 32 |
+
"Analyze individual keywords from the data and classify them as winning,
|
| 33 |
+
wasted spend, or scaling opportunities using CTR, cost, and conversions. Add reasoning.
|
| 34 |
+
"Use simple language. One insight per bullet. Start each line with '- '. No intro sentence.\n\n"
|
| 35 |
+
f"Data (JSON):\n{payload}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
"""
|
| 37 |
# -------------------------
|
| 38 |
# Main runner
|
app/ads1/search_term_optimizer.py
CHANGED
|
@@ -45,15 +45,7 @@ def build_search_optimizer_prompt(context: dict) -> str:
|
|
| 45 |
|
| 46 |
return (
|
| 47 |
f"""
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
TASK:
|
| 51 |
-
Return 3–5 search term actions.
|
| 52 |
-
|
| 53 |
-
STRICT RULES:
|
| 54 |
-
- Only use provided search terms.
|
| 55 |
-
- Do not compare unrelated terms.
|
| 56 |
-
- No explanations longer than 1 sentence per bullet.
|
| 57 |
|
| 58 |
OUTPUT FORMAT:
|
| 59 |
- Search Term: <term>
|
|
|
|
| 45 |
|
| 46 |
return (
|
| 47 |
f"""
|
| 48 |
+
Return 3–5 search term actions for given campaign data.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
OUTPUT FORMAT:
|
| 51 |
- Search Term: <term>
|