Sarath0x8f commited on
Commit
1faac5b
·
verified ·
1 Parent(s): 52a5702

Upload 5 files

Browse files
MarketingPostGeneratorAgent.py CHANGED
@@ -13,18 +13,15 @@ llm_models = [
13
  ]
14
  selected_model = llm_models[0]
15
 
16
-
17
  def set_model(selected_model_name):
18
  global selected_model
19
  selected_model = selected_model_name
20
 
21
-
22
  def configure_api_keys(gemini_api_key):
23
  if not gemini_api_key:
24
  raise ValueError("Gemini API key is required")
25
  os.environ['GEMINI_API_KEY'] = gemini_api_key
26
 
27
-
28
  # Pydantic models for output validation
29
  class MarketStrategy(BaseModel):
30
  """Market strategy model"""
@@ -33,7 +30,6 @@ class MarketStrategy(BaseModel):
33
  channels: List[str] = Field(..., description="List of channels to be used in the market strategy")
34
  KPIs: List[str] = Field(..., description="List of KPIs to be used in the market strategy")
35
 
36
-
37
  class CampaignIdea(BaseModel):
38
  """Campaign idea model"""
39
  name: str = Field(..., description="Name of the campaign idea")
@@ -41,13 +37,11 @@ class CampaignIdea(BaseModel):
41
  audience: str = Field(..., description="Audience of the campaign idea")
42
  channel: str = Field(..., description="Channel of the campaign idea")
43
 
44
-
45
  class Copy(BaseModel):
46
  """Copy model"""
47
  title: str = Field(..., description="Title of the copy")
48
  body: str = Field(..., description="Body of the copy")
49
 
50
-
51
  @CrewBase
52
  class MarketingPostsCrew:
53
  """MarketingPosts crew"""
@@ -60,7 +54,6 @@ class MarketingPostsCrew:
60
  config=self.agents_config['lead_market_analyst'],
61
  tools=[SerperDevTool(), ScrapeWebsiteTool()],
62
  verbose=True,
63
- memory=False,
64
  llm=selected_model
65
  )
66
 
@@ -70,7 +63,6 @@ class MarketingPostsCrew:
70
  config=self.agents_config['chief_marketing_strategist'],
71
  tools=[SerperDevTool(), ScrapeWebsiteTool()],
72
  verbose=True,
73
- memory=False,
74
  llm=selected_model
75
  )
76
 
@@ -79,7 +71,6 @@ class MarketingPostsCrew:
79
  return Agent(
80
  config=self.agents_config['creative_content_creator'],
81
  verbose=True,
82
- memory=False,
83
  llm=selected_model
84
  )
85
 
@@ -102,7 +93,7 @@ class MarketingPostsCrew:
102
  return Task(
103
  config=self.tasks_config['marketing_strategy_task'],
104
  agent=self.chief_marketing_strategist(),
105
- output_json=MarketStrategy
106
  )
107
 
108
  @task
@@ -110,7 +101,7 @@ class MarketingPostsCrew:
110
  return Task(
111
  config=self.tasks_config['campaign_idea_task'],
112
  agent=self.creative_content_creator(),
113
- output_json=CampaignIdea
114
  )
115
 
116
  @task
@@ -119,7 +110,7 @@ class MarketingPostsCrew:
119
  config=self.tasks_config['copy_creation_task'],
120
  agent=self.creative_content_creator(),
121
  context=[self.marketing_strategy_task(), self.campaign_idea_task()],
122
- output_json=Copy
123
  )
124
 
125
  @crew
@@ -127,27 +118,38 @@ class MarketingPostsCrew:
127
  """Creates the MarketingPosts crew"""
128
  return Crew(
129
  agents=self.agents, # Automatically created by the @agent decorator
130
- tasks=self.tasks, # Automatically created by the @task decorator
131
  process=Process.sequential,
132
  verbose=True,
 
133
  )
134
 
