waldiez 0.1.15__tar.gz → 0.1.17__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.15 → waldiez-0.1.17}/PKG-INFO +18 -18
  2. {waldiez-0.1.15 → waldiez-0.1.17}/README.md +195 -195
  3. {waldiez-0.1.15 → waldiez-0.1.17}/pyproject.toml +30 -18
  4. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/_version.py +1 -1
  5. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/conflict_checker.py +6 -3
  6. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/flow/def_main.py +1 -6
  7. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/flow/flow.py +2 -3
  8. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/flow/flow.py +15 -1
  9. {waldiez-0.1.15 → waldiez-0.1.17}/.gitignore +0 -0
  10. {waldiez-0.1.15 → waldiez-0.1.17}/LICENSE +0 -0
  11. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/__init__.py +0 -0
  12. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/__main__.py +0 -0
  13. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/cli.py +0 -0
  14. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporter.py +0 -0
  15. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/__init__.py +0 -0
  16. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/__init__.py +0 -0
  17. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/agent.py +0 -0
  18. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/agent_skills.py +0 -0
  19. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/code_execution.py +0 -0
  20. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/group_manager.py +0 -0
  21. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/llm_config.py +0 -0
  22. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/rag_user/__init__.py +0 -0
  23. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/rag_user/chroma_utils.py +0 -0
  24. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/rag_user/mongo_utils.py +0 -0
  25. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/rag_user/pgvector_utils.py +0 -0
  26. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/rag_user/qdrant_utils.py +0 -0
  27. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/rag_user/rag_user.py +0 -0
  28. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/rag_user/vector_db.py +0 -0
  29. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/teachability.py +0 -0
  30. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/agents/termination_message.py +0 -0
  31. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/chats/__init__.py +0 -0
  32. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/chats/chats.py +0 -0
  33. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/chats/helpers.py +0 -0
  34. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/chats/nested.py +0 -0
  35. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/flow/__init__.py +0 -0
  36. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/models/__init__.py +0 -0
  37. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/skills/__init__.py +0 -0
  38. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/utils/__init__.py +0 -0
  39. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/utils/comments.py +0 -0
  40. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/utils/importing.py +0 -0
  41. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/utils/logging_utils.py +0 -0
  42. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/utils/method_utils.py +0 -0
  43. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/utils/naming.py +0 -0
  44. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/utils/object_string.py +0 -0
  45. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/exporting/utils/path_check.py +0 -0
  46. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/io/__init__.py +0 -0
  47. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/__init__.py +0 -0
  48. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/__init__.py +0 -0
  49. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/agent/__init__.py +0 -0
  50. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/agent/agent.py +0 -0
  51. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/agent/agent_data.py +0 -0
  52. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/agent/code_execution.py +0 -0
  53. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/agent/linked_skill.py +0 -0
  54. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/agent/nested_chat.py +0 -0
  55. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/agent/teachability.py +0 -0
  56. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/agent/termination_message.py +0 -0
  57. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/agents.py +0 -0
  58. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/assistant/__init__.py +0 -0
  59. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/assistant/assistant.py +0 -0
  60. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/assistant/assistant_data.py +0 -0
  61. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/group_manager/__init__.py +0 -0
  62. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/group_manager/group_manager.py +0 -0
  63. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/group_manager/group_manager_data.py +0 -0
  64. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/group_manager/speakers.py +0 -0
  65. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/rag_user/__init__.py +0 -0
  66. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/rag_user/rag_user.py +0 -0
  67. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/rag_user/rag_user_data.py +0 -0
  68. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/rag_user/retrieve_config.py +0 -0
  69. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/rag_user/vector_db_config.py +0 -0
  70. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/user_proxy/__init__.py +0 -0
  71. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/user_proxy/user_proxy.py +0 -0
  72. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/agents/user_proxy/user_proxy_data.py +0 -0
  73. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/chat/__init__.py +0 -0
  74. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/chat/chat.py +0 -0
  75. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/chat/chat_data.py +0 -0
  76. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/chat/chat_message.py +0 -0
  77. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/chat/chat_nested.py +0 -0
  78. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/chat/chat_summary.py +0 -0
  79. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/common/__init__.py +0 -0
  80. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/common/base.py +0 -0
  81. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/common/method_utils.py +0 -0
  82. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/flow/__init__.py +0 -0
  83. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/flow/flow_data.py +0 -0
  84. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/model/__init__.py +0 -0
  85. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/model/model.py +0 -0
  86. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/model/model_data.py +0 -0
  87. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/skill/__init__.py +0 -0
  88. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/skill/skill.py +0 -0
  89. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/skill/skill_data.py +0 -0
  90. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/models/waldiez.py +0 -0
  91. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/py.typed +0 -0
  92. {waldiez-0.1.15 → waldiez-0.1.17}/waldiez/runner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: waldiez
