PraisonAI 0.0.25__tar.gz → 0.0.27__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.25
3
+ Version: 0.0.27
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,8 +11,11 @@ Classifier: Programming Language :: Python :: 3.12
11
11
  Provides-Extra: gradio
12
12
  Provides-Extra: ui
13
13
  Requires-Dist: Flask (>=3.0.0)
14
+ Requires-Dist: blinker (>=1.8.2)
15
+ Requires-Dist: chainlit (>=1.1.301,<2.0.0) ; extra == "ui"
14
16
  Requires-Dist: crewai (>=0.30.4)
15
17
  Requires-Dist: crewai-tools (>=0.2.6,<0.3.0)
18
+ Requires-Dist: gradio (>=4.26.0) ; extra == "gradio"
16
19
  Requires-Dist: markdown (>=3.5)
17
20
  Requires-Dist: praisonai-tools (>=0.0.4)
18
21
  Requires-Dist: pyautogen (>=0.2.19)
@@ -1,6 +1,6 @@
1
1
  from openai import OpenAI
2
2
  from pydantic import BaseModel
3
- from typing import Dict, List
3
+ from typing import Dict, List, Optional
4
4
  import instructor
5
5
  import os
6
6
  import json
@@ -23,16 +23,17 @@ class TeamStructure(BaseModel):
23
23
  roles: Dict[str, RoleDetails]
24
24
 
25
25
  class AutoGenerator:
26
- def __init__(self, topic="Movie Story writing about AI", agent_file="test.yaml", framework="crewai"):
26
+ def __init__(self, topic="Movie Story writing about AI", agent_file="test.yaml", framework="crewai", config_list: Optional[List[Dict]] = None):
27
27
  """
28
28
  Initialize the AutoGenerator class with the specified topic, agent file, and framework.
29
- note: autogen framework is different from this AutoGenerator class.
29
+ Note: autogen framework is different from this AutoGenerator class.
30
30
 
31
31
  Args:
32
32
  topic (str, optional): The topic for the generated team structure. Defaults to "Movie Story writing about AI".
33
33
  agent_file (str, optional): The name of the YAML file to save the generated team structure. Defaults to "test.yaml".
34
34
  framework (str, optional): The framework for the generated team structure. Defaults to "crewai".
35
-
35
+ config_list (Optional[List[Dict]], optional): A list containing the configuration details for the OpenAI API.
36
+ If None, it defaults to using environment variables or hardcoded values.
36
37
  Attributes:
37
38
  config_list (list): A list containing the configuration details for the OpenAI API.
38
39
  topic (str): The specified topic for the generated team structure.
@@ -40,10 +41,11 @@ class AutoGenerator:
40
41
  framework (str): The specified framework for the generated team structure.
41
42
  client (instructor.Client): An instance of the instructor.Client class initialized with the specified OpenAI API configuration.
42
43
  """
43
- self.config_list = [
44
+ self.config_list = config_list or [
44
45
  {
45
46
  'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4o"),
46
47
  'base_url': os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1"),
48
+ 'api_key': os.environ.get("OPENAI_API_KEY")
47
49
  }
48
50
  ]
49
51
  self.topic = topic
@@ -1,16 +1,20 @@
1
+ # praisonai/chainlit_ui.py
1
2
  from praisonai.agents_generator import AgentsGenerator
2
3
  from praisonai.auto import AutoGenerator
3
4
  import chainlit as cl
4
5
  import os
5
6
  from chainlit.types import ThreadDict
7
+ from chainlit.input_widget import Select, TextInput
6
8
  from typing import Optional
7
9
  from dotenv import load_dotenv
10
+ load_dotenv()
8
11
 
9
12
  framework = "crewai"
10
13
  config_list = [
11
14
  {
12
15
  'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4o"),
13
16
  'base_url': os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1"),
17
+ 'api_key': os.environ.get("OPENAI_API_KEY")
14
18
  }
15
19
  ]
16
20
  agent_file = "test.yaml"
@@ -21,7 +25,29 @@ async def start_chat():
21
25
  "message_history",
22
26
  [{"role": "system", "content": "You are a helpful assistant."}],
23
27
  )