135
-
136
- def run_crew_mpga(gemini_api_key, inputs):
137
  """
138
  Run the MarketingPosts crew using the provided Gemini API key and inputs.
139
 
140
  Args:
141
- gemini_api_key (str): The Gemini API key to configure the environment.
142
- inputs (dict): Input parameters required by the tasks (e.g., customer_domain, project_description).
 
143
 
144
  Returns:
145
- The final output from the crew kickoff.
146
  """
147
  try:
148
  configure_api_keys(gemini_api_key)
149
  crew_instance = MarketingPostsCrew().crew()
 
 
 
 
150
  result = crew_instance.kickoff(inputs=inputs)
151
- return result
 
 
 
 
 
 
152
  except Exception as e:
153
- return f"Error: {str(e)}"
 
13
  ]
14
  selected_model = llm_models[0]
15
 
 
16
  def set_model(selected_model_name):
17
  global selected_model
18
  selected_model = selected_model_name
19
 
 
20
  def configure_api_keys(gemini_api_key):
21
  if not gemini_api_key:
22
  raise ValueError("Gemini API key is required")
23
  os.environ['GEMINI_API_KEY'] = gemini_api_key
24
 
 
25
  # Pydantic models for output validation
26
  class MarketStrategy(BaseModel):
27
  """Market strategy model"""
 
30
  channels: List[str] = Field(..., description="List of channels to be used in the market strategy")
31
  KPIs: List[str] = Field(..., description="List of KPIs to be used in the market strategy")
32
 
 
33
  class CampaignIdea(BaseModel):
34
  """Campaign idea model"""
35
  name: str = Field(..., description="Name of the campaign idea")
 
37
  audience: str = Field(..., description="Audience of the campaign idea")
38
  channel: str = Field(..., description="Channel of the campaign idea")
39
 
 
40
  class Copy(BaseModel):
41
  """Copy model"""
42
  title: str = Field(..., description="Title of the copy")
43
  body: str = Field(..., description="Body of the copy")
44
 
 
45
  @CrewBase
46
  class MarketingPostsCrew:
47
  """MarketingPosts crew"""
 
54
  config=self.agents_config['lead_market_analyst'],
55
  tools=[SerperDevTool(), ScrapeWebsiteTool()],
56
  verbose=True,
 
57
  llm=selected_model
58
  )
59
 
 
63
  config=self.agents_config['chief_marketing_strategist'],
64
  tools=[SerperDevTool(), ScrapeWebsiteTool()],
65
  verbose=True,
 
66
  llm=selected_model
67
  )
68
 
 
71
  return Agent(
72
  config=self.agents_config['creative_content_creator'],
73
  verbose=True,
 
74
  llm=selected_model
75
  )
76
 
 
93
  return Task(
94
  config=self.tasks_config['marketing_strategy_task'],
95
  agent=self.chief_marketing_strategist(),
96
+ # output_json=MarketStrategy
97
  )
98
 
99
  @task
 
101
  return Task(
102
  config=self.tasks_config['campaign_idea_task'],
103
  agent=self.creative_content_creator(),
104
+ # output_json=CampaignIdea
105
  )
106
 
107
  @task
 
110
  config=self.tasks_config['copy_creation_task'],
111
  agent=self.creative_content_creator(),
112
  context=[self.marketing_strategy_task(), self.campaign_idea_task()],
113
+ output_file="post_generation.md"
114
  )
115
 
116
  @crew
 
118
  """Creates the MarketingPosts crew"""
119
  return Crew(
120
  agents=self.agents, # Automatically created by the @agent decorator
121
+ tasks=self.tasks, # Automatically created by the @task decorator
122
  process=Process.sequential,
123
  verbose=True,
124
+ output_log_file=True
125
  )
126
 
127
+ def run_crew_mpga(gemini_api_key, customer_domain, project_description):
 
128
  """
129
  Run the MarketingPosts crew using the provided Gemini API key and inputs.
130
 
131
  Args:
132
+ gemini_api_key (str): The Gemini API key.
133
+ customer_domain (str): The customer domain.
134
+ project_description (str): The project description.
135
 
136
  Returns:
137
+ A tuple (result, logs) from the crew kickoff.
138
  """
139
  try:
140
  configure_api_keys(gemini_api_key)
