waldiez 0.5.10__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 +19 -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 +15 -16
- 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 +40 -24
- waldiez/exporting/agent/extras/group_member_extras.py +6 -5
- waldiez/exporting/agent/extras/handoffs/after_work.py +2 -1
- waldiez/exporting/agent/extras/handoffs/available.py +2 -1
- waldiez/exporting/agent/extras/handoffs/condition.py +3 -2
- waldiez/exporting/agent/extras/handoffs/handoff.py +2 -1
- waldiez/exporting/agent/extras/handoffs/target.py +7 -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/agent/termination.py +1 -0
- 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/constants.py +3 -1
- 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 +13 -11
- waldiez/exporting/core/protocols.py +6 -5
- waldiez/exporting/core/result.py +25 -28
- waldiez/exporting/core/types.py +11 -10
- waldiez/exporting/core/utils/llm_config.py +4 -4
- waldiez/exporting/core/validation.py +10 -11
- waldiez/exporting/flow/execution_generator.py +99 -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 +6 -6
- waldiez/exporting/flow/utils/importing.py +7 -8
- waldiez/exporting/flow/utils/linting.py +25 -9
- waldiez/exporting/flow/utils/logging.py +5 -77
- 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 +11 -5
- waldiez/io/_ws.py +12 -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 +122 -70
- waldiez/io/utils.py +19 -10
- waldiez/io/ws.py +7 -3
- waldiez/logger.py +16 -3
- waldiez/models/agents/__init__.py +3 -0
- waldiez/models/agents/agent/agent.py +25 -17
- 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 +28 -20
- waldiez/models/chat/chat_data.py +22 -21
- 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/base.py +2 -0
- waldiez/models/common/dict_utils.py +8 -6
- waldiez/models/common/handoff.py +20 -17
- waldiez/models/common/method_utils.py +9 -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 +8 -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 +4 -0
- waldiez/models/tool/predefined/_google.py +1 -0
- waldiez/models/tool/predefined/_perplexity.py +2 -1
- waldiez/models/tool/predefined/_searxng.py +2 -1
- waldiez/models/tool/predefined/_tavily.py +1 -0
- waldiez/models/tool/predefined/_wikipedia.py +2 -1
- 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 +155 -241
- 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 +24 -27
- waldiez/running/step_by_step/breakpoints_mixin.py +503 -47
- waldiez/running/step_by_step/command_handler.py +154 -0
- waldiez/running/step_by_step/events_processor.py +379 -0
- waldiez/running/step_by_step/step_by_step_models.py +425 -41
- waldiez/running/step_by_step/step_by_step_runner.py +437 -382
- waldiez/running/subprocess_runner/__base__.py +13 -8
- waldiez/running/subprocess_runner/_async_runner.py +6 -4
- waldiez/running/subprocess_runner/_sync_runner.py +11 -6
- waldiez/running/subprocess_runner/runner.py +48 -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/__init__.py +8 -7
- waldiez/ws/_file_handler.py +18 -20
- waldiez/ws/_mock.py +75 -0
- waldiez/ws/cli.py +58 -10
- waldiez/ws/client_manager.py +77 -53
- waldiez/ws/errors.py +3 -0
- waldiez/ws/models.py +61 -53
- waldiez/ws/reloader.py +33 -4
- waldiez/ws/server.py +121 -52
- waldiez/ws/session_manager.py +8 -9
- waldiez/ws/session_stats.py +1 -1
- waldiez/ws/utils.py +33 -5
- {waldiez-0.5.10.dist-info → waldiez-0.6.1.dist-info}/METADATA +107 -109
- waldiez-0.6.1.dist-info/RECORD +254 -0
- waldiez/running/post_run.py +0 -180
- waldiez/running/pre_run.py +0 -159
- waldiez/running/run_results.py +0 -14
- waldiez/running/utils.py +0 -511
- waldiez-0.5.10.dist-info/RECORD +0 -248
- {waldiez-0.5.10.dist-info → waldiez-0.6.1.dist-info}/WHEEL +0 -0
- {waldiez-0.5.10.dist-info → waldiez-0.6.1.dist-info}/entry_points.txt +0 -0
- {waldiez-0.5.10.dist-info → waldiez-0.6.1.dist-info}/licenses/LICENSE +0 -0
- {waldiez-0.5.10.dist-info → waldiez-0.6.1.dist-info}/licenses/NOTICE.md +0 -0
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
|
|
4
|
+
# pylint: disable=invalid-name
|
|
5
|
+
# pyright: reportArgumentType=false
|
|
6
|
+
|
|
3
7
|
"""RAG user agent retrieve config."""
|
|
4
8
|
|
|
5
9
|
import os
|
|
6
10
|
from pathlib import Path
|
|
7
|
-
from typing import Optional, Union
|
|
8
11
|
|
|
9
12
|
from pydantic import Field, model_validator
|
|
10
13
|
from typing_extensions import Annotated, Literal, Self
|
|
@@ -89,7 +92,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
89
92
|
updates existing documents and adds new ones. Default is True.
|
|
90
93
|
Document id is used to determine if a document is new or existing.
|
|
91
94
|
By default, the id is the hash value of the content.
|
|
92
|
-
model :
|
|
95
|
+
model : str | None
|
|
93
96
|
The model to use for the retrieve chat. If key not provided, a default
|
|
94
97
|
model gpt-4 will be used.
|
|
95
98
|
chunk_token_size : Optional[int]
|
|
@@ -98,7 +101,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
98
101
|
context_max_tokens : Optional[int]
|
|
99
102
|
The context max token size for the retrieve chat. If key not provided,
|
|
100
103
|
a default size max_tokens * 0.8 will be used.
|
|
101
|
-
chunk_mode :
|
|
104
|
+
chunk_mode : str | None
|
|
102
105
|
The chunk mode for the retrieve chat. Possible values are 'multi_lines'
|
|
103
106
|
and 'one_line'. If key not provided, a default mode multi_lines will be
|
|
104
107
|
used.
|
|
@@ -108,22 +111,22 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
108
111
|
use_custom_embedding: bool
|
|
109
112
|
Whether to use custom embedding for the retrieve chat. Default is False.
|
|
110
113
|
If True, the embedding_function should be provided.
|
|
111
|
-
embedding_function :
|
|
114
|
+
embedding_function : str | None
|
|
112
115
|
The embedding function for creating the vector db. Default is None,
|
|
113
116
|
SentenceTransformer with the given embedding_model will be used. If
|
|
114
117
|
you want to use OpenAI, Cohere, HuggingFace or other embedding
|
|
115
118
|
functions, you can pass it here, follow the examples in
|
|
116
119
|
https://docs.trychroma.com/guides/embeddings.
|
|
117
|
-
customized_prompt :
|
|
120
|
+
customized_prompt : str | None
|
|
118
121
|
The customized prompt for the retrieve chat. Default is None.
|
|
119
|
-
customized_answer_prefix :
|
|
122
|
+
customized_answer_prefix : str | None
|
|
120
123
|
The customized answer prefix for the retrieve chat. Default is ''. If
|
|
121
124
|
not '' and the customized_answer_prefix is not in the answer, Update
|
|
122
125
|
Context will be triggered.
|
|
123
126
|
update_context : bool
|
|
124
127
|
If False, will not apply Update Context for interactive retrieval.
|
|
125
128
|
Default is True.
|
|
126
|
-
collection_name :
|
|
129
|
+
collection_name : str | None
|
|
127
130
|
The name of the collection. If key not provided, a default name
|
|
128
131
|
autogen-docs will be used.
|
|
129
132
|
get_or_create : bool
|
|
@@ -139,7 +142,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
139
142
|
Whether to use custom token count function for the retrieve chat.
|
|
140
143
|
Default is False. If True, the custom_token_count_function should be
|
|
141
144
|
provided.
|
|
142
|
-
custom_token_count_function :
|
|
145
|
+
custom_token_count_function : str | None
|
|
143
146
|
A custom function to count the number of tokens in a string. The
|
|
144
147
|
function should take (text:str, model:str) as input and return the
|
|
145
148
|
token_count(int). the retrieve_config['model'] will be passed in the
|
|
@@ -148,7 +151,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
148
151
|
use_custom_text_split: bool
|
|
149
152
|
Whether to use custom text split function for the retrieve chat. Default
|
|
150
153
|
is False. If True, the custom_text_split_function should be provided.
|
|
151
|
-
custom_text_split_function :
|
|
154
|
+
custom_text_split_function : str | None
|
|
152
155
|
A custom function to split a string into a list of strings. Default is
|
|
153
156
|
None, will use the default function in autogen.retrieve_utils.
|
|
154
157
|
split_text_to_chunks.
|
|
@@ -181,7 +184,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
181
184
|
"the response."
|
|
182
185
|
),
|
|
183
186
|
),
|
|
184
|
-
]
|
|
187
|
+
]
|
|
185
188
|
vector_db: Annotated[
|
|
186
189
|
WaldiezRagUserProxyVectorDb,
|
|
187
190
|
Field(
|
|
@@ -189,7 +192,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
189
192
|
title="Vector DB",
|
|
190
193
|
description="The vector db for the retrieve chat.",
|
|
191
194
|
),
|
|
192
|
-
]
|
|
195
|
+
]
|
|
193
196
|
db_config: Annotated[
|
|
194
197
|
WaldiezRagUserProxyVectorDbConfig,
|
|
195
198
|
Field(
|
|
@@ -199,7 +202,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
199
202
|
),
|
|
200
203
|
]
|
|
201
204
|
docs_path: Annotated[
|
|
202
|
-
|
|
205
|
+
str | list[str] | None,
|
|
203
206
|
Field(
|
|
204
207
|
default=None,
|
|
205
208
|
title="Docs Path",
|
|
@@ -210,7 +213,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
210
213
|
"only if the collection is already created."
|
|
211
214
|
),
|
|
212
215
|
),
|
|
213
|
-
]
|
|
216
|
+
]
|
|
214
217
|
new_docs: Annotated[
|
|
215
218
|
bool,
|
|
216
219
|
Field(
|
|
@@ -224,9 +227,9 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
224
227
|
"hash value of the content."
|
|
225
228
|
),
|
|
226
229
|
),
|
|
227
|
-
]
|
|
230
|
+
]
|
|
228
231
|
model: Annotated[
|
|
229
|
-
|
|
232
|
+
str | None,
|
|
230
233
|
Field(
|
|
231
234
|
default=None,
|
|
232
235
|
title="Model",
|
|
@@ -235,9 +238,9 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
235
238
|
"we check for models linked to the agent."
|
|
236
239
|
),
|
|
237
240
|
),
|
|
238
|
-
]
|
|
241
|
+
]
|
|
239
242
|
chunk_token_size: Annotated[
|
|
240
|
-
|
|
243
|
+
int | None,
|
|
241
244
|
Field(
|
|
242
245
|
default=None,
|
|
243
246
|
title="Chunk Token Size",
|
|
@@ -247,9 +250,9 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
247
250
|
"will be used."
|
|
248
251
|
),
|
|
249
252
|
),
|
|
250
|
-
]
|
|
253
|
+
]
|
|
251
254
|
context_max_tokens: Annotated[
|
|
252
|
-
|
|
255
|
+
int | None,
|
|
253
256
|
Field(
|
|
254
257
|
default=None,
|
|
255
258
|
title="Context Max Tokens",
|
|
@@ -259,7 +262,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
259
262
|
"will be used."
|
|
260
263
|
),
|
|
261
264
|
),
|
|
262
|
-
]
|
|
265
|
+
]
|
|
263
266
|
chunk_mode: Annotated[
|
|
264
267
|
WaldiezRagUserProxyChunkMode,
|
|
265
268
|
Field(
|
|
@@ -271,7 +274,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
271
274
|
"a default mode multi_lines will be used."
|
|
272
275
|
),
|
|
273
276
|
),
|
|
274
|
-
]
|
|
277
|
+
]
|
|
275
278
|
must_break_at_empty_line: Annotated[
|
|
276
279
|
bool,
|
|
277
280
|
Field(
|
|
@@ -282,7 +285,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
282
285
|
"If chunk_mode is 'one_line', this parameter will be ignored."
|
|
283
286
|
),
|
|
284
287
|
),
|
|
285
|
-
]
|
|
288
|
+
]
|
|
286
289
|
use_custom_embedding: Annotated[
|
|
287
290
|
bool,
|
|
288
291
|
Field(
|
|
@@ -294,9 +297,9 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
294
297
|
"provided."
|
|
295
298
|
),
|
|
296
299
|
),
|
|
297
|
-
]
|
|
300
|
+
]
|
|
298
301
|
embedding_function: Annotated[
|
|
299
|
-
|
|
302
|
+
str | None,
|
|
300
303
|
Field(
|
|
301
304
|
default=None,
|
|
302
305
|
title="Embedding Function",
|
|
@@ -309,9 +312,9 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
309
312
|
"https://docs.trychroma.com/guides/embeddings."
|
|
310
313
|
),
|
|
311
314
|
),
|
|
312
|
-
]
|
|
315
|
+
]
|
|
313
316
|
customized_prompt: Annotated[
|
|
314
|
-
|
|
317
|
+
str | None,
|
|
315
318
|
Field(
|
|
316
319
|
default=None,
|
|
317
320
|
title="Customized Prompt",
|
|
@@ -319,9 +322,9 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
319
322
|
"The customized prompt for the retrieve chat. Default is None."
|
|
320
323
|
),
|
|
321
324
|
),
|
|
322
|
-
]
|
|
325
|
+
]
|
|
323
326
|
customized_answer_prefix: Annotated[
|
|
324
|
-
|
|
327
|
+
str | None,
|
|
325
328
|
Field(
|
|
326
329
|
default="",
|
|
327
330
|
title="Customized Answer Prefix",
|
|
@@ -331,7 +334,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
331
334
|
"not in the answer, Update Context will be triggered."
|
|
332
335
|
),
|
|
333
336
|
),
|
|
334
|
-
]
|
|
337
|
+
]
|
|
335
338
|
update_context: Annotated[
|
|
336
339
|
bool,
|
|
337
340
|
Field(
|
|
@@ -342,7 +345,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
342
345
|
"retrieval. Default is True."
|
|
343
346
|
),
|
|
344
347
|
),
|
|
345
|
-
]
|
|
348
|
+
]
|
|
346
349
|
collection_name: Annotated[
|
|
347
350
|
str,
|
|
348
351
|
Field(
|
|
@@ -353,7 +356,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
353
356
|
"a default name autogen-docs will be used."
|
|
354
357
|
),
|
|
355
358
|
),
|
|
356
|
-
]
|
|
359
|
+
]
|
|
357
360
|
get_or_create: Annotated[
|
|
358
361
|
bool,
|
|
359
362
|
Field(
|
|
@@ -363,7 +366,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
363
366
|
"Whether to get the collection if it exists. Default is False."
|
|
364
367
|
),
|
|
365
368
|
),
|
|
366
|
-
]
|
|
369
|
+
]
|
|
367
370
|
overwrite: Annotated[
|
|
368
371
|
bool,
|
|
369
372
|
Field(
|
|
@@ -381,7 +384,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
381
384
|
" otherwise it raise a ValueError."
|
|
382
385
|
),
|
|
383
386
|
),
|
|
384
|
-
]
|
|
387
|
+
]
|
|
385
388
|
use_custom_token_count: Annotated[
|
|
386
389
|
bool,
|
|
387
390
|
Field(
|
|
@@ -393,9 +396,9 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
393
396
|
"custom_token_count_function should be provided."
|
|
394
397
|
),
|
|
395
398
|
),
|
|
396
|
-
]
|
|
399
|
+
]
|
|
397
400
|
custom_token_count_function: Annotated[
|
|
398
|
-
|
|
401
|
+
str | None,
|
|
399
402
|
Field(
|
|
400
403
|
default=None,
|
|
401
404
|
title="Custom Token Count Function",
|
|
@@ -408,7 +411,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
408
411
|
"tiktoken, which may not be accurate for non-OpenAI models."
|
|
409
412
|
),
|
|
410
413
|
),
|
|
411
|
-
]
|
|
414
|
+
]
|
|
412
415
|
use_custom_text_split: Annotated[
|
|
413
416
|
bool,
|
|
414
417
|
Field(
|
|
@@ -420,9 +423,9 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
420
423
|
"custom_text_split_function should be provided."
|
|
421
424
|
),
|
|
422
425
|
),
|
|
423
|
-
]
|
|
426
|
+
]
|
|
424
427
|
custom_text_split_function: Annotated[
|
|
425
|
-
|
|
428
|
+
str | None,
|
|
426
429
|
Field(
|
|
427
430
|
default=None,
|
|
428
431
|
title="Custom Text Split Function",
|
|
@@ -432,9 +435,9 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
432
435
|
"autogen.retrieve_utils.split_text_to_chunks."
|
|
433
436
|
),
|
|
434
437
|
),
|
|
435
|
-
]
|
|
438
|
+
]
|
|
436
439
|
custom_text_types: Annotated[
|
|
437
|
-
|
|
440
|
+
list[str] | None,
|
|
438
441
|
Field(
|
|
439
442
|
default=None,
|
|
440
443
|
title="Custom Text Types",
|
|
@@ -446,7 +449,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
446
449
|
"chunked regardless of their types."
|
|
447
450
|
),
|
|
448
451
|
),
|
|
449
|
-
]
|
|
452
|
+
]
|
|
450
453
|
recursive: Annotated[
|
|
451
454
|
bool,
|
|
452
455
|
Field(
|
|
@@ -457,7 +460,7 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
457
460
|
"Default is True."
|
|
458
461
|
),
|
|
459
462
|
),
|
|
460
|
-
]
|
|
463
|
+
]
|
|
461
464
|
distance_threshold: Annotated[
|
|
462
465
|
float,
|
|
463
466
|
Field(
|
|
@@ -469,9 +472,9 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
469
472
|
"Will be ignored if < 0. Default is -1."
|
|
470
473
|
),
|
|
471
474
|
),
|
|
472
|
-
]
|
|
475
|
+
]
|
|
473
476
|
n_results: Annotated[
|
|
474
|
-
|
|
477
|
+
int | None,
|
|
475
478
|
Field(
|
|
476
479
|
default=None,
|
|
477
480
|
title="Number of Results",
|
|
@@ -481,50 +484,50 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
481
484
|
"Use None or <1 to return all results."
|
|
482
485
|
),
|
|
483
486
|
),
|
|
484
|
-
]
|
|
485
|
-
_embedding_function_string:
|
|
487
|
+
]
|
|
488
|
+
_embedding_function_string: str | None = None
|
|
486
489
|
|
|
487
|
-
_token_count_function_string:
|
|
490
|
+
_token_count_function_string: str | None = None
|
|
488
491
|
|
|
489
|
-
_text_split_function_string:
|
|
492
|
+
_text_split_function_string: str | None = None
|
|
490
493
|
|
|
491
494
|
@property
|
|
492
|
-
def embedding_function_string(self) ->
|
|
495
|
+
def embedding_function_string(self) -> str | None:
|
|
493
496
|
"""Get the embedding function string.
|
|
494
497
|
|
|
495
498
|
Returns
|
|
496
499
|
-------
|
|
497
|
-
|
|
500
|
+
str | None
|
|
498
501
|
The embedding function string.
|
|
499
502
|
"""
|
|
500
503
|
return self._embedding_function_string
|
|
501
504
|
|
|
502
505
|
@property
|
|
503
|
-
def token_count_function_string(self) ->
|
|
506
|
+
def token_count_function_string(self) -> str | None:
|
|
504
507
|
"""Get the token count function string.
|
|
505
508
|
|
|
506
509
|
Returns
|
|
507
510
|
-------
|
|
508
|
-
|
|
511
|
+
str | None
|
|
509
512
|
The token count function string.
|
|
510
513
|
"""
|
|
511
514
|
return self._token_count_function_string
|
|
512
515
|
|
|
513
516
|
@property
|
|
514
|
-
def text_split_function_string(self) ->
|
|
517
|
+
def text_split_function_string(self) -> str | None:
|
|
515
518
|
"""Get the text split function string.
|
|
516
519
|
|
|
517
520
|
Returns
|
|
518
521
|
-------
|
|
519
|
-
|
|
522
|
+
str | None
|
|
520
523
|
The text split function string.
|
|
521
524
|
"""
|
|
522
525
|
return self._text_split_function_string
|
|
523
526
|
|
|
524
527
|
def get_custom_embedding_function(
|
|
525
528
|
self,
|
|
526
|
-
name_prefix:
|
|
527
|
-
name_suffix:
|
|
529
|
+
name_prefix: str | None = None,
|
|
530
|
+
name_suffix: str | None = None,
|
|
528
531
|
) -> tuple[str, str]:
|
|
529
532
|
"""Generate the custom embedding function.
|
|
530
533
|
|
|
@@ -557,8 +560,8 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
557
560
|
|
|
558
561
|
def get_custom_token_count_function(
|
|
559
562
|
self,
|
|
560
|
-
name_prefix:
|
|
561
|
-
name_suffix:
|
|
563
|
+
name_prefix: str | None = None,
|
|
564
|
+
name_suffix: str | None = None,
|
|
562
565
|
) -> tuple[str, str]:
|
|
563
566
|
"""Generate the custom token count function.
|
|
564
567
|
|
|
@@ -591,8 +594,8 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
591
594
|
|
|
592
595
|
def get_custom_text_split_function(
|
|
593
596
|
self,
|
|
594
|
-
name_prefix:
|
|
595
|
-
name_suffix:
|
|
597
|
+
name_prefix: str | None = None,
|
|
598
|
+
name_suffix: str | None = None,
|
|
596
599
|
) -> tuple[str, str]:
|
|
597
600
|
"""Generate the custom text split function.
|
|
598
601
|
|
|
@@ -633,10 +636,11 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
633
636
|
"""
|
|
634
637
|
if self.use_custom_embedding:
|
|
635
638
|
if not self.embedding_function:
|
|
636
|
-
|
|
639
|
+
msg = (
|
|
637
640
|
"The embedding_function is required "
|
|
638
641
|
"if use_custom_embedding is True."
|
|
639
642
|
)
|
|
643
|
+
raise ValueError(msg)
|
|
640
644
|
valid, error_or_content = check_function(
|
|
641
645
|
code_string=self.embedding_function,
|
|
642
646
|
function_name=CUSTOM_EMBEDDING_FUNCTION,
|
|
@@ -656,10 +660,11 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
656
660
|
"""
|
|
657
661
|
if self.use_custom_token_count:
|
|
658
662
|
if not self.custom_token_count_function:
|
|
659
|
-
|
|
663
|
+
msg = (
|
|
660
664
|
"The custom_token_count_function is required "
|
|
661
665
|
"if use_custom_token_count is True."
|
|
662
666
|
)
|
|
667
|
+
raise ValueError(msg)
|
|
663
668
|
valid, error_or_content = check_function(
|
|
664
669
|
code_string=self.custom_token_count_function,
|
|
665
670
|
function_name=CUSTOM_TOKEN_COUNT_FUNCTION,
|
|
@@ -679,10 +684,11 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
|
|
|
679
684
|
"""
|
|
680
685
|
if self.use_custom_text_split:
|
|
681
686
|
if not self.custom_text_split_function:
|
|
682
|
-
|
|
687
|
+
msg = (
|
|
683
688
|
"The custom_text_split_function is required "
|
|
684
689
|
"if use_custom_text_split is True."
|
|
685
690
|
)
|
|
691
|
+
raise ValueError(msg)
|
|
686
692
|
valid, error_or_content = check_function(
|
|
687
693
|
code_string=self.custom_text_split_function,
|
|
688
694
|
function_name=CUSTOM_TEXT_SPLIT_FUNCTION,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"""The vector db config for the RAG user agent."""
|
|
6
6
|
|
|
7
7
|
from pathlib import Path
|
|
8
|
-
from typing import Any
|
|
8
|
+
from typing import Any
|
|
9
9
|
|
|
10
10
|
from pydantic import ConfigDict, Field, model_validator
|
|
11
11
|
from pydantic.alias_generators import to_camel
|
|
@@ -26,14 +26,14 @@ class WaldiezRagUserProxyVectorDbConfig(WaldiezBase):
|
|
|
26
26
|
Whether to use memory for the vector db (if `qdrant` is used).
|
|
27
27
|
use_local_storage : bool
|
|
28
28
|
Whether to use local storage for the db (if `qdrant` or `chroma` is used).
|
|
29
|
-
local_storage_path :
|
|
29
|
+
local_storage_path : str | None
|
|
30
30
|
The path to the local storage for the vector db (if `qdrant` or `chroma` is used).
|
|
31
|
-
connection_url :
|
|
31
|
+
connection_url : str | None
|
|
32
32
|
The connection url for the vector db.
|
|
33
|
-
wait_until_index_ready :
|
|
33
|
+
wait_until_index_ready : float | None
|
|
34
34
|
Blocking call to wait until the database indexes are ready (if `mongodb` is used).
|
|
35
35
|
None, the default, means no wait.
|
|
36
|
-
wait_until_document_ready :
|
|
36
|
+
wait_until_document_ready : float | None
|
|
37
37
|
Blocking call to wait until the database documents are ready (if `mongodb` is used).
|
|
38
38
|
None, the default, means no wait.
|
|
39
39
|
metadata : Optional[dict[str, Any]]
|
|
@@ -50,13 +50,13 @@ class WaldiezRagUserProxyVectorDbConfig(WaldiezBase):
|
|
|
50
50
|
)
|
|
51
51
|
|
|
52
52
|
model: Annotated[
|
|
53
|
-
|
|
53
|
+
str | None,
|
|
54
54
|
Field(
|
|
55
55
|
None,
|
|
56
56
|
title="Model",
|
|
57
57
|
description="The model to use for the vector db embeddings.",
|
|
58
58
|
),
|
|
59
|
-
]
|
|
59
|
+
]
|
|
60
60
|
use_memory: Annotated[
|
|
61
61
|
bool,
|
|
62
62
|
Field(
|
|
@@ -66,7 +66,7 @@ class WaldiezRagUserProxyVectorDbConfig(WaldiezBase):
|
|
|
66
66
|
"Whether to use memory for the vector db (if qdrant is used)."
|
|
67
67
|
),
|
|
68
68
|
),
|
|
69
|
-
]
|
|
69
|
+
]
|
|
70
70
|
use_local_storage: Annotated[
|
|
71
71
|
bool,
|
|
72
72
|
Field(
|
|
@@ -77,9 +77,9 @@ class WaldiezRagUserProxyVectorDbConfig(WaldiezBase):
|
|
|
77
77
|
"(if qdrant or chroma is used)."
|
|
78
78
|
),
|
|
79
79
|
),
|
|
80
|
-
]
|
|
80
|
+
]
|
|
81
81
|
local_storage_path: Annotated[
|
|
82
|
-
|
|
82
|
+
str | None,
|
|
83
83
|
Field(
|
|
84
84
|
None,
|
|
85
85
|
title="Local Storage Path",
|
|
@@ -88,17 +88,17 @@ class WaldiezRagUserProxyVectorDbConfig(WaldiezBase):
|
|
|
88
88
|
"(if qdrant is used)."
|
|
89
89
|
),
|
|
90
90
|
),
|
|
91
|
-
]
|
|
91
|
+
]
|
|
92
92
|
connection_url: Annotated[
|
|
93
|
-
|
|
93
|
+
str | None,
|
|
94
94
|
Field(
|
|
95
95
|
None,
|
|
96
96
|
title="Connection URL",
|
|
97
97
|
description="The connection url for the vector db.",
|
|
98
98
|
),
|
|
99
|
-
]
|
|
99
|
+
]
|
|
100
100
|
wait_until_index_ready: Annotated[
|
|
101
|
-
|
|
101
|
+
float | None,
|
|
102
102
|
Field(
|
|
103
103
|
None,
|
|
104
104
|
title="Wait Until Index Ready",
|
|
@@ -107,9 +107,9 @@ class WaldiezRagUserProxyVectorDbConfig(WaldiezBase):
|
|
|
107
107
|
"None, the default, means no wait."
|
|
108
108
|
),
|
|
109
109
|
),
|
|
110
|
-
]
|
|
110
|
+
]
|
|
111
111
|
wait_until_document_ready: Annotated[
|
|
112
|
-
|
|
112
|
+
float | None,
|
|
113
113
|
Field(
|
|
114
114
|
None,
|
|
115
115
|
title="Wait Until Document Ready",
|
|
@@ -118,9 +118,9 @@ class WaldiezRagUserProxyVectorDbConfig(WaldiezBase):
|
|
|
118
118
|
"are ready. None, the default, means no wait."
|
|
119
119
|
),
|
|
120
120
|
),
|
|
121
|
-
]
|
|
121
|
+
]
|
|
122
122
|
metadata: Annotated[
|
|
123
|
-
|
|
123
|
+
dict[str, Any] | None,
|
|
124
124
|
Field(
|
|
125
125
|
None,
|
|
126
126
|
title="Metadata",
|
|
@@ -131,7 +131,7 @@ class WaldiezRagUserProxyVectorDbConfig(WaldiezBase):
|
|
|
131
131
|
'"hnsw:M": 32}'
|
|
132
132
|
),
|
|
133
133
|
),
|
|
134
|
-
]
|
|
134
|
+
]
|
|
135
135
|
|
|
136
136
|
@model_validator(mode="after")
|
|
137
137
|
def validate_vector_db_config(self) -> Self:
|
|
@@ -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
|
"""Reasoning agent model."""
|
|
4
7
|
|
|
5
8
|
from typing import Any
|
|
@@ -14,7 +17,7 @@ from .reasoning_agent_data import WaldiezReasoningAgentData
|
|
|
14
17
|
class WaldiezReasoningAgent(WaldiezAgent):
|
|
15
18
|
"""Reasoning agent model."""
|
|
16
19
|
|
|
17
|
-
agent_type: Annotated[
|
|
20
|
+
agent_type: Annotated[
|
|
18
21
|
Literal["reasoning"],
|
|
19
22
|
Field(
|
|
20
23
|
"reasoning",
|
|
@@ -22,13 +25,13 @@ class WaldiezReasoningAgent(WaldiezAgent):
|
|
|
22
25
|
description="The agent type in a graph: 'reasoning'",
|
|
23
26
|
alias="agentType",
|
|
24
27
|
),
|
|
25
|
-
]
|
|
26
|
-
data: Annotated[
|
|
28
|
+
]
|
|
29
|
+
data: Annotated[
|
|
27
30
|
WaldiezReasoningAgentData,
|
|
28
31
|
Field(
|
|
29
32
|
title="Data",
|
|
30
33
|
description="The reasoning agent's data",
|
|
31
|
-
default_factory=WaldiezReasoningAgentData,
|
|
34
|
+
default_factory=WaldiezReasoningAgentData,
|
|
32
35
|
),
|
|
33
36
|
]
|
|
34
37
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
# pyright: reportArgumentType=false
|
|
3
4
|
"""Reasoning agent data model."""
|
|
4
5
|
|
|
5
6
|
from typing import Any
|
|
@@ -22,7 +23,7 @@ class WaldiezReasoningAgentData(WaldiezAgentData):
|
|
|
22
23
|
description="The human input mode, Defaults to `NEVER`",
|
|
23
24
|
alias="humanInputMode",
|
|
24
25
|
),
|
|
25
|
-
]
|
|
26
|
+
]
|
|
26
27
|
verbose: Annotated[
|
|
27
28
|
bool,
|
|
28
29
|
Field(
|
|
@@ -30,7 +31,7 @@ class WaldiezReasoningAgentData(WaldiezAgentData):
|
|
|
30
31
|
title="Verbose",
|
|
31
32
|
description="Whether to show intermediate steps",
|
|
32
33
|
),
|
|
33
|
-
]
|
|
34
|
+
]
|
|
34
35
|
reason_config: Annotated[
|
|
35
36
|
WaldiezReasoningAgentReasonConfig,
|
|
36
37
|
Field(
|
|
@@ -43,7 +43,7 @@ class WaldiezReasoningAgentReasonConfig(WaldiezBase):
|
|
|
43
43
|
title="Method",
|
|
44
44
|
description="The search strategy to use.",
|
|
45
45
|
),
|
|
46
|
-
]
|
|
46
|
+
]
|
|
47
47
|
max_depth: Annotated[
|
|
48
48
|
int,
|
|
49
49
|
Field(
|
|
@@ -51,7 +51,7 @@ class WaldiezReasoningAgentReasonConfig(WaldiezBase):
|
|
|
51
51
|
title="Maximum depth",
|
|
52
52
|
description="Maximum depth of reasoning tree.",
|
|
53
53
|
),
|
|
54
|
-
]
|
|
54
|
+
]
|
|
55
55
|
forest_size: Annotated[
|
|
56
56
|
int,
|
|
57
57
|
Field(
|
|
@@ -59,7 +59,7 @@ class WaldiezReasoningAgentReasonConfig(WaldiezBase):
|
|
|
59
59
|
title="Forest size",
|
|
60
60
|
description="Number of independent trees to maintain.",
|
|
61
61
|
),
|
|
62
|
-
]
|
|
62
|
+
]
|
|
63
63
|
rating_scale: Annotated[
|
|
64
64
|
int,
|
|
65
65
|
Field(
|
|
@@ -67,7 +67,7 @@ class WaldiezReasoningAgentReasonConfig(WaldiezBase):
|
|
|
67
67
|
title="Rating scale",
|
|
68
68
|
description="Scale for grading responses, e.g. 1-10.",
|
|
69
69
|
),
|
|
70
|
-
]
|
|
70
|
+
]
|
|
71
71
|
beam_size: Annotated[
|
|
72
72
|
int,
|
|
73
73
|
Field(
|
|
@@ -75,7 +75,7 @@ class WaldiezReasoningAgentReasonConfig(WaldiezBase):
|
|
|
75
75
|
title="Beam size",
|
|
76
76
|
description="Number of parallel paths to maintain.",
|
|
77
77
|
),
|
|
78
|
-
]
|
|
78
|
+
]
|
|
79
79
|
answer_approach: Annotated[
|
|
80
80
|
Literal["pool", "best"],
|
|
81
81
|
Field(
|
|
@@ -83,7 +83,7 @@ class WaldiezReasoningAgentReasonConfig(WaldiezBase):
|
|
|
83
83
|
title="Answer approach",
|
|
84
84
|
description="How to select final answer.",
|
|
85
85
|
),
|
|
86
|
-
]
|
|
86
|
+
]
|
|
87
87
|
nsim: Annotated[
|
|
88
88
|
int,
|
|
89
89
|
Field(
|
|
@@ -91,7 +91,7 @@ class WaldiezReasoningAgentReasonConfig(WaldiezBase):
|
|
|
91
91
|
title="Number of simulations",
|
|
92
92
|
description="Number of simulations to run.",
|
|
93
93
|
),
|
|
94
|
-
]
|
|
94
|
+
]
|
|
95
95
|
exploration_constant: Annotated[
|
|
96
96
|
float,
|
|
97
97
|
Field(
|
|
@@ -99,7 +99,7 @@ class WaldiezReasoningAgentReasonConfig(WaldiezBase):
|
|
|
99
99
|
title="Exploration constant",
|
|
100
100
|
description="UCT exploration parameter.",
|
|
101
101
|
),
|
|
102
|
-
]
|
|
102
|
+
]
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
# reason_config (dict): Configuration for the reasoning method.
|