-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathautogen_test.py
36 lines (29 loc) · 1.08 KB
/
autogen_test.py
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
"""
This is a basic autogen example.
"""
# filename: autonomous_agents_integration.py
from autogen import AssistantAgent, UserProxyAgent, config_list_from_json
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
# Load LLM configuration from environment or a file
config_list = config_list_from_json(env_or_file="OAI_CONFIG_LIST.json")
llm_config = {"config_list": config_list}
# Create an AssistantAgent instance
assistant = AssistantAgent(
name="assistant",
llm_config=llm_config,
)
# Create a UserProxyAgent instance with autonomous settings
user_proxy = UserProxyAgent(
name="user_proxy",
human_input_mode="NEVER", # No human input will be solicited
max_consecutive_auto_reply=10, # Maximum number of consecutive auto-replies
code_execution_config={"work_dir": "working"}, # Working directory for code execution
llm_config=llm_config, # LLM configuration for generating replies
)
# Initiate a conversation with a task description
user_proxy.initiate_chat(
assistant,
message="Please execute a python script that prints 10 dad jokes.",
)