waldiez 0.4.3__py3-none-any.whl → 0.4.5__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 +21 -2
- waldiez/_version.py +5 -2
- waldiez/cli.py +19 -4
- waldiez/exporter.py +8 -4
- waldiez/exporting/agent/utils/captain_agent.py +4 -1
- waldiez/exporting/agent/utils/group_manager.py +0 -1
- waldiez/exporting/agent/utils/rag_user/rag_user.py +1 -0
- waldiez/exporting/agent/utils/swarm_agent.py +1 -0
- waldiez/exporting/base/base_exporter.py +2 -2
- waldiez/exporting/base/mixin.py +3 -0
- waldiez/exporting/base/utils/comments.py +2 -0
- waldiez/exporting/chats/utils/sequential.py +1 -1
- waldiez/exporting/chats/utils/single_chat.py +3 -0
- waldiez/exporting/chats/utils/swarm.py +3 -0
- waldiez/exporting/flow/flow_exporter.py +2 -0
- waldiez/exporting/flow/utils/def_main.py +1 -0
- waldiez/exporting/flow/utils/flow_content.py +3 -0
- waldiez/exporting/flow/utils/flow_names.py +1 -0
- waldiez/exporting/flow/utils/importing_utils.py +1 -0
- waldiez/exporting/flow/utils/logging_utils.py +8 -8
- waldiez/exporting/skills/skills_exporter.py +1 -1
- waldiez/exporting/skills/utils.py +5 -3
- waldiez/models/__init__.py +1 -0
- waldiez/models/agents/agent/agent.py +1 -1
- waldiez/models/agents/agent/termination_message.py +1 -0
- waldiez/models/agents/group_manager/speakers.py +1 -1
- waldiez/models/agents/rag_user/retrieve_config.py +1 -0
- waldiez/models/agents/swarm_agent/after_work.py +0 -1
- waldiez/models/agents/swarm_agent/on_condition.py +1 -0
- waldiez/models/agents/swarm_agent/on_condition_available.py +1 -0
- waldiez/models/chat/chat.py +2 -0
- waldiez/models/chat/chat_message.py +1 -0
- waldiez/models/common/method_utils.py +11 -2
- waldiez/models/flow/flow.py +1 -0
- waldiez/models/skill/extra_requirements.py +1 -0
- waldiez/models/waldiez.py +5 -5
- waldiez/runner.py +4 -2
- waldiez/running/environment.py +4 -3
- waldiez/running/gen_seq_diagram.py +3 -2
- waldiez/running/running.py +48 -24
- waldiez/utils/check_rdps.py +18 -0
- waldiez/utils/cli_extras/__init__.py +2 -0
- waldiez/utils/cli_extras/runner.py +37 -0
- {waldiez-0.4.3.dist-info → waldiez-0.4.5.dist-info}/METADATA +119 -38
- {waldiez-0.4.3.dist-info → waldiez-0.4.5.dist-info}/RECORD +49 -47
- {waldiez-0.4.3.dist-info → waldiez-0.4.5.dist-info}/licenses/LICENSE +2 -2
- waldiez-0.4.5.dist-info/licenses/NOTICE.md +14 -0
- waldiez-0.4.3.dist-info/licenses/NOTICE.md +0 -5
- {waldiez-0.4.3.dist-info → waldiez-0.4.5.dist-info}/WHEEL +0 -0
- {waldiez-0.4.3.dist-info → waldiez-0.4.5.dist-info}/entry_points.txt +0 -0
waldiez/__init__.py
CHANGED
|
@@ -2,15 +2,35 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez package."""
|
|
4
4
|
|
|
5
|
-
from ._version import __version__
|
|
6
5
|
from .exporter import WaldiezExporter
|
|
7
6
|
from .models import Waldiez
|
|
8
7
|
from .runner import WaldiezRunner
|
|
9
8
|
from .utils import check_conflicts, check_flaml_warnings
|
|
10
9
|
|
|
10
|
+
# flake8: noqa: F401
|
|
11
|
+
# pylint: disable=import-error,line-too-long
|
|
12
|
+
# pyright: reportMissingImports=false
|
|
13
|
+
try:
|
|
14
|
+
from ._version import ( # type: ignore[unused-ignore, unused-import, import-not-found, import-untyped] # noqa
|
|
15
|
+
__version__,
|
|
16
|
+
)
|
|
17
|
+
except ImportError: # pragma: no cover
|
|
18
|
+
# Fallback when using the package in dev mode without installing
|
|
19
|
+
# in editable mode with pip. It is highly recommended to install
|
|
20
|
+
# the package from a stable release or in editable mode:
|
|
21
|
+
# https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
|
|
22
|
+
import warnings
|
|
23
|
+
|
|
24
|
+
warnings.warn(
|
|
25
|
+
"Importing __version__ failed. Using 'dev' as version.", stacklevel=2
|
|
26
|
+
)
|
|
27
|
+
__version__ = "dev"
|
|
28
|
+
|
|
29
|
+
|
|
11
30
|
__WALDIEZ_INITIALIZED = False
|
|
12
31
|
|
|
13
32
|
if not __WALDIEZ_INITIALIZED:
|
|
33
|
+
__WALDIEZ_INITIALIZED = True
|
|
14
34
|
check_conflicts()
|
|
15
35
|
check_flaml_warnings()
|
|
16
36
|
# let's skip the one below
|
|
@@ -20,7 +40,6 @@ if not __WALDIEZ_INITIALIZED:
|
|
|
20
40
|
# before calling pip install pyautogen[captainagent]
|
|
21
41
|
# we should have pysqlite3 installed (at least on windows)
|
|
22
42
|
# before running a flow
|
|
23
|
-
__WALDIEZ_INITIALIZED = True
|
|
24
43
|
|
|
25
44
|
__all__ = [
|
|
26
45
|
"Waldiez",
|
waldiez/_version.py
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
-
"""Version information for
|
|
3
|
+
"""Version information for waldiez.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This file is automatically generated by Hatchling.
|
|
6
|
+
Do not edit this file directly.
|
|
7
|
+
"""
|
|
8
|
+
__version__ = VERSION = "0.4.5"
|
waldiez/cli.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
-
#
|
|
3
|
+
# flake8: noqa: E501
|
|
4
|
+
# pylint: disable=missing-function-docstring,missing-param-doc,missing-raises-doc
|
|
4
5
|
"""Command line interface to convert or run a waldiez file."""
|
|
5
6
|
|
|
6
7
|
import json
|
|
@@ -14,7 +15,21 @@ import anyio
|
|
|
14
15
|
import typer
|
|
15
16
|
from typing_extensions import Annotated
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
# pylint: disable=import-error,line-too-long
|
|
19
|
+
# pyright: reportMissingImports=false
|
|
20
|
+
try: # pragma: no cover
|
|
21
|
+
from ._version import ( # type: ignore[unused-ignore, unused-import, import-not-found, import-untyped] # noqa
|
|
22
|
+
__version__,
|
|
23
|
+
)
|
|
24
|
+
except ImportError: # pragma: no cover
|
|
25
|
+
import warnings
|
|
26
|
+
|
|
27
|
+
warnings.warn(
|
|
28
|
+
"Importing __version__ failed. Using 'dev' as version.", stacklevel=2
|
|
29
|
+
)
|
|
30
|
+
__version__ = "dev"
|
|
31
|
+
|
|
32
|
+
|
|
18
33
|
from .exporter import WaldiezExporter
|
|
19
34
|
from .models import Waldiez
|
|
20
35
|
from .runner import WaldiezRunner
|
|
@@ -70,7 +85,7 @@ def run(
|
|
|
70
85
|
resolve_path=True,
|
|
71
86
|
),
|
|
72
87
|
],
|
|
73
|
-
output: Optional[Path] = typer.Option(
|
|
88
|
+
output: Optional[Path] = typer.Option( # noqa: B008
|
|
74
89
|
None,
|
|
75
90
|
help=(
|
|
76
91
|
"Path to the output (.py) file. "
|
|
@@ -80,7 +95,7 @@ def run(
|
|
|
80
95
|
dir_okay=False,
|
|
81
96
|
resolve_path=True,
|
|
82
97
|
),
|
|
83
|
-
force: bool = typer.Option(
|
|
98
|
+
force: bool = typer.Option( # noqa: B008
|
|
84
99
|
False,
|
|
85
100
|
help="Override the output file if it already exists.",
|
|
86
101
|
),
|
waldiez/exporter.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""
|
|
4
|
+
Waldiez exporter class.
|
|
5
|
+
|
|
4
6
|
The role of the exporter is to export the model's data
|
|
5
7
|
to an autogen's flow with one or more chats.
|
|
6
8
|
|
|
@@ -20,18 +22,20 @@ from .models import Waldiez
|
|
|
20
22
|
class WaldiezExporter:
|
|
21
23
|
"""Waldiez exporter.
|
|
22
24
|
|
|
23
|
-
Attributes
|
|
25
|
+
Attributes
|
|
26
|
+
----------
|
|
24
27
|
waldiez (Waldiez): The Waldiez instance.
|
|
25
28
|
"""
|
|
26
29
|
|
|
27
30
|
def __init__(self, waldiez: Waldiez) -> None:
|
|
28
31
|
"""Initialize the Waldiez exporter.
|
|
29
32
|
|
|
30
|
-
Parameters
|
|
31
|
-
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
waldiez: Waldiez
|
|
36
|
+
The Waldiez instance.
|
|
32
37
|
"""
|
|
33
38
|
self.waldiez = waldiez
|
|
34
|
-
# self._initialize()
|
|
35
39
|
|
|
36
40
|
@classmethod
|
|
37
41
|
def load(cls, file_path: Path) -> "WaldiezExporter":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
-
"""
|
|
3
|
+
"""Extras for exporting a captain agent."""
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
6
|
import os
|
|
@@ -37,6 +37,7 @@ def get_captain_agent_extras(
|
|
|
37
37
|
The serializer to use.
|
|
38
38
|
output_dir : Optional[Union[str, Path]]
|
|
39
39
|
The output directory to save the agent lib and nested config.
|
|
40
|
+
|
|
40
41
|
Returns
|
|
41
42
|
-------
|
|
42
43
|
str
|
|
@@ -90,6 +91,7 @@ def generate_nested_config(
|
|
|
90
91
|
All the models in the flow.
|
|
91
92
|
save_path : str
|
|
92
93
|
The path to save the nested config.
|
|
94
|
+
|
|
93
95
|
Returns
|
|
94
96
|
-------
|
|
95
97
|
Dict[str, Any]
|
|
@@ -131,6 +133,7 @@ def get_llm_config(
|
|
|
131
133
|
The agent.
|
|
132
134
|
all_models : List[WaldiezModel]
|
|
133
135
|
All the models in the flow.
|
|
136
|
+
|
|
134
137
|
Returns
|
|
135
138
|
-------
|
|
136
139
|
Dict[str, str]
|
|
@@ -10,7 +10,7 @@ from .export_position import ExportPosition
|
|
|
10
10
|
from .import_position import ImportPosition
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
# flake8: noqa: E501
|
|
13
|
+
# flake8: noqa: E501,B027
|
|
14
14
|
# pylint: disable=line-too-long
|
|
15
15
|
class ExporterReturnType(TypedDict):
|
|
16
16
|
"""Exporter Return Type.
|
|
@@ -66,7 +66,7 @@ class BaseExporter(abc.ABC):
|
|
|
66
66
|
"""
|
|
67
67
|
|
|
68
68
|
def get_imports(self) -> Optional[List[Tuple[str, ImportPosition]]]:
|
|
69
|
-
"""
|
|
69
|
+
"""Generate the imports string for the exporter.
|
|
70
70
|
|
|
71
71
|
Returns
|
|
72
72
|
-------
|
waldiez/exporting/base/mixin.py
CHANGED
|
@@ -28,6 +28,7 @@ class ExporterMixin:
|
|
|
28
28
|
The item.
|
|
29
29
|
tabs : int, optional
|
|
30
30
|
The number of tabs for indentation, by default 1.
|
|
31
|
+
|
|
31
32
|
Returns
|
|
32
33
|
-------
|
|
33
34
|
str
|
|
@@ -77,6 +78,7 @@ class ExporterMixin:
|
|
|
77
78
|
The comment key.
|
|
78
79
|
for_notebook : bool
|
|
79
80
|
Whether the comment is for a notebook or not.
|
|
81
|
+
|
|
80
82
|
Returns
|
|
81
83
|
-------
|
|
82
84
|
str
|
|
@@ -121,6 +123,7 @@ class ExporterMixin:
|
|
|
121
123
|
The prefix for the instance name, by default "w".
|
|
122
124
|
max_length : int, optional
|
|
123
125
|
The maximum length of the variable name, by default 64
|
|
126
|
+
|
|
124
127
|
Returns
|
|
125
128
|
-------
|
|
126
129
|
Dict[str, str]
|
|
@@ -23,7 +23,7 @@ def export_sequential_chat(
|
|
|
23
23
|
tabs: int,
|
|
24
24
|
is_async: bool,
|
|
25
25
|
) -> Tuple[str, str]:
|
|
26
|
-
"""Get the chats content, when there are more than one chats in the flow.
|
|
26
|
+
r"""Get the chats content, when there are more than one chats in the flow.
|
|
27
27
|
|
|
28
28
|
Parameters
|
|
29
29
|
----------
|
|
@@ -49,6 +49,7 @@ def export_single_chat(
|
|
|
49
49
|
The number of tabs to use for indentation.
|
|
50
50
|
is_async : bool
|
|
51
51
|
Whether the chat is asynchronous.
|
|
52
|
+
|
|
52
53
|
Returns
|
|
53
54
|
-------
|
|
54
55
|
Tuple[str, str]
|
|
@@ -154,6 +155,7 @@ def get_simple_chat_string(
|
|
|
154
155
|
The number of tabs to use for indentation.
|
|
155
156
|
is_async : bool
|
|
156
157
|
Whether the chat is asynchronous.
|
|
158
|
+
|
|
157
159
|
Returns
|
|
158
160
|
-------
|
|
159
161
|
Tuple[str, str]
|
|
@@ -218,6 +220,7 @@ def get_empty_simple_chat_string(
|
|
|
218
220
|
The tab string.
|
|
219
221
|
is_async : bool
|
|
220
222
|
Whether the chat is asynchronous.
|
|
223
|
+
|
|
221
224
|
Returns
|
|
222
225
|
-------
|
|
223
226
|
Tuple[str, str]
|
|
@@ -47,6 +47,7 @@ def export_swarm_chat(
|
|
|
47
47
|
The number of tabs to use for indentation.
|
|
48
48
|
is_async : bool
|
|
49
49
|
Whether the chat is asynchronous.
|
|
50
|
+
|
|
50
51
|
Returns
|
|
51
52
|
-------
|
|
52
53
|
Tuple[str, str]
|
|
@@ -124,6 +125,7 @@ def get_swarm_agents_strings(
|
|
|
124
125
|
A mapping of agent id to agent name.
|
|
125
126
|
user_agent : Optional[WaldiezAgent]
|
|
126
127
|
The user agent.
|
|
128
|
+
|
|
127
129
|
Returns
|
|
128
130
|
-------
|
|
129
131
|
Tuple[str, str]
|
|
@@ -190,6 +192,7 @@ def get_swarm_after_work_string(
|
|
|
190
192
|
A mapping of agent id to agent name.
|
|
191
193
|
name_suffix : str
|
|
192
194
|
The suffix to use for the function name.
|
|
195
|
+
|
|
193
196
|
Returns
|
|
194
197
|
-------
|
|
195
198
|
Tuple[str, str]
|
|
@@ -197,6 +197,7 @@ class FlowExporter(BaseExporter, ExporterMixin):
|
|
|
197
197
|
chats_content : str
|
|
198
198
|
The chats content.
|
|
199
199
|
before_chats : str
|
|
200
|
+
|
|
200
201
|
Returns
|
|
201
202
|
-------
|
|
202
203
|
str
|
|
@@ -412,6 +413,7 @@ class FlowExporter(BaseExporter, ExporterMixin):
|
|
|
412
413
|
The before export.
|
|
413
414
|
after_export : List[Tuple[str, Union[ExportPosition, AgentPosition]]]
|
|
414
415
|
The after export.
|
|
416
|
+
|
|
415
417
|
Returns
|
|
416
418
|
-------
|
|
417
419
|
str
|
|
@@ -16,6 +16,7 @@ def get_py_content_start(waldiez: Waldiez) -> str:
|
|
|
16
16
|
----------
|
|
17
17
|
waldiez : Waldiez
|
|
18
18
|
The waldiez object.
|
|
19
|
+
|
|
19
20
|
Returns
|
|
20
21
|
-------
|
|
21
22
|
str
|
|
@@ -46,6 +47,7 @@ def get_ipynb_content_start(
|
|
|
46
47
|
The waldiez object.
|
|
47
48
|
comment : Callable[[bool, int], str]
|
|
48
49
|
The function to create a comment.
|
|
50
|
+
|
|
49
51
|
Returns
|
|
50
52
|
-------
|
|
51
53
|
str
|
|
@@ -130,6 +132,7 @@ def get_after_run_content(
|
|
|
130
132
|
The dictionary of agent names and their corresponding ids
|
|
131
133
|
tabs : int
|
|
132
134
|
The number of tabs to add before the content.
|
|
135
|
+
|
|
133
136
|
Returns
|
|
134
137
|
-------
|
|
135
138
|
str
|
|
@@ -17,7 +17,7 @@ get_sqlite_to_csv_call_string
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def get_start_logging(is_async: bool, tabs: int = 0) -> str:
|
|
20
|
-
"""Get the logging start call string.
|
|
20
|
+
r"""Get the logging start call string.
|
|
21
21
|
|
|
22
22
|
Parameters
|
|
23
23
|
----------
|
|
@@ -70,7 +70,7 @@ def get_start_logging(is_async: bool, tabs: int = 0) -> str:
|
|
|
70
70
|
|
|
71
71
|
# pylint: disable=differing-param-doc,differing-type-doc
|
|
72
72
|
def get_sync_sqlite_out() -> str:
|
|
73
|
-
"""Get the sqlite to csv and json conversion code string.
|
|
73
|
+
r"""Get the sqlite to csv and json conversion code string.
|
|
74
74
|
|
|
75
75
|
Returns
|
|
76
76
|
-------
|
|
@@ -84,8 +84,8 @@ def get_sync_sqlite_out() -> str:
|
|
|
84
84
|
def get_sqlite_out(dbname: str, table: str, csv_file: str) -> None:
|
|
85
85
|
\"\"\"Convert a sqlite table to csv and json files.
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
Parameters
|
|
88
|
+
----------
|
|
89
89
|
dbname : str
|
|
90
90
|
The sqlite database name.
|
|
91
91
|
table : str
|
|
@@ -152,7 +152,7 @@ def get_sync_sqlite_out() -> str:
|
|
|
152
152
|
|
|
153
153
|
# pylint: disable=differing-param-doc,differing-type-doc,line-too-long
|
|
154
154
|
def get_async_sqlite_out() -> str:
|
|
155
|
-
"""Get the sqlite to csv and json conversion code string.
|
|
155
|
+
r"""Get the sqlite to csv and json conversion code string.
|
|
156
156
|
|
|
157
157
|
Returns
|
|
158
158
|
-------
|
|
@@ -166,8 +166,8 @@ def get_async_sqlite_out() -> str:
|
|
|
166
166
|
async def get_sqlite_out(dbname: str, table: str, csv_file: str) -> None:
|
|
167
167
|
\"\"\"Convert a sqlite table to csv and json files.
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
Parameters
|
|
170
|
+
----------
|
|
171
171
|
dbname : str
|
|
172
172
|
The sqlite database name.
|
|
173
173
|
table : str
|
|
@@ -313,7 +313,7 @@ def get_sqlite_out_call(tabs: int, is_async: bool) -> str:
|
|
|
313
313
|
|
|
314
314
|
|
|
315
315
|
def get_stop_logging(tabs: int, is_async: bool) -> str:
|
|
316
|
-
"""Get the function to stop logging and gather logs.
|
|
316
|
+
r"""Get the function to stop logging and gather logs.
|
|
317
317
|
|
|
318
318
|
Parameters
|
|
319
319
|
----------
|
|
@@ -23,7 +23,7 @@ def get_agent_skill_registration(
|
|
|
23
23
|
skill_description: str,
|
|
24
24
|
string_escape: Callable[[str], str],
|
|
25
25
|
) -> str:
|
|
26
|
-
"""Get the agent skill string and secrets.
|
|
26
|
+
r"""Get the agent skill string and secrets.
|
|
27
27
|
|
|
28
28
|
Parameters
|
|
29
29
|
----------
|
|
@@ -37,6 +37,7 @@ def get_agent_skill_registration(
|
|
|
37
37
|
The skill description.
|
|
38
38
|
string_escape : Callable[[str], str]
|
|
39
39
|
The string escape function.
|
|
40
|
+
|
|
40
41
|
Returns
|
|
41
42
|
-------
|
|
42
43
|
str
|
|
@@ -220,7 +221,6 @@ def _sort_imports(
|
|
|
220
221
|
Tuple[List[str], List[str], List[str]]
|
|
221
222
|
The sorted skill imports.
|
|
222
223
|
"""
|
|
223
|
-
|
|
224
224
|
# "from x import y" and "import z"
|
|
225
225
|
# the "import a" should be first (and sorted)
|
|
226
226
|
# then the "from b import c" (and sorted)
|
|
@@ -254,6 +254,7 @@ def get_skill_secrets_import(flow_name: str, skill: WaldiezSkill) -> str:
|
|
|
254
254
|
The name of the flow.
|
|
255
255
|
skill : WaldiezSkill
|
|
256
256
|
The skill.
|
|
257
|
+
|
|
257
258
|
Returns
|
|
258
259
|
-------
|
|
259
260
|
str
|
|
@@ -274,7 +275,7 @@ def get_agent_skill_registrations(
|
|
|
274
275
|
skill_names: Dict[str, str],
|
|
275
276
|
string_escape: Callable[[str], str],
|
|
276
277
|
) -> str:
|
|
277
|
-
"""Get the agent skill registrations.
|
|
278
|
+
r"""Get the agent skill registrations.
|
|
278
279
|
|
|
279
280
|
example output:
|
|
280
281
|
|
|
@@ -333,6 +334,7 @@ def get_agent_skill_registrations(
|
|
|
333
334
|
A mapping of skill id to skill name.
|
|
334
335
|
string_escape : Callable[[str], str]
|
|
335
336
|
The string escape function.
|
|
337
|
+
|
|
336
338
|
Returns
|
|
337
339
|
-------
|
|
338
340
|
str
|
waldiez/models/__init__.py
CHANGED
|
@@ -148,7 +148,7 @@ class WaldiezAgent(WaldiezBase):
|
|
|
148
148
|
def ag2_imports(self) -> Set[str]:
|
|
149
149
|
"""Return the AG2 imports of the agent."""
|
|
150
150
|
agent_class = self.ag2_class
|
|
151
|
-
imports =
|
|
151
|
+
imports = {"import autogen"}
|
|
152
152
|
if agent_class == "AssistantAgent":
|
|
153
153
|
imports.add("from autogen import AssistantAgent")
|
|
154
154
|
elif agent_class == "UserProxyAgent":
|
|
@@ -31,7 +31,7 @@ CUSTOM_SPEAKER_SELECTION_TYPES = (
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
class WaldiezGroupManagerSpeakers(WaldiezBase):
|
|
34
|
-
"""Group chat speakers.
|
|
34
|
+
r"""Group chat speakers.
|
|
35
35
|
|
|
36
36
|
If the method for the speaker selection is `custom`
|
|
37
37
|
the `selection_custom_method` contents (source code) will be used.
|
waldiez/models/chat/chat.py
CHANGED
|
@@ -318,6 +318,7 @@ class WaldiezChat(WaldiezBase):
|
|
|
318
318
|
Whether to get the chat arguments for a chat queue.
|
|
319
319
|
sender : WaldiezAgent, optional
|
|
320
320
|
The sender agent, to check if it's a RAG user.
|
|
321
|
+
|
|
321
322
|
Returns
|
|
322
323
|
-------
|
|
323
324
|
dict
|
|
@@ -342,6 +343,7 @@ class WaldiezChat(WaldiezBase):
|
|
|
342
343
|
----------
|
|
343
344
|
kwargs : Any
|
|
344
345
|
The keyword arguments.
|
|
346
|
+
|
|
345
347
|
Returns
|
|
346
348
|
-------
|
|
347
349
|
Dict[str, Any]
|
|
@@ -151,6 +151,7 @@ def check_function(
|
|
|
151
151
|
The expected method name.
|
|
152
152
|
function_args : List[str]
|
|
153
153
|
The expected method arguments.
|
|
154
|
+
|
|
154
155
|
Returns
|
|
155
156
|
-------
|
|
156
157
|
Tuple[bool, str]
|
|
@@ -186,6 +187,7 @@ def _validate_function_body(
|
|
|
186
187
|
The expected method name.
|
|
187
188
|
function_args : List[str]
|
|
188
189
|
The expected method arguments.
|
|
190
|
+
|
|
189
191
|
Returns
|
|
190
192
|
-------
|
|
191
193
|
Tuple[bool, str]
|
|
@@ -205,7 +207,11 @@ def _validate_function_body(
|
|
|
205
207
|
f" got: {len(node.args.args)} :("
|
|
206
208
|
),
|
|
207
209
|
)
|
|
208
|
-
for arg, expected_arg in zip(
|
|
210
|
+
for arg, expected_arg in zip(
|
|
211
|
+
node.args.args,
|
|
212
|
+
function_args,
|
|
213
|
+
strict=False,
|
|
214
|
+
):
|
|
209
215
|
if arg.arg != expected_arg:
|
|
210
216
|
return (
|
|
211
217
|
False,
|
|
@@ -315,6 +321,7 @@ def generate_function(
|
|
|
315
321
|
types_as_comments : bool, optional
|
|
316
322
|
Include the type hints as comments (or in the function signature)
|
|
317
323
|
(default is False).
|
|
324
|
+
|
|
318
325
|
Returns
|
|
319
326
|
-------
|
|
320
327
|
str
|
|
@@ -327,7 +334,9 @@ def generate_function(
|
|
|
327
334
|
function_string += ")"
|
|
328
335
|
else:
|
|
329
336
|
function_string += "\n"
|
|
330
|
-
for arg, arg_type in zip(
|
|
337
|
+
for arg, arg_type in zip(
|
|
338
|
+
function_args, function_types[0], strict=False
|
|
339
|
+
):
|
|
331
340
|
if types_as_comments:
|
|
332
341
|
function_string += f" {arg}, # type: {arg_type}" + "\n"
|
|
333
342
|
else:
|
waldiez/models/flow/flow.py
CHANGED