141
  crew_instance = MarketingPostsCrew().crew()
142
+ inputs = {
143
+ "customer_domain": customer_domain,
144
+ "project_description": project_description
145
+ }
146
  result = crew_instance.kickoff(inputs=inputs)
147
+ with open("post_generation.md", "r", encoding='utf-8') as f:
148
+ post_generation = f.read()
149
+ with open("logs.txt", 'r', encoding='utf-8') as f:
150
+ logs = f.read()
151
+ with open("logs.txt", 'w', encoding='utf-8') as f:
152
+ f.truncate(0)
153
+ return post_generation, logs
154
  except Exception as e:
155
+ return f"Error: {str(e)}", ""
app.py CHANGED
@@ -1,200 +1,199 @@
1
- import gradio as gr
2
- import markdown as md
3
- import yaml
4
- from ContentGeneratorAgent import run_crew_cga, set_model, llm_models
5
- from GameBuilderAgent import run_crew_game
6
- from MarketingPostGeneratorAgent import run_crew_mpga
7
- import base64
8
-
9
- def toggle_serper_input(choice):
10
- return gr.Textbox(visible=(choice == "Yes"))
11
-
12
- def update_game_instructions(example_key):
13
- # Load the game design examples from the YAML file
14
- with open('gamedesign.yaml', 'r', encoding='utf-8') as f:
15
- examples = yaml.safe_load(f)
16
- return examples.get(example_key, "")
17
-
18
- def encode_image(image_path):
19
- with open(image_path, "rb") as image_file:
20
- return base64.b64encode(image_file.read()).decode('utf-8')
21
-
22
- # Encode the images
23
- github_logo_encoded = encode_image("Images/github-logo.png")
24
- linkedin_logo_encoded = encode_image("Images/linkedin-logo.png")
25
- website_logo_encoded = encode_image("Images/ai-logo.png")
26
-
27
- # UI Setup
28
- with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Roboto Mono")]),
29
- css='footer {visibility: hidden}') as demo:
30
- gr.Markdown("# AI Agents 🤖🕵🏻")
31
-
32
- with gr.Tabs():
33
- with gr.TabItem("Intro"):
34
- gr.Markdown(md.description)
35
- # Tab for SEO Content Generator Agent
36
- with gr.TabItem("SEO Content Agent"):
37
- with gr.Accordion("📔 Description:", open=False):
38
- gr.Markdown(md.seo_content)
39
- with gr.Accordion("How to get GEMINI API KEY", open=False):
40
- gr.Markdown(md.gemini_api_key)
41
- with gr.Accordion("How to get SERPER API KEY", open=False):
42
- gr.Markdown(md.serper_api_key)
43
- with gr.Row():
44
- with gr.Column(scale=1):
45
- model_dropdown = gr.Dropdown(
46
- llm_models,
47
- label="1. Select AI Model",
48
- value=llm_models[0]
49
- )
50
- gemini_key = gr.Textbox(
51
- label="2. Enter Gemini API Key",
52
- type="password",
53
- placeholder="Paste your Gemini API key here..."
54
- )
55
- search_toggle = gr.Radio(
56
- ["Yes", "No"],
57
- label="3. Enable Online Search?",
58
- value="No"
59
- )
60
- serper_key = gr.Textbox(
61
- label="4. Enter Serper API Key",
62
- type="password",
63
- visible=False,
64
- placeholder="Paste your Serper API key if enabled..."
65
- )
66
- topic_input = gr.Textbox(
67
- label="5. Enter Content Topic",
68
- placeholder="Enter your article topic here..."
69
- )
70
- run_btn = gr.Button("Generate Content", variant="primary")
71
- with gr.Column(scale=3):
72
- output = gr.Markdown(
73
- label="Generated Content",
74
- value="Your content will appear here..."
75
- )
76
- with gr.Accordion("Process Logs", open=True):
77
- logs = gr.Markdown()
78
-
79
- # Event handlers for SEO Content Generator
80
- model_dropdown.change(set_model, model_dropdown)
81
- search_toggle.change(
82
- toggle_serper_input,
83
- inputs=search_toggle,
84
- outputs=serper_key
85
- )
86
- run_btn.click(
87
- run_crew_cga,
88
- inputs=[gemini_key, search_toggle, serper_key, topic_input],
89
- outputs=[output, logs],
90
- show_progress="full"
91
- )
92
-
93
- # Tab for Game Dev Agent
94
- with gr.TabItem("Game Dev Agent"):
95
- with gr.Accordion('📔 Description:', open=True):
96
- gr.Markdown(md.game_dev)
97
- with gr.Accordion("How to get GEMINI API KEY", open=False):
98
- gr.Markdown(md.gemini_api_key)
99
- with gr.Row():
100
- with gr.Column(scale=1):
101
- game_model_dropdown = gr.Dropdown(
102
- llm_models,
103
- label="1. Select AI Model",
104
- value=llm_models[0]
105
- )
106
- game_gemini_key = gr.Textbox(
107
- label="2. Enter Gemini API Key",
108
- type="password",
109
- placeholder="Paste your Gemini API key here..."
110
- )
111
- game_example_dropdown = gr.Dropdown(
112
- choices=["pacman", "pacman2", "snake", "space_invaders", "Tetris", "Frogger", "Chess", "Go", "Reversi"],
113
- label="3. Select Example",
114
- value="example1_pacman"
115
- )
116
- game_load_example_btn = gr.Button("Load Example", variant="secondary")
117
-
118
- game_instructions = gr.Textbox(
119
- label="4. Enter Game Design Instructions",
120
- placeholder="Enter your game design instructions here...",
121
- lines=5
122
- )
123
- game_run_btn = gr.Button("Generate Game Code", variant="primary")
124
- with gr.Column(scale=3):
125
- game_output = gr.Markdown(
126
- label="Generated Game Code",
127
- value="Your game code will appear here..."
128
- )
129
- with gr.Accordion("Process Logs", open=False):
130
- game_logs = gr.Markdown()
131
-
132
- # Event handlers for Game Dev Agent
133
- game_model_dropdown.change(set_model, game_model_dropdown)
134
- game_load_example_btn.click(
135
- update_game_instructions,
136
- inputs=[game_example_dropdown],
137
- outputs=[game_instructions]
138
- )
139
- game_run_btn.click(
140
- run_crew_game,
141
- inputs=[game_gemini_key, game_instructions],
142
- outputs=[game_output, game_logs],
143
- show_progress="full"
144
- )
145
-
146
- # Tab for Marketing Posts Generator Agent
147
- with gr.TabItem("Marketing Posts Generator Agent"):
148
- with gr.Accordion("How to get GEMINI API KEY", open=False):
149
- gr.Markdown(md.gemini_api_key)
150
- with gr.Accordion("How to get SERPER API KEY", open=False):
151
- gr.Markdown(md.serper_api_key)
152
- with gr.Row():
153
- with gr.Column(scale=1):
154
- mpga_model_dropdown = gr.Dropdown(
155
- llm_models,
156
- label="1. Select AI Model",
157
- value=llm_models[0]
158
- )
159
- mpga_gemini_key = gr.Textbox(
160
- label="2. Enter Gemini API Key",
161
- type="password",
162
- placeholder="Paste your Gemini API key here..."
163
- )
164
- mpga_serper_key = gr.Textbox(
165
- label="3. Enter Serper API Key",
166
- type="password",
167
- placeholder="Paste your Serper API key here..."
168
- )
169
- customer_domain = gr.Textbox(
170
- label="4. Enter Customer Domain",
171
- placeholder="Enter the customer domain here..."
172
- )
173
- project_description = gr.Textbox(
174
- label="5. Enter Project Description",
175
- placeholder="Enter the project description here..."
176
- )
177
- mpga_run_btn = gr.Button("Generate Marketing Posts", variant="primary")
178
- with gr.Column(scale=3):
179
- mpga_output = gr.Markdown(
180
- label="Generated Marketing Posts",
181
- value="Your marketing posts will appear here..."
182
- )
183
- with gr.Accordion("Process Logs", open=False):
184
- mpga_logs = gr.Markdown()
185
-
186
- # Event handlers for Marketing Posts Generator Agent
187
- mpga_model_dropdown.change(set_model, mpga_model_dropdown)
188
- # mpga_run_btn.click(
189
- # run_crew_mpga,
190
- # inputs=[mpga_gemini_key, mpga_serper_key, {
191
- # "customer_domain": customer_domain,
192
- # "project_description": project_description
193
- # }],
194
- # outputs=[mpga_output, mpga_logs],
195
- # show_progress="full"
196
- # )
197
- gr.HTML(md.footer.format(github_logo_encoded, linkedin_logo_encoded, website_logo_encoded))
198
-
199
- if __name__ == "__main__":
200
- demo.launch()
 
