PraisonAI 0.0.22__tar.gz → 0.0.23__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.22
3
+ Version: 0.0.23
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
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3.12
11
11
  Requires-Dist: Flask (>=3.0.0)
12
12
  Requires-Dist: crewai (>=0.30.4)
13
13
  Requires-Dist: crewai-tools (>=0.2.6,<0.3.0)
14
- Requires-Dist: gradio (>=4.20.0)
14
+ Requires-Dist: gradio (>=4.26.0)
15
15
  Requires-Dist: markdown (>=3.5)
16
16
  Requires-Dist: praisonai-tools (>=0.0.4)
17
17
  Requires-Dist: pyautogen (>=0.2.19)
@@ -0,0 +1,59 @@
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
+
8
+ framework = "crewai"
9
+ config_list = [
10
+ {
11
+ 'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4o"),
12
+ 'base_url': os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1"),
13
+ }
14
+ ]
15
+ agent_file = "test.yaml"
16
+
17
+ @cl.on_chat_start
18
+ async def start_chat():
19
+ cl.user_session.set(
20
+ "message_history",
21
+ [{"role": "system", "content": "You are a helpful assistant."}],
22
+ )
23
+
24
+ @cl.on_chat_resume
25
+ async def on_chat_resume(thread: ThreadDict):
26
+ message_history = cl.user_session.get("message_history", [])
27
+ root_messages = [m for m in thread["steps"] if m["parentId"] is None]
28
+ for message in root_messages:
29
+ if message["type"] == "user_message":
30
+ message_history.append({"role": "user", "content": message["output"]})
31
+ elif message["type"] == "ai_message":
32
+ message_history.append({"role": "assistant", "content": message["content"]})
33
+ cl.user_session.set("message_history", message_history)
34
+
35
+ @cl.on_message
36
+ async def main(message: cl.Message):
37
+ """Run PraisonAI with the provided message as the topic."""
38
+ message_history = cl.user_session.get("message_history")
39
+ message_history.append({"role": "user", "content": message.content})
40
+ topic = message.content
41
+ agent_file = "test.yaml"
42
+ generator = AutoGenerator(topic=topic, framework=framework)
43
+ agent_file = generator.generate()
44
+ agents_generator = AgentsGenerator(agent_file, framework, config_list)
45
+ result = agents_generator.generate_crew_and_kickoff()
46
+ msg = cl.Message(content=result)
47
+ await msg.send()
48
+ message_history.append({"role": "assistant", "content": message.content})
49
+
50
+ @cl.password_auth_callback
51
+ def auth_callback(username: str, password: str):
52
+ # Fetch the user matching username from your database
53
+ # and compare the hashed password with the value stored in the database
54
+ if (username, password) == ("admin", "admin"):
55
+ return cl.User(
56
+ identifier="admin", metadata={"role": "admin", "provider": "credentials"}
57
+ )
58
+ else:
59
+ return None
@@ -9,6 +9,11 @@ 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
12
17
  import argparse
13
18
  from .auto import AutoGenerator
14
19
  from .agents_generator import AgentsGenerator
@@ -72,9 +77,8 @@ class PraisonAI:
72
77
 
73
78
  self.framework = args.framework or self.framework
74
79
 
75
- ui = args.ui
76
80
  if args.agent_file:
77
- if args.agent_file.startswith("tests.test"): # Argument used for testing purposes
81
+ if args.agent_file.startswith("tests.test"): # Argument used for testing purposes. eg: python -m unittest tests.test
78
82
  print("test")
79
83
  else:
80
84
  self.agent_file = args.agent_file
@@ -100,8 +104,13 @@ class PraisonAI:
100
104
  print("File {} created successfully".format(self.agent_file))
101
105
  return "File {} created successfully".format(self.agent_file)
102
106
 
103
- if ui:
104
- self.create_gradio_interface()
107
+ if args.ui:
108
+ if args.ui == "gradio":
109
+ self.create_gradio_interface()
110
+ elif args.ui == "chainlit":
111
+ self.create_chainlit_interface()
112
+ else:
113
+ self.create_chainlit_interface()
105
114
  else:
106
115
  agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list)
107
116
  result = agents_generator.generate_crew_and_kickoff()
@@ -126,12 +135,11 @@ class PraisonAI:
126
135
  """
127
136
  parser = argparse.ArgumentParser(prog="praisonai", description="praisonAI command-line interface")
128
137
  parser.add_argument("--framework", choices=["crewai", "autogen"], help="Specify the framework")
129
- parser.add_argument("--ui", action="store_true", help="Enable UI mode")
138
+ parser.add_argument("--ui", nargs='?', const='chainlit', default="chainlit", help="Specify the UI framework (gradio or chainlit). Default chainlit")
130
139
  parser.add_argument("--auto", nargs=argparse.REMAINDER, help="Enable auto mode and pass arguments for it")
131
140
  parser.add_argument("--init", nargs=argparse.REMAINDER, help="Enable auto mode and pass arguments for it")
132
141
  parser.add_argument("agent_file", nargs="?", help="Specify the agent file")
133
142
  parser.add_argument("--deploy", action="store_true", help="Deploy the application") # New argument
134
-
135
143
  args, unknown_args = parser.parse_known_args()
136
144
 
137
145
  if unknown_args and unknown_args[0] == '-b' and unknown_args[1] == 'api:app':
@@ -191,8 +199,23 @@ class PraisonAI:
191
199
  description="Create Agents and perform tasks",
192
200
  theme="default"
193
201
  ).launch()
202
+
203
+ def create_chainlit_interface(self):
204
+ """
205
+ Create a Chainlit interface for generating agents and performing tasks.
206
+
207
+ This function sets up a Chainlit application that listens for messages.
208
+ When a message is received, it runs PraisonAI with the provided message as the topic.
209
+ The generated agents are then used to perform tasks.
210
+
211
+ Returns:
212
+ None: This function does not return any value. It starts the Chainlit application.
213
+ """
214
+ from chainlit.cli import chainlit_run # Import chainlit_run
215
+ os.environ["CHAINLIT_PORT"] = "8082"
216
+ chainlit_run(["praisonai/chainlit_ui.py"])
217
+
194
218
 
195
219
  if __name__ == "__main__":
196
220
  praison_ai = PraisonAI()
197
- praison_ai.main()
198
-
221
+ 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.22 gunicorn markdown\n")
59
+ file.write("RUN pip install flask praisonai==0.0.23 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.22"
3
+ version = "0.0.23"
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,7 @@ 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"
21
+ gradio = ">=4.26.0"
22
22
  Flask = ">=3.0.0"
23
23
  markdown = ">=3.5"
24
24
  crewai-tools = "^0.2.6"
File without changes
File without changes
File without changes
File without changes