Spaces:
Running
Running
Create app.py
Browse filesAdded code for the Viz app
app.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flaml import autogen
|
2 |
+
|
3 |
+
# Set up configurations
|
4 |
+
config_list = autogen.config_list_from_json(
|
5 |
+
"OAI_CONFIG_LIST",
|
6 |
+
filter_dict={
|
7 |
+
"model": ["gpt4", "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-v0314"],
|
8 |
+
},
|
9 |
+
)
|
10 |
+
|
11 |
+
llm_config = {
|
12 |
+
"request_timeout": 600,
|
13 |
+
"seed": 42,
|
14 |
+
"config_list": config_list,
|
15 |
+
"temperature": 0,
|
16 |
+
}
|
17 |
+
|
18 |
+
# Construct agents
|
19 |
+
|
20 |
+
assistant = autogen.AssistantAgent(
|
21 |
+
name="assistant",
|
22 |
+
llm_config=llm_config
|
23 |
+
)
|
24 |
+
|
25 |
+
|
26 |
+
#USer proxy agent
|
27 |
+
|
28 |
+
user_proxy = autogen.UserProxyAgent(
|
29 |
+
name="user_proxy",
|
30 |
+
human_input_mode="NEVER",
|
31 |
+
max_consecutive_auto_reply=10,
|
32 |
+
is_termination_msg=lambda x: x.get("content", "").rstrip().endswith("TERMINATE"),
|
33 |
+
code_execution_config={
|
34 |
+
"work_dir": "coding",
|
35 |
+
"use_docker": False, # set to True or image name like "python:3" to use docker
|
36 |
+
},
|
37 |
+
)
|
38 |
+
|
39 |
+
#Example Task: Plot Chart
|
40 |
+
# Start a conversation
|
41 |
+
user_proxy.initiate_chat(
|
42 |
+
assistant,
|
43 |
+
message="""Plot a chart of NVIDIA and TESLA stock price gain YTD""",
|
44 |
+
)
|