1
+ import gradio as gr
2
+ import markdown as md
3
+ import yaml
4
+ from ContentGeneratorAgent import run_crew_cga, set_model, llm_models
5
+ from GameBuilderAgent import run_crew_game
6
+ from MarketingPostGeneratorAgent import run_crew_mpga
7
+ import base64
8
+
9
+ def toggle_serper_input(choice):
10
+ return gr.Textbox(visible=(choice == "Yes"))
11
+
12
+ def update_game_instructions(example_key):
13
+ # Load the game design examples from the YAML file
14
+ with open('gamedesign.yaml', 'r', encoding='utf-8') as f:
15
+ examples = yaml.safe_load(f)
16
+ return examples.get(example_key, "")
17
+
18
+ def encode_image(image_path):
19
+ with open(image_path, "rb") as image_file:
20
+ return base64.b64encode(image_file.read()).decode('utf-8')
21
+
22
+ # Encode the images
23
+ github_logo_encoded = encode_image("Images/github-logo.png")
24
+ linkedin_logo_encoded = encode_image("Images/linkedin-logo.png")
25
+ website_logo_encoded = encode_image("Images/ai-logo.png")
26
+
27
+ # UI Setup
28
+ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Roboto Mono")]),
29
+ css='footer {visibility: hidden}') as demo:
30
+ gr.Markdown("# AI Agents 🤖🕵🏻")
31
+
32
+ with gr.Tabs():
33
+ with gr.TabItem("Intro"):
34
+ gr.Markdown(md.description)
35
+ # Tab for SEO Content Generator Agent
36
+ with gr.TabItem("SEO Content Agent"):
37
+ with gr.Accordion("📔 Description:", open=False):
38
+ gr.Markdown(md.seo_content)
39
+ with gr.Accordion("How to get GEMINI API KEY", open=False):
40
+ gr.Markdown(md.gemini_api_key)
41
+ with gr.Accordion("How to get SERPER API KEY", open=False):
42
+ gr.Markdown(md.serper_api_key)
43
+ with gr.Row():
44
+ with gr.Column(scale=1):
45
+ model_dropdown = gr.Dropdown(
46
+ llm_models,
47
+ label="1. Select AI Model",
48
+ value=llm_models[0]
49
+ )
50
+ gemini_key = gr.Textbox(
51
+ label="2. Enter Gemini API Key",
52
+ type="password",
53
+ placeholder="Paste your Gemini API key here..."
54
+ )
55
+ search_toggle = gr.Radio(
56
+ ["Yes", "No"],
57
+ label="3. Enable Online Search?",
58
+ value="No"
59
+ )
60
+ serper_key = gr.Textbox(
61
+ label="4. Enter Serper API Key",
62
+ type="password",
63
+ visible=False,
64
+ placeholder="Paste your Serper API key if enabled..."
65
+ )
66
+ topic_input = gr.Textbox(
67
+ label="5. Enter Content Topic",
68
+ placeholder="Enter your article topic here..."
69
+ )
70
+ run_btn = gr.Button("Generate Content", variant="primary")
71
+ with gr.Column(scale=3):
72
+ output = gr.Markdown(
73
+ label="Generated Content",
74
+ value="Your content will appear here..."
75
+ )
76
+ with gr.Accordion("Process Logs", open=True):
77
+ logs = gr.Markdown()
78
+
79
+ # Event handlers for SEO Content Generator
80
+ model_dropdown.change(set_model, model_dropdown)
81
+ search_toggle.change(
82
+ toggle_serper_input,
83
+ inputs=search_toggle,
84
+ outputs=serper_key
85
+ )
86
+ run_btn.click(
87
+ run_crew_cga,
88
+ inputs=[gemini_key, search_toggle, serper_key, topic_input],
89
+ outputs=[output, logs],
90
+ show_progress="full"
91
+ )
92
+
93
+ # Tab for Game Dev Agent
94
+ with gr.TabItem("Game Dev Agent"):
95
+ with gr.Accordion('📔 Description:', open=False):
96
+ gr.Markdown(md.game_dev)
97
+ with gr.Accordion("How to get GEMINI API KEY", open=False):
98
+ gr.Markdown(md.gemini_api_key)
99
+ with gr.Row():
100
+ with gr.Column(scale=1):
101
+ game_model_dropdown = gr.Dropdown(
102
+ llm_models,
103
+ label="1. Select AI Model",
104
+ value=llm_models[0]
105
+ )
106
+ game_gemini_key = gr.Textbox(
107
+ label="2. Enter Gemini API Key",
108
+ type="password",
109
+ placeholder="Paste your Gemini API key here..."
110
+ )
111
+ game_example_dropdown = gr.Dropdown(
112
+ choices=["pacman", "pacman2", "snake", "space_invaders", "Tetris", "Frogger", "Chess", "Go", "Reversi"],
113
+ label="3. Select Example",
114
+ value="pacman"
115
+ )
116
+ game_load_example_btn = gr.Button("Load Example", variant="secondary")
117
+ game_instructions = gr.Textbox(
118
+ label="4. Enter Game Design Instructions",
119
+ placeholder="Enter your game design instructions here...",
120
+ lines=5
121
+ )
122
+ game_run_btn = gr.Button("Generate Game Code", variant="primary")
123
+ with gr.Column(scale=3):
124
+ game_output = gr.Markdown(
125
+ label="Generated Game Code",
126
+ value="Your game code will appear here..."
127
+ )
128
+ with gr.Accordion("Process Logs", open=False):
129
+ game_logs = gr.Markdown()
130
+
131
+ # Event handlers for Game Dev Agent
132
+ game_model_dropdown.change(set_model, game_model_dropdown)
133
+ game_load_example_btn.click(
134
+ update_game_instructions,
135
+ inputs=[game_example_dropdown],
136
+ outputs=[game_instructions]
137
+ )
138
+ game_run_btn.click(
139
+ run_crew_game,
140
+ inputs=[game_gemini_key, game_instructions],
141
+ outputs=[game_output, game_logs],
142
+ show_progress="full"
143
+ )
144
+
145
+ # Tab for Marketing Posts Generator Agent
146
+ with gr.TabItem("Marketing Posts Generator Agent"):
147
+ with gr.Accordion("📔 Description: ", open=False):
148
+ gr.Markdown(md.marking_post_gen_agent)
149
+ with gr.Accordion("How to get GEMINI API KEY", open=False):
150
+ gr.Markdown(md.gemini_api_key)
151
+ with gr.Accordion("How to get SERPER API KEY", open=False):
152
+ gr.Markdown(md.serper_api_key)
153
+ with gr.Row():
154
+ with gr.Column(scale=1):
155
+ mpga_model_dropdown = gr.Dropdown(
156
+ llm_models,
157
+ label="1. Select AI Model",
158
+ value=llm_models[0]
159
+ )
160
+ mpga_gemini_key = gr.Textbox(
161
+ label="2. Enter Gemini API Key",
162
+ type="password",
163
+ placeholder="Paste your Gemini API key here..."
164
+ )
165
+ mpga_serper_key = gr.Textbox(
166
+ label="3. Enter Serper API Key",
167
+ type="password",
168
+ placeholder="Paste your Serper API key here..."
169
+ )
170
+ customer_domain = gr.Textbox(
171
+ label="4. Enter Customer Domain",
172
+ placeholder="Enter the customer domain here..."
173
+ )
174
+ project_description = gr.Textbox(
175
+ label="5. Enter Project Description",
176
+ placeholder="Enter the project description here..."
177
+ )
178
+ mpga_run_btn = gr.Button("Generate Marketing Posts", variant="primary")
179
+ with gr.Column(scale=3):
180
+ mpga_output = gr.Markdown(
181
+ label="Generated Marketing Posts",
182
+ value="Your marketing posts will appear here..."
183
+ )
184
+ with gr.Accordion("Process Logs", open=False):
185
+ mpga_logs = gr.Markdown()
186
+
187
+ # Event handlers for Marketing Posts Generator Agent
188
+ mpga_model_dropdown.change(set_model, mpga_model_dropdown)
189
+ mpga_run_btn.click(
190
+ run_crew_mpga,
191
+ inputs=[mpga_gemini_key, customer_domain, project_description],
192
+ outputs=[mpga_output, mpga_logs],
193
+ show_progress="full"
194
+ )
195
+
196
+ gr.HTML(md.footer.format(github_logo_encoded, linkedin_logo_encoded, website_logo_encoded))
197
+
198
+ if __name__ == "__main__":
199
+ demo.launch()
 