3
- Version: 0.1.15
3
+ Version: 0.1.17
4
4
  Summary: waldiez
5
5
  Project-URL: homepage, https://waldiez.github.io/waldiez/
6
6
  Project-URL: repository, https://github.com/waldiez/waldiez.git
@@ -17,26 +17,26 @@ Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Requires-Python: <3.13,>=3.10
19
19
  Requires-Dist: jupytext
20
- Requires-Dist: pyautogen==0.5.0
20
+ Requires-Dist: pyautogen==0.5.3
21
21
  Requires-Dist: pydantic>=2.0
22
22
  Requires-Dist: typer<0.13,>=0.9
23
23
  Provides-Extra: ag2-extras
24
- Requires-Dist: fastembed==0.4.2; extra == 'ag2-extras'
25
24
  Requires-Dist: pgvector>=0.3.6; extra == 'ag2-extras'
26
25
  Requires-Dist: psycopg[binary]>=3.2.3; extra == 'ag2-extras'
27
- Requires-Dist: pyautogen[anthropic]==0.5.0; extra == 'ag2-extras'
28
- Requires-Dist: pyautogen[bedrock]==0.5.0; extra == 'ag2-extras'
29
- Requires-Dist: pyautogen[captainagent]==0.5.0; extra == 'ag2-extras'
30
- Requires-Dist: pyautogen[gemini]==0.5.0; extra == 'ag2-extras'
31
- Requires-Dist: pyautogen[groq]==0.5.0; extra == 'ag2-extras'
32
- Requires-Dist: pyautogen[lmm]==0.5.0; extra == 'ag2-extras'
33
- Requires-Dist: pyautogen[mistral]==0.5.0; extra == 'ag2-extras'
34
- Requires-Dist: pyautogen[retrievechat-mongodb]==0.5.0; extra == 'ag2-extras'
35
- Requires-Dist: pyautogen[retrievechat-pgvector]==0.5.0; extra == 'ag2-extras'
36
- Requires-Dist: pyautogen[retrievechat-qdrant]==0.5.0; (python_version < '3.13') and extra == 'ag2-extras'
37
- Requires-Dist: pyautogen[retrievechat]==0.5.0; extra == 'ag2-extras'
38
- Requires-Dist: pyautogen[together]==0.5.0; extra == 'ag2-extras'
39
- Requires-Dist: pyautogen[websurfer]==0.5.0; extra == 'ag2-extras'
26
+ Requires-Dist: pyautogen[anthropic]==0.5.3; extra == 'ag2-extras'
27
+ Requires-Dist: pyautogen[bedrock]==0.5.3; extra == 'ag2-extras'
28
+ Requires-Dist: pyautogen[captainagent]==0.5.3; extra == 'ag2-extras'
29
+ Requires-Dist: pyautogen[gemini]==0.5.3; extra == 'ag2-extras'
30
+ Requires-Dist: pyautogen[groq]==0.5.3; extra == 'ag2-extras'
31
+ Requires-Dist: pyautogen[lmm]==0.5.3; extra == 'ag2-extras'
32
+ Requires-Dist: pyautogen[mistral]==0.5.3; extra == 'ag2-extras'
33
+ Requires-Dist: pyautogen[neo4j]==0.5.3; extra == 'ag2-extras'
34
+ Requires-Dist: pyautogen[retrievechat-mongodb]==0.5.3; extra == 'ag2-extras'
35
+ Requires-Dist: pyautogen[retrievechat-pgvector]==0.5.3; extra == 'ag2-extras'
36
+ Requires-Dist: pyautogen[retrievechat-qdrant]==0.5.3; (python_version < '3.13') and extra == 'ag2-extras'
37
+ Requires-Dist: pyautogen[retrievechat]==0.5.3; extra == 'ag2-extras'
38
+ Requires-Dist: pyautogen[together]==0.5.3; extra == 'ag2-extras'
39
+ Requires-Dist: pyautogen[websurfer]==0.5.3; extra == 'ag2-extras'
40
40
  Requires-Dist: pymongo==4.10.1; extra == 'ag2-extras'
