waldiez 0.3.6__tar.gz → 0.3.8__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 waldiez might be problematic. Click here for more details.
- waldiez-0.3.8/NOTICE.md +5 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/PKG-INFO +27 -19
- {waldiez-0.3.6 → waldiez-0.3.8}/pyproject.toml +27 -20
- waldiez-0.3.8/waldiez/__init__.py +30 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/_version.py +1 -1
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/cli.py +11 -8
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/__init__.py +2 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/agent_exporter.py +11 -2
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/__init__.py +2 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/agent_class_name.py +2 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/agent_imports.py +5 -0
- waldiez-0.3.8/waldiez/exporting/agent/utils/reasoning.py +36 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/flow/flow_exporter.py +21 -8
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/flow/utils/__init__.py +10 -5
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/flow/utils/def_main.py +25 -20
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/flow/utils/flow_content.py +51 -3
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/flow/utils/importing_utils.py +7 -1
- waldiez-0.3.8/waldiez/exporting/flow/utils/logging_utils.py +341 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/__init__.py +8 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/__init__.py +10 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/agent/agent.py +10 -4
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/agent/termination_message.py +2 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/agents.py +10 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/rag_user/retrieve_config.py +46 -17
- waldiez-0.3.8/waldiez/models/agents/reasoning/__init__.py +13 -0
- waldiez-0.3.8/waldiez/models/agents/reasoning/reasoning_agent.py +43 -0
- waldiez-0.3.8/waldiez/models/agents/reasoning/reasoning_agent_data.py +116 -0
- waldiez-0.3.8/waldiez/models/agents/reasoning/reasoning_agent_reason_config.py +101 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/swarm_agent/__init__.py +2 -1
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/swarm_agent/swarm_agent_data.py +2 -3
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/chat/chat_data.py +30 -63
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/chat/chat_message.py +2 -26
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/chat/chat_nested.py +7 -8
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/common/__init__.py +3 -18
- waldiez-0.3.8/waldiez/models/common/date_utils.py +18 -0
- waldiez-0.3.8/waldiez/models/common/dict_utils.py +37 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/common/method_utils.py +2 -5
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/flow/flow_data.py +1 -1
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/model/model.py +3 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/model/model_data.py +2 -1
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/waldiez.py +4 -1
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/runner.py +3 -3
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/running/environment.py +22 -16
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/running/gen_seq_diagram.py +7 -4
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/running/running.py +69 -19
- waldiez-0.3.8/waldiez/utils/__init__.py +15 -0
- waldiez-0.3.8/waldiez/utils/cli_extras/__init__.py +30 -0
- waldiez-0.3.6/waldiez/cli_extras.py → waldiez-0.3.8/waldiez/utils/cli_extras/jupyter.py +9 -20
- waldiez-0.3.8/waldiez/utils/cli_extras/studio.py +36 -0
- {waldiez-0.3.6/waldiez → waldiez-0.3.8/waldiez/utils}/conflict_checker.py +14 -3
- waldiez-0.3.8/waldiez/utils/flaml_warnings.py +17 -0
- waldiez-0.3.8/waldiez/utils/pysqlite3_checker.py +249 -0
- waldiez-0.3.6/waldiez/__init__.py +0 -81
- waldiez-0.3.6/waldiez/exporting/flow/utils/logging_utils.py +0 -207
- {waldiez-0.3.6 → waldiez-0.3.8}/.gitignore +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/LICENSE +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/README.md +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/__main__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporter.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/code_execution.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/group_manager.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/rag_user/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/rag_user/chroma_utils.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/rag_user/mongo_utils.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/rag_user/pgvector_utils.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/rag_user/qdrant_utils.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/rag_user/rag_user.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/rag_user/vector_db.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/swarm_agent.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/teachability.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/agent/utils/termination_message.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/base/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/base/agent_position.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/base/base_exporter.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/base/export_position.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/base/import_position.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/base/mixin.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/base/utils/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/base/utils/comments.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/base/utils/naming.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/base/utils/path_check.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/base/utils/to_string.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/chats/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/chats/chats_exporter.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/chats/utils/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/chats/utils/common.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/chats/utils/nested.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/chats/utils/sequential.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/chats/utils/single_chat.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/chats/utils/swarm.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/flow/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/flow/utils/agent_utils.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/flow/utils/chat_utils.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/flow/utils/flow_names.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/models/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/models/models_exporter.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/models/utils.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/skills/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/skills/skills_exporter.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/exporting/skills/utils.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/agent/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/agent/agent_data.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/agent/code_execution.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/agent/linked_skill.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/agent/nested_chat.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/agent/teachability.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/assistant/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/assistant/assistant.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/assistant/assistant_data.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/group_manager/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/group_manager/group_manager.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/group_manager/group_manager_data.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/group_manager/speakers.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/rag_user/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/rag_user/rag_user.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/rag_user/rag_user_data.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/rag_user/vector_db_config.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/swarm_agent/after_work.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/swarm_agent/on_condition.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/swarm_agent/on_condition_available.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/swarm_agent/on_condition_target.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/swarm_agent/swarm_agent.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/swarm_agent/update_system_message.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/user_proxy/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/user_proxy/user_proxy.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/agents/user_proxy/user_proxy_data.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/chat/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/chat/chat.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/chat/chat_summary.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/common/base.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/flow/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/flow/flow.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/flow/utils.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/model/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/skill/__init__.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/skill/skill.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/models/skill/skill_data.py +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/py.typed +0 -0
- {waldiez-0.3.6 → waldiez-0.3.8}/waldiez/running/__init__.py +0 -0
waldiez-0.3.8/NOTICE.md
ADDED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: waldiez
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.8
|
|
4
4
|
Summary: waldiez
|
|
5
5
|
Project-URL: homepage, https://waldiez.github.io/waldiez/python
|
|
6
6
|
Project-URL: repository, https://github.com/waldiez/python.git
|
|
7
7
|
Author-email: Panagiotis Kasnesis <pkasnesis@waldiez.io>, Lazaros Toumanidis <laztoum@waldiez.io>, Stella Ioannidou <stella@humancentered.gr>
|
|
8
8
|
License-File: LICENSE
|
|
9
|
+
License-File: NOTICE.md
|
|
9
10
|
Classifier: Development Status :: 3 - Alpha
|
|
10
11
|
Classifier: Intended Audience :: Developers
|
|
11
12
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -17,33 +18,40 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
17
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
20
|
Requires-Python: <3.13,>=3.10
|
|
21
|
+
Requires-Dist: aiocsv==1.3.2
|
|
22
|
+
Requires-Dist: aiofiles==24.1.0
|
|
23
|
+
Requires-Dist: aiosqlite==0.20.0
|
|
20
24
|
Requires-Dist: asyncer==0.0.8
|
|
25
|
+
Requires-Dist: graphviz==0.20.3
|
|
21
26
|
Requires-Dist: httpx<0.28.0,>=0.27.0
|
|
22
27
|
Requires-Dist: jupytext
|
|
23
28
|
Requires-Dist: pandas>=2
|
|
24
29
|
Requires-Dist: parso==0.8.4
|
|
25
|
-
Requires-Dist: pyautogen==0.7.
|
|
30
|
+
Requires-Dist: pyautogen==0.7.2
|
|
26
31
|
Requires-Dist: pydantic<3,>=2.6.1
|
|
27
32
|
Requires-Dist: typer<0.13,>=0.9
|
|
28
33
|
Provides-Extra: ag2-extras
|
|
29
|
-
Requires-Dist: autogen[captainagent]==0.7.
|
|
34
|
+
Requires-Dist: autogen[captainagent]==0.7.2; (platform_system == 'Linux') and extra == 'ag2-extras'
|
|
35
|
+
Requires-Dist: chromadb; (platform_system != 'Linux') and extra == 'ag2-extras'
|
|
36
|
+
Requires-Dist: huggingface-hub>=0.0.17; (platform_system != 'Linux') and extra == 'ag2-extras'
|
|
30
37
|
Requires-Dist: pgvector>=0.3.6; extra == 'ag2-extras'
|
|
31
38
|
Requires-Dist: psycopg[binary]>=3.2.3; extra == 'ag2-extras'
|
|
32
|
-
Requires-Dist: pyautogen[anthropic]==0.7.
|
|
33
|
-
Requires-Dist: pyautogen[bedrock]==0.7.
|
|
34
|
-
Requires-Dist: pyautogen[gemini]==0.7.
|
|
35
|
-
Requires-Dist: pyautogen[groq]==0.7.
|
|
36
|
-
Requires-Dist: pyautogen[lmm]==0.7.
|
|
37
|
-
Requires-Dist: pyautogen[mistral]==0.7.
|
|
38
|
-
Requires-Dist: pyautogen[neo4j]==0.7.
|
|
39
|
-
Requires-Dist: pyautogen[retrievechat-mongodb]==0.7.
|
|
40
|
-
Requires-Dist: pyautogen[retrievechat-pgvector]==0.7.
|
|
41
|
-
Requires-Dist: pyautogen[retrievechat-qdrant]==0.7.
|
|
42
|
-
Requires-Dist: pyautogen[retrievechat]==0.7.
|
|
43
|
-
Requires-Dist: pyautogen[together]==0.7.
|
|
44
|
-
Requires-Dist: pyautogen[websurfer]==0.7.
|
|
39
|
+
Requires-Dist: pyautogen[anthropic]==0.7.2; extra == 'ag2-extras'
|
|
40
|
+
Requires-Dist: pyautogen[bedrock]==0.7.2; extra == 'ag2-extras'
|
|
41
|
+
Requires-Dist: pyautogen[gemini]==0.7.2; extra == 'ag2-extras'
|
|
42
|
+
Requires-Dist: pyautogen[groq]==0.7.2; extra == 'ag2-extras'
|
|
43
|
+
Requires-Dist: pyautogen[lmm]==0.7.2; extra == 'ag2-extras'
|
|
44
|
+
Requires-Dist: pyautogen[mistral]==0.7.2; extra == 'ag2-extras'
|
|
45
|
+
Requires-Dist: pyautogen[neo4j]==0.7.2; extra == 'ag2-extras'
|
|
46
|
+
Requires-Dist: pyautogen[retrievechat-mongodb]==0.7.2; extra == 'ag2-extras'
|
|
47
|
+
Requires-Dist: pyautogen[retrievechat-pgvector]==0.7.2; extra == 'ag2-extras'
|
|
48
|
+
Requires-Dist: pyautogen[retrievechat-qdrant]==0.7.2; (python_version < '3.13') and extra == 'ag2-extras'
|
|
49
|
+
Requires-Dist: pyautogen[retrievechat]==0.7.2; extra == 'ag2-extras'
|
|
50
|
+
Requires-Dist: pyautogen[together]==0.7.2; extra == 'ag2-extras'
|
|
51
|
+
Requires-Dist: pyautogen[websurfer]==0.7.2; extra == 'ag2-extras'
|
|
45
52
|
Requires-Dist: pymongo==4.10.1; extra == 'ag2-extras'
|
|
46
53
|
Requires-Dist: qdrant-client[fastembed]; (python_version >= '3.13') and extra == 'ag2-extras'
|
|
54
|
+
Requires-Dist: sentence-transformers>=2.0.0; (platform_system != 'Linux') and extra == 'ag2-extras'
|
|
47
55
|
Provides-Extra: dev
|
|
48
56
|
Requires-Dist: autoflake==2.3.1; extra == 'dev'
|
|
49
57
|
Requires-Dist: bandit==1.8.2; extra == 'dev'
|
|
@@ -56,7 +64,7 @@ Requires-Dist: pre-commit==4.1.0; extra == 'dev'
|
|
|
56
64
|
Requires-Dist: pydocstyle==6.3.0; extra == 'dev'
|
|
57
65
|
Requires-Dist: pylint==3.3.3; extra == 'dev'
|
|
58
66
|
Requires-Dist: python-dotenv==1.0.1; extra == 'dev'
|
|
59
|
-
Requires-Dist: ruff==0.9.
|
|
67
|
+
Requires-Dist: ruff==0.9.3; extra == 'dev'
|
|
60
68
|
Requires-Dist: toml; (python_version <= '3.10') and extra == 'dev'
|
|
61
69
|
Requires-Dist: types-pyyaml==6.0.12.20241230; extra == 'dev'
|
|
62
70
|
Requires-Dist: types-toml==0.10.8.20240310; extra == 'dev'
|
|
@@ -73,9 +81,9 @@ Requires-Dist: mkdocstrings-python==1.13.0; extra == 'docs'
|
|
|
73
81
|
Requires-Dist: mkdocstrings[crystal,python]==0.27.0; extra == 'docs'
|
|
74
82
|
Provides-Extra: jupyter
|
|
75
83
|
Requires-Dist: jupyterlab>=4.3.0; extra == 'jupyter'
|
|
76
|
-
Requires-Dist: waldiez-jupyter==0.3.
|
|
84
|
+
Requires-Dist: waldiez-jupyter==0.3.7; extra == 'jupyter'
|
|
77
85
|
Provides-Extra: studio
|
|
78
|
-
Requires-Dist: waldiez-studio==0.3.
|
|
86
|
+
Requires-Dist: waldiez-studio==0.3.7; extra == 'studio'
|
|
79
87
|
Provides-Extra: test
|
|
80
88
|
Requires-Dist: pytest-asyncio==0.25.2; extra == 'test'
|
|
81
89
|
Requires-Dist: pytest-cov==6.0.0; extra == 'test'
|
|
@@ -22,9 +22,13 @@ classifiers = [
|
|
|
22
22
|
"Intended Audience :: Developers",
|
|
23
23
|
]
|
|
24
24
|
dependencies =[
|
|
25
|
+
"aiocsv==1.3.2",
|
|
26
|
+
"aiofiles==24.1.0",
|
|
27
|
+
"aiosqlite==0.20.0",
|
|
25
28
|
"asyncer==0.0.8",
|
|
29
|
+
"graphviz==0.20.3",
|
|
26
30
|
"pandas>=2",
|
|
27
|
-
"pyautogen==0.7.
|
|
31
|
+
"pyautogen==0.7.2",
|
|
28
32
|
"jupytext",
|
|
29
33
|
"parso==0.8.4",
|
|
30
34
|
"pydantic>=2.6.1,<3",
|
|
@@ -49,10 +53,10 @@ exclude = [ "**/example.py" ]
|
|
|
49
53
|
|
|
50
54
|
[project.optional-dependencies]
|
|
51
55
|
studio = [
|
|
52
|
-
"waldiez_studio==0.3.
|
|
56
|
+
"waldiez_studio==0.3.7",
|
|
53
57
|
]
|
|
54
58
|
jupyter = [
|
|
55
|
-
"waldiez_jupyter==0.3.
|
|
59
|
+
"waldiez_jupyter==0.3.7",
|
|
56
60
|
"jupyterlab>=4.3.0",
|
|
57
61
|
]
|
|
58
62
|
dev = [
|
|
@@ -67,7 +71,7 @@ dev = [
|
|
|
67
71
|
'pydocstyle==6.3.0',
|
|
68
72
|
'pylint==3.3.3',
|
|
69
73
|
'python-dotenv==1.0.1',
|
|
70
|
-
'ruff==0.9.
|
|
74
|
+
'ruff==0.9.3',
|
|
71
75
|
'types-PyYAML==6.0.12.20241230',
|
|
72
76
|
'yamllint==1.35.1',
|
|
73
77
|
'toml; python_version <= "3.10"',
|
|
@@ -99,22 +103,25 @@ dev = [
|
|
|
99
103
|
ag2_extras =[
|
|
100
104
|
'pgvector>=0.3.6',
|
|
101
105
|
'psycopg[binary]>=3.2.3',
|
|
102
|
-
'pyautogen[anthropic]==0.7.
|
|
103
|
-
'pyautogen[bedrock]==0.7.
|
|
104
|
-
'autogen[captainagent]==0.7.
|
|
105
|
-
'
|
|
106
|
-
'
|
|
107
|
-
'
|
|
108
|
-
'pyautogen[
|
|
109
|
-
'pyautogen[
|
|
110
|
-
'pyautogen[
|
|
111
|
-
'pyautogen[
|
|
112
|
-
'pyautogen[
|
|
106
|
+
'pyautogen[anthropic]==0.7.2',
|
|
107
|
+
'pyautogen[bedrock]==0.7.2',
|
|
108
|
+
'autogen[captainagent]==0.7.2; platform_system == "Linux"',
|
|
109
|
+
'chromadb; platform_system != "Linux"',
|
|
110
|
+
'sentence-transformers>=2.0.0; platform_system != "Linux"',
|
|
111
|
+
'huggingface-hub>=0.0.17; platform_system != "Linux"',
|
|
112
|
+
'pyautogen[gemini]==0.7.2',
|
|
113
|
+
'pyautogen[groq]==0.7.2',
|
|
114
|
+
'pyautogen[lmm]==0.7.2',
|
|
115
|
+
'pyautogen[mistral]==0.7.2',
|
|
116
|
+
'pyautogen[neo4j]==0.7.2',
|
|
117
|
+
'pyautogen[retrievechat-mongodb]==0.7.2',
|
|
118
|
+
'pyautogen[retrievechat-pgvector]==0.7.2',
|
|
119
|
+
'pyautogen[retrievechat-qdrant]==0.7.2; python_version < "3.13"',
|
|
113
120
|
'qdrant-client[fastembed]; python_version >= "3.13"',
|
|
114
|
-
'pyautogen[retrievechat]==0.7.
|
|
115
|
-
'pyautogen[together]==0.7.
|
|
116
|
-
'pyautogen[together]==0.7.
|
|
117
|
-
'pyautogen[websurfer]==0.7.
|
|
121
|
+
'pyautogen[retrievechat]==0.7.2',
|
|
122
|
+
'pyautogen[together]==0.7.2',
|
|
123
|
+
'pyautogen[together]==0.7.2',
|
|
124
|
+
'pyautogen[websurfer]==0.7.2',
|
|
118
125
|
'pymongo==4.10.1',
|
|
119
126
|
]
|
|
120
127
|
test = [
|
|
@@ -347,7 +354,7 @@ addopts = """
|
|
|
347
354
|
[tool.coverage.run]
|
|
348
355
|
omit = [
|
|
349
356
|
"example.py",
|
|
350
|
-
"cli_extras
|
|
357
|
+
"**/cli_extras/*.py",
|
|
351
358
|
]
|
|
352
359
|
[tool.coverage.report]
|
|
353
360
|
exclude_lines = [
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0.
|
|
2
|
+
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
"""Waldiez package."""
|
|
4
|
+
|
|
5
|
+
from ._version import __version__
|
|
6
|
+
from .exporter import WaldiezExporter
|
|
7
|
+
from .models import Waldiez
|
|
8
|
+
from .runner import WaldiezRunner
|
|
9
|
+
from .utils import check_conflicts, check_flaml_warnings
|
|
10
|
+
|
|
11
|
+
__WALDIEZ_INITIALIZED = False
|
|
12
|
+
|
|
13
|
+
if not __WALDIEZ_INITIALIZED:
|
|
14
|
+
check_conflicts()
|
|
15
|
+
check_flaml_warnings()
|
|
16
|
+
# let's skip the one below
|
|
17
|
+
# check_pysqlite3()
|
|
18
|
+
# and use it only if needed:
|
|
19
|
+
# captain_agent dependency:
|
|
20
|
+
# before calling pip install pyautogen[captainagent]
|
|
21
|
+
# we should have pysqlite3 installed (at least on windows)
|
|
22
|
+
# before running a flow
|
|
23
|
+
__WALDIEZ_INITIALIZED = True
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
"Waldiez",
|
|
27
|
+
"WaldiezExporter",
|
|
28
|
+
"WaldiezRunner",
|
|
29
|
+
"__version__",
|
|
30
|
+
]
|
|
@@ -7,7 +7,6 @@ import json
|
|
|
7
7
|
import logging
|
|
8
8
|
import os
|
|
9
9
|
import sys
|
|
10
|
-
import warnings
|
|
11
10
|
from pathlib import Path
|
|
12
11
|
from typing import TYPE_CHECKING, Optional
|
|
13
12
|
|
|
@@ -15,14 +14,11 @@ import anyio
|
|
|
15
14
|
import typer
|
|
16
15
|
from typing_extensions import Annotated
|
|
17
16
|
|
|
18
|
-
from . import
|
|
19
|
-
from .cli_extras import add_cli_extras # type: ignore
|
|
17
|
+
from ._version import __version__
|
|
20
18
|
from .exporter import WaldiezExporter
|
|
19
|
+
from .models import Waldiez
|
|
21
20
|
from .runner import WaldiezRunner
|
|
22
|
-
|
|
23
|
-
warnings.filterwarnings(
|
|
24
|
-
"ignore", module="flaml", message="^.*flaml.automl is not available.*$"
|
|
25
|
-
)
|
|
21
|
+
from .utils import add_cli_extras
|
|
26
22
|
|
|
27
23
|
if TYPE_CHECKING:
|
|
28
24
|
from autogen import ChatResult # type: ignore[import-untyped]
|
|
@@ -90,7 +86,7 @@ def run(
|
|
|
90
86
|
),
|
|
91
87
|
) -> None:
|
|
92
88
|
"""Run a Waldiez flow."""
|
|
93
|
-
# swarm without a user
|
|
89
|
+
# a swarm chat without a user agent
|
|
94
90
|
# creates a new user (this has a default code execution with docker)
|
|
95
91
|
# temp (until we handle/detect docker setup)
|
|
96
92
|
os.environ["AUTOGEN_USE_DOCKER"] = "0"
|
|
@@ -114,6 +110,13 @@ def run(
|
|
|
114
110
|
_log_result(result, logger)
|
|
115
111
|
sep = "-" * 80
|
|
116
112
|
print("\n" + f"{sep}" + "\n")
|
|
113
|
+
elif isinstance(results, dict):
|
|
114
|
+
logger.info("Results:")
|
|
115
|
+
for key, result in results.items():
|
|
116
|
+
logger.info("Order: %s", key)
|
|
117
|
+
_log_result(result, logger)
|
|
118
|
+
sep = "-" * 80
|
|
119
|
+
print("\n" + f"{sep}" + "\n")
|
|
117
120
|
else:
|
|
118
121
|
_log_result(results, logger)
|
|
119
122
|
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Tools for exporting agents, models, skills and chats to strings."""
|
|
4
4
|
|
|
5
|
+
from .agent import AgentExporter
|
|
5
6
|
from .flow import FlowExporter
|
|
6
7
|
from .models import ModelsExporter
|
|
7
8
|
from .skills import SkillsExporter
|
|
8
9
|
|
|
9
10
|
__all__ = [
|
|
11
|
+
"AgentExporter",
|
|
10
12
|
"FlowExporter",
|
|
11
13
|
"ModelsExporter",
|
|
12
14
|
"SkillsExporter",
|
|
@@ -24,6 +24,7 @@ from .utils import (
|
|
|
24
24
|
get_group_manager_extras,
|
|
25
25
|
get_is_termination_message,
|
|
26
26
|
get_rag_user_extras,
|
|
27
|
+
get_reasoning_agent_extras,
|
|
27
28
|
get_swarm_extras,
|
|
28
29
|
)
|
|
29
30
|
|
|
@@ -114,6 +115,10 @@ class AgentExporter(BaseExporter, ExporterMixin):
|
|
|
114
115
|
self._termination = get_is_termination_message(
|
|
115
116
|
agent=self.agent, agent_name=self._agent_name
|
|
116
117
|
)
|
|
118
|
+
self._reasoning = get_reasoning_agent_extras(
|
|
119
|
+
agent=self.agent,
|
|
120
|
+
serializer=self.serializer,
|
|
121
|
+
)
|
|
117
122
|
|
|
118
123
|
def get_imports(self) -> Optional[List[Tuple[str, ImportPosition]]]:
|
|
119
124
|
"""Get the imports.
|
|
@@ -135,7 +140,10 @@ class AgentExporter(BaseExporter, ExporterMixin):
|
|
|
135
140
|
# if the agent has skills, add the register_function import.
|
|
136
141
|
if self.agent.data.skills:
|
|
137
142
|
agent_imports.add("from autogen import register_function")
|
|
138
|
-
return
|
|
143
|
+
return sorted(
|
|
144
|
+
[(import_string, position) for import_string in agent_imports],
|
|
145
|
+
key=lambda x: x[0],
|
|
146
|
+
)
|
|
139
147
|
|
|
140
148
|
def get_system_message_arg(self) -> str:
|
|
141
149
|
"""Get the system message argument.
|
|
@@ -223,6 +231,7 @@ class AgentExporter(BaseExporter, ExporterMixin):
|
|
|
223
231
|
default_auto_reply = (
|
|
224
232
|
f'"{self.string_escape(agent.data.agent_default_auto_reply)}"'
|
|
225
233
|
)
|
|
234
|
+
extras = f"{group_chat_arg}{retrieve_arg}{self._reasoning}"
|
|
226
235
|
agent_str = f"""{agent_name} = {agent_class}(
|
|
227
236
|
name="{agent_name}",
|
|
228
237
|
description="{agent.description}"{system_message_arg},
|
|
@@ -230,7 +239,7 @@ class AgentExporter(BaseExporter, ExporterMixin):
|
|
|
230
239
|
max_consecutive_auto_reply={agent.data.max_consecutive_auto_reply},
|
|
231
240
|
default_auto_reply={default_auto_reply},
|
|
232
241
|
code_execution_config={code_execution_arg},
|
|
233
|
-
is_termination_msg={is_termination},{
|
|
242
|
+
is_termination_msg={is_termination},{extras}
|
|
234
243
|
"""
|
|
235
244
|
if self._swarm[1]:
|
|
236
245
|
agent_str += self._swarm[1]
|
|
@@ -7,6 +7,7 @@ from .agent_imports import get_agent_imports
|
|
|
7
7
|
from .code_execution import get_agent_code_execution_config
|
|
8
8
|
from .group_manager import get_group_manager_extras
|
|
9
9
|
from .rag_user import get_rag_user_extras
|
|
10
|
+
from .reasoning import get_reasoning_agent_extras
|
|
10
11
|
from .swarm_agent import get_swarm_extras
|
|
11
12
|
from .teachability import get_agent_teachability_string
|
|
12
13
|
from .termination_message import get_is_termination_message
|
|
@@ -19,5 +20,6 @@ __all__ = [
|
|
|
19
20
|
"get_group_manager_extras",
|
|
20
21
|
"get_is_termination_message",
|
|
21
22
|
"get_rag_user_extras",
|
|
23
|
+
"get_reasoning_agent_extras",
|
|
22
24
|
"get_swarm_extras",
|
|
23
25
|
]
|
|
@@ -45,6 +45,11 @@ def get_agent_imports(agent_class: str) -> Set[str]:
|
|
|
45
45
|
"SwarmAgent, "
|
|
46
46
|
"SwarmResult"
|
|
47
47
|
)
|
|
48
|
+
elif agent_class == "ReasoningAgent":
|
|
49
|
+
# pylint: disable=line-too-long
|
|
50
|
+
imports.add(
|
|
51
|
+
"from autogen.agentchat.contrib.reasoning_agent import ReasoningAgent, visualize_tree" # noqa: E501
|
|
52
|
+
)
|
|
48
53
|
else:
|
|
49
54
|
imports.add("from autogen import ConversableAgent")
|
|
50
55
|
return imports
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0.
|
|
2
|
+
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
"""Export reasoning agent to string."""
|
|
4
|
+
|
|
5
|
+
from typing import Callable
|
|
6
|
+
|
|
7
|
+
from waldiez.models import WaldiezAgent, WaldiezReasoningAgent
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_reasoning_agent_extras(
|
|
11
|
+
agent: WaldiezAgent,
|
|
12
|
+
serializer: Callable[..., str],
|
|
13
|
+
) -> str:
|
|
14
|
+
"""Get the reasoning agent extras.
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
agent : WaldiezReasoningAgent
|
|
19
|
+
The reasoning agent.
|
|
20
|
+
serializer : Callable[..., str]
|
|
21
|
+
The serializer to get the string representation of an object.
|
|
22
|
+
|
|
23
|
+
Returns
|
|
24
|
+
-------
|
|
25
|
+
str
|
|
26
|
+
The reasoning agent extras.
|
|
27
|
+
"""
|
|
28
|
+
if agent.agent_type != "reasoning" or not isinstance(
|
|
29
|
+
agent, WaldiezReasoningAgent
|
|
30
|
+
):
|
|
31
|
+
return ""
|
|
32
|
+
reasoning_config = agent.get_reasoning_config()
|
|
33
|
+
serialized = serializer(reasoning_config)
|
|
34
|
+
content = "\n verbose=" + f"{agent.data.verbose},"
|
|
35
|
+
content += "\n reason_config=" + f"{serialized},"
|
|
36
|
+
return content
|
|
@@ -49,13 +49,13 @@ from .utils import (
|
|
|
49
49
|
ensure_unique_names,
|
|
50
50
|
gather_agent_outputs,
|
|
51
51
|
gather_imports,
|
|
52
|
+
get_after_run_content,
|
|
52
53
|
get_def_main,
|
|
53
54
|
get_ipynb_content_start,
|
|
54
|
-
get_logging_start_string,
|
|
55
|
-
get_logging_stop_string,
|
|
56
55
|
get_py_content_start,
|
|
57
56
|
get_sqlite_out,
|
|
58
|
-
|
|
57
|
+
get_start_logging,
|
|
58
|
+
get_stop_logging,
|
|
59
59
|
get_the_imports_string,
|
|
60
60
|
)
|
|
61
61
|
|
|
@@ -201,6 +201,7 @@ class FlowExporter(BaseExporter, ExporterMixin):
|
|
|
201
201
|
str
|
|
202
202
|
The merged export contents.
|
|
203
203
|
"""
|
|
204
|
+
is_async = self.waldiez.is_async
|
|
204
205
|
content = (
|
|
205
206
|
get_py_content_start(self.waldiez)
|
|
206
207
|
if not self.for_notebook
|
|
@@ -209,7 +210,8 @@ class FlowExporter(BaseExporter, ExporterMixin):
|
|
|
209
210
|
content += self.get_comment("imports", self.for_notebook) + "\n"
|
|
210
211
|
content += imports[0] + "\n"
|
|
211
212
|
content += self.get_comment("logging", self.for_notebook) + "\n"
|
|
212
|
-
content +=
|
|
213
|
+
content += get_start_logging(tabs=0) + "\n"
|
|
214
|
+
content += "start_logging()\n\n"
|
|
213
215
|
if models_output:
|
|
214
216
|
content += self.get_comment("models", self.for_notebook) + "\n"
|
|
215
217
|
content += models_output + "\n"
|
|
@@ -221,16 +223,27 @@ class FlowExporter(BaseExporter, ExporterMixin):
|
|
|
221
223
|
content += agents_content + "\n"
|
|
222
224
|
if before_chats:
|
|
223
225
|
content += before_chats + "\n"
|
|
224
|
-
content += get_sqlite_out() + "\n"
|
|
226
|
+
content += get_sqlite_out(is_async=is_async) + "\n"
|
|
227
|
+
content += get_stop_logging(tabs=0, is_async=is_async) + "\n"
|
|
225
228
|
content += self.get_comment("run", self.for_notebook) + "\n"
|
|
229
|
+
after_run = get_after_run_content(
|
|
230
|
+
waldiez=self.waldiez,
|
|
231
|
+
agent_names=self.agent_names,
|
|
232
|
+
tabs=0 if self.for_notebook else 1,
|
|
233
|
+
)
|
|
226
234
|
if self.for_notebook is False:
|
|
227
235
|
content += get_def_main(
|
|
228
|
-
chats_content,
|
|
236
|
+
chats_content,
|
|
237
|
+
after_run=after_run,
|
|
238
|
+
is_async=self.waldiez.is_async,
|
|
229
239
|
)
|
|
230
240
|
else:
|
|
231
241
|
content += "\n" + chats_content + "\n"
|
|
232
|
-
|
|
233
|
-
|
|
242
|
+
if is_async:
|
|
243
|
+
content += "await stop_logging()"
|
|
244
|
+
else:
|
|
245
|
+
content += "stop_logging()"
|
|
246
|
+
content += after_run
|
|
234
247
|
content = content.replace("\n\n\n\n", "\n\n\n")
|
|
235
248
|
return content
|
|
236
249
|
|
|
@@ -11,7 +11,11 @@ from .agent_utils import (
|
|
|
11
11
|
)
|
|
12
12
|
from .chat_utils import add_after_chat_content, add_before_chat_content
|
|
13
13
|
from .def_main import get_def_main
|
|
14
|
-
from .flow_content import
|
|
14
|
+
from .flow_content import (
|
|
15
|
+
get_after_run_content,
|
|
16
|
+
get_ipynb_content_start,
|
|
17
|
+
get_py_content_start,
|
|
18
|
+
)
|
|
15
19
|
from .flow_names import ensure_unique_names
|
|
16
20
|
from .importing_utils import (
|
|
17
21
|
gather_imports,
|
|
@@ -19,10 +23,10 @@ from .importing_utils import (
|
|
|
19
23
|
get_the_imports_string,
|
|
20
24
|
)
|
|
21
25
|
from .logging_utils import (
|
|
22
|
-
get_logging_start_string,
|
|
23
|
-
get_logging_stop_string,
|
|
24
26
|
get_sqlite_out,
|
|
25
27
|
get_sqlite_out_call,
|
|
28
|
+
get_start_logging,
|
|
29
|
+
get_stop_logging,
|
|
26
30
|
)
|
|
27
31
|
|
|
28
32
|
__all__ = [
|
|
@@ -35,11 +39,12 @@ __all__ = [
|
|
|
35
39
|
"ensure_unique_names",
|
|
36
40
|
"gather_agent_outputs",
|
|
37
41
|
"gather_imports",
|
|
42
|
+
"get_after_run_content",
|
|
38
43
|
"get_def_main",
|
|
39
44
|
"get_py_content_start",
|
|
40
45
|
"get_ipynb_content_start",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
46
|
+
"get_start_logging",
|
|
47
|
+
"get_stop_logging",
|
|
43
48
|
"get_sqlite_out",
|
|
44
49
|
"get_sqlite_out_call",
|
|
45
50
|
"get_standard_imports",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
# flake8: noqa: E501
|
|
4
|
+
# pylint: disable=inconsistent-quotes, line-too-long
|
|
3
5
|
"""Get the main function."""
|
|
4
6
|
|
|
5
|
-
from .logging_utils import get_logging_stop_string, get_sqlite_out_call
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
def get_def_main(flow_chats: str, is_async: bool) -> str:
|
|
8
|
+
def get_def_main(flow_chats: str, after_run: str, is_async: bool) -> str:
|
|
9
9
|
"""Get the main function.
|
|
10
10
|
|
|
11
11
|
When exporting to python, waldiez_chats string will be the
|
|
@@ -18,6 +18,8 @@ def get_def_main(flow_chats: str, is_async: bool) -> str:
|
|
|
18
18
|
----------
|
|
19
19
|
flow_chats : str
|
|
20
20
|
The content of the main function.
|
|
21
|
+
after_run : str
|
|
22
|
+
The content after the run of the flow.
|
|
21
23
|
is_async : bool
|
|
22
24
|
Whether the main function is asynchronous.
|
|
23
25
|
Returns
|
|
@@ -29,31 +31,34 @@ def get_def_main(flow_chats: str, is_async: bool) -> str:
|
|
|
29
31
|
if is_async:
|
|
30
32
|
content += "async "
|
|
31
33
|
content += "def main():\n"
|
|
32
|
-
content += " # type: () -> Union[ChatResult, List[ChatResult]]\n"
|
|
34
|
+
content += " # type: () -> Union[ChatResult, List[ChatResult], Dict[int, ChatResult]]\n"
|
|
33
35
|
content += ' """Start chatting."""\n'
|
|
34
36
|
content += f"{flow_chats}" + "\n"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
if is_async:
|
|
38
|
+
content += " await stop_logging()"
|
|
39
|
+
else:
|
|
40
|
+
content += " stop_logging()"
|
|
41
|
+
content += after_run
|
|
42
|
+
content += "\n return results\n\n\n"
|
|
38
43
|
if is_async:
|
|
39
44
|
content += "async def call_main():\n"
|
|
40
45
|
else:
|
|
41
46
|
content += "def call_main() -> None:\n"
|
|
42
47
|
content += ' """Run the main function and print the results."""\n'
|
|
43
|
-
|
|
48
|
+
content += " results: Union[ChatResult, List[ChatResult], Dict[int, ChatResult]] = "
|
|
44
49
|
if is_async:
|
|
45
|
-
content +=
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
content += "
|
|
54
|
-
content += "
|
|
55
|
-
content += "
|
|
56
|
-
content += " pprint(asdict(
|
|
50
|
+
content += "await "
|
|
51
|
+
content += "main()\n"
|
|
52
|
+
content += " if isinstance(results, dict):\n"
|
|
53
|
+
content += " # order by key\n"
|
|
54
|
+
content += " ordered_results = dict(sorted(results.items()))\n"
|
|
55
|
+
content += " for _, result in ordered_results.items():\n"
|
|
56
|
+
content += " pprint(asdict(result))\n"
|
|
57
|
+
content += " elif isinstance(results, list):\n"
|
|
58
|
+
content += " for result in results:\n"
|
|
59
|
+
content += " pprint(asdict(result))\n"
|
|
60
|
+
content += " else:\n"
|
|
61
|
+
content += " pprint(asdict(results))\n"
|
|
57
62
|
content += 'if __name__ == "__main__":\n'
|
|
58
63
|
if is_async:
|
|
59
64
|
content += " anyio.run(call_main)\n"
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
# flake8: noqa E501
|
|
4
|
+
# pylint: disable=line-too-long
|
|
3
5
|
"""Utils to generate the content of a flow."""
|
|
4
6
|
|
|
5
|
-
from typing import Callable, List, Optional
|
|
7
|
+
from typing import Callable, Dict, List, Optional
|
|
6
8
|
|
|
7
9
|
from waldiez.models import Waldiez
|
|
8
10
|
|
|
@@ -55,9 +57,8 @@ def get_ipynb_content_start(
|
|
|
55
57
|
content += "import sys\n"
|
|
56
58
|
requirements = " ".join(waldiez.requirements)
|
|
57
59
|
if requirements:
|
|
58
|
-
# pylint: disable=line-too-long
|
|
59
60
|
# fmt: off
|
|
60
|
-
content += "# " + f"!{{sys.executable}} -m pip install -q {requirements}" + "\n"
|
|
61
|
+
content += "# " + f"!{{sys.executable}} -m pip install -q {requirements}" + "\n"
|
|
61
62
|
# fmt: on
|
|
62
63
|
content += "# flake8: noqa E501"
|
|
63
64
|
content += get_pylint_ignore_comment(True)
|
|
@@ -110,3 +111,50 @@ def get_pylint_ignore_comment(
|
|
|
110
111
|
if notebook is True:
|
|
111
112
|
line = "\n" + line
|
|
112
113
|
return line + "\n"
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def get_after_run_content(
|
|
117
|
+
waldiez: Waldiez,
|
|
118
|
+
agent_names: Dict[str, str],
|
|
119
|
+
tabs: int,
|
|
120
|
+
) -> str:
|
|
121
|
+
"""Get content to add after the flow is run.
|
|
122
|
+
|
|
123
|
+
Parameters
|
|
124
|
+
----------
|
|
125
|
+
waldiez : Waldiez
|
|
126
|
+
The waldiez object.
|
|
127
|
+
agent_names : Dict[str, str]
|
|
128
|
+
The dictionary of agent names and their corresponding ids
|
|
129
|
+
tabs : int
|
|
130
|
+
The number of tabs to add before the content.
|
|
131
|
+
Returns
|
|
132
|
+
-------
|
|
133
|
+
str
|
|
134
|
+
The content to add after the flow is run.
|
|
135
|
+
"""
|
|
136
|
+
# if th eflow has reasoning agents, we add
|
|
137
|
+
# visualize_tree(agent._root) for each agent
|
|
138
|
+
content = ""
|
|
139
|
+
space = " " * tabs
|
|
140
|
+
for agent in waldiez.agents:
|
|
141
|
+
if agent.agent_type == "reasoning":
|
|
142
|
+
agent_name = agent_names[agent.id]
|
|
143
|
+
content += f"""
|
|
144
|
+
{space}# pylint: disable=broad-except,too-many-try-statements
|
|
145
|
+
{space}try:
|
|
146
|
+
{space}{space}visualize_tree({agent_name}._root) # pylint: disable=protected-access
|
|
147
|
+
{space}{space}if os.path.exists("tree_of_thoughts.png"):
|
|
148
|
+
{space}{space}{space}new_name = "{agent_name}_tree_of_thoughts.png"
|
|
149
|
+
{space}{space}{space}os.rename("tree_of_thoughts.png", new_name)
|
|
150
|
+
{space}except BaseException:
|
|
151
|
+
{space}{space}pass
|
|
152
|
+
{space}# save the tree to json
|
|
153
|
+
{space}try:
|
|
154
|
+
{space}{space}data = {agent_name}._root.to_dict() # pylint: disable=protected-access
|
|
155
|
+
{space}{space}with open("{agent_name}_reasoning_tree.json", "w", encoding="utf-8") as f:
|
|
156
|
+
{space}{space}{space}json.dump(data, f)
|
|
157
|
+
{space}except BaseException:
|
|
158
|
+
{space}{space}pass
|
|
159
|
+
"""
|
|
160
|
+
return content
|