config/MarketingPostGeneratorAgent/agents.yaml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ lead_market_analyst:
2
+ role: >
3
+ Lead Market Analyst
4
+ goal: >
5
+ Conduct amazing analysis of the products and competitors, providing in-depth
6
+ insights to guide marketing strategies.
7
+ backstory: >
8
+ As the Lead Market Analyst at a premier digital marketing firm, you specialize
9
+ in dissecting online business landscapes.
10
+
11
+ chief_marketing_strategist:
12
+ role: >
13
+ Chief Marketing Strategist
14
+ goal: >
15
+ Synthesize amazing insights from product analysis to formulate incredible
16
+ marketing strategies.
17
+ backstory: >
18
+ You are the Chief Marketing Strategist at a leading digital marketing agency,
19
+ known for crafting bespoke strategies that drive success.
20
+
21
+ creative_content_creator:
22
+ role: >
23
+ Creative Content Creator
24
+ goal: >
25
+ Develop compelling and innovative content for social media campaigns, with a
26
+ focus on creating high-impact ad copies.
27
+ backstory: >
28
+ As a Creative Content Creator at a top-tier digital marketing agency, you
29
+ excel in crafting narratives that resonate with audiences. Your expertise
30
+ lies in turning marketing strategies into engaging stories and visual
31
+ content that capture attention and inspire action.
32
+
33
+ chief_creative_director:
34
+ role: >
35
+ Chief Creative Director
36
+ goal: >
37
+ Oversee the work done by your team to make sure it is the best possible and
38
+ aligned with the product goals, review, approve, ask clarifying questions or
39
+ delegate follow-up work if necessary.
40
+ backstory: >
41
+ You are the Chief Content Officer at a leading digital marketing agency
42
+ specializing in product branding. You ensure your team crafts the best
43
+ possible content for the customer.
config/MarketingPostGeneratorAgent/tasks.yaml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ research_task:
2
+ description: >
3
+ Conduct a thorough research about the customer and competitors in the context
4
+ of {customer_domain}.
5
+ Make sure you find any interesting and relevant information given the
6
+ current year is 2024.
7
+ We are working with them on the following project: {project_description}.
8
+ expected_output: >
9
+ A complete report on the customer and their customers and competitors,
10
+ including their demographics, preferences, market positioning and audience engagement.
11
+
12
+ project_understanding_task:
13
+ description: >
14
+ Understand the project details and the target audience for
15
+ {project_description}.
16
+ Review any provided materials and gather additional information as needed.
17
+ expected_output: >
18
+ A detailed summary of the project and a profile of the target audience.
19
+
20
+ marketing_strategy_task:
21
+ description: >
22
+ Formulate a comprehensive marketing strategy for the project
23
+ {project_description} of the customer {customer_domain}.
24
+ Use the insights from the research task and the project understanding
25
+ task to create a high-quality strategy.
26
+ expected_output: >
27
+ A detailed marketing strategy document that outlines the goals, target
28
+ audience, key messages, and proposed tactics, make sure to have name, tatics, channels and KPIs
29
+
30
+ campaign_idea_task:
31
+ description: >
32
+ Develop creative marketing campaign ideas for {project_description}.
33
+ Ensure the ideas are innovative, engaging, and aligned with the overall marketing strategy.
34
+ expected_output: >
35
+ A list of 5 campaign ideas, each with a brief description and expected impact.
36
+
37
+ copy_creation_task:
38
+ description: >
39
+ Create marketing copies based on the approved campaign ideas for {project_description}.
40
+ Ensure the copies are compelling, clear, and tailored to the target audience.
41
+ expected_output: >
42
+ Marketing copies for each campaign idea.
markdown.py CHANGED
@@ -254,6 +254,48 @@ The provided code utilizes the CrewAI framework to automate the development and
254
  Experience streamlined game development with CrewAI's advanced automation capabilities.