41
41
  Requires-Dist: qdrant-client[fastembed]; (python_version >= '3.13') and extra == 'ag2-extras'
42
42
  Provides-Extra: dev
@@ -50,7 +50,7 @@ Requires-Dist: pre-commit==4.0.1; extra == 'dev'
50
50
  Requires-Dist: pydocstyle==6.3.0; extra == 'dev'
51
51
  Requires-Dist: pylint==3.3.2; extra == 'dev'
52
52
  Requires-Dist: python-dotenv==1.0.1; extra == 'dev'
53
- Requires-Dist: ruff==0.8.2; extra == 'dev'
53
+ Requires-Dist: ruff==0.8.3; extra == 'dev'
54
54
  Requires-Dist: toml; (python_version <= '3.10') and extra == 'dev'
55
55
  Requires-Dist: types-pyyaml==6.0.12.20240917; extra == 'dev'
56
56
  Requires-Dist: types-toml==0.10.8.20240310; extra == 'dev'
@@ -60,7 +60,7 @@ Requires-Dist: mdx-include==1.4.2; extra == 'docs'
60
60
  Requires-Dist: mdx-truly-sane-lists==1.3; extra == 'docs'
61
61
  Requires-Dist: mkdocs-jupyter==0.25.1; extra == 'docs'
62
62
  Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == 'docs'
63
- Requires-Dist: mkdocs-material==9.5.47; extra == 'docs'
63
+ Requires-Dist: mkdocs-material==9.5.48; extra == 'docs'
64
64
  Requires-Dist: mkdocs-minify-html-plugin==0.2.3; extra == 'docs'
65
65
  Requires-Dist: mkdocs==1.6.1; extra == 'docs'
66
66
  Requires-Dist: mkdocstrings-python==1.12.2; extra == 'docs'
