PraisonAI 2.2.19__cp313-cp313-manylinux_2_39_x86_64.whl → 2.2.21__cp313-cp313-manylinux_2_39_x86_64.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/__init__.py +1 -1
- praisonai/api/call.py +3 -3
- praisonai/cli.py +69 -10
- praisonai/deploy.py +1 -1
- praisonai/ui/chat.py +2 -2
- praisonai/ui/code.py +3 -3
- praisonai/ui/components/aicoder.py +2 -2
- praisonai/ui/realtimeclient/tools.py +3 -3
- {praisonai-2.2.19.dist-info → praisonai-2.2.21.dist-info}/METADATA +1 -1
- {praisonai-2.2.19.dist-info → praisonai-2.2.21.dist-info}/RECORD +12 -12
- {praisonai-2.2.19.dist-info → praisonai-2.2.21.dist-info}/entry_points.txt +1 -1
- {praisonai-2.2.19.dist-info → praisonai-2.2.21.dist-info}/WHEEL +0 -0
praisonai/__init__.py
CHANGED
praisonai/api/call.py
CHANGED
|
@@ -39,9 +39,6 @@ LOG_EVENT_TYPES = [
|
|
|
39
39
|
|
|
40
40
|
app = FastAPI()
|
|
41
41
|
|
|
42
|
-
if not OPENAI_API_KEY:
|
|
43
|
-
raise ValueError('Missing the OpenAI API key. Please set it in the .env file.')
|
|
44
|
-
|
|
45
42
|
# Set up logging
|
|
46
43
|
logger = logging.getLogger(__name__)
|
|
47
44
|
log_level = os.getenv("LOGLEVEL", "INFO").upper()
|
|
@@ -266,6 +263,9 @@ def setup_public_url(port):
|
|
|
266
263
|
|
|
267
264
|
def run_server(port: int, use_public: bool = False):
|
|
268
265
|
"""Run the FastAPI server using uvicorn."""
|
|
266
|
+
if not OPENAI_API_KEY:
|
|
267
|
+
raise ValueError('Missing the OpenAI API key. Please set it in the .env file or configure it through the GUI.')
|
|
268
|
+
|
|
269
269
|
if use_public:
|
|
270
270
|
setup_public_url(port)
|
|
271
271
|
else:
|
praisonai/cli.py
CHANGED
|
@@ -54,7 +54,7 @@ except ImportError:
|
|
|
54
54
|
pass
|
|
55
55
|
|
|
56
56
|
try:
|
|
57
|
-
|
|
57
|
+
import crewai
|
|
58
58
|
CREWAI_AVAILABLE = True
|
|
59
59
|
except ImportError:
|
|
60
60
|
pass
|
|
@@ -147,6 +147,21 @@ class PraisonAI:
|
|
|
147
147
|
"""
|
|
148
148
|
return self.main()
|
|
149
149
|
|
|
150
|
+
def read_stdin_if_available(self):
|
|
151
|
+
"""
|
|
152
|
+
Read from stdin if it's available (when data is piped in).
|
|
153
|
+
Returns the stdin content or None if no piped input is available.
|
|
154
|
+
"""
|
|
155
|
+
try:
|
|
156
|
+
# Check if stdin is not a terminal (i.e., has piped input)
|
|
157
|
+
if not sys.stdin.isatty():
|
|
158
|
+
stdin_content = sys.stdin.read().strip()
|
|
159
|
+
return stdin_content if stdin_content else None
|
|
160
|
+
except Exception:
|
|
161
|
+
# If there's any error reading stdin, ignore it
|
|
162
|
+
pass
|
|
163
|
+
return None
|
|
164
|
+
|
|
150
165
|
def main(self):
|
|
151
166
|
"""
|
|
152
167
|
The main function of the PraisonAI object. It parses the command-line arguments,
|
|
@@ -164,21 +179,41 @@ class PraisonAI:
|
|
|
164
179
|
|
|
165
180
|
self.framework = args.framework or self.framework
|
|
166
181
|
|
|
182
|
+
# Check for piped input from stdin
|
|
183
|
+
stdin_input = self.read_stdin_if_available()
|
|
184
|
+
|
|
167
185
|
if args.command:
|
|
168
186
|
if args.command.startswith("tests.test") or args.command.startswith("tests/test"): # Argument used for testing purposes
|
|
169
187
|
print("test")
|
|
170
188
|
return "test"
|
|
171
189
|
else:
|
|
172
|
-
|
|
190
|
+
# If stdin input is available, append it to the command
|
|
191
|
+
if stdin_input:
|
|
192
|
+
combined_prompt = f"{args.command} {stdin_input}"
|
|
193
|
+
result = self.handle_direct_prompt(combined_prompt)
|
|
194
|
+
print(result)
|
|
195
|
+
return result
|
|
196
|
+
else:
|
|
197
|
+
self.agent_file = args.command
|
|
173
198
|
elif hasattr(args, 'direct_prompt') and args.direct_prompt:
|
|
174
199
|
# Only handle direct prompt if agent_file wasn't explicitly set in constructor
|
|
175
200
|
if original_agent_file == "agents.yaml": # Default value, so safe to use direct prompt
|
|
176
|
-
|
|
201
|
+
# If stdin input is available, append it to the direct prompt
|
|
202
|
+
prompt = args.direct_prompt
|
|
203
|
+
if stdin_input:
|
|
204
|
+
prompt = f"{args.direct_prompt} {stdin_input}"
|
|
205
|
+
result = self.handle_direct_prompt(prompt)
|
|
177
206
|
print(result)
|
|
178
207
|
return result
|
|
179
208
|
else:
|
|
180
209
|
# Agent file was explicitly set, ignore direct prompt and use the file
|
|
181
210
|
pass
|
|
211
|
+
elif stdin_input:
|
|
212
|
+
# If only stdin input is provided (no command), use it as direct prompt
|
|
213
|
+
if original_agent_file == "agents.yaml": # Default value, so safe to use stdin as prompt
|
|
214
|
+
result = self.handle_direct_prompt(stdin_input)
|
|
215
|
+
print(result)
|
|
216
|
+
return result
|
|
182
217
|
# If no command or direct_prompt, preserve agent_file from constructor (don't overwrite)
|
|
183
218
|
|
|
184
219
|
if args.deploy:
|
|
@@ -248,17 +283,29 @@ class PraisonAI:
|
|
|
248
283
|
print("All packages installed")
|
|
249
284
|
return
|
|
250
285
|
|
|
286
|
+
# Check if conda is available and environment exists
|
|
287
|
+
conda_available = True
|
|
288
|
+
conda_env_exists = False
|
|
289
|
+
|
|
251
290
|
try:
|
|
252
291
|
result = subprocess.check_output(['conda', 'env', 'list'])
|
|
253
292
|
if 'praison_env' in result.decode('utf-8'):
|
|
254
293
|
print("Conda environment 'praison_env' found.")
|
|
294
|
+
conda_env_exists = True
|
|
255
295
|
else:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
296
|
+
print("Conda environment 'praison_env' not found. Setting it up...")
|
|
297
|
+
from praisonai.setup.setup_conda_env import main as setup_conda_main
|
|
298
|
+
setup_conda_main()
|
|
299
|
+
print("All packages installed.")
|
|
300
|
+
# Check again if environment was created successfully
|
|
301
|
+
try:
|
|
302
|
+
result = subprocess.check_output(['conda', 'env', 'list'])
|
|
303
|
+
conda_env_exists = 'praison_env' in result.decode('utf-8')
|
|
304
|
+
except subprocess.CalledProcessError:
|
|
305
|
+
conda_env_exists = False
|
|
306
|
+
except (subprocess.CalledProcessError, FileNotFoundError):
|
|
307
|
+
print("Conda not available or failed to check environment.")
|
|
308
|
+
conda_available = False
|
|
262
309
|
|
|
263
310
|
train_args = sys.argv[2:] # Get all arguments after 'train'
|
|
264
311
|
|
|
@@ -278,7 +325,18 @@ class PraisonAI:
|
|
|
278
325
|
env = os.environ.copy()
|
|
279
326
|
env['PYTHONUNBUFFERED'] = '1'
|
|
280
327
|
|
|
281
|
-
|
|
328
|
+
# Try conda run first, fallback to direct Python execution
|
|
329
|
+
if conda_available and conda_env_exists:
|
|
330
|
+
try:
|
|
331
|
+
print("Attempting to run training using conda environment...")
|
|
332
|
+
stream_subprocess(['conda', 'run', '--no-capture-output', '--name', 'praison_env', 'python', '-u', train_script_path, 'train'], env=env)
|
|
333
|
+
except subprocess.CalledProcessError as e:
|
|
334
|
+
print(f"Conda run failed with error: {e}")
|
|
335
|
+
print("Falling back to direct Python execution...")
|
|
336
|
+
stream_subprocess([sys.executable, '-u', train_script_path, 'train'], env=env)
|
|
337
|
+
else:
|
|
338
|
+
print("Conda environment not available, using direct Python execution...")
|
|
339
|
+
stream_subprocess([sys.executable, '-u', train_script_path, 'train'], env=env)
|
|
282
340
|
return
|
|
283
341
|
|
|
284
342
|
if args.auto or self.auto:
|
|
@@ -500,6 +558,7 @@ class PraisonAI:
|
|
|
500
558
|
result = agent.start(prompt)
|
|
501
559
|
return result
|
|
502
560
|
elif CREWAI_AVAILABLE:
|
|
561
|
+
from crewai import Agent, Task, Crew
|
|
503
562
|
agent_config = {
|
|
504
563
|
"name": "DirectAgent",
|
|
505
564
|
"role": "Assistant",
|
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==2.2.
|
|
59
|
+
file.write("RUN pip install flask praisonai==2.2.21 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
|
|
praisonai/ui/chat.py
CHANGED
|
@@ -12,7 +12,7 @@ import base64
|
|
|
12
12
|
from dotenv import load_dotenv
|
|
13
13
|
from PIL import Image
|
|
14
14
|
from tavily import TavilyClient
|
|
15
|
-
from crawl4ai import
|
|
15
|
+
from crawl4ai import AsyncAsyncWebCrawler
|
|
16
16
|
|
|
17
17
|
# Local application/library imports
|
|
18
18
|
import chainlit as cl
|
|
@@ -72,7 +72,7 @@ async def tavily_web_search(query):
|
|
|
72
72
|
response = tavily_client.search(query)
|
|
73
73
|
logger.debug(f"Tavily search response: {response}")
|
|
74
74
|
|
|
75
|
-
async with
|
|
75
|
+
async with AsyncAsyncWebCrawler() as crawler:
|
|
76
76
|
results = []
|
|
77
77
|
for result in response.get('results', []):
|
|
78
78
|
url = result.get('url')
|
praisonai/ui/code.py
CHANGED
|
@@ -12,7 +12,7 @@ from dotenv import load_dotenv
|
|
|
12
12
|
from PIL import Image
|
|
13
13
|
from context import ContextGatherer
|
|
14
14
|
from tavily import TavilyClient
|
|
15
|
-
from crawl4ai import
|
|
15
|
+
from crawl4ai import AsyncAsyncWebCrawler
|
|
16
16
|
|
|
17
17
|
# Local application/library imports
|
|
18
18
|
import chainlit as cl
|
|
@@ -153,8 +153,8 @@ async def tavily_web_search(query):
|
|
|
153
153
|
response = tavily_client.search(query)
|
|
154
154
|
logger.debug(f"Tavily search response: {response}")
|
|
155
155
|
|
|
156
|
-
# Create an instance of
|
|
157
|
-
async with
|
|
156
|
+
# Create an instance of AsyncAsyncWebCrawler
|
|
157
|
+
async with AsyncAsyncWebCrawler() as crawler:
|
|
158
158
|
# Prepare the results
|
|
159
159
|
results = []
|
|
160
160
|
for result in response.get('results', []):
|
|
@@ -7,7 +7,7 @@ from litellm import acompletion
|
|
|
7
7
|
import json
|
|
8
8
|
import dotenv
|
|
9
9
|
from tavily import TavilyClient
|
|
10
|
-
from crawl4ai import
|
|
10
|
+
from crawl4ai import AsyncAsyncWebCrawler
|
|
11
11
|
|
|
12
12
|
dotenv.load_dotenv()
|
|
13
13
|
|
|
@@ -144,7 +144,7 @@ class AICoder:
|
|
|
144
144
|
})
|
|
145
145
|
response = self.tavily_client.search(query)
|
|
146
146
|
results = []
|
|
147
|
-
async with
|
|
147
|
+
async with AsyncAsyncWebCrawler() as crawler:
|
|
148
148
|
for result in response.get('results', []):
|
|
149
149
|
url = result.get('url')
|
|
150
150
|
if url:
|
|
@@ -3,7 +3,7 @@ import chainlit as cl
|
|
|
3
3
|
import plotly
|
|
4
4
|
import json
|
|
5
5
|
from tavily import TavilyClient
|
|
6
|
-
from crawl4ai import
|
|
6
|
+
from crawl4ai import AsyncWebCrawler
|
|
7
7
|
import os
|
|
8
8
|
import logging
|
|
9
9
|
import asyncio
|
|
@@ -122,7 +122,7 @@ async def tavily_web_search_handler(query):
|
|
|
122
122
|
})
|
|
123
123
|
|
|
124
124
|
def process_tavily_results(response):
|
|
125
|
-
crawler =
|
|
125
|
+
crawler = AsyncWebCrawler()
|
|
126
126
|
crawler.warmup()
|
|
127
127
|
results = []
|
|
128
128
|
for result in response.get('results', []):
|
|
@@ -151,7 +151,7 @@ async def fallback_to_duckduckgo(query):
|
|
|
151
151
|
|
|
152
152
|
logger.debug(f"DuckDuckGo search results: {ddg_results}")
|
|
153
153
|
|
|
154
|
-
crawler =
|
|
154
|
+
crawler = AsyncWebCrawler()
|
|
155
155
|
crawler.warmup()
|
|
156
156
|
results = []
|
|
157
157
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: PraisonAI
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.21
|
|
4
4
|
Summary: PraisonAI is an AI Agents Framework with Self Reflection. PraisonAI application combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customisation, and efficient human-agent collaboration.
|
|
5
5
|
Author: Mervin Praison
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
praisonai/README.md,sha256=dXaEAByiWlJPE8_k-13lsNIEuvHdzmzJzJ8IVa84thM,195
|
|
2
|
-
praisonai/__init__.py,sha256=
|
|
2
|
+
praisonai/__init__.py,sha256=SAoNxA9ITH75eBUULjZZCu7Oia5m1gkQIS3Fl0dCpmY,176
|
|
3
3
|
praisonai/__main__.py,sha256=MVgsjMThjBexHt4nhd760JCqvP4x0IQcwo8kULOK4FQ,144
|
|
4
4
|
praisonai/agents_generator.py,sha256=IMD5VTYL0fUEiCUcoADGAfe2tBtPHJa-tRmN8g525bM,29353
|
|
5
|
-
praisonai/api/call.py,sha256
|
|
5
|
+
praisonai/api/call.py,sha256=-dV9DKNDi4w9vN6K63TUh15_PC0M5KzYOmBqHbuJqq0,11079
|
|
6
6
|
praisonai/auto.py,sha256=n4rhiNckKv0Vtn2OnhDVVuOBxmm3CpimM9Y-ZVN9H9E,9240
|
|
7
7
|
praisonai/chainlit_ui.py,sha256=VKf_--cONLIBMymMY8j-oj6Pq_rw3pHtXOqF2wZ9gYI,12220
|
|
8
|
-
praisonai/cli.py,sha256=
|
|
9
|
-
praisonai/deploy.py,sha256=
|
|
8
|
+
praisonai/cli.py,sha256=nGfkK78xz4mSK6zuOiNxDyoedJ3NMB-HWVZJ1x-J0aY,30859
|
|
9
|
+
praisonai/deploy.py,sha256=LHjAE47YqIXKlWaKBbDb5BAUDLwE0NK5lIHpCAc7Qis,6028
|
|
10
10
|
praisonai/inbuilt_tools/__init__.py,sha256=mZOEximj3zCyJHq9Lz0bGXhQpBsa_QR-R-yA9UKC3zI,565
|
|
11
11
|
praisonai/inbuilt_tools/autogen_tools.py,sha256=kJdEv61BTYvdHOaURNEpBcWq8Rs-oC03loNFTIjT-ak,4687
|
|
12
12
|
praisonai/inc/__init__.py,sha256=sPDlYBBwdk0VlWzaaM_lG0_LD07lS2HRGvPdxXJFiYg,62
|
|
@@ -39,11 +39,11 @@ praisonai/train_vision.py,sha256=OLDtr5u9rszWQ80LC5iFy37yPuYguES6AQybm_2RtM4,125
|
|
|
39
39
|
praisonai/ui/README.md,sha256=QG9yucvBieVjCjWFzu6hL9xNtYllkoqyJ_q1b0YYAco,1124
|
|
40
40
|
praisonai/ui/agents.py,sha256=wWtVHCQAvLxAe3vtcnivM0JWGuxshbhhwbX8t5VYTD4,32817
|
|
41
41
|
praisonai/ui/callbacks.py,sha256=V4_-GjxmjDFmugUZGfQHKtNSysx7rT6i1UblbM_8lIM,1968
|
|
42
|
-
praisonai/ui/chat.py,sha256=
|
|
43
|
-
praisonai/ui/code.py,sha256=
|
|
42
|
+
praisonai/ui/chat.py,sha256=8pLbn5gnmQFRCc9U_P5MyQgYUGHHloN3qjul8rm6ASI,13575
|
|
43
|
+
praisonai/ui/code.py,sha256=9nixOcdJa8z1YhRgH4I72B1AX7ZeXDNupl_52w7DS4g,16006
|
|
44
44
|
praisonai/ui/colab.py,sha256=A2NceDVazMy53mIpp-NIn5w3y8aQKwQu5LmHTepVwlo,19584
|
|
45
45
|
praisonai/ui/colab_chainlit.py,sha256=wrB1O0ttRlmOH8aMxU8QdGpse-X54U87ZcEEA3R1aFg,2432
|
|
46
|
-
praisonai/ui/components/aicoder.py,sha256=
|
|
46
|
+
praisonai/ui/components/aicoder.py,sha256=E2Tz3sWR9WKIPquO30T7aNzpe41XwYwy9UY3CXvSTlw,11165
|
|
47
47
|
praisonai/ui/config/chainlit.md,sha256=YCjGjkKOeW0w711tkAdEfC6sPgBRm6G3bxYPFeHx72U,28
|
|
48
48
|
praisonai/ui/config/translations/bn.json,sha256=m2TAaGMS-18_siW5dw4sbosh0Wn8ENWWzdGYkHaBrXw,22679
|
|
49
49
|
praisonai/ui/config/translations/en-US.json,sha256=QoQAg8P5Q5gbGASc-HAHcfhufk71-Uc1u_ewIBfHuLc,9821
|
|
@@ -69,12 +69,12 @@ praisonai/ui/public/thriller.svg,sha256=2dYY72EcgbEyTxS4QzjAm37Y4srtPWEW4vCMFki9
|
|
|
69
69
|
praisonai/ui/realtime.py,sha256=aVK-lbA57J9KHo3Lrknk4aaO1V1tRkiKXr_01zWrl30,17845
|
|
70
70
|
praisonai/ui/realtimeclient/__init__.py,sha256=zA2xa7rBUSw77wFkndJMQNNPqdH6ywQ3uf4WSYHjNfs,27513
|
|
71
71
|
praisonai/ui/realtimeclient/realtimedocs.txt,sha256=hmgd8Uwy2SkjSndyyF_-ZOaNxiyHwGaQLGc67DvV-sI,26395
|
|
72
|
-
praisonai/ui/realtimeclient/tools.py,sha256=
|
|
72
|
+
praisonai/ui/realtimeclient/tools.py,sha256=mVfnq7LnYn3sABCtiORgrMjlS5oVJ3wkDTZ-MYbci70,7870
|
|
73
73
|
praisonai/ui/sql_alchemy.py,sha256=ilWAWicUGja7ADbXW9_OgIYeyKNuAQ1ZI_RMqjmMI9k,29667
|
|
74
74
|
praisonai/ui/tools.md,sha256=Ad3YH_ZCLMWlz3mDXllQnQ_S5l55LWqLdcZSh-EXrHI,3956
|
|
75
75
|
praisonai/upload_vision.py,sha256=lMpFn993UiYVJxRNZQTmcbPbEajQ5TFKCNGK1Icn_hg,5253
|
|
76
76
|
praisonai/version.py,sha256=ugyuFliEqtAwQmH4sTlc16YXKYbFWDmfyk87fErB8-8,21
|
|
77
|
-
praisonai-2.2.
|
|
78
|
-
praisonai-2.2.
|
|
79
|
-
praisonai-2.2.
|
|
80
|
-
praisonai-2.2.
|
|
77
|
+
praisonai-2.2.21.dist-info/METADATA,sha256=BJtEl0tpnC33oCYNgkUQzdVanJSpLnSLVn-MoIycTjw,4739
|
|
78
|
+
praisonai-2.2.21.dist-info/WHEEL,sha256=dCzwOzx-VmbmLA5u8QpkARaxx3rsePBxa1nmZphhNQk,110
|
|
79
|
+
praisonai-2.2.21.dist-info/entry_points.txt,sha256=QSSfuXjZMhf16FZ201I_oSoX_s1nWYbi_4_UXPE3S-o,145
|
|
80
|
+
praisonai-2.2.21.dist-info/RECORD,,
|
|
File without changes
|