28
+ settings = await cl.ChatSettings(
29
+ [
30
+ TextInput(id="Model", label="OpenAI - Model", initial=config_list[0]['model']),
31
+ TextInput(id="BaseUrl", label="OpenAI - Base URL", initial=config_list[0]['base_url']),
32
+ Select(
33
+ id="Framework",
34
+ label="Framework",
35
+ values=["crewai", "autogen"],
36
+ initial_index=0,
37
+ ),
38
+ ]
39
+ ).send()
40
+ # await on_settings_update(settings)
24
41
 
42
+ @cl.on_settings_update
43
+ async def on_settings_update(settings):
44
+ """Handle updates to the ChatSettings form."""
45
+ global config_list, framework
46
+ config_list[0]['model'] = settings["Model"]
47
+ config_list[0]['base_url'] = settings["BaseUrl"]
48
+ framework = settings["Framework"]
49
+ print("Settings updated:", settings)
50
+
25
51
  @cl.on_chat_resume
26
52
  async def on_chat_resume(thread: ThreadDict):
27
53
  message_history = cl.user_session.get("message_history", [])
@@ -40,7 +66,7 @@ async def main(message: cl.Message):
40
66
  message_history.append({"role": "user", "content": message.content})
41
67
  topic = message.content
42
68
  agent_file = "test.yaml"
43
- generator = AutoGenerator(topic=topic, framework=framework)
69
+ generator = AutoGenerator(topic=topic, framework=framework, config_list=config_list)
44
70
  agent_file = generator.generate()
45
71
  agents_generator = AgentsGenerator(agent_file, framework, config_list)
46
72
  result = agents_generator.generate_crew_and_kickoff()
@@ -59,9 +85,9 @@ password = os.getenv("CHAINLIT_PASSWORD", "admin") # Default to "admin" if not
59
85
  def auth_callback(username: str, password: str):
60
86
  # Fetch the user matching username from your database
61
87
  # and compare the hashed password with the value stored in the database
62
- if (username, password) == ("admin", "admin"):
88
+ if (username, password) == (username, password):
63
89
  return cl.User(
64
- identifier="admin", metadata={"role": "admin", "provider": "credentials"}
90
+ identifier=username, metadata={"role": "ADMIN", "provider": "credentials"}
65
91
  )
66
92
  else:
67
93
  return None
@@ -47,6 +47,7 @@ class PraisonAI:
47
47
  {
48
48
  'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4o"),
49
49
  'base_url': os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1"),
50
+ 'api_key': os.environ.get("OPENAI_API_KEY")
50
51
  }
51
52
  ]
52
53
  self.agent_file = agent_file
@@ -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.25 gunicorn markdown\n")
59
+ file.write("RUN pip install flask praisonai==0.0.27 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
 
@@ -9,6 +9,7 @@ config_list = [
9
9
  {
10
10
  'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-3.5-turbo"),
11
11
  'base_url': os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1"),
12
+ 'api_key': os.environ.get("OPENAI_API_KEY")
12
13
  }
13
14
  ]
14
15
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "PraisonAI"
3
- version = "0.0.25"
3
+ version = "0.0.27"
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,10 +18,13 @@ python = ">=3.10,<3.13"
18
18
  rich = ">=13.7"
19
19
  pyautogen = ">=0.2.19"
20
20
  crewai = ">=0.30.4"
21
- Flask = ">=3.0.0"
22
21
  markdown = ">=3.5"
23
22
  crewai-tools = "^0.2.6"
24
23
  praisonai-tools = ">=0.0.4"
24
+ blinker = ">=1.8.2"
25
+ Flask = ">=3.0.0"
26
+ chainlit = {version = "^1.1.301", optional = true}
27
+ gradio = {version = ">=4.26.0", optional = true}
25
28
 
26
29
  [tool.poetry.dev-dependencies]
27
30
  pytest = "^8.0.0"
File without changes
File without changes