waldiez 0.1.19__tar.gz → 0.2.0__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.

Files changed (92) hide show
  1. {waldiez-0.1.19 → waldiez-0.2.0}/.gitignore +2 -1
  2. {waldiez-0.1.19 → waldiez-0.2.0}/LICENSE +1 -1
  3. {waldiez-0.1.19 → waldiez-0.2.0}/PKG-INFO +55 -38
  4. {waldiez-0.1.19 → waldiez-0.2.0}/README.md +28 -16
  5. {waldiez-0.1.19 → waldiez-0.2.0}/pyproject.toml +46 -35
  6. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/__init__.py +5 -0
  7. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/_version.py +1 -1
  8. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/cli.py +9 -1
  9. waldiez-0.2.0/waldiez/cli_extras.py +123 -0
  10. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporter.py +11 -4
  11. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/rag_user/vector_db.py +1 -0
  12. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/chats/helpers.py +1 -0
  13. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/models/__init__.py +3 -1
  14. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/skills/__init__.py +2 -2
  15. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/rag_user/vector_db_config.py +2 -0
  16. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/common/method_utils.py +1 -0
  17. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/model/__init__.py +2 -1
  18. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/model/model.py +37 -2
  19. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/model/model_data.py +1 -0
  20. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/waldiez.py +8 -5
  21. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/runner.py +61 -2
  22. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/__main__.py +0 -0
  23. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/conflict_checker.py +0 -0
  24. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/__init__.py +0 -0
  25. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/__init__.py +0 -0
  26. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/agent.py +0 -0
  27. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/agent_skills.py +0 -0
  28. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/code_execution.py +0 -0
  29. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/group_manager.py +0 -0
  30. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/llm_config.py +0 -0
  31. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/rag_user/__init__.py +0 -0
  32. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/rag_user/chroma_utils.py +0 -0
  33. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/rag_user/mongo_utils.py +0 -0
  34. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/rag_user/pgvector_utils.py +0 -0
  35. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/rag_user/qdrant_utils.py +0 -0
  36. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/rag_user/rag_user.py +0 -0
  37. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/teachability.py +0 -0
  38. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/agents/termination_message.py +0 -0
  39. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/chats/__init__.py +0 -0
  40. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/chats/chats.py +0 -0
  41. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/chats/nested.py +0 -0
  42. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/flow/__init__.py +0 -0
  43. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/flow/def_main.py +0 -0
  44. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/flow/flow.py +0 -0
  45. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/utils/__init__.py +0 -0
  46. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/utils/comments.py +0 -0
  47. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/utils/importing.py +0 -0
  48. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/utils/logging_utils.py +0 -0
  49. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/utils/method_utils.py +0 -0
  50. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/utils/naming.py +0 -0
  51. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/utils/object_string.py +0 -0
  52. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/exporting/utils/path_check.py +0 -0
  53. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/__init__.py +0 -0
  54. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/__init__.py +0 -0
  55. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/agent/__init__.py +0 -0
  56. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/agent/agent.py +0 -0
  57. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/agent/agent_data.py +0 -0
  58. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/agent/code_execution.py +0 -0
  59. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/agent/linked_skill.py +0 -0
  60. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/agent/nested_chat.py +0 -0
  61. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/agent/teachability.py +0 -0
  62. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/agent/termination_message.py +0 -0
  63. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/agents.py +0 -0
  64. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/assistant/__init__.py +0 -0
  65. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/assistant/assistant.py +0 -0
  66. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/assistant/assistant_data.py +0 -0
  67. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/group_manager/__init__.py +0 -0
  68. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/group_manager/group_manager.py +0 -0
  69. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/group_manager/group_manager_data.py +0 -0
  70. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/group_manager/speakers.py +0 -0
  71. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/rag_user/__init__.py +0 -0
  72. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/rag_user/rag_user.py +0 -0
  73. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/rag_user/rag_user_data.py +0 -0
  74. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/rag_user/retrieve_config.py +0 -0
  75. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/user_proxy/__init__.py +0 -0
  76. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/user_proxy/user_proxy.py +0 -0
  77. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/agents/user_proxy/user_proxy_data.py +0 -0
  78. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/chat/__init__.py +0 -0
  79. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/chat/chat.py +0 -0
  80. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/chat/chat_data.py +0 -0
  81. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/chat/chat_message.py +0 -0
  82. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/chat/chat_nested.py +0 -0
  83. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/chat/chat_summary.py +0 -0
  84. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/common/__init__.py +0 -0
  85. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/common/base.py +0 -0
  86. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/flow/__init__.py +0 -0
  87. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/flow/flow.py +0 -0
  88. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/flow/flow_data.py +0 -0
  89. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/skill/__init__.py +0 -0
  90. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/skill/skill.py +0 -0
  91. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/models/skill/skill_data.py +0 -0
  92. {waldiez-0.1.19 → waldiez-0.2.0}/waldiez/py.typed +0 -0
@@ -4,7 +4,7 @@
4
4
  build/
5
5
  dist/
6
6
  site/
7
- reports/
7
+ coverage/
8
8
  waldiez_out/
9
9
  **/logs/
10
10
  **/tmp/
@@ -24,3 +24,4 @@ dmypy.json
24
24
  .coverage
25
25
  **/*.coverage*
26
26
  **/*.ffs_db
27
+ **/*.lcov
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Waldiez
3
+ Copyright (c) 2024- Waldiez
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: waldiez
3
- Version: 0.1.19
3
+ Version: 0.2.0
4
4
  Summary: waldiez
5
- Project-URL: homepage, https://waldiez.github.io/waldiez/
6
- Project-URL: repository, https://github.com/waldiez/waldiez.git
7
- Author-email: Panagiotis Kasnesis <pkasnesis@thingenious.io>, Lazaros Toumanidis <laztoum@protonmail.com>, Stella Ioannidou <stella@humancentered.gr>
5
+ Project-URL: homepage, https://waldiez.github.io/waldiez/python
6
+ Project-URL: repository, https://github.com/waldiez/python.git
7
+ Author-email: Panagiotis Kasnesis <pkasnesis@waldiez.io>, Lazaros Toumanidis <laztoum@waldiez.io>, Stella Ioannidou <stella@humancentered.gr>
8
8
  License-File: LICENSE
9
9
  Classifier: Development Status :: 3 - Alpha
10
10
  Classifier: Intended Audience :: Developers
@@ -18,26 +18,26 @@ Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Requires-Python: <3.13,>=3.10
20
20
  Requires-Dist: jupytext
21
- Requires-Dist: pyautogen==0.5.3
21
+ Requires-Dist: pyautogen==0.6.0
22
22
  Requires-Dist: pydantic>=2.0
23
23
  Requires-Dist: typer<0.13,>=0.9
24
24
  Provides-Extra: ag2-extras
25
+ Requires-Dist: autogen[captainagent]==0.6.0; (platform_system == 'Linux') and extra == 'ag2-extras'
25
26
  Requires-Dist: pgvector>=0.3.6; extra == 'ag2-extras'
26
27
  Requires-Dist: psycopg[binary]>=3.2.3; extra == 'ag2-extras'
27
- Requires-Dist: pyautogen[anthropic]==0.5.3; extra == 'ag2-extras'
28
- Requires-Dist: pyautogen[bedrock]==0.5.3; extra == 'ag2-extras'
29
- Requires-Dist: pyautogen[captainagent]==0.5.3; extra == 'ag2-extras'
30
- Requires-Dist: pyautogen[gemini]==0.5.3; extra == 'ag2-extras'
31
- Requires-Dist: pyautogen[groq]==0.5.3; extra == 'ag2-extras'
32
- Requires-Dist: pyautogen[lmm]==0.5.3; extra == 'ag2-extras'
33
- Requires-Dist: pyautogen[mistral]==0.5.3; extra == 'ag2-extras'
34
- Requires-Dist: pyautogen[neo4j]==0.5.3; extra == 'ag2-extras'
35
- Requires-Dist: pyautogen[retrievechat-mongodb]==0.5.3; extra == 'ag2-extras'
36
- Requires-Dist: pyautogen[retrievechat-pgvector]==0.5.3; extra == 'ag2-extras'
37
- Requires-Dist: pyautogen[retrievechat-qdrant]==0.5.3; (python_version < '3.13') and extra == 'ag2-extras'
38
- Requires-Dist: pyautogen[retrievechat]==0.5.3; extra == 'ag2-extras'
39
- Requires-Dist: pyautogen[together]==0.5.3; extra == 'ag2-extras'
40
- Requires-Dist: pyautogen[websurfer]==0.5.3; extra == 'ag2-extras'
28
+ Requires-Dist: pyautogen[anthropic]==0.6.0; extra == 'ag2-extras'
29
+ Requires-Dist: pyautogen[bedrock]==0.6.0; extra == 'ag2-extras'
30
+ Requires-Dist: pyautogen[gemini]==0.6.0; extra == 'ag2-extras'
31
+ Requires-Dist: pyautogen[groq]==0.6.0; extra == 'ag2-extras'
32
+ Requires-Dist: pyautogen[lmm]==0.6.0; extra == 'ag2-extras'
33
+ Requires-Dist: pyautogen[mistral]==0.6.0; extra == 'ag2-extras'
34
+ Requires-Dist: pyautogen[neo4j]==0.6.0; extra == 'ag2-extras'
35
+ Requires-Dist: pyautogen[retrievechat-mongodb]==0.6.0; extra == 'ag2-extras'
36
+ Requires-Dist: pyautogen[retrievechat-pgvector]==0.6.0; extra == 'ag2-extras'
37
+ Requires-Dist: pyautogen[retrievechat-qdrant]==0.6.0; (python_version < '3.13') and extra == 'ag2-extras'
38
+ Requires-Dist: pyautogen[retrievechat]==0.6.0; extra == 'ag2-extras'
39
+ Requires-Dist: pyautogen[together]==0.6.0; extra == 'ag2-extras'
40
+ Requires-Dist: pyautogen[websurfer]==0.6.0; extra == 'ag2-extras'
41
41
  Requires-Dist: pymongo==4.10.1; extra == 'ag2-extras'
42
42
  Requires-Dist: qdrant-client[fastembed]; (python_version >= '3.13') and extra == 'ag2-extras'
43
43
  Provides-Extra: dev
@@ -46,12 +46,12 @@ Requires-Dist: bandit==1.8.0; extra == 'dev'
46
46
  Requires-Dist: black[jupyter]==24.10.0; extra == 'dev'
47
47
  Requires-Dist: flake8==7.1.1; extra == 'dev'
48
48
  Requires-Dist: isort==5.13.2; extra == 'dev'
49
- Requires-Dist: mypy==1.13.0; extra == 'dev'
49
+ Requires-Dist: mypy==1.14.0; extra == 'dev'
50
50
  Requires-Dist: pre-commit==4.0.1; extra == 'dev'
51
51
  Requires-Dist: pydocstyle==6.3.0; extra == 'dev'
52
- Requires-Dist: pylint==3.3.2; extra == 'dev'
52
+ Requires-Dist: pylint==3.3.3; extra == 'dev'
53
53
  Requires-Dist: python-dotenv==1.0.1; extra == 'dev'
54
- Requires-Dist: ruff==0.8.3; extra == 'dev'
54
+ Requires-Dist: ruff==0.8.4; extra == 'dev'
55
55
  Requires-Dist: toml; (python_version <= '3.10') and extra == 'dev'
56
56
  Requires-Dist: types-pyyaml==6.0.12.20240917; extra == 'dev'
57
57
  Requires-Dist: types-toml==0.10.8.20240310; extra == 'dev'
@@ -66,6 +66,11 @@ Requires-Dist: mkdocs-minify-html-plugin==0.2.3; extra == 'docs'
66
66
  Requires-Dist: mkdocs==1.6.1; extra == 'docs'
67
67
  Requires-Dist: mkdocstrings-python==1.12.2; extra == 'docs'
68
68
  Requires-Dist: mkdocstrings[crystal,python]==0.27.0; extra == 'docs'
69
+ Provides-Extra: jupyter
70
+ Requires-Dist: jupyterlab>=4.3.0; extra == 'jupyter'
71
+ Requires-Dist: waldiez-jupyter==0.2.0; extra == 'jupyter'
72
+ Provides-Extra: studio
73
+ Requires-Dist: waldiez-studio==0.2.0; extra == 'studio'
69
74
  Provides-Extra: test
70
75
  Requires-Dist: pytest-cov==6.0.0; extra == 'test'
71
76
  Requires-Dist: pytest-html==4.1.1; extra == 'test'
@@ -77,11 +82,11 @@ Description-Content-Type: text/markdown
77
82
 
78
83
  # Waldiez
79
84
 
80
- ![CI Build](https://github.com/waldiez/waldiez/actions/workflows/main.yaml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/waldiez/waldiez/badge.svg)](https://coveralls.io/github/waldiez/waldiez) [![PyPI version](https://badge.fury.io/py/waldiez.svg?icon=si%3Apython)](https://badge.fury.io/py/waldiez)
85
+ ![CI Build](https://github.com/waldiez/python/actions/workflows/main.yaml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/waldiez/python/badge.svg)](https://coveralls.io/github/waldiez/python) [![PyPI version](https://badge.fury.io/py/waldiez.svg?icon=si%3Apython)](https://badge.fury.io/py/waldiez)
81
86
 
82
87
  Translate a Waldiez flow:
83
88
 
84
- ![Flow](https://raw.githubusercontent.com/waldiez/waldiez/refs/heads/main/docs/static/images/overview.webp)
89
+ ![Flow](https://raw.githubusercontent.com/waldiez/python/refs/heads/main/docs/static/images/overview.webp)
85
90
 
86
91
  To a python script or a jupyter notebook with the corresponding [ag2](https://github.com/ag2ai/ag2/) agents and chats.
87
92
 
@@ -102,11 +107,30 @@ python -m pip install waldiez
102
107
  From the repository:
103
108
 
104
109
  ```bash
105
- python -m pip install git+https://github.com/waldiez/waldiez.git
110
+ python -m pip install git+https://github.com/waldiez/python.git
106
111
  ```
107
112
 
108
113
  ## Usage
109
114
 
115
+ ### UI Options
116
+
117
+ - For creating-only (no exporting or running) waldiez flows, you can use the playground at <https://waldiez.github.io>.
118
+ The repo for the js library is [here](https://github.com/waldiez/react).
119
+ - There is also a jupyterlab extension [here](https://github.com/waldiez/jupyter)
120
+ - You also can use the vscode extension:
121
+ - [repo](https://github.com/waldiez/vscode)
122
+ - [marketplace](https://marketplace.visualstudio.com/items?itemName=Waldiez.waldiez-vscode)
123
+ - Finally, you can use [waldiez-studio](https://github.com/waldiez/studio)
124
+
125
+ <!--
126
+ The jupyterlab extension and studio also provided as extras in the main package.
127
+
128
+ ```shell
129
+ pip install waldiez[studio] # or pip install waldiez_studio
130
+ pip install waldiez[jupyter] # or pip install waldiez_jupyter
131
+ # or both
132
+ pip install waldiez[studio,jupyter]
133
+ ``` -->
110
134
  ### CLI
111
135
 
112
136
  ```bash
@@ -148,13 +172,6 @@ $CONTAINER_COMMAND run \
148
172
  waldiez/waldiez run --file /flow.waldiez --output /output/output[.py]
149
173
  ```
150
174
 
151
- ### UI
152
-
153
- For creating-only (no exporting or running) waldiez flows, you can use the playground at <https://waldiez.github.io>.
154
- The repo for the js library is [here](https://github.com/waldiez/react).
155
- We are currently working on waldiez-studio to provide a visual interface for creating and running Waldiez flows (you can find more [here](https://github.com/waldiez/studio)).
156
- Until then, you can use our [Jupyter](https://github.com/waldiez/jupyter) or the [VSCode](https://github.com/waldiez/vscode) extension to create and run Waldiez flows.
157
-
158
175
  ### As a library
159
176
 
160
177
  #### Export a flow
@@ -167,7 +184,7 @@ output_path = "/path/to/an/output.py" # or .ipynb
167
184
  exporter = WaldiezExporter.load(flow_path)
168
185
  exporter.export(output_path)
169
186
  ```
170
-
187
+
171
188
  #### Run a flow
172
189
 
173
190
  ```python
@@ -195,11 +212,11 @@ runner.run(output_path=output_path)
195
212
  ```
196
213
 
197
214
  If already installed waldiez you might need to reinstall it after uninstalling `autogen-agentchat`:
198
-
199
- ```shell
200
- pip install --force --no-cache waldiez pyautogen
201
- ```
215
+
216
+ ```shell
217
+ pip install --force --no-cache waldiez pyautogen
218
+ ```
202
219
 
203
220
  ## License
204
221
 
205
- This project is licensed under the MIT License - see the [LICENSE](https://github.com/waldiez/waldiez/blob/main/LICENSE) file for details.
222
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/waldiez/python/blob/main/LICENSE) file for details.
@@ -1,10 +1,10 @@
1
1
  # Waldiez
2
2
 
3
- ![CI Build](https://github.com/waldiez/waldiez/actions/workflows/main.yaml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/waldiez/waldiez/badge.svg)](https://coveralls.io/github/waldiez/waldiez) [![PyPI version](https://badge.fury.io/py/waldiez.svg?icon=si%3Apython)](https://badge.fury.io/py/waldiez)
3
+ ![CI Build](https://github.com/waldiez/python/actions/workflows/main.yaml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/waldiez/python/badge.svg)](https://coveralls.io/github/waldiez/python) [![PyPI version](https://badge.fury.io/py/waldiez.svg?icon=si%3Apython)](https://badge.fury.io/py/waldiez)
4
4
 
5
5
  Translate a Waldiez flow:
6
6
 
7
- ![Flow](https://raw.githubusercontent.com/waldiez/waldiez/refs/heads/main/docs/static/images/overview.webp)
7
+ ![Flow](https://raw.githubusercontent.com/waldiez/python/refs/heads/main/docs/static/images/overview.webp)
8
8
 
9
9
  To a python script or a jupyter notebook with the corresponding [ag2](https://github.com/ag2ai/ag2/) agents and chats.
10
10
 
@@ -25,11 +25,30 @@ python -m pip install waldiez
25
25
  From the repository:
26
26
 
27
27
  ```bash
28
- python -m pip install git+https://github.com/waldiez/waldiez.git
28
+ python -m pip install git+https://github.com/waldiez/python.git
29
29
  ```
30
30
 
31
31
  ## Usage
32
32
 
33
+ ### UI Options
34
+
35
+ - For creating-only (no exporting or running) waldiez flows, you can use the playground at <https://waldiez.github.io>.
36
+ The repo for the js library is [here](https://github.com/waldiez/react).
37
+ - There is also a jupyterlab extension [here](https://github.com/waldiez/jupyter)
38
+ - You also can use the vscode extension:
39
+ - [repo](https://github.com/waldiez/vscode)
40
+ - [marketplace](https://marketplace.visualstudio.com/items?itemName=Waldiez.waldiez-vscode)
41
+ - Finally, you can use [waldiez-studio](https://github.com/waldiez/studio)
42
+
43
+ <!--
44
+ The jupyterlab extension and studio also provided as extras in the main package.
45
+
46
+ ```shell
47
+ pip install waldiez[studio] # or pip install waldiez_studio
48
+ pip install waldiez[jupyter] # or pip install waldiez_jupyter
49
+ # or both
50
+ pip install waldiez[studio,jupyter]
51
+ ``` -->
33
52
  ### CLI
34
53
 
35
54
  ```bash
@@ -71,13 +90,6 @@ $CONTAINER_COMMAND run \
71
90
  waldiez/waldiez run --file /flow.waldiez --output /output/output[.py]
72
91
  ```
73
92
 
74
- ### UI
75
-
76
- For creating-only (no exporting or running) waldiez flows, you can use the playground at <https://waldiez.github.io>.
77
- The repo for the js library is [here](https://github.com/waldiez/react).
78
- We are currently working on waldiez-studio to provide a visual interface for creating and running Waldiez flows (you can find more [here](https://github.com/waldiez/studio)).
79
- Until then, you can use our [Jupyter](https://github.com/waldiez/jupyter) or the [VSCode](https://github.com/waldiez/vscode) extension to create and run Waldiez flows.
80
-
81
93
  ### As a library
82
94
 
83
95
  #### Export a flow
@@ -90,7 +102,7 @@ output_path = "/path/to/an/output.py" # or .ipynb
90
102
  exporter = WaldiezExporter.load(flow_path)
91
103
  exporter.export(output_path)
92
104
  ```
93
-
105
+
94
106
  #### Run a flow
95
107
 
96
108
  ```python
@@ -118,11 +130,11 @@ runner.run(output_path=output_path)
118
130
  ```
119
131
 
120
132
  If already installed waldiez you might need to reinstall it after uninstalling `autogen-agentchat`:
121
-
122
- ```shell
123
- pip install --force --no-cache waldiez pyautogen
124
- ```
133
+
134
+ ```shell
135
+ pip install --force --no-cache waldiez pyautogen
136
+ ```
125
137
 
126
138
  ## License
127
139
 
128
- This project is licensed under the MIT License - see the [LICENSE](https://github.com/waldiez/waldiez/blob/main/LICENSE) file for details.
140
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/waldiez/python/blob/main/LICENSE) file for details.
@@ -2,8 +2,8 @@
2
2
  name = "waldiez"
3
3
  description = 'waldiez'
4
4
  authors = [
5
- { name = 'Panagiotis Kasnesis', email = 'pkasnesis@thingenious.io' },
6
- { name= 'Lazaros Toumanidis', email= 'laztoum@protonmail.com' },
5
+ { name = 'Panagiotis Kasnesis', email = 'pkasnesis@waldiez.io' },
6
+ { name= 'Lazaros Toumanidis', email= 'laztoum@waldiez.io' },
7
7
  { name = 'Stella Ioannidou', email = 'stella@humancentered.gr'}
8
8
  ]
9
9
  readme = "README.md"
@@ -22,7 +22,7 @@ classifiers = [
22
22
  "Intended Audience :: Developers",
23
23
  ]
24
24
  dependencies =[
25
- "pyautogen==0.5.3",
25
+ "pyautogen==0.6.0",
26
26
  "jupytext",
27
27
  "pydantic>=2.0",
28
28
  # together(ag2 extra) 1.2.0 depends on typer<0.13 and >=0.9
@@ -30,8 +30,8 @@ dependencies =[
30
30
  ]
31
31
 
32
32
  [project.urls]
33
- homepage = 'https://waldiez.github.io/waldiez/'
34
- repository = 'https://github.com/waldiez/waldiez.git'
33
+ homepage = 'https://waldiez.github.io/waldiez/python'
34
+ repository = 'https://github.com/waldiez/python.git'
35
35
 
36
36
  [tool.hatch.build.targets.sdist]
37
37
  packages = ["waldiez", "waldiez.*"]
@@ -42,18 +42,25 @@ packages = ["waldiez", "waldiez.*"]
42
42
  exclude = [ "**/example.py" ]
