PraisonAI 0.0.22__tar.gz → 0.0.24__tar.gz
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-0.0.22 → praisonai-0.0.24}/PKG-INFO +4 -2
- praisonai-0.0.24/praisonai/chainlit_ui.py +67 -0
- {praisonai-0.0.22 → praisonai-0.0.24}/praisonai/cli.py +77 -40
- {praisonai-0.0.22 → praisonai-0.0.24}/praisonai/deploy.py +1 -1
- {praisonai-0.0.22 → praisonai-0.0.24}/pyproject.toml +7 -3
- {praisonai-0.0.22 → praisonai-0.0.24}/LICENSE +0 -0
- {praisonai-0.0.22 → praisonai-0.0.24}/README.md +0 -0
- {praisonai-0.0.22 → praisonai-0.0.24}/praisonai/__init__.py +0 -0
- {praisonai-0.0.22 → praisonai-0.0.24}/praisonai/__main__.py +0 -0
- {praisonai-0.0.22 → praisonai-0.0.24}/praisonai/agents_generator.py +0 -0
- {praisonai-0.0.22 → praisonai-0.0.24}/praisonai/auto.py +0 -0
- {praisonai-0.0.22 → praisonai-0.0.24}/praisonai/inbuilt_tools/__init__.py +0 -0
- {praisonai-0.0.22 → praisonai-0.0.24}/praisonai/inbuilt_tools/autogen_tools.py +0 -0
- {praisonai-0.0.22 → praisonai-0.0.24}/praisonai/test.py +0 -0
- {praisonai-0.0.22 → praisonai-0.0.24}/praisonai/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PraisonAI
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.24
|
|
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,10 +8,12 @@ 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: chainlit
|
|
12
|
+
Provides-Extra: gradio
|
|
13
|
+
Provides-Extra: ui
|
|
11
14
|
Requires-Dist: Flask (>=3.0.0)
|
|
12
15
|
Requires-Dist: crewai (>=0.30.4)
|
|
13
16
|
Requires-Dist: crewai-tools (>=0.2.6,<0.3.0)
|
|
14
|
-
Requires-Dist: gradio (>=4.20.0)
|
|
15
17
|
Requires-Dist: markdown (>=3.5)
|
|
16
18
|
Requires-Dist: praisonai-tools (>=0.0.4)
|
|
17
19
|
Requires-Dist: pyautogen (>=0.2.19)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
from praisonai.agents_generator import AgentsGenerator
|
|
2
|
+
from praisonai.auto import AutoGenerator
|
|
3
|
+
import chainlit as cl
|
|
4
|
+
import os
|
|
5
|
+
from chainlit.types import ThreadDict
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from dotenv import load_dotenv
|
|
8
|
+
|
|
9
|
+
framework = "crewai"
|
|
10
|
+
config_list = [
|
|
11
|
+
{
|
|
12
|
+
'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4o"),
|
|
13
|
+
'base_url': os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1"),
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
agent_file = "test.yaml"
|
|
17
|
+
|
|
18
|
+
@cl.on_chat_start
|
|
19
|
+
async def start_chat():
|
|
20
|
+
cl.user_session.set(
|
|
21
|
+
"message_history",
|
|
22
|
+
[{"role": "system", "content": "You are a helpful assistant."}],
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
@cl.on_chat_resume
|
|
26
|
+
async def on_chat_resume(thread: ThreadDict):
|
|
27
|
+
message_history = cl.user_session.get("message_history", [])
|
|
28
|
+
root_messages = [m for m in thread["steps"] if m["parentId"] is None]
|
|
29
|
+
for message in root_messages:
|
|
30
|
+
if message["type"] == "user_message":
|
|
31
|
+
message_history.append({"role": "user", "content": message["output"]})
|
|
32
|
+
elif message["type"] == "ai_message":
|
|
33
|
+
message_history.append({"role": "assistant", "content": message["content"]})
|
|
34
|
+
cl.user_session.set("message_history", message_history)
|
|
35
|
+
|
|
36
|
+
@cl.on_message
|
|
37
|
+
async def main(message: cl.Message):
|
|
38
|
+
"""Run PraisonAI with the provided message as the topic."""
|
|
39
|
+
message_history = cl.user_session.get("message_history")
|
|
40
|
+
message_history.append({"role": "user", "content": message.content})
|
|
41
|
+
topic = message.content
|
|
42
|
+
agent_file = "test.yaml"
|
|
43
|
+
generator = AutoGenerator(topic=topic, framework=framework)
|
|
44
|
+
agent_file = generator.generate()
|
|
45
|
+
agents_generator = AgentsGenerator(agent_file, framework, config_list)
|
|
46
|
+
result = agents_generator.generate_crew_and_kickoff()
|
|
47
|
+
msg = cl.Message(content=result)
|
|
48
|
+
await msg.send()
|
|
49
|
+
message_history.append({"role": "assistant", "content": message.content})
|
|
50
|
+
|
|
51
|
+
# Load environment variables from .env file
|
|
52
|
+
load_dotenv()
|
|
53
|
+
|
|
54
|
+
# Get username and password from environment variables
|
|
55
|
+
username = os.getenv("CHAINLIT_USERNAME", "admin") # Default to "admin" if not found
|
|
56
|
+
password = os.getenv("CHAINLIT_PASSWORD", "admin") # Default to "admin" if not found
|
|
57
|
+
|
|
58
|
+
@cl.password_auth_callback
|
|
59
|
+
def auth_callback(username: str, password: str):
|
|
60
|
+
# Fetch the user matching username from your database
|
|
61
|
+
# and compare the hashed password with the value stored in the database
|
|
62
|
+
if (username, password) == ("admin", "admin"):
|
|
63
|
+
return cl.User(
|
|
64
|
+
identifier="admin", metadata={"role": "admin", "provider": "credentials"}
|
|
65
|
+
)
|
|
66
|
+
else:
|
|
67
|
+
return None
|
|
@@ -14,6 +14,18 @@ from .auto import AutoGenerator
|
|
|
14
14
|
from .agents_generator import AgentsGenerator
|
|
15
15
|
from .inbuilt_tools import *
|
|
16
16
|
|
|
17
|
+
try:
|
|
18
|
+
from chainlit.cli import chainlit_run
|
|
19
|
+
CHAINLIT_AVAILABLE = True
|
|
20
|
+
except ImportError:
|
|
21
|
+
CHAINLIT_AVAILABLE = False
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
import gradio as gr
|
|
25
|
+
GRADIO_AVAILABLE = True
|
|
26
|
+
except ImportError:
|
|
27
|
+
GRADIO_AVAILABLE = False
|
|
28
|
+
|
|
17
29
|
class PraisonAI:
|
|
18
30
|
def __init__(self, agent_file="agents.yaml", framework="", auto=False, init=False):
|
|
19
31
|
"""
|
|
@@ -72,9 +84,8 @@ class PraisonAI:
|
|
|
72
84
|
|
|
73
85
|
self.framework = args.framework or self.framework
|
|
74
86
|
|
|
75
|
-
ui = args.ui
|
|
76
87
|
if args.agent_file:
|
|
77
|
-
if args.agent_file.startswith("tests.test"): # Argument used for testing purposes
|
|
88
|
+
if args.agent_file.startswith("tests.test"): # Argument used for testing purposes. eg: python -m unittest tests.test
|
|
78
89
|
print("test")
|
|
79
90
|
else:
|
|
80
91
|
self.agent_file = args.agent_file
|
|
@@ -100,8 +111,16 @@ class PraisonAI:
|
|
|
100
111
|
print("File {} created successfully".format(self.agent_file))
|
|
101
112
|
return "File {} created successfully".format(self.agent_file)
|
|
102
113
|
|
|
103
|
-
if ui:
|
|
104
|
-
|
|
114
|
+
if args.ui:
|
|
115
|
+
if args.ui == "gradio":
|
|
116
|
+
self.create_gradio_interface()
|
|
117
|
+
elif args.ui == "chainlit":
|
|
118
|
+
self.create_chainlit_interface()
|
|
119
|
+
else:
|
|
120
|
+
# Modify below code to allow default ui
|
|
121
|
+
agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list)
|
|
122
|
+
result = agents_generator.generate_crew_and_kickoff()
|
|
123
|
+
return result
|
|
105
124
|
else:
|
|
106
125
|
agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list)
|
|
107
126
|
result = agents_generator.generate_crew_and_kickoff()
|
|
@@ -126,12 +145,11 @@ class PraisonAI:
|
|
|
126
145
|
"""
|
|
127
146
|
parser = argparse.ArgumentParser(prog="praisonai", description="praisonAI command-line interface")
|
|
128
147
|
parser.add_argument("--framework", choices=["crewai", "autogen"], help="Specify the framework")
|
|
129
|
-
parser.add_argument("--ui",
|
|
148
|
+
parser.add_argument("--ui", choices=["chainlit", "gradio"], help="Specify the UI framework (gradio or chainlit).")
|
|
130
149
|
parser.add_argument("--auto", nargs=argparse.REMAINDER, help="Enable auto mode and pass arguments for it")
|
|
131
150
|
parser.add_argument("--init", nargs=argparse.REMAINDER, help="Enable auto mode and pass arguments for it")
|
|
132
151
|
parser.add_argument("agent_file", nargs="?", help="Specify the agent file")
|
|
133
152
|
parser.add_argument("--deploy", action="store_true", help="Deploy the application") # New argument
|
|
134
|
-
|
|
135
153
|
args, unknown_args = parser.parse_known_args()
|
|
136
154
|
|
|
137
155
|
if unknown_args and unknown_args[0] == '-b' and unknown_args[1] == 'api:app':
|
|
@@ -157,42 +175,61 @@ class PraisonAI:
|
|
|
157
175
|
Example:
|
|
158
176
|
>>> praison_ai.create_gradio_interface()
|
|
159
177
|
"""
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
178
|
+
if GRADIO_AVAILABLE:
|
|
179
|
+
def generate_crew_and_kickoff_interface(auto_args, framework):
|
|
180
|
+
"""
|
|
181
|
+
Generate a crew and kick off tasks based on the provided auto arguments and framework.
|
|
182
|
+
|
|
183
|
+
Args:
|
|
184
|
+
auto_args (list): Topic.
|
|
185
|
+
framework (str): The framework to use for generating agents.
|
|
186
|
+
|
|
187
|
+
Returns:
|
|
188
|
+
str: A string representing the result of generating the crew and kicking off tasks.
|
|
189
|
+
|
|
190
|
+
Raises:
|
|
191
|
+
None: This method does not raise any exceptions.
|
|
192
|
+
|
|
193
|
+
Example:
|
|
194
|
+
>>> result = generate_crew_and_kickoff_interface("Create a movie about Cat in Mars", "crewai")
|
|
195
|
+
>>> print(result)
|
|
196
|
+
"""
|
|
197
|
+
self.framework = framework
|
|
198
|
+
self.agent_file = "test.yaml"
|
|
199
|
+
generator = AutoGenerator(topic=auto_args , framework=self.framework)
|
|
200
|
+
self.agent_file = generator.generate()
|
|
201
|
+
agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list)
|
|
202
|
+
result = agents_generator.generate_crew_and_kickoff()
|
|
203
|
+
return result
|
|
204
|
+
|
|
205
|
+
gr.Interface(
|
|
206
|
+
fn=generate_crew_and_kickoff_interface,
|
|
207
|
+
inputs=[gr.Textbox(lines=2, label="Auto Args"), gr.Dropdown(choices=["crewai", "autogen"], label="Framework")],
|
|
208
|
+
outputs="textbox",
|
|
209
|
+
title="Praison AI Studio",
|
|
210
|
+
description="Create Agents and perform tasks",
|
|
211
|
+
theme="default"
|
|
212
|
+
).launch()
|
|
213
|
+
else:
|
|
214
|
+
print("ERROR: Gradio is not installed. Please install it with 'pip install \"praisonai[gradio]\"' to use this feature.")
|
|
215
|
+
|
|
216
|
+
def create_chainlit_interface(self):
|
|
217
|
+
"""
|
|
218
|
+
Create a Chainlit interface for generating agents and performing tasks.
|
|
170
219
|
|
|
171
|
-
|
|
172
|
-
|
|
220
|
+
This function sets up a Chainlit application that listens for messages.
|
|
221
|
+
When a message is received, it runs PraisonAI with the provided message as the topic.
|
|
222
|
+
The generated agents are then used to perform tasks.
|
|
173
223
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list)
|
|
183
|
-
result = agents_generator.generate_crew_and_kickoff()
|
|
184
|
-
return result
|
|
185
|
-
|
|
186
|
-
gr.Interface(
|
|
187
|
-
fn=generate_crew_and_kickoff_interface,
|
|
188
|
-
inputs=[gr.Textbox(lines=2, label="Auto Args"), gr.Dropdown(choices=["crewai", "autogen"], label="Framework")],
|
|
189
|
-
outputs="textbox",
|
|
190
|
-
title="Praison AI Studio",
|
|
191
|
-
description="Create Agents and perform tasks",
|
|
192
|
-
theme="default"
|
|
193
|
-
).launch()
|
|
224
|
+
Returns:
|
|
225
|
+
None: This function does not return any value. It starts the Chainlit application.
|
|
226
|
+
"""
|
|
227
|
+
if CHAINLIT_AVAILABLE:
|
|
228
|
+
os.environ["CHAINLIT_PORT"] = "8082"
|
|
229
|
+
chainlit_run(["praisonai/chainlit_ui.py"])
|
|
230
|
+
else:
|
|
231
|
+
print("ERROR: Chainlit is not installed. Please install it with 'pip install \"praisonai\[ui]\"' to use the UI.")
|
|
194
232
|
|
|
195
233
|
if __name__ == "__main__":
|
|
196
234
|
praison_ai = PraisonAI()
|
|
197
|
-
praison_ai.main()
|
|
198
|
-
|
|
235
|
+
praison_ai.main()
|
|
@@ -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.24 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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "PraisonAI"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.24"
|
|
4
4
|
description = "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
|
authors = ["Mervin Praison"]
|
|
6
6
|
license = ""
|
|
@@ -18,7 +18,6 @@ python = ">=3.10,<3.13"
|
|
|
18
18
|
rich = ">=13.7"
|
|
19
19
|
pyautogen = ">=0.2.19"
|
|
20
20
|
crewai = ">=0.30.4"
|
|
21
|
-
gradio = ">=4.20.0"
|
|
22
21
|
Flask = ">=3.0.0"
|
|
23
22
|
markdown = ">=3.5"
|
|
24
23
|
crewai-tools = "^0.2.6"
|
|
@@ -33,4 +32,9 @@ requires = ["poetry-core"]
|
|
|
33
32
|
build-backend = "poetry.core.masonry.api"
|
|
34
33
|
|
|
35
34
|
[tool.poetry.scripts]
|
|
36
|
-
praisonai = "praisonai.__main__:main"
|
|
35
|
+
praisonai = "praisonai.__main__:main"
|
|
36
|
+
|
|
37
|
+
[tool.poetry.extras]
|
|
38
|
+
ui = ["chainlit"]
|
|
39
|
+
chainlit = ["chainlit"]
|
|
40
|
+
gradio = ["gradio"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|