waldiez 0.5.1__py3-none-any.whl → 0.5.3__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/cli.py +2 -0
- waldiez/exporting/agent/extras/group_manager_agent_extas.py +5 -1
- waldiez/exporting/chats/processor.py +4 -4
- waldiez/exporting/chats/utils/group.py +4 -4
- waldiez/exporting/chats/utils/single.py +3 -3
- waldiez/exporting/tools/exporter.py +1 -1
- waldiez/models/chat/chat_message.py +1 -1
- waldiez/models/tool/extra_requirements.py +5 -0
- waldiez/models/tool/predefined/__init__.py +24 -0
- waldiez/models/tool/predefined/_config.py +68 -0
- waldiez/models/tool/predefined/_google.py +166 -0
- waldiez/models/tool/predefined/_tavily.py +124 -0
- waldiez/models/tool/predefined/_wikipedia.py +130 -0
- waldiez/models/tool/predefined/_youtube.py +123 -0
- waldiez/models/tool/predefined/protocol.py +85 -0
- waldiez/models/tool/predefined/registry.py +79 -0
- waldiez/models/tool/tool.py +96 -13
- waldiez/models/tool/tool_data.py +12 -0
- waldiez/models/tool/tool_type.py +3 -1
- waldiez/runner.py +35 -2
- waldiez/running/base_runner.py +38 -8
- waldiez/running/environment.py +32 -12
- waldiez/running/import_runner.py +13 -0
- waldiez/running/post_run.py +71 -14
- waldiez/running/pre_run.py +42 -0
- waldiez/running/protocol.py +6 -0
- waldiez/running/subprocess_runner.py +4 -0
- waldiez/running/timeline_processor.py +1248 -0
- waldiez/utils/version.py +12 -1
- {waldiez-0.5.1.dist-info → waldiez-0.5.3.dist-info}/METADATA +39 -38
- {waldiez-0.5.1.dist-info → waldiez-0.5.3.dist-info}/RECORD +36 -27
- {waldiez-0.5.1.dist-info → waldiez-0.5.3.dist-info}/WHEEL +0 -0
- {waldiez-0.5.1.dist-info → waldiez-0.5.3.dist-info}/entry_points.txt +0 -0
- {waldiez-0.5.1.dist-info → waldiez-0.5.3.dist-info}/licenses/LICENSE +0 -0
- {waldiez-0.5.1.dist-info → waldiez-0.5.3.dist-info}/licenses/NOTICE.md +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0.
|
|
2
|
+
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
"""Predefined YouTube search tool for Waldiez."""
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from ._config import PredefinedToolConfig
|
|
9
|
+
from .protocol import PredefinedTool
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class YouTubeSearchToolImpl(PredefinedTool):
|
|
13
|
+
"""YouTube search tool for Waldiez."""
|
|
14
|
+
|
|
15
|
+
required_secrets: list[str] = ["YOUTUBE_API_KEY"]
|
|
16
|
+
required_kwargs: dict[str, type] = {
|
|
17
|
+
"youtube_search_engine_id": str,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def name(self) -> str:
|
|
22
|
+
"""Tool name."""
|
|
23
|
+
return "youtube_search"
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def description(self) -> str:
|
|
27
|
+
"""Tool description."""
|
|
28
|
+
return "Search YouTube for a given query."
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def kwargs(self) -> dict[str, Any]:
|
|
32
|
+
"""Keyword arguments for the tool, used for initialization."""
|
|
33
|
+
return {}
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def requirements(self) -> list[str]:
|
|
37
|
+
"""Python requirements for the tool."""
|
|
38
|
+
return ["ag2[google-search, openai]"]
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def tags(self) -> list[str]:
|
|
42
|
+
"""Tags for the tool, used for categorization."""
|
|
43
|
+
return ["youtube", "search", "video", "reference"]
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def tool_imports(self) -> list[str]:
|
|
47
|
+
"""Imports required for the tool implementation."""
|
|
48
|
+
return [
|
|
49
|
+
"from autogen.tools.experimental import YoutubeSearchTool",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
def validate_secrets(self, secrets: dict[str, str]) -> list[str]:
|
|
53
|
+
"""Validate secrets and return list of missing required ones.
|
|
54
|
+
|
|
55
|
+
Parameters
|
|
56
|
+
----------
|
|
57
|
+
secrets : dict[str, str]
|
|
58
|
+
Dictionary of secrets/environment variables.
|
|
59
|
+
|
|
60
|
+
Returns
|
|
61
|
+
-------
|
|
62
|
+
list[str]
|
|
63
|
+
List of missing required secrets.
|
|
64
|
+
"""
|
|
65
|
+
missing: list[str] = []
|
|
66
|
+
for secret in self.required_secrets:
|
|
67
|
+
if secret not in secrets:
|
|
68
|
+
missing.append(secret)
|
|
69
|
+
return missing
|
|
70
|
+
|
|
71
|
+
def validate_kwargs(self, kwargs: dict[str, Any]) -> list[str]:
|
|
72
|
+
"""Validate keyword arguments and return list of missing required ones.
|
|
73
|
+
|
|
74
|
+
Parameters
|
|
75
|
+
----------
|
|
76
|
+
kwargs : dict[str, Any]
|
|
77
|
+
Dictionary of keyword arguments.
|
|
78
|
+
|
|
79
|
+
Returns
|
|
80
|
+
-------
|
|
81
|
+
list[str]
|
|
82
|
+
List of missing required keyword arguments.
|
|
83
|
+
"""
|
|
84
|
+
return []
|
|
85
|
+
|
|
86
|
+
def get_content(
|
|
87
|
+
self,
|
|
88
|
+
secrets: dict[str, str],
|
|
89
|
+
) -> str:
|
|
90
|
+
"""Get content for the tool.
|
|
91
|
+
|
|
92
|
+
Parameters
|
|
93
|
+
----------
|
|
94
|
+
secrets : dict[str, str]
|
|
95
|
+
Dictionary of secrets/environment variables.
|
|
96
|
+
|
|
97
|
+
Returns
|
|
98
|
+
-------
|
|
99
|
+
str
|
|
100
|
+
The content for the tool.
|
|
101
|
+
"""
|
|
102
|
+
os.environ["YOUTUBE_API_KEY"] = secrets.get("YOUTUBE_API_KEY", "")
|
|
103
|
+
content = f"""
|
|
104
|
+
youtube_api_key = os.environ.get("YOUTUBE_API_KEY", "")
|
|
105
|
+
if not youtube_api_key:
|
|
106
|
+
raise ValueError("YOUTUBE_API_KEY is required for YouTube search tool.")
|
|
107
|
+
{self.name} = YoutubeSearchTool(
|
|
108
|
+
youtube_api_key=youtube_api_key,
|
|
109
|
+
)
|
|
110
|
+
"""
|
|
111
|
+
return content
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
YouTubeSearchTool = YouTubeSearchToolImpl()
|
|
115
|
+
YouTubeSearchConfig = PredefinedToolConfig(
|
|
116
|
+
name=YouTubeSearchTool.name,
|
|
117
|
+
description=YouTubeSearchTool.description,
|
|
118
|
+
required_secrets=YouTubeSearchTool.required_secrets,
|
|
119
|
+
required_kwargs=YouTubeSearchTool.required_kwargs,
|
|
120
|
+
requirements=YouTubeSearchTool.requirements,
|
|
121
|
+
tags=YouTubeSearchTool.tags,
|
|
122
|
+
implementation=YouTubeSearchTool,
|
|
123
|
+
)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0.
|
|
2
|
+
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
|
|
4
|
+
"""Predefined tool protocol definition for Waldiez."""
|
|
5
|
+
|
|
6
|
+
# pyright: reportReturnType=false
|
|
7
|
+
from typing import Any, Protocol, runtime_checkable
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@runtime_checkable
|
|
11
|
+
class PredefinedTool(Protocol):
|
|
12
|
+
"""Protocol for predefined tools in Waldiez."""
|
|
13
|
+
|
|
14
|
+
required_secrets: list[str]
|
|
15
|
+
required_kwargs: dict[str, type]
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def name(self) -> str:
|
|
19
|
+
"""Tool name."""
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def description(self) -> str:
|
|
23
|
+
"""Tool description."""
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def requirements(self) -> list[str]:
|
|
27
|
+
"""Python requirements for the tool."""
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def tags(self) -> list[str]:
|
|
31
|
+
"""Tags for the tool, used for categorization."""
|
|
32
|
+
|
|
33
|
+
@property
|
|
34
|
+
def tool_imports(self) -> list[str]:
|
|
35
|
+
"""Imports required for the tool implementation."""
|
|
36
|
+
|
|
37
|
+
def get_content(
|
|
38
|
+
self,
|
|
39
|
+
secrets: dict[str, str],
|
|
40
|
+
) -> str:
|
|
41
|
+
"""Get the content of the tool.
|
|
42
|
+
|
|
43
|
+
Parameters
|
|
44
|
+
----------
|
|
45
|
+
secrets : dict[str, str]
|
|
46
|
+
Dictionary of secrets/environment variables.
|
|
47
|
+
|
|
48
|
+
Returns
|
|
49
|
+
-------
|
|
50
|
+
str
|
|
51
|
+
Content of the tool.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
def validate_secrets(self, secrets: dict[str, str]) -> list[str]:
|
|
55
|
+
"""Validate secrets and return list of missing required ones.
|
|
56
|
+
|
|
57
|
+
Parameters
|
|
58
|
+
----------
|
|
59
|
+
secrets : dict[str, str]
|
|
60
|
+
Dictionary of secrets/environment variables.
|
|
61
|
+
|
|
62
|
+
Returns
|
|
63
|
+
-------
|
|
64
|
+
list[str]
|
|
65
|
+
List of missing required secrets.
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
def validate_kwargs(self, kwargs: dict[str, Any]) -> list[str]:
|
|
69
|
+
"""Validate keyword arguments and return list of missing required ones.
|
|
70
|
+
|
|
71
|
+
Parameters
|
|
72
|
+
----------
|
|
73
|
+
kwargs : dict[str, Any]
|
|
74
|
+
Dictionary of keyword arguments.
|
|
75
|
+
|
|
76
|
+
Returns
|
|
77
|
+
-------
|
|
78
|
+
list[str]
|
|
79
|
+
List of missing required keyword arguments.
|
|
80
|
+
|
|
81
|
+
Raises
|
|
82
|
+
------
|
|
83
|
+
ValueError
|
|
84
|
+
If any required keyword arguments are missing or of incorrect type.
|
|
85
|
+
"""
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0.
|
|
2
|
+
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
"""Predefined tools registry for Waldiez."""
|
|
4
|
+
|
|
5
|
+
from ._config import PredefinedToolConfig
|
|
6
|
+
from ._google import GoogleSearchConfig
|
|
7
|
+
from ._tavily import TavilySearchConfig
|
|
8
|
+
from ._wikipedia import WikipediaSearchConfig
|
|
9
|
+
from ._youtube import YouTubeSearchConfig
|
|
10
|
+
|
|
11
|
+
PREDEFINED_TOOLS: dict[str, PredefinedToolConfig] = {
|
|
12
|
+
GoogleSearchConfig.name: GoogleSearchConfig,
|
|
13
|
+
WikipediaSearchConfig.name: WikipediaSearchConfig,
|
|
14
|
+
YouTubeSearchConfig.name: YouTubeSearchConfig,
|
|
15
|
+
TavilySearchConfig.name: TavilySearchConfig,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_predefined_tool_config(tool_name: str) -> PredefinedToolConfig | None:
|
|
20
|
+
"""Get configuration for a predefined tool.
|
|
21
|
+
|
|
22
|
+
Parameters
|
|
23
|
+
----------
|
|
24
|
+
tool_name : str
|
|
25
|
+
Name of the tool to retrieve configuration for.
|
|
26
|
+
|
|
27
|
+
Returns
|
|
28
|
+
-------
|
|
29
|
+
PredefinedToolConfig | None
|
|
30
|
+
Configuration of the tool if it exists, otherwise None.
|
|
31
|
+
"""
|
|
32
|
+
return PREDEFINED_TOOLS.get(tool_name)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def get_predefined_tool_requirements(tool_name: str) -> list[str]:
|
|
36
|
+
"""Get requirements for a predefined tool.
|
|
37
|
+
|
|
38
|
+
Parameters
|
|
39
|
+
----------
|
|
40
|
+
tool_name : str
|
|
41
|
+
Name of the tool to retrieve requirements for.
|
|
42
|
+
|
|
43
|
+
Returns
|
|
44
|
+
-------
|
|
45
|
+
list[str]
|
|
46
|
+
List of requirements for the tool,
|
|
47
|
+
or an empty list if the tool does not exist.
|
|
48
|
+
"""
|
|
49
|
+
config = get_predefined_tool_config(tool_name)
|
|
50
|
+
return config.requirements if config else []
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def get_predefined_tool_imports(tool_name: str) -> list[str]:
|
|
54
|
+
"""Get imports for a predefined tool.
|
|
55
|
+
|
|
56
|
+
Parameters
|
|
57
|
+
----------
|
|
58
|
+
tool_name : str
|
|
59
|
+
Name of the tool to retrieve imports for.
|
|
60
|
+
|
|
61
|
+
Returns
|
|
62
|
+
-------
|
|
63
|
+
list[str]
|
|
64
|
+
List of imports for the tool,
|
|
65
|
+
or an empty list if the tool does not exist.
|
|
66
|
+
"""
|
|
67
|
+
config = get_predefined_tool_config(tool_name)
|
|
68
|
+
return config.implementation.tool_imports if config else []
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def list_predefined_tools() -> list[str]:
|
|
72
|
+
"""List all available predefined tools.
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
list[str]
|
|
77
|
+
List of all predefined tool names.
|
|
78
|
+
"""
|
|
79
|
+
return list(PREDEFINED_TOOLS.keys())
|
waldiez/models/tool/tool.py
CHANGED
|
@@ -17,6 +17,10 @@ from ..common import (
|
|
|
17
17
|
now,
|
|
18
18
|
parse_code_string,
|
|
19
19
|
)
|
|
20
|
+
from .predefined import (
|
|
21
|
+
get_predefined_tool_config,
|
|
22
|
+
list_predefined_tools,
|
|
23
|
+
)
|
|
20
24
|
from .tool_data import WaldiezToolData
|
|
21
25
|
from .tool_type import WaldiezToolType
|
|
22
26
|
|
|
@@ -179,6 +183,17 @@ class WaldiezTool(WaldiezBase):
|
|
|
179
183
|
"""
|
|
180
184
|
return self.tool_type == "shared" or self.name == SHARED_TOOL_NAME
|
|
181
185
|
|
|
186
|
+
@property
|
|
187
|
+
def is_predefined(self) -> bool:
|
|
188
|
+
"""Check if the tool is predefined.
|
|
189
|
+
|
|
190
|
+
Returns
|
|
191
|
+
-------
|
|
192
|
+
bool
|
|
193
|
+
True if the tool is predefined, False otherwise.
|
|
194
|
+
"""
|
|
195
|
+
return self.tool_type == "predefined"
|
|
196
|
+
|
|
182
197
|
@property
|
|
183
198
|
def is_interop(self) -> bool:
|
|
184
199
|
"""Check if the tool is interoperability.
|
|
@@ -190,6 +205,16 @@ class WaldiezTool(WaldiezBase):
|
|
|
190
205
|
"""
|
|
191
206
|
return self.tool_type in ("langchain", "crewai")
|
|
192
207
|
|
|
208
|
+
@property
|
|
209
|
+
def content(self) -> str:
|
|
210
|
+
"""Get the content (source) of the tool."""
|
|
211
|
+
return self.data.content
|
|
212
|
+
|
|
213
|
+
@property
|
|
214
|
+
def secrets(self) -> dict[str, str]:
|
|
215
|
+
"""Get the secrets (environment variables) of the tool."""
|
|
216
|
+
return self.data.secrets or {}
|
|
217
|
+
|
|
193
218
|
def get_content(self) -> str:
|
|
194
219
|
"""Get the content of the tool.
|
|
195
220
|
|
|
@@ -198,11 +223,26 @@ class WaldiezTool(WaldiezBase):
|
|
|
198
223
|
str
|
|
199
224
|
The content of the tool.
|
|
200
225
|
"""
|
|
226
|
+
if self.is_predefined:
|
|
227
|
+
return self._generate_predefined_content()
|
|
201
228
|
if self.is_shared or self.is_interop:
|
|
202
229
|
return self.data.content
|
|
203
230
|
# if custom, only the function content
|
|
204
231
|
return get_function(self.data.content, self.name)
|
|
205
232
|
|
|
233
|
+
def _generate_predefined_content(self) -> str:
|
|
234
|
+
"""Generate the content for a predefined tool.
|
|
235
|
+
|
|
236
|
+
Returns
|
|
237
|
+
-------
|
|
238
|
+
str
|
|
239
|
+
The content of the predefined tool.
|
|
240
|
+
"""
|
|
241
|
+
config = get_predefined_tool_config(self.name)
|
|
242
|
+
if not config:
|
|
243
|
+
return ""
|
|
244
|
+
return config.get_content(self.data.secrets)
|
|
245
|
+
|
|
206
246
|
def _validate_interop_tool(self) -> None:
|
|
207
247
|
"""Validate the interoperability tool.
|
|
208
248
|
|
|
@@ -253,6 +293,50 @@ class WaldiezTool(WaldiezBase):
|
|
|
253
293
|
if error is not None or tree is None:
|
|
254
294
|
raise ValueError(f"Invalid tool content: {error}")
|
|
255
295
|
|
|
296
|
+
def _validate_predefined_tool(self) -> None:
|
|
297
|
+
"""Validate a predefined tool.
|
|
298
|
+
|
|
299
|
+
Raises
|
|
300
|
+
------
|
|
301
|
+
ValueError
|
|
302
|
+
If the tool name is not in the content.
|
|
303
|
+
If the tool content is invalid.
|
|
304
|
+
"""
|
|
305
|
+
if self.is_predefined:
|
|
306
|
+
config = get_predefined_tool_config(self.name)
|
|
307
|
+
if not config:
|
|
308
|
+
available_tools = list_predefined_tools()
|
|
309
|
+
raise ValueError(
|
|
310
|
+
f"Unknown predefined tool: {self.name}. "
|
|
311
|
+
f"Available tools: {available_tools}"
|
|
312
|
+
)
|
|
313
|
+
missing_secrets = config.validate_secrets(self.data.secrets)
|
|
314
|
+
if missing_secrets:
|
|
315
|
+
raise ValueError(
|
|
316
|
+
f"Missing required secrets for {self.name}: "
|
|
317
|
+
f"{missing_secrets}"
|
|
318
|
+
)
|
|
319
|
+
invalid_kwargs = config.validate_kwargs(self.data.kwargs)
|
|
320
|
+
if invalid_kwargs:
|
|
321
|
+
raise ValueError(
|
|
322
|
+
f"Invalid keyword arguments for {self.name}: "
|
|
323
|
+
f"{invalid_kwargs}"
|
|
324
|
+
)
|
|
325
|
+
# Update tool metadata from predefined config
|
|
326
|
+
if not self.description:
|
|
327
|
+
self.description = config.description
|
|
328
|
+
|
|
329
|
+
# Merge requirements
|
|
330
|
+
predefined_reqs = set(config.requirements)
|
|
331
|
+
existing_reqs = set(self.requirements)
|
|
332
|
+
self.requirements = list(predefined_reqs | existing_reqs)
|
|
333
|
+
|
|
334
|
+
# Merge tags
|
|
335
|
+
predefined_tags = set(config.tags)
|
|
336
|
+
existing_tags = set(self.tags)
|
|
337
|
+
self.tags = list(predefined_tags | existing_tags)
|
|
338
|
+
self.data.content = config.get_content(self.data.secrets)
|
|
339
|
+
|
|
256
340
|
@model_validator(mode="after")
|
|
257
341
|
def validate_data(self) -> Self:
|
|
258
342
|
"""Validate the data.
|
|
@@ -270,9 +354,18 @@ class WaldiezTool(WaldiezBase):
|
|
|
270
354
|
"""
|
|
271
355
|
self._validate_custom_tool()
|
|
272
356
|
self._validate_interop_tool()
|
|
273
|
-
self.
|
|
274
|
-
|
|
275
|
-
|
|
357
|
+
self._validate_predefined_tool()
|
|
358
|
+
if self.is_predefined:
|
|
359
|
+
config = get_predefined_tool_config(self.name)
|
|
360
|
+
if config:
|
|
361
|
+
self._tool_imports = (
|
|
362
|
+
["import os"],
|
|
363
|
+
config.implementation.tool_imports,
|
|
364
|
+
)
|
|
365
|
+
else:
|
|
366
|
+
self._tool_imports = gather_code_imports(
|
|
367
|
+
self.data.content, self.is_interop
|
|
368
|
+
)
|
|
276
369
|
# remove the imports from the content
|
|
277
370
|
# we will place them at the top of the file
|
|
278
371
|
all_imports = self._tool_imports[0] + self._tool_imports[1]
|
|
@@ -290,13 +383,3 @@ class WaldiezTool(WaldiezBase):
|
|
|
290
383
|
valid_lines.pop()
|
|
291
384
|
self.data.content = "\n".join(valid_lines)
|
|
292
385
|
return self
|
|
293
|
-
|
|
294
|
-
@property
|
|
295
|
-
def content(self) -> str:
|
|
296
|
-
"""Get the content (source) of the tool."""
|
|
297
|
-
return self.data.content
|
|
298
|
-
|
|
299
|
-
@property
|
|
300
|
-
def secrets(self) -> dict[str, str]:
|
|
301
|
-
"""Get the secrets (environment variables) of the tool."""
|
|
302
|
-
return self.data.secrets or {}
|
waldiez/models/tool/tool_data.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez Tool model."""
|
|
4
4
|
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
5
7
|
from pydantic import Field
|
|
6
8
|
from typing_extensions import Annotated
|
|
7
9
|
|
|
@@ -49,3 +51,13 @@ class WaldiezToolData(WaldiezBase):
|
|
|
49
51
|
description="The secrets (environment variables) of the tool.",
|
|
50
52
|
),
|
|
51
53
|
]
|
|
54
|
+
kwargs: Annotated[
|
|
55
|
+
dict[str, Any],
|
|
56
|
+
Field(
|
|
57
|
+
default_factory=dict,
|
|
58
|
+
title="Keyword Arguments",
|
|
59
|
+
description=(
|
|
60
|
+
"Keyword arguments for the tool, used for initialization."
|
|
61
|
+
),
|
|
62
|
+
),
|
|
63
|
+
] = {}
|
waldiez/models/tool/tool_type.py
CHANGED
waldiez/runner.py
CHANGED
|
@@ -222,6 +222,7 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
222
222
|
output_file: Path,
|
|
223
223
|
uploads_root: Path | None,
|
|
224
224
|
skip_mmd: bool = False,
|
|
225
|
+
skip_timeline: bool = False,
|
|
225
226
|
) -> Union[
|
|
226
227
|
"ChatResult",
|
|
227
228
|
list["ChatResult"],
|
|
@@ -239,6 +240,8 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
239
240
|
The runtime uploads root.
|
|
240
241
|
skip_mmd : bool
|
|
241
242
|
Whether to skip generating the mermaid diagram.
|
|
243
|
+
skip_timeline : bool
|
|
244
|
+
Whether to skip generating the timeline JSON.
|
|
242
245
|
|
|
243
246
|
Returns
|
|
244
247
|
-------
|
|
@@ -252,6 +255,7 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
252
255
|
output_file=output_file,
|
|
253
256
|
uploads_root=uploads_root,
|
|
254
257
|
skip_mmd=skip_mmd,
|
|
258
|
+
skip_timeline=skip_timeline,
|
|
255
259
|
)
|
|
256
260
|
|
|
257
261
|
async def _a_run(
|
|
@@ -260,6 +264,7 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
260
264
|
output_file: Path,
|
|
261
265
|
uploads_root: Path | None,
|
|
262
266
|
skip_mmd: bool,
|
|
267
|
+
skip_timeline: bool,
|
|
263
268
|
) -> Union[
|
|
264
269
|
"ChatResult",
|
|
265
270
|
list["ChatResult"],
|
|
@@ -277,6 +282,8 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
277
282
|
The runtime uploads root.
|
|
278
283
|
skip_mmd : bool
|
|
279
284
|
Whether to skip generating the mermaid diagram.
|
|
285
|
+
skip_timeline : bool
|
|
286
|
+
Whether to skip generating the timeline JSON.
|
|
280
287
|
|
|
281
288
|
Returns
|
|
282
289
|
-------
|
|
@@ -290,6 +297,7 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
290
297
|
output_file=output_file,
|
|
291
298
|
uploads_root=uploads_root,
|
|
292
299
|
skip_mmd=skip_mmd,
|
|
300
|
+
skip_timeline=skip_timeline,
|
|
293
301
|
)
|
|
294
302
|
|
|
295
303
|
def _after_run(
|
|
@@ -303,6 +311,7 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
303
311
|
uploads_root: Path | None,
|
|
304
312
|
temp_dir: Path,
|
|
305
313
|
skip_mmd: bool,
|
|
314
|
+
skip_timeline: bool,
|
|
306
315
|
) -> None:
|
|
307
316
|
"""Actions to perform after running the flow.
|
|
308
317
|
|
|
@@ -322,13 +331,16 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
322
331
|
The path to the temporary directory created for the run.
|
|
323
332
|
skip_mmd : bool
|
|
324
333
|
Whether to skip generating the mermaid diagram.
|
|
334
|
+
skip_timeline : bool
|
|
335
|
+
Whether to skip generating the timeline JSON.
|
|
325
336
|
"""
|
|
326
337
|
self._implementation._after_run(
|
|
327
338
|
results,
|
|
328
339
|
output_file,
|
|
329
340
|
uploads_root,
|
|
330
341
|
temp_dir,
|
|
331
|
-
skip_mmd,
|
|
342
|
+
skip_mmd=skip_mmd,
|
|
343
|
+
skip_timeline=skip_timeline,
|
|
332
344
|
)
|
|
333
345
|
|
|
334
346
|
async def _a_after_run(
|
|
@@ -342,6 +354,7 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
342
354
|
uploads_root: Path | None,
|
|
343
355
|
temp_dir: Path,
|
|
344
356
|
skip_mmd: bool,
|
|
357
|
+
skip_timeline: bool,
|
|
345
358
|
) -> None:
|
|
346
359
|
"""Asynchronously perform actions after running the flow.
|
|
347
360
|
|
|
@@ -357,13 +370,16 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
357
370
|
The path to the temporary directory created for the run.
|
|
358
371
|
skip_mmd : bool
|
|
359
372
|
Whether to skip generating the mermaid diagram.
|
|
373
|
+
skip_timeline : bool
|
|
374
|
+
Whether to skip generating the timeline JSON.
|
|
360
375
|
"""
|
|
361
376
|
await self._implementation._a_after_run(
|
|
362
377
|
results,
|
|
363
378
|
output_file,
|
|
364
379
|
uploads_root,
|
|
365
380
|
temp_dir,
|
|
366
|
-
skip_mmd,
|
|
381
|
+
skip_mmd=skip_mmd,
|
|
382
|
+
skip_timeline=skip_timeline,
|
|
367
383
|
)
|
|
368
384
|
|
|
369
385
|
def start(
|
|
@@ -373,6 +389,7 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
373
389
|
structured_io: bool | None = None,
|
|
374
390
|
skip_patch_io: bool | None = None,
|
|
375
391
|
skip_mmd: bool = False,
|
|
392
|
+
skip_timeline: bool = False,
|
|
376
393
|
) -> None:
|
|
377
394
|
"""Start the flow.
|
|
378
395
|
|
|
@@ -390,12 +407,16 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
390
407
|
If None, it will use the value from the context.
|
|
391
408
|
skip_mmd : bool = False
|
|
392
409
|
Whether to skip generating the mermaid diagram.
|
|
410
|
+
skip_timeline : bool = False
|
|
411
|
+
Whether to skip generating the timeline JSON.
|
|
393
412
|
"""
|
|
394
413
|
self._implementation.start(
|
|
395
414
|
output_path=output_path,
|
|
396
415
|
uploads_root=uploads_root,
|
|
397
416
|
structured_io=structured_io,
|
|
398
417
|
skip_patch_io=skip_patch_io,
|
|
418
|
+
skip_mmd=skip_mmd,
|
|
419
|
+
skip_timeline=skip_timeline,
|
|
399
420
|
)
|
|
400
421
|
|
|
401
422
|
def _start(
|
|
@@ -404,6 +425,7 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
404
425
|
output_file: Path,
|
|
405
426
|
uploads_root: Path | None,
|
|
406
427
|
skip_mmd: bool,
|
|
428
|
+
skip_timeline: bool,
|
|
407
429
|
) -> None:
|
|
408
430
|
"""Start the flow.
|
|
409
431
|
|
|
@@ -415,12 +437,15 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
415
437
|
The runtime uploads root.
|
|
416
438
|
skip_mmd : bool
|
|
417
439
|
Whether to skip generating the mermaid diagram.
|
|
440
|
+
skip_timeline : bool
|
|
441
|
+
Whether to skip generating the timeline JSON.
|
|
418
442
|
"""
|
|
419
443
|
self._implementation._start(
|
|
420
444
|
temp_dir=temp_dir,
|
|
421
445
|
output_file=output_file,
|
|
422
446
|
uploads_root=uploads_root,
|
|
423
447
|
skip_mmd=skip_mmd,
|
|
448
|
+
skip_timeline=skip_timeline,
|
|
424
449
|
)
|
|
425
450
|
|
|
426
451
|
async def a_start(
|
|
@@ -430,6 +455,7 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
430
455
|
structured_io: bool | None = None,
|
|
431
456
|
skip_patch_io: bool | None = None,
|
|
432
457
|
skip_mmd: bool = False,
|
|
458
|
+
skip_timeline: bool = False,
|
|
433
459
|
) -> None:
|
|
434
460
|
"""Asynchronously start the flow.
|
|
435
461
|
|
|
@@ -445,6 +471,8 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
445
471
|
Whether to skip patching I/O, by default None.
|
|
446
472
|
skip_mmd : bool = False
|
|
447
473
|
Whether to skip generating the mermaid diagram, by default False.
|
|
474
|
+
skip_timeline : bool = False
|
|
475
|
+
Whether to skip generating the timeline JSON, by default False.
|
|
448
476
|
"""
|
|
449
477
|
await self._implementation.a_start(
|
|
450
478
|
output_path=output_path,
|
|
@@ -452,6 +480,7 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
452
480
|
structured_io=structured_io,
|
|
453
481
|
skip_patch_io=skip_patch_io,
|
|
454
482
|
skip_mmd=skip_mmd,
|
|
483
|
+
skip_timeline=skip_timeline,
|
|
455
484
|
)
|
|
456
485
|
|
|
457
486
|
async def _a_start(
|
|
@@ -460,6 +489,7 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
460
489
|
output_file: Path,
|
|
461
490
|
uploads_root: Path | None,
|
|
462
491
|
skip_mmd: bool,
|
|
492
|
+
skip_timeline: bool = False,
|
|
463
493
|
) -> None:
|
|
464
494
|
"""Asynchronously start the flow.
|
|
465
495
|
|
|
@@ -473,12 +503,15 @@ class WaldiezRunner(WaldiezBaseRunner):
|
|
|
473
503
|
The runtime uploads root.
|
|
474
504
|
skip_mmd : bool
|
|
475
505
|
Whether to skip generating the mermaid diagram.
|
|
506
|
+
skip_timeline : bool, optional
|
|
507
|
+
Whether to skip generating the timeline JSON, by default False.
|
|
476
508
|
"""
|
|
477
509
|
await self._implementation._a_start(
|
|
478
510
|
temp_dir=temp_dir,
|
|
479
511
|
output_file=output_file,
|
|
480
512
|
uploads_root=uploads_root,
|
|
481
513
|
skip_mmd=skip_mmd,
|
|
514
|
+
skip_timeline=skip_timeline,
|
|
482
515
|
)
|
|
483
516
|
|
|
484
517
|
def _stop(self) -> None:
|