AutoGen : 여러 Agent 사용해 LLM Application 제작을 돕는 프레임워크
Contents
Assistant Agent
from autogen import AssistantAgent, UserProxyAgentllm_config = {"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}assistant = AssistantAgent("assistant", llm_config=llm_config)user_proxy = UserProxyAgent("user_proxy", code_execution_config=False)# Start the chatuser_proxy.initiate_chat( assistant, message="Tell me a joke.",)
ConversableAgent : 대화 가능한 Agent
import osfrom autogen import ConversableAgentcathy = ConversableAgent( "cathy", system_message="Your name is Cathy and you are a part of a duo of comedians.", llm_config={"config_list": [{"model": "gpt-4", "temperature": 0.9, "api_key": os.environ.get("OPENAI_API_KEY")}]}, human_input_mode="NEVER", # Never ask for human input.)joe = ConversableAgent( "joe", system_message="Your name is Joe and you are a part of a duo of comedians.", llm_config={"config_list": [{"model": "gpt-4", "temperature": 0.7, "api_key": os.environ.get("OPENAI_API_KEY")}]}, human_input_mode="NEVER", # Never ask for human input.)result = joe.initiate_chat(cathy, message="Cathy, tell me a joke.", max_turns=2)