Update strategyGen.py
Browse files- strategyGen.py +32 -0
strategyGen.py
CHANGED
|
@@ -49,6 +49,38 @@ def ideagen(content_type , brand_name, product_list, core_essence, brand_target,
|
|
| 49 |
messages=messages_base
|
| 50 |
)
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
completed_text = response.choices[0].message.content
|
| 53 |
total_prompt_tokens_used += response.usage.prompt_tokens
|
| 54 |
total_completion_tokens_used += response.usage.completion_tokens
|
|
|
|
| 49 |
messages=messages_base
|
| 50 |
)
|
| 51 |
|
| 52 |
+
def ideagen_adv(content_type , brand_name, product_list, core_essence, brand_target, target_customer, strength_focus, weakness_focus, opportunities_focus, threats_focus, additional):
|
| 53 |
+
total_prompt_tokens_used = 0
|
| 54 |
+
total_completion_tokens_used = 0
|
| 55 |
+
|
| 56 |
+
print("GO")
|
| 57 |
+
|
| 58 |
+
messages_base = [
|
| 59 |
+
{"role": "system", "content": "你是一位行銷策略大師,擅長使用各種策略分析的模型,解決品牌在經營上的難題。請使用指定的分析模型,根據提供的品牌資訊,產出分析的結果。"},
|
| 60 |
+
]
|
| 61 |
+
|
| 62 |
+
if content_type == 0:
|
| 63 |
+
messages_base.extend([{"role": "user", "content": f"分析方式:SWOT Analysis。SWOT Analysis包含以下四個部分:優勢(Strengths):這些是組織在市場上相對於競爭對手的內在優勢。可能包括專利技術、品牌識別度、市場份額、財務資源、客戶忠誠度或有效的供應鏈等。識別這些優勢可以幫助組織最大化其競爭優勢。;劣勢(Weaknesses):這些是組織在運營和策略方面的內在弱點。劣勢可能包括資金不足、技術落後、品牌形象不佳、管理問題或顧客服務缺陷等。識別並了解這些劣勢對於規避風險和改進策略至關重要。;機會(Opportunities):這些是組織可以利用來增長和改進的外部條件。機會可能來自市場變化、技術創新、政策變更、消費者趨勢的變化或新市場的出現。識別機會有助於組織抓住成長的可能性。;威脅(Threats):這些是來自組織外部的可能對其造成損害的因素。威脅可能包括競爭加劇、市場需求減少、負面公關、法律變化或經濟衰退等。了解這些威脅對於制定風險管理策略和確保組織穩定性非常重要。"}])
|
| 64 |
+
|
| 65 |
+
messages_base.extend([{"role": "user", "content": f"品牌資訊如下,分析品牌:{brand_name}。主要產品:{product_list}。品牌理念:{core_essence}。品牌目標:{brand_target}。目標客群:{target_customer}。補充資料:{additional}。"}])
|
| 66 |
+
|
| 67 |
+
messages_base.extend([{"role": "user", "content": f"請 Step by Step 的思考,Strength 分析請加上針對{strength_focus}的思考,得出這些問題的答案後,再根據 Strength 分析的定義,以條列的方式產出內容。"}])
|
| 68 |
+
messages_base.extend([{"role": "user", "content": f"Weakness 分析請加上針對{weakness_focus}的思考,得出這些問題的答案後,再根據 Strength 分析的定義,以條列的方式產出內容。"}])
|
| 69 |
+
messages_base.extend([{"role": "user", "content": f"Opportunities 分析請加上針對{opportunities_focus}的思考,得出這些問題的答案後,再根據 Strength 分析的定義,以條列的方式產出內容。"}])
|
| 70 |
+
messages_base.extend([{"role": "user", "content": f"Threats 分析請加上針對{threats_focus}的思考,得出這些問題的答案後,再根據 Strength 分析的定義,以條列的方式產出內容。"}])
|
| 71 |
+
|
| 72 |
+
messages_base.extend([{"role": "user", "content": "請運用你的專業,限定在台灣市場,盡可能分析的具體且深入,對於資訊不足的部分請說明你的推理並附上依據,在分析目標逐項說明結束後,針對品牌目標,提供可行的策略。請使用繁體中文"}])
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
response = client.chat.completions.create(
|
| 76 |
+
model='gpt-4o',
|
| 77 |
+
max_tokens=3000,
|
| 78 |
+
temperature=0.5,
|
| 79 |
+
messages=messages_base
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
|
| 84 |
completed_text = response.choices[0].message.content
|
| 85 |
total_prompt_tokens_used += response.usage.prompt_tokens
|
| 86 |
total_completion_tokens_used += response.usage.completion_tokens
|