PraisonAI 2.2.63__tar.gz → 2.2.65__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.
- {praisonai-2.2.63 → praisonai-2.2.65}/PKG-INFO +7 -1
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/agents_generator.py +191 -12
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/auto.py +19 -4
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/chainlit_ui.py +1 -1
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/cli.py +1 -1
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/deploy.py +3 -3
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/inc/models.py +1 -1
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/agents.py +1 -1
- {praisonai-2.2.63 → praisonai-2.2.65}/pyproject.toml +13 -2
- {praisonai-2.2.63 → praisonai-2.2.65}/README.md +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/README.md +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/__init__.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/__main__.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/api/call.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/inbuilt_tools/__init__.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/inbuilt_tools/autogen_tools.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/inc/__init__.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/inc/config.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/android-chrome-192x192.png +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/android-chrome-512x512.png +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/apple-touch-icon.png +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/fantasy.svg +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/favicon-16x16.png +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/favicon-32x32.png +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/favicon.ico +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/game.svg +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/logo_dark.png +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/logo_light.png +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/movie.svg +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/praison-ai-agents-architecture-dark.png +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/praison-ai-agents-architecture.png +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/thriller.svg +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/scheduler.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/setup/__init__.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/setup/build.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/setup/config.yaml +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/setup/post_install.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/setup/setup_conda_env.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/setup/setup_conda_env.sh +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/setup.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/test.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/train.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/train_vision.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/README.md +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/callbacks.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/chat.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/code.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/colab.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/colab_chainlit.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/components/aicoder.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/config/chainlit.md +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/config/translations/bn.json +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/config/translations/en-US.json +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/config/translations/gu.json +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/config/translations/he-IL.json +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/config/translations/hi.json +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/config/translations/kn.json +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/config/translations/ml.json +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/config/translations/mr.json +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/config/translations/ta.json +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/config/translations/te.json +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/config/translations/zh-CN.json +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/context.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/database_config.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/db.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/public/fantasy.svg +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/public/game.svg +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/public/logo_dark.png +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/public/logo_light.png +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/public/movie.svg +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/public/praison.css +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/public/thriller.svg +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/realtime.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/realtimeclient/__init__.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/realtimeclient/tools.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/sql_alchemy.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/ui/tools.md +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/upload_vision.py +0 -0
- {praisonai-2.2.63 → praisonai-2.2.65}/praisonai/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: PraisonAI
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.65
|
|
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
|
|
@@ -12,6 +12,7 @@ Provides-Extra: agentops
|
|
|
12
12
|
Provides-Extra: anthropic
|
|
13
13
|
Provides-Extra: api
|
|
14
14
|
Provides-Extra: autogen
|
|
15
|
+
Provides-Extra: autogen-v4
|
|
15
16
|
Provides-Extra: call
|
|
16
17
|
Provides-Extra: chat
|
|
17
18
|
Provides-Extra: code
|
|
@@ -29,6 +30,9 @@ Requires-Dist: aiosqlite (>=0.20.0) ; extra == "chat"
|
|
|
29
30
|
Requires-Dist: aiosqlite (>=0.20.0) ; extra == "code"
|
|
30
31
|
Requires-Dist: aiosqlite (>=0.20.0) ; extra == "realtime"
|
|
31
32
|
Requires-Dist: aiosqlite (>=0.20.0) ; extra == "ui"
|
|
33
|
+
Requires-Dist: autogen-agentchat (>=0.4.0) ; extra == "autogen-v4"
|
|
34
|
+
Requires-Dist: autogen-core (>=0.4.0) ; extra == "autogen-v4"
|
|
35
|
+
Requires-Dist: autogen-ext[openai] (>=0.4.0) ; extra == "autogen-v4"
|
|
32
36
|
Requires-Dist: chainlit (==2.5.5) ; extra == "chat"
|
|
33
37
|
Requires-Dist: chainlit (==2.5.5) ; extra == "code"
|
|
34
38
|
Requires-Dist: chainlit (==2.5.5) ; extra == "realtime"
|
|
@@ -38,6 +42,7 @@ Requires-Dist: crawl4ai (>=0.6.0) ; extra == "code"
|
|
|
38
42
|
Requires-Dist: crawl4ai (>=0.6.0) ; extra == "realtime"
|
|
39
43
|
Requires-Dist: crewai (>=0.32.0) ; extra == "crewai"
|
|
40
44
|
Requires-Dist: crewai ; extra == "autogen"
|
|
45
|
+
Requires-Dist: crewai ; extra == "autogen-v4"
|
|
41
46
|
Requires-Dist: duckduckgo_search (>=6.3.0) ; extra == "realtime"
|
|
42
47
|
Requires-Dist: fastapi (>=0.115.0) ; extra == "api"
|
|
43
48
|
Requires-Dist: fastapi (>=0.95.0) ; extra == "call"
|
|
@@ -63,6 +68,7 @@ Requires-Dist: playwright (>=1.47.0) ; extra == "chat"
|
|
|
63
68
|
Requires-Dist: playwright (>=1.47.0) ; extra == "code"
|
|
64
69
|
Requires-Dist: plotly (>=5.24.0) ; extra == "realtime"
|
|
65
70
|
Requires-Dist: praisonai-tools (>=0.0.22) ; extra == "autogen"
|
|
71
|
+
Requires-Dist: praisonai-tools (>=0.0.22) ; extra == "autogen-v4"
|
|
66
72
|
Requires-Dist: praisonai-tools (>=0.0.22) ; extra == "crewai"
|
|
67
73
|
Requires-Dist: praisonaiagents (>=0.0.136)
|
|
68
74
|
Requires-Dist: pyautogen (==0.2.29) ; extra == "autogen"
|
|
@@ -14,10 +14,13 @@ import importlib
|
|
|
14
14
|
import importlib.util
|
|
15
15
|
import os
|
|
16
16
|
import logging
|
|
17
|
+
import re
|
|
18
|
+
import keyword
|
|
17
19
|
|
|
18
20
|
# Framework-specific imports with availability checks
|
|
19
21
|
CREWAI_AVAILABLE = False
|
|
20
22
|
AUTOGEN_AVAILABLE = False
|
|
23
|
+
AUTOGEN_V4_AVAILABLE = False
|
|
21
24
|
PRAISONAI_TOOLS_AVAILABLE = False
|
|
22
25
|
AGENTOPS_AVAILABLE = False
|
|
23
26
|
PRAISONAI_AVAILABLE = False
|
|
@@ -41,6 +44,17 @@ try:
|
|
|
41
44
|
except ImportError:
|
|
42
45
|
pass
|
|
43
46
|
|
|
47
|
+
try:
|
|
48
|
+
from autogen_agentchat.agents import AssistantAgent as AutoGenV4AssistantAgent
|
|
49
|
+
from autogen_ext.models.openai import OpenAIChatCompletionClient
|
|
50
|
+
from autogen_agentchat.teams import RoundRobinGroupChat
|
|
51
|
+
from autogen_agentchat.conditions import TextMentionTermination, MaxMessageTermination
|
|
52
|
+
from autogen_agentchat.messages import TextMessage
|
|
53
|
+
from autogen_core import CancellationToken
|
|
54
|
+
AUTOGEN_V4_AVAILABLE = True
|
|
55
|
+
except ImportError:
|
|
56
|
+
pass
|
|
57
|
+
|
|
44
58
|
try:
|
|
45
59
|
import agentops
|
|
46
60
|
AGENTOPS_AVAILABLE = True
|
|
@@ -70,6 +84,40 @@ os.environ["OTEL_SDK_DISABLED"] = "true"
|
|
|
70
84
|
def noop(*args, **kwargs):
|
|
71
85
|
pass
|
|
72
86
|
|
|
87
|
+
def sanitize_agent_name_for_autogen_v4(name):
|
|
88
|
+
"""
|
|
89
|
+
Sanitize agent name to be a valid Python identifier for AutoGen v0.4.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
name (str): The original agent name
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
str: A valid Python identifier
|
|
96
|
+
"""
|
|
97
|
+
# Convert to string and replace invalid characters with underscores
|
|
98
|
+
sanitized = re.sub(r'[^a-zA-Z0-9_]', '_', str(name))
|
|
99
|
+
|
|
100
|
+
# Collapse only very excessive underscores (5 or more) to reduce extreme cases
|
|
101
|
+
sanitized = re.sub(r'_{5,}', '_', sanitized)
|
|
102
|
+
|
|
103
|
+
# Remove trailing underscores only if not part of a dunder pattern and only if singular
|
|
104
|
+
if sanitized.endswith('_') and not sanitized.endswith('__') and sanitized != '_':
|
|
105
|
+
sanitized = sanitized.rstrip('_')
|
|
106
|
+
|
|
107
|
+
# Ensure it starts with a letter or underscore (not a digit)
|
|
108
|
+
if sanitized and sanitized[0].isdigit():
|
|
109
|
+
sanitized = 'agent_' + sanitized
|
|
110
|
+
|
|
111
|
+
# Handle empty string or only invalid characters (including single underscore from all invalid chars)
|
|
112
|
+
if not sanitized or sanitized == '_':
|
|
113
|
+
sanitized = 'agent'
|
|
114
|
+
|
|
115
|
+
# Check if it's a Python keyword and append underscore if so
|
|
116
|
+
if keyword.iskeyword(sanitized):
|
|
117
|
+
sanitized += '_'
|
|
118
|
+
|
|
119
|
+
return sanitized
|
|
120
|
+
|
|
73
121
|
def disable_crewai_telemetry():
|
|
74
122
|
if CREWAI_AVAILABLE:
|
|
75
123
|
for attr in dir(Telemetry):
|
|
@@ -123,8 +171,8 @@ class AgentsGenerator:
|
|
|
123
171
|
# Validate framework availability
|
|
124
172
|
if framework == "crewai" and not CREWAI_AVAILABLE:
|
|
125
173
|
raise ImportError("CrewAI is not installed. Please install it with 'pip install praisonai[crewai]'")
|
|
126
|
-
elif framework == "autogen" and not AUTOGEN_AVAILABLE:
|
|
127
|
-
raise ImportError("AutoGen is not installed. Please install it with 'pip install praisonai[autogen]'")
|
|
174
|
+
elif framework == "autogen" and not (AUTOGEN_AVAILABLE or AUTOGEN_V4_AVAILABLE):
|
|
175
|
+
raise ImportError("AutoGen is not installed. Please install it with 'pip install praisonai[autogen]' for v0.2 or 'pip install praisonai[autogen-v4]' for v0.4")
|
|
128
176
|
elif framework == "praisonai" and not PRAISONAI_AVAILABLE:
|
|
129
177
|
raise ImportError("PraisonAI is not installed. Please install it with 'pip install praisonaiagents'")
|
|
130
178
|
|
|
@@ -316,11 +364,35 @@ class AgentsGenerator:
|
|
|
316
364
|
framework = self.framework or config.get('framework')
|
|
317
365
|
|
|
318
366
|
if framework == "autogen":
|
|
319
|
-
if not AUTOGEN_AVAILABLE:
|
|
320
|
-
raise ImportError("AutoGen is not installed. Please install it with 'pip install praisonai[autogen]'")
|
|
367
|
+
if not (AUTOGEN_AVAILABLE or AUTOGEN_V4_AVAILABLE):
|
|
368
|
+
raise ImportError("AutoGen is not installed. Please install it with 'pip install praisonai[autogen]' for v0.2 or 'pip install praisonai[autogen-v4]' for v0.4")
|
|
369
|
+
|
|
370
|
+
# Choose autogen version based on availability and environment preference
|
|
371
|
+
# AUTOGEN_VERSION can be set to "v0.2" or "v0.4" to force a specific version
|
|
372
|
+
autogen_version = os.environ.get("AUTOGEN_VERSION", "auto").lower()
|
|
373
|
+
|
|
374
|
+
use_v4 = False
|
|
375
|
+
if autogen_version == "v0.4" and AUTOGEN_V4_AVAILABLE:
|
|
376
|
+
use_v4 = True
|
|
377
|
+
elif autogen_version == "v0.2" and AUTOGEN_AVAILABLE:
|
|
378
|
+
use_v4 = False
|
|
379
|
+
elif autogen_version == "auto":
|
|
380
|
+
# Default preference: use v0.4 if available, fallback to v0.2
|
|
381
|
+
use_v4 = AUTOGEN_V4_AVAILABLE
|
|
382
|
+
else:
|
|
383
|
+
# Fallback to whatever is available
|
|
384
|
+
use_v4 = AUTOGEN_V4_AVAILABLE and not AUTOGEN_AVAILABLE
|
|
385
|
+
|
|
321
386
|
if AGENTOPS_AVAILABLE:
|
|
322
|
-
|
|
323
|
-
|
|
387
|
+
version_tag = "autogen-v4" if use_v4 else "autogen-v2"
|
|
388
|
+
agentops.init(os.environ.get("AGENTOPS_API_KEY"), default_tags=[version_tag])
|
|
389
|
+
|
|
390
|
+
if use_v4:
|
|
391
|
+
self.logger.info("Using AutoGen v0.4")
|
|
392
|
+
return self._run_autogen_v4(config, topic, tools_dict)
|
|
393
|
+
else:
|
|
394
|
+
self.logger.info("Using AutoGen v0.2")
|
|
395
|
+
return self._run_autogen(config, topic, tools_dict)
|
|
324
396
|
elif framework == "praisonai":
|
|
325
397
|
if not PRAISONAI_AVAILABLE:
|
|
326
398
|
raise ImportError("PraisonAI is not installed. Please install it with 'pip install praisonaiagents'")
|
|
@@ -407,6 +479,113 @@ class AgentsGenerator:
|
|
|
407
479
|
|
|
408
480
|
return result
|
|
409
481
|
|
|
482
|
+
def _run_autogen_v4(self, config, topic, tools_dict):
|
|
483
|
+
"""
|
|
484
|
+
Run agents using the AutoGen v0.4 framework with async, event-driven architecture.
|
|
485
|
+
|
|
486
|
+
Args:
|
|
487
|
+
config (dict): Configuration dictionary
|
|
488
|
+
topic (str): The topic to process
|
|
489
|
+
tools_dict (dict): Dictionary of available tools
|
|
490
|
+
|
|
491
|
+
Returns:
|
|
492
|
+
str: Result of the agent interactions
|
|
493
|
+
"""
|
|
494
|
+
import asyncio
|
|
495
|
+
|
|
496
|
+
async def run_autogen_v4_async():
|
|
497
|
+
# Create model client for v0.4
|
|
498
|
+
model_config = self.config_list[0] if self.config_list else {}
|
|
499
|
+
model_client = OpenAIChatCompletionClient(
|
|
500
|
+
model=model_config.get('model', 'gpt-4o'),
|
|
501
|
+
api_key=model_config.get('api_key', os.environ.get("OPENAI_API_KEY")),
|
|
502
|
+
base_url=model_config.get('base_url', "https://api.openai.com/v1")
|
|
503
|
+
)
|
|
504
|
+
|
|
505
|
+
agents = []
|
|
506
|
+
combined_tasks = []
|
|
507
|
+
|
|
508
|
+
# Create agents from config
|
|
509
|
+
for role, details in config['roles'].items():
|
|
510
|
+
# For AutoGen v0.4, ensure agent name is a valid Python identifier
|
|
511
|
+
agent_name = details['role'].format(topic=topic).replace("{topic}", topic)
|
|
512
|
+
agent_name = sanitize_agent_name_for_autogen_v4(agent_name)
|
|
513
|
+
backstory = details['backstory'].format(topic=topic)
|
|
514
|
+
|
|
515
|
+
# Convert tools for v0.4 - simplified tool passing
|
|
516
|
+
agent_tools = []
|
|
517
|
+
for tool_name in details.get('tools', []):
|
|
518
|
+
if tool_name in tools_dict:
|
|
519
|
+
tool_instance = tools_dict[tool_name]
|
|
520
|
+
# For v0.4, we can pass the tool's run method directly if it's callable
|
|
521
|
+
if hasattr(tool_instance, 'run') and callable(tool_instance.run):
|
|
522
|
+
agent_tools.append(tool_instance.run)
|
|
523
|
+
|
|
524
|
+
# Create v0.4 AssistantAgent
|
|
525
|
+
assistant = AutoGenV4AssistantAgent(
|
|
526
|
+
name=agent_name,
|
|
527
|
+
system_message=backstory + ". Must reply with 'TERMINATE' when the task is complete.",
|
|
528
|
+
model_client=model_client,
|
|
529
|
+
tools=agent_tools,
|
|
530
|
+
reflect_on_tool_use=True
|
|
531
|
+
)
|
|
532
|
+
|
|
533
|
+
agents.append(assistant)
|
|
534
|
+
|
|
535
|
+
# Collect all task descriptions for sequential execution
|
|
536
|
+
for task_name, task_details in details.get('tasks', {}).items():
|
|
537
|
+
description_filled = task_details['description'].format(topic=topic)
|
|
538
|
+
combined_tasks.append(description_filled)
|
|
539
|
+
|
|
540
|
+
if not agents:
|
|
541
|
+
return "No agents created from configuration"
|
|
542
|
+
|
|
543
|
+
# Create termination conditions
|
|
544
|
+
text_termination = TextMentionTermination("TERMINATE")
|
|
545
|
+
max_messages_termination = MaxMessageTermination(max_messages=20)
|
|
546
|
+
termination_condition = text_termination | max_messages_termination
|
|
547
|
+
|
|
548
|
+
# Create RoundRobinGroupChat for parallel/sequential execution
|
|
549
|
+
group_chat = RoundRobinGroupChat(
|
|
550
|
+
agents,
|
|
551
|
+
termination_condition=termination_condition,
|
|
552
|
+
max_turns=len(agents) * 3 # Allow multiple rounds
|
|
553
|
+
)
|
|
554
|
+
|
|
555
|
+
# Combine all tasks into a single task description
|
|
556
|
+
task_description = f"Topic: {topic}\n\nTasks to complete:\n" + "\n".join(
|
|
557
|
+
f"{i+1}. {task}" for i, task in enumerate(combined_tasks)
|
|
558
|
+
)
|
|
559
|
+
|
|
560
|
+
# Run the group chat
|
|
561
|
+
try:
|
|
562
|
+
result = await group_chat.run(task=task_description)
|
|
563
|
+
|
|
564
|
+
# Extract the final message content
|
|
565
|
+
if result.messages:
|
|
566
|
+
final_message = result.messages[-1]
|
|
567
|
+
if hasattr(final_message, 'content'):
|
|
568
|
+
return f"### AutoGen v0.4 Output ###\n{final_message.content}"
|
|
569
|
+
else:
|
|
570
|
+
return f"### AutoGen v0.4 Output ###\n{str(final_message)}"
|
|
571
|
+
else:
|
|
572
|
+
return "### AutoGen v0.4 Output ###\nNo messages generated"
|
|
573
|
+
|
|
574
|
+
except Exception as e:
|
|
575
|
+
self.logger.error(f"Error in AutoGen v0.4 execution: {str(e)}")
|
|
576
|
+
return f"### AutoGen v0.4 Error ###\n{str(e)}"
|
|
577
|
+
|
|
578
|
+
finally:
|
|
579
|
+
# Close the model client
|
|
580
|
+
await model_client.close()
|
|
581
|
+
|
|
582
|
+
# Run the async function
|
|
583
|
+
try:
|
|
584
|
+
return asyncio.run(run_autogen_v4_async())
|
|
585
|
+
except Exception as e:
|
|
586
|
+
self.logger.error(f"Error running AutoGen v0.4: {str(e)}")
|
|
587
|
+
return f"### AutoGen v0.4 Error ###\n{str(e)}"
|
|
588
|
+
|
|
410
589
|
def _run_crewai(self, config, topic, tools_dict):
|
|
411
590
|
"""
|
|
412
591
|
Run agents using the CrewAI framework.
|
|
@@ -437,7 +616,7 @@ class AgentsGenerator:
|
|
|
437
616
|
llm_model = details.get('llm')
|
|
438
617
|
if llm_model:
|
|
439
618
|
llm = PraisonAIModel(
|
|
440
|
-
model=llm_model.get("model") or os.environ.get("MODEL_NAME") or "openai/gpt-4o",
|
|
619
|
+
model=llm_model.get("model") or os.environ.get("MODEL_NAME") or "openai/gpt-4o-mini",
|
|
441
620
|
base_url=self.config_list[0].get('base_url') if self.config_list else None,
|
|
442
621
|
api_key=self.config_list[0].get('api_key') if self.config_list else None
|
|
443
622
|
).get_model()
|
|
@@ -451,7 +630,7 @@ class AgentsGenerator:
|
|
|
451
630
|
function_calling_llm_model = details.get('function_calling_llm')
|
|
452
631
|
if function_calling_llm_model:
|
|
453
632
|
function_calling_llm = PraisonAIModel(
|
|
454
|
-
model=function_calling_llm_model.get("model") or os.environ.get("MODEL_NAME") or "openai/gpt-4o",
|
|
633
|
+
model=function_calling_llm_model.get("model") or os.environ.get("MODEL_NAME") or "openai/gpt-4o-mini",
|
|
455
634
|
base_url=self.config_list[0].get('base_url') if self.config_list else None,
|
|
456
635
|
api_key=self.config_list[0].get('api_key') if self.config_list else None
|
|
457
636
|
).get_model()
|
|
@@ -567,8 +746,8 @@ class AgentsGenerator:
|
|
|
567
746
|
backstory=backstory_filled,
|
|
568
747
|
tools=tools_list, # Pass the entire tools list to the agent
|
|
569
748
|
allow_delegation=details.get('allow_delegation', False),
|
|
570
|
-
llm=details.get('llm', {}).get("model") or os.environ.get("MODEL_NAME") or "openai/gpt-4o",
|
|
571
|
-
function_calling_llm=details.get('function_calling_llm', {}).get("model") or os.environ.get("MODEL_NAME") or "openai/gpt-4o",
|
|
749
|
+
llm=details.get('llm', {}).get("model") or os.environ.get("MODEL_NAME") or "openai/gpt-4o-mini",
|
|
750
|
+
function_calling_llm=details.get('function_calling_llm', {}).get("model") or os.environ.get("MODEL_NAME") or "openai/gpt-4o-mini",
|
|
572
751
|
max_iter=details.get('max_iter', 15),
|
|
573
752
|
max_rpm=details.get('max_rpm'),
|
|
574
753
|
max_execution_time=details.get('max_execution_time'),
|
|
@@ -577,7 +756,7 @@ class AgentsGenerator:
|
|
|
577
756
|
system_template=details.get('system_template'),
|
|
578
757
|
prompt_template=details.get('prompt_template'),
|
|
579
758
|
response_template=details.get('response_template'),
|
|
580
|
-
reflect_llm=details.get('reflect_llm', {}).get("model") or os.environ.get("MODEL_NAME") or "openai/gpt-4o",
|
|
759
|
+
reflect_llm=details.get('reflect_llm', {}).get("model") or os.environ.get("MODEL_NAME") or "openai/gpt-4o-mini",
|
|
581
760
|
min_reflect=details.get('min_reflect', 1),
|
|
582
761
|
max_reflect=details.get('max_reflect', 3),
|
|
583
762
|
)
|
|
@@ -633,7 +812,7 @@ class AgentsGenerator:
|
|
|
633
812
|
tasks=tasks,
|
|
634
813
|
verbose=True,
|
|
635
814
|
process="hierarchical",
|
|
636
|
-
manager_llm=config.get('manager_llm') or os.environ.get("MODEL_NAME") or "openai/gpt-4o",
|
|
815
|
+
manager_llm=config.get('manager_llm') or os.environ.get("MODEL_NAME") or "openai/gpt-4o-mini",
|
|
637
816
|
memory=memory
|
|
638
817
|
)
|
|
639
818
|
else:
|
|
@@ -32,6 +32,13 @@ try:
|
|
|
32
32
|
except ImportError:
|
|
33
33
|
pass
|
|
34
34
|
|
|
35
|
+
try:
|
|
36
|
+
from autogen_agentchat.agents import AssistantAgent
|
|
37
|
+
from autogen_ext.models.openai import OpenAIChatCompletionClient
|
|
38
|
+
AUTOGEN_V4_AVAILABLE = True
|
|
39
|
+
except ImportError:
|
|
40
|
+
AUTOGEN_V4_AVAILABLE = False
|
|
41
|
+
|
|
35
42
|
try:
|
|
36
43
|
from praisonai_tools import (
|
|
37
44
|
CodeDocsSearchTool, CSVSearchTool, DirectorySearchTool, DOCXSearchTool,
|
|
@@ -73,10 +80,11 @@ class AutoGenerator:
|
|
|
73
80
|
CrewAI is not installed. Please install with:
|
|
74
81
|
pip install "praisonai[crewai]"
|
|
75
82
|
""")
|
|
76
|
-
elif framework == "autogen" and not AUTOGEN_AVAILABLE:
|
|
83
|
+
elif framework == "autogen" and not (AUTOGEN_AVAILABLE or AUTOGEN_V4_AVAILABLE):
|
|
77
84
|
raise ImportError("""
|
|
78
85
|
AutoGen is not installed. Please install with:
|
|
79
|
-
pip install "praisonai[autogen]"
|
|
86
|
+
pip install "praisonai[autogen]" for v0.2
|
|
87
|
+
pip install "praisonai[autogen-v4]" for v0.4
|
|
80
88
|
""")
|
|
81
89
|
elif framework == "praisonai" and not PRAISONAI_AVAILABLE:
|
|
82
90
|
raise ImportError("""
|
|
@@ -86,14 +94,21 @@ Praisonai is not installed. Please install with:
|
|
|
86
94
|
|
|
87
95
|
# Only show tools message if using a framework and tools are needed
|
|
88
96
|
if (framework in ["crewai", "autogen"]) and not PRAISONAI_TOOLS_AVAILABLE:
|
|
89
|
-
|
|
97
|
+
if framework == "autogen":
|
|
98
|
+
logging.warning("""
|
|
99
|
+
Tools are not available for autogen. To use tools, install:
|
|
100
|
+
pip install "praisonai[autogen]" for v0.2
|
|
101
|
+
pip install "praisonai[autogen-v4]" for v0.4
|
|
102
|
+
""")
|
|
103
|
+
else:
|
|
104
|
+
logging.warning(f"""
|
|
90
105
|
Tools are not available for {framework}. To use tools, install:
|
|
91
106
|
pip install "praisonai[{framework}]"
|
|
92
107
|
""")
|
|
93
108
|
|
|
94
109
|
# Support multiple environment variable patterns for better compatibility
|
|
95
110
|
# Priority order: MODEL_NAME > OPENAI_MODEL_NAME for model selection
|
|
96
|
-
model_name = os.environ.get("MODEL_NAME") or os.environ.get("OPENAI_MODEL_NAME", "gpt-4o")
|
|
111
|
+
model_name = os.environ.get("MODEL_NAME") or os.environ.get("OPENAI_MODEL_NAME", "gpt-4o-mini")
|
|
97
112
|
|
|
98
113
|
# Priority order for base_url: OPENAI_BASE_URL > OPENAI_API_BASE > OLLAMA_API_BASE
|
|
99
114
|
# OPENAI_BASE_URL is the standard OpenAI SDK environment variable
|
|
@@ -16,7 +16,7 @@ logging.basicConfig(level=os.environ.get('LOGLEVEL', 'INFO').upper(), format='%(
|
|
|
16
16
|
framework = "crewai"
|
|
17
17
|
config_list = [
|
|
18
18
|
{
|
|
19
|
-
'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4o"),
|
|
19
|
+
'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4o-mini"),
|
|
20
20
|
'base_url': os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1"),
|
|
21
21
|
'api_key': os.environ.get("OPENAI_API_KEY", "")
|
|
22
22
|
}
|
|
@@ -124,7 +124,7 @@ class PraisonAI:
|
|
|
124
124
|
# Create config_list with AutoGen compatibility
|
|
125
125
|
# Support multiple environment variable patterns for better compatibility
|
|
126
126
|
# Priority order: MODEL_NAME > OPENAI_MODEL_NAME for model selection
|
|
127
|
-
model_name = os.environ.get("MODEL_NAME") or os.environ.get("OPENAI_MODEL_NAME", "gpt-4o")
|
|
127
|
+
model_name = os.environ.get("MODEL_NAME") or os.environ.get("OPENAI_MODEL_NAME", "gpt-4o-mini")
|
|
128
128
|
|
|
129
129
|
# Priority order for base_url: OPENAI_BASE_URL > OPENAI_API_BASE > OLLAMA_API_BASE
|
|
130
130
|
# OPENAI_BASE_URL is the standard OpenAI SDK environment variable
|
|
@@ -57,7 +57,7 @@ class CloudDeployer:
|
|
|
57
57
|
file.write("FROM python:3.11-slim\n")
|
|
58
58
|
file.write("WORKDIR /app\n")
|
|
59
59
|
file.write("COPY . .\n")
|
|
60
|
-
file.write("RUN pip install flask praisonai==2.2.
|
|
60
|
+
file.write("RUN pip install flask praisonai==2.2.65 gunicorn markdown\n")
|
|
61
61
|
file.write("EXPOSE 8080\n")
|
|
62
62
|
file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
|
|
63
63
|
|
|
@@ -91,7 +91,7 @@ class CloudDeployer:
|
|
|
91
91
|
|
|
92
92
|
def set_environment_variables(self):
|
|
93
93
|
"""Sets environment variables with fallback to .env values or defaults."""
|
|
94
|
-
os.environ["OPENAI_MODEL_NAME"] = os.getenv("OPENAI_MODEL_NAME", "gpt-4o")
|
|
94
|
+
os.environ["OPENAI_MODEL_NAME"] = os.getenv("OPENAI_MODEL_NAME", "gpt-4o-mini")
|
|
95
95
|
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY", "Enter your API key")
|
|
96
96
|
os.environ["OPENAI_API_BASE"] = os.getenv("OPENAI_API_BASE", "https://api.openai.com/v1")
|
|
97
97
|
|
|
@@ -110,7 +110,7 @@ class CloudDeployer:
|
|
|
110
110
|
|
|
111
111
|
This method sets environment variables for the application. It uses the `os.environ` dictionary to set the following environment variables:
|
|
112
112
|
|
|
113
|
-
- `OPENAI_MODEL_NAME`: The name of the OpenAI model to use. If not specified in the .env file, it defaults to "gpt-4o".
|
|
113
|
+
- `OPENAI_MODEL_NAME`: The name of the OpenAI model to use. If not specified in the .env file, it defaults to "gpt-4o-mini".
|
|
114
114
|
- `OPENAI_API_KEY`: The API key for accessing the OpenAI API. If not specified in the .env file, it defaults to "Enter your API key".
|
|
115
115
|
- `OPENAI_API_BASE`: The base URL for the OpenAI API. If not specified in the .env file, it defaults to "https://api.openai.com/v1".
|
|
116
116
|
"""
|
|
@@ -44,7 +44,7 @@ class PraisonAIModel:
|
|
|
44
44
|
base_url (str, optional): The base URL for the OpenAI API. Defaults to None.
|
|
45
45
|
api_key (str, optional): The explicit API key to use. Takes precedence over environment variables. Defaults to None.
|
|
46
46
|
"""
|
|
47
|
-
self.model = model or os.getenv("OPENAI_MODEL_NAME", "gpt-4o")
|
|
47
|
+
self.model = model or os.getenv("OPENAI_MODEL_NAME", "gpt-4o-mini")
|
|
48
48
|
if self.model.startswith("openai/"):
|
|
49
49
|
self.api_key_var = "OPENAI_API_KEY"
|
|
50
50
|
self.base_url = base_url or "https://api.openai.com/v1"
|
|
@@ -10,7 +10,7 @@ from praisonaiagents import Agent, Task, PraisonAIAgents, register_display_callb
|
|
|
10
10
|
framework = "praisonai"
|
|
11
11
|
config_list = [
|
|
12
12
|
{
|
|
13
|
-
'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4o"),
|
|
13
|
+
'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4o-mini"),
|
|
14
14
|
'base_url': os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1"),
|
|
15
15
|
'api_key': os.environ.get("OPENAI_API_KEY", "")
|
|
16
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "PraisonAI"
|
|
3
|
-
version = "2.2.
|
|
3
|
+
version = "2.2.65"
|
|
4
4
|
description = "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
|
readme = "README.md"
|
|
6
6
|
license = ""
|
|
@@ -92,10 +92,17 @@ call = [
|
|
|
92
92
|
train = []
|
|
93
93
|
crewai = ["crewai>=0.32.0", "praisonai-tools>=0.0.22"]
|
|
94
94
|
autogen = ["pyautogen==0.2.29", "praisonai-tools>=0.0.22", "crewai"]
|
|
95
|
+
autogen-v4 = [
|
|
96
|
+
"autogen-agentchat>=0.4.0",
|
|
97
|
+
"autogen-ext[openai]>=0.4.0",
|
|
98
|
+
"autogen-core>=0.4.0",
|
|
99
|
+
"praisonai-tools>=0.0.22",
|
|
100
|
+
"crewai"
|
|
101
|
+
]
|
|
95
102
|
|
|
96
103
|
[tool.poetry]
|
|
97
104
|
name = "PraisonAI"
|
|
98
|
-
version = "2.2.
|
|
105
|
+
version = "2.2.65"
|
|
99
106
|
description = "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."
|
|
100
107
|
authors = ["Mervin Praison"]
|
|
101
108
|
license = ""
|
|
@@ -119,6 +126,9 @@ instructor = ">=1.3.3"
|
|
|
119
126
|
PyYAML = ">=6.0"
|
|
120
127
|
mcp = ">=1.6.0"
|
|
121
128
|
pyautogen = {version = "==0.2.29", optional = true}
|
|
129
|
+
autogen-agentchat = {version = ">=0.4.0", optional = true}
|
|
130
|
+
autogen-ext = {version = ">=0.4.0", optional = true}
|
|
131
|
+
autogen-core = {version = ">=0.4.0", optional = true}
|
|
122
132
|
crewai = {version = ">=0.32.0", optional = true}
|
|
123
133
|
praisonai-tools = {version = ">=0.0.22", optional = true}
|
|
124
134
|
chainlit = {version = "==2.5.5", optional = true}
|
|
@@ -277,6 +287,7 @@ call = [
|
|
|
277
287
|
]
|
|
278
288
|
crewai = ["crewai", "praisonai-tools"]
|
|
279
289
|
autogen = ["pyautogen", "praisonai-tools", "crewai"]
|
|
290
|
+
autogen-v4 = ["autogen-agentchat", "autogen-ext", "autogen-core", "praisonai-tools", "crewai"]
|
|
280
291
|
|
|
281
292
|
[tool.poetry-dynamic-versioning]
|
|
282
293
|
enable = true
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{praisonai-2.2.63 → praisonai-2.2.65}/praisonai/public/praison-ai-agents-architecture-dark.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|