PraisonAI 0.0.23__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PraisonAI
3
- Version: 0.0.23
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.26.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)
@@ -4,6 +4,7 @@ import chainlit as cl
4
4
  import os
5
5
  from chainlit.types import ThreadDict
6
6
  from typing import Optional
7
+ from dotenv import load_dotenv
7
8
 
8
9
  framework = "crewai"
9
10
  config_list = [
@@ -47,6 +48,13 @@ async def main(message: cl.Message):
47
48
  await msg.send()
48
49
  message_history.append({"role": "assistant", "content": message.content})
49
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
+
50
58
  @cl.password_auth_callback
51
59
  def auth_callback(username: str, password: str):
52
60
  # Fetch the user matching username from your database
@@ -9,16 +9,23 @@ from crewai import Agent, Task, Crew
9
9
  load_dotenv()
10
10
  import autogen
11
11
  import gradio as gr
12
- import chainlit as cl
13
- import asyncio
14
- import uvicorn
15
- from chainlit.cli import cli as chainlit_cli
16
- from chainlit.server import app
17
12
  import argparse
18
13
  from .auto import AutoGenerator
19
14
  from .agents_generator import AgentsGenerator
20
15
  from .inbuilt_tools import *
21
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
+
22
29
  class PraisonAI:
23
30
  def __init__(self, agent_file="agents.yaml", framework="", auto=False, init=False):
24
31
  """
@@ -110,7 +117,10 @@ class PraisonAI:
110
117
  elif args.ui == "chainlit":
111
118
  self.create_chainlit_interface()
112
119
  else:
113
- self.create_chainlit_interface()
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
114
124
  else:
115
125
  agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list)
116
126
  result = agents_generator.generate_crew_and_kickoff()
@@ -135,7 +145,7 @@ class PraisonAI:
135
145
  """
136
146
  parser = argparse.ArgumentParser(prog="praisonai", description="praisonAI command-line interface")
137
147
  parser.add_argument("--framework", choices=["crewai", "autogen"], help="Specify the framework")
138
- parser.add_argument("--ui", nargs='?', const='chainlit', default="chainlit", help="Specify the UI framework (gradio or chainlit). Default chainlit")
148
+ parser.add_argument("--ui", choices=["chainlit", "gradio"], help="Specify the UI framework (gradio or chainlit).")
139
149
  parser.add_argument("--auto", nargs=argparse.REMAINDER, help="Enable auto mode and pass arguments for it")
140
150
  parser.add_argument("--init", nargs=argparse.REMAINDER, help="Enable auto mode and pass arguments for it")
141
151
  parser.add_argument("agent_file", nargs="?", help="Specify the agent file")
@@ -165,40 +175,43 @@ class PraisonAI:
165
175
  Example:
166
176
  >>> praison_ai.create_gradio_interface()
167
177
  """
168
- def generate_crew_and_kickoff_interface(auto_args, framework):
169
- """
170
- Generate a crew and kick off tasks based on the provided auto arguments and framework.
171
-
172
- Args:
173
- auto_args (list): Topic.
174
- framework (str): The framework to use for generating agents.
175
-
176
- Returns:
177
- str: A string representing the result of generating the crew and kicking off tasks.
178
-
179
- Raises:
180
- None: This method does not raise any exceptions.
181
-
182
- Example:
183
- >>> result = generate_crew_and_kickoff_interface("Create a movie about Cat in Mars", "crewai")
184
- >>> print(result)
185
- """
186
- self.framework = framework
187
- self.agent_file = "test.yaml"
188
- generator = AutoGenerator(topic=auto_args , framework=self.framework)
189
- self.agent_file = generator.generate()
190
- agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list)
191
- result = agents_generator.generate_crew_and_kickoff()
192
- return result
193
-
194
- gr.Interface(
195
- fn=generate_crew_and_kickoff_interface,
196
- inputs=[gr.Textbox(lines=2, label="Auto Args"), gr.Dropdown(choices=["crewai", "autogen"], label="Framework")],
197
- outputs="textbox",
198
- title="Praison AI Studio",
199
- description="Create Agents and perform tasks",
200
- theme="default"
201
- ).launch()
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.")
202
215
 
203
216
  def create_chainlit_interface(self):
204
217
  """
@@ -211,10 +224,11 @@ class PraisonAI:
211
224
  Returns:
212
225
  None: This function does not return any value. It starts the Chainlit application.
213
226
  """
214
- from chainlit.cli import chainlit_run # Import chainlit_run
215
- os.environ["CHAINLIT_PORT"] = "8082"
216
- chainlit_run(["praisonai/chainlit_ui.py"])
217
-
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.")
218
232
 
219
233
  if __name__ == "__main__":
220
234
  praison_ai = PraisonAI()
@@ -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.23 gunicorn markdown\n")
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.23"
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.26.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