@@ -1,195 +1,195 @@
1
- # Waldiez
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)
4
-
5
- Translate a Waldiez flow:
6
-
7
- ![Flow](https://raw.githubusercontent.com/waldiez/waldiez/refs/heads/main/docs/static/images/overview.webp)
8
-
9
- To a python script or a jupyter notebook with the corresponding [ag2](https://github.com/ag2ai/ag2/) agents and chats.
10
-
11
- ## Features
12
-
13
- - Convert .waldiez flows to .py or .ipynb
14
- - Run a .waldiez flow
15
- - Provide a custom [IOSStream](https://ag2ai.github.io/ag2/docs/reference/io/base#iostream) to handle input and output.
16
-
17
- ## Installation
18
-
19
- On PyPI:
20
-
21
- ```bash
22
- python -m pip install waldiez
23
- ```
24
-
25
- From the repository:
26
-
27
- ```bash
28
- python -m pip install git+https://github.com/waldiez/waldiez.git
29
- ```
30
-
31
- ## Usage
32
-
33
- ### CLI
34
-
35
- ```bash
36
- # Convert a Waldiez flow to a python script or a jupyter notebook
37
- waldiez convert --file /path/to/a/flow.waldiez --output /path/to/an/output/flow[.py|.ipynb]
38
- # Convert and run the script, optionally force generation if the output file already exists
39
- waldiez run --file /path/to/a/flow.waldiez --output /path/to/an/output/flow[.py] [--force]
40
- ```
41
-
42
- ### Using docker/podman
43
-
44
- ```shell
45
- CONTAINER_COMMAND=docker # or podman
46
- # pull the image
47
- $CONTAINER_COMMAND pull waldiez/waldiez
48
- # Convert a Waldiez flow to a python script or a jupyter notebook
49
- $CONTAINER_COMMAND run \
50
- --rm \
51
- -v /path/to/a/flow.waldiez:/flow.waldiez \
52
- -v /path/to/an/output:/output \
53
- waldiez/waldiez convert --file /flow.waldiez --output /output/flow[.py|.ipynb] [--force]
54
-
55
- # with selinux and/or podman, you might get permission (or file not found) errors, so you can try:
56
- $CONTAINER_COMMAND run \
57
- --rm \
58
- -v /path/to/a/flow.waldiez:/flow.waldiez \
59
- -v /path/to/an/output:/output \
60
- --userns=keep-id \
61
- --security-opt label=disable \
62
- waldiez/waldiez convert --file /flow.waldiez --output /output/flow[.py|.ipynb] [--force]
63
- ```
64
-
65
- ```shell
66
- # Convert and run the script
67
- $CONTAINER_COMMAND run \
68
- --rm \
69
- -v /path/to/a/flow.waldiez:/flow.waldiez \
70
- -v /path/to/an/output:/output \
71
- waldiez/waldiez run --file /flow.waldiez --output /output/output[.py]
72
- ```
73
-
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
- ### As a library
82
-
83
- #### Export a flow
84
-
85
- ```python
86
- # Export a Waldiez flow to a python script or a jupyter notebook
87
- from waldiez import WaldiezExporter
88
- flow_path = "/path/to/a/flow.waldiez"
89
- output_path = "/path/to/an/output.py" # or .ipynb
90
- exporter = WaldiezExporter.load(flow_path)
91
- exporter.export(output_path)
92
- ```
93
-
94
- #### Run a flow
95
-
96
- ```python
97
- # Run a flow
98
- from waldiez import WaldiezRunner
99
- flow_path = "/path/to/a/flow.waldiez"
100
- output_path = "/path/to/an/output.py"
101
- runner = WaldiezRunner.load(flow_path)
102
- runner.run(output_path=output_path)
103
- ```
104
-
105
- #### Run a flow with a custom IOStream
106
-
107
- ```python
108
- # Run the flow with a custom IOStream
109
- # In case the standard 'input' and 'print' functions cannot be used
110
- import time
111
- import threading
112
-
113
- from typing import Any
114
-
115
- from waldiez import WaldiezRunner
116
- from waldiez.io import WaldiezIOStream
117
-
118
- flow_path = "/path/to/a/flow.waldiez"
119
- output_path = "/path/to/an/output.py"
120
-
121
-
122
- def custom_print_function(*args: Any, sep: str = " ", **kwargs: Any) -> None:
123
- """Custom print function."""
124
- print(*args, sep=sep, **kwargs)
125
-
126
-
127
- # Custom input handler
128
- class InputProcessorWrapper:
129
- """Wrapper input processor.
130
-
131
- To manage the interaction between the custom input processor and IOStream.
132
- """
133
-
134
- def __init__(self):
135
- self.stream = None # Placeholder for the WaldiezIOStream instance
136
- self.lock = threading.Lock() # Ensure thread-safe operations
137
-
138
- def custom_input_processor(self, prompt: str) -> None:
139
- """Simulate external input and send it back to the IOStream."""
140
- def external_input_simulation():
141
- with self.lock: # Ensure thread-safe access
142
- time.sleep(2) # Simulate delay for network input
143
- if self.stream:
144
- self.stream.set_input("Simulated external input")
145
- else:
146
- raise RuntimeError("Stream reference not set!")
147
-
148
- threading.Thread(target=external_input_simulation, daemon=True).start()
149
-
150
- def set_stream(self, stream: "WaldiezIOStream"):
151
- """Set the WaldiezIOStream instance."""
152
- with self.lock: # Ensure thread-safe setting of the stream
153
- self.stream = stream
154
-
155
- processor_wrapper = InputProcessorWrapper()
156
-
157
- stream = WaldiezIOStream(
158
- input_timeout=30,
159
- print_function=
160
- on_prompt_input=processor_wrapper.custom_input_processor,
161
- )
162
-
163
- # Link the processor wrapper to the WaldiezIOStream instance
164
- processor_wrapper.set_stream(custom_stream)
165
-
166
- with WaldiezIOStream.set_default(io_stream):
167
- runner = WaldiezRunner.load(flow_path)
168
- runner.run(stream=io_stream, output_path=output_path)
169
-
170
- ```
171
-
172
- ### Tools
173
-
174
- - [ag2 (formerly AutoGen)](https://github.com/ag2ai/ag2)
175
- - [juptytext](https://github.com/mwouts/jupytext)
176
- - [pydantic](https://github.com/pydantic/pydantic)
177
- - [typer](https://github.com/fastapi/typer)
178
-
179
- ## Known Conflicts
180
-
181
- - **autogen-agentchat**: This package conflicts with `ag2` / `pyautogen`. Ensure that `autogen-agentchat` is uninstalled before installing `waldiez`. If you have already installed `autogen-agentchat`, you can uninstall it with the following command:
182
-
183
- ```shell
184
- pip uninstall autogen-agentchat -y
185
- ```
186
-
187
- If already installed waldiez you might need to reinstall it after uninstalling `autogen-agentchat`:
188
-
189
- ```shell
190
- pip install --force --no-cache waldiez pyautogen
191
- ```
192
-
193
- ## License
194
-
195
- This project is licensed under the MIT License - see the [LICENSE](https://github.com/waldiez/waldiez/blob/main/LICENSE) file for details.
1
+ # Waldiez
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)
4
+
5
+ Translate a Waldiez flow:
6
+
7
+ ![Flow](https://raw.githubusercontent.com/waldiez/waldiez/refs/heads/main/docs/static/images/overview.webp)
8
+
9
+ To a python script or a jupyter notebook with the corresponding [ag2](https://github.com/ag2ai/ag2/) agents and chats.
10
+
11
+ ## Features
12
+
13
+ - Convert .waldiez flows to .py or .ipynb
14
+ - Run a .waldiez flow
15
+ - Provide a custom [IOSStream](https://ag2ai.github.io/ag2/docs/reference/io/base#iostream) to handle input and output.
16
+
17
+ ## Installation
18
+
19
+ On PyPI:
20
+
21
+ ```bash
22
+ python -m pip install waldiez
23
+ ```
24
+
25
+ From the repository:
26
+
27
+ ```bash
28
+ python -m pip install git+https://github.com/waldiez/waldiez.git
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ### CLI
34
+
35
+ ```bash
36
+ # Convert a Waldiez flow to a python script or a jupyter notebook
37
+ waldiez convert --file /path/to/a/flow.waldiez --output /path/to/an/output/flow[.py|.ipynb]
38
+ # Convert and run the script, optionally force generation if the output file already exists
39
+ waldiez run --file /path/to/a/flow.waldiez --output /path/to/an/output/flow[.py] [--force]
40
+ ```
41
+
42
+ ### Using docker/podman
43
+
44
+ ```shell
45
+ CONTAINER_COMMAND=docker # or podman
46
+ # pull the image
47
+ $CONTAINER_COMMAND pull waldiez/waldiez
48
+ # Convert a Waldiez flow to a python script or a jupyter notebook
49
+ $CONTAINER_COMMAND run \
50
+ --rm \
51
+ -v /path/to/a/flow.waldiez:/flow.waldiez \
52
+ -v /path/to/an/output:/output \
53
+ waldiez/waldiez convert --file /flow.waldiez --output /output/flow[.py|.ipynb] [--force]
54
+
55
+ # with selinux and/or podman, you might get permission (or file not found) errors, so you can try:
56
+ $CONTAINER_COMMAND run \
57
+ --rm \
58
+ -v /path/to/a/flow.waldiez:/flow.waldiez \
59
+ -v /path/to/an/output:/output \
60
+ --userns=keep-id \
61
+ --security-opt label=disable \
62
+ waldiez/waldiez convert --file /flow.waldiez --output /output/flow[.py|.ipynb] [--force]
63
+ ```
64
+
65
+ ```shell
66
+ # Convert and run the script
67
+ $CONTAINER_COMMAND run \
68
+ --rm \
69
+ -v /path/to/a/flow.waldiez:/flow.waldiez \
70
+ -v /path/to/an/output:/output \
71
+ waldiez/waldiez run --file /flow.waldiez --output /output/output[.py]
72
+ ```
73
+
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
+ ### As a library
82
+
83
+ #### Export a flow
84
+
85
+ ```python
86
+ # Export a Waldiez flow to a python script or a jupyter notebook
87
+ from waldiez import WaldiezExporter
88
+ flow_path = "/path/to/a/flow.waldiez"
89
+ output_path = "/path/to/an/output.py" # or .ipynb
90
+ exporter = WaldiezExporter.load(flow_path)
91
+ exporter.export(output_path)
92
+ ```
93
+
94
+ #### Run a flow
95
+
96
+ ```python
97
+ # Run a flow
98
+ from waldiez import WaldiezRunner
99
+ flow_path = "/path/to/a/flow.waldiez"
100
+ output_path = "/path/to/an/output.py"
101
+ runner = WaldiezRunner.load(flow_path)
102
+ runner.run(output_path=output_path)
103
+ ```
104
+
105
+ #### Run a flow with a custom IOStream
106
+
107
+ ```python
108
+ # Run the flow with a custom IOStream
109
+ # In case the standard 'input' and 'print' functions cannot be used
110
+ import time
111
+ import threading
112
+
113
+ from typing import Any
114
+
115
+ from waldiez import WaldiezRunner
116
+ from waldiez.io import WaldiezIOStream
117
+
118
+ flow_path = "/path/to/a/flow.waldiez"
119
+ output_path = "/path/to/an/output.py"
120
+
121
+
122
+ def custom_print_function(*args: Any, sep: str = " ", **kwargs: Any) -> None:
123
+ """Custom print function."""
124
+ print(*args, sep=sep, **kwargs)
125
+
126
+
127
+ # Custom input handler
128
+ class InputProcessorWrapper:
129
+ """Wrapper input processor.
130
+
131
+ To manage the interaction between the custom input processor and IOStream.
132
+ """
133
+
134
+ def __init__(self):
135
+ self.stream = None # Placeholder for the WaldiezIOStream instance
136
+ self.lock = threading.Lock() # Ensure thread-safe operations
137
+
138
+ def custom_input_processor(self, prompt: str) -> None:
139
+ """Simulate external input and send it back to the IOStream."""
140
+ def external_input_simulation():
141
+ with self.lock: # Ensure thread-safe access
142
+ time.sleep(2) # Simulate delay for network input
143
+ if self.stream:
144
+ self.stream.set_input("Simulated external input")
145
+ else:
146
+ raise RuntimeError("Stream reference not set!")
147
+
148
+ threading.Thread(target=external_input_simulation, daemon=True).start()
149
+
150
+ def set_stream(self, stream: "WaldiezIOStream"):
151
+ """Set the WaldiezIOStream instance."""
152
+ with self.lock: # Ensure thread-safe setting of the stream
153
+ self.stream = stream
154
+
155
+ processor_wrapper = InputProcessorWrapper()
156
+
157
+ stream = WaldiezIOStream(
158
+ input_timeout=30,
159
+ print_function=
160
+ on_prompt_input=processor_wrapper.custom_input_processor,
161
+ )
162
+
163
+ # Link the processor wrapper to the WaldiezIOStream instance
164
+ processor_wrapper.set_stream(custom_stream)
165
+
166
+ with WaldiezIOStream.set_default(io_stream):
167
+ runner = WaldiezRunner.load(flow_path)
168
+ runner.run(stream=io_stream, output_path=output_path)
169
+
170
+ ```
171
+
172
+ ### Tools
173
+
174
+ - [ag2 (formerly AutoGen)](https://github.com/ag2ai/ag2)
175
+ - [juptytext](https://github.com/mwouts/jupytext)
176
+ - [pydantic](https://github.com/pydantic/pydantic)
177
+ - [typer](https://github.com/fastapi/typer)
178
+
179
+ ## Known Conflicts
180
+
181
+ - **autogen-agentchat**: This package conflicts with `ag2` / `pyautogen`. Ensure that `autogen-agentchat` is uninstalled before installing `waldiez`. If you have already installed `autogen-agentchat`, you can uninstall it with the following command:
182
+
183
+ ```shell
184
+ pip uninstall autogen-agentchat -y
185
+ ```
186
+
187
+ If already installed waldiez you might need to reinstall it after uninstalling `autogen-agentchat`:
188
+
189
+ ```shell
190
+ pip install --force --no-cache waldiez pyautogen
191
+ ```
192
+
193
+ ## License
194
+
195
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/waldiez/waldiez/blob/main/LICENSE) file for details.
@@ -22,7 +22,7 @@ classifiers = [
22
22
  "Intended Audience :: Developers",
23
23
  ]
24
24
  dependencies =[
25
- "pyautogen==0.5.0",
25
+ "pyautogen==0.5.3",
26
26
  "jupytext",
27
27
  "pydantic>=2.0",
28
28
  # together(ag2 extra) 1.2.0 depends on typer<0.13 and >=0.9
@@ -53,12 +53,14 @@ dev = [
53
53
  'pydocstyle==6.3.0',
54
54
  'pylint==3.3.2',
55
55
  'python-dotenv==1.0.1',
56
- 'ruff==0.8.2',
56
+ 'ruff==0.8.3',
57
57
  'types-PyYAML==6.0.12.20240917',
58
58
  'yamllint==1.35.1',
59
59
  'toml; python_version <= "3.10"',
60
60
  'types-toml== 0.10.8.20240310',
61
61
  ]
62
+ # let's stay with <3.13 for now
63
+ ####
62
64
  # fastembed and fastembed-gpu are not available, yet for python 3.13
63
65
  # ref: https://github.com/qdrant/qdrant-client/blob/master/pyproject.toml
64
66
  # fastembed = [
@@ -67,25 +69,35 @@ dev = [
67
69
  # fastembed-gpu = [
68
70
  # { version = "0.3.6", optional = true, python = "<3.13" }
69
71
  # ]
72
+ ####
73
+ # the pinned chromadb version (pyautogen[retrievechat]) (0.5.3)
74
+ # needs numpy <2.0.0
75
+ # but pyautogen wants numpy >=1.21.0 for python 3.13
76
+ #
77
+ # refs:
78
+ # https://github.com/chroma-core/chroma/blob/0.5.3/pyproject.toml#L24C3-L24C30
79
+ #
80
+ # https://github.com/ag2ai/ag2/blob/main/setup.py#L33
81
+ #
70
82
  ag2_extras =[
71
- 'fastembed==0.4.2',
72
83
  'pgvector>=0.3.6',
73
84
  'psycopg[binary]>=3.2.3',
74
- 'pyautogen[captainagent]==0.5.0',
75
- 'pyautogen[retrievechat]==0.5.0',
76
- 'pyautogen[retrievechat-pgvector]==0.5.0',
77
- 'pyautogen[retrievechat-mongodb]==0.5.0',
78
- 'pyautogen[retrievechat-qdrant]==0.5.0; python_version < "3.13"',
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"',
79
96
  'qdrant-client[fastembed]; python_version >= "3.13"',
80
- 'pyautogen[gemini]==0.5.0',
81
- 'pyautogen[together]==0.5.0',
82
- 'pyautogen[anthropic]==0.5.0',
83
- 'pyautogen[lmm]==0.5.0',
84
- 'pyautogen[mistral]==0.5.0',
85
- 'pyautogen[groq]==0.5.0',
86
- 'pyautogen[bedrock]==0.5.0',
87
- 'pyautogen[websurfer]==0.5.0',
88
- 'pyautogen[together]==0.5.0',
97
+ 'pyautogen[retrievechat]==0.5.3',
98
+ 'pyautogen[together]==0.5.3',
99
+ 'pyautogen[together]==0.5.3',
100
+ 'pyautogen[websurfer]==0.5.3',
89
101
  'pymongo==4.10.1',
90
102
  ]
91
103
  test = [
@@ -102,7 +114,7 @@ docs = [
102
114
  'mkdocs==1.6.1',
103
115
  'mkdocs-jupyter==0.25.1',
104
116
  'mkdocs-macros-plugin==1.3.7',
105
- 'mkdocs-material==9.5.47',
117
+ 'mkdocs-material==9.5.48',
106
118
  'mkdocs-minify-html-plugin==0.2.3',
107
119
  'mkdocstrings[crystal,python]==0.27.0',
108
120
  'mkdocstrings-python==1.12.2'
@@ -1,3 +1,3 @@
1
1
  """Version information for Waldiez."""
2
2
 
3
- __version__ = "0.1.15"
3
+ __version__ = "0.1.17"
@@ -12,10 +12,13 @@ def check_conflicts() -> None: # pragma: no cover
12
12
  try:
13
13
  version("autogen-agentchat")
14
14
  print(
15
- "Conflict detected: 'autogen-agentchat' is installed, "
15
+ "Conflict detected: 'autogen-agentchat' is installed "
16
+ "in the current environment, \n"
16
17
  "which conflicts with 'ag2' / 'pyautogen'.\n"
17
- "Please uninstall 'autogen-agentchat': pip uninstall -y autogen-agentchat \n"
18
- "And install 'pyautogen' (or 'waldiez') again: pip install --force pyautogen waldiez"
18
+ "Please uninstall 'autogen-agentchat': \n"
19
+ f"{sys.executable} -m pip uninstall -y autogen-agentchat \n"
20
+ "And install 'pyautogen' (and/or 'waldiez') again: \n"
21
+ f"{sys.executable} -m pip install --force pyautogen waldiez"
19
22
  )
20
23
  sys.exit(1)
21
24
  except PackageNotFoundError:
@@ -1,10 +1,6 @@
1
1
  """Get the main function (if exporting to python)."""
2
2
 
3
- from ..utils import (
4
- get_logging_start_string,
5
- get_logging_stop_string,
6
- get_sqlite_to_csv_call_string,
7
- )
3
+ from ..utils import get_logging_stop_string, get_sqlite_to_csv_call_string
8
4
 
9
5
 
10
6
  def get_def_main(waldiez_chats: str) -> str:
@@ -29,7 +25,6 @@ def get_def_main(waldiez_chats: str) -> str:
29
25
  # type: () -> Union[ChatResult, List[ChatResult]]
30
26
  \"\"\"Start chatting.\"\"\"
31
27
  """
32
- content += get_logging_start_string(1)
33
28
  content += f" results = {waldiez_chats}" + "\n"
34
29
  content += get_logging_stop_string(1) + "\n"
35
30
  content += get_sqlite_to_csv_call_string(1) + "\n"
@@ -159,8 +159,8 @@ def _combine_strings(
159
159
  ) -> str:
160
160
  content = get_pylint_ignore_comment(notebook)
161
161
  content += imports_string
162
- # content += get_comment("logging", notebook) + "\n"
163
- # content += get_logging_start_string(tabs=0) + "\n\n"
162
+ content += get_comment("logging", notebook) + "\n"
163
+ content += get_logging_start_string(tabs=0) + "\n\n"
164
164
  content += models_string
165
165
  content += get_comment("agents", notebook) + "\n"
166
166
  content += agents_string
@@ -182,7 +182,6 @@ def _combine_strings(
182
182
  if not notebook:
183
183
  content += get_def_main(chats_content)
184
184
  else:
185
- content += get_logging_start_string(tabs=0)
186
185
  content += "\n" + chats_content + "\n"
187
186
  content += get_logging_stop_string(tabs=0) + "\n"
188
187
  content += get_sqlite_to_csv_call_string(tabs=0) + "\n"
@@ -1,6 +1,7 @@
1
1
  """Waldiez flow model."""
2
2
 
3
3
  import uuid
4
+ from datetime import datetime, timezone
4
5
  from typing import List, Optional, Tuple
5
6
 
6
7
  from pydantic import Field, model_validator
@@ -12,6 +13,19 @@ from ..common import WaldiezBase, now
12
13
  from .flow_data import WaldiezFlowData
13
14
 
14
15
 
16
+ def id_factory() -> str:
17
+ """Generate a unique ID.
18
+
19
+ Returns
20
+ -------
21
+ str
22
+ The unique ID.
23
+ """
24
+ now_td = datetime.now(timezone.utc)
25
+ now_str = now_td.strftime("%Y%m%d%H%M%S%f")
26
+ return f"{now_str}-{uuid.uuid4().hex}"
27
+
28
+
15
29
  class WaldiezFlow(WaldiezBase):
16
30
  """Flow data class.
17
31
 
@@ -44,7 +58,7 @@ class WaldiezFlow(WaldiezBase):
44
58
  Field(
45
59
  description="The ID of the flow",
46
60
  title="ID",
47
- default_factory=uuid.uuid4,
61
+ default_factory=id_factory,
48
62
  ),
49
63
  ]
50
64
  type: Annotated[
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes