在程式化廣告與跨國跨文化行銷場景中,團隊往往需要快速產出數百條針對不同受眾輪廓的廣告標語(Slogan)與標題。傳統工作流長期受困於效率與成本的兩難:若將未經驗證的生成式 AI 文案直接推向付費廣告平台,容易因語氣失焦或文化隔閡而浪費廣告預算;若委由外部問卷與焦點小組進行受眾測試,曠日廢時的週期則完全無法配合自動化敏捷投放的步調。
365Finds 的機構研判非常明確:neuroflash 的核心價值在於將受眾偏好測試轉化為可程式化呼叫的 CI/CD 品質門禁。 與市面上僅作為大模型封裝層的工具不同,neuroflash 將多模型生成能力與基於逾 100 萬筆真實受眾問卷數據校準的「數位孿生(Digital Twins)」仿真人設深度串接。軟體工程師透過 neuroflash 官方開放的 REST API,能夠建構出端到端「生成—測試—質檢—回饋自癒」的自動化閉環:批量產出文案、發起目標受眾模擬審查、自動攔截低評分候選,並將受眾批評回饋至 Prompt 進行修正,在投入廣告預算前完成嚴謹預演。
flowchart TD
A["OAuth2 驗證服務<br/>(id.neuroflash.com)"] -->|Bearer 權杖| B["權杖管理器<br/>(記憶體快取與定期更新)"]
B --> C["工作區服務<br/>(取得 Workspace ID)"]
C --> D["品牌聲音服務<br/>(讀取官方語氣與準則)"]
D --> E["文本生成 API<br/>(/ds-prototypes/content_generation)"]
E -->|候選標語陣列| F["數位孿生群體評測 API<br/>(/twin-group-chat-completions)"]
G["目標受眾畫像組<br/>(德語區 Z 世代 / 千禧世代等)"] --> F
F -->|Verbalized Sampling 評分與質性回饋| H{"品質門禁<br/>(平均分 >= 預設門檻?)"}
H -->|通過| I["核准文案庫 / 同步廣告投放平台"]
H -->|未通過| J["負面意見彙整器"]
J -->|修正後之 Prompt 提示詞| E
1. 安全驗證規範與工作區解析
neuroflash 採用 Zitadel OAuth2 機制處理身份驗證與授權。後端服務需透過 Client Credentials 授權模式取得 JSON Web Token(JWT),依據返回的 expires_in 建立具安全緩衝的記憶體快取機制,並在所有請求標頭中夾帶 Bearer Token 與目標工作區識別碼(x-workspace-id)。
Zitadel 權杖取得
向 https://id.neuroflash.com/oauth/v2/token 發起 POST 請求,帶入申請之 client_id 與 client_secret:
curl -X POST https://id.neuroflash.com/oauth/v2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET" \
-d "scope=openid"
回應範例包含存取權杖與有效秒數:
{
"access_token": "eyJhbGciOiJSUzI1NiIs...",
"token_type": "Bearer",
"expires_in": 43199
}
動態解析工作區識別碼(Workspace ID)
所有呼叫 https://app.neuroflash.com/api 的端點均須攜帶 x-workspace-id 標頭。於系統初始化階段,可呼叫工作區端點進行查詢:
curl -X GET https://app.neuroflash.com/api/workspace-service/v1/workspaces \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
回應將列出目前憑證可存取的工作區:
[
{
"id": "ws-987a654b-321c-4def-a987-654321fedcba",
"name": "Global Growth Team",
"status": "ACTIVE"
}
]
2. 注入品牌聲音(Brand Voice)批次生成行銷標語
脫離品牌調性規範隨機生成的文案往往缺乏說服力。neuroflash 提供了結構化的品牌聲音管理介面,讓工程師能在文字生成階段將企業語氣與禁用詞彙直接注入 System Prompt。
讀取工作區品牌聲音設定
curl -X GET https://app.neuroflash.com/api/brand-voice-service/v1/workspaces/ws-987a654b-321c-4def-a987-654321fedcba/brand-voices \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-workspace-id: ws-987a654b-321c-4def-a987-654321fedcba"
呼叫文字生成介面產出標語變體
neuroflash 的文本生成端點(/ds-prototypes/content_generation/chat/completions)相容於類 OpenAI 規範,可自由選用頂尖模型(如 GPT-4、Claude 3.5 Sonnet 或歐洲本地模型),並完全受控於 neuroflash 的資料隱私與合規防護網:
curl -X POST https://app.neuroflash.com/api/ds-prototypes/content_generation/chat/completions \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-workspace-id: ws-987a654b-321c-4def-a987-654321fedcba" \
-H "Content-Type: application/json" \
-d '{
"model": "openai_chatgpt-4.1",
"temperature": 0.7,
"messages": [
{
"role": "system",
"content": "你是一家歐洲綠色金融科技品牌的資深文案專家。請嚴格遵循自信、科技感且誠實透明的品牌基調,避免使用顛覆性、革命性等陳腔濫調。"
},
{
"role": "user",
"content": "為鎖定 22-35 歲德國年輕都會專業人士的碳中和自動理財功能生成 3 條德語行銷標語。請嚴格以 JSON 字串陣列格式回傳。"
}
]
}'
3. 數位孿生(Digital Twins)受眾仿真預測試端點實作
neuroflash 的關鍵優勢在於其合成受眾研究架構。相較於讓一般模型「扮演某個族群」(極易產生過度奉承的討好偏差),neuroflash 數位孿生是基於大樣本受眾資料統計校準而成。
查詢內建靜態受眾組(Static Groups)
neuroflash 預先定義了跨世代的靜態輪廓群組:
curl -X GET https://app.neuroflash.com/api/digital-twin-service/v1/static-groups \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-workspace-id: ws-987a654b-321c-4def-a987-654321fedcba"
常見群組包含 gen_z、millennials、gen_x、baby_boomers 等。若要取得該群組內具體的數位孿生 ID 列表:
curl -X GET https://app.neuroflash.com/api/digital-twin-service/v1/workspaces/ws-987a654b-321c-4def-a987-654321fedcba/static-groups/gen_z/twins \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-workspace-id: ws-987a654b-321c-4def-a987-654321fedcba"
群體評測請求建構與 Verbalized Sampling 取樣
對多個數位孿生發起平行評測時,應呼叫 /twin-group-chat-completions 端點。
確保工程可靠度的重要參數配置:
responseFormat: 設定嚴格的 JSON Schema,要求模型輸出明確的整數評分(1–10 分)與客觀批評,以利程式碼自動化解析。useVerbalizedSampling: true: 啟用專利的口語化多輪機率取樣(內部執行 5 次機率加權推論,搭配極低溫度 $\tau=0.10$),有效剔除單次隨機生成的虛假好評,反映真實受眾的批判性意見。
curl -X POST https://app.neuroflash.com/api/digital-twin-service/v1/workspaces/ws-987a654b-321c-4def-a987-654321fedcba/twin-group-chat-completions \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-workspace-id: ws-987a654b-321c-4def-a987-654321fedcba" \
-H "Content-Type: application/json" \
-d '{
"twinIds": ["twin_de_genz_01", "twin_de_genz_02", "twin_de_genz_03"],
"useVerbalizedSampling": true,
"responseFormat": {
"type": "json_schema",
"json_schema": {
"name": "slogan_evaluation",
"schema": {
"type": "object",
"properties": {
"score": { "type": "integer", "minimum": 1, "maximum": 10 },
"appeal": { "type": "string" },
"criticism": { "type": "string" }
},
"required": ["score", "appeal", "criticism"],
"additionalProperties": false
}
}
},
"messages": [
{
"role": "user",
"content": "請客觀評估以下理財廣告標語:\"Invest green without breaking your routine.\"。這句標語能否吸引你的注意?是否有任何令人反感或虛假的字眼?"
}
]
}'
4. 端到端實作:自動化文案生成與受眾回饋自癒管線
以下為生產就緒的 Python 自動化指令碼,整合了 OAuth2 權杖管理、品牌聲音載入、文案生成、受眾群體評分與負面回饋自癒重試機制:
#!/usr/bin/env python3
"""
基於 neuroflash REST API 的自動化文案生成與數位孿生受眾預測試管線
"""
import time
import json
import requests
from typing import Dict, List, Any, Optional
class NeuroflashClient:
def __init__(self, client_id: str, client_secret: str, base_url: str = "https://app.neuroflash.com/api"):
self.client_id = client_id
self.client_secret = client_secret
self.base_url = base_url
self.token_url = "https://id.neuroflash.com/oauth/v2/token"
self._access_token: Optional[str] = None
self._token_expires_at: float = 0.0
self.workspace_id: Optional[str] = None
def get_token(self) -> str:
"""取得或自動更新 OAuth2 存取權杖,內建 60 秒緩衝期。"""
now = time.time()
if self._access_token and now < (self._token_expires_at - 60):
return self._access_token
payload = {
"grant_type": "client_credentials",
"client_id": self.client_id,
"client_secret": self.client_secret,
"scope": "openid"
}
res = requests.post(self.token_url, data=payload, timeout=10)
res.raise_for_status()
data = res.json()
self._access_token = data["access_token"]
self._token_expires_at = now + data.get("expires_in", 3600)
return self._access_token
def _headers(self) -> Dict[str, str]:
headers = {
"Authorization": f"Bearer {self.get_token()}",
"Content-Type": "application/json"
}
if self.workspace_id:
headers["x-workspace-id"] = self.workspace_id
return headers
def resolve_workspace(self) -> str:
"""自動查詢並設定首個有效工作區 ID。"""
url = f"{self.base_url}/workspace-service/v1/workspaces"
res = requests.get(url, headers={"Authorization": f"Bearer {self.get_token()}"}, timeout=10)
res.raise_for_status()
workspaces = res.json()
if not workspaces:
raise RuntimeError("當前憑證下未發現有效工作區。")
self.workspace_id = workspaces[0]["id"]
return self.workspace_id
def generate_slogans(self, prompt: str, brand_voice: str, model: str = "openai_chatgpt-4.1") -> List[str]:
"""依據品牌規範生成候選廣告標語。"""
url = f"{self.base_url}/ds-prototypes/content_generation/chat/completions"
system_prompt = (
f"你是一位成效型行銷資深文案總監。請嚴格遵循以下品牌規範:\n{brand_voice}\n"
"請僅以標準 JSON 物件回傳,鍵值為 'slogans',內容為字串陣列。"
)
payload = {
"model": model,
"temperature": 0.8,
"messages": [
{"role": "system", "content": system_prompt},
{"role": "user", "content": prompt}
]
}
res = requests.post(url, headers=self._headers(), json=payload, timeout=30)
res.raise_for_status()
content = res.json()["choices"][0]["message"]["content"]
try:
return json.loads(content).get("slogans", [])
except json.JSONDecodeError:
clean = content.replace("```json", "").replace("```", "").strip()
return json.loads(clean).get("slogans", [])
def pre_test_slogan(self, slogan: str, twin_ids: List[str]) -> Dict[str, Any]:
"""使用 Verbalized Sampling 向多位數位孿生發起評估。"""
url = f"{self.base_url}/digital-twin-service/v1/workspaces/{self.workspace_id}/twin-group-chat-completions"
payload = {
"twinIds": twin_ids,
"useVerbalizedSampling": True,
"responseFormat": {
"type": "json_schema",
"json_schema": {
"name": "twin_rating",
"schema": {
"type": "object",
"properties": {
"score": {"type": "integer", "minimum": 1, "maximum": 10},
"reaction": {"type": "string"},
"dealbreaker": {"type": "string"}
},
"required": ["score", "reaction", "dealbreaker"],
"additionalProperties": False
}
}
},
"messages": [
{
"role": "user",
"content": f"請對這條廣告標語提出真實評價:\"{slogan}\"。給出 1 到 10 的評分、個人直觀反應,以及是否包含讓你排斥的語句。"
}
]
}
res = requests.post(url, headers=self._headers(), json=payload, timeout=45)
res.raise_for_status()
return res.json()
def run_self_healing_campaign(
client: NeuroflashClient,
campaign_brief: str,
brand_voice: str,
target_twin_ids: List[str],
approval_threshold: float = 7.5,
max_iterations: int = 3
) -> List[Dict[str, Any]]:
"""
執行反覆運算管線,直到候選標語達到目標評分門檻。
"""
passed_slogans = []
current_brief = campaign_brief
for iteration in range(1, max_iterations + 1):
print(f"[*] 第 {iteration} 次迭代:正在生成候選文案...")
candidates = client.generate_slogans(current_brief, brand_voice)
iteration_feedback = []
for slogan in candidates:
eval_result = client.pre_test_slogan(slogan, target_twin_ids)
twin_outputs = eval_result.get("twins", [])
scores = []
critiques = []
for twin in twin_outputs:
raw_json = twin.get("message", {}).get("content", "{}")
try:
parsed = json.loads(raw_json)
scores.append(parsed.get("score", 0))
critiques.append(parsed.get("dealbreaker", ""))
except json.JSONDecodeError:
continue
mean_score = sum(scores) / len(scores) if scores else 0.0
print(f" 標語: \"{slogan}\" -> 受眾平均分: {mean_score:.1f}/10")
if mean_score >= approval_threshold:
passed_slogans.append({
"slogan": slogan,
"score": mean_score,
"iteration": iteration,
"status": "APPROVED"
})
else:
iteration_feedback.extend(critiques)
if passed_slogans:
print(f"[+] 成功審核通過 {len(passed_slogans)} 條標語,達到分數門檻 >= {approval_threshold}")
break
print("[!] 當前批次皆未達標,整理受眾批評回饋並注入下一輪 Prompt...")
concise_feedback = ";".join([c for c in iteration_feedback if c])[:300]
current_brief = (
f"{campaign_brief}\n"
f"【重要修正指示】:上一批標語未能通過目標族群測試。受眾主要質疑點為:{concise_feedback}。"
f"請調整創意策略,明確解決上述反饋問題。"
)
return passed_slogans
5. 架構權衡與 365Finds 落地指引
將合成受眾系統整合進持續交付流程時,工程團隊需在反應延遲、API 成本與受眾真實度之間尋求最佳平衡。
核心方案綜合比較
| 評估面向 | 人工後台操作與線下問卷 | 通用模型提示詞模擬 (role: persona) | neuroflash API + 數位孿生 |
|---|---|---|---|
| 管線耗時 | 每批次 3 至 14 天 | 2 至 5 秒 | 15 至 45 秒 |
| 受眾數據校準 | 高(真實受訪者) | 極低(模型幻覺嚴重;容易討好用戶) | 高(基於百萬受眾樣本統計校準) |
| 自動化相容度 | 零(仰賴人工匯入與複製貼上) | 高(標準 REST API) | 高(原生 REST 介面;支援 JSON Schema) |
| 變異性與重現性 | 抽樣誤差波動大 | 受隨機溫度影響極不穩定 | 高穩定性(透過 Verbalized Sampling 達成) |
| 單次測試成本 | 500 至 5,000 美元/樣本組 | 極低模型 Token 費用 | 可預期的 API 席位與點數消耗 |
365Finds 決策建議
- 作為發布前的「負面過濾器」,而非替代實測轉化率:365Finds 明確建議將數位孿生定位為「上線前負向過濾機制」。數位孿生極度擅長辨識語氣不合適、文化地雷與浮誇陳詞等容易引發反感的致命缺點;但若要針對微觀點擊轉化率(CTR)進行極限優化,仍應搭配線上的多臂老虎機(Multi-Armed Bandit)測試。
- 務必開啟 Verbalized Sampling 參數:一般模型在接收評測提示詞時,往往傾向給出 8-9 分的高評分。neuroflash 的
useVerbalizedSampling: true參數是自動化測試不可或缺的核心,能利用加權多輪推論發掘特定人群真正的抗拒點。 - 分流使用生成與測試端點:在標語生成階段,可選用 GPT-4 或 Claude 3.5 等高表達力的大模型以擴展創意廣度;而在受眾評審階段,應嚴格交由經過校準的 neuroflash 數位孿生服務,切勿自行撰寫提示詞讓通用模型模擬歐洲各國的特定次文化族群。