PraisonAI 0.0.27__py3-none-any.whl → 0.0.31__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of PraisonAI might be problematic. Click here for more details.
- praisonai/chainlit_ui.py +158 -11
- praisonai/cli.py +2 -0
- praisonai/deploy.py +1 -1
- praisonai/inbuilt_tools/autogen_tools.py +5 -1
- {praisonai-0.0.27.dist-info → praisonai-0.0.31.dist-info}/METADATA +3 -3
- praisonai-0.0.31.dist-info/RECORD +16 -0
- praisonai-0.0.27.dist-info/RECORD +0 -16
- {praisonai-0.0.27.dist-info → praisonai-0.0.31.dist-info}/LICENSE +0 -0
- {praisonai-0.0.27.dist-info → praisonai-0.0.31.dist-info}/WHEEL +0 -0
- {praisonai-0.0.27.dist-info → praisonai-0.0.31.dist-info}/entry_points.txt +0 -0
praisonai/chainlit_ui.py
CHANGED
|
@@ -19,16 +19,73 @@ config_list = [
|
|
|
19
19
|
]
|
|
20
20
|
agent_file = "test.yaml"
|
|
21
21
|
|
|
22
|
+
actions=[
|
|
23
|
+
cl.Action(name="run", value="run", label="✅ Run"),
|
|
24
|
+
cl.Action(name="modify", value="modify", label="🔧 Modify"),
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
@cl.action_callback("run")
|
|
28
|
+
async def on_run(action):
|
|
29
|
+
await main(cl.Message(content=""))
|
|
30
|
+
|
|
31
|
+
@cl.action_callback("modify")
|
|
32
|
+
async def on_modify(action):
|
|
33
|
+
await cl.Message(content="Modify the agents and tools from below settings").send()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@cl.set_chat_profiles
|
|
37
|
+
async def set_profiles(current_user: cl.User):
|
|
38
|
+
return [
|
|
39
|
+
cl.ChatProfile(
|
|
40
|
+
name="Auto",
|
|
41
|
+
markdown_description="Automatically generate agents and tasks based on your input.",
|
|
42
|
+
starters=[
|
|
43
|
+
cl.Starter(
|
|
44
|
+
label="Create a movie script",
|
|
45
|
+
message="Create a movie script about a futuristic society where AI and humans coexist, focusing on the conflict and resolution between them. Start with an intriguing opening scene.",
|
|
46
|
+
icon="/public/movie.svg",
|
|
47
|
+
),
|
|
48
|
+
cl.Starter(
|
|
49
|
+
label="Design a fantasy world",
|
|
50
|
+
message="Design a detailed fantasy world with unique geography, cultures, and magical systems. Start by describing the main continent and its inhabitants.",
|
|
51
|
+
icon="/public/fantasy.svg",
|
|
52
|
+
),
|
|
53
|
+
cl.Starter(
|
|
54
|
+
label="Write a futuristic political thriller",
|
|
55
|
+
message="Write a futuristic political thriller involving a conspiracy within a global government. Start with a high-stakes meeting that sets the plot in motion.",
|
|
56
|
+
icon="/public/thriller.svg",
|
|
57
|
+
),
|
|
58
|
+
cl.Starter(
|
|
59
|
+
label="Develop a new board game",
|
|
60
|
+
message="Develop a new, innovative board game. Describe the game's objective, rules, and unique mechanics. Create a scenario to illustrate gameplay.",
|
|
61
|
+
icon="/public/game.svg",
|
|
62
|
+
),
|
|
63
|
+
]
|
|
64
|
+
),
|
|
65
|
+
cl.ChatProfile(
|
|
66
|
+
name="Manual",
|
|
67
|
+
markdown_description="Manually define your agents and tasks using a YAML file.",
|
|
68
|
+
),
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
|
|
22
72
|
@cl.on_chat_start
|
|
23
73
|
async def start_chat():
|
|
24
74
|
cl.user_session.set(
|
|
25
75
|
"message_history",
|
|
26
76
|
[{"role": "system", "content": "You are a helpful assistant."}],
|
|
27
77
|
)
|
|
78
|
+
|
|
79
|
+
# Create tools.py if it doesn't exist
|
|
80
|
+
if not os.path.exists("tools.py"):
|
|
81
|
+
with open("tools.py", "w") as f:
|
|
82
|
+
f.write("# Add your custom tools here\n")
|
|
83
|
+
|
|
28
84
|
settings = await cl.ChatSettings(
|
|
29
85
|
[
|
|
30
86
|
TextInput(id="Model", label="OpenAI - Model", initial=config_list[0]['model']),
|
|
31
87
|
TextInput(id="BaseUrl", label="OpenAI - Base URL", initial=config_list[0]['base_url']),
|
|
88
|
+
TextInput(id="ApiKey", label="OpenAI - API Key", initial=config_list[0]['api_key']),
|
|
32
89
|
Select(
|
|
33
90
|
id="Framework",
|
|
34
91
|
label="Framework",
|
|
@@ -37,7 +94,53 @@ async def start_chat():
|
|
|
37
94
|
),
|
|
38
95
|
]
|
|
39
96
|
).send()
|
|
40
|
-
|
|
97
|
+
cl.user_session.set("settings", settings)
|
|
98
|
+
chat_profile = cl.user_session.get("chat_profile")
|
|
99
|
+
if chat_profile=="Manual":
|
|
100
|
+
|
|
101
|
+
agent_file = "agents.yaml"
|
|
102
|
+
full_agent_file_path = os.path.abspath(agent_file) # Get full path
|
|
103
|
+
if os.path.exists(full_agent_file_path):
|
|
104
|
+
with open(full_agent_file_path, 'r') as f:
|
|
105
|
+
yaml_content = f.read()
|
|
106
|
+
msg = cl.Message(content=yaml_content, language="yaml")
|
|
107
|
+
await msg.send()
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
full_tools_file_path = os.path.abspath("tools.py") # Get full path
|
|
111
|
+
if os.path.exists(full_tools_file_path):
|
|
112
|
+
with open(full_tools_file_path, 'r') as f:
|
|
113
|
+
tools_content = f.read()
|
|
114
|
+
msg = cl.Message(content=tools_content, language="python")
|
|
115
|
+
await msg.send()
|
|
116
|
+
|
|
117
|
+
settings = await cl.ChatSettings(
|
|
118
|
+
[
|
|
119
|
+
TextInput(id="Model", label="OpenAI - Model", initial=config_list[0]['model']),
|
|
120
|
+
TextInput(id="BaseUrl", label="OpenAI - Base URL", initial=config_list[0]['base_url']),
|
|
121
|
+
TextInput(id="ApiKey", label="OpenAI - API Key", initial=config_list[0]['api_key']),
|
|
122
|
+
Select(
|
|
123
|
+
id="Framework",
|
|
124
|
+
label="Framework",
|
|
125
|
+
values=["crewai", "autogen"],
|
|
126
|
+
initial_index=0,
|
|
127
|
+
),
|
|
128
|
+
TextInput(id="agents", label="agents.yaml", initial=yaml_content, multiline=True),
|
|
129
|
+
TextInput(id="tools", label="tools.py", initial=tools_content, multiline=True),
|
|
130
|
+
]
|
|
131
|
+
).send()
|
|
132
|
+
cl.user_session.set("settings", settings)
|
|
133
|
+
|
|
134
|
+
res = await cl.AskActionMessage(
|
|
135
|
+
content="Pick an action!",
|
|
136
|
+
actions=actions,
|
|
137
|
+
).send()
|
|
138
|
+
if res and res.get("value") == "modify":
|
|
139
|
+
await cl.Message(content="Modify the agents and tools from below settings", actions=actions).send()
|
|
140
|
+
elif res and res.get("value") == "run":
|
|
141
|
+
await main(cl.Message(content="", actions=actions))
|
|
142
|
+
|
|
143
|
+
await on_settings_update(settings)
|
|
41
144
|
|
|
42
145
|
@cl.on_settings_update
|
|
43
146
|
async def on_settings_update(settings):
|
|
@@ -45,8 +148,20 @@ async def on_settings_update(settings):
|
|
|
45
148
|
global config_list, framework
|
|
46
149
|
config_list[0]['model'] = settings["Model"]
|
|
47
150
|
config_list[0]['base_url'] = settings["BaseUrl"]
|
|
151
|
+
config_list[0]['api_key'] = settings["ApiKey"]
|
|
152
|
+
os.environ["OPENAI_API_KEY"] = config_list[0]['api_key']
|
|
153
|
+
os.environ["OPENAI_MODEL_NAME"] = config_list[0]['model']
|
|
154
|
+
os.environ["OPENAI_API_BASE"] = config_list[0]['base_url']
|
|
48
155
|
framework = settings["Framework"]
|
|
49
|
-
|
|
156
|
+
|
|
157
|
+
if "agents" in settings:
|
|
158
|
+
with open("agents.yaml", "w") as f:
|
|
159
|
+
f.write(settings["agents"])
|
|
160
|
+
if "tools" in settings:
|
|
161
|
+
with open("tools.py", "w") as f:
|
|
162
|
+
f.write(settings["tools"])
|
|
163
|
+
|
|
164
|
+
print("Settings updated")
|
|
50
165
|
|
|
51
166
|
@cl.on_chat_resume
|
|
52
167
|
async def on_chat_resume(thread: ThreadDict):
|
|
@@ -59,20 +174,52 @@ async def on_chat_resume(thread: ThreadDict):
|
|
|
59
174
|
message_history.append({"role": "assistant", "content": message["content"]})
|
|
60
175
|
cl.user_session.set("message_history", message_history)
|
|
61
176
|
|
|
177
|
+
# @cl.step(type="tool")
|
|
178
|
+
# async def tool(data: Optional[str] = None, language: Optional[str] = None):
|
|
179
|
+
# return cl.Message(content=data, language=language)
|
|
180
|
+
|
|
62
181
|
@cl.on_message
|
|
63
182
|
async def main(message: cl.Message):
|
|
64
183
|
"""Run PraisonAI with the provided message as the topic."""
|
|
65
184
|
message_history = cl.user_session.get("message_history")
|
|
66
185
|
message_history.append({"role": "user", "content": message.content})
|
|
67
186
|
topic = message.content
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
187
|
+
chat_profile = cl.user_session.get("chat_profile")
|
|
188
|
+
|
|
189
|
+
if chat_profile == "Auto":
|
|
190
|
+
agent_file = "agents.yaml"
|
|
191
|
+
generator = AutoGenerator(topic=topic, agent_file=agent_file, framework=framework, config_list=config_list)
|
|
192
|
+
agent_file = generator.generate()
|
|
193
|
+
agents_generator = AgentsGenerator(agent_file, framework, config_list)
|
|
194
|
+
result = agents_generator.generate_crew_and_kickoff()
|
|
195
|
+
msg = cl.Message(content=result)
|
|
196
|
+
await msg.send()
|
|
197
|
+
message_history.append({"role": "assistant", "content": message.content})
|
|
198
|
+
else: # chat_profile == "Manual"
|
|
199
|
+
agent_file = "agents.yaml"
|
|
200
|
+
full_agent_file_path = os.path.abspath(agent_file) # Get full path
|
|
201
|
+
full_tools_file_path = os.path.abspath("tools.py")
|
|
202
|
+
if os.path.exists(full_agent_file_path):
|
|
203
|
+
with open(full_agent_file_path, 'r') as f:
|
|
204
|
+
yaml_content = f.read()
|
|
205
|
+
# tool_res = await tool()
|
|
206
|
+
msg_agents = cl.Message(content=yaml_content, language="yaml")
|
|
207
|
+
await msg_agents.send()
|
|
208
|
+
if os.path.exists(full_tools_file_path):
|
|
209
|
+
with open(full_tools_file_path, 'r') as f:
|
|
210
|
+
tools_content = f.read()
|
|
211
|
+
msg_tools = cl.Message(content=tools_content, language="python")
|
|
212
|
+
await msg_tools.send()
|
|
213
|
+
else:
|
|
214
|
+
# If the file doesn't exist, follow the same process as "Auto"
|
|
215
|
+
generator = AutoGenerator(topic=topic, agent_file=agent_file, framework=framework, config_list=config_list)
|
|
216
|
+
agent_file = generator.generate()
|
|
217
|
+
|
|
218
|
+
agents_generator = AgentsGenerator(agent_file, framework, config_list)
|
|
219
|
+
result = agents_generator.generate_crew_and_kickoff()
|
|
220
|
+
msg = cl.Message(content=result, actions=actions)
|
|
221
|
+
await msg.send()
|
|
222
|
+
message_history.append({"role": "assistant", "content": message.content})
|
|
76
223
|
|
|
77
224
|
# Load environment variables from .env file
|
|
78
225
|
load_dotenv()
|
|
@@ -90,4 +237,4 @@ def auth_callback(username: str, password: str):
|
|
|
90
237
|
identifier=username, metadata={"role": "ADMIN", "provider": "credentials"}
|
|
91
238
|
)
|
|
92
239
|
else:
|
|
93
|
-
return None
|
|
240
|
+
return None
|
praisonai/cli.py
CHANGED
praisonai/deploy.py
CHANGED
|
@@ -56,7 +56,7 @@ class CloudDeployer:
|
|
|
56
56
|
file.write("FROM python:3.11-slim\n")
|
|
57
57
|
file.write("WORKDIR /app\n")
|
|
58
58
|
file.write("COPY . .\n")
|
|
59
|
-
file.write("RUN pip install flask praisonai==0.0.
|
|
59
|
+
file.write("RUN pip install flask praisonai==0.0.31 gunicorn markdown\n")
|
|
60
60
|
file.write("EXPOSE 8080\n")
|
|
61
61
|
file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
|
|
62
62
|
|
|
@@ -166,7 +166,11 @@ def autogen_ScrapeWebsiteTool(assistant, user_proxy):
|
|
|
166
166
|
def register_scrape_website_tool(tool_class, tool_name, tool_description, assistant, user_proxy):
|
|
167
167
|
def tool_func(website_url: str) -> Any:
|
|
168
168
|
tool_instance = tool_class(website_url=website_url)
|
|
169
|
-
|
|
169
|
+
content = tool_instance.run()
|
|
170
|
+
# Ensure content is properly decoded as UTF-8 if it's a bytes object
|
|
171
|
+
if isinstance(content, bytes):
|
|
172
|
+
content = content.decode('utf-8')
|
|
173
|
+
return content
|
|
170
174
|
register_function(tool_func, caller=assistant, executor=user_proxy, name=tool_name, description=tool_description)
|
|
171
175
|
register_scrape_website_tool(ScrapeWebsiteTool, "scrape_website_tool", "Read website content(website_url: 'string') - A tool that can be used to read content from a specified website.", assistant, user_proxy)
|
|
172
176
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PraisonAI
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.31
|
|
4
4
|
Summary: PraisonAI application combines AutoGen and CrewAI or similar frameworks into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customization, and efficient human-agent collaboration.
|
|
5
5
|
Author: Mervin Praison
|
|
6
6
|
Requires-Python: >=3.10,<3.13
|
|
@@ -8,13 +8,13 @@ Classifier: Programming Language :: Python :: 3
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3.10
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.11
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Provides-Extra: api
|
|
11
12
|
Provides-Extra: gradio
|
|
12
13
|
Provides-Extra: ui
|
|
13
|
-
Requires-Dist: Flask (>=3.0.0)
|
|
14
|
-
Requires-Dist: blinker (>=1.8.2)
|
|
15
14
|
Requires-Dist: chainlit (>=1.1.301,<2.0.0) ; extra == "ui"
|
|
16
15
|
Requires-Dist: crewai (>=0.30.4)
|
|
17
16
|
Requires-Dist: crewai-tools (>=0.2.6,<0.3.0)
|
|
17
|
+
Requires-Dist: flask (>=3.0.0) ; extra == "api"
|
|
18
18
|
Requires-Dist: gradio (>=4.26.0) ; extra == "gradio"
|
|
19
19
|
Requires-Dist: markdown (>=3.5)
|
|
20
20
|
Requires-Dist: praisonai-tools (>=0.0.4)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
praisonai/__init__.py,sha256=5SwxMGd4vNUmYedF_HLLQBo4u8zMEWuEfKhHqJrEE1I,59
|
|
2
|
+
praisonai/__main__.py,sha256=MVgsjMThjBexHt4nhd760JCqvP4x0IQcwo8kULOK4FQ,144
|
|
3
|
+
praisonai/agents_generator.py,sha256=blzU5uru7rctRUTlnxEER9NLyu4aAd-oUjE-0xo81ww,12787
|
|
4
|
+
praisonai/auto.py,sha256=CpE9zUbdCP1wR0aLZWKVLxiLU9JOQprRNBK9WKDZVQo,7758
|
|
5
|
+
praisonai/chainlit_ui.py,sha256=nzm_C8MpiocAlSfyA3lgERCGxzpEfvoROREBTNrDe5A,10239
|
|
6
|
+
praisonai/cli.py,sha256=-ikeUf2NUCVvme37X7HwtaDop5ck2Fx802J-Q7b4cyg,10090
|
|
7
|
+
praisonai/deploy.py,sha256=WXvq-jRw5aXw0ZOfD3w0vaZ-1Ajl5NQFtuNiBsjaItM,6031
|
|
8
|
+
praisonai/inbuilt_tools/__init__.py,sha256=mUKnbL6Gram9c9f2m8wJwEzURBLmPEOcHzwySBH89YA,74
|
|
9
|
+
praisonai/inbuilt_tools/autogen_tools.py,sha256=AY-6Vc4l2KsUlqm1Z--YqK1Ji-8q0YyaCAOxx1j5seE,14761
|
|
10
|
+
praisonai/test.py,sha256=RZKq3UEFb6AnFFiHER3zBXfNmlteSLBlrTmOvnpnZLo,4092
|
|
11
|
+
praisonai/version.py,sha256=ugyuFliEqtAwQmH4sTlc16YXKYbFWDmfyk87fErB8-8,21
|
|
12
|
+
praisonai-0.0.31.dist-info/LICENSE,sha256=kqvFysVlnFxYOu0HxCe2HlmZmJtdmNGOxWRRkT9TsWc,1035
|
|
13
|
+
praisonai-0.0.31.dist-info/METADATA,sha256=DQrY-6SgEilNJlNIPwYGDbLOCfLlc5cgVzf-zpHDbO4,9556
|
|
14
|
+
praisonai-0.0.31.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
15
|
+
praisonai-0.0.31.dist-info/entry_points.txt,sha256=Qg41eW3A1-dvdV5tF7LqChfYof8Rihk2rN1fiEE3vnk,53
|
|
16
|
+
praisonai-0.0.31.dist-info/RECORD,,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
praisonai/__init__.py,sha256=5SwxMGd4vNUmYedF_HLLQBo4u8zMEWuEfKhHqJrEE1I,59
|
|
2
|
-
praisonai/__main__.py,sha256=MVgsjMThjBexHt4nhd760JCqvP4x0IQcwo8kULOK4FQ,144
|
|
3
|
-
praisonai/agents_generator.py,sha256=blzU5uru7rctRUTlnxEER9NLyu4aAd-oUjE-0xo81ww,12787
|
|
4
|
-
praisonai/auto.py,sha256=CpE9zUbdCP1wR0aLZWKVLxiLU9JOQprRNBK9WKDZVQo,7758
|
|
5
|
-
praisonai/chainlit_ui.py,sha256=GO_ZQAp6e4sGaoVr0gb0nQxPIY_3YrLgfsh5CnYa_So,3605
|
|
6
|
-
praisonai/cli.py,sha256=_KB_12VoYFSLywFqE0kfbkM76e3DNRK9eeWsFlnfANc,10021
|
|
7
|
-
praisonai/deploy.py,sha256=bF66kXQQPzCyFLNY3l50k27rlwdB1yLtnaHu0BV2o5E,6031
|
|
8
|
-
praisonai/inbuilt_tools/__init__.py,sha256=mUKnbL6Gram9c9f2m8wJwEzURBLmPEOcHzwySBH89YA,74
|
|
9
|
-
praisonai/inbuilt_tools/autogen_tools.py,sha256=m3Ws2444hzgkiEjqw9Y4PFb_LsU9ZDD23C03uNsyeu0,14556
|
|
10
|
-
praisonai/test.py,sha256=RZKq3UEFb6AnFFiHER3zBXfNmlteSLBlrTmOvnpnZLo,4092
|
|
11
|
-
praisonai/version.py,sha256=ugyuFliEqtAwQmH4sTlc16YXKYbFWDmfyk87fErB8-8,21
|
|
12
|
-
praisonai-0.0.27.dist-info/LICENSE,sha256=kqvFysVlnFxYOu0HxCe2HlmZmJtdmNGOxWRRkT9TsWc,1035
|
|
13
|
-
praisonai-0.0.27.dist-info/METADATA,sha256=qDqdMkIFJo3jDHWEpDoW9Zf5S_8w0fJcFwHIYLatw2I,9552
|
|
14
|
-
praisonai-0.0.27.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
15
|
-
praisonai-0.0.27.dist-info/entry_points.txt,sha256=Qg41eW3A1-dvdV5tF7LqChfYof8Rihk2rN1fiEE3vnk,53
|
|
16
|
-
praisonai-0.0.27.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|