PraisonAI 0.0.23__tar.gz → 0.0.25__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.25
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,11 @@ 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: gradio
12
+ Provides-Extra: ui
11
13
  Requires-Dist: Flask (>=3.0.0)
12
14
  Requires-Dist: crewai (>=0.30.4)
13
15
  Requires-Dist: crewai-tools (>=0.2.6,<0.3.0)
14
- Requires-Dist: gradio (>=4.26.0)
15
16
  Requires-Dist: markdown (>=3.5)
16
17
  Requires-Dist: praisonai-tools (>=0.0.4)
17
18
  Requires-Dist: pyautogen (>=0.2.19)
@@ -9,7 +9,6 @@ from crewai import Agent, Task, Crew
9
9
  from crewai.telemetry import Telemetry
10
10
  load_dotenv()
11
11
  import autogen
12
- import gradio as gr
13
12
  import argparse
14
13
  from .auto import AutoGenerator
15
14
  from crewai_tools import (
@@ -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
@@ -8,17 +8,23 @@ from dotenv import load_dotenv
8
8
  from crewai import Agent, Task, Crew
9
9
  load_dotenv()
10
10
  import autogen
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
11
  import argparse
18
12
  from .auto import AutoGenerator
19
13
  from .agents_generator import AgentsGenerator
20
14
  from .inbuilt_tools import *
21
15
 
16
+ try:
17
+ from chainlit.cli import chainlit_run
18
+ CHAINLIT_AVAILABLE = True
19
+ except ImportError:
20
+ CHAINLIT_AVAILABLE = False
21
+
22
+ try:
23
+ import gradio as gr
24
+ GRADIO_AVAILABLE = True
25
+ except ImportError:
26
+ GRADIO_AVAILABLE = False
27
+
22
28
  class PraisonAI:
23
29
  def __init__(self, agent_file="agents.yaml", framework="", auto=False, init=False):
24
30
  """
@@ -110,7 +116,10 @@ class PraisonAI:
110
116
  elif args.ui == "chainlit":
111
117
  self.create_chainlit_interface()
112
118
  else:
113
- self.create_chainlit_interface()
119
+ # Modify below code to allow default ui
120
+ agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list)
121
+ result = agents_generator.generate_crew_and_kickoff()
122
+ return result
114
123
  else:
115
124
  agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list)
116
125
  result = agents_generator.generate_crew_and_kickoff()
@@ -135,7 +144,7 @@ class PraisonAI:
135
144
  """
136
145
  parser = argparse.ArgumentParser(prog="praisonai", description="praisonAI command-line interface")
137
146
  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")
147
+ parser.add_argument("--ui", choices=["chainlit", "gradio"], help="Specify the UI framework (gradio or chainlit).")
139
148
  parser.add_argument("--auto", nargs=argparse.REMAINDER, help="Enable auto mode and pass arguments for it")
140
149
  parser.add_argument("--init", nargs=argparse.REMAINDER, help="Enable auto mode and pass arguments for it")
141
150
  parser.add_argument("agent_file", nargs="?", help="Specify the agent file")
@@ -165,40 +174,43 @@ class PraisonAI:
165
174
  Example:
166
175
  >>> praison_ai.create_gradio_interface()
167
176
  """
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()
177
+ if GRADIO_AVAILABLE:
178
+ def generate_crew_and_kickoff_interface(auto_args, framework):
179
+ """
180
+ Generate a crew and kick off tasks based on the provided auto arguments and framework.
181
+
182
+ Args:
183
+ auto_args (list): Topic.
184
+ framework (str): The framework to use for generating agents.
185
+
186
+ Returns:
187
+ str: A string representing the result of generating the crew and kicking off tasks.
188
+
189
+ Raises:
190
+ None: This method does not raise any exceptions.
191
+
192
+ Example:
193
+ >>> result = generate_crew_and_kickoff_interface("Create a movie about Cat in Mars", "crewai")
194
+ >>> print(result)
195
+ """
196
+ self.framework = framework
197
+ self.agent_file = "test.yaml"
198
+ generator = AutoGenerator(topic=auto_args , framework=self.framework)
199
+ self.agent_file = generator.generate()
200
+ agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list)
201
+ result = agents_generator.generate_crew_and_kickoff()
202
+ return result
203
+
204
+ gr.Interface(
205
+ fn=generate_crew_and_kickoff_interface,
206
+ inputs=[gr.Textbox(lines=2, label="Auto Args"), gr.Dropdown(choices=["crewai", "autogen"], label="Framework")],
207
+ outputs="textbox",
208
+ title="Praison AI Studio",
209
+ description="Create Agents and perform tasks",
210
+ theme="default"
211
+ ).launch()
212
+ else:
213
+ print("ERROR: Gradio is not installed. Please install it with 'pip install gradio' to use this feature.")
202
214
 
203
215
  def create_chainlit_interface(self):
204
216
  """
@@ -211,10 +223,13 @@ class PraisonAI:
211
223
  Returns:
212
224
  None: This function does not return any value. It starts the Chainlit application.
213
225
  """
214
- from chainlit.cli import chainlit_run # Import chainlit_run
215
- os.environ["CHAINLIT_PORT"] = "8082"
216
- chainlit_run(["praisonai/chainlit_ui.py"])
217
-
226
+ if CHAINLIT_AVAILABLE:
227
+ os.environ["CHAINLIT_PORT"] = "8082"
228
+ import praisonai
229
+ chainlit_ui_path = os.path.join(os.path.dirname(praisonai.__file__), 'chainlit_ui.py')
230
+ chainlit_run([chainlit_ui_path])
231
+ else:
232
+ print("ERROR: Chainlit is not installed. Please install it with 'pip install chainlit' to use the UI.")
218
233
 
219
234
  if __name__ == "__main__":
220
235
  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.25 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.25"
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,8 @@ 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
+ gradio = ["gradio"]
File without changes
File without changes
File without changes
File without changes