File size: 3,947 Bytes
3c697be |
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 |
import autogen
config_list_gpt4 = autogen.config_list_from_json(
"OAI_CONFIG_LIST",
filter_dict={
"model": ["gpt-4-32k", "gpt-4", "gpt-4-32k-0314", "gpt-4-32k-v0314"],
},
)
gpt4_config = {
"seed": 43,
"temperature": 0,
"config_list": config_list_gpt4,
"request_timeout": 120,
}
user_proxy = autogen.UserProxyAgent(
name="Owner",
system_message="Owner of the social media account. Interact with the strategist and campaign manager to finalize the strategy. Approve plans and oversee overall direction.",
code_execution_config=False,
)
developer = autogen.AssistantAgent(
name="Developer",
llm_config=gpt4_config,
system_message='''Developer. Follow the approved strategy. Write python/shell code to automate tasks, create new tools, and integrate with social media APIs securely. Respond to feedback from the BotExecutor. Ensure complete code execution and handle potential errors or exceptions gracefully. Ask Owner to provide API keys and Tokens if necessary''',
)
strategist = autogen.AssistantAgent(
name="Strategist",
llm_config=gpt4_config,
system_message="""Strategist. Provide insights into trends, create content strategies, and suggest growth optimization methods while ensuring ethical standards. Collaborate with the campaign manager to devise the overarching strategy. Do not write code but can recommend tool creation to the developer.""",
)
content_creator = autogen.AssistantAgent(
name="ContentCreator",
llm_config=gpt4_config,
system_message="""ContentCreator. Generate engaging posts, captions, and visuals based on the strategist's guidance and campaign manager's directives. Collaborate with the developer for any automation needs related to content deployment.""",
)
campaign_manager = autogen.AssistantAgent(
name="CampaignManager",
llm_config=gpt4_config,
system_message='''CampaignManager. Design campaigns using the strategist's insights and auditor feedback. Assign tasks to the developer and content creator for implementation. Ensure all actions adhere to platform rules and ethical standards. Detail each step, specify the responsible agent, and maintain clear communication channels with all team members. Ask Owner for feedback occasionally.''',
)
analytics_agent = autogen.AssistantAgent(
name="AnalyticsAgent",
llm_config=gpt4_config,
system_message='''AnalyticsAgent. Monitor and report on campaign performance, analyzing follower growth, engagement metrics, and other KPIs. Work with the strategist and campaign manager to refine ongoing strategies based on real-time data.''',
)
bot_executor = autogen.UserProxyAgent(
name="BotExecutor",
system_message="BotExecutor. Execute the code written by the developer to automate tasks, post content, or analyze metrics. Report execution results, feedback, and any encountered issues for continuous refinement.",
human_input_mode="NEVER",
code_execution_config={"last_n_messages": 3, "work_dir": "social_media"},
)
auditor = autogen.AssistantAgent(
name="Auditor",
llm_config=gpt4_config,
system_message="Auditor. Regularly review strategies, campaigns, and executed actions for compliance with platform rules and ethical standards. Provide constructive feedback and recommendations for continuous improvement.",
)
groupchat = autogen.GroupChat(
agents=[user_proxy, developer, strategist, content_creator, campaign_manager, analytics_agent, bot_executor, auditor],
messages=[],
max_round=100 # Increased rounds for better flexibility
)
manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=gpt4_config)
user_proxy.initiate_chat(
manager,
message="""Create me an automated campaign for my social media account. Use the most optimal strategy to achieve maximum followers in minimal time while adhering to platform rules and ethical guidelines. Maximize automation using APIs and code.""",
) |