waldiez 0.1.7__py3-none-any.whl → 0.1.9__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.
- waldiez/_version.py +1 -1
- waldiez/exporting/agents/rag_user/chroma_utils.py +5 -6
- waldiez/exporting/chats/nested.py +2 -12
- waldiez/exporting/utils/logging_utils.py +1 -0
- waldiez/exporting/utils/path_check.py +8 -5
- waldiez/io/__init__.py +74 -113
- waldiez/models/agents/agent/nested_chat.py +4 -8
- waldiez/models/waldiez.py +5 -8
- {waldiez-0.1.7.dist-info → waldiez-0.1.9.dist-info}/METADATA +83 -51
- {waldiez-0.1.7.dist-info → waldiez-0.1.9.dist-info}/RECORD +13 -17
- {waldiez-0.1.7.dist-info → waldiez-0.1.9.dist-info}/WHEEL +1 -1
- waldiez/io/stream/__init__.py +0 -7
- waldiez/io/stream/consumer.py +0 -139
- waldiez/io/stream/provider.py +0 -343
- waldiez/io/stream/server.py +0 -438
- {waldiez-0.1.7.dist-info → waldiez-0.1.9.dist-info}/entry_points.txt +0 -0
- {waldiez-0.1.7.dist-info → waldiez-0.1.9.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: waldiez
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary: waldiez
|
|
5
|
-
Project-URL: homepage, https://waldiez.github.io/
|
|
6
|
-
Project-URL: repository, https://github.com/waldiez/
|
|
5
|
+
Project-URL: homepage, https://waldiez.github.io/waldiez/
|
|
6
|
+
Project-URL: repository, https://github.com/waldiez/waldiez.git
|
|
7
7
|
Author-email: Panagiotis Kasnesis <pkasnesis@thingenious.io>, Lazaros Toumanidis <laztoum@protonmail.com>
|
|
8
|
-
License-File: LICENSE
|
|
9
8
|
Classifier: Development Status :: 3 - Alpha
|
|
10
9
|
Classifier: Intended Audience :: Developers
|
|
11
10
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -17,28 +16,26 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
18
|
Requires-Python: <3.13,>=3.10
|
|
20
|
-
Requires-Dist:
|
|
19
|
+
Requires-Dist: ag2==0.3.2
|
|
21
20
|
Requires-Dist: jupytext
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist:
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist:
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist:
|
|
34
|
-
Requires-Dist:
|
|
35
|
-
Requires-Dist:
|
|
36
|
-
Requires-Dist:
|
|
37
|
-
Requires-Dist:
|
|
38
|
-
Requires-Dist:
|
|
39
|
-
Requires-Dist:
|
|
40
|
-
Requires-Dist: pymongo==4.10.1; extra == 'autogen-extras'
|
|
41
|
-
Requires-Dist: qdrant-client==1.12.1; extra == 'autogen-extras'
|
|
21
|
+
Provides-Extra: ag2-extras
|
|
22
|
+
Requires-Dist: ag2[anthropic]==0.3.2; extra == 'ag2-extras'
|
|
23
|
+
Requires-Dist: ag2[bedrock]==0.3.2; extra == 'ag2-extras'
|
|
24
|
+
Requires-Dist: ag2[gemini]==0.3.2; extra == 'ag2-extras'
|
|
25
|
+
Requires-Dist: ag2[groq]==0.3.2; extra == 'ag2-extras'
|
|
26
|
+
Requires-Dist: ag2[mistral]==0.3.2; extra == 'ag2-extras'
|
|
27
|
+
Requires-Dist: ag2[retrievechat-mongodb]==0.3.2; extra == 'ag2-extras'
|
|
28
|
+
Requires-Dist: ag2[retrievechat-pgvector]==0.3.2; extra == 'ag2-extras'
|
|
29
|
+
Requires-Dist: ag2[retrievechat-qdrant]==0.3.2; extra == 'ag2-extras'
|
|
30
|
+
Requires-Dist: ag2[retrievechat]==0.3.2; extra == 'ag2-extras'
|
|
31
|
+
Requires-Dist: ag2[together]==0.3.2; extra == 'ag2-extras'
|
|
32
|
+
Requires-Dist: ag2[websurfer]==0.3.2; extra == 'ag2-extras'
|
|
33
|
+
Requires-Dist: chromadb==0.5.3; extra == 'ag2-extras'
|
|
34
|
+
Requires-Dist: fastembed==0.4.2; extra == 'ag2-extras'
|
|
35
|
+
Requires-Dist: pgvector>=0.2.5; extra == 'ag2-extras'
|
|
36
|
+
Requires-Dist: psycopg[binary]>=3.1.18; extra == 'ag2-extras'
|
|
37
|
+
Requires-Dist: pymongo==4.10.1; extra == 'ag2-extras'
|
|
38
|
+
Requires-Dist: qdrant-client==1.12.1; extra == 'ag2-extras'
|
|
42
39
|
Provides-Extra: dev
|
|
43
40
|
Requires-Dist: autoflake==2.3.1; extra == 'dev'
|
|
44
41
|
Requires-Dist: bandit==1.7.10; extra == 'dev'
|
|
@@ -50,7 +47,7 @@ Requires-Dist: pre-commit==4.0.1; extra == 'dev'
|
|
|
50
47
|
Requires-Dist: pydocstyle==6.3.0; extra == 'dev'
|
|
51
48
|
Requires-Dist: pylint==3.3.1; extra == 'dev'
|
|
52
49
|
Requires-Dist: python-dotenv==1.0.1; extra == 'dev'
|
|
53
|
-
Requires-Dist: ruff==0.7.
|
|
50
|
+
Requires-Dist: ruff==0.7.4; extra == 'dev'
|
|
54
51
|
Requires-Dist: types-pyyaml==6.0.12; extra == 'dev'
|
|
55
52
|
Requires-Dist: yamllint==1.35.1; extra == 'dev'
|
|
56
53
|
Provides-Extra: docs
|
|
@@ -58,11 +55,11 @@ Requires-Dist: mdx-include==1.4.2; extra == 'docs'
|
|
|
58
55
|
Requires-Dist: mdx-truly-sane-lists==1.3; extra == 'docs'
|
|
59
56
|
Requires-Dist: mkdocs-jupyter==0.25.1; extra == 'docs'
|
|
60
57
|
Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == 'docs'
|
|
61
|
-
Requires-Dist: mkdocs-material==9.5.
|
|
58
|
+
Requires-Dist: mkdocs-material==9.5.45; extra == 'docs'
|
|
62
59
|
Requires-Dist: mkdocs-minify-html-plugin==0.2.3; extra == 'docs'
|
|
63
60
|
Requires-Dist: mkdocs==1.6.1; extra == 'docs'
|
|
64
61
|
Requires-Dist: mkdocstrings-python==1.12.2; extra == 'docs'
|
|
65
|
-
Requires-Dist: mkdocstrings[crystal,python]==0.
|
|
62
|
+
Requires-Dist: mkdocstrings[crystal,python]==0.27.0; extra == 'docs'
|
|
66
63
|
Provides-Extra: test
|
|
67
64
|
Requires-Dist: pytest-cov==6.0.0; extra == 'test'
|
|
68
65
|
Requires-Dist: pytest-html==4.1.1; extra == 'test'
|
|
@@ -74,20 +71,20 @@ Description-Content-Type: text/markdown
|
|
|
74
71
|
|
|
75
72
|
# Waldiez
|
|
76
73
|
|
|
77
|
-
 [](https://coveralls.io/github/waldiez/waldiez) [](https://badge.fury.io/py/waldiez)
|
|
78
75
|
|
|
79
76
|
Translate a Waldiez flow:
|
|
80
77
|
|
|
81
|
-

|
|
82
79
|
|
|
83
|
-
To a python script or a jupyter notebook with the corresponding [
|
|
80
|
+
To a python script or a jupyter notebook with the corresponding [ag2](https://github.com/ag2ai/ag2/) agents and chats.
|
|
84
81
|
|
|
85
82
|
## Features
|
|
86
83
|
|
|
87
84
|
- Export .waldiez flows to .py or .ipynb
|
|
88
85
|
- Run a .waldiez flow
|
|
89
86
|
- Include a `logs` folder with the logs of the flow in csv format
|
|
90
|
-
- Provide a custom [IOSStream](https://
|
|
87
|
+
- Provide a custom [IOSStream](https://ag2ai.github.io/ag2/docs/reference/io/base#iostream) to handle input and output.
|
|
91
88
|
|
|
92
89
|
## Installation
|
|
93
90
|
|
|
@@ -100,7 +97,7 @@ python -m pip install waldiez
|
|
|
100
97
|
From the repository:
|
|
101
98
|
|
|
102
99
|
```bash
|
|
103
|
-
python -m pip install git+https://github.com/waldiez/
|
|
100
|
+
python -m pip install git+https://github.com/waldiez/waldiez.git
|
|
104
101
|
```
|
|
105
102
|
|
|
106
103
|
## Usage
|
|
@@ -119,13 +116,13 @@ waldiez /path/to/a/flow.waldiez --output /path/to/an/output/flow[.py] [--force]
|
|
|
119
116
|
```shell
|
|
120
117
|
CONTAINER_COMMAND=docker # or podman
|
|
121
118
|
# pull the image
|
|
122
|
-
$CONTAINER_COMMAND pull waldiez/
|
|
119
|
+
$CONTAINER_COMMAND pull waldiez/waldiez
|
|
123
120
|
# Export a Waldiez flow to a python script or a jupyter notebook
|
|
124
121
|
$CONTAINER_COMMAND run \
|
|
125
122
|
--rm \
|
|
126
123
|
-v /path/to/a/flow.waldiez:/flow.waldiez \
|
|
127
124
|
-v /path/to/an/output:/output \
|
|
128
|
-
waldiez/
|
|
125
|
+
waldiez/waldiez --export /flow.waldiez --output /output/flow[.py|.ipynb]
|
|
129
126
|
|
|
130
127
|
# with selinux and/or podman, you might get permission (or file not found) errors, so you can try:
|
|
131
128
|
$CONTAINER_COMMAND run \
|
|
@@ -134,12 +131,12 @@ $CONTAINER_COMMAND run \
|
|
|
134
131
|
-v /path/to/an/output:/output \
|
|
135
132
|
--userns=keep-id \
|
|
136
133
|
--security-opt label=disable \
|
|
137
|
-
waldiez/
|
|
134
|
+
waldiez/waldiez --export /flow.waldiez --output /output/flow[.py|.ipynb]
|
|
138
135
|
```
|
|
139
136
|
|
|
140
137
|
```shell
|
|
141
138
|
# Export and run the script
|
|
142
|
-
$CONTAINER_COMMAND run --rm -v /path/to/a/flow.waldiez:/flow.waldiez -v /path/to/an/output:/output waldiez/
|
|
139
|
+
$CONTAINER_COMMAND run --rm -v /path/to/a/flow.waldiez:/flow.waldiez -v /path/to/an/output:/output waldiez/waldiez /flow.waldiez --output /output/output[.py]
|
|
143
140
|
```
|
|
144
141
|
|
|
145
142
|
### As a library
|
|
@@ -170,40 +167,75 @@ runner.run(output_path=output_path)
|
|
|
170
167
|
|
|
171
168
|
```python
|
|
172
169
|
# Run the flow with a custom IOStream
|
|
170
|
+
# In case the standard 'input' and 'print' functions cannot be used
|
|
171
|
+
import time
|
|
172
|
+
import threading
|
|
173
|
+
|
|
174
|
+
from typing import Any
|
|
175
|
+
|
|
173
176
|
from waldiez import WaldiezRunner
|
|
174
177
|
from waldiez.io import WaldiezIOStream
|
|
175
178
|
|
|
176
179
|
flow_path = "/path/to/a/flow.waldiez"
|
|
177
180
|
output_path = "/path/to/an/output.py"
|
|
178
181
|
|
|
179
|
-
def print_function(*values, **args) -> None:
|
|
180
|
-
"""A custom print function."""
|
|
181
|
-
print(values)
|
|
182
182
|
|
|
183
|
-
def
|
|
184
|
-
"""
|
|
185
|
-
|
|
183
|
+
def custom_print_function(*args: Any, sep: str = " ", **kwargs: Any) -> None:
|
|
184
|
+
"""Custom print function."""
|
|
185
|
+
print(*args, sep=sep, **kwargs)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
# Custom input handler
|
|
189
|
+
class InputProcessorWrapper:
|
|
190
|
+
"""Wrapper input processor.
|
|
191
|
+
|
|
192
|
+
To manage the interaction between the custom input processor and IOStream.
|
|
193
|
+
"""
|
|
194
|
+
|
|
195
|
+
def __init__(self):
|
|
196
|
+
self.stream = None # Placeholder for the WaldiezIOStream instance
|
|
197
|
+
self.lock = threading.Lock() # Ensure thread-safe operations
|
|
198
|
+
|
|
199
|
+
def custom_input_processor(self, prompt: str) -> None:
|
|
200
|
+
"""Simulate external input and send it back to the IOStream."""
|
|
201
|
+
def external_input_simulation():
|
|
202
|
+
with self.lock: # Ensure thread-safe access
|
|
203
|
+
time.sleep(2) # Simulate delay for network input
|
|
204
|
+
if self.stream:
|
|
205
|
+
self.stream.set_input("Simulated external input")
|
|
206
|
+
else:
|
|
207
|
+
raise RuntimeError("Stream reference not set!")
|
|
186
208
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
209
|
+
threading.Thread(target=external_input_simulation, daemon=True).start()
|
|
210
|
+
|
|
211
|
+
def set_stream(self, stream: "WaldiezIOStream"):
|
|
212
|
+
"""Set the WaldiezIOStream instance."""
|
|
213
|
+
with self.lock: # Ensure thread-safe setting of the stream
|
|
214
|
+
self.stream = stream
|
|
215
|
+
|
|
216
|
+
processor_wrapper = InputProcessorWrapper()
|
|
217
|
+
|
|
218
|
+
stream = WaldiezIOStream(
|
|
190
219
|
input_timeout=30,
|
|
220
|
+
print_function=
|
|
221
|
+
on_prompt_input=processor_wrapper.custom_input_processor,
|
|
191
222
|
)
|
|
223
|
+
|
|
224
|
+
# Link the processor wrapper to the WaldiezIOStream instance
|
|
225
|
+
processor_wrapper.set_stream(custom_stream)
|
|
226
|
+
|
|
192
227
|
with WaldiezIOStream.set_default(io_stream):
|
|
193
228
|
runner = WaldiezRunner.load(flow_path)
|
|
194
229
|
runner.run(stream=io_stream, output_path=output_path)
|
|
195
230
|
|
|
196
|
-
io_stream.close()
|
|
197
|
-
|
|
198
231
|
```
|
|
199
232
|
|
|
200
233
|
### Tools
|
|
201
234
|
|
|
202
|
-
- [
|
|
235
|
+
- [ag2 (formerly AutoGen)](https://github.com/ag2ai/ag2)
|
|
203
236
|
- [juptytext](https://github.com/mwouts/jupytext)
|
|
204
|
-
- [twisted](https://github.com/twisted/twisted)
|
|
205
237
|
- [pydantic](https://github.com/pydantic/pydantic)
|
|
206
238
|
|
|
207
239
|
## License
|
|
208
240
|
|
|
209
|
-
This project is licensed under the MIT License - see the [LICENSE](https://github.com/waldiez/
|
|
241
|
+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/waldiez/waldiez/blob/main/LICENSE) file for details.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
waldiez/__init__.py,sha256=AuVJ8ZOPmJoTeKQ_ryezU14tG-DFRb7djvr72a5G63Y,251
|
|
2
2
|
waldiez/__main__.py,sha256=9xR-F2ohZcRPDG6KrM7cJpXciKX-u6WdL221ckyJ04k,112
|
|
3
|
-
waldiez/_version.py,sha256=
|
|
3
|
+
waldiez/_version.py,sha256=BAPW_qv-vw1iBQm2bCpQfS6VnM42uoEaWNsSV8dCyr8,62
|
|
4
4
|
waldiez/cli.py,sha256=wStRkt056Y-F2CcuD6Zlov-ooUpWndyNesV9s_MjyHU,4798
|
|
5
5
|
waldiez/exporter.py,sha256=iKe-l_Me8NRWsXHIdBcrOrnLT9XIyp4iYi4HLuuj2jA,9342
|
|
6
6
|
waldiez/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -15,7 +15,7 @@ waldiez/exporting/agents/llm_config.py,sha256=A88e-RKp09r8n9MG11hArpITzxK8nVrTZ6
|
|
|
15
15
|
waldiez/exporting/agents/teachability.py,sha256=ame4hHJCZRBp7hAQGZzv2Cjs6QtcV9vlQ1zheMEMac0,1103
|
|
16
16
|
waldiez/exporting/agents/termination_message.py,sha256=tzI4-tcveYKBVx5PsznQZwAoghSX3mbn_vPu4rX8tuU,1276
|
|
17
17
|
waldiez/exporting/agents/rag_user/__init__.py,sha256=01F4gwgUwtSpZbGXcfieqIuLNT64u9KiqMIB2f0mplI,196
|
|
18
|
-
waldiez/exporting/agents/rag_user/chroma_utils.py,sha256=
|
|
18
|
+
waldiez/exporting/agents/rag_user/chroma_utils.py,sha256=JZJwISn75Hklm50lqKdGNRHuMg81AnDNTMqoI-TJLRk,4702
|
|
19
19
|
waldiez/exporting/agents/rag_user/mongo_utils.py,sha256=y5IL-Anfktg9cYo2o-ED1A7lwHQWdVMWD_W1AT5_RmE,2664
|
|
20
20
|
waldiez/exporting/agents/rag_user/pgvector_utils.py,sha256=EyGDwvo1Pe8bqoJl3NFpqK6zizN81lPPaSMBMQF79Dc,2722
|
|
21
21
|
waldiez/exporting/agents/rag_user/qdrant_utils.py,sha256=tn1A7pjQjJfGS33ALgnPYTz7xu8rVBidcc5-WHLq8e8,3487
|
|
@@ -24,7 +24,7 @@ waldiez/exporting/agents/rag_user/vector_db.py,sha256=64Gr_y1VTZLXi1pC4KjChsZ6DT
|
|
|
24
24
|
waldiez/exporting/chats/__init__.py,sha256=v5aR1gWqSN5xeDDMIFo-ceC_Z9UgL8qJZofC2sU8HqQ,296
|
|
25
25
|
waldiez/exporting/chats/chats.py,sha256=xI5ZzWpcqYz8Kuu7B9pU6iHN16wUwHxOvYFhH5vxWuA,1259
|
|
26
26
|
waldiez/exporting/chats/helpers.py,sha256=K-IwBAG4-t7NLBP8Qs8_a2AEoKyoLw_B6eHzgXpOshA,13352
|
|
27
|
-
waldiez/exporting/chats/nested.py,sha256=
|
|
27
|
+
waldiez/exporting/chats/nested.py,sha256=nYzxOTHSBpyFdqvX_NtZUvUgTdmoTZcCRaGTFzdnmII,7916
|
|
28
28
|
waldiez/exporting/flow/__init__.py,sha256=WhdPrjXQAcihrS1KUtPNgbx0y1tqD5HtGykzpEAcsBM,98
|
|
29
29
|
waldiez/exporting/flow/def_main.py,sha256=YpdhqO4iFng3r7if69ZPMJAibPVNDqnrOrWvGw7CJq8,1052
|
|
30
30
|
waldiez/exporting/flow/flow.py,sha256=x2AlXr7aJJfrPMeuXQYfT9sG5GycMwf0kRkovZWKGag,6206
|
|
@@ -33,18 +33,14 @@ waldiez/exporting/skills/__init__.py,sha256=oIA9f5ABtYSbS0kMY_4ovU3-m6meVk5blEu_
|
|
|
33
33
|
waldiez/exporting/utils/__init__.py,sha256=tP1V4g9-MyARlfOEL_1YWMJNW7UivUrrukq7DIwdq6k,1018
|
|
34
34
|
waldiez/exporting/utils/comments.py,sha256=X9j8w48rh3DfFDjiMverU9DBSuE9yuMMbbStxBbN1sE,3190
|
|
35
35
|
waldiez/exporting/utils/importing.py,sha256=dA4HCQ-OxmodUjovgXyLI9IwNvLwbY67P41969XoZ7g,8649
|
|
36
|
-
waldiez/exporting/utils/logging_utils.py,sha256=
|
|
36
|
+
waldiez/exporting/utils/logging_utils.py,sha256=DfnC13PqnadG0nRxz_gHA4IIZGnMawpTPlkKYdGT94w,5864
|
|
37
37
|
waldiez/exporting/utils/method_utils.py,sha256=7-RUMTylNM2W0iM1bPX2_Gn3553XZSl2s2VGEijxNp4,891
|
|
38
38
|
waldiez/exporting/utils/naming.py,sha256=VdoVODQduhXIs9hQFWUVEVqTaSyNDt7rkECsuIgXYwI,3196
|
|
39
39
|
waldiez/exporting/utils/object_string.py,sha256=2kdIu4in3iUV92a2KbLWwp9POhvY-fzF_r2AGVnCKls,2166
|
|
40
|
-
waldiez/exporting/utils/path_check.py,sha256=
|
|
41
|
-
waldiez/io/__init__.py,sha256
|
|
42
|
-
waldiez/io/stream/__init__.py,sha256=6qst5j2iXmV-wDTnhgCna3llqUfJ6tkR0HBq7Vx9x-Q,197
|
|
43
|
-
waldiez/io/stream/consumer.py,sha256=VQDJEomYpGjmAtOoFBJrpCyoYzwykJUIOrdiLn08Uj4,4049
|
|
44
|
-
waldiez/io/stream/provider.py,sha256=xcjtlZeeq7q-9fh0pSKCvAXv8vzPFrqbSGzfZCQoSFw,9607
|
|
45
|
-
waldiez/io/stream/server.py,sha256=G3mUmfyswp6jQZAeqY3eemsuhRns1ls7nsMr27mdT6o,12614
|
|
40
|
+
waldiez/exporting/utils/path_check.py,sha256=aO49sbk6hUHEr65UjNNUSKO5WCGnQitiT733W-kGVtI,1062
|
|
41
|
+
waldiez/io/__init__.py,sha256=-w6ywIjG8ByxGtpSeRt1bjhnP4CZzpHf8WRWckjs4ng,5172
|
|
46
42
|
waldiez/models/__init__.py,sha256=IMq8vzuAgmv92kHSSuZQLF38vVd31ojgOHonuHqWYj0,2888
|
|
47
|
-
waldiez/models/waldiez.py,sha256=
|
|
43
|
+
waldiez/models/waldiez.py,sha256=Oxav9QCYlkfxrNLlcJC89gT0UC4Ls5fTn4kL0PypyGw,9066
|
|
48
44
|
waldiez/models/agents/__init__.py,sha256=3ZyVYBHMFzZjRMIdPrBF6HLg82LPAlEubL6utL6KhfU,1856
|
|
49
45
|
waldiez/models/agents/agents.py,sha256=zIqihnoBjzaQLL_P6FcVoHddcusRNYsWPIFLZD091bE,3641
|
|
50
46
|
waldiez/models/agents/agent/__init__.py,sha256=inA0zV3dnwmcQlcObH_FLaZSURjFG31E_XUampJAnJU,746
|
|
@@ -52,7 +48,7 @@ waldiez/models/agents/agent/agent.py,sha256=DAwreQtIdoM2x_vVccIkALl5whyS07GvfKRU
|
|
|
52
48
|
waldiez/models/agents/agent/agent_data.py,sha256=A3qIvOKyUKBIqqPbsBKVE5JTNQ8JcoDEGMqazNkN_rA,5009
|
|
53
49
|
waldiez/models/agents/agent/code_execution.py,sha256=kgL3pbEEyuMvJid0sIbfe4os7SWKpzL1Bv4O525Biyk,1942
|
|
54
50
|
waldiez/models/agents/agent/linked_skill.py,sha256=8RHWHkHXqFuv7lEe1PuQoK1hTO3kBQ7ILKm9kCEWqNs,667
|
|
55
|
-
waldiez/models/agents/agent/nested_chat.py,sha256=
|
|
51
|
+
waldiez/models/agents/agent/nested_chat.py,sha256=VKzHI38CUCnOlB6oBdO7CJdCk-wmG0aGXIkWpJPa4-Q,1757
|
|
56
52
|
waldiez/models/agents/agent/teachability.py,sha256=IIR4LY9dwx3T7Ok17RYN2g6zGiga2gGizGteaeI3eGs,1703
|
|
57
53
|
waldiez/models/agents/agent/termination_message.py,sha256=aGsIdwGs42BxDktkxoqHGEWM1wzhXr-zh_MlETsbycA,5674
|
|
58
54
|
waldiez/models/agents/assistant/__init__.py,sha256=Zlf-4EI9HXl-LrqGosL7UucoyqIl74GZzohZlRLx2QI,175
|
|
@@ -88,8 +84,8 @@ waldiez/models/model/model_data.py,sha256=pDPKUbltaXWjCuDArgwTOEHw_igfk_DkxzFzdn
|
|
|
88
84
|
waldiez/models/skill/__init__.py,sha256=rU88bajKOGMYoHFcE8MP0jW9H0MswbQmvz5wxS35BYE,169
|
|
89
85
|
waldiez/models/skill/skill.py,sha256=fhsAI413an2_d4DBIkf7dzEuWk6rGs2t4sl97a4dj20,3473
|
|
90
86
|
waldiez/models/skill/skill_data.py,sha256=RTWn8Od6w7g-nRIpsS29sqZ8sPm5dCPiK7-qXmU-KD4,815
|
|
91
|
-
waldiez-0.1.
|
|
92
|
-
waldiez-0.1.
|
|
93
|
-
waldiez-0.1.
|
|
94
|
-
waldiez-0.1.
|
|
95
|
-
waldiez-0.1.
|
|
87
|
+
waldiez-0.1.9.dist-info/METADATA,sha256=tCHxrAXmDgRKloonwepcZQO-9X4MXYpQ5Hq523L4NEY,8679
|
|
88
|
+
waldiez-0.1.9.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
89
|
+
waldiez-0.1.9.dist-info/entry_points.txt,sha256=5Po4yQXPa_QEdtTevpEBgr3rGoIvDMeQuJR2zqwBLBo,45
|
|
90
|
+
waldiez-0.1.9.dist-info/licenses/LICENSE,sha256=VQEHM6WMQLRu1qaGl3GWsoOknDwro-69eGo4NLIJPIM,1064
|
|
91
|
+
waldiez-0.1.9.dist-info/RECORD,,
|
waldiez/io/stream/__init__.py
DELETED
waldiez/io/stream/consumer.py
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"""TCP socket input consumer.
|
|
2
|
-
|
|
3
|
-
It connects to a TCP server,
|
|
4
|
-
listens for `INPUT:` messages to get the user's input,
|
|
5
|
-
and sends `REQUEST:` messages to prompt the user,
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import socket
|
|
9
|
-
import time
|
|
10
|
-
from types import TracebackType
|
|
11
|
-
from typing import Optional, Type
|
|
12
|
-
|
|
13
|
-
END_OF_MESSAGE = b"\r\n"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class TCPConsumer:
|
|
17
|
-
"""TCP socket input consumer."""
|
|
18
|
-
|
|
19
|
-
def __init__(
|
|
20
|
-
self, host: str, port: int, timeout: Optional[float] = None
|
|
21
|
-
) -> None:
|
|
22
|
-
"""Create a new input consumer.
|
|
23
|
-
|
|
24
|
-
Parameters
|
|
25
|
-
----------
|
|
26
|
-
host : str
|
|
27
|
-
The host to connect to.
|
|
28
|
-
port : int
|
|
29
|
-
The port to connect to.
|
|
30
|
-
timeout : float, optional
|
|
31
|
-
The timeout for the consumer, by default None (no timeout).
|
|
32
|
-
"""
|
|
33
|
-
self.host = host
|
|
34
|
-
self.port = port
|
|
35
|
-
self.timeout = timeout
|
|
36
|
-
self._running = False
|
|
37
|
-
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
|
|
38
|
-
|
|
39
|
-
def __enter__(self) -> "TCPConsumer":
|
|
40
|
-
"""Enter the context."""
|
|
41
|
-
self.start()
|
|
42
|
-
return self
|
|
43
|
-
|
|
44
|
-
def __exit__(
|
|
45
|
-
self,
|
|
46
|
-
exc_type: Optional[Type[BaseException]],
|
|
47
|
-
exc_value: Optional[BaseException],
|
|
48
|
-
traceback: Optional[TracebackType],
|
|
49
|
-
) -> None:
|
|
50
|
-
"""Exit the context."""
|
|
51
|
-
self.stop()
|
|
52
|
-
|
|
53
|
-
def is_running(self) -> bool:
|
|
54
|
-
"""Check if the consumer is running.
|
|
55
|
-
|
|
56
|
-
Returns
|
|
57
|
-
-------
|
|
58
|
-
bool
|
|
59
|
-
True is the consumer is running, else False
|
|
60
|
-
"""
|
|
61
|
-
return self._running
|
|
62
|
-
|
|
63
|
-
def start(self) -> None:
|
|
64
|
-
"""Start the consumer."""
|
|
65
|
-
if self._running:
|
|
66
|
-
return
|
|
67
|
-
self._running = True
|
|
68
|
-
self.socket.connect((self.host, self.port))
|
|
69
|
-
self.socket.sendall("CONSUMER\r\n".encode("utf-8"))
|
|
70
|
-
|
|
71
|
-
def _get_response_no_timeout(self) -> Optional[str]:
|
|
72
|
-
"""Get the response."""
|
|
73
|
-
data = self.socket.recv(1024)
|
|
74
|
-
while not data.endswith(END_OF_MESSAGE):
|
|
75
|
-
data += self.socket.recv(1024)
|
|
76
|
-
if data.startswith(b"INPUT:"):
|
|
77
|
-
response = data[len(b"INPUT:") :]
|
|
78
|
-
if response.endswith(END_OF_MESSAGE):
|
|
79
|
-
response = response[: -len(END_OF_MESSAGE)]
|
|
80
|
-
return response.decode("utf-8")
|
|
81
|
-
return None
|
|
82
|
-
|
|
83
|
-
def _get_response_with_timeout(self, timeout: float) -> Optional[str]:
|
|
84
|
-
"""Get the response using a timeout."""
|
|
85
|
-
start_time = time.monotonic()
|
|
86
|
-
data = b""
|
|
87
|
-
self.socket.settimeout(timeout)
|
|
88
|
-
while time.monotonic() - start_time < timeout:
|
|
89
|
-
try:
|
|
90
|
-
data += self.socket.recv(1024)
|
|
91
|
-
except TimeoutError:
|
|
92
|
-
return None
|
|
93
|
-
if data.endswith(END_OF_MESSAGE):
|
|
94
|
-
break
|
|
95
|
-
if not data:
|
|
96
|
-
return None
|
|
97
|
-
if data.startswith(b"INPUT:"):
|
|
98
|
-
response = data[len(b"INPUT:") :]
|
|
99
|
-
if response.endswith(END_OF_MESSAGE):
|
|
100
|
-
response = response[: -len(END_OF_MESSAGE)]
|
|
101
|
-
return response.decode("utf-8")
|
|
102
|
-
return None
|
|
103
|
-
|
|
104
|
-
def get_response(self) -> Optional[str]:
|
|
105
|
-
"""Get the response.
|
|
106
|
-
|
|
107
|
-
Returns
|
|
108
|
-
-------
|
|
109
|
-
Optional[str]
|
|
110
|
-
The response if available, None otherwise.
|
|
111
|
-
"""
|
|
112
|
-
if not self._running:
|
|
113
|
-
self.start()
|
|
114
|
-
if self.timeout is None or self.timeout < 1:
|
|
115
|
-
return self._get_response_no_timeout()
|
|
116
|
-
return self._get_response_with_timeout(self.timeout)
|
|
117
|
-
|
|
118
|
-
def send_prompt(self, prompt: str) -> None:
|
|
119
|
-
"""Send a prompt.
|
|
120
|
-
|
|
121
|
-
Parameters
|
|
122
|
-
----------
|
|
123
|
-
prompt : str
|
|
124
|
-
The prompt to send.
|
|
125
|
-
"""
|
|
126
|
-
if not self._running:
|
|
127
|
-
self.start()
|
|
128
|
-
message = f"REQUEST:{prompt}" + "\r\n"
|
|
129
|
-
self.socket.sendall(message.encode("utf-8"))
|
|
130
|
-
|
|
131
|
-
def stop(self) -> None:
|
|
132
|
-
"""Close the consumer."""
|
|
133
|
-
try:
|
|
134
|
-
self.socket.close()
|
|
135
|
-
except OSError:
|
|
136
|
-
pass
|
|
137
|
-
del self.socket
|
|
138
|
-
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
|
|
139
|
-
self._running = False
|