waldiez 0.1.0__py3-none-any.whl

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 (94) hide show
  1. waldiez/__init__.py +15 -0
  2. waldiez/__main__.py +6 -0
  3. waldiez/_version.py +3 -0
  4. waldiez/cli.py +162 -0
  5. waldiez/exporter.py +293 -0
  6. waldiez/exporting/__init__.py +14 -0
  7. waldiez/exporting/agents/__init__.py +5 -0
  8. waldiez/exporting/agents/agent.py +229 -0
  9. waldiez/exporting/agents/agent_skills.py +67 -0
  10. waldiez/exporting/agents/code_execution.py +67 -0
  11. waldiez/exporting/agents/group_manager.py +209 -0
  12. waldiez/exporting/agents/llm_config.py +53 -0
  13. waldiez/exporting/agents/rag_user/__init__.py +5 -0
  14. waldiez/exporting/agents/rag_user/chroma_utils.py +134 -0
  15. waldiez/exporting/agents/rag_user/mongo_utils.py +83 -0
  16. waldiez/exporting/agents/rag_user/pgvector_utils.py +93 -0
  17. waldiez/exporting/agents/rag_user/qdrant_utils.py +112 -0
  18. waldiez/exporting/agents/rag_user/rag_user.py +165 -0
  19. waldiez/exporting/agents/rag_user/vector_db.py +119 -0
  20. waldiez/exporting/agents/teachability.py +37 -0
  21. waldiez/exporting/agents/termination_message.py +45 -0
  22. waldiez/exporting/chats/__init__.py +14 -0
  23. waldiez/exporting/chats/chats.py +46 -0
  24. waldiez/exporting/chats/helpers.py +395 -0
  25. waldiez/exporting/chats/nested.py +264 -0
  26. waldiez/exporting/flow/__init__.py +5 -0
  27. waldiez/exporting/flow/def_main.py +37 -0
  28. waldiez/exporting/flow/flow.py +185 -0
  29. waldiez/exporting/models/__init__.py +193 -0
  30. waldiez/exporting/skills/__init__.py +128 -0
  31. waldiez/exporting/utils/__init__.py +34 -0
  32. waldiez/exporting/utils/comments.py +136 -0
  33. waldiez/exporting/utils/importing.py +267 -0
  34. waldiez/exporting/utils/logging_utils.py +203 -0
  35. waldiez/exporting/utils/method_utils.py +35 -0
  36. waldiez/exporting/utils/naming.py +127 -0
  37. waldiez/exporting/utils/object_string.py +81 -0
  38. waldiez/io_stream.py +181 -0
  39. waldiez/models/__init__.py +107 -0
  40. waldiez/models/agents/__init__.py +65 -0
  41. waldiez/models/agents/agent/__init__.py +21 -0
  42. waldiez/models/agents/agent/agent.py +190 -0
  43. waldiez/models/agents/agent/agent_data.py +162 -0
  44. waldiez/models/agents/agent/code_execution.py +71 -0
  45. waldiez/models/agents/agent/linked_skill.py +30 -0
  46. waldiez/models/agents/agent/nested_chat.py +73 -0
  47. waldiez/models/agents/agent/teachability.py +68 -0
  48. waldiez/models/agents/agent/termination_message.py +167 -0
  49. waldiez/models/agents/agents.py +129 -0
  50. waldiez/models/agents/assistant/__init__.py +6 -0
  51. waldiez/models/agents/assistant/assistant.py +41 -0
  52. waldiez/models/agents/assistant/assistant_data.py +29 -0
  53. waldiez/models/agents/group_manager/__init__.py +19 -0
  54. waldiez/models/agents/group_manager/group_manager.py +87 -0
  55. waldiez/models/agents/group_manager/group_manager_data.py +91 -0
  56. waldiez/models/agents/group_manager/speakers.py +211 -0
  57. waldiez/models/agents/rag_user/__init__.py +26 -0
  58. waldiez/models/agents/rag_user/rag_user.py +58 -0
  59. waldiez/models/agents/rag_user/rag_user_data.py +32 -0
  60. waldiez/models/agents/rag_user/retrieve_config.py +592 -0
  61. waldiez/models/agents/rag_user/vector_db_config.py +162 -0
  62. waldiez/models/agents/user_proxy/__init__.py +6 -0
  63. waldiez/models/agents/user_proxy/user_proxy.py +41 -0
  64. waldiez/models/agents/user_proxy/user_proxy_data.py +30 -0
  65. waldiez/models/chat/__init__.py +22 -0
  66. waldiez/models/chat/chat.py +129 -0
  67. waldiez/models/chat/chat_data.py +326 -0
  68. waldiez/models/chat/chat_message.py +304 -0
  69. waldiez/models/chat/chat_nested.py +160 -0
  70. waldiez/models/chat/chat_summary.py +110 -0
  71. waldiez/models/common/__init__.py +38 -0
  72. waldiez/models/common/base.py +63 -0
  73. waldiez/models/common/method_utils.py +165 -0
  74. waldiez/models/flow/__init__.py +9 -0
  75. waldiez/models/flow/flow.py +302 -0
  76. waldiez/models/flow/flow_data.py +87 -0
  77. waldiez/models/model/__init__.py +11 -0
  78. waldiez/models/model/model.py +169 -0
  79. waldiez/models/model/model_data.py +86 -0
  80. waldiez/models/skill/__init__.py +9 -0
  81. waldiez/models/skill/skill.py +129 -0
  82. waldiez/models/skill/skill_data.py +37 -0
  83. waldiez/models/waldiez.py +301 -0
  84. waldiez/py.typed +0 -0
  85. waldiez/runner.py +304 -0
  86. waldiez/stream/__init__.py +7 -0
  87. waldiez/stream/consumer.py +139 -0
  88. waldiez/stream/provider.py +339 -0
  89. waldiez/stream/server.py +412 -0
  90. waldiez-0.1.0.dist-info/METADATA +181 -0
  91. waldiez-0.1.0.dist-info/RECORD +94 -0
  92. waldiez-0.1.0.dist-info/WHEEL +4 -0
  93. waldiez-0.1.0.dist-info/entry_points.txt +2 -0
  94. waldiez-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,412 @@