43
43
 
44
44
  [project.optional-dependencies]
45
+ studio = [
46
+ "waldiez_studio==0.2.0",
47
+ ]
48
+ jupyter = [
49
+ "waldiez_jupyter==0.2.0",
50
+ "jupyterlab>=4.3.0",
51
+ ]
45
52
  dev = [
46
53
  'autoflake==2.3.1',
47
54
  'bandit==1.8.0',
48
55
  'black[jupyter]==24.10.0',
49
56
  'flake8==7.1.1',
50
57
  'isort==5.13.2',
51
- 'mypy==1.13.0',
58
+ 'mypy==1.14.0',
52
59
  'pre-commit==4.0.1',
53
60
  'pydocstyle==6.3.0',
54
- 'pylint==3.3.2',
61
+ 'pylint==3.3.3',
55
62
  'python-dotenv==1.0.1',
56
- 'ruff==0.8.3',
63
+ 'ruff==0.8.4',
57
64
  'types-PyYAML==6.0.12.20240917',
58
65
  'yamllint==1.35.1',
59
66
  'toml; python_version <= "3.10"',
@@ -79,25 +86,28 @@ dev = [
79
86
  #
80
87
  # https://github.com/ag2ai/ag2/blob/main/setup.py#L33
81
88
  #
89
+ # captainagent(ag2 extra) depends on pysqlite3-binary,
90
+ # but the wheels are only for linux (not checked every py version)
91
+ # on windows with py 3.12, it seems to not work.
82
92
  ag2_extras =[
83
93
  'pgvector>=0.3.6',
84
94
  'psycopg[binary]>=3.2.3',
85
- 'pyautogen[anthropic]==0.5.3',
86
- 'pyautogen[bedrock]==0.5.3',
87
- 'pyautogen[captainagent]==0.5.3',
88
- 'pyautogen[gemini]==0.5.3',
89
- 'pyautogen[groq]==0.5.3',
90
- 'pyautogen[lmm]==0.5.3',
91
- 'pyautogen[mistral]==0.5.3',
92
- 'pyautogen[neo4j]==0.5.3',
93
- 'pyautogen[retrievechat-mongodb]==0.5.3',
94
- 'pyautogen[retrievechat-pgvector]==0.5.3',
95
- 'pyautogen[retrievechat-qdrant]==0.5.3; python_version < "3.13"',
95
+ 'pyautogen[anthropic]==0.6.0',
96
+ 'pyautogen[bedrock]==0.6.0',
97
+ 'autogen[captainagent]==0.6.0; platform_system == "Linux"',
98
+ 'pyautogen[gemini]==0.6.0',
99
+ 'pyautogen[groq]==0.6.0',
100
+ 'pyautogen[lmm]==0.6.0',
101
+ 'pyautogen[mistral]==0.6.0',
102
+ 'pyautogen[neo4j]==0.6.0',
103
+ 'pyautogen[retrievechat-mongodb]==0.6.0',
104
+ 'pyautogen[retrievechat-pgvector]==0.6.0',
105
+ 'pyautogen[retrievechat-qdrant]==0.6.0; python_version < "3.13"',
96
106
  'qdrant-client[fastembed]; python_version >= "3.13"',
97
- 'pyautogen[retrievechat]==0.5.3',
98
- 'pyautogen[together]==0.5.3',
99
- 'pyautogen[together]==0.5.3',
100
- 'pyautogen[websurfer]==0.5.3',
107
+ 'pyautogen[retrievechat]==0.6.0',
108
+ 'pyautogen[together]==0.6.0',
109
+ 'pyautogen[together]==0.6.0',
110
+ 'pyautogen[websurfer]==0.6.0',
101
111
  'pymongo==4.10.1',
102
112
  ]
103
113
  test = [
@@ -147,6 +157,7 @@ exclude = '''
147
157
  | __init__.py
148
158
  | .local
149
159
  | examples
160
+ | waldiez_out
150
161
  )/
151
162
  '''
152
163
 
@@ -177,6 +188,7 @@ exclude = [
177
188
  '.venv',
178
189
  '.local',
179
190
  'examples',
191
+ 'waldiez_out',
180
192
  ]
181
193
 
182
194
  [tool.pydantic-mypy]
@@ -191,6 +203,7 @@ skip=[
191
203
  '.venv',
192
204
  '.local',
193
205
  'examples',
206
+ 'waldiez_out',
194
207
  ]
195
208
  include_trailing_comma=true
196
209
  force_grid_wrap=0
@@ -199,7 +212,7 @@ line_length=80
199
212
 
200
213
  # pydocstyle
201
214
  [tool.pydocstyle]
202
- match-dir='([^!(.venv)].*)([^!(.local)].*)([^!(examples)].*)'
215
+ match-dir='([^!(.venv)].*)([^!(.local)].*)([^!(examples)].*)([^!(waldiez_out)].*)'
203
216
 
204
217
  # pylint
205
218
  [tool.pylint.master]
@@ -219,6 +232,7 @@ ignore-paths = [
219
232
  ".venv",
220
233
  ".local*",
221
234
  "examples",
235
+ "waldiez_out",
222
236
  ]
223
237
 
224
238
  unsafe-load-any-extension="no"
@@ -234,9 +248,10 @@ min-similarity-lines=10
234
248
  [tool.pylint.broad_try_clause]
235
249
  max-try-statements=3
236
250
  [tool.pylint.design]
237
- max-args=10
238
- max-attributes=10
239
- max-positional-arguments=10
251
+ max-args=11
252
+ max-attributes=11
253
+ max-positional-arguments=11
254
+ max-statements=50
240
255
  [tool.pylint.string]
241
256
  check-quote-consistency = true
242
257
  check-str-concat-over-line-jumps = true
@@ -253,7 +268,8 @@ default-docstring-type = "numpy"
253
268
  exclude_dirs = [
254
269
  ".venv",
255
270
  ".local",
256
- "examples"
271
+ "examples",
272
+ "waldiez_out",
257
273
  ]
258
274
  # B104: bind to all interfaces (0.0.0.0)
259
275
  # B110: allow pass on try/except
@@ -263,7 +279,6 @@ skips = ['B104', 'B110', 'B404', 'B602', 'B603' ]
263
279
  [tool.bandit.assert_used]
264
280
  skips = ['*_test.py', '*/test_*.py']
265
281
 
266
-
267
282
  # ruff
268
283
  [tool.ruff]
269
284
  line-length = 80
@@ -271,6 +286,7 @@ extend-exclude = [
271
286
  ".venv",
272
287
  ".local",
273
288
  "examples",
289
+ "waldiez_out",
274
290
  ]
275
291
 
276
292
  [tool.ruff.lint]
@@ -299,12 +315,6 @@ filterwarnings = [
299
315
  # DeprecationWarning:
300
316
  # Type google._upb._message.MessageMapContainer uses PyType_Spec with a metaclass that has custom tp_new.
301
317
  # This is deprecated and will no longer be allowed in Python 3.14.
302
- #
303
- # autogen/logger/logger_utils.py:9: DeprecationWarning:
304
- # datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version
305
- #
306
- # DeprecationWarning:
307
- # reactor.stop cannot be used inside unit tests
308
318
  "ignore::DeprecationWarning",
309
319
  ]
310
320
  python_files = [
@@ -314,6 +324,7 @@ python_files = [
314
324
  ]
315
325
  addopts = """
316
326
  -d \
327
+ -s \
317
328
  -n auto \
318
329
  --exitfirst \
319
330
  --durations=10 \
@@ -1,6 +1,7 @@
1
1
  """Waldiez package."""
2
2
 
3
3
  import logging
4
+ import warnings
4
5
 
5
6
  from ._version import __version__
6
7
  from .conflict_checker import check_conflicts
@@ -8,6 +9,10 @@ from .exporter import WaldiezExporter
8
9
  from .models import Waldiez
9
10
  from .runner import WaldiezRunner
10
11
 
12
+ warnings.filterwarnings(
13
+ "ignore", module="flaml", message="^.*flaml.automl is not available.*$"
14
+ )
15
+
11
16
 
12
17
  # pylint: disable=too-few-public-methods
13
18
  class FlamlFilter(logging.Filter):
@@ -1,3 +1,3 @@
1
1
  """Version information for Waldiez."""
2
2
 
3
- __version__ = "0.1.19"
3
+ __version__ = "0.2.0"
@@ -1,10 +1,11 @@
1
1
  """Command line interface to convert or run a waldiez file."""
2
2
 
3
- # pylint: disable=missing-function-docstring,missing-param-doc,missing-raises-doc
3
+ # pylint: disable=missing-function-docstring,missing-param-doc,missing-raises-doc # noqa: E501
4
4
  import json
5
5
  import logging
6
6
  import os
7
7
  import sys
8
+ import warnings
8
9
  from pathlib import Path
9
10
  from typing import TYPE_CHECKING, Optional
10
11
 
@@ -12,9 +13,14 @@ import typer
12
13
  from typing_extensions import Annotated
13
14
 
14
15
  from . import Waldiez, __version__
16
+ from .cli_extras import add_cli_extras # type: ignore
15
17
  from .exporter import WaldiezExporter
16
18
  from .runner import WaldiezRunner
17
19
 
20
+ warnings.filterwarnings(
21
+ "ignore", module="flaml", message="^.*flaml.automl is not available.*$"
22
+ )
23
+
18
24
  if TYPE_CHECKING:
19
25
  from autogen import ChatResult # type: ignore[import-untyped]
20
26
 
@@ -224,6 +230,8 @@ def _log_result(result: "ChatResult", logger: logging.Logger) -> None:
224
230
  logger.info(result.cost)
225
231
 
226
232
 
233
+ add_cli_extras(app)
234
+
227
235
  if __name__ == "__main__":
228
236
  _get_logger()
229
237
  app()
@@ -0,0 +1,123 @@
1
+ # type: ignore
2
+ # flake8: noqa
3
+ # pylint: skip-file
4
+ # isort: skip_file
5
+ """Extra typer commands for CLI."""
6
+
7
+ import typer
8
+ import subprocess # nosemgrep # nosec
9
+
10
+ HAVE_STUDIO = False
11
+ HAVE_JUPYTER = False
12
+ try:
13
+ from waldiez_studio.cli import app as studio_app
14
+
15
+ HAVE_STUDIO = True
16
+ except BaseException:
17
+ pass
18
+
19
+ try:
20
+ import waldiez_jupyter
21
+
22
+ HAVE_JUPYTER = True
23
+ except BaseException:
24
+ pass
25
+
26
+
27
+ def add_cli_extras(app: typer.Typer) -> None:
28
+ """Add extra CLI commands to the app.
29
+
30
+ Parameters
31
+ ----------
32
+ app : typer.Typer
33
+ The Typer app to add the extra commands to.
34
+
35
+ Returns
36
+ -------
37
+ typer.Typer
38
+ The app with the extra commands added
39
+ """
40
+ if HAVE_STUDIO:
41
+ app.add_typer(
42
+ studio_app,
43
+ name="studio",
44
+ help="Start Waldiez Studio.",
45
+ no_args_is_help=False,
46
+ )
47
+ if HAVE_JUPYTER:
48
+ jupyter_app = get_jupyter_app()
49
+ app.add_typer(jupyter_app, name="lab")
50
+
51
+
52
+ def get_jupyter_app() -> typer.Typer:
53
+ """Get the Jupyter Typer app.
54
+
55
+ Returns
56
+ -------
57
+ typer.Typer
58
+ The Jupyter Typer app
59
+ """
60
+ jupyter_app = typer.Typer(
61
+ name="lab",
62
+ help="Start jupyter lab with the waldiez extension.",
63
+ context_settings={
64
+ "help_option_names": ["-h", "--help"],
65
+ "allow_extra_args": True,
66
+ "ignore_unknown_options": True,
67
+ },
68
+ add_completion=False,
69
+ no_args_is_help=False,
70
+ invoke_without_command=True,
71
+ add_help_option=True,
72
+ pretty_exceptions_enable=False,
73
+ epilog=(
74
+ "Use `waldiez lab [COMMAND] --help` for command-specific help. "
75
+ ),
76
+ )
77
+
78
+ @jupyter_app.command(
79
+ name="start",
80
+ help="Start JupyterLab.",
81
+ )
82
+ def start(
83
+ port: int = typer.Option(
84
+ 8888,
85
+ "--port",
86
+ help="Port to run JupyterLab on.",
87
+ ),
88
+ host: str = typer.Option(
89
+ "*",
90
+ "--host",
91
+ help="Host to run JupyterLab on.",
92
+ ),
93
+ browser: bool = typer.Option(
94
+ False,
95
+ "--no-browser",
96
+ help="Don't open the browser.",
97
+ ),
98
+ password: str = typer.Option(
99
+ None,
100
+ "--password",
101
+ help="Password to access JupyterLab.",
102
+ ),
103
+ ) -> None:
104
+ """Start JupyterLab."""
105
+ command = [
106
+ "jupyter",
107
+ "lab",
108
+ f"--port={port}",
109
+ f"--ip={host}",
110
+ "--ServerApp.terminado_settings=\"shell_command=['/bin/bash']\"",
111
+ "--ServerApp.allow_origin='*'",
112
+ "--ServerApp.disable_check_xsrf=True",
113
+ ]
114
+ if browser:
115
+ command.append("--no-browser")
116
+ if password:
117
+ from jupyter_server.auth import passwd
118
+
119
+ hashed_password = passwd(password)
120
+ command.append(f"--ServerApp.password={hashed_password}")
121
+ subprocess.run(command)
122
+
123
+ return jupyter_app
@@ -195,7 +195,7 @@ class WaldiezExporter:
195
195
  # we first create a .py file with the content
196
196
  # and then convert it to a notebook using jupytext
197
197
  py_path = path.with_suffix(".tmp.py")
198
- with open(py_path, "w", encoding="utf-8") as f:
198
+ with open(py_path, "w", encoding="utf-8", newline="\n") as f:
199
199
  f.write(content)
200
200
  if not shutil.which("jupytext"): # pragma: no cover
201
201
  run_command(
@@ -203,7 +203,14 @@ class WaldiezExporter:
203
203
  allow_error=False,
204
204
  )
205
205
  run_command(
206
- ["jupytext", "--to", "notebook", str(py_path)],
206
+ [
207
+ sys.executable,
208
+ "-m",
209
+ "jupytext",
210
+ "--to",
211
+ "notebook",
212
+ str(py_path),
213
+ ],
207
214
  allow_error=False,
208
215
  )
209
216
  ipynb_path = str(py_path).replace(".tmp.py", ".tmp.ipynb")
@@ -239,7 +246,7 @@ class WaldiezExporter:
239
246
  )
240
247
  content += '\n\nif __name__ == "__main__":\n'
241
248
  content += " print(main())\n"
242
- with open(path, "w", encoding="utf-8") as file:
249
+ with open(path, "w", encoding="utf-8", newline="\n") as file:
243
250
  file.write(content)
244
251
 
245
252
  def to_waldiez(self, file_path: Path) -> None:
@@ -250,7 +257,7 @@ class WaldiezExporter:
250
257
  file_path : Path
251
258
  The file path.
252
259
  """
253
- with open(file_path, "w", encoding="utf-8") as file:
260
+ with open(file_path, "w", encoding="utf-8", newline="\n") as file:
254
261
  file.write(self.waldiez.model_dump_json())
255
262
 
256
263
 
@@ -1,5 +1,6 @@
1
1
  """Vector DB exporting utils for RAG user agents."""
2
2
 
3
+ # flake8: noqa E501
3
4
  # pylint: disable=line-too-long
4
5
  from typing import Any, Set, Tuple
5
6
 
@@ -8,6 +8,7 @@ export_multiple_chats_string
8
8
  Get the chats content, when there are more than one chats in the flow.
9
9
  """
10
10
 
11
+ # flake8: noqa E501
11
12
  from typing import Any, Dict, List, Optional, Tuple
12
13
 
13
14
  from waldiez.models import (
@@ -238,5 +238,7 @@ def get_model_api_key(model_name: str) -> str:
238
238
  return __ALL_MODEL_API_KEYS__.get(model_name, "")
239
239
  '''
240
240
 
241
- with open(output_dir / "waldiez_api_keys.py", "w", encoding="utf-8") as f:
241
+ with open(
242
+ output_dir / "waldiez_api_keys.py", "w", encoding="utf-8", newline="\n"
243
+ ) as f:
242
244
  f.write(api_keys_content)
@@ -88,7 +88,7 @@ def _write_skill_secrets(
88
88
  if not skill.secrets:
89
89
  return
90
90
  secrets_file = output_dir / f"{skill_name}_secrets.py"
91
- with secrets_file.open("w", encoding="utf-8") as f:
91
+ with secrets_file.open("w", encoding="utf-8", newline="\n") as f:
92
92
  f.write('"""Secrets for the skill."""\n')
93
93
  f.write("from os import environ\n\n")
94
94
  for key, value in skill.secrets.items():
@@ -158,6 +158,6 @@ def export_skills(
158
158
  )
159
159
  _write_skill_secrets(skill, skill_name, output_dir)
160
160
  skill_file = output_dir / f"{skill_name}.py"
161
- with skill_file.open("w", encoding="utf-8") as f:
161
+ with skill_file.open("w", encoding="utf-8", newline="\n") as f:
162
162
  f.write(skill.content)
163
163
  return skill_imports, skill_secrets
@@ -1,5 +1,7 @@
1
1
  """The vector db config for the RAG user agent."""
2
2
 
3
+ # flake8: noqa E501
4
+
3
5
  from pathlib import Path
4
6
  from typing import Any, Dict, Optional
5
7
 
@@ -1,5 +1,6 @@
1
1
  """Function related utilities."""
2
2
 
3
+ # flake8: noqa E501
3
4
  import ast
4
5
  from typing import Dict, List, Literal, Optional, Tuple
5
6
 
@@ -1,9 +1,10 @@
1
1
  """Waldiez model."""
2
2
 
3
- from .model import WaldiezModel
3
+ from .model import DEFAULT_BASE_URLS, WaldiezModel
4
4
  from .model_data import WaldiezModelAPIType, WaldiezModelData, WaldiezModelPrice
5
5
 
6
6
  __all__ = [
7
+ "DEFAULT_BASE_URLS",
7
8
  "WaldiezModel",
8
9
  "WaldiezModelData",
9
10
  "WaldiezModelPrice",
@@ -7,7 +7,16 @@ from pydantic import Field
7
7
  from typing_extensions import Annotated, Literal
8
8
 
9
9
  from ..common import WaldiezBase, now
10
- from .model_data import WaldiezModelData
10
+ from .model_data import WaldiezModelAPIType, WaldiezModelData
11
+
12
+ DEFAULT_BASE_URLS: Dict[WaldiezModelAPIType, str] = {
13
+ "google": "https://generativelanguage.googleapis.com/v1beta",
14
+ "anthropic": "https://api.anthropic.com/v1",
15
+ "mistral": "https://api.mistral.ai/v1",
16
+ "groq": "https://api.groq.com/openai/v1",
17
+ "together": "https://api.together.xyz/v1",
18
+ "nim": "https://integrate.api.nvidia.com/v1",
19
+ }
11
20
 
12
21
 
13
22
  class WaldiezModel(WaldiezBase):
@@ -166,4 +175,30 @@ class WaldiezModel(WaldiezBase):
166
175
  value = getattr(self, attr)
167
176
  if value:
168
177
  _llm_config[attr] = value
169
- return _llm_config
178
+ return set_default_base_url(_llm_config, self.data.api_type)
179
+
180
+
181
+ def set_default_base_url(
182
+ llm_config: Dict[str, Any], api_type: WaldiezModelAPIType
183
+ ) -> Dict[str, Any]:
184
+ """Set the default base url if not provided.
185
+
186
+ Parameters
187
+ ----------
188
+ llm_config : Dict[str, Any]
189
+ The llm config dictionary.
190
+ api_type : str
191
+ The api type.
192
+
193
+ Returns
194
+ -------
195
+ Dict[str, Any]
196
+ The llm config dictionary with the default base url set.
197
+ """
198
+ if api_type in ("openai", "other", "azure"):
199
+ return llm_config
200
+ if "base_url" not in llm_config or not llm_config["base_url"]:
201
+ dict_copy = llm_config.copy()
202
+ dict_copy["base_url"] = DEFAULT_BASE_URLS.get(api_type, "")
203
+ return dict_copy
204
+ return llm_config
@@ -1,5 +1,6 @@
1
1
  """Waldiez Model Data."""
2
2
 
3
+ # flake8: noqa E501
3
4
  from typing import Dict, Optional
4
5
 
5
6
  from pydantic import Field
@@ -6,6 +6,7 @@ definitions and their optional additional skills to be used.
6
6
  """
7
7
 
8
8
  import json
9
+ import warnings
9
10
  from dataclasses import dataclass
10
11
  from functools import cache
11
12
  from pathlib import Path
@@ -309,8 +310,10 @@ def _get_flow(
309
310
  def _get_autogen_version() -> str:
310
311
  """Get the autogen version."""
311
312
  # pylint: disable=import-outside-toplevel
312
- try:
313
- from autogen.version import __version__ as atg_version # type: ignore
314
- except ImportError: # pragma: no cover
315
- atg_version = "0.0.0"
316
- return atg_version
313
+ with warnings.catch_warnings():
314
+ warnings.simplefilter("ignore")
315
+ try:
316
+ from autogen.version import __version__ as ag2 # type: ignore
317
+ except ImportError as error: # pragma: no cover
318
+ raise ValueError("pyautogen is not installed.") from error
319
+ return ag2
@@ -18,6 +18,7 @@ import site
18
18
  import subprocess # nosemgrep # nosec
19
19
  import sys
20
20
  import tempfile
21
+ import warnings
21
22
  from contextlib import contextmanager
22
23
  from pathlib import Path
23
24
  from types import TracebackType
@@ -28,6 +29,7 @@ from typing import (
28
29
  Iterator,
29
30
  List,
30
31
  Optional,
32
+ Tuple,
31
33
  Type,
32
34
  Union,
33
35
  )
@@ -153,7 +155,8 @@ class WaldiezRunner:
153
155
  req for req in self.waldiez.requirements if req not in sys.modules
154
156
  )
155
157
  if extra_requirements:
156
- printer(f"Installing requirements: {', '.join(extra_requirements)}")
158
+ requirements_string = ", ".join(extra_requirements)
159
+ printer(f"Installing requirements: {requirements_string}")
157
160
  pip_install = [sys.executable, "-m", "pip", "install"]
158
161
  if not in_virtualenv():
159
162
  pip_install.append("--user")
@@ -343,6 +346,9 @@ def refresh_environment() -> None:
343
346
  ]
344
347
  for mod in modules_to_reload:
345
348
  del sys.modules[mod]
349
+ warnings.filterwarnings(
350
+ "ignore", module="flaml", message="^.*flaml.automl is not available.*$"
351
+ )
346
352
  import autogen
347
353
  from autogen.io import IOStream
348
354
 
@@ -361,4 +367,57 @@ def get_printer() -> Callable[..., None]:
361
367
  """
362
368
  from autogen.io import IOStream
363
369
 
364
- return IOStream.get_default().print
370
+ printer = IOStream.get_default().print
371
+
372
+ def safe_printer(*args: object, **kwargs: object) -> None:
373
+ try:
374
+ printer(*args, **kwargs)
375
+ except UnicodeEncodeError:
376
+ # pylint: disable=too-many-try-statements
377
+ try:
378
+ msg, flush = get_what_to_print(*args, **kwargs)
379
+ printer(msg, end="", flush=flush)
380
+ except UnicodeEncodeError:
381
+ sys.stdout = io.TextIOWrapper(
382
+ sys.stdout.buffer, encoding="utf-8"
383
+ )
384
+ sys.stderr = io.TextIOWrapper(
385
+ sys.stderr.buffer, encoding="utf-8"
386
+ )
387
+ try:
388
+ printer(*args, **kwargs)
389
+ except UnicodeEncodeError:
390
+ sys.stderr.write(
391
+ "Could not print the message due to encoding issues.\n"
392
+ )
393
+
394
+ return safe_printer
395
+
396
+
397
+ def get_what_to_print(*args: object, **kwargs: object) -> Tuple[str, bool]:
398
+ """Get what to print.
399
+
400
+ Parameters
401
+ ----------
402
+ args : object
403
+ The arguments.
404
+ kwargs : object
405
+ The keyword arguments.
406
+
407
+ Returns
408
+ -------
409
+ Tuple[str, bool]
410
+ The message and whether to flush.
411
+ """
412
+ sep = kwargs.get("sep", " ")
413
+ if not isinstance(sep, str):
414
+ sep = " "
415
+ end = kwargs.get("end", "\n")
416
+ if not isinstance(end, str):
417
+ end = "\n"
418
+ flush = kwargs.get("flush", False)
419
+ if not isinstance(flush, bool):
420
+ flush = False
421
+ msg = sep.join(str(arg) for arg in args) + end
422
+ utf8_msg = msg.encode("utf-8", errors="replace").decode("utf-8")
423
+ return utf8_msg, flush
File without changes
File without changes