waldiez 0.1.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.
- waldiez-0.1.0/.gitignore +26 -0
- waldiez-0.1.0/LICENSE +21 -0
- waldiez-0.1.0/PKG-INFO +181 -0
- waldiez-0.1.0/README.md +107 -0
- waldiez-0.1.0/pyproject.toml +302 -0
- waldiez-0.1.0/waldiez/__init__.py +15 -0
- waldiez-0.1.0/waldiez/__main__.py +6 -0
- waldiez-0.1.0/waldiez/_version.py +3 -0
- waldiez-0.1.0/waldiez/cli.py +162 -0
- waldiez-0.1.0/waldiez/exporter.py +293 -0
- waldiez-0.1.0/waldiez/exporting/__init__.py +14 -0
- waldiez-0.1.0/waldiez/exporting/agents/__init__.py +5 -0
- waldiez-0.1.0/waldiez/exporting/agents/agent.py +229 -0
- waldiez-0.1.0/waldiez/exporting/agents/agent_skills.py +67 -0
- waldiez-0.1.0/waldiez/exporting/agents/code_execution.py +67 -0
- waldiez-0.1.0/waldiez/exporting/agents/group_manager.py +209 -0
- waldiez-0.1.0/waldiez/exporting/agents/llm_config.py +53 -0
- waldiez-0.1.0/waldiez/exporting/agents/rag_user/__init__.py +5 -0
- waldiez-0.1.0/waldiez/exporting/agents/rag_user/chroma_utils.py +134 -0
- waldiez-0.1.0/waldiez/exporting/agents/rag_user/mongo_utils.py +83 -0
- waldiez-0.1.0/waldiez/exporting/agents/rag_user/pgvector_utils.py +93 -0
- waldiez-0.1.0/waldiez/exporting/agents/rag_user/qdrant_utils.py +112 -0
- waldiez-0.1.0/waldiez/exporting/agents/rag_user/rag_user.py +165 -0
- waldiez-0.1.0/waldiez/exporting/agents/rag_user/vector_db.py +119 -0
- waldiez-0.1.0/waldiez/exporting/agents/teachability.py +37 -0
- waldiez-0.1.0/waldiez/exporting/agents/termination_message.py +45 -0
- waldiez-0.1.0/waldiez/exporting/chats/__init__.py +14 -0
- waldiez-0.1.0/waldiez/exporting/chats/chats.py +46 -0
- waldiez-0.1.0/waldiez/exporting/chats/helpers.py +395 -0
- waldiez-0.1.0/waldiez/exporting/chats/nested.py +264 -0
- waldiez-0.1.0/waldiez/exporting/flow/__init__.py +5 -0
- waldiez-0.1.0/waldiez/exporting/flow/def_main.py +37 -0
- waldiez-0.1.0/waldiez/exporting/flow/flow.py +185 -0
- waldiez-0.1.0/waldiez/exporting/models/__init__.py +193 -0
- waldiez-0.1.0/waldiez/exporting/skills/__init__.py +128 -0
- waldiez-0.1.0/waldiez/exporting/utils/__init__.py +34 -0
- waldiez-0.1.0/waldiez/exporting/utils/comments.py +136 -0
- waldiez-0.1.0/waldiez/exporting/utils/importing.py +267 -0
- waldiez-0.1.0/waldiez/exporting/utils/logging_utils.py +203 -0
- waldiez-0.1.0/waldiez/exporting/utils/method_utils.py +35 -0
- waldiez-0.1.0/waldiez/exporting/utils/naming.py +127 -0
- waldiez-0.1.0/waldiez/exporting/utils/object_string.py +81 -0
- waldiez-0.1.0/waldiez/io_stream.py +181 -0
- waldiez-0.1.0/waldiez/models/__init__.py +107 -0
- waldiez-0.1.0/waldiez/models/agents/__init__.py +65 -0
- waldiez-0.1.0/waldiez/models/agents/agent/__init__.py +21 -0
- waldiez-0.1.0/waldiez/models/agents/agent/agent.py +190 -0
- waldiez-0.1.0/waldiez/models/agents/agent/agent_data.py +162 -0
- waldiez-0.1.0/waldiez/models/agents/agent/code_execution.py +71 -0
- waldiez-0.1.0/waldiez/models/agents/agent/linked_skill.py +30 -0
- waldiez-0.1.0/waldiez/models/agents/agent/nested_chat.py +73 -0
- waldiez-0.1.0/waldiez/models/agents/agent/teachability.py +68 -0
- waldiez-0.1.0/waldiez/models/agents/agent/termination_message.py +167 -0
- waldiez-0.1.0/waldiez/models/agents/agents.py +129 -0
- waldiez-0.1.0/waldiez/models/agents/assistant/__init__.py +6 -0
- waldiez-0.1.0/waldiez/models/agents/assistant/assistant.py +41 -0
- waldiez-0.1.0/waldiez/models/agents/assistant/assistant_data.py +29 -0
- waldiez-0.1.0/waldiez/models/agents/group_manager/__init__.py +19 -0
- waldiez-0.1.0/waldiez/models/agents/group_manager/group_manager.py +87 -0
- waldiez-0.1.0/waldiez/models/agents/group_manager/group_manager_data.py +91 -0
- waldiez-0.1.0/waldiez/models/agents/group_manager/speakers.py +211 -0
- waldiez-0.1.0/waldiez/models/agents/rag_user/__init__.py +26 -0
- waldiez-0.1.0/waldiez/models/agents/rag_user/rag_user.py +58 -0
- waldiez-0.1.0/waldiez/models/agents/rag_user/rag_user_data.py +32 -0
- waldiez-0.1.0/waldiez/models/agents/rag_user/retrieve_config.py +592 -0
- waldiez-0.1.0/waldiez/models/agents/rag_user/vector_db_config.py +162 -0
- waldiez-0.1.0/waldiez/models/agents/user_proxy/__init__.py +6 -0
- waldiez-0.1.0/waldiez/models/agents/user_proxy/user_proxy.py +41 -0
- waldiez-0.1.0/waldiez/models/agents/user_proxy/user_proxy_data.py +30 -0
- waldiez-0.1.0/waldiez/models/chat/__init__.py +22 -0
- waldiez-0.1.0/waldiez/models/chat/chat.py +129 -0
- waldiez-0.1.0/waldiez/models/chat/chat_data.py +326 -0
- waldiez-0.1.0/waldiez/models/chat/chat_message.py +304 -0
- waldiez-0.1.0/waldiez/models/chat/chat_nested.py +160 -0
- waldiez-0.1.0/waldiez/models/chat/chat_summary.py +110 -0
- waldiez-0.1.0/waldiez/models/common/__init__.py +38 -0
- waldiez-0.1.0/waldiez/models/common/base.py +63 -0
- waldiez-0.1.0/waldiez/models/common/method_utils.py +165 -0
- waldiez-0.1.0/waldiez/models/flow/__init__.py +9 -0
- waldiez-0.1.0/waldiez/models/flow/flow.py +302 -0
- waldiez-0.1.0/waldiez/models/flow/flow_data.py +87 -0
- waldiez-0.1.0/waldiez/models/model/__init__.py +11 -0
- waldiez-0.1.0/waldiez/models/model/model.py +169 -0
- waldiez-0.1.0/waldiez/models/model/model_data.py +86 -0
- waldiez-0.1.0/waldiez/models/skill/__init__.py +9 -0
- waldiez-0.1.0/waldiez/models/skill/skill.py +129 -0
- waldiez-0.1.0/waldiez/models/skill/skill_data.py +37 -0
- waldiez-0.1.0/waldiez/models/waldiez.py +301 -0
- waldiez-0.1.0/waldiez/py.typed +0 -0
- waldiez-0.1.0/waldiez/runner.py +304 -0
- waldiez-0.1.0/waldiez/stream/__init__.py +7 -0
- waldiez-0.1.0/waldiez/stream/consumer.py +139 -0
- waldiez-0.1.0/waldiez/stream/provider.py +339 -0
- waldiez-0.1.0/waldiez/stream/server.py +412 -0
waldiez-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.local/
|
|
2
|
+
.venv/
|
|
3
|
+
.cache/
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
site/
|
|
7
|
+
reports/
|
|
8
|
+
waldiez_out/
|
|
9
|
+
**/logs/
|
|
10
|
+
**/tmp/
|
|
11
|
+
**/documents/
|
|
12
|
+
*.log
|
|
13
|
+
*.db
|
|
14
|
+
*.sqlite3
|
|
15
|
+
__pycache__/
|
|
16
|
+
*.py[cod]
|
|
17
|
+
*.egg
|
|
18
|
+
.pytest_cache/
|
|
19
|
+
.mypy_cache/
|
|
20
|
+
.dmypy.json
|
|
21
|
+
dmypy.json
|
|
22
|
+
.ruff_cache/
|
|
23
|
+
.DS_Store
|
|
24
|
+
.coverage
|
|
25
|
+
**/*.coverage*
|
|
26
|
+
**/*.ffs_db
|
waldiez-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Waldiez
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
waldiez-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: waldiez
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: waldiez
|
|
5
|
+
Project-URL: homepage, https://waldiez.github.io/py/
|
|
6
|
+
Project-URL: repository, https://github.com/waldiez/py.git
|
|
7
|
+
Author-email: Panagiotis Kasnesis <pkasnesis@thingenious.io>, Lazaros Toumanidis <laztoum@protonmail.com>
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Requires-Python: <3.13,>=3.10
|
|
20
|
+
Requires-Dist: autogen-agentchat==0.2.37
|
|
21
|
+
Requires-Dist: jupytext
|
|
22
|
+
Requires-Dist: twisted==24.7.0
|
|
23
|
+
Provides-Extra: autogen-extras
|
|
24
|
+
Requires-Dist: autogen-agentchat[anthropic]==0.2.37; extra == 'autogen-extras'
|
|
25
|
+
Requires-Dist: autogen-agentchat[bedrock]==0.2.37; extra == 'autogen-extras'
|
|
26
|
+
Requires-Dist: autogen-agentchat[gemini]==0.2.37; extra == 'autogen-extras'
|
|
27
|
+
Requires-Dist: autogen-agentchat[groq]==0.2.37; extra == 'autogen-extras'
|
|
28
|
+
Requires-Dist: autogen-agentchat[mistral]==0.2.37; extra == 'autogen-extras'
|
|
29
|
+
Requires-Dist: autogen-agentchat[retrievechat-couchbase]==0.2.37; extra == 'autogen-extras'
|
|
30
|
+
Requires-Dist: autogen-agentchat[retrievechat-mongodb]==0.2.37; extra == 'autogen-extras'
|
|
31
|
+
Requires-Dist: autogen-agentchat[retrievechat-pgvector]==0.2.37; extra == 'autogen-extras'
|
|
32
|
+
Requires-Dist: autogen-agentchat[retrievechat-qdrant]==0.2.37; extra == 'autogen-extras'
|
|
33
|
+
Requires-Dist: autogen-agentchat[retrievechat]==0.2.37; extra == 'autogen-extras'
|
|
34
|
+
Requires-Dist: autogen-agentchat[together]==0.2.37; extra == 'autogen-extras'
|
|
35
|
+
Requires-Dist: autogen-agentchat[websurfer]==0.2.37; extra == 'autogen-extras'
|
|
36
|
+
Requires-Dist: chromadb==0.5.15; extra == 'autogen-extras'
|
|
37
|
+
Requires-Dist: fastembed==0.4.1; extra == 'autogen-extras'
|
|
38
|
+
Requires-Dist: pgvector==0.3.5; extra == 'autogen-extras'
|
|
39
|
+
Requires-Dist: psycopg[binary]>=3.2.3; extra == 'autogen-extras'
|
|
40
|
+
Requires-Dist: pymongo==4.10.1; extra == 'autogen-extras'
|
|
41
|
+
Requires-Dist: qdrant-client==1.12.0; extra == 'autogen-extras'
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: autoflake==2.3.1; extra == 'dev'
|
|
44
|
+
Requires-Dist: bandit==1.7.10; extra == 'dev'
|
|
45
|
+
Requires-Dist: black[jupyter]==24.10.0; extra == 'dev'
|
|
46
|
+
Requires-Dist: flake8==7.1.1; extra == 'dev'
|
|
47
|
+
Requires-Dist: isort==5.13.2; extra == 'dev'
|
|
48
|
+
Requires-Dist: mypy==1.13.0; extra == 'dev'
|
|
49
|
+
Requires-Dist: pre-commit==4.0.1; extra == 'dev'
|
|
50
|
+
Requires-Dist: pydocstyle==6.3.0; extra == 'dev'
|
|
51
|
+
Requires-Dist: pylint==3.3.1; extra == 'dev'
|
|
52
|
+
Requires-Dist: python-dotenv==1.0.1; extra == 'dev'
|
|
53
|
+
Requires-Dist: ruff==0.7.1; extra == 'dev'
|
|
54
|
+
Requires-Dist: types-pyyaml==6.0.12; extra == 'dev'
|
|
55
|
+
Requires-Dist: yamllint==1.35.1; extra == 'dev'
|
|
56
|
+
Provides-Extra: docs
|
|
57
|
+
Requires-Dist: mdx-include==1.4.2; extra == 'docs'
|
|
58
|
+
Requires-Dist: mdx-truly-sane-lists==1.3; extra == 'docs'
|
|
59
|
+
Requires-Dist: mkdocs-jupyter==0.25.1; extra == 'docs'
|
|
60
|
+
Requires-Dist: mkdocs-macros-plugin==1.3.6; extra == 'docs'
|
|
61
|
+
Requires-Dist: mkdocs-material==9.5.42; extra == 'docs'
|
|
62
|
+
Requires-Dist: mkdocs-minify-html-plugin==0.2.3; extra == 'docs'
|
|
63
|
+
Requires-Dist: mkdocs==1.6.1; extra == 'docs'
|
|
64
|
+
Requires-Dist: mkdocstrings-python==1.12.2; extra == 'docs'
|
|
65
|
+
Requires-Dist: mkdocstrings[crystal,python]==0.26.2; extra == 'docs'
|
|
66
|
+
Provides-Extra: test
|
|
67
|
+
Requires-Dist: pytest-cov==5.0.0; extra == 'test'
|
|
68
|
+
Requires-Dist: pytest-html==4.1.1; extra == 'test'
|
|
69
|
+
Requires-Dist: pytest-sugar==1.0.0; extra == 'test'
|
|
70
|
+
Requires-Dist: pytest-timeout==2.3.1; extra == 'test'
|
|
71
|
+
Requires-Dist: pytest-xdist==3.6.1; extra == 'test'
|
|
72
|
+
Requires-Dist: pytest==8.3.3; extra == 'test'
|
|
73
|
+
Description-Content-Type: text/markdown
|
|
74
|
+
|
|
75
|
+
# Waldiez
|
|
76
|
+
|
|
77
|
+
 [](https://coveralls.io/github/waldiez/py)
|
|
78
|
+
|
|
79
|
+
Translate a Waldiez flow:
|
|
80
|
+
|
|
81
|
+
[](./docs/flow.png)
|
|
82
|
+
|
|
83
|
+
To a python script or a jupyter notebook with the corresponding [autogen](https://github.com/microsoft/autogen/) agents and chats.
|
|
84
|
+
|
|
85
|
+
## Features
|
|
86
|
+
|
|
87
|
+
- Export .waldiez flows to .py or .ipynb
|
|
88
|
+
- Run a .waldiez flow
|
|
89
|
+
- Include a `logs` folder with the logs of the flow in csv format
|
|
90
|
+
- Provide a custom [IOSStream](https://autogen-ai.github.io/autogen/docs/reference/io/base#iostream) to handle input and output.
|
|
91
|
+
|
|
92
|
+
## Installation
|
|
93
|
+
|
|
94
|
+
<!--
|
|
95
|
+
On PyPI:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
python -m pip install waldiez
|
|
99
|
+
``` -->
|
|
100
|
+
|
|
101
|
+
From this repository:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
python -m pip install git+https://github.com/waldiez/py.git
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Usage
|
|
108
|
+
|
|
109
|
+
### CLI
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Export a Waldiez flow to a python script or a jupyter notebook
|
|
113
|
+
waldiez --export /path/to/a/flow.waldiez --output /path/to/an/output[.py|.ipynb]
|
|
114
|
+
# Export and run the script, optionally force generation if the output file already exists
|
|
115
|
+
waldiez /path/to/a/flow.waldiez --output /path/to/an/output[.py] [--force]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### As a library
|
|
119
|
+
|
|
120
|
+
#### Export a flow
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
# Export a Waldiez flow to a python script or a jupyter notebook
|
|
124
|
+
from waldiez import WaldiezExporter
|
|
125
|
+
flow_path = "/path/to/a/flow.waldiez"
|
|
126
|
+
output_path = "/path/to/an/output.py" # or .ipynb
|
|
127
|
+
exporter = WaldiezExporter.load(flow_path)
|
|
128
|
+
exporter.export(output_path)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### Run a flow
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
# Run a flow
|
|
135
|
+
from waldiez import WaldiezRunner
|
|
136
|
+
flow_path = "/path/to/a/flow.waldiez"
|
|
137
|
+
output_path = "/path/to/an/output.py"
|
|
138
|
+
runner = WaldiezRunner.load(flow_path)
|
|
139
|
+
runner.run(output_path=output_path)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Run a flow with a custom IOStream
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
# Run the flow with a custom IOStream
|
|
146
|
+
from waldiez import WaldiezIOStream, WaldiezRunner
|
|
147
|
+
|
|
148
|
+
flow_path = "/path/to/a/flow.waldiez"
|
|
149
|
+
output_path = "/path/to/an/output.py"
|
|
150
|
+
|
|
151
|
+
def print_function(*values, **args) -> None:
|
|
152
|
+
"""A custom print function."""
|
|
153
|
+
print(values)
|
|
154
|
+
|
|
155
|
+
def on_prompt_input(prompt: str) -> str:
|
|
156
|
+
"""A custom input function."""
|
|
157
|
+
return input(prompt)
|
|
158
|
+
|
|
159
|
+
io_stream = WaldiezIOStream(
|
|
160
|
+
print_function=print_function,
|
|
161
|
+
on_prompt_input=on_prompt_input,
|
|
162
|
+
input_timeout=30,
|
|
163
|
+
)
|
|
164
|
+
with WaldiezIOStream.set_default(io_stream):
|
|
165
|
+
runner = WaldiezRunner.load(flow_path)
|
|
166
|
+
runner.run(stream=io_stream, output_path=output_path)
|
|
167
|
+
|
|
168
|
+
io_stream.close()
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Tools
|
|
173
|
+
|
|
174
|
+
- [autogen](https://github.com/microsoft/autogen/)
|
|
175
|
+
- [juptytext](https://github.com/mwouts/jupytext)
|
|
176
|
+
- [twisted](https://github.com/twisted/twisted)
|
|
177
|
+
- [pydantic](https://github.com/pydantic/pydantic)
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
waldiez-0.1.0/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Waldiez
|
|
2
|
+
|
|
3
|
+
 [](https://coveralls.io/github/waldiez/py)
|
|
4
|
+
|
|
5
|
+
Translate a Waldiez flow:
|
|
6
|
+
|
|
7
|
+
[](./docs/flow.png)
|
|
8
|
+
|
|
9
|
+
To a python script or a jupyter notebook with the corresponding [autogen](https://github.com/microsoft/autogen/) agents and chats.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Export .waldiez flows to .py or .ipynb
|
|
14
|
+
- Run a .waldiez flow
|
|
15
|
+
- Include a `logs` folder with the logs of the flow in csv format
|
|
16
|
+
- Provide a custom [IOSStream](https://autogen-ai.github.io/autogen/docs/reference/io/base#iostream) to handle input and output.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
<!--
|
|
21
|
+
On PyPI:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
python -m pip install waldiez
|
|
25
|
+
``` -->
|
|
26
|
+
|
|
27
|
+
From this repository:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
python -m pip install git+https://github.com/waldiez/py.git
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### CLI
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Export a Waldiez flow to a python script or a jupyter notebook
|
|
39
|
+
waldiez --export /path/to/a/flow.waldiez --output /path/to/an/output[.py|.ipynb]
|
|
40
|
+
# Export and run the script, optionally force generation if the output file already exists
|
|
41
|
+
waldiez /path/to/a/flow.waldiez --output /path/to/an/output[.py] [--force]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### As a library
|
|
45
|
+
|
|
46
|
+
#### Export a flow
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
# Export a Waldiez flow to a python script or a jupyter notebook
|
|
50
|
+
from waldiez import WaldiezExporter
|
|
51
|
+
flow_path = "/path/to/a/flow.waldiez"
|
|
52
|
+
output_path = "/path/to/an/output.py" # or .ipynb
|
|
53
|
+
exporter = WaldiezExporter.load(flow_path)
|
|
54
|
+
exporter.export(output_path)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Run a flow
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
# Run a flow
|
|
61
|
+
from waldiez import WaldiezRunner
|
|
62
|
+
flow_path = "/path/to/a/flow.waldiez"
|
|
63
|
+
output_path = "/path/to/an/output.py"
|
|
64
|
+
runner = WaldiezRunner.load(flow_path)
|
|
65
|
+
runner.run(output_path=output_path)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### Run a flow with a custom IOStream
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
# Run the flow with a custom IOStream
|
|
72
|
+
from waldiez import WaldiezIOStream, WaldiezRunner
|
|
73
|
+
|
|
74
|
+
flow_path = "/path/to/a/flow.waldiez"
|
|
75
|
+
output_path = "/path/to/an/output.py"
|
|
76
|
+
|
|
77
|
+
def print_function(*values, **args) -> None:
|
|
78
|
+
"""A custom print function."""
|
|
79
|
+
print(values)
|
|
80
|
+
|
|
81
|
+
def on_prompt_input(prompt: str) -> str:
|
|
82
|
+
"""A custom input function."""
|
|
83
|
+
return input(prompt)
|
|
84
|
+
|
|
85
|
+
io_stream = WaldiezIOStream(
|
|
86
|
+
print_function=print_function,
|
|
87
|
+
on_prompt_input=on_prompt_input,
|
|
88
|
+
input_timeout=30,
|
|
89
|
+
)
|
|
90
|
+
with WaldiezIOStream.set_default(io_stream):
|
|
91
|
+
runner = WaldiezRunner.load(flow_path)
|
|
92
|
+
runner.run(stream=io_stream, output_path=output_path)
|
|
93
|
+
|
|
94
|
+
io_stream.close()
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Tools
|
|
99
|
+
|
|
100
|
+
- [autogen](https://github.com/microsoft/autogen/)
|
|
101
|
+
- [juptytext](https://github.com/mwouts/jupytext)
|
|
102
|
+
- [twisted](https://github.com/twisted/twisted)
|
|
103
|
+
- [pydantic](https://github.com/pydantic/pydantic)
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "waldiez"
|
|
3
|
+
description = 'waldiez'
|
|
4
|
+
authors = [
|
|
5
|
+
{ name = 'Panagiotis Kasnesis', email = 'pkasnesis@thingenious.io' },
|
|
6
|
+
{ name= 'Lazaros Toumanidis', email= 'laztoum@protonmail.com' },
|
|
7
|
+
]
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = '>=3.10,<3.13'
|
|
10
|
+
dynamic = ["version"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Programming Language :: Python",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Intended Audience :: Science/Research",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"jupytext",
|
|
25
|
+
"autogen-agentchat==0.2.37",
|
|
26
|
+
"twisted==24.7.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
homepage = 'https://waldiez.github.io/py/'
|
|
31
|
+
repository = 'https://github.com/waldiez/py.git'
|
|
32
|
+
|
|
33
|
+
[tool.hatch.build.targets.sdist]
|
|
34
|
+
packages = ["waldiez", "waldiez.*"]
|
|
35
|
+
exclude = [ "**/example.py", ".gitignore" ]
|
|
36
|
+
|
|
37
|
+
[tool.hatch.build.targets.wheel]
|
|
38
|
+
packages = ["waldiez", "waldiez.*"]
|
|
39
|
+
exclude = [ "**/example.py" ]
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
dev = [
|
|
43
|
+
'autoflake==2.3.1',
|
|
44
|
+
'bandit==1.7.10',
|
|
45
|
+
'black[jupyter]==24.10.0',
|
|
46
|
+
'flake8==7.1.1',
|
|
47
|
+
'isort==5.13.2',
|
|
48
|
+
'mypy==1.13.0',
|
|
49
|
+
'pre-commit==4.0.1',
|
|
50
|
+
'pydocstyle==6.3.0',
|
|
51
|
+
'pylint==3.3.1',
|
|
52
|
+
'python-dotenv==1.0.1',
|
|
53
|
+
'ruff==0.7.1',
|
|
54
|
+
'types-PyYAML==6.0.12',
|
|
55
|
+
'yamllint==1.35.1',
|
|
56
|
+
]
|
|
57
|
+
autogen_extras =[
|
|
58
|
+
'chromadb==0.5.15',
|
|
59
|
+
'fastembed==0.4.1',
|
|
60
|
+
'pgvector==0.3.5',
|
|
61
|
+
'psycopg[binary]>=3.2.3',
|
|
62
|
+
'autogen-agentchat[retrievechat]==0.2.37',
|
|
63
|
+
'autogen-agentchat[retrievechat-pgvector]==0.2.37',
|
|
64
|
+
'autogen-agentchat[retrievechat-mongodb]==0.2.37',
|
|
65
|
+
'autogen-agentchat[retrievechat-qdrant]==0.2.37',
|
|
66
|
+
'autogen-agentchat[retrievechat-couchbase]==0.2.37',
|
|
67
|
+
'autogen-agentchat[gemini]==0.2.37',
|
|
68
|
+
'autogen-agentchat[together]==0.2.37',
|
|
69
|
+
'autogen-agentchat[anthropic]==0.2.37',
|
|
70
|
+
'autogen-agentchat[mistral]==0.2.37',
|
|
71
|
+
'autogen-agentchat[groq]==0.2.37',
|
|
72
|
+
'autogen-agentchat[bedrock]==0.2.37',
|
|
73
|
+
'autogen-agentchat[websurfer]==0.2.37',
|
|
74
|
+
'pymongo==4.10.1',
|
|
75
|
+
'qdrant-client==1.12.0',
|
|
76
|
+
]
|
|
77
|
+
test = [
|
|
78
|
+
'pytest==8.3.3',
|
|
79
|
+
'pytest-cov==5.0.0',
|
|
80
|
+
'pytest-html==4.1.1',
|
|
81
|
+
'pytest-sugar==1.0.0',
|
|
82
|
+
'pytest-timeout==2.3.1',
|
|
83
|
+
'pytest-xdist==3.6.1',
|
|
84
|
+
]
|
|
85
|
+
docs = [
|
|
86
|
+
'mdx-include==1.4.2',
|
|
87
|
+
'mdx_truly_sane_lists==1.3',
|
|
88
|
+
'mkdocs==1.6.1',
|
|
89
|
+
'mkdocs-jupyter==0.25.1',
|
|
90
|
+
'mkdocs-macros-plugin==1.3.6',
|
|
91
|
+
'mkdocs-material==9.5.42',
|
|
92
|
+
'mkdocs-minify-html-plugin==0.2.3',
|
|
93
|
+
'mkdocstrings[crystal,python]==0.26.2',
|
|
94
|
+
'mkdocstrings-python==1.12.2'
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
[project.scripts]
|
|
98
|
+
waldiez = 'waldiez.cli:main'
|
|
99
|
+
|
|
100
|
+
[build-system]
|
|
101
|
+
requires = ["hatchling"]
|
|
102
|
+
build-backend = "hatchling.build"
|
|
103
|
+
[tool.hatch.version]
|
|
104
|
+
path = "waldiez/_version.py"
|
|
105
|
+
# black
|
|
106
|
+
[tool.black]
|
|
107
|
+
line-length = 80
|
|
108
|
+
skip-string-normalization=true
|
|
109
|
+
include = '''
|
|
110
|
+
\.pyi?$
|
|
111
|
+
'''
|
|
112
|
+
exclude = '''
|
|
113
|
+
/(
|
|
114
|
+
\.git
|
|
115
|
+
| \.hg
|
|
116
|
+
| \.mypy_cache
|
|
117
|
+
| \.tox
|
|
118
|
+
| \.venv
|
|
119
|
+
| .local
|
|
120
|
+
| _build
|
|
121
|
+
| __init__.py
|
|
122
|
+
| .local
|
|
123
|
+
| examples
|
|
124
|
+
)/
|
|
125
|
+
'''
|
|
126
|
+
|
|
127
|
+
# mypy
|
|
128
|
+
[tool.mypy]
|
|
129
|
+
files = '.'
|
|
130
|
+
show_error_codes = true
|
|
131
|
+
# xcode/dmypy: follow-imports=silent not supported
|
|
132
|
+
# follow_imports = 'skip'
|
|
133
|
+
platform = 'linux'
|
|
134
|
+
check_untyped_defs = true
|
|
135
|
+
disallow_any_generics = true
|
|
136
|
+
disallow_incomplete_defs = true
|
|
137
|
+
disallow_subclassing_any = false
|
|
138
|
+
disallow_untyped_calls = true
|
|
139
|
+
disallow_untyped_decorators = true
|
|
140
|
+
disallow_untyped_defs = true
|
|
141
|
+
ignore_missing_imports = false
|
|
142
|
+
no_implicit_reexport = true
|
|
143
|
+
strict_optional = true
|
|
144
|
+
warn_redundant_casts = true
|
|
145
|
+
warn_unused_configs = true
|
|
146
|
+
warn_unused_ignores = true
|
|
147
|
+
plugins = [
|
|
148
|
+
'pydantic.mypy'
|
|
149
|
+
]
|
|
150
|
+
# 'mypy_zope:plugin'
|
|
151
|
+
# ]
|
|
152
|
+
exclude = [
|
|
153
|
+
'.venv',
|
|
154
|
+
'.local',
|
|
155
|
+
'examples',
|
|
156
|
+
]
|
|
157
|
+
|
|
158
|
+
[tool.pydantic-mypy]
|
|
159
|
+
init_forbid_extra = true
|
|
160
|
+
init_typed = true
|
|
161
|
+
warn_required_dynamic_aliases = true
|
|
162
|
+
|
|
163
|
+
# isort
|
|
164
|
+
[tool.isort]
|
|
165
|
+
profile ='black'
|
|
166
|
+
skip=[
|
|
167
|
+
'.venv',
|
|
168
|
+
'.local',
|
|
169
|
+
'examples',
|
|
170
|
+
]
|
|
171
|
+
include_trailing_comma=true
|
|
172
|
+
force_grid_wrap=0
|
|
173
|
+
use_parentheses=true
|
|
174
|
+
line_length=80
|
|
175
|
+
|
|
176
|
+
# pydocstyle
|
|
177
|
+
[tool.pydocstyle]
|
|
178
|
+
match-dir='([^!(.venv)].*)([^!(.local)].*)([^!(examples)].*)'
|
|
179
|
+
|
|
180
|
+
# pylint
|
|
181
|
+
[tool.pylint.master]
|
|
182
|
+
load-plugins = [
|
|
183
|
+
'pylint.extensions.mccabe',
|
|
184
|
+
'pylint.extensions.redefined_variable_type',
|
|
185
|
+
'pylint.extensions.broad_try_clause',
|
|
186
|
+
'pylint.extensions.no_self_use',
|
|
187
|
+
'pylint.extensions.docparams',
|
|
188
|
+
]
|
|
189
|
+
extension-pkg-whitelist= []
|
|
190
|
+
# reports=true
|
|
191
|
+
recursive=true
|
|
192
|
+
fail-under=8.0
|
|
193
|
+
ignore=["CVS"]
|
|
194
|
+
ignore-paths = [
|
|
195
|
+
".venv",
|
|
196
|
+
".local*",
|
|
197
|
+
"examples",
|
|
198
|
+
]
|
|
199
|
+
|
|
200
|
+
unsafe-load-any-extension="no"
|
|
201
|
+
|
|
202
|
+
[tool.pylint.messages_control]
|
|
203
|
+
enable=["c-extension-no-member"]
|
|
204
|
+
[tool.pylint.fotmat]
|
|
205
|
+
max-line-length=80
|
|
206
|
+
[tool.pylint.similarities]
|
|
207
|
+
ignore-imports="yes"
|
|
208
|
+
ignore-signatures="yes"
|
|
209
|
+
min-similarity-lines=10
|
|
210
|
+
[tool.pylint.broad_try_clause]
|
|
211
|
+
max-try-statements=3
|
|
212
|
+
[tool.pylint.design]
|
|
213
|
+
max-args=10
|
|
214
|
+
max-attributes=10
|
|
215
|
+
max-positional-arguments=10
|
|
216
|
+
[tool.pylint.string]
|
|
217
|
+
check-quote-consistency = true
|
|
218
|
+
check-str-concat-over-line-jumps = true
|
|
219
|
+
[tool.pylint.parameter_documentation]
|
|
220
|
+
accept-no-param-doc=false
|
|
221
|
+
accept-no-raise-doc=false
|
|
222
|
+
accept-no-return-doc=false
|
|
223
|
+
accept-no-yields-doc=false
|
|
224
|
+
# Possible choices: ['sphinx', 'epytext', 'google', 'numpy', 'default']
|
|
225
|
+
default-docstring-type = "numpy"
|
|
226
|
+
|
|
227
|
+
# bandit
|
|
228
|
+
[tool.bandit]
|
|
229
|
+
exclude_dirs = [
|
|
230
|
+
".venv",
|
|
231
|
+
".local",
|
|
232
|
+
"examples"
|
|
233
|
+
]
|
|
234
|
+
# B104: bind to all interfaces (0.0.0.0)
|
|
235
|
+
# B110: allow pass on try/except
|
|
236
|
+
# B404: allow import subprocess
|
|
237
|
+
# B602, B603: allow shell=True (subprocess,popen)
|
|
238
|
+
skips = ['B104', 'B110', 'B404', 'B602', 'B603' ]
|
|
239
|
+
[tool.bandit.assert_used]
|
|
240
|
+
skips = ['*_test.py', '*/test_*.py']
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
# ruff
|
|
244
|
+
[tool.ruff]
|
|
245
|
+
line-length = 80
|
|
246
|
+
extend-exclude = [
|
|
247
|
+
".venv",
|
|
248
|
+
".local",
|
|
249
|
+
"examples",
|
|
250
|
+
]
|
|
251
|
+
|
|
252
|
+
[tool.ruff.lint]
|
|
253
|
+
select = ["E4", "E7", "E9", "F", "Q"]
|
|
254
|
+
ignore = []
|
|
255
|
+
# # Allow fix for all enabled rules (when `--fix`) is provided.
|
|
256
|
+
fixable = ["ALL"]
|
|
257
|
+
unfixable = []
|
|
258
|
+
|
|
259
|
+
# # Allow unused variables when underscore-prefixed.
|
|
260
|
+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
261
|
+
|
|
262
|
+
[tool.ruff.format]
|
|
263
|
+
# exclude = ["*.pyi", "*.j2"]
|
|
264
|
+
# Like Black, use double quotes for strings.
|
|
265
|
+
quote-style = "double"
|
|
266
|
+
# Like Black, indent with spaces, rather than tabs.
|
|
267
|
+
indent-style = "space"
|
|
268
|
+
# Like Black, respect magic trailing commas.
|
|
269
|
+
skip-magic-trailing-comma = false
|
|
270
|
+
line-ending = "lf"
|
|
271
|
+
|
|
272
|
+
# pytest
|
|
273
|
+
[tool.pytest.ini_options]
|
|
274
|
+
# filterwarnings = []
|
|
275
|
+
python_files = [
|
|
276
|
+
"tests.py",
|
|
277
|
+
"test_*.py",
|
|
278
|
+
"*_tests.py",
|
|
279
|
+
]
|
|
280
|
+
addopts = """
|
|
281
|
+
-d \
|
|
282
|
+
-n auto \
|
|
283
|
+
--exitfirst \
|
|
284
|
+
--durations=10 \
|
|
285
|
+
--color=yes \
|
|
286
|
+
--timeout=30
|
|
287
|
+
"""
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
# coverage
|
|
291
|
+
[tool.coverage.run]
|
|
292
|
+
omit = [
|
|
293
|
+
"example.py",
|
|
294
|
+
]
|
|
295
|
+
[tool.coverage.report]
|
|
296
|
+
exclude_lines = [
|
|
297
|
+
"pragma: no cover",
|
|
298
|
+
"if TYPE_CHECKING:",
|
|
299
|
+
"if __name__ == .__main__.:",
|
|
300
|
+
]
|
|
301
|
+
fail_under = 80
|
|
302
|
+
precision = 2
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Waldiez package."""
|
|
2
|
+
|
|
3
|
+
from ._version import __version__
|
|
4
|
+
from .exporter import WaldiezExporter
|
|
5
|
+
from .io_stream import WaldiezIOStream
|
|
6
|
+
from .models import Waldiez
|
|
7
|
+
from .runner import WaldiezRunner
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"Waldiez",
|
|
11
|
+
"WaldiezExporter",
|
|
12
|
+
"WaldiezIOStream",
|
|
13
|
+
"WaldiezRunner",
|
|
14
|
+
"__version__",
|
|
15
|
+
]
|