1
+ """Simple TCP server using twisted.
2
+
3
+ It listens for connections from an input provider and an input consumer,
4
+ and forwards messages between them.
5
+ """
6
+
7
+ # pylint: disable=import-outside-toplevel,no-member,reimported,unused-import,redefined-outer-name,invalid-name # noqa
8
+ import logging
9
+ import sys
10
+ from threading import Thread
11
+ from types import TracebackType
12
+ from typing import Dict, Optional, Type, cast
13
+
14
+ from twisted.internet.error import ReactorNotRestartable
15
+ from twisted.internet.interfaces import IReactorCore
16
+ from twisted.internet.protocol import Factory, Protocol, connectionDone
17
+ from twisted.internet.tcp import Port
18
+ from twisted.python.failure import Failure
19
+
20
+ LOGGER = logging.getLogger("tcp::server")
21
+ END_OF_MESSAGE = b"\r\n"
22
+
23
+
24
+ class ServerProtocol(Protocol):
25
+ """Server protocol."""
26
+
27
+ factory: "ServerFactory"
28
+
29
+ def set_factory(self, factory: "ServerFactory") -> None:
30
+ """Set the factory.
31
+
32
+ Parameters
33
+ ----------
34
+ factory : ServerFactory
35
+ The factory to set.
36
+ """
37
+ self.factory = factory
38
+
39
+ def connectionLost(self, reason: Failure = connectionDone) -> None:
40
+ """Handle connection lost event.
41
+
42
+ Parameters
43
+ ----------
44
+ reason : Failure, optional
45
+ The reason for the connection loss, by default connectionDone
46
+ """
47
+ if self.factory.clients["provider"] == self:
48
+ self.factory.clients["provider"] = None
49
+ LOGGER.info("Input provider disconnected.")
50
+ elif self.factory.clients["consumer"] == self:
51
+ self.factory.clients["consumer"] = None
52
+ LOGGER.info("Input consumer disconnected.")
53
+ super().connectionLost(reason)
54
+
55
+ def message_received(self, message: str) -> None:
56
+ """Handle a message received event.
57
+
58
+ Parameters
59
+ ----------
60
+ message : str
61
+ The message received.
62
+ """
63
+ if message.startswith("REQUEST:"):
64
+ prompt = message[len("REQUEST:") :]
65
+ if prompt.endswith("\r\n"):
66
+ prompt = prompt[: -(len("\r\n"))]
67
+ prompt = prompt.strip()
68
+ LOGGER.debug("Received request: %s", prompt)
69
+ if self.factory.clients["provider"]:
70
+ msg = f"PROVIDE:{prompt}" + "\r\n"
71
+ transport = self.factory.clients["provider"].transport
72
+ transport.write(msg.encode("utf-8")) # type: ignore
73
+ else:
74
+ LOGGER.error("No provider connected.")
75
+ elif message.startswith("USE:"):
76
+ response = message[len("USE:") :]
77
+ if response.endswith("\r\n"):
78
+ response = response[: -(len("\r\n"))]
79
+ response = response.strip()
80
+ LOGGER.debug("Received response: %s", response)
81
+ if self.factory.clients["consumer"]:
82
+ msg = f"INPUT:{response}" + "\r\n"
83
+ transport = self.factory.clients["consumer"].transport
84
+ transport.write(msg.encode("utf-8")) # type: ignore
85
+ else:
86
+ LOGGER.error("No consumer connected.")
87
+
88
+ def dataReceived(self, data: bytes) -> None:
89
+ """Handle a data received event.
90
+
91
+ Parameters
92
+ ----------
93
+ data : bytes
94
+ The data received.
95
+ """
96
+ # we might get multiple messages in one chunk
97
+ # i.e. CONSUMER\r\nREQUEST:prompt\r\n
98
+ message = data.decode("utf-8")
99
+ if message in ("PROVIDER\r\n", "PROVIDER\n", "PROVIDER"):
100
+ LOGGER.debug("Input provider connected.")
101
+ self.factory.clients["provider"] = self
102
+ return
103
+ if message.startswith("CONSUMER\r\n"):
104
+ LOGGER.debug("Input consumer connected.")
105
+ self.factory.clients["consumer"] = self
106
+ rest = message[len("CONSUMER\r\n") :]
107
+ if rest:
108
+ self.message_received(rest)
109
+ return
110
+ self.message_received(message)
111
+
112
+
113
+ class ServerFactory(Factory):
114
+ """Server factory."""
115
+
116
+ protocol: "ServerProtocol" # type: ignore
117
+ clients: Dict[str, Optional["ServerProtocol"]]
118
+
119
+ def __init__(self) -> None:
120
+ """Initialize the factory."""
121
+ super().__init__()
122
+ self.clients = {
123
+ "provider": None,
124
+ "consumer": None,
125
+ }
126
+
127
+ def buildProtocol(self, addr: str) -> "ServerProtocol":
128
+ """Build the protocol.
129
+
130
+ Parameters
131
+ ----------
132
+ addr : str
133
+ The address (ignored)
134
+
135
+ Returns
136
+ -------
137
+ ServerProtocol
138
+ The factory's protocol.
139
+ """
140
+ self.protocol = ServerProtocol()
141
+ self.protocol.set_factory(self)
142
+ return self.protocol
143
+
144
+
145
+ def get_reactor() -> IReactorCore:
146
+ """Get the reactor from twisted.
147
+
148
+ Returns
149
+ -------
150
+ IReactorCore
151
+ The twisted's reactor
152
+ """
153
+ # dummy hack to allow restarting the reactor
154
+ if "twisted.internet.reactor" in sys.modules:
155
+ del sys.modules["twisted.internet.reactor"]
156
+ import twisted.internet.error
157
+ from twisted.internet import reactor # noqa
158
+ from twisted.internet import default
159
+
160
+ try:
161
+ default.install()
162
+ # pylint: disable=line-too-long
163
+ except (
164
+ twisted.internet.error.ReactorAlreadyInstalledError
165
+ ): # pragma: no cover
166
+ pass
167
+ # cast it so mypy doesn't complain a lot
168
+ reactor_cast = cast(IReactorCore, reactor)
169
+ return reactor_cast
170
+
171
+
172
+ class TCPServerThread(Thread):
173
+ """Threaded TCP server."""
174
+
175
+ reactor: Optional[IReactorCore] = None # noqa
176
+ factory: Optional[Factory] = None # noqa
177
+
178
+ def __init__(
179
+ self,
180
+ interface: str,
181
+ port: int,
182
+ timeout: Optional[float] = None,
183
+ ) -> None:
184
+ """Create a new TCP server.
185
+
186
+ Parameters
187
+ ----------
188
+ interface : str
189
+ Interface to listen on. Defaults to '' (all interfaces)
190
+ port : int
191
+ Port to listen on.
192
+ timeout : Optional[float]
193
+ Timeout for the server.
194
+ """
195
+ super().__init__(
196
+ name="TCPServerThread",
197
+ daemon=True,
198
+ target=self.run,
199
+ )
200
+ from twisted.internet.endpoints import TCP4ServerEndpoint
201
+
202
+ self.timeout = timeout
203
+ self.reactor = get_reactor()
204
+ self._port = port
205
+ endpoint = TCP4ServerEndpoint( # type: ignore[no-untyped-call]
206
+ self.reactor,
207
+ port,
208
+ interface=interface,
209
+ )
210
+ server_factory = ServerFactory()
211
+ deferred = endpoint.listen(server_factory) # type: ignore
212
+ deferred.addCallback(callback=self.on_start)
213
+
214
+ @property
215
+ def port(self) -> int:
216
+ """Get the port."""
217
+ return self._port
218
+
219
+ def on_start(self, port: Port) -> None:
220
+ """On connect callback.
221
+
222
+ Parameters
223
+ ----------
224
+ port : Port
225
+ The port to connect to.
226
+ """
227
+ socket = port.getHost() # type: ignore[no-untyped-call]
228
+ LOGGER.debug(
229
+ "listening on %s:%s",
230
+ socket.host,
231
+ socket.port,
232
+ )
233
+ self._port = socket.port
234
+ self.factory = port.factory
235
+
236
+ def run(self) -> None:
237
+ """Start the server.
238
+
239
+ Raises
240
+ ------
241
+ RuntimeError
242
+ If reactor is not initialized
243
+ """
244
+ if self.reactor is None: # pragma: no cover (just for the linter)
245
+ raise RuntimeError("reactor is not running")
246
+ if not self.reactor.running:
247
+ try:
248
+ self.reactor.run(installSignalHandlers=False) # type: ignore
249
+ except ReactorNotRestartable: # pragma: no cover
250
+ self.reactor = get_reactor()
251
+ self.reactor.run(installSignalHandlers=False) # type: ignore
252
+
253
+
254
+ class ServerWrapper:
255
+ """Server Wrapper."""
256
+
257
+ server: TCPServerThread
258
+ timeout: float
259
+
260
+ def __init__(
261
+ self,
262
+ interface: str,
263
+ port: int,
264
+ timeout: Optional[float] = None,
265
+ ) -> None:
266
+ """Create a new TCP server.
267
+
268
+ Parameters
269
+ ----------
270
+ interface : str
271
+ Interface to listen on. Defaults to '' (all interfaces)
272
+ port : int
273
+ Port to listen on.
274
+ """
275
+ self.timeout = timeout if timeout is not None else 0.2
276
+ self.server = TCPServerThread(
277
+ interface=interface, port=port, timeout=self.timeout
278
+ )
279
+
280
+ @property
281
+ def port(self) -> int:
282
+ """Get the port.
283
+
284
+ Raises
285
+ ------
286
+ RuntimeError
287
+ If the server is not running
288
+ """
289
+ if self.server.factory is None:
290
+ raise RuntimeError("server is not running")
291
+ return self.server.port
292
+
293
+ def start(self) -> None:
294
+ """Start the server.
295
+
296
+ Raises
297
+ ------
298
+ RuntimeError
299
+ If the server is not running
300
+ """
301
+ if self.server is None:
302
+ raise RuntimeError("server is not running")
303
+ self.server.start()
304
+
305
+ def stop(self) -> None:
306
+ """Stop the server."""
307
+ # pylint: disable=line-too-long
308
+ self.server.reactor.callFromThread(self.server.reactor.stop) # type: ignore # noqa
309
+ self.server.join()
310
+
311
+
312
+ class TCPServer:
313
+ """TCP Server."""
314
+
315
+ _wrapper: Optional[ServerWrapper] = None
316
+
317
+ def __init__(
318
+ self,
319
+ port: int,
320
+ timeout: Optional[float] = None,
321
+ interface: str = "",
322
+ ) -> None:
323
+ """Create a new server.
324
+
325
+ Parameters
326
+ ----------
327
+ port : int
328
+ Port to listen on.
329
+ timeout : Optional[float]
330
+ Timeout for the server.
331
+ interface : str
332
+ Interface to listen on. Defaults to '' (all interfaces)
333
+ """
334
+ self._port = port
335
+ self._timeout = timeout
336
+ self._interface = interface
337
+ self._init_wrapper()
338
+ self._running = False
339
+
340
+ @property
341
+ def port(self) -> int:
342
+ """Get the port."""
343
+ if self._wrapper is None:
344
+ return self._port
345
+ return self._wrapper.port
346
+
347
+ def _init_wrapper(self) -> None:
348
+ """Initialize the wrapper."""
349
+ self._wrapper = ServerWrapper(
350
+ port=self._port,
351
+ timeout=self._timeout,
352
+ interface=self._interface,
353
+ )
354
+
355
+ def start(self) -> None:
356
+ """Start the server.
357
+
358
+ Raises
359
+ ------
360
+ RuntimeError
361
+ If the wrapper is not initialized
362
+ """
363
+ if self._running:
364
+ return
365
+ if not self._wrapper:
366
+ self._init_wrapper()
367
+ if not self._wrapper: # pragma: no cover (just for the linter)
368
+ raise RuntimeError("Server wrapper is not initialized")
369
+ self._wrapper.start()
370
+ self._port = self._wrapper.port
371
+ self._running = True
372
+
373
+ def stop(self) -> None:
374
+ """Stop the server."""
375
+ if not self._running:
376
+ return
377
+ if not self._wrapper: # pragma: no cover (just for the linter)
378
+ return
379
+ self._wrapper.stop()
380
+ self._running = False
381
+ del self._wrapper
382
+ self._wrapper = None
383
+
384
+ def is_running(self) -> bool:
385
+ """Check if the server is running.
386
+
387
+ Returns
388
+ -------
389
+ bool
390
+ True if the server is running, else False.
391
+ """
392
+ return self._running
393
+
394
+ def __enter__(self) -> "TCPServer":
395
+ """Enter the context manager."""
396
+ self.start()
397
+ return self
398
+
399
+ def __exit__(
400
+ self,
401
+ exc_type: Optional[Type[BaseException]],
402
+ exc_value: Optional[BaseException],
403
+ traceback: Optional[TracebackType],
404
+ ) -> None:
405
+ """Exit the context manager."""
406
+ self.stop()
407
+
408
+ def restart(self) -> None:
409
+ """Restart the server."""
410
+ self.stop()
411
+ self._init_wrapper()
412
+ self.start()
@@ -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
+ ![CI Build](https://github.com/waldiez/py/actions/workflows/main.yaml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/waldiez/py/badge.svg)](https://coveralls.io/github/waldiez/py)
78
+
79
+ Translate a Waldiez flow:
80
+
81
+ [![Flow](./docs/flow.png)](./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.
@@ -0,0 +1,94 @@
1
+ waldiez/__init__.py,sha256=pX6lHj8fNlfqCpHEfF6MNQBCR6qRjFYjwBSOCoxrlwk,313
2
+ waldiez/__main__.py,sha256=9xR-F2ohZcRPDG6KrM7cJpXciKX-u6WdL221ckyJ04k,112
3
+ waldiez/_version.py,sha256=saqwbVgZYlUXO-iC6EOQxQDymeoLbPuCmDNC4OXKzto,62
4
+ waldiez/cli.py,sha256=vIQDqs9XBOlDpshq7rNgvoTcnnkeZrsXa_51gMWs6H4,4690
5
+ waldiez/exporter.py,sha256=iKe-l_Me8NRWsXHIdBcrOrnLT9XIyp4iYi4HLuuj2jA,9342
6
+ waldiez/io_stream.py,sha256=YczhIw0PKEsxCSY6tAqElCqOUh8b-aEkSIGC1JjXxAs,5877
7
+ waldiez/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ waldiez/runner.py,sha256=BvDiczgTip-cj5gWxBWuXca03aR63sBl3AP_6-5eZ9k,10003
9
+ waldiez/exporting/__init__.py,sha256=GMY7qTRpNmc7tpaCFNGLT5wX9eu26NvoNPuYX8MzP50,344
10
+ waldiez/exporting/agents/__init__.py,sha256=v5KA112W_EFYwXE2TSBKYyO8rRKUOUAOpFS5CMSnfRs,110
11
+ waldiez/exporting/agents/agent.py,sha256=otNYclKfi57CUNsM0lVLAbD7YPboe_2TnrdllBwgKzE,7228
12
+ waldiez/exporting/agents/agent_skills.py,sha256=4et3DduwV6dvYTzR4hQRBQGdIkQuJwp1w4oGnjBek6Y,1852
13
+ waldiez/exporting/agents/code_execution.py,sha256=fA_E8EuxUqCzlQMoIDQODiN32CSTttjLXGKBJaAEyqY,2299
14
+ waldiez/exporting/agents/group_manager.py,sha256=rVYtg72dM4J_agEtpN60cGT1dWNqP9msd9I9YRVR1cc,7112
15
+ waldiez/exporting/agents/llm_config.py,sha256=A88e-RKp09r8n9MG11hArpITzxK8nVrTZ6dtJ60iRXE,1455
16
+ waldiez/exporting/agents/teachability.py,sha256=ame4hHJCZRBp7hAQGZzv2Cjs6QtcV9vlQ1zheMEMac0,1103
17
+ waldiez/exporting/agents/termination_message.py,sha256=tzI4-tcveYKBVx5PsznQZwAoghSX3mbn_vPu4rX8tuU,1276
18
+ waldiez/exporting/agents/rag_user/__init__.py,sha256=01F4gwgUwtSpZbGXcfieqIuLNT64u9KiqMIB2f0mplI,196
19
+ waldiez/exporting/agents/rag_user/chroma_utils.py,sha256=Xtx3bWL25MnioFhXZNyW3t-K8CS32Zw_c54l185QbDg,4466
20
+ waldiez/exporting/agents/rag_user/mongo_utils.py,sha256=y5IL-Anfktg9cYo2o-ED1A7lwHQWdVMWD_W1AT5_RmE,2664
21
+ waldiez/exporting/agents/rag_user/pgvector_utils.py,sha256=EyGDwvo1Pe8bqoJl3NFpqK6zizN81lPPaSMBMQF79Dc,2722
22
+ waldiez/exporting/agents/rag_user/qdrant_utils.py,sha256=vVPGIt-L2Z6z7S4RPBK5LYkJtv1sCscPHsWl_VrcPGQ,3486
23
+ waldiez/exporting/agents/rag_user/rag_user.py,sha256=omBmT6mQR2fSMo003GVckqUpAaI6mWRpVRqCqFpKJRg,5294
24
+ waldiez/exporting/agents/rag_user/vector_db.py,sha256=64Gr_y1VTZLXi1pC4KjChsZ6DTX7cxdkDRQI3Ty_H-U,3659
25
+ waldiez/exporting/chats/__init__.py,sha256=v5aR1gWqSN5xeDDMIFo-ceC_Z9UgL8qJZofC2sU8HqQ,296
26
+ waldiez/exporting/chats/chats.py,sha256=xI5ZzWpcqYz8Kuu7B9pU6iHN16wUwHxOvYFhH5vxWuA,1259
27
+ waldiez/exporting/chats/helpers.py,sha256=LmbOKXxMMSf2D1up8CNxxitUDvZ-Z_8NNxJFcP32CIc,12587
28
+ waldiez/exporting/chats/nested.py,sha256=39qodz8Lct2SDjIjEHSxNUls9T4UtfLBEeiBcmqydbA,8254
29
+ waldiez/exporting/flow/__init__.py,sha256=WhdPrjXQAcihrS1KUtPNgbx0y1tqD5HtGykzpEAcsBM,98
30
+ waldiez/exporting/flow/def_main.py,sha256=YpdhqO4iFng3r7if69ZPMJAibPVNDqnrOrWvGw7CJq8,1052
31
+ waldiez/exporting/flow/flow.py,sha256=AGISfMOicdee4zikvuega8ZnHceQpdfCphDBgIE5_94,6038
32
+ waldiez/exporting/models/__init__.py,sha256=qJvP0CIrgLPM2pnIoXM26eyUdh7ub-CiNNLJwXEOAwQ,5829
33
+ waldiez/exporting/skills/__init__.py,sha256=oIA9f5ABtYSbS0kMY_4ovU3-m6meVk5blEu_xViZsRU,3536
34
+ waldiez/exporting/utils/__init__.py,sha256=omS2U9OpXTaIezT-RdktZK6lWJsFNGUsic4digBfQNg,955
35
+ waldiez/exporting/utils/comments.py,sha256=X9j8w48rh3DfFDjiMverU9DBSuE9yuMMbbStxBbN1sE,3190
36
+ waldiez/exporting/utils/importing.py,sha256=M7vBcW9gPe3hCaTX2Bsv-mz36DAiCe4R-3mLrMWGY-Y,8616
37
+ waldiez/exporting/utils/logging_utils.py,sha256=uoV6O23lfB5ztOYEZiYu8Mn-2xEUwp_Qx404Mr62i7M,5822
38
+ waldiez/exporting/utils/method_utils.py,sha256=7-RUMTylNM2W0iM1bPX2_Gn3553XZSl2s2VGEijxNp4,891
39
+ waldiez/exporting/utils/naming.py,sha256=VdoVODQduhXIs9hQFWUVEVqTaSyNDt7rkECsuIgXYwI,3196
40
+ waldiez/exporting/utils/object_string.py,sha256=FQYrP2UmpRY6S-koCSCigaquyqGq42c62szcS2joy24,2086
41
+ waldiez/models/__init__.py,sha256=IMq8vzuAgmv92kHSSuZQLF38vVd31ojgOHonuHqWYj0,2888
42
+ waldiez/models/waldiez.py,sha256=B_ujtMVnuGFAB_d9gMDydOdbe2XtP80EH7FVefwpHeg,8909
43
+ waldiez/models/agents/__init__.py,sha256=3ZyVYBHMFzZjRMIdPrBF6HLg82LPAlEubL6utL6KhfU,1856
44
+ waldiez/models/agents/agents.py,sha256=zIqihnoBjzaQLL_P6FcVoHddcusRNYsWPIFLZD091bE,3641
45
+ waldiez/models/agents/agent/__init__.py,sha256=inA0zV3dnwmcQlcObH_FLaZSURjFG31E_XUampJAnJU,746
46
+ waldiez/models/agents/agent/agent.py,sha256=DAwreQtIdoM2x_vVccIkALl5whyS07GvfKRUxdVhLeY,5513
47
+ waldiez/models/agents/agent/agent_data.py,sha256=JJcSZqT4YRFn3lSxE1U5q_fp8bv-Y2KVeUWa1nb-gA4,5343
48
+ waldiez/models/agents/agent/code_execution.py,sha256=kgL3pbEEyuMvJid0sIbfe4os7SWKpzL1Bv4O525Biyk,1942
49
+ waldiez/models/agents/agent/linked_skill.py,sha256=8RHWHkHXqFuv7lEe1PuQoK1hTO3kBQ7ILKm9kCEWqNs,667
50
+ waldiez/models/agents/agent/nested_chat.py,sha256=DAF3TCbTwyDvg6PGbeETtBLCQ4Xz5Saw5a4Xi-jr6jA,1929
51
+ waldiez/models/agents/agent/teachability.py,sha256=IIR4LY9dwx3T7Ok17RYN2g6zGiga2gGizGteaeI3eGs,1703
52
+ waldiez/models/agents/agent/termination_message.py,sha256=lZskWdFCHPNldTwy080rxCQNaEfyR08vzaKWCG00-Mw,5630
53
+ waldiez/models/agents/assistant/__init__.py,sha256=Zlf-4EI9HXl-LrqGosL7UucoyqIl74GZzohZlRLx2QI,175
54
+ waldiez/models/agents/assistant/assistant.py,sha256=OFh5nr8HrOLg2KXnwzFUU7_JBWrYfM7lRtTRQT1E_gI,1095
55
+ waldiez/models/agents/assistant/assistant_data.py,sha256=VGdF1IZBBqBvZwe6BP2s4LinmkQ2IjesaDvs9Me9iHY,823
56
+ waldiez/models/agents/group_manager/__init__.py,sha256=To97X5vdRTcTSylWUH2hlgkNH2pdn4TRUJqvLiU5-Bk,592
57
+ waldiez/models/agents/group_manager/group_manager.py,sha256=0Bg3rEGL414M8gIMlgg6q3et7RFgGheHbvHUcONc-qw,2687
58
+ waldiez/models/agents/group_manager/group_manager_data.py,sha256=NHA_uRC3KxqquhW4sEoNVhT8XWpXD1W_8EYaRjzJuG8,2785
59
+ waldiez/models/agents/group_manager/speakers.py,sha256=tlz15MO2veK_v895MsIa2zeOzEGamkdLg3W5Ctn8nV8,6648
60
+ waldiez/models/agents/rag_user/__init__.py,sha256=_Ge6ekCPHGuDuebbP3unUKbWrjeN8Hx3ST68_DapE7w,678
61
+ waldiez/models/agents/rag_user/rag_user.py,sha256=l4a_IzlNPtNb-GTx22r15XIVmHxvhuM5KbXjkUwS8JU,1558
62
+ waldiez/models/agents/rag_user/rag_user_data.py,sha256=4WjG8UcQ8ltLAxvZgsZUUlaEqHrX3KewrVIH7UJeUYo,870
63
+ waldiez/models/agents/rag_user/retrieve_config.py,sha256=ZG0kqdza35aoMm9ZJdU-jLPDo-PJFkeUZycnaE3secI,21817
64
+ waldiez/models/agents/rag_user/vector_db_config.py,sha256=PqrP28LCSAxbiNtbFoiVcsmm_y6sf1YgpV_HqdFWn4Y,4901
65
+ waldiez/models/agents/user_proxy/__init__.py,sha256=RNLQ5ws58mJE-8ckjAvC8UvXPUu5CyTe8-iDLxSFogQ,178
66
+ waldiez/models/agents/user_proxy/user_proxy.py,sha256=Um9Oxprpct1Dlg7dwi0S4v6z8IGjlcrirM-BpgV5XaU,1071
67
+ waldiez/models/agents/user_proxy/user_proxy_data.py,sha256=3aQ4N-C1mEt4FDkOzaknLGbwfoFuDD47OkLJSNgSvcQ,833
68
+ waldiez/models/chat/__init__.py,sha256=AVFHRig7T4TBHx1B5MczW3s79wVN4G98ThLYm7pBfr8,553
69
+ waldiez/models/chat/chat.py,sha256=lqyNvC2XjffLy8RIGcYOi8CEMenmfd_brapfDVenAqc,3408
70
+ waldiez/models/chat/chat_data.py,sha256=EGWIPj1U0SoEdl0Wc5e9l4ncNbMaDndfLnVSV7qRmJo,9870
71
+ waldiez/models/chat/chat_message.py,sha256=OtA65nNm4J0N3G5EHz7ga9dKsKqzClyhsVNm7-XKvow,8761
72
+ waldiez/models/chat/chat_nested.py,sha256=OFeytlQ1Rgt6hx9_-xe47PdNnmgztokxldEDPJuGKsc,4685
73
+ waldiez/models/chat/chat_summary.py,sha256=fiF0X6nk5dLoZFfwKBHoytk2ArhvIpVHETyCIH7uKd4,2823
74
+ waldiez/models/common/__init__.py,sha256=1WhzhGYYUWMuHgxjiT1UralMClutO3_5BhFtnkhp8Yk,686
75
+ waldiez/models/common/base.py,sha256=aEZhUEy46HeivemX851bVcwAAovxgXNq_rtkvkniBIk,1687
76
+ waldiez/models/common/method_utils.py,sha256=K7dNyvqHwvwuULLgn1_uK72Bfnm9d0CYHP3rYW5IgjM,5502
77
+ waldiez/models/flow/__init__.py,sha256=oy_G58xDkZk_LZEvqmr-0MJrpYy1JRf-U-F5-bI1944,162
78
+ waldiez/models/flow/flow.py,sha256=Zxcl0Z9qty4DDRLSCaMSPOBcUZrd6pcWcuCFf_vDGPE,9372
79
+ waldiez/models/flow/flow_data.py,sha256=7dLMa0RHQSN7y8xnIqZviS9EKelCkk22ZYliNDO7qMM,2391
80
+ waldiez/models/model/__init__.py,sha256=32Xox2Qw1jsf7ZCcoi0vMgZ5yxulLmtBrRRxq3FBAks,246
81
+ waldiez/models/model/model.py,sha256=aG-9YAyLDYPqF-GWRTfuI7hP1Z7tfWWfj7Dhy1Y2GSc,4997
82
+ waldiez/models/model/model_data.py,sha256=pDPKUbltaXWjCuDArgwTOEHw_igfk_DkxzFzdn6zo14,2599
83
+ waldiez/models/skill/__init__.py,sha256=rU88bajKOGMYoHFcE8MP0jW9H0MswbQmvz5wxS35BYE,169
84
+ waldiez/models/skill/skill.py,sha256=fhsAI413an2_d4DBIkf7dzEuWk6rGs2t4sl97a4dj20,3473
85
+ waldiez/models/skill/skill_data.py,sha256=RTWn8Od6w7g-nRIpsS29sqZ8sPm5dCPiK7-qXmU-KD4,815
86
+ waldiez/stream/__init__.py,sha256=6qst5j2iXmV-wDTnhgCna3llqUfJ6tkR0HBq7Vx9x-Q,197
87
+ waldiez/stream/consumer.py,sha256=VQDJEomYpGjmAtOoFBJrpCyoYzwykJUIOrdiLn08Uj4,4049
88
+ waldiez/stream/provider.py,sha256=JqnnR1yAimfK4HxW4gr4HIoJ15Ly71kXn75mv7FZBmw,9478
89
+ waldiez/stream/server.py,sha256=Ya4AKP5Wr_xAsbG3Q-qShqHmfIyamj9LGXizJsL-N4Y,11815
90
+ waldiez-0.1.0.dist-info/METADATA,sha256=8AhAe15WIsHbkCGqft3VJsm4jTWlFGYg2ncPPty7798,6626
91
+ waldiez-0.1.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
92
+ waldiez-0.1.0.dist-info/entry_points.txt,sha256=5Po4yQXPa_QEdtTevpEBgr3rGoIvDMeQuJR2zqwBLBo,45
93
+ waldiez-0.1.0.dist-info/licenses/LICENSE,sha256=VQEHM6WMQLRu1qaGl3GWsoOknDwro-69eGo4NLIJPIM,1064
94
+ waldiez-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.25.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any