PraisonAI 1.0.10__tar.gz → 1.0.11__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.

Files changed (81) hide show
  1. {praisonai-1.0.10 → praisonai-1.0.11}/PKG-INFO +1 -1
  2. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/deploy.py +1 -1
  3. praisonai-1.0.11/praisonai/ui/components/aicoder.py +269 -0
  4. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/.chainlit/config.toml +1 -1
  5. {praisonai-1.0.10 → praisonai-1.0.11}/pyproject.toml +2 -2
  6. {praisonai-1.0.10 → praisonai-1.0.11}/LICENSE +0 -0
  7. {praisonai-1.0.10 → praisonai-1.0.11}/README.md +0 -0
  8. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/__init__.py +0 -0
  9. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/__main__.py +0 -0
  10. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/agents_generator.py +0 -0
  11. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/api/call.py +0 -0
  12. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/auto.py +0 -0
  13. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/chainlit_ui.py +0 -0
  14. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/cli.py +0 -0
  15. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/inbuilt_tools/__init__.py +0 -0
  16. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/inbuilt_tools/autogen_tools.py +0 -0
  17. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/inc/__init__.py +0 -0
  18. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/inc/config.py +0 -0
  19. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/inc/models.py +0 -0
  20. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/public/android-chrome-192x192.png +0 -0
  21. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/public/android-chrome-512x512.png +0 -0
  22. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/public/apple-touch-icon.png +0 -0
  23. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/public/fantasy.svg +0 -0
  24. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/public/favicon-16x16.png +0 -0
  25. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/public/favicon-32x32.png +0 -0
  26. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/public/favicon.ico +0 -0
  27. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/public/game.svg +0 -0
  28. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/public/logo_dark.png +0 -0
  29. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/public/logo_light.png +0 -0
  30. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/public/movie.svg +0 -0
  31. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/public/thriller.svg +0 -0
  32. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/setup/__init__.py +0 -0
  33. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/setup/build.py +0 -0
  34. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/setup/config.yaml +0 -0
  35. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/setup/post_install.py +0 -0
  36. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/setup/setup_conda_env.py +0 -0
  37. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/setup/setup_conda_env.sh +0 -0
  38. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/setup.py +0 -0
  39. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/test.py +0 -0
  40. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/train.py +0 -0
  41. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/README.md +0 -0
  42. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/chat.py +0 -0
  43. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/code.py +0 -0
  44. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/.chainlit/translations/bn.json +0 -0
  45. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/.chainlit/translations/en-US.json +0 -0
  46. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/.chainlit/translations/gu.json +0 -0
  47. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/.chainlit/translations/he-IL.json +0 -0
  48. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/.chainlit/translations/hi.json +0 -0
  49. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/.chainlit/translations/kn.json +0 -0
  50. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/.chainlit/translations/ml.json +0 -0
  51. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/.chainlit/translations/mr.json +0 -0
  52. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/.chainlit/translations/ta.json +0 -0
  53. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/.chainlit/translations/te.json +0 -0
  54. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/.chainlit/translations/zh-CN.json +0 -0
  55. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/chainlit.md +0 -0
  56. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/translations/bn.json +0 -0
  57. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/translations/en-US.json +0 -0
  58. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/translations/gu.json +0 -0
  59. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/translations/he-IL.json +0 -0
  60. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/translations/hi.json +0 -0
  61. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/translations/kn.json +0 -0
  62. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/translations/ml.json +0 -0
  63. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/translations/mr.json +0 -0
  64. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/translations/ta.json +0 -0
  65. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/translations/te.json +0 -0
  66. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/config/translations/zh-CN.json +0 -0
  67. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/context.py +0 -0
  68. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/db.py +0 -0
  69. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/public/fantasy.svg +0 -0
  70. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/public/game.svg +0 -0
  71. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/public/logo_dark.png +0 -0
  72. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/public/logo_light.png +0 -0
  73. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/public/movie.svg +0 -0
  74. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/public/praison.css +0 -0
  75. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/public/thriller.svg +0 -0
  76. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/realtime.py +0 -0
  77. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/realtimeclient/__init__.py +0 -0
  78. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/realtimeclient/realtimedocs.txt +0 -0
  79. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/realtimeclient/tools.py +0 -0
  80. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/ui/sql_alchemy.py +0 -0
  81. {praisonai-1.0.10 → praisonai-1.0.11}/praisonai/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PraisonAI
