-
Notifications
You must be signed in to change notification settings - Fork 3
/
test6.py
53 lines (47 loc) · 1.39 KB
/
test6.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from PIL import Image, ImageDraw, ImageFont
from IPython import get_ipython
import autogen
from dotenv import load_dotenv
import os
import openai
load_dotenv()
# Get the API key
OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')
# Set the API key
openai.api_key = OPENAI_API_KEY
config_list = autogen.config_list_from_json(
"OAI_CONFIG_LIST",
filter_dict={
"model": ["gpt-3.5-turbo"],
},
)
llm_config = {
"request_timeout": 600,
"seed": 42,
"config_list": config_list,
"temperature": 0,
}
assistant = autogen.AssistantAgent(
name="assistant",
llm_config=llm_config,
)
# create a UserProxyAgent instance named "user_proxy"
user_proxy = autogen.UserProxyAgent(
name="user_proxy",
human_input_mode="TERMINATE",
max_consecutive_auto_reply=10,
is_termination_msg=lambda x: x.get(
"content", "").rstrip().endswith("TERMINATE"),
code_execution_config={"work_dir": "web"},
llm_config=llm_config,
system_message="""Reply TERMINATE if the task has been solved at full satisfaction.
Otherwise, reply CONTINUE, or the reason why the task is not solved yet."""
)
# the assistant receives a message from the user, which contains the task description
user_proxy.initiate_chat(
assistant,
message="""
find the cutest golden retreiver image and use that image to generate a html page for bob,
and write a birthday poem in the style of kanye west
""",
)