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
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
|
|
4
|
+
# pyright: reportArgumentType=false
|
|
5
|
+
|
|
3
6
|
"""Common data structures for agents."""
|
|
4
7
|
|
|
5
|
-
from typing import Any
|
|
8
|
+
from typing import Any
|
|
6
9
|
|
|
7
10
|
from pydantic import ConfigDict, Field, model_validator
|
|
8
11
|
from pydantic.alias_generators import to_camel
|
|
@@ -67,14 +70,14 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
67
70
|
)
|
|
68
71
|
|
|
69
72
|
system_message: Annotated[
|
|
70
|
-
|
|
73
|
+
str | None,
|
|
71
74
|
Field(
|
|
72
75
|
None,
|
|
73
76
|
title="System message",
|
|
74
77
|
description="The agent's system message.",
|
|
75
78
|
alias="systemMessage",
|
|
76
79
|
),
|
|
77
|
-
]
|
|
80
|
+
]
|
|
78
81
|
human_input_mode: Annotated[
|
|
79
82
|
WaldiezAgentHumanInputMode,
|
|
80
83
|
Field(
|
|
@@ -83,9 +86,9 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
83
86
|
description="The human input mode to use for the agent.",
|
|
84
87
|
alias="humanInputMode",
|
|
85
88
|
),
|
|
86
|
-
]
|
|
89
|
+
]
|
|
87
90
|
code_execution_config: Annotated[
|
|
88
|
-
|
|
91
|
+
WaldiezAgentCodeExecutionConfig | Literal[False],
|
|
89
92
|
Field(
|
|
90
93
|
False,
|
|
91
94
|
title="Code execution config",
|
|
@@ -95,9 +98,9 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
95
98
|
),
|
|
96
99
|
alias="codeExecutionConfig",
|
|
97
100
|
),
|
|
98
|
-
]
|
|
101
|
+
]
|
|
99
102
|
agent_default_auto_reply: Annotated[
|
|
100
|
-
|
|
103
|
+
str | None,
|
|
101
104
|
Field(
|
|
102
105
|
None,
|
|
103
106
|
title="Agent's default auto reply",
|
|
@@ -106,9 +109,9 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
106
109
|
),
|
|
107
110
|
alias="agentDefaultAutoReply",
|
|
108
111
|
),
|
|
109
|
-
]
|
|
112
|
+
]
|
|
110
113
|
max_consecutive_auto_reply: Annotated[
|
|
111
|
-
|
|
114
|
+
int | None,
|
|
112
115
|
Field(
|
|
113
116
|
None,
|
|
114
117
|
title="Max consecutive auto reply",
|
|
@@ -118,7 +121,7 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
118
121
|
),
|
|
119
122
|
alias="maxConsecutiveAutoReply",
|
|
120
123
|
),
|
|
121
|
-
]
|
|
124
|
+
]
|
|
122
125
|
termination: Annotated[
|
|
123
126
|
WaldiezAgentTerminationMessage,
|
|
124
127
|
Field(
|
|
@@ -140,7 +143,7 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
140
143
|
),
|
|
141
144
|
alias="modelIds",
|
|
142
145
|
),
|
|
143
|
-
]
|
|
146
|
+
]
|
|
144
147
|
tools: Annotated[
|
|
145
148
|
list[WaldiezAgentLinkedTool],
|
|
146
149
|
Field(
|
|
@@ -148,7 +151,7 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
148
151
|
title="Tools",
|
|
149
152
|
description="A list of tools (id and executor) to register.",
|
|
150
153
|
),
|
|
151
|
-
]
|
|
154
|
+
]
|
|
152
155
|
nested_chats: Annotated[
|
|
153
156
|
list[WaldiezAgentNestedChat],
|
|
154
157
|
Field(
|
|
@@ -158,11 +161,11 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
158
161
|
),
|
|
159
162
|
alias="nestedChats",
|
|
160
163
|
),
|
|
161
|
-
]
|
|
164
|
+
]
|
|
162
165
|
context_variables: Annotated[
|
|
163
166
|
dict[str, Any],
|
|
164
167
|
Field(
|
|
165
|
-
default_factory=dict,
|
|
168
|
+
default_factory=dict,
|
|
166
169
|
title="Context variables",
|
|
167
170
|
description=(
|
|
168
171
|
"Context variables that provide a persistent context "
|
|
@@ -172,10 +175,10 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
172
175
|
),
|
|
173
176
|
alias="contextVariables",
|
|
174
177
|
),
|
|
175
|
-
]
|
|
178
|
+
]
|
|
176
179
|
|
|
177
180
|
update_agent_state_before_reply: Annotated[
|
|
178
|
-
list[
|
|
181
|
+
list[str | WaldiezAgentUpdateSystemMessage],
|
|
179
182
|
Field(
|
|
180
183
|
title="Update Agent State Before Reply",
|
|
181
184
|
alias="updateAgentStateBeforeReply",
|
|
@@ -188,7 +191,7 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
188
191
|
),
|
|
189
192
|
default_factory=list,
|
|
190
193
|
),
|
|
191
|
-
]
|
|
194
|
+
]
|
|
192
195
|
handoffs: Annotated[
|
|
193
196
|
list[str],
|
|
194
197
|
Field(
|
|
@@ -196,9 +199,9 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
196
199
|
title="Handoffs",
|
|
197
200
|
description="A list of handoffs (target ids) to register.",
|
|
198
201
|
),
|
|
199
|
-
]
|
|
202
|
+
]
|
|
200
203
|
after_work: Annotated[
|
|
201
|
-
|
|
204
|
+
WaldiezTransitionTarget | None,
|
|
202
205
|
Field(
|
|
203
206
|
None,
|
|
204
207
|
title="After work",
|
|
@@ -208,10 +211,10 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
208
211
|
),
|
|
209
212
|
alias="afterWork",
|
|
210
213
|
),
|
|
211
|
-
]
|
|
214
|
+
]
|
|
212
215
|
|
|
213
216
|
parent_id: Annotated[
|
|
214
|
-
|
|
217
|
+
str | None,
|
|
215
218
|
Field(
|
|
216
219
|
None,
|
|
217
220
|
title="Parent ID",
|
|
@@ -220,7 +223,7 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
220
223
|
),
|
|
221
224
|
alias="parentId",
|
|
222
225
|
),
|
|
223
|
-
]
|
|
226
|
+
]
|
|
224
227
|
|
|
225
228
|
@model_validator(mode="after")
|
|
226
229
|
def update_context_variables(self) -> Self:
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez Agent Code Execution Configuration."""
|
|
4
4
|
|
|
5
|
-
from typing import Optional
|
|
6
|
-
|
|
7
5
|
from pydantic import Field
|
|
8
6
|
from typing_extensions import Annotated
|
|
9
7
|
|
|
@@ -28,25 +26,25 @@ class WaldiezAgentCodeExecutionConfig(WaldiezBase):
|
|
|
28
26
|
"""
|
|
29
27
|
|
|
30
28
|
work_dir: Annotated[
|
|
31
|
-
|
|
29
|
+
str | None,
|
|
32
30
|
Field(
|
|
33
31
|
default=None,
|
|
34
32
|
title="Working directory",
|
|
35
33
|
description="The working directory for the code execution.",
|
|
36
34
|
alias="workDir",
|
|
37
35
|
),
|
|
38
|
-
]
|
|
36
|
+
]
|
|
39
37
|
use_docker: Annotated[
|
|
40
|
-
|
|
38
|
+
bool | None,
|
|
41
39
|
Field(
|
|
42
40
|
default=None,
|
|
43
41
|
title="Use docker",
|
|
44
42
|
description="Run the code in a docker container.",
|
|
45
43
|
alias="useDocker",
|
|
46
44
|
),
|
|
47
|
-
]
|
|
45
|
+
]
|
|
48
46
|
timeout: Annotated[
|
|
49
|
-
|
|
47
|
+
float | None,
|
|
50
48
|
Field(
|
|
51
49
|
default=None,
|
|
52
50
|
title="Timeout",
|
|
@@ -54,15 +52,15 @@ class WaldiezAgentCodeExecutionConfig(WaldiezBase):
|
|
|
54
52
|
"The timeout for the code execution.Default: No timeout"
|
|
55
53
|
),
|
|
56
54
|
),
|
|
57
|
-
]
|
|
55
|
+
]
|
|
58
56
|
last_n_messages: Annotated[
|
|
59
|
-
|
|
57
|
+
int | None,
|
|
60
58
|
Field(
|
|
61
59
|
default=None,
|
|
62
60
|
title="Last N Messages",
|
|
63
61
|
description="The number of previous messages in the chat to use.",
|
|
64
62
|
),
|
|
65
|
-
]
|
|
63
|
+
]
|
|
66
64
|
functions: Annotated[
|
|
67
65
|
list[str],
|
|
68
66
|
Field(
|
|
@@ -70,4 +68,4 @@ class WaldiezAgentCodeExecutionConfig(WaldiezBase):
|
|
|
70
68
|
title="Functions",
|
|
71
69
|
description="If not using docker, the function ids to use",
|
|
72
70
|
),
|
|
73
|
-
]
|
|
71
|
+
]
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez Agent Termination Message Check."""
|
|
4
4
|
|
|
5
|
-
from typing import Optional
|
|
6
|
-
|
|
7
5
|
from pydantic import Field, model_validator
|
|
8
6
|
from typing_extensions import Annotated, Literal, Self
|
|
9
7
|
|
|
@@ -45,7 +43,7 @@ class WaldiezAgentTerminationMessage(WaldiezBase):
|
|
|
45
43
|
"none, keyword, method"
|
|
46
44
|
),
|
|
47
45
|
),
|
|
48
|
-
]
|
|
46
|
+
]
|
|
49
47
|
keywords: Annotated[
|
|
50
48
|
list[str],
|
|
51
49
|
Field(
|
|
@@ -56,9 +54,9 @@ class WaldiezAgentTerminationMessage(WaldiezBase):
|
|
|
56
54
|
" the keywords to search in the message."
|
|
57
55
|
),
|
|
58
56
|
),
|
|
59
|
-
]
|
|
57
|
+
]
|
|
60
58
|
criterion: Annotated[
|
|
61
|
-
|
|
59
|
+
Literal["found", "ending", "starting", "exact"] | None,
|
|
62
60
|
Field(
|
|
63
61
|
"exact",
|
|
64
62
|
title="Criterion",
|
|
@@ -67,9 +65,9 @@ class WaldiezAgentTerminationMessage(WaldiezBase):
|
|
|
67
65
|
"the criterion to use (e.g.: in, endswith, ==)"
|
|
68
66
|
),
|
|
69
67
|
),
|
|
70
|
-
]
|
|
68
|
+
]
|
|
71
69
|
method_content: Annotated[
|
|
72
|
-
|
|
70
|
+
str | None,
|
|
73
71
|
Field(
|
|
74
72
|
None,
|
|
75
73
|
title="Method content",
|
|
@@ -80,22 +78,22 @@ class WaldiezAgentTerminationMessage(WaldiezBase):
|
|
|
80
78
|
"bool (whether the message is a termination message or not.)"
|
|
81
79
|
),
|
|
82
80
|
),
|
|
83
|
-
]
|
|
81
|
+
]
|
|
84
82
|
|
|
85
83
|
_string: str = "None"
|
|
86
84
|
|
|
87
85
|
def get_termination_function(
|
|
88
86
|
self,
|
|
89
|
-
name_prefix:
|
|
90
|
-
name_suffix:
|
|
87
|
+
name_prefix: str | None = None,
|
|
88
|
+
name_suffix: str | None = None,
|
|
91
89
|
) -> tuple[str, str]:
|
|
92
90
|
"""Get the termination function.
|
|
93
91
|
|
|
94
92
|
Parameters
|
|
95
93
|
----------
|
|
96
|
-
name_prefix : str
|
|
94
|
+
name_prefix : str | None
|
|
97
95
|
The function name prefix.
|
|
98
|
-
name_suffix : str
|
|
96
|
+
name_suffix : str | None
|
|
99
97
|
The function name suffix.
|
|
100
98
|
|
|
101
99
|
Returns
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Update the agent's system message before they reply."""
|
|
4
4
|
|
|
5
|
-
from typing import Optional
|
|
6
|
-
|
|
7
5
|
from pydantic import Field, model_validator
|
|
8
6
|
from typing_extensions import Annotated, Literal, Self
|
|
9
7
|
|
|
@@ -78,8 +76,8 @@ class WaldiezAgentUpdateSystemMessage(WaldiezBase):
|
|
|
78
76
|
|
|
79
77
|
def get_content(
|
|
80
78
|
self,
|
|
81
|
-
name_prefix:
|
|
82
|
-
name_suffix:
|
|
79
|
+
name_prefix: str | None = None,
|
|
80
|
+
name_suffix: str | None = None,
|
|
83
81
|
) -> tuple[str, str]:
|
|
84
82
|
"""Get the update function content.
|
|
85
83
|
|
waldiez/models/agents/agents.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez agents model."""
|
|
4
4
|
|
|
5
|
-
from
|
|
5
|
+
from collections.abc import Iterator
|
|
6
6
|
|
|
7
7
|
from pydantic import Field, model_validator
|
|
8
8
|
from typing_extensions import Annotated, Self
|
|
@@ -44,7 +44,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
44
44
|
description="The User proxy agents in the flow.",
|
|
45
45
|
default_factory=list,
|
|
46
46
|
),
|
|
47
|
-
]
|
|
47
|
+
]
|
|
48
48
|
assistantAgents: Annotated[
|
|
49
49
|
list[WaldiezAssistant],
|
|
50
50
|
Field(
|
|
@@ -52,7 +52,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
52
52
|
description="The assistant agents in the flow.",
|
|
53
53
|
default_factory=list,
|
|
54
54
|
),
|
|
55
|
-
]
|
|
55
|
+
]
|
|
56
56
|
ragUserProxyAgents: Annotated[
|
|
57
57
|
list[WaldiezRagUserProxy],
|
|
58
58
|
Field(
|
|
@@ -60,7 +60,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
60
60
|
description="The RAG user proxy agents in the flow.",
|
|
61
61
|
default_factory=list,
|
|
62
62
|
),
|
|
63
|
-
]
|
|
63
|
+
]
|
|
64
64
|
reasoningAgents: Annotated[
|
|
65
65
|
list[WaldiezReasoningAgent],
|
|
66
66
|
Field(
|
|
@@ -68,7 +68,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
68
68
|
description="The Reasoning agents in the flow.",
|
|
69
69
|
default_factory=list,
|
|
70
70
|
),
|
|
71
|
-
]
|
|
71
|
+
]
|
|
72
72
|
captainAgents: Annotated[
|
|
73
73
|
list[WaldiezCaptainAgent],
|
|
74
74
|
Field(
|
|
@@ -76,7 +76,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
76
76
|
description="The Captain agents in the flow.",
|
|
77
77
|
default_factory=list,
|
|
78
78
|
),
|
|
79
|
-
]
|
|
79
|
+
]
|
|
80
80
|
groupManagerAgents: Annotated[
|
|
81
81
|
list[WaldiezGroupManager],
|
|
82
82
|
Field(
|
|
@@ -84,7 +84,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
84
84
|
description="The Group manager agents in the flow.",
|
|
85
85
|
default_factory=list,
|
|
86
86
|
),
|
|
87
|
-
]
|
|
87
|
+
]
|
|
88
88
|
docAgents: Annotated[
|
|
89
89
|
list[WaldiezDocAgent],
|
|
90
90
|
Field(
|
|
@@ -92,7 +92,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
92
92
|
description="The Document agents in the flow.",
|
|
93
93
|
default_factory=list,
|
|
94
94
|
),
|
|
95
|
-
]
|
|
95
|
+
]
|
|
96
96
|
|
|
97
97
|
@property
|
|
98
98
|
def members(self) -> Iterator[WaldiezAgent]:
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
|
|
4
|
+
# pyright: reportArgumentType=false,reportIncompatibleVariableOverride=false
|
|
5
|
+
|
|
3
6
|
"""Assistant agent model."""
|
|
4
7
|
|
|
5
8
|
from pydantic import Field
|
|
@@ -24,7 +27,7 @@ class WaldiezAssistant(WaldiezAgent):
|
|
|
24
27
|
The assistant agent's data
|
|
25
28
|
"""
|
|
26
29
|
|
|
27
|
-
agent_type: Annotated[
|
|
30
|
+
agent_type: Annotated[
|
|
28
31
|
Literal["assistant"],
|
|
29
32
|
Field(
|
|
30
33
|
"assistant",
|
|
@@ -33,11 +36,11 @@ class WaldiezAssistant(WaldiezAgent):
|
|
|
33
36
|
alias="agentType",
|
|
34
37
|
),
|
|
35
38
|
] = "assistant"
|
|
36
|
-
data: Annotated[
|
|
39
|
+
data: Annotated[
|
|
37
40
|
WaldiezAssistantData,
|
|
38
41
|
Field(
|
|
39
42
|
title="Data",
|
|
40
43
|
description="The assistant agent's data",
|
|
41
|
-
default_factory=WaldiezAssistantData,
|
|
44
|
+
default_factory=WaldiezAssistantData,
|
|
42
45
|
),
|
|
43
46
|
]
|
|
@@ -31,7 +31,7 @@ class WaldiezAssistantData(WaldiezAgentData):
|
|
|
31
31
|
description="The human input mode, Defaults to `NEVER`",
|
|
32
32
|
alias="humanInputMode",
|
|
33
33
|
),
|
|
34
|
-
]
|
|
34
|
+
]
|
|
35
35
|
is_multimodal: Annotated[
|
|
36
36
|
bool,
|
|
37
37
|
Field(
|
|
@@ -40,4 +40,4 @@ class WaldiezAssistantData(WaldiezAgentData):
|
|
|
40
40
|
description="A flag to indicate if the agent is multimodal.",
|
|
41
41
|
alias="isMultimodal",
|
|
42
42
|
),
|
|
43
|
-
]
|
|
43
|
+
]
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
|
|
4
|
+
# pyright: reportArgumentType=false,reportIncompatibleVariableOverride=false
|
|
5
|
+
|
|
3
6
|
"""Waldiez captain agent model."""
|
|
4
7
|
|
|
5
8
|
from typing import Literal
|
|
@@ -26,7 +29,7 @@ class WaldiezCaptainAgent(WaldiezAgent):
|
|
|
26
29
|
The captain agent's data.
|
|
27
30
|
"""
|
|
28
31
|
|
|
29
|
-
agent_type: Annotated[
|
|
32
|
+
agent_type: Annotated[
|
|
30
33
|
Literal["captain"],
|
|
31
34
|
Field(
|
|
32
35
|
default="captain",
|
|
@@ -34,12 +37,12 @@ class WaldiezCaptainAgent(WaldiezAgent):
|
|
|
34
37
|
description="The agent type: 'captain' for a captain agent",
|
|
35
38
|
alias="agentType",
|
|
36
39
|
),
|
|
37
|
-
]
|
|
38
|
-
data: Annotated[
|
|
40
|
+
]
|
|
41
|
+
data: Annotated[
|
|
39
42
|
WaldiezCaptainAgentData,
|
|
40
43
|
Field(
|
|
41
44
|
title="Data",
|
|
42
45
|
description="The captain agent's data",
|
|
43
|
-
default_factory=WaldiezCaptainAgentData,
|
|
46
|
+
default_factory=WaldiezCaptainAgentData,
|
|
44
47
|
),
|
|
45
48
|
]
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez captain agent data."""
|
|
4
4
|
|
|
5
|
-
from typing import Optional
|
|
6
|
-
|
|
7
5
|
from pydantic import Field
|
|
8
6
|
from typing_extensions import Annotated, Literal
|
|
9
7
|
|
|
@@ -32,16 +30,16 @@ class WaldiezCaptainAgentData(WaldiezAgentData):
|
|
|
32
30
|
description="The agent lib",
|
|
33
31
|
alias="agentLib",
|
|
34
32
|
),
|
|
35
|
-
]
|
|
33
|
+
]
|
|
36
34
|
tool_lib: Annotated[
|
|
37
|
-
|
|
35
|
+
Literal["default"] | None,
|
|
38
36
|
Field(
|
|
39
37
|
default=None,
|
|
40
38
|
title="Tool lib",
|
|
41
39
|
description="Whether to use the default tool lib",
|
|
42
40
|
alias="toolLib",
|
|
43
41
|
),
|
|
44
|
-
]
|
|
42
|
+
]
|
|
45
43
|
max_round: Annotated[
|
|
46
44
|
int,
|
|
47
45
|
Field(
|
|
@@ -50,7 +48,7 @@ class WaldiezCaptainAgentData(WaldiezAgentData):
|
|
|
50
48
|
description="The maximum number of rounds in a group chat",
|
|
51
49
|
alias="maxRound",
|
|
52
50
|
),
|
|
53
|
-
]
|
|
51
|
+
]
|
|
54
52
|
max_turns: Annotated[
|
|
55
53
|
int,
|
|
56
54
|
Field(
|
|
@@ -59,4 +57,4 @@ class WaldiezCaptainAgentData(WaldiezAgentData):
|
|
|
59
57
|
description="The maximum number of turns for a chat",
|
|
60
58
|
alias="maxTurns",
|
|
61
59
|
),
|
|
62
|
-
]
|
|
60
|
+
]
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
|
|
4
|
+
# pyright: reportArgumentType=false,reportIncompatibleVariableOverride=false
|
|
5
|
+
|
|
3
6
|
"""Document agent model."""
|
|
4
7
|
|
|
5
8
|
from typing import Literal
|
|
@@ -23,7 +26,7 @@ class WaldiezDocAgent(WaldiezAgent):
|
|
|
23
26
|
Extends `WaldiezAgent`.
|
|
24
27
|
"""
|
|
25
28
|
|
|
26
|
-
agent_type: Annotated[
|
|
29
|
+
agent_type: Annotated[
|
|
27
30
|
Literal["doc_agent"],
|
|
28
31
|
Field(
|
|
29
32
|
default="doc_agent",
|
|
@@ -31,13 +34,13 @@ class WaldiezDocAgent(WaldiezAgent):
|
|
|
31
34
|
description="The agent type: 'doc_agent' for a document agent",
|
|
32
35
|
alias="agentType",
|
|
33
36
|
),
|
|
34
|
-
]
|
|
35
|
-
data: Annotated[
|
|
37
|
+
]
|
|
38
|
+
data: Annotated[
|
|
36
39
|
WaldiezDocAgentData,
|
|
37
40
|
Field(
|
|
38
41
|
title="Data",
|
|
39
42
|
description="The document agent's data",
|
|
40
|
-
default_factory=WaldiezDocAgentData,
|
|
43
|
+
default_factory=WaldiezDocAgentData,
|
|
41
44
|
),
|
|
42
45
|
]
|
|
43
46
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
"""Document agent data model."""
|
|
4
4
|
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Optional, Union
|
|
7
6
|
|
|
8
7
|
from pydantic import Field, model_validator
|
|
9
8
|
from typing_extensions import Annotated, Self
|
|
@@ -25,14 +24,14 @@ class WaldiezDocAgentData(WaldiezAgentData):
|
|
|
25
24
|
"""
|
|
26
25
|
|
|
27
26
|
collection_name: Annotated[
|
|
28
|
-
|
|
27
|
+
str | None,
|
|
29
28
|
Field(
|
|
30
29
|
title="Collection Name",
|
|
31
30
|
description="The name of the collection for the document agent.",
|
|
32
31
|
default=None,
|
|
33
32
|
alias="collectionName",
|
|
34
33
|
),
|
|
35
|
-
]
|
|
34
|
+
]
|
|
36
35
|
reset_collection: Annotated[
|
|
37
36
|
bool,
|
|
38
37
|
Field(
|
|
@@ -43,9 +42,9 @@ class WaldiezDocAgentData(WaldiezAgentData):
|
|
|
43
42
|
default=False,
|
|
44
43
|
alias="resetCollection",
|
|
45
44
|
),
|
|
46
|
-
]
|
|
45
|
+
]
|
|
47
46
|
parsed_docs_path: Annotated[
|
|
48
|
-
|
|
47
|
+
str | Path | None,
|
|
49
48
|
Field(
|
|
50
49
|
title="Parsed Documents Path",
|
|
51
50
|
description=(
|
|
@@ -54,16 +53,16 @@ class WaldiezDocAgentData(WaldiezAgentData):
|
|
|
54
53
|
default=None,
|
|
55
54
|
alias="parsedDocsPath",
|
|
56
55
|
),
|
|
57
|
-
]
|
|
56
|
+
]
|
|
58
57
|
query_engine: Annotated[
|
|
59
|
-
|
|
58
|
+
WaldiezDocAgentQueryEngine | None,
|
|
60
59
|
Field(
|
|
61
60
|
title="Query Engine",
|
|
62
61
|
description="The query engine to use for the document agent.",
|
|
63
62
|
default=None,
|
|
64
63
|
alias="queryEngine",
|
|
65
64
|
),
|
|
66
|
-
]
|
|
65
|
+
]
|
|
67
66
|
|
|
68
67
|
@model_validator(mode="after")
|
|
69
68
|
def validate_parsed_docs_path(self) -> Self:
|
|
@@ -129,13 +128,13 @@ class WaldiezDocAgentData(WaldiezAgentData):
|
|
|
129
128
|
|
|
130
129
|
|
|
131
130
|
def get_parsed_docs_path(
|
|
132
|
-
parsed_docs_path:
|
|
131
|
+
parsed_docs_path: str | Path | None = None,
|
|
133
132
|
) -> str:
|
|
134
133
|
"""Get the parsed documents path for the document agent.
|
|
135
134
|
|
|
136
135
|
Parameters
|
|
137
136
|
----------
|
|
138
|
-
parsed_docs_path :
|
|
137
|
+
parsed_docs_path : str | Path | None
|
|
139
138
|
The path to the parsed documents.
|
|
140
139
|
|
|
141
140
|
Returns
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
"""Document agent data model."""
|
|
4
4
|
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Optional, Union
|
|
7
6
|
|
|
8
7
|
from platformdirs import user_data_dir
|
|
9
8
|
from pydantic import Field, model_validator
|
|
@@ -19,24 +18,23 @@ class WaldiezDocAgentQueryEngine(WaldiezBase):
|
|
|
19
18
|
"""
|
|
20
19
|
|
|
21
20
|
type: Annotated[
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
],
|
|
21
|
+
Literal[
|
|
22
|
+
"VectorChromaQueryEngine",
|
|
23
|
+
"VectorChromaCitationQueryEngine",
|
|
24
|
+
"InMemoryQueryEngine",
|
|
25
|
+
]
|
|
26
|
+
| None,
|
|
29
27
|
"RAG Query Engine type",
|
|
30
28
|
] = "VectorChromaQueryEngine"
|
|
31
29
|
db_path: Annotated[
|
|
32
|
-
|
|
30
|
+
str | Path | None,
|
|
33
31
|
Field(
|
|
34
32
|
title="Database Path",
|
|
35
33
|
description="The path to the database for the query engine.",
|
|
36
34
|
default=None,
|
|
37
35
|
alias="dbPath",
|
|
38
36
|
),
|
|
39
|
-
]
|
|
37
|
+
]
|
|
40
38
|
enable_query_citations: Annotated[
|
|
41
39
|
bool,
|
|
42
40
|
Field(
|
|
@@ -47,7 +45,7 @@ class WaldiezDocAgentQueryEngine(WaldiezBase):
|
|
|
47
45
|
default=False,
|
|
48
46
|
alias="enableQueryCitations",
|
|
49
47
|
),
|
|
50
|
-
]
|
|
48
|
+
]
|
|
51
49
|
citation_chunk_size: Annotated[
|
|
52
50
|
int,
|
|
53
51
|
Field(
|
|
@@ -56,7 +54,7 @@ class WaldiezDocAgentQueryEngine(WaldiezBase):
|
|
|
56
54
|
default=512,
|
|
57
55
|
alias="citationChunkSize",
|
|
58
56
|
),
|
|
59
|
-
]
|
|
57
|
+
]
|
|
60
58
|
|
|
61
59
|
@model_validator(mode="after")
|
|
62
60
|
def validate_db_path(self) -> Self:
|