PraisonAI 0.0.43__py3-none-any.whl → 0.0.46__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/cli.py CHANGED
@@ -60,6 +60,12 @@ class PraisonAI:
60
60
  self.auto = auto
61
61
  self.init = init
62
62
 
63
+ def run(self):
64
+ """
65
+ Run the PraisonAI application.
66
+ """
67
+ self.main()
68
+
63
69
  def main(self):
64
70
  """
65
71
  The main function of the PraisonAI object. It parses the command-line arguments,
@@ -188,6 +194,15 @@ class PraisonAI:
188
194
  if CHAINLIT_AVAILABLE:
189
195
  import praisonai
190
196
  os.environ["CHAINLIT_PORT"] = "8084"
197
+ public_folder = os.path.join(os.path.dirname(praisonai.__file__), 'public')
198
+ if not os.path.exists("public"): # Check if the folder exists in the current directory
199
+ if os.path.exists(public_folder):
200
+ shutil.copytree(public_folder, 'public', dirs_exist_ok=True)
201
+ logging.info("Public folder copied successfully!")
202
+ else:
203
+ logging.info("Public folder not found in the package.")
204
+ else:
205
+ logging.info("Public folder already exists.")
191
206
  chat_ui_path = os.path.join(os.path.dirname(praisonai.__file__), 'ui', 'chat.py')
192
207
  chainlit_run([chat_ui_path])
193
208
  else:
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.43 gunicorn markdown\n")
59
+ file.write("RUN pip install flask praisonai==0.0.46 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
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
praisonai/ui/chat.py CHANGED
@@ -11,6 +11,28 @@ load_dotenv()
11
11
  import chainlit.data as cl_data
12
12
  from chainlit.step import StepDict
13
13
  from literalai.helper import utc_now
14
+ import logging
15
+
16
+ # Set up logging
17
+ logger = logging.getLogger(__name__)
18
+ log_level = os.getenv("LOGLEVEL", "INFO").upper()
19
+ logger.handlers = []
20
+
21
+ # Set up logging to console
22
+ console_handler = logging.StreamHandler()
23
+ console_handler.setLevel(log_level)
24
+ console_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
25
+ console_handler.setFormatter(console_formatter)
26
+ logger.addHandler(console_handler)
27
+
28
+ # Set the logging level for the logger
29
+ logger.setLevel(log_level)
30
+
31
+ CHAINLIT_AUTH_SECRET = os.getenv("CHAINLIT_AUTH_SECRET")
32
+
33
+ if not CHAINLIT_AUTH_SECRET:
34
+ os.environ["CHAINLIT_AUTH_SECRET"] = "p8BPhQChpg@J>jBz$wGxqLX2V>yTVgP*7Ky9H$aV:axW~ANNX-7_T:o@lnyCBu^U"
35
+ CHAINLIT_AUTH_SECRET = os.getenv("CHAINLIT_AUTH_SECRET")
14
36
 
15
37
  now = utc_now()
16
38
 
@@ -43,9 +65,51 @@ def initialize_db():
43
65
  FOREIGN KEY (threadId) REFERENCES threads (id)
44
66
  )
45
67
  ''')
68
+ cursor.execute('''
69
+ CREATE TABLE IF NOT EXISTS settings (
70
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
71
+ key TEXT UNIQUE,
72
+ value TEXT
73
+ )
74
+ ''')
46
75
  conn.commit()
47
76
  conn.close()
48
77
 
78
+ def save_setting(key: str, value: str):
79
+ """Saves a setting to the database.
80
+
81
+ Args:
82
+ key: The setting key.
83
+ value: The setting value.
84
+ """
85
+ conn = sqlite3.connect(DB_PATH)
86
+ cursor = conn.cursor()
87
+ cursor.execute(
88
+ """
89
+ INSERT OR REPLACE INTO settings (id, key, value)
90
+ VALUES ((SELECT id FROM settings WHERE key = ?), ?, ?)
91
+ """,
92
+ (key, key, value),
93
+ )
94
+ conn.commit()
95
+ conn.close()
96
+
97
+ def load_setting(key: str) -> str:
98
+ """Loads a setting from the database.
99
+
100
+ Args:
101
+ key: The setting key.
102
+
103
+ Returns:
104
+ The setting value, or None if the key is not found.
105
+ """
106
+ conn = sqlite3.connect(DB_PATH)
107
+ cursor = conn.cursor()
108
+ cursor.execute('SELECT value FROM settings WHERE key = ?', (key,))
109
+ result = cursor.fetchone()
110
+ conn.close()
111
+ return result[0] if result else None
112
+
49
113
  def save_thread_to_db(thread):
50
114
  conn = sqlite3.connect(DB_PATH)
51
115
  cursor = conn.cursor()
@@ -57,7 +121,7 @@ def save_thread_to_db(thread):
57
121
  # No steps to save as steps are empty in the provided thread data
58
122
  conn.commit()
59
123
  conn.close()
60
- print("saved")
124
+ logger.debug("Thread saved to DB")
61
125
 
62
126
  def update_thread_in_db(thread):
63
127
  conn = sqlite3.connect(DB_PATH)
@@ -70,7 +134,7 @@ def update_thread_in_db(thread):
70
134
  ''', (thread['id'], thread['name'], thread['createdAt'], thread['userId'], thread['userIdentifier']))
71
135
 
72
136
  # Fetch message_history from metadata
73
- message_history = thread['metadata']['message_history']
137
+ message_history = cl.user_session.get("message_history", [])
74
138
 
75
139
  # Ensure user messages come first followed by assistant messages
76
140
  user_messages = [msg for msg in message_history if msg['role'] == 'user']
@@ -102,15 +166,29 @@ def update_thread_in_db(thread):
102
166
 
103
167
  conn.commit()
104
168
  conn.close()
169
+ logger.debug("Thread updated in DB")
170
+
171
+ def delete_thread_from_db(thread_id: str):
172
+ """Deletes a thread and its steps from the database.
173
+
174
+ Args:
175
+ thread_id: The ID of the thread to delete.
176
+ """
177
+ conn = sqlite3.connect(DB_PATH)
178
+ cursor = conn.cursor()
179
+ cursor.execute('DELETE FROM threads WHERE id = ?', (thread_id,))
180
+ cursor.execute('DELETE FROM steps WHERE threadId = ?', (thread_id,))
181
+ conn.commit()
182
+ conn.close()
105
183
 
106
184
  def load_threads_from_db():
107
185
  conn = sqlite3.connect(DB_PATH)
108
186
  cursor = conn.cursor()
109
- cursor.execute('SELECT * FROM threads')
187
+ cursor.execute('SELECT * FROM threads ORDER BY createdAt ASC')
110
188
  thread_rows = cursor.fetchall()
111
189
  threads = []
112
190
  for thread_row in thread_rows:
113
- cursor.execute('SELECT * FROM steps WHERE threadId = ?', (thread_row[0],))
191
+ cursor.execute('SELECT * FROM steps WHERE threadId = ? ORDER BY createdAt ASC', (thread_row[0],))
114
192
  step_rows = cursor.fetchall()
115
193
  steps = []
116
194
  for step_row in step_rows:
@@ -131,6 +209,7 @@ def load_threads_from_db():
131
209
  "steps": steps
132
210
  })
133
211
  conn.close()
212
+ logger.debug("Threads loaded from DB")
134
213
  return threads
135
214
 
136
215
  # Initialize the database
@@ -139,11 +218,13 @@ thread_history = load_threads_from_db()
139
218
 
140
219
  deleted_thread_ids = [] # type: List[str]
141
220
 
142
- class TestDataLayer(cl_data.BaseDataLayer):
221
+ class TestDataLayer(cl_data.BaseDataLayer): # Implement SQLAlchemyDataLayer
143
222
  async def get_user(self, identifier: str):
223
+ logger.debug(f"Getting user: {identifier}")
144
224
  return cl.PersistedUser(id="test", createdAt=now, identifier=identifier)
145
225
 
146
226
  async def create_user(self, user: cl.User):
227
+ logger.debug(f"Creating user: {user.identifier}")
147
228
  return cl.PersistedUser(id="test", createdAt=now, identifier=user.identifier)
148
229
 
149
230
  async def update_thread(
@@ -154,6 +235,7 @@ class TestDataLayer(cl_data.BaseDataLayer):
154
235
  metadata: Optional[Dict] = None,
155
236
  tags: Optional[List[str]] = None,
156
237
  ):
238
+ logger.debug(f"Updating thread: {thread_id}")
157
239
  thread = next((t for t in thread_history if t["id"] == thread_id), None)
158
240
  if thread:
159
241
  if name:
@@ -162,10 +244,12 @@ class TestDataLayer(cl_data.BaseDataLayer):
162
244
  thread["metadata"] = metadata
163
245
  if tags:
164
246
  thread["tags"] = tags
165
- update_thread_in_db(thread)
247
+
248
+ logger.debug(f"Thread: {thread}")
166
249
  cl.user_session.set("message_history", thread['metadata']['message_history'])
167
250
  cl.user_session.set("thread_id", thread["id"])
168
- print("Updated")
251
+ update_thread_in_db(thread)
252
+ logger.debug(f"Thread updated: {thread_id}")
169
253
 
170
254
  else:
171
255
  thread_history.append(
@@ -191,6 +275,7 @@ class TestDataLayer(cl_data.BaseDataLayer):
191
275
  "steps": [],
192
276
  }
193
277
  save_thread_to_db(thread)
278
+ logger.debug(f"Thread created: {thread_id}")
194
279
 
195
280
  @cl_data.queue_until_user_message()
196
281
  async def create_step(self, step_dict: StepDict):
@@ -204,48 +289,79 @@ class TestDataLayer(cl_data.BaseDataLayer):
204
289
  thread["steps"].append(step_dict)
205
290
 
206
291
  async def get_thread_author(self, thread_id: str):
292
+ logger.debug(f"Getting thread author: {thread_id}")
207
293
  return "admin"
208
294
 
209
295
  async def list_threads(
210
296
  self, pagination: cl_data.Pagination, filters: cl_data.ThreadFilter
211
297
  ) -> cl_data.PaginatedResponse[cl_data.ThreadDict]:
298
+ logger.debug(f"Listing threads")
212
299
  return cl_data.PaginatedResponse(
213
- data=[t for t in thread_history if t["id"] not in deleted_thread_ids],
300
+ data=[t for t in thread_history if t["id"] not in deleted_thread_ids][::-1],
214
301
  pageInfo=cl_data.PageInfo(
215
302
  hasNextPage=False, startCursor=None, endCursor=None
216
303
  ),
217
304
  )
218
305
 
219
306
  async def get_thread(self, thread_id: str):
307
+ logger.debug(f"Getting thread: {thread_id}")
220
308
  thread_history = load_threads_from_db()
221
309
  return next((t for t in thread_history if t["id"] == thread_id), None)
222
310
 
223
311
  async def delete_thread(self, thread_id: str):
224
312
  deleted_thread_ids.append(thread_id)
313
+ delete_thread_from_db(thread_id)
314
+ logger.debug(f"Deleted thread: {thread_id}")
225
315
 
226
316
  cl_data._data_layer = TestDataLayer()
227
317
 
228
318
  @cl.on_chat_start
229
319
  async def start():
230
320
  initialize_db()
231
- await cl.ChatSettings(
321
+ model_name = load_setting("model_name")
322
+
323
+ if model_name:
324
+ cl.user_session.set("model_name", model_name)
325
+ else:
326
+ # If no setting found, use default or environment variable
327
+ model_name = os.getenv("MODEL_NAME", "gpt-3.5-turbo")
328
+ cl.user_session.set("model_name", model_name)
329
+ logger.debug(f"Model name: {model_name}")
330
+ settings = cl.ChatSettings(
232
331
  [
233
332
  TextInput(
234
333
  id="model_name",
235
334
  label="Enter the Model Name",
236
- placeholder="e.g., gpt-3.5-turbo"
335
+ placeholder="e.g., gpt-3.5-turbo",
336
+ initial=model_name
237
337
  )
238
338
  ]
239
- ).send()
339
+ )
340
+ cl.user_session.set("settings", settings)
341
+ await settings.send()
240
342
 
241
343
  @cl.on_settings_update
242
344
  async def setup_agent(settings):
345
+ logger.debug(settings)
346
+ cl.user_session.set("settings", settings)
243
347
  model_name = settings["model_name"]
244
348
  cl.user_session.set("model_name", model_name)
349
+
350
+ # Save in settings table
351
+ save_setting("model_name", model_name)
352
+
353
+ # Save in thread metadata
354
+ thread_id = cl.user_session.get("thread_id")
355
+ if thread_id:
356
+ thread = await cl_data.get_thread(thread_id)
357
+ if thread:
358
+ metadata = thread.get("metadata", {})
359
+ metadata["model_name"] = model_name
360
+ await cl_data.update_thread(thread_id, metadata=metadata)
245
361
 
246
362
  @cl.on_message
247
363
  async def main(message: cl.Message):
248
- model_name = cl.user_session.get("model_name", "gpt-3.5-turbo")
364
+ model_name = load_setting("model_name") or os.getenv("MODEL_NAME") or "gpt-3.5-turbo"
249
365
  message_history = cl.user_session.get("message_history", [])
250
366
  message_history.append({"role": "user", "content": message.content})
251
367
 
@@ -266,9 +382,9 @@ async def main(message: cl.Message):
266
382
  if token := part['choices'][0]['delta']['content']:
267
383
  await msg.stream_token(token)
268
384
  full_response += token
269
- print(full_response)
385
+ logger.debug(f"Full response: {full_response}")
270
386
  message_history.append({"role": "assistant", "content": full_response})
271
- print(message_history)
387
+ logger.debug(f"Message history: {message_history}")
272
388
  cl.user_session.set("message_history", message_history)
273
389
  await msg.update()
274
390
 
@@ -291,6 +407,20 @@ async def send_count():
291
407
 
292
408
  @cl.on_chat_resume
293
409
  async def on_chat_resume(thread: cl_data.ThreadDict):
410
+ logger.info(f"Resuming chat: {thread['id']}")
411
+ model_name = load_setting("model_name") or os.getenv("MODEL_NAME") or "gpt-3.5-turbo"
412
+ logger.debug(f"Model name: {model_name}")
413
+ settings = cl.ChatSettings(
414
+ [
415
+ TextInput(
416
+ id="model_name",
417
+ label="Enter the Model Name",
418
+ placeholder="e.g., gpt-3.5-turbo",
419
+ initial=model_name
420
+ )
421
+ ]
422
+ )
423
+ await settings.send()
294
424
  thread_id = thread["id"]
295
425
  cl.user_session.set("thread_id", thread["id"])
296
426
  message_history = cl.user_session.get("message_history", [])
@@ -303,6 +433,6 @@ async def on_chat_resume(thread: cl_data.ThreadDict):
303
433
  elif msg_type == "assistant_message":
304
434
  message_history.append({"role": "assistant", "content": message.get("output", "")})
305
435
  else:
306
- print(f"Message without type: {message}")
436
+ logger.warning(f"Message without type: {message}")
307
437
 
308
438
  cl.user_session.set("message_history", message_history)
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
+ <svg width="800px" height="800px" viewBox="0 0 1024 1024" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M840.5 798.2L662.3 599.5l-151 173.7-173.7-173.7-167.7 201c-21 30.4 0.9 71.8 37.9 71.6l594.7-3.3c36.2-0.1 57.8-40.3 38-70.6z" fill="#FFB89A" /><path d="M741.6 647.3l-52.3-47.7c-12.2-11.2-31.2-10.3-42.4 1.9s-10.3 31.2 1.9 42.4l52.3 47.7c5.8 5.3 13 7.8 20.2 7.8 8.1 0 16.2-3.3 22.2-9.8 11.2-12.1 10.3-31.1-1.9-42.3zM631.2 546.5c-12.4-11-31.4-9.8-42.3 2.6l-98.8 111.7-171-165.7L87.9 724.7c-11.8 11.7-11.8 30.7-0.1 42.4 5.9 5.9 13.6 8.9 21.3 8.9 7.6 0 15.3-2.9 21.1-8.7l189.4-188.1 173.8 168.5L633.8 589c11-12.5 9.8-31.5-2.6-42.5z" fill="#33CC99" /><path d="M721.3 342.8m-35.1 0a35.1 35.1 0 1 0 70.2 0 35.1 35.1 0 1 0-70.2 0Z" fill="#33CC99" /><path d="M743.2 175.1H191.6c-70.6 0-128.3 57.7-128.3 128.3v499.2c0 70.6 57.7 128.3 128.3 128.3h551.5c70.6 0 128.3-57.7 128.3-128.3V303.5c0.1-70.6-57.7-128.4-128.2-128.4z m68.3 627.6c0 18.1-7.1 35.2-20.1 48.2-13 13-30.1 20.1-48.2 20.1H191.6c-18.1 0-35.2-7.1-48.2-20.1-13-13-20.1-30.1-20.1-48.2V303.5c0-18.1 7.1-35.2 20.1-48.2 13-13 30.1-20.1 48.2-20.1h551.5c18.1 0 35.2 7.1 48.2 20.1 13 13 20.1 30.1 20.1 48.2v499.2z" fill="#45484C" /><path d="M799.7 90.9H237.2c-16.6 0-30 13.4-30 30s13.4 30 30 30h562.4c26.1 0 50.8 10.3 69.4 28.9 18.6 18.6 28.9 43.3 28.9 69.4v482.4c0 16.6 13.4 30 30 30s30-13.4 30-30V249.2C958 161.9 887 90.9 799.7 90.9z" fill="#45484C" /></svg>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
+ <svg width="800px" height="800px" viewBox="0 0 1024 1024" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M570.2 842c-50.6 0-278.7-180-278.7-401.9 0-58.8-2.9-133.1-1-183.9-50.8 3.2-91.4 45.7-91.4 97.3v272.1c37.4 194.7 137.5 334 255.2 334 69.5 0 132.9-48.6 180.9-128.5-20.8 7.1-42.6 10.9-65 10.9z" fill="#FFB89A" /><path d="M926.1 191.8C900.5 74.1 817.9 62.1 704.9 62.1c-29.1 0-60.3 0.8-93 0.8-36 0-70.5-1.1-102.5-1.1-109.7 0-189.8 12.5-201.3 123.7-20.4 198.3 30 617.1 306.1 617.1S939 414.3 926.1 191.8z m-76.9 268.5c-9.5 47.9-22.3 90.8-38.1 127.7-16.8 39.2-37 71.4-60 95.8-37.3 39.5-82.1 58.7-137 58.7-53.4 0-97.6-20.1-134.9-61.6-45.5-50.5-79.8-131.5-99-234.2-15.6-83.5-20.3-178.9-12.4-255.2 1.8-17.3 5.7-30.7 11.6-39.8 4.4-6.8 10.1-11.7 18.7-15.8 25.8-12.5 70.8-14.2 111.4-14.2 15 0 30.7 0.2 47.3 0.5 17.8 0.3 36.2 0.6 55.2 0.6 17.2 0 33.9-0.2 50-0.4 15.1-0.2 29.3-0.4 43.1-0.4 44.5 0 89.5 1.8 118 15.1 15.9 7.4 33.4 20.8 43.6 63 2.6 53.3 3.6 153.5-17.5 260.2z" fill="#4E5155" /><path d="M532 841.7c-32.5 22.3-70.6 33.7-113.2 33.7-29.7 0-57.3-6-82.1-17.7-23.2-11-44.7-27.4-63.9-48.7-46-50.9-80.3-131.3-99.2-232.4-15.1-80.6-19.6-172.9-12-246.8 3-29.5 12-50.2 27.5-63.2 14.2-12 35.1-19.2 65.8-22.9 16.5-2 28.2-16.9 26.3-33.3-2-16.5-16.9-28.2-33.3-26.3-42.9 5.1-73.8 16.7-97.4 36.5-27.9 23.5-43.8 57.2-48.5 103-8.2 79.3-3.4 178.1 12.7 264 9.7 51.9 23.4 99.4 40.6 141.2 19.8 48.1 44.4 88.6 73 120.4 51.6 57.2 115.7 86.2 190.6 86.2 55 0 104.5-14.9 147.2-44.2 13.7-9.4 17.1-28.1 7.7-41.7-9.4-13.7-28.1-17.2-41.8-7.8z" fill="#4E5155" /><path d="M519.7 248.5c-16.6 0-30 13.4-30 30v91.3c0 16.6 13.4 30 30 30s30-13.4 30-30v-91.3c0-16.6-13.5-30-30-30zM299.5 385.5c0-16.6-13.4-30-30-30s-30 13.4-30 30v91.3c0 16.6 13.4 30 30 30s30-13.4 30-30v-91.3zM754.6 248.5c-16.6 0-30 13.4-30 30v91.3c0 16.6 13.4 30 30 30s30-13.4 30-30v-91.3c0-16.6-13.4-30-30-30zM716.7 554.5c0-16.6-13.4-30-30-30H551v30c0 58.5 38.1 123.7 92.8 123.7 22.9 0 45-11.9 62.2-33.6 10.3-13 8.1-31.9-4.9-42.1-13-10.3-31.9-8.1-42.1 4.9-5.3 6.7-11.1 10.9-15.1 10.9-4.3 0-11.9-5.1-19.1-16.4-3.3-5.3-6.2-11.2-8.4-17.4h70.4c16.4 0 29.9-13.4 29.9-30zM401.6 704c-25.4 0-46.1-24.2-46.1-53.9 0-16.6-13.4-30-30-30s-30 13.4-30 30c0 62.8 47.6 113.9 106.1 113.9 16.6 0 30-13.4 30-30s-13.5-30-30-30z" fill="#33CC99" /></svg>
Binary file
Binary file
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
+ <svg width="800px" height="800px" viewBox="0 0 1024 1024" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M861.9 383.8H218.1c-36.4 0-66.1-29.8-66.1-66.1V288c0-36.4 29.8-66.1 66.1-66.1h643.8c36.4 0 66.1 29.8 66.1 66.1v29.7c0 36.3-29.8 66.1-66.1 66.1z" fill="#FFB89A" /><path d="M822.9 129.2H199.8c-77.2 0-140.4 63.2-140.4 140.4v487.2c0 77.2 63.2 140.4 140.4 140.4h623.1c77.2 0 140.4-63.2 140.4-140.4V269.6c0-77.2-63.2-140.4-140.4-140.4z m80.4 177H760.4L864.6 201c5.4 3.3 10.4 7.3 15 11.8 15.3 15.3 23.7 35.4 23.7 56.8v36.6z m-673.3 0l104-117h61.3l-109.1 117H230z m247.4-117h169.2L532 306.2H368.3l109.1-117z m248.8 0h65.6L676 306.2h-60l112.5-114.8-2.3-2.2zM143 212.9c15.3-15.3 35.4-23.7 56.8-23.7h53.9l-104 117h-30.4v-36.5c0.1-21.4 8.5-41.5 23.7-56.8z m736.6 600.7c-15.3 15.3-35.4 23.7-56.8 23.7h-623c-21.3 0-41.5-8.4-56.8-23.7-15.3-15.3-23.7-35.4-23.7-56.8V366.2h783.9v390.6c0.1 21.3-8.3 41.5-23.6 56.8z" fill="#45484C" /><path d="M400.5 770.6V430.9L534.1 508c14.3 8.3 19.3 26.6 11 41-8.3 14.3-26.6 19.3-41 11l-43.6-25.2v131.8l114.1-65.9-7.5-4.3c-14.3-8.3-19.3-26.6-11-41 8.3-14.3 26.6-19.3 41-11l97.5 56.3-294.1 169.9z" fill="#33CC99" /></svg>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
+ <svg width="800px" height="800px" viewBox="0 0 1024 1024" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M188.3 766.5a94.4 135.8 0 1 0 188.8 0 94.4 135.8 0 1 0-188.8 0Z" fill="#FFB89A" /><path d="M931.5 397s0-0.1 0 0c-34.2-82.6-119.3-141-218.8-141-129.7 0-234.9 99.3-234.9 221.9 0 52.1 19.1 100.1 50.9 138 1 14.5 1.8 29.1 1.8 43.6 0 148.5 98.1 269 219.2 269 121 0 219.2-120.4 219.2-269 0-70.1-1.7-214.7-37.4-262.5z m-36.6 347.5c-8.7 25.3-21.1 47.9-36.8 67.1-29.8 36.5-68.3 56.7-108.5 56.7s-78.7-20.1-108.5-56.7c-15.7-19.2-28-41.8-36.8-67.1-9.3-26.9-13.9-55.5-13.9-85.1 0-16.8-1-33.5-2-47.7l-1.3-19.5-12.6-15c-24.1-28.6-36.8-63-36.8-99.3 0-89.3 78.5-161.9 174.9-161.9 36.4 0 71.4 10.3 101 29.7 28.4 18.7 65.5 81.7 65.5 81.7s17.9 27.5 24.7 98.2c4.5 46.5 5 95.9 5 133.8 0.1 29.6-4.6 58.2-13.9 85.1zM377.1 219.9c-51.8 0-93.8 42-93.8 93.8s42 93.8 93.8 93.8 93.8-42 93.8-93.8-42-93.8-93.8-93.8z m0 127.5c-18.6 0-33.8-15.2-33.8-33.8 0-18.6 15.2-33.8 33.8-33.8 18.6 0 33.8 15.2 33.8 33.8 0 18.7-15.1 33.8-33.8 33.8z" fill="#45484C" /><path d="M521.2 206.7m-50.3 0a50.3 50.3 0 1 0 100.6 0 50.3 50.3 0 1 0-100.6 0Z" fill="#45484C" /><path d="M653 156.4m-50.3 0a50.3 50.3 0 1 0 100.6 0 50.3 50.3 0 1 0-100.6 0Z" fill="#45484C" /><path d="M781.9 158.4m-50.3 0a50.3 50.3 0 1 0 100.6 0 50.3 50.3 0 1 0-100.6 0Z" fill="#45484C" /><path d="M909 206.7m-50.3 0a50.3 50.3 0 1 0 100.6 0 50.3 50.3 0 1 0-100.6 0Z" fill="#45484C" /><path d="M263.9 602.7c44.7 0 81 31.5 81 70.3 0 20.9-10.2 35.9-18.7 44.8l-15.9 19.7-0.5 27.2c0.7 7.2 0.6 16.9 0.6 24.7v4.8c0 33.7-27.4 61.2-61.2 61.2-14.9 0-33.3-9.6-48.1-25-15.2-15.9-24.6-35.9-24.6-52.3v-3.2c0-12.7 0-36.2 1-60.2 1.4-33 7.4-57.3 7.4-57.3 3.9-14.7 13.4-28.2 26.8-38 14.8-11 32.8-16.7 52.2-16.7m0-60c-66.4 0-122 42.4-137 99.4-10.9 23-10.4 112.6-10.4 135.9 0 66.9 65.8 137.3 132.7 137.3 66.9 0 121.2-54.3 121.2-121.2 0-9.2 0.3-23-0.8-34.9 22-23 35.4-53.2 35.4-86.3-0.1-71.9-63.2-130.2-141.1-130.2zM444.4 559.9c-26.4 0-47.8 21.4-47.8 47.8s21.4 47.8 47.8 47.8 47.8-21.4 47.8-47.8-21.4-47.8-47.8-47.8zM377.1 494.5c-15.2 0-27.5 12.3-27.5 27.5s12.3 27.5 27.5 27.5 27.5-12.3 27.5-27.5c0-15.3-12.3-27.5-27.5-27.5zM288.1 471.5c-15.2 0-27.5 12.3-27.5 27.5s12.3 27.5 27.5 27.5 27.5-12.3 27.5-27.5-12.4-27.5-27.5-27.5zM188.3 477.9c-15.2 0-27.5 12.3-27.5 27.5s12.3 27.5 27.5 27.5 27.5-12.3 27.5-27.5-12.3-27.5-27.5-27.5zM100.6 538.4c-15.2 0-27.5 12.3-27.5 27.5s12.3 27.5 27.5 27.5 27.5-12.3 27.5-27.5c-0.1-15.2-12.4-27.5-27.5-27.5z" fill="#45484C" /><path d="M670.1 584.6c-41.4 0-80.2-20.3-103.9-54.3-9.5-13.6-6.2-32.3 7.4-41.8 13.6-9.5 32.3-6.2 41.8 7.4 12.5 17.9 33 28.6 54.7 28.6 36.8 0 66.7-29.9 66.7-66.7 0-19.8-8.7-38.4-23.9-51.2-12.7-10.6-14.4-29.6-3.7-42.3s29.6-14.4 42.3-3.7c28.9 24.2 45.4 59.6 45.4 97.2-0.1 70-56.9 126.8-126.8 126.8z" fill="#33CC99" /><path d="M853 556.4c-26 0-49.6-14.5-60.1-36.9-7-15-0.6-32.9 14.4-39.9s32.9-0.6 39.9 14.4c0.3 0.6 2.2 2.4 5.8 2.4 1.2 0 2.3-0.2 3.3-0.6 15.5-5.9 32.8 1.8 38.7 17.3 5.9 15.5-1.8 32.8-17.3 38.7-7.9 3.1-16.2 4.6-24.7 4.6z" fill="#33CC99" /></svg>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PraisonAI
3
- Version: 0.0.43
3
+ Version: 0.0.46
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
@@ -51,6 +51,11 @@ Description-Content-Type: text/markdown
51
51
 
52
52
  Praison AI, leveraging both AutoGen and CrewAI or any other agent framework, represents a low-code, centralised framework designed to simplify the creation and orchestration of multi-agent systems for various LLM applications, emphasizing ease of use, customization, and human-agent interaction.
53
53
 
54
+ | | Cookbook | Open in Colab |
55
+ | --- | --- | --- |
56
+ | Basic | PraisonAI | <a target="_blank" href="https://colab.research.google.com/github/MervinPraison/PraisonAI/blob/main/cookbooks/praisonai-googlecolab.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> |
57
+ | Include Tools | PraisonAI Tools | <a target="_blank" href="https://colab.research.google.com/github/MervinPraison/PraisonAI/blob/main/cookbooks/praisonai-tools-googlecolab.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> |
58
+
54
59
  ## TL;DR
55
60
  ```bash
56
61
  pip install praisonai
@@ -59,6 +64,22 @@ praisonai --init create a movie script about dog in moon
59
64
  praisonai
60
65
  ```
61
66
 
67
+ ## Table of Contents
68
+
69
+ - [Installation](#installation)
70
+ - [Initialise](#initialise)
71
+ - [Run](#run)
72
+ - [Full Automatic Mode](#full-automatic-mode)
73
+ - [User Interface](#user-interface)
74
+ - [Praison AI Chat](#praison-ai-chat)
75
+ - [Create Custom Tools](#create-custom-tools)
76
+ - [Agents Playbook](#agents-playbook)
77
+ - [Include praisonai package in your project](#include-praisonai-package-in-your-project)
78
+ - [Commands to Install Dev Dependencies](#commands-to-install-dependencies)
79
+ - [Other Models](#other-models)
80
+ - [Contributing](#contributing)
81
+ - [Star History](#star-history)
82
+
62
83
  ## Installation
63
84
 
64
85
  ```bash
@@ -126,29 +147,26 @@ or
126
147
  python -m praisonai ui
127
148
  ```
128
149
 
129
- ## Create Custom Tools
150
+ ## Praison AI Chat
130
151
 
131
- ### TL;DR to Create a Custom Tool
152
+ * https://docs.praison.ai/chat/
132
153
 
133
154
  ```bash
134
- pip install praisonai duckduckgo-search
155
+ pip install "praisonai[chat]"
135
156
  export OPENAI_API_KEY="Enter your API key"
136
- praisonai --init research about the latest AI News and prepare a detailed report
157
+ praisonai chat
137
158
  ```
138
159
 
139
- - Add `- InternetSearchTool` in the agents.yaml file in the tools section.
140
- - Create a file called tools.py and add this code [tools.py](./tools.py)
160
+ ## Create Custom Tools
141
161
 
142
- ```bash
143
- praisonai
144
- ```
162
+ * https://docs.praison.ai/tools/custom/
145
163
 
146
- ### Pre-requisite to Create a Custom Tool
164
+ ### Step 1: Pre-requisite to Create a Custom Tool
147
165
  `agents.yaml` file should be present in the current directory.
148
166
 
149
167
  If it doesn't exist, create it by running the command `praisonai --init research about the latest AI News and prepare a detailed report`.
150
168
 
151
- ### Step 1 to Create a Custom Tool
169
+ ### Step 2: to Create a Custom Tool
152
170
 
153
171
  Create a file called tools.py in the same directory as the agents.yaml file.
154
172
 
@@ -167,7 +185,7 @@ class InternetSearchTool(BaseTool):
167
185
  return results
168
186
  ```
169
187
 
170
- ### Step 2 to Create a Custom Tool
188
+ ### Step 3: to Create a Custom Tool
171
189
 
172
190
  Add the tool to the agents.yaml file as show below under the tools section `- InternetSearchTool`.
173
191
 
@@ -206,37 +224,63 @@ roles:
206
224
  expected_output: 'Complete script ready for production.'
207
225
  ```
208
226
 
227
+ ## Use 100+ Models
228
+
229
+ * https://docs.praison.ai/models/
230
+
209
231
  ## Include praisonai package in your project
210
232
 
233
+ * https://docs.praison.ai/developers/wrapper
234
+ * https://docs.praison.ai/developers/wrapper-tools/
235
+
236
+ ## Option 1: Using RAW YAML
237
+
238
+ ```python
239
+ from praisonai import PraisonAI
240
+
241
+ # Example agent_yaml content
242
+ agent_yaml = """
243
+ framework: "crewai"
244
+ topic: "Space Exploration"
245
+
246
+ roles:
247
+ astronomer:
248
+ role: "Space Researcher"
249
+ goal: "Discover new insights about {topic}"
250
+ backstory: "You are a curious and dedicated astronomer with a passion for unraveling the mysteries of the cosmos."
251
+ tasks:
252
+ investigate_exoplanets:
253
+ description: "Research and compile information about exoplanets discovered in the last decade."
254
+ expected_output: "A summarized report on exoplanet discoveries, including their size, potential habitability, and distance from Earth."
255
+ """
256
+
257
+ # Create a PraisonAI instance with the agent_yaml content
258
+ praison_ai = PraisonAI(agent_yaml=agent_yaml)
259
+
260
+ # Run PraisonAI
261
+ result = praison_ai.main()
262
+
263
+ # Print the result
264
+ print(result)
265
+ ```
266
+
267
+ ## Option 2: Using separate agents.yaml file
268
+
269
+
270
+ Note: Please create agents.yaml file before hand.
271
+
211
272
  ```python
212
273
  from praisonai import PraisonAI
213
274
 
214
275
  def basic(): # Basic Mode
215
276
  praison_ai = PraisonAI(agent_file="agents.yaml")
216
277
  praison_ai.main()
217
-
218
- def advanced(): # Advanced Mode with options
219
- praison_ai = PraisonAI(
220
- agent_file="agents.yaml",
221
- framework="autogen",
222
- )
223
- praison_ai.main()
224
-
225
- def auto(): # Full Automatic Mode
226
- praison_ai = PraisonAI(
227
- auto="Create a movie script about car in mars",
228
- framework="autogen"
229
- )
230
- print(praison_ai.framework)
231
- praison_ai.main()
232
278
 
233
279
  if __name__ == "__main__":
234
280
  basic()
235
- advanced()
236
- auto()
237
281
  ```
238
282
 
239
- ### Commands to Install Dependencies:
283
+ ## Commands to Install Dependencies:
240
284
 
241
285
  1. **Install all dependencies, including dev dependencies:**
242
286
  ```sh
@@ -260,30 +304,6 @@ if __name__ == "__main__":
260
304
 
261
305
  This configuration ensures that your development dependencies are correctly categorized and installed as needed.
262
306
 
263
- ## Other Models
264
-
265
- ```bash
266
- # Ollama
267
- OPENAI_API_BASE='http://localhost:11434/v1'
268
- OPENAI_MODEL_NAME='mistral'
269
- OPENAI_API_KEY='NA'
270
-
271
- # FastChat
272
- OPENAI_API_BASE="http://localhost:8001/v1"
273
- OPENAI_MODEL_NAME='oh-2.5m7b-q51'
274
- OPENAI_API_KEY=NA
275
-
276
- # LM Studio
277
- OPENAI_API_BASE="http://localhost:1234/v1"
278
- OPENAI_MODEL_NAME=NA
279
- OPENAI_API_KEY=NA
280
-
281
- # Mistral API
282
- OPENAI_API_BASE=https://api.mistral.ai/v1
283
- OPENAI_MODEL_NAME="mistral-small"
284
- OPENAI_API_KEY=your-mistral-api-key
285
- ```
286
-
287
307
  ## Contributing
288
308
 
289
309
  - Fork on GitHub: Use the "Fork" button on the repository page.
@@ -0,0 +1,37 @@
1
+ praisonai/__init__.py,sha256=JrgyPlzZfLlozoW7SHZ1nVJ63rLPR3ki2k5ZPywYrnI,175
2
+ praisonai/__main__.py,sha256=MVgsjMThjBexHt4nhd760JCqvP4x0IQcwo8kULOK4FQ,144
3
+ praisonai/agents_generator.py,sha256=8d1WRbubvEkBrW1HZ7_xnGyqgJi0yxmXa3MgTIqef1c,19127
4
+ praisonai/auto.py,sha256=9spTXqj47Hmmqv5QHRYE_RzSVHH_KoPbaZjskUj2UcE,7895
5
+ praisonai/chainlit_ui.py,sha256=bNR7s509lp0I9JlJNvwCZRUZosC64qdvlFCt8NmFamQ,12216
6
+ praisonai/cli.py,sha256=JBI3JjI7RB0QQipuy-utJpP3jxj8gnG5roMLW2Zjq6A,12851
7
+ praisonai/deploy.py,sha256=UmebXvdSfKGk4A-nQeOkbj2bieEOcMK9VZMTn2z1AOY,6031
8
+ praisonai/inbuilt_tools/__init__.py,sha256=mUKnbL6Gram9c9f2m8wJwEzURBLmPEOcHzwySBH89YA,74
9
+ praisonai/inbuilt_tools/autogen_tools.py,sha256=svYkM2N7DVFvbiwgoAS7U_MqTOD8rHf8VD3BaFUV5_Y,14907
10
+ praisonai/inc/__init__.py,sha256=sPDlYBBwdk0VlWzaaM_lG0_LD07lS2HRGvPdxXJFiYg,62
11
+ praisonai/inc/models.py,sha256=1kwP9o56AvN8L38x7eeAzudjAvstN0uWu-woQkgxAe4,5449
12
+ praisonai/public/android-chrome-192x192.png,sha256=ENJEqhDE3XEQViRhKNDezQKRiOiuHOUj5nzRN43fz50,6535
13
+ praisonai/public/android-chrome-512x512.png,sha256=4txEwB0cJkxFVarRdvFGJZR1DtWJ2h-L_2cUEjBXHAc,15244
14
+ praisonai/public/apple-touch-icon.png,sha256=YLlEhlenm24QY_yv-5wb_mxDxJ8H22H_S8Khlvz-zVA,6001
15
+ praisonai/public/fantasy.svg,sha256=4Gs3kIOux-pjGtw6ogI_rv5_viVJxnE5gRwGilsSg0o,1553
16
+ praisonai/public/favicon-16x16.png,sha256=jFiLfRSaEw_kwSxVQQUNV7Auc6oDRvZVKEIiUqC7vYE,429
17
+ praisonai/public/favicon-32x32.png,sha256=cgKvhHroXWNl1Err0TFr8tGepjNzIBpaTinFUT5pbZk,872
18
+ praisonai/public/favicon.ico,sha256=SOcyfycBi_8rd9ff3gmSuZ3M-rkxv1RpHi76cwvmsQ0,15406
19
+ praisonai/public/game.svg,sha256=y2QMaA01m8XzuDjTOBWzupOC3-TpnUl9ah89mIhviUw,2406
20
+ praisonai/public/logo_dark.png,sha256=frHz1zkrnivGssJgk9iy1cabojkVgm8B4MllFwL_CnI,17050
21
+ praisonai/public/logo_light.png,sha256=8cQRti_Ysa30O3_7C3ku2w40LnVUUlUok47H-3ZZHSU,19656
22
+ praisonai/public/movie.svg,sha256=aJ2EQ8vXZusVsF2SeuAVxP4RFJzQ14T26ejrGYdBgzk,1289
23
+ praisonai/public/thriller.svg,sha256=2dYY72EcgbEyTxS4QzjAm37Y4srtPWEW4vCMFki98ZI,3163
24
+ praisonai/test.py,sha256=RZKq3UEFb6AnFFiHER3zBXfNmlteSLBlrTmOvnpnZLo,4092
25
+ praisonai/ui/chat.py,sha256=Gx0SmnE5P6f8csS--gfnInJVmLF-5bWyOBLu1o4AXgc,14643
26
+ praisonai/ui/public/fantasy.svg,sha256=4Gs3kIOux-pjGtw6ogI_rv5_viVJxnE5gRwGilsSg0o,1553
27
+ praisonai/ui/public/game.svg,sha256=y2QMaA01m8XzuDjTOBWzupOC3-TpnUl9ah89mIhviUw,2406
28
+ praisonai/ui/public/logo_dark.png,sha256=frHz1zkrnivGssJgk9iy1cabojkVgm8B4MllFwL_CnI,17050
29
+ praisonai/ui/public/logo_light.png,sha256=8cQRti_Ysa30O3_7C3ku2w40LnVUUlUok47H-3ZZHSU,19656
30
+ praisonai/ui/public/movie.svg,sha256=aJ2EQ8vXZusVsF2SeuAVxP4RFJzQ14T26ejrGYdBgzk,1289
31
+ praisonai/ui/public/thriller.svg,sha256=2dYY72EcgbEyTxS4QzjAm37Y4srtPWEW4vCMFki98ZI,3163
32
+ praisonai/version.py,sha256=ugyuFliEqtAwQmH4sTlc16YXKYbFWDmfyk87fErB8-8,21
33
+ praisonai-0.0.46.dist-info/LICENSE,sha256=kqvFysVlnFxYOu0HxCe2HlmZmJtdmNGOxWRRkT9TsWc,1035
34
+ praisonai-0.0.46.dist-info/METADATA,sha256=HFsoACSl5CZakd3MXJtl4pFGB3_6fV-6jBEYyY07wR8,9307
35
+ praisonai-0.0.46.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
+ praisonai-0.0.46.dist-info/entry_points.txt,sha256=Qg41eW3A1-dvdV5tF7LqChfYof8Rihk2rN1fiEE3vnk,53
37
+ praisonai-0.0.46.dist-info/RECORD,,
@@ -1,23 +0,0 @@
1
- praisonai/__init__.py,sha256=JrgyPlzZfLlozoW7SHZ1nVJ63rLPR3ki2k5ZPywYrnI,175
2
- praisonai/__main__.py,sha256=MVgsjMThjBexHt4nhd760JCqvP4x0IQcwo8kULOK4FQ,144
3
- praisonai/agents_generator.py,sha256=8d1WRbubvEkBrW1HZ7_xnGyqgJi0yxmXa3MgTIqef1c,19127
4
- praisonai/auto.py,sha256=9spTXqj47Hmmqv5QHRYE_RzSVHH_KoPbaZjskUj2UcE,7895
5
- praisonai/chainlit_ui.py,sha256=bNR7s509lp0I9JlJNvwCZRUZosC64qdvlFCt8NmFamQ,12216
6
- praisonai/cli.py,sha256=RAPXxz6FxEG8Ek7XVRrzZ0FE1fwNHRd-prOjVjJjd0k,12180
7
- praisonai/deploy.py,sha256=E-K35liJeVRHhJtEpE9_41IFg0lT4dr1f2amobYxpws,6031
8
- praisonai/inbuilt_tools/__init__.py,sha256=mUKnbL6Gram9c9f2m8wJwEzURBLmPEOcHzwySBH89YA,74
9
- praisonai/inbuilt_tools/autogen_tools.py,sha256=svYkM2N7DVFvbiwgoAS7U_MqTOD8rHf8VD3BaFUV5_Y,14907
10
- praisonai/inc/__init__.py,sha256=sPDlYBBwdk0VlWzaaM_lG0_LD07lS2HRGvPdxXJFiYg,62
11
- praisonai/inc/models.py,sha256=1kwP9o56AvN8L38x7eeAzudjAvstN0uWu-woQkgxAe4,5449
12
- praisonai/public/fantasy.svg,sha256=4Gs3kIOux-pjGtw6ogI_rv5_viVJxnE5gRwGilsSg0o,1553
13
- praisonai/public/game.svg,sha256=y2QMaA01m8XzuDjTOBWzupOC3-TpnUl9ah89mIhviUw,2406
14
- praisonai/public/movie.svg,sha256=aJ2EQ8vXZusVsF2SeuAVxP4RFJzQ14T26ejrGYdBgzk,1289
15
- praisonai/public/thriller.svg,sha256=2dYY72EcgbEyTxS4QzjAm37Y4srtPWEW4vCMFki98ZI,3163
16
- praisonai/test.py,sha256=RZKq3UEFb6AnFFiHER3zBXfNmlteSLBlrTmOvnpnZLo,4092
17
- praisonai/ui/chat.py,sha256=kyfWIIpVdb6D54SnoMPw3MQp0xk6sppgTzT-Xflz9Tw,10149
18
- praisonai/version.py,sha256=ugyuFliEqtAwQmH4sTlc16YXKYbFWDmfyk87fErB8-8,21
19
- praisonai-0.0.43.dist-info/LICENSE,sha256=kqvFysVlnFxYOu0HxCe2HlmZmJtdmNGOxWRRkT9TsWc,1035
20
- praisonai-0.0.43.dist-info/METADATA,sha256=UW42K2ecDGhjfNlqV5rd_Xh6xYkQqLSwxMZzRgh6zVY,8088
21
- praisonai-0.0.43.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
22
- praisonai-0.0.43.dist-info/entry_points.txt,sha256=Qg41eW3A1-dvdV5tF7LqChfYof8Rihk2rN1fiEE3vnk,53
23
- praisonai-0.0.43.dist-info/RECORD,,