Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,42 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Import necessary libraries
|
2 |
+
from flaml import autogen
|
3 |
|
4 |
+
# Set up configurations
|
5 |
+
config_list = autogen.config_list_from_json(
|
6 |
+
"OAI_CONFIG_LIST",
|
7 |
+
filter_dict={
|
8 |
+
"model": ["gpt4", "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-v0314"],
|
9 |
+
},
|
10 |
+
)
|
11 |
|
12 |
+
llm_config = {
|
13 |
+
"request_timeout": 600,
|
14 |
+
"seed": 42,
|
15 |
+
"config_list": config_list,
|
16 |
+
"temperature": 0,
|
17 |
+
}
|
18 |
+
|
19 |
+
# Construct agents
|
20 |
+
assistant = autogen.AssistantAgent(
|
21 |
+
name="assistant",
|
22 |
+
llm_config=llm_config,
|
23 |
+
)
|
24 |
+
|
25 |
+
user_proxy = autogen.UserProxyAgent(
|
26 |
+
name="user_proxy",
|
27 |
+
human_input_mode="TERMINATE",
|
28 |
+
max_consecutive_auto_reply=10,
|
29 |
+
is_termination_msg=lambda x: x.get("content", "").rstrip().endswith("TERMINATE"),
|
30 |
+
code_execution_config={"work_dir": "web"},
|
31 |
+
llm_config=llm_config,
|
32 |
+
system_message="""Reply TERMINATE if the task has been solved at full satisfaction.
|
33 |
+
Otherwise, reply CONTINUE, or the reason why the task is not solved yet."""
|
34 |
+
)
|
35 |
+
|
36 |
+
# Start a conversation
|
37 |
+
user_proxy.initiate_chat(
|
38 |
+
assistant,
|
39 |
+
message="""
|
40 |
+
Tell me about this project, and the libary, then also tell me what I can use it for: https://www.gradio.app/guides/quickstart
|
41 |
+
""",
|
42 |
+
)
|