255
  """
256
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  footer = """
258
  <div style="background-color: #1d2938; color: white; padding: 10px; width: 100%; bottom: 0; left: 0; display: flex; justify-content: space-between; align-items: center; padding: .2rem 35px; box-sizing: border-box; font-size: 16px;">
259
  <div style="text-align: left;">
 
254
  Experience streamlined game development with CrewAI's advanced automation capabilities.
255
  """
256
 
257
+ marking_post_gen_agent = '''
258
+ # CrewAI Marketing Post Generator Agent
259
+
260
+ ## Overview
261
+
262
+ The Marketing Post Generator Agent leverages the CrewAI framework to automate the creation of engaging and effective marketing posts for social media campaigns. It integrates with the Gemini language model to ensure high-quality, tailored content.
263
+
264
+ ## Roles
265
+
266
+ - **Market Research Analyst**: Conducts in-depth research on the target audience and competitors to gather insights for post creation.
267
+ - **Creative Content Writer**: Crafts compelling and innovative marketing posts based on the research findings.
268
+ - **Social Media Strategist**: Ensures the posts align with the overall marketing strategy and are optimized for engagement.
269
+
270
+ ## Tasks
271
+
272
+ - **Research Task**: Aggregates detailed information on the target audience, competitors, and current market trends.
273
+ - **Content Creation Task**: Develops engaging and innovative marketing posts tailored to the target audience.
274
+ - **Strategy Alignment Task**: Ensures the posts are aligned with the overall marketing strategy and optimized for maximum impact.
275
+
276
+ ## Usage
277
+
278
+ 1. **Set Model**: Choose the desired Gemini model.
279
+ 2. **Configure API Keys**: Provide the necessary API key for Gemini.
280
+ 3. **Run Crew**: Execute the crew with the specified campaign details to generate marketing posts.
281
+
282
+ ## Features
283
+
284
+ - **Model Selection**: Supports multiple Gemini language models for flexibility.
285
+ - **API Configuration**: Manages API keys for Gemini.
286
+ - **Agent Roles**: Defines specialized agents for market research, content creation, and strategy alignment.
287
+ - **Task Management**: Orchestrates sequential tasks for research, content creation, and strategy alignment.
288
+ - **Output**: Generates a set of polished marketing posts and detailed logs.
289
+
290
+ ## Benefits
291
+
292
+ - **Efficiency**: Automates the marketing post creation process, saving time and effort.
293
+ - **Quality**: Ensures high-quality, engaging, and strategically aligned content.
294
+ - **Flexibility**: Allows for easy integration of additional tools for enhanced functionality.
295
+
296
+ Experience streamlined marketing post generation with CrewAI's advanced automation capabilities.
297
+ '''
298
+
299
  footer = """
300
  <div style="background-color: #1d2938; color: white; padding: 10px; width: 100%; bottom: 0; left: 0; display: flex; justify-content: space-between; align-items: center; padding: .2rem 35px; box-sizing: border-box; font-size: 16px;">
301
  <div style="text-align: left;">