File size: 1,860 Bytes
39b31c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from llama_cpp import Llama
import re

print("Script started")

# llm = Llama.from_pretrained(
#     repo_id="mradermacher/MiniCPM4.1-8B-GGUF",
#     filename="MiniCPM4.1-8B.IQ4_XS.gguf",
#     n_ctx=4096,
#     verbose=False
# )

llm = Llama.from_pretrained(
    repo_id="Abiray/MiniCPM5-1B-GGUF",
    filename="minicpm5-1b-Q4_K_M.gguf",
    n_ctx=3048,
    verbose=True
)

prompt = """
You are a senior Google Ads performance analyst.

You must output ONLY 3–5 bullet insights.

STRICT RULES:
- Do NOT include reasoning
- Do NOT include calculations
- Do NOT include step-by-step analysis
- Do NOT use <think> tags
- Do NOT show working or explanations
- Only final insights allowed

Use only the provided data. Do not derive new metrics.

DATA:

Campaign:
- Name: Preschool Search
- Spend: 1200
- Clicks: 300
- Impressions: 15000
- Conversions: 30

Trends:
- Spend increasing steadily over last 10 days
- Clicks increasing steadily
- Impressions increasing slightly faster than clicks

Keywords:
- preschool near me → strong performance (15 conversions, low cost)
- nursery admission → moderate (5 conversions)
- best preschool london → poor (0 conversions, high cost)
- early learning center → good (8 conversions)

Signals:
- CTR: 0.35 (low)
- Wasted spend: 0.25 (high)

Business targets:
- Target CPL: 20
- Current CPL: 40

OUTPUT RULES:
- Exactly 3–5 bullets
- No numbering
- No explanations
- No thinking traces
- Each bullet must be independently useful for decision-making
"""

response = llm.create_chat_completion(
    messages=[
        {"role": "system", "content": "You are an expert marketing analyst for Google Ads."},
        {"role": "user", "content": prompt}
    ],
    temperature=0.7,
)

raw = response["choices"][0]["message"]["content"]

clean = re.sub(r"<think>.*?</think>", "", raw, flags=re.DOTALL).strip()

print(clean)