waldiez 0.6.0__py3-none-any.whl → 0.6.1__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/__init__.py +1 -1
- waldiez/_version.py +1 -1
- waldiez/cli.py +18 -7
- waldiez/cli_extras/jupyter.py +3 -0
- waldiez/cli_extras/runner.py +3 -1
- waldiez/cli_extras/studio.py +3 -1
- waldiez/exporter.py +9 -3
- waldiez/exporting/agent/exporter.py +9 -10
- waldiez/exporting/agent/extras/captain_agent_extras.py +6 -6
- waldiez/exporting/agent/extras/doc_agent_extras.py +6 -6
- waldiez/exporting/agent/extras/group_manager_agent_extas.py +34 -23
- waldiez/exporting/agent/extras/group_member_extras.py +6 -5
- waldiez/exporting/agent/extras/handoffs/after_work.py +1 -1
- waldiez/exporting/agent/extras/handoffs/available.py +1 -1
- waldiez/exporting/agent/extras/handoffs/condition.py +3 -2
- waldiez/exporting/agent/extras/handoffs/handoff.py +1 -1
- waldiez/exporting/agent/extras/handoffs/target.py +6 -4
- waldiez/exporting/agent/extras/rag/chroma_extras.py +27 -19
- waldiez/exporting/agent/extras/rag/mongo_extras.py +8 -8
- waldiez/exporting/agent/extras/rag/pgvector_extras.py +5 -5
- waldiez/exporting/agent/extras/rag/qdrant_extras.py +5 -4
- waldiez/exporting/agent/extras/rag/vector_db_extras.py +1 -1
- waldiez/exporting/agent/extras/rag_user_proxy_agent_extras.py +5 -7
- waldiez/exporting/agent/extras/reasoning_agent_extras.py +3 -5
- waldiez/exporting/chats/exporter.py +4 -4
- waldiez/exporting/chats/processor.py +1 -2
- waldiez/exporting/chats/utils/common.py +89 -48
- waldiez/exporting/chats/utils/group.py +9 -9
- waldiez/exporting/chats/utils/nested.py +7 -7
- waldiez/exporting/chats/utils/sequential.py +1 -1
- waldiez/exporting/chats/utils/single.py +2 -2
- waldiez/exporting/core/content.py +7 -7
- waldiez/exporting/core/context.py +5 -3
- waldiez/exporting/core/exporter.py +5 -3
- waldiez/exporting/core/exporters.py +2 -2
- waldiez/exporting/core/extras/agent_extras/captain_extras.py +2 -2
- waldiez/exporting/core/extras/agent_extras/group_manager_extras.py +2 -2
- waldiez/exporting/core/extras/agent_extras/rag_user_extras.py +2 -2
- waldiez/exporting/core/extras/agent_extras/standard_extras.py +3 -8
- waldiez/exporting/core/extras/base.py +7 -5
- waldiez/exporting/core/extras/flow_extras.py +4 -5
- waldiez/exporting/core/extras/model_extras.py +2 -2
- waldiez/exporting/core/extras/path_resolver.py +1 -2
- waldiez/exporting/core/extras/serializer.py +2 -2
- waldiez/exporting/core/protocols.py +6 -5
- waldiez/exporting/core/result.py +25 -28
- waldiez/exporting/core/types.py +10 -10
- waldiez/exporting/core/utils/llm_config.py +2 -2
- waldiez/exporting/core/validation.py +10 -11
- waldiez/exporting/flow/execution_generator.py +98 -10
- waldiez/exporting/flow/exporter.py +2 -2
- waldiez/exporting/flow/factory.py +2 -2
- waldiez/exporting/flow/file_generator.py +4 -2
- waldiez/exporting/flow/merger.py +5 -3
- waldiez/exporting/flow/orchestrator.py +72 -2
- waldiez/exporting/flow/utils/common.py +5 -5
- waldiez/exporting/flow/utils/importing.py +6 -7
- waldiez/exporting/flow/utils/linting.py +25 -9
- waldiez/exporting/flow/utils/logging.py +2 -2
- waldiez/exporting/models/exporter.py +8 -8
- waldiez/exporting/models/processor.py +5 -5
- waldiez/exporting/tools/exporter.py +2 -2
- waldiez/exporting/tools/processor.py +7 -4
- waldiez/io/__init__.py +8 -4
- waldiez/io/_ws.py +10 -6
- waldiez/io/models/constants.py +10 -10
- waldiez/io/models/content/audio.py +1 -0
- waldiez/io/models/content/base.py +20 -18
- waldiez/io/models/content/file.py +1 -0
- waldiez/io/models/content/image.py +1 -0
- waldiez/io/models/content/text.py +1 -0
- waldiez/io/models/content/video.py +1 -0
- waldiez/io/models/user_input.py +10 -5
- waldiez/io/models/user_response.py +17 -16
- waldiez/io/mqtt.py +18 -31
- waldiez/io/redis.py +18 -22
- waldiez/io/structured.py +52 -53
- waldiez/io/utils.py +3 -0
- waldiez/io/ws.py +5 -1
- waldiez/logger.py +16 -3
- waldiez/models/agents/__init__.py +3 -0
- waldiez/models/agents/agent/agent.py +23 -16
- waldiez/models/agents/agent/agent_data.py +25 -22
- waldiez/models/agents/agent/code_execution.py +9 -11
- waldiez/models/agents/agent/termination_message.py +10 -12
- waldiez/models/agents/agent/update_system_message.py +2 -4
- waldiez/models/agents/agents.py +8 -8
- waldiez/models/agents/assistant/assistant.py +6 -3
- waldiez/models/agents/assistant/assistant_data.py +2 -2
- waldiez/models/agents/captain/captain_agent.py +7 -4
- waldiez/models/agents/captain/captain_agent_data.py +5 -7
- waldiez/models/agents/doc_agent/doc_agent.py +7 -4
- waldiez/models/agents/doc_agent/doc_agent_data.py +9 -10
- waldiez/models/agents/doc_agent/rag_query_engine.py +10 -12
- waldiez/models/agents/extra_requirements.py +3 -3
- waldiez/models/agents/group_manager/group_manager.py +12 -7
- waldiez/models/agents/group_manager/group_manager_data.py +13 -12
- waldiez/models/agents/group_manager/speakers.py +17 -19
- waldiez/models/agents/rag_user_proxy/rag_user_proxy.py +7 -4
- waldiez/models/agents/rag_user_proxy/rag_user_proxy_data.py +4 -1
- waldiez/models/agents/rag_user_proxy/retrieve_config.py +69 -63
- waldiez/models/agents/rag_user_proxy/vector_db_config.py +19 -19
- waldiez/models/agents/reasoning/reasoning_agent.py +7 -4
- waldiez/models/agents/reasoning/reasoning_agent_data.py +3 -2
- waldiez/models/agents/reasoning/reasoning_agent_reason_config.py +8 -8
- waldiez/models/agents/user_proxy/user_proxy.py +6 -3
- waldiez/models/agents/user_proxy/user_proxy_data.py +1 -1
- waldiez/models/chat/chat.py +27 -20
- waldiez/models/chat/chat_data.py +22 -19
- waldiez/models/chat/chat_message.py +9 -9
- waldiez/models/chat/chat_nested.py +9 -9
- waldiez/models/chat/chat_summary.py +6 -6
- waldiez/models/common/__init__.py +2 -0
- waldiez/models/common/ag2_version.py +2 -0
- waldiez/models/common/dict_utils.py +8 -6
- waldiez/models/common/handoff.py +18 -17
- waldiez/models/common/method_utils.py +7 -7
- waldiez/models/common/naming.py +49 -0
- waldiez/models/flow/flow.py +11 -6
- waldiez/models/flow/flow_data.py +23 -17
- waldiez/models/flow/info.py +3 -3
- waldiez/models/flow/naming.py +2 -1
- waldiez/models/model/_aws.py +11 -13
- waldiez/models/model/_llm.py +5 -0
- waldiez/models/model/_price.py +2 -4
- waldiez/models/model/extra_requirements.py +1 -3
- waldiez/models/model/model.py +2 -2
- waldiez/models/model/model_data.py +21 -21
- waldiez/models/tool/extra_requirements.py +2 -4
- waldiez/models/tool/predefined/_duckduckgo.py +1 -0
- waldiez/models/tool/predefined/_email.py +1 -0
- waldiez/models/tool/predefined/_google.py +1 -0
- waldiez/models/tool/predefined/_perplexity.py +1 -0
- waldiez/models/tool/predefined/_searxng.py +1 -0
- waldiez/models/tool/predefined/_tavily.py +1 -0
- waldiez/models/tool/predefined/_wikipedia.py +1 -0
- waldiez/models/tool/predefined/_youtube.py +1 -0
- waldiez/models/tool/tool.py +8 -5
- waldiez/models/tool/tool_data.py +2 -2
- waldiez/models/waldiez.py +152 -4
- waldiez/runner.py +11 -5
- waldiez/running/async_utils.py +192 -0
- waldiez/running/base_runner.py +117 -264
- waldiez/running/dir_utils.py +52 -0
- waldiez/running/environment.py +10 -44
- waldiez/running/events_mixin.py +252 -0
- waldiez/running/exceptions.py +20 -0
- waldiez/running/gen_seq_diagram.py +18 -15
- waldiez/running/io_utils.py +216 -0
- waldiez/running/protocol.py +11 -5
- waldiez/running/requirements_mixin.py +65 -0
- waldiez/running/results_mixin.py +926 -0
- waldiez/running/standard_runner.py +22 -25
- waldiez/running/step_by_step/breakpoints_mixin.py +192 -60
- waldiez/running/step_by_step/command_handler.py +3 -0
- waldiez/running/step_by_step/events_processor.py +194 -14
- waldiez/running/step_by_step/step_by_step_models.py +110 -43
- waldiez/running/step_by_step/step_by_step_runner.py +107 -57
- waldiez/running/subprocess_runner/__base__.py +9 -1
- waldiez/running/subprocess_runner/_async_runner.py +5 -3
- waldiez/running/subprocess_runner/_sync_runner.py +6 -2
- waldiez/running/subprocess_runner/runner.py +39 -23
- waldiez/running/timeline_processor.py +1 -1
- waldiez/utils/__init__.py +2 -0
- waldiez/utils/conflict_checker.py +4 -4
- waldiez/utils/python_manager.py +415 -0
- waldiez/ws/_file_handler.py +18 -18
- waldiez/ws/_mock.py +2 -1
- waldiez/ws/cli.py +36 -12
- waldiez/ws/client_manager.py +35 -27
- waldiez/ws/errors.py +3 -0
- waldiez/ws/models.py +43 -52
- waldiez/ws/reloader.py +12 -4
- waldiez/ws/server.py +85 -55
- waldiez/ws/session_manager.py +8 -9
- waldiez/ws/session_stats.py +1 -1
- waldiez/ws/utils.py +4 -1
- {waldiez-0.6.0.dist-info → waldiez-0.6.1.dist-info}/METADATA +82 -93
- waldiez-0.6.1.dist-info/RECORD +254 -0
- waldiez/running/post_run.py +0 -186
- waldiez/running/pre_run.py +0 -281
- waldiez/running/run_results.py +0 -14
- waldiez/running/utils.py +0 -625
- waldiez-0.6.0.dist-info/RECORD +0 -251
- {waldiez-0.6.0.dist-info → waldiez-0.6.1.dist-info}/WHEEL +0 -0
- {waldiez-0.6.0.dist-info → waldiez-0.6.1.dist-info}/entry_points.txt +0 -0
- {waldiez-0.6.0.dist-info → waldiez-0.6.1.dist-info}/licenses/LICENSE +0 -0
- {waldiez-0.6.0.dist-info → waldiez-0.6.1.dist-info}/licenses/NOTICE.md +0 -0
waldiez/running/pre_run.py
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
# SPDX-License-Identifier: Apache-2.0.
|
|
2
|
-
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
-
"""Actions to perform before running the flow."""
|
|
4
|
-
|
|
5
|
-
import asyncio
|
|
6
|
-
import io
|
|
7
|
-
import os
|
|
8
|
-
import subprocess
|
|
9
|
-
import sys
|
|
10
|
-
import tempfile
|
|
11
|
-
from pathlib import Path
|
|
12
|
-
from typing import Callable
|
|
13
|
-
|
|
14
|
-
from waldiez.models import Waldiez
|
|
15
|
-
|
|
16
|
-
from .environment import in_virtualenv, is_root
|
|
17
|
-
from .utils import (
|
|
18
|
-
ensure_pip,
|
|
19
|
-
get_pip_install_location,
|
|
20
|
-
get_python_executable,
|
|
21
|
-
safe_filename,
|
|
22
|
-
strip_ansi,
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class RequirementsMixin:
|
|
27
|
-
"""Mixin class to handle requirements installation."""
|
|
28
|
-
|
|
29
|
-
_waldiez: Waldiez
|
|
30
|
-
_called_install_requirements: bool
|
|
31
|
-
|
|
32
|
-
def gather_requirements(self) -> set[str]:
|
|
33
|
-
"""Gather extra requirements to install before running the flow.
|
|
34
|
-
|
|
35
|
-
Returns
|
|
36
|
-
-------
|
|
37
|
-
set[str]
|
|
38
|
-
A set of requirements that are not already installed and do not
|
|
39
|
-
include 'waldiez' in their name.
|
|
40
|
-
"""
|
|
41
|
-
extra_requirements = {
|
|
42
|
-
req
|
|
43
|
-
for req in self._waldiez.requirements
|
|
44
|
-
if req not in sys.modules and "waldiez" not in req
|
|
45
|
-
}
|
|
46
|
-
if "python-dotenv" not in extra_requirements: # pragma: no branch
|
|
47
|
-
extra_requirements.add("python-dotenv")
|
|
48
|
-
return extra_requirements
|
|
49
|
-
|
|
50
|
-
def install_requirements(self) -> None:
|
|
51
|
-
"""Install the requirements for the flow."""
|
|
52
|
-
if not self._called_install_requirements: # pragma: no branch
|
|
53
|
-
self._called_install_requirements = True
|
|
54
|
-
extra_requirements = self.gather_requirements()
|
|
55
|
-
if extra_requirements: # pragma: no branch
|
|
56
|
-
install_requirements(extra_requirements)
|
|
57
|
-
|
|
58
|
-
async def a_install_requirements(self) -> None:
|
|
59
|
-
"""Install the requirements for the flow asynchronously."""
|
|
60
|
-
if not self._called_install_requirements: # pragma: no branch
|
|
61
|
-
self._called_install_requirements = True
|
|
62
|
-
extra_requirements = self.gather_requirements()
|
|
63
|
-
if extra_requirements: # pragma: no branch
|
|
64
|
-
await a_install_requirements(extra_requirements)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
# noinspection PyUnresolvedReferences
|
|
68
|
-
def install_requirements(
|
|
69
|
-
extra_requirements: set[str],
|
|
70
|
-
upgrade: bool = False,
|
|
71
|
-
printer: Callable[..., None] = print,
|
|
72
|
-
) -> None:
|
|
73
|
-
"""Install the requirements.
|
|
74
|
-
|
|
75
|
-
Parameters
|
|
76
|
-
----------
|
|
77
|
-
extra_requirements : set[str]
|
|
78
|
-
The extra requirements.
|
|
79
|
-
upgrade : bool, optional
|
|
80
|
-
Whether to upgrade the requirements, by default False.
|
|
81
|
-
printer : Callable[..., None]
|
|
82
|
-
The printer function to use, defaults to print.
|
|
83
|
-
"""
|
|
84
|
-
requirements_string = ", ".join(extra_requirements)
|
|
85
|
-
printer(f"Installing requirements: {requirements_string}")
|
|
86
|
-
ensure_pip()
|
|
87
|
-
pip_install, break_system_packages, install_location = _before_pip(
|
|
88
|
-
extra_requirements, upgrade
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
# pylint: disable=too-many-try-statements,broad-exception-caught
|
|
92
|
-
try:
|
|
93
|
-
with subprocess.Popen(
|
|
94
|
-
pip_install,
|
|
95
|
-
stdout=subprocess.PIPE,
|
|
96
|
-
stderr=subprocess.PIPE,
|
|
97
|
-
) as proc:
|
|
98
|
-
if proc.stdout: # pragma: no branch
|
|
99
|
-
for line in io.TextIOWrapper(proc.stdout, encoding="utf-8"):
|
|
100
|
-
stripped_line = strip_ansi(line.strip())
|
|
101
|
-
if stripped_line: # Only print non-empty lines
|
|
102
|
-
printer(stripped_line)
|
|
103
|
-
if proc.stderr: # pragma: no branch
|
|
104
|
-
for line in io.TextIOWrapper(proc.stderr, encoding="utf-8"):
|
|
105
|
-
stripped_line = strip_ansi(line.strip())
|
|
106
|
-
if stripped_line: # Only print non-empty lines
|
|
107
|
-
printer(stripped_line)
|
|
108
|
-
|
|
109
|
-
# Wait for process to complete and check return code
|
|
110
|
-
return_code = proc.wait()
|
|
111
|
-
if return_code != 0:
|
|
112
|
-
printer(
|
|
113
|
-
f"Package installation failed with exit code {return_code}"
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
except Exception as e:
|
|
117
|
-
printer(f"Failed to install requirements: {e}")
|
|
118
|
-
finally:
|
|
119
|
-
_after_pip(break_system_packages, install_location)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
async def a_install_requirements(
|
|
123
|
-
extra_requirements: set[str],
|
|
124
|
-
upgrade: bool = False,
|
|
125
|
-
printer: Callable[..., None] = print,
|
|
126
|
-
) -> None:
|
|
127
|
-
"""Install the requirements asynchronously.
|
|
128
|
-
|
|
129
|
-
Parameters
|
|
130
|
-
----------
|
|
131
|
-
extra_requirements : set[str]
|
|
132
|
-
The extra requirements.
|
|
133
|
-
upgrade : bool, optional
|
|
134
|
-
Whether to upgrade the requirements, by default False.
|
|
135
|
-
printer : Callable[..., None]
|
|
136
|
-
The printer function to use, defaults to print.
|
|
137
|
-
"""
|
|
138
|
-
pip_install, break_system_packages, install_location = _before_pip(
|
|
139
|
-
extra_requirements, upgrade=upgrade
|
|
140
|
-
)
|
|
141
|
-
requirements_string = ", ".join(extra_requirements)
|
|
142
|
-
printer(f"Installing requirements: {requirements_string}")
|
|
143
|
-
# pylint: disable=too-many-try-statements,broad-exception-caught
|
|
144
|
-
try:
|
|
145
|
-
proc = await asyncio.create_subprocess_exec(
|
|
146
|
-
*pip_install,
|
|
147
|
-
stdout=asyncio.subprocess.PIPE,
|
|
148
|
-
stderr=asyncio.subprocess.PIPE,
|
|
149
|
-
)
|
|
150
|
-
|
|
151
|
-
async def _pump_stream(stream: asyncio.StreamReader | None) -> None:
|
|
152
|
-
if not stream:
|
|
153
|
-
return
|
|
154
|
-
async for raw in stream:
|
|
155
|
-
text = strip_ansi(raw.decode().rstrip())
|
|
156
|
-
if text:
|
|
157
|
-
printer(text)
|
|
158
|
-
|
|
159
|
-
# Create tasks for concurrent execution
|
|
160
|
-
tasks: list[asyncio.Task[int | None]] = [
|
|
161
|
-
asyncio.create_task(_pump_stream(proc.stdout)),
|
|
162
|
-
asyncio.create_task(_pump_stream(proc.stderr)),
|
|
163
|
-
asyncio.create_task(proc.wait()),
|
|
164
|
-
]
|
|
165
|
-
await asyncio.gather(*tasks, return_exceptions=True)
|
|
166
|
-
if proc.returncode != 0:
|
|
167
|
-
printer(
|
|
168
|
-
f"Package installation failed with exit code {proc.returncode}"
|
|
169
|
-
)
|
|
170
|
-
|
|
171
|
-
except Exception as e:
|
|
172
|
-
printer(f"Failed to install requirements: {e}")
|
|
173
|
-
finally:
|
|
174
|
-
_after_pip(break_system_packages, install_location)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
def _before_pip(
|
|
178
|
-
packages: set[str],
|
|
179
|
-
upgrade: bool,
|
|
180
|
-
) -> tuple[list[str], str, str | None]:
|
|
181
|
-
"""Gather the pip command for installing requirements.
|
|
182
|
-
|
|
183
|
-
Parameters
|
|
184
|
-
----------
|
|
185
|
-
packages : set[str]
|
|
186
|
-
The packages to install.
|
|
187
|
-
upgrade : bool
|
|
188
|
-
Whether to upgrade the packages.
|
|
189
|
-
|
|
190
|
-
Returns
|
|
191
|
-
-------
|
|
192
|
-
tuple[list[str], str, str | None]
|
|
193
|
-
The pip command, break_system_packages flag, and install location.
|
|
194
|
-
"""
|
|
195
|
-
ensure_pip()
|
|
196
|
-
pip_install = [
|
|
197
|
-
get_python_executable(),
|
|
198
|
-
"-m",
|
|
199
|
-
"pip",
|
|
200
|
-
"install",
|
|
201
|
-
"--disable-pip-version-check",
|
|
202
|
-
"--no-input",
|
|
203
|
-
]
|
|
204
|
-
install_location = get_pip_install_location()
|
|
205
|
-
break_system_packages = ""
|
|
206
|
-
|
|
207
|
-
if install_location:
|
|
208
|
-
pip_install += ["--target", install_location]
|
|
209
|
-
elif not in_virtualenv(): # it should # pragma: no cover
|
|
210
|
-
# if not, let's try to install as user
|
|
211
|
-
# not sure if --break-system-packages is safe,
|
|
212
|
-
# but it might fail if we don't
|
|
213
|
-
break_system_packages = os.environ.get("PIP_BREAK_SYSTEM_PACKAGES", "")
|
|
214
|
-
os.environ["PIP_BREAK_SYSTEM_PACKAGES"] = "1"
|
|
215
|
-
if not is_root():
|
|
216
|
-
pip_install.append("--user")
|
|
217
|
-
|
|
218
|
-
if upgrade: # pragma: no cover
|
|
219
|
-
pip_install.append("--upgrade")
|
|
220
|
-
|
|
221
|
-
pip_install.extend(packages)
|
|
222
|
-
return pip_install, break_system_packages, install_location
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
def _after_pip(
|
|
226
|
-
break_system_packages: str, install_location: str | None
|
|
227
|
-
) -> None:
|
|
228
|
-
"""Restore environment variables after pip installation.
|
|
229
|
-
|
|
230
|
-
Parameters
|
|
231
|
-
----------
|
|
232
|
-
break_system_packages : str
|
|
233
|
-
The original value of PIP_BREAK_SYSTEM_PACKAGES.
|
|
234
|
-
install_location : str | None
|
|
235
|
-
The install location used (None if default).
|
|
236
|
-
"""
|
|
237
|
-
if install_location is None and not in_virtualenv(): # pragma: no cover
|
|
238
|
-
# restore the old env var
|
|
239
|
-
if break_system_packages:
|
|
240
|
-
os.environ["PIP_BREAK_SYSTEM_PACKAGES"] = break_system_packages
|
|
241
|
-
else:
|
|
242
|
-
# Use pop to avoid KeyError if the key doesn't exist
|
|
243
|
-
os.environ.pop("PIP_BREAK_SYSTEM_PACKAGES", None)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
def dump_waldiez(waldiez: Waldiez, output_path: str | Path | None) -> Path:
|
|
247
|
-
"""Dump waldiez flow to a file.
|
|
248
|
-
|
|
249
|
-
Parameters
|
|
250
|
-
----------
|
|
251
|
-
waldiez : Waldiez
|
|
252
|
-
The waldiez instance to dump.
|
|
253
|
-
output_path : str | Path | None
|
|
254
|
-
Optional output path to determine the directory to save the flow to.
|
|
255
|
-
|
|
256
|
-
Returns
|
|
257
|
-
-------
|
|
258
|
-
Path
|
|
259
|
-
The path to the generated file.
|
|
260
|
-
"""
|
|
261
|
-
file_path = Path(output_path) if output_path else None
|
|
262
|
-
if file_path:
|
|
263
|
-
file_name = file_path.name
|
|
264
|
-
if not file_name.endswith(".waldiez"):
|
|
265
|
-
file_path.with_suffix(".waldiez")
|
|
266
|
-
|
|
267
|
-
else:
|
|
268
|
-
full_name = waldiez.name
|
|
269
|
-
file_name = safe_filename(full_name, "waldiez")
|
|
270
|
-
file_dir: Path
|
|
271
|
-
if file_path:
|
|
272
|
-
file_dir = file_path if file_path.is_dir() else file_path.parent
|
|
273
|
-
else:
|
|
274
|
-
file_dir = Path(tempfile.mkdtemp())
|
|
275
|
-
file_dir.mkdir(parents=True, exist_ok=True)
|
|
276
|
-
output_path = file_dir / file_name
|
|
277
|
-
with output_path.open(
|
|
278
|
-
"w", encoding="utf-8", errors="replace", newline="\n"
|
|
279
|
-
) as f_open:
|
|
280
|
-
f_open.write(waldiez.model_dump_json())
|
|
281
|
-
return output_path
|
waldiez/running/run_results.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# SPDX-License-Identifier: Apache-2.0.
|
|
2
|
-
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
-
|
|
4
|
-
"""Waldiez run results module."""
|
|
5
|
-
|
|
6
|
-
from typing import Any, TypedDict
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class WaldiezRunResults(TypedDict):
|
|
10
|
-
"""Results of the Waldiez run."""
|
|
11
|
-
|
|
12
|
-
results: list[dict[str, Any]]
|
|
13
|
-
exception: BaseException | None
|
|
14
|
-
completed: bool
|