3
- Version: 1.0.10
3
+ Version: 1.0.11
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
@@ -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==1.0.10 gunicorn markdown\n")
59
+ file.write("RUN pip install flask praisonai==1.0.11 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
 
@@ -0,0 +1,269 @@
1
+ import os
2
+ import asyncio
3
+ from pathlib import Path
4
+ import difflib
5
+ from typing import Dict, Any
6
+ from litellm import acompletion
7
+ import json
8
+ import dotenv
9
+ from tavily import TavilyClient
10
+ from crawl4ai import AsyncWebCrawler
11
+
12
+ dotenv.load_dotenv()
13
+
14
+ class AICoder:
15
+ def __init__(self, cwd: str = None, tavily_api_key: str = None):
16
+ self.cwd = cwd or os.getcwd()
17
+ self.tools = [
18
+ {
19
+ "type": "function",
20
+ "function": {
21
+ "name": "write_to_file",
22
+ "description": "Write content to a file at the specified path. If the file exists, it will be overwritten.",
23
+ "parameters": {
24
+ "type": "object",
25
+ "properties": {
26
+ "path": {
27
+ "type": "string",
28
+ "description": "The path of the file to write to."
29
+ },
30
+ "content": {
31
+ "type": "string",
32
+ "description": "The content to write to the file."
33
+ }
34
+ },
35
+ "required": ["path", "content"]
36
+ }
37
+ }
38
+ },
39
+ {
40
+ "type": "function",
41
+ "function": {
42
+ "name": "execute_command",
43
+ "description": "Execute a CLI command on the system.",
44
+ "parameters": {
45
+ "type": "object",
46
+ "properties": {
47
+ "command": {
48
+ "type": "string",
49
+ "description": "The CLI command to execute."
50
+ }
51
+ },
52
+ "required": ["command"]
53
+ }
54
+ }
55
+ },
56
+ {
57
+ "type": "function",
58
+ "function": {
59
+ "name": "read_file",
60
+ "description": "Read the contents of a file at the specified path.",
61
+ "parameters": {
62
+ "type": "object",
63
+ "properties": {
64
+ "path": {
65
+ "type": "string",
66
+ "description": "The path of the file to read."
67
+ }
68
+ },
69
+ "required": ["path"]
70
+ }
71
+ }
72
+ }
73
+ ]
74
+
75
+ self.tavily_api_key = tavily_api_key
76
+ if self.tavily_api_key:
77
+ self.tavily_client = TavilyClient(api_key=self.tavily_api_key)
78
+ self.tools.append({
79
+ "type": "function",
80
+ "function": {
81
+ "name": "tavily_web_search",
82
+ "description": "Search the web using Tavily API and crawl the resulting URLs",
83
+ "parameters": {
84
+ "type": "object",
85
+ "properties": {
86
+ "query": {"type": "string", "description": "Search query"}
87
+ },
88
+ "required": ["query"]
89
+ }
90
+ }
91
+ })
92
+ else:
93
+ self.tavily_client = None
94
+
95
+ async def create_directories(self, file_path):
96
+ file_path_obj = Path(file_path)
97
+ dir_path = file_path_obj.parent
98
+ if not dir_path.exists():
99
+ os.makedirs(dir_path, exist_ok=True)
100
+ return dir_path
101
+
102
+ async def file_exists(self, file_path):
103
+ return Path(file_path).exists()
104
+
105
+ async def write_to_file(self, file_path, content, existing=False):
106
+ if not existing:
107
+ await self.create_directories(file_path)
108
+ try:
109
+ with open(file_path, 'w') as file:
110
+ file.write(content)
111
+ return True
112
+ except Exception as e:
113
+ return False
114
+
115
+ async def read_file(self, file_path):
116
+ try:
117
+ with open(file_path, 'r') as file:
118
+ return file.read()
119
+ except:
120
+ return None
121
+
122
+ async def execute_command(self, command: str):
123
+ try:
124
+ process = await asyncio.create_subprocess_shell(
125
+ command,
126
+ stdout=asyncio.subprocess.PIPE,
127
+ stderr=asyncio.subprocess.PIPE,
128
+ cwd=self.cwd
129
+ )
130
+ stdout, stderr = await process.communicate()
131
+ if stdout:
132
+ return f"Command output:\n{stdout.decode()}"
133
+ if stderr:
134
+ return f"Command error:\n{stderr.decode()}"
135
+ return process.returncode == 0
136
+ except Exception as e:
137
+ return f"Error executing command: {str(e)}"
138
+
139
+ async def tavily_web_search(self, query):
140
+ if not self.tavily_client:
141
+ return json.dumps({
142
+ "query": query,
143
+ "error": "Tavily API key is not set. Web search is unavailable."
144
+ })
145
+ response = self.tavily_client.search(query)
146
+ results = []
147
+ async with AsyncWebCrawler() as crawler:
148
+ for result in response.get('results', []):
149
+ url = result.get('url')
150
+ if url:
151
+ try:
152
+ crawl_result = await crawler.arun(url=url)
153
+ results.append({
154
+ "content": result.get('content'),
155
+ "url": url,
156
+ "full_content": crawl_result.markdown
157
+ })
158
+ except Exception:
159
+ results.append({
160
+ "content": result.get('content'),
161
+ "url": url,
162
+ "full_content": "Error: Unable to crawl this URL"
163
+ })
164
+ return json.dumps({
165
+ "query": query,
166
+ "results": results
167
+ })
168
+
169
+ def generate_diff(self, original_content: str, new_content: str, filename="file.txt"):
170
+ diff_lines = difflib.unified_diff(
171
+ original_content.splitlines(keepends=True),
172
+ new_content.splitlines(keepends=True),
173
+ fromfile=f"original_{filename}",
174
+ tofile=f"modified_{filename}"
175
+ )
176
+ return "".join(diff_lines)
177
+
178
+ def parse_json_response(self, json_object: Dict) -> Dict[str, Any]:
179
+ if 'choices' in json_object and json_object['choices'][0]['message']:
180
+ message = json_object['choices'][0]['message']
181
+ if 'tool_calls' in message and message['tool_calls']:
182
+ return {"type": "tool_calls", "data": message['tool_calls']}
183
+ return {"type": "content", "data": message.get('content', "")}
184
+ return {"type": "content", "data": json.dumps(json_object)}
185
+
186
+ def parse_llm_response(self, response: Any) -> Dict[str, Any]:
187
+ if response is None:
188
+ return {"type": "content", "data": ""}
189
+ if isinstance(response, str):
190
+ try:
191
+ json_object = json.loads(response)
192
+ if isinstance(json_object, dict):
193
+ return self.parse_json_response(json_object)
194
+ except json.JSONDecodeError:
195
+ return {"type": "content", "data": response}
196
+ if hasattr(response, 'choices') and response.choices:
197
+ message = response.choices[0].message
198
+ if hasattr(message, 'tool_calls') and message.tool_calls:
199
+ tool_calls_data = []
200
+ for tool_call in message.tool_calls:
201
+ tool_calls_data.append({
202
+ 'id': tool_call.id,
203
+ 'type': tool_call.type,
204
+ 'function': {
205
+ 'name': tool_call.function.name,
206
+ 'arguments': tool_call.function.arguments
207
+ }
208
+ })
209
+ return {"type": "tool_calls", "data": tool_calls_data}
210
+ return {"type": "content", "data": message.content or ""}
211
+ return {"type": "content", "data": str(response)}
212
+
213
+ async def apply_llm_response(self, task, llm_response):
214
+ parsed_response = self.parse_llm_response(llm_response)
215
+ if parsed_response["type"] == "tool_calls":
216
+ for tool_call in parsed_response["data"]:
217
+ if tool_call["function"]["name"] == "write_to_file":
218
+ args = json.loads(tool_call["function"]["arguments"])
219
+ file_path = os.path.join(self.cwd, args["path"].strip())
220
+ content = args["content"]
221
+ if await self.file_exists(file_path):
222
+ original_content = await self.read_file(file_path)
223
+ file_diff = self.generate_diff(original_content, content, os.path.basename(file_path))
224
+ # Interaction with user removed for automation context
225
+ return await self.write_to_file(file_path, content, True)
226
+ else:
227
+ return await self.write_to_file(file_path, content)
228
+ elif tool_call["function"]["name"] == "execute_command":
229
+ args = json.loads(tool_call["function"]["arguments"])
230
+ command = args.get("command", "").strip()
231
+ if command:
232
+ return await self.execute_command(command)
233
+ else:
234
+ return False
235
+ elif tool_call["function"]["name"] == "read_file":
236
+ args = json.loads(tool_call["function"]["arguments"])
237
+ file_path = args.get("path", "").strip()
238
+ if file_path:
239
+ content = await self.read_file(os.path.join(self.cwd, file_path))
240
+ return True if content is not None else False
241
+ else:
242
+ return False
243
+ elif tool_call["function"]["name"] == "tavily_web_search":
244
+ args = json.loads(tool_call["function"]["arguments"])
245
+ return await self.tavily_web_search(args.get("query"))
246
+ else:
247
+ return False
248
+ return True
249
+
250
+ async def process_task(self, task: str):
251
+ llm_response = await acompletion(
252
+ model="gpt-4",
253
+ messages=[
254
+ {"role": "user", "content": task}
255
+ ],
256
+ tools=self.tools,
257
+ tool_choice="auto"
258
+ )
259
+ return await self.apply_llm_response(task, llm_response)
260
+
261
+ async def main():
262
+ ai_coder = AICoder()
263
+ await ai_coder.process_task("Create a file called `hello.txt` with the content 'Hello, world!'")
264
+ await ai_coder.process_task("Edit the file called `hello.txt` and change the content to 'Hello again, world!'")
265
+ await ai_coder.process_task("Show me the current working directory")
266
+ await ai_coder.process_task("Read the contents of hello.txt")
267
+
268
+ if __name__ == "__main__":
269
+ asyncio.run(main())
@@ -69,7 +69,7 @@ cot = "full"
69
69
 
70
70
  # Specify a CSS file that can be used to customize the user interface.
71
71
  # The CSS file can be served from the public directory or via an external link.
72
- custom_css = "https://cdn.jsdelivr.net/gh/MervinPraison/PraisonAI@1.0.10/praisonai/ui/public/praison.css"
72
+ custom_css = "https://cdn.jsdelivr.net/gh/MervinPraison/PraisonAI@1.0.11/praisonai/ui/public/praison.css"
73
73
 
74
74
  # Specify a Javascript file that can be used to customize the user interface.
75
75
  # The Javascript file can be served from the public directory.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "PraisonAI"
3
- version = "1.0.10"
3
+ version = "1.0.11"
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
  readme = "README.md"
6
6
  license = ""
@@ -10,7 +10,7 @@ authors = [
10
10
 
11
11
  [tool.poetry]
12
12
  name = "PraisonAI"
13
- version = "1.0.10"
13
+ version = "1.0.11"
14
14
  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."
15
15
  authors = ["Mervin Praison"]
16
16
  license = ""
File without changes
File without changes
File without changes
File without changes
File without changes