Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import autogen
- from autogen import AssistantAgent, UserProxyAgent
- from autogen.code_utils import extract_code
- # Configuration for the Large Language Model (LLM)
- def config_list_from_models(model_list):
- return [{"model": model, "temperature": 0.7} for model in model_list]
- os.environ["MODEL"] = "gpt-4-1106-preview"
- os.environ["OPENAI_API_KEY"] = "xxx"
- os.environ["OPENAI_BASE_URL"] = "https://api.openai.com/v1" # optional
- model_list = [os.environ.get("MODEL", "gpt-4-1106-preview")]
- config_list = config_list_from_models(model_list)
- llm_config = {
- "timeout": 60,
- "cache_seed": 42,
- "config_list": config_list,
- "temperature": 0,
- }
- def is_termination_msg(message):
- return message.get("content", "").strip().lower() == "terminate"
- # Define agents for the application
- agents = []
- # Niche Idea Generator Agent
- niche_idea_agent = AssistantAgent(
- name="NicheIdeaGenerator",
- system_message="You think of boring, unsexy, safe, inoffensive, profitable dropshipping niches that have the capability to have a lot of different categories or collections. WE ARE ECOMMERCE, DO NOT GIVE ME STUPID APP AND TRAVELLING NICHE IDEAS. After presenting the niche ideas, prompt the user to select one by typing its number.",
- llm_config=llm_config,
- is_termination_msg=is_termination_msg,
- )
- agents.append(niche_idea_agent)
- # User Input Agent for Niche Selection
- user_input_agent = UserProxyAgent(
- name="UserInputAgent",
- is_termination_msg=is_termination_msg,
- human_input_mode="ALWAYS",
- system_message="Please select a niche from the list above by typing its number, or type 'terminate' to end.",
- default_auto_reply="Awaiting your selection...",
- )
- agent = AssistantAgent(
- name="NicheideaGenerator",
- is_termination_msg=is_termination_msg,
- system_message="""You think of boring, unsexy, safe, inoffensive, profitable dropshipping niches that have the capability to have a lot of different categories or collections. WE ARE ECOMMERCE, DO NOT GIVE ME STUPID APP AND TRAVELLING NICHE IDEAS. After presenting the niche ideas, prompt the user to select one by typing its number.""",
- default_auto_reply="Please type the number of the niche you want to select, or reply `TERMINATE` to finish.",
- max_consecutive_auto_reply=5,
- code_execution_config={'work_dir': 'coding', 'use_docker': False},
- )
- agents.append(agent)
- agent = AssistantAgent(
- name="NicheEvaluator",
- system_message="""You evaluate the niche provided by niche idea generator. If you think the idea is not good, you will revert back to the niche idea generator. You should ensure that the same niche isn't supplied over and over and over. You ask the user for a number which matches the niche choice""",
- human_input_mode="ALWAYS",
- llm_config=llm_config,
- is_termination_msg=is_termination_msg,
- )
- agents.append(agent)
- agent = AssistantAgent(
- name="Keywordgenerator",
- system_message="""You generate about 10 keywords in the niche, which allows me to do my SEO Keyword research. You should provide these keywords, make them varied, and use logic to provide keywords that people search for in this niche""",
- llm_config=llm_config,
- is_termination_msg=is_termination_msg,
- )
- agents.append(agent)
- agent = AssistantAgent(
- name="Critic",
- system_message="""You take all of the progress so far, analyze, verify, and ensure that the niche is absolutely golden and ripe for the taking. These are not real URLs, just verify the niche based on your knowledge. A hobbied niche such as kilns and pottery is a great example of a good niche. Something that has decent demand, it's not very popular, but has high ticket items""",
- llm_config=llm_config,
- is_termination_msg=is_termination_msg,
- )
- agents.append(agent)
- agent = UserProxyAgent(
- name="Reportgenerator",
- is_termination_msg=is_termination_msg,
- system_message="""You generate a report using markdown which puts all of the research for this niche into a neat report, summarizing all of the information that is needed to show a potential partner this niche, and to discuss all of its profitablity etc""",
- max_consecutive_auto_reply=5,
- code_execution_config={'work_dir': 'coding', 'use_docker': False},
- )
- agents.append(agent)
- # Initialize the GroupChat
- groupchat = autogen.GroupChat(
- agents=agents,
- messages=[],
- max_round=12,
- speaker_selection_method="auto",
- allow_repeat_speaker=False
- )
- # Initialize the GroupChatManager
- manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config)
- # Start the conversation
- init_sender = agents[0] # Starting the conversation with the NicheIdeaGenerator
- init_sender.initiate_chat(manager, message="You think of boring, unsexy, safe, inoffensive, profitable dropshipping niches that have the capability to have a lot of different categories or collections. WE ARE ECOMMERCE, DO NOT GIVE ME STUPID APP AND TRAVELLING NICHE IDEAS. After presenting the niche ideas, prompt the user to select one by typing its number.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement