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.

Files changed (188) hide show
  1. waldiez/__init__.py +1 -1
  2. waldiez/_version.py +1 -1
  3. waldiez/cli.py +18 -7
  4. waldiez/cli_extras/jupyter.py +3 -0
  5. waldiez/cli_extras/runner.py +3 -1
  6. waldiez/cli_extras/studio.py +3 -1
  7. waldiez/exporter.py +9 -3
  8. waldiez/exporting/agent/exporter.py +9 -10
  9. waldiez/exporting/agent/extras/captain_agent_extras.py +6 -6
  10. waldiez/exporting/agent/extras/doc_agent_extras.py +6 -6
  11. waldiez/exporting/agent/extras/group_manager_agent_extas.py +34 -23
  12. waldiez/exporting/agent/extras/group_member_extras.py +6 -5
  13. waldiez/exporting/agent/extras/handoffs/after_work.py +1 -1
  14. waldiez/exporting/agent/extras/handoffs/available.py +1 -1
  15. waldiez/exporting/agent/extras/handoffs/condition.py +3 -2
  16. waldiez/exporting/agent/extras/handoffs/handoff.py +1 -1
  17. waldiez/exporting/agent/extras/handoffs/target.py +6 -4
  18. waldiez/exporting/agent/extras/rag/chroma_extras.py +27 -19
  19. waldiez/exporting/agent/extras/rag/mongo_extras.py +8 -8
  20. waldiez/exporting/agent/extras/rag/pgvector_extras.py +5 -5
  21. waldiez/exporting/agent/extras/rag/qdrant_extras.py +5 -4
  22. waldiez/exporting/agent/extras/rag/vector_db_extras.py +1 -1
  23. waldiez/exporting/agent/extras/rag_user_proxy_agent_extras.py +5 -7
  24. waldiez/exporting/agent/extras/reasoning_agent_extras.py +3 -5
  25. waldiez/exporting/chats/exporter.py +4 -4
  26. waldiez/exporting/chats/processor.py +1 -2
  27. waldiez/exporting/chats/utils/common.py +89 -48
  28. waldiez/exporting/chats/utils/group.py +9 -9
  29. waldiez/exporting/chats/utils/nested.py +7 -7
  30. waldiez/exporting/chats/utils/sequential.py +1 -1
  31. waldiez/exporting/chats/utils/single.py +2 -2
  32. waldiez/exporting/core/content.py +7 -7
  33. waldiez/exporting/core/context.py +5 -3
  34. waldiez/exporting/core/exporter.py +5 -3
  35. waldiez/exporting/core/exporters.py +2 -2
  36. waldiez/exporting/core/extras/agent_extras/captain_extras.py +2 -2
  37. waldiez/exporting/core/extras/agent_extras/group_manager_extras.py +2 -2
  38. waldiez/exporting/core/extras/agent_extras/rag_user_extras.py +2 -2
  39. waldiez/exporting/core/extras/agent_extras/standard_extras.py +3 -8
  40. waldiez/exporting/core/extras/base.py +7 -5
  41. waldiez/exporting/core/extras/flow_extras.py +4 -5
  42. waldiez/exporting/core/extras/model_extras.py +2 -2
  43. waldiez/exporting/core/extras/path_resolver.py +1 -2
  44. waldiez/exporting/core/extras/serializer.py +2 -2
  45. waldiez/exporting/core/protocols.py +6 -5
  46. waldiez/exporting/core/result.py +25 -28
  47. waldiez/exporting/core/types.py +10 -10
  48. waldiez/exporting/core/utils/llm_config.py +2 -2
  49. waldiez/exporting/core/validation.py +10 -11
  50. waldiez/exporting/flow/execution_generator.py +98 -10
  51. waldiez/exporting/flow/exporter.py +2 -2
  52. waldiez/exporting/flow/factory.py +2 -2
  53. waldiez/exporting/flow/file_generator.py +4 -2
  54. waldiez/exporting/flow/merger.py +5 -3
  55. waldiez/exporting/flow/orchestrator.py +72 -2
  56. waldiez/exporting/flow/utils/common.py +5 -5
  57. waldiez/exporting/flow/utils/importing.py +6 -7
  58. waldiez/exporting/flow/utils/linting.py +25 -9
  59. waldiez/exporting/flow/utils/logging.py +2 -2
  60. waldiez/exporting/models/exporter.py +8 -8
  61. waldiez/exporting/models/processor.py +5 -5
  62. waldiez/exporting/tools/exporter.py +2 -2
  63. waldiez/exporting/tools/processor.py +7 -4
  64. waldiez/io/__init__.py +8 -4
  65. waldiez/io/_ws.py +10 -6
  66. waldiez/io/models/constants.py +10 -10
  67. waldiez/io/models/content/audio.py +1 -0
  68. waldiez/io/models/content/base.py +20 -18
  69. waldiez/io/models/content/file.py +1 -0
  70. waldiez/io/models/content/image.py +1 -0
  71. waldiez/io/models/content/text.py +1 -0
  72. waldiez/io/models/content/video.py +1 -0
  73. waldiez/io/models/user_input.py +10 -5
  74. waldiez/io/models/user_response.py +17 -16
  75. waldiez/io/mqtt.py +18 -31
  76. waldiez/io/redis.py +18 -22
  77. waldiez/io/structured.py +52 -53
  78. waldiez/io/utils.py +3 -0
  79. waldiez/io/ws.py +5 -1
  80. waldiez/logger.py +16 -3
  81. waldiez/models/agents/__init__.py +3 -0
  82. waldiez/models/agents/agent/agent.py +23 -16
  83. waldiez/models/agents/agent/agent_data.py +25 -22
  84. waldiez/models/agents/agent/code_execution.py +9 -11
  85. waldiez/models/agents/agent/termination_message.py +10 -12
  86. waldiez/models/agents/agent/update_system_message.py +2 -4
  87. waldiez/models/agents/agents.py +8 -8
  88. waldiez/models/agents/assistant/assistant.py +6 -3
  89. waldiez/models/agents/assistant/assistant_data.py +2 -2
  90. waldiez/models/agents/captain/captain_agent.py +7 -4
  91. waldiez/models/agents/captain/captain_agent_data.py +5 -7
  92. waldiez/models/agents/doc_agent/doc_agent.py +7 -4
  93. waldiez/models/agents/doc_agent/doc_agent_data.py +9 -10
  94. waldiez/models/agents/doc_agent/rag_query_engine.py +10 -12
  95. waldiez/models/agents/extra_requirements.py +3 -3
  96. waldiez/models/agents/group_manager/group_manager.py +12 -7
  97. waldiez/models/agents/group_manager/group_manager_data.py +13 -12
  98. waldiez/models/agents/group_manager/speakers.py +17 -19
  99. waldiez/models/agents/rag_user_proxy/rag_user_proxy.py +7 -4
  100. waldiez/models/agents/rag_user_proxy/rag_user_proxy_data.py +4 -1
  101. waldiez/models/agents/rag_user_proxy/retrieve_config.py +69 -63
  102. waldiez/models/agents/rag_user_proxy/vector_db_config.py +19 -19
  103. waldiez/models/agents/reasoning/reasoning_agent.py +7 -4
  104. waldiez/models/agents/reasoning/reasoning_agent_data.py +3 -2
  105. waldiez/models/agents/reasoning/reasoning_agent_reason_config.py +8 -8
  106. waldiez/models/agents/user_proxy/user_proxy.py +6 -3
  107. waldiez/models/agents/user_proxy/user_proxy_data.py +1 -1
  108. waldiez/models/chat/chat.py +27 -20
  109. waldiez/models/chat/chat_data.py +22 -19
  110. waldiez/models/chat/chat_message.py +9 -9
  111. waldiez/models/chat/chat_nested.py +9 -9
  112. waldiez/models/chat/chat_summary.py +6 -6
  113. waldiez/models/common/__init__.py +2 -0
  114. waldiez/models/common/ag2_version.py +2 -0
  115. waldiez/models/common/dict_utils.py +8 -6
  116. waldiez/models/common/handoff.py +18 -17
  117. waldiez/models/common/method_utils.py +7 -7
  118. waldiez/models/common/naming.py +49 -0
  119. waldiez/models/flow/flow.py +11 -6
  120. waldiez/models/flow/flow_data.py +23 -17
  121. waldiez/models/flow/info.py +3 -3
  122. waldiez/models/flow/naming.py +2 -1
  123. waldiez/models/model/_aws.py +11 -13
  124. waldiez/models/model/_llm.py +5 -0
  125. waldiez/models/model/_price.py +2 -4
  126. waldiez/models/model/extra_requirements.py +1 -3
  127. waldiez/models/model/model.py +2 -2
  128. waldiez/models/model/model_data.py +21 -21
  129. waldiez/models/tool/extra_requirements.py +2 -4
  130. waldiez/models/tool/predefined/_duckduckgo.py +1 -0
  131. waldiez/models/tool/predefined/_email.py +1 -0
  132. waldiez/models/tool/predefined/_google.py +1 -0
  133. waldiez/models/tool/predefined/_perplexity.py +1 -0
  134. waldiez/models/tool/predefined/_searxng.py +1 -0
  135. waldiez/models/tool/predefined/_tavily.py +1 -0
  136. waldiez/models/tool/predefined/_wikipedia.py +1 -0
  137. waldiez/models/tool/predefined/_youtube.py +1 -0
  138. waldiez/models/tool/tool.py +8 -5
  139. waldiez/models/tool/tool_data.py +2 -2
  140. waldiez/models/waldiez.py +152 -4
  141. waldiez/runner.py +11 -5
  142. waldiez/running/async_utils.py +192 -0
  143. waldiez/running/base_runner.py +117 -264
  144. waldiez/running/dir_utils.py +52 -0
  145. waldiez/running/environment.py +10 -44
  146. waldiez/running/events_mixin.py +252 -0
  147. waldiez/running/exceptions.py +20 -0
  148. waldiez/running/gen_seq_diagram.py +18 -15
  149. waldiez/running/io_utils.py +216 -0
  150. waldiez/running/protocol.py +11 -5
  151. waldiez/running/requirements_mixin.py +65 -0
  152. waldiez/running/results_mixin.py +926 -0
  153. waldiez/running/standard_runner.py +22 -25
  154. waldiez/running/step_by_step/breakpoints_mixin.py +192 -60
  155. waldiez/running/step_by_step/command_handler.py +3 -0
  156. waldiez/running/step_by_step/events_processor.py +194 -14
  157. waldiez/running/step_by_step/step_by_step_models.py +110 -43
  158. waldiez/running/step_by_step/step_by_step_runner.py +107 -57
  159. waldiez/running/subprocess_runner/__base__.py +9 -1
  160. waldiez/running/subprocess_runner/_async_runner.py +5 -3
  161. waldiez/running/subprocess_runner/_sync_runner.py +6 -2
  162. waldiez/running/subprocess_runner/runner.py +39 -23
  163. waldiez/running/timeline_processor.py +1 -1
  164. waldiez/utils/__init__.py +2 -0
  165. waldiez/utils/conflict_checker.py +4 -4
  166. waldiez/utils/python_manager.py +415 -0
  167. waldiez/ws/_file_handler.py +18 -18
  168. waldiez/ws/_mock.py +2 -1
  169. waldiez/ws/cli.py +36 -12
  170. waldiez/ws/client_manager.py +35 -27
  171. waldiez/ws/errors.py +3 -0
  172. waldiez/ws/models.py +43 -52
  173. waldiez/ws/reloader.py +12 -4
  174. waldiez/ws/server.py +85 -55
  175. waldiez/ws/session_manager.py +8 -9
  176. waldiez/ws/session_stats.py +1 -1
  177. waldiez/ws/utils.py +4 -1
  178. {waldiez-0.6.0.dist-info → waldiez-0.6.1.dist-info}/METADATA +82 -93
  179. waldiez-0.6.1.dist-info/RECORD +254 -0
  180. waldiez/running/post_run.py +0 -186
  181. waldiez/running/pre_run.py +0 -281
  182. waldiez/running/run_results.py +0 -14
  183. waldiez/running/utils.py +0 -625
  184. waldiez-0.6.0.dist-info/RECORD +0 -251
  185. {waldiez-0.6.0.dist-info → waldiez-0.6.1.dist-info}/WHEEL +0 -0
  186. {waldiez-0.6.0.dist-info → waldiez-0.6.1.dist-info}/entry_points.txt +0 -0
  187. {waldiez-0.6.0.dist-info → waldiez-0.6.1.dist-info}/licenses/LICENSE +0 -0
  188. {waldiez-0.6.0.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 : Optional[str]
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 : Optional[str]
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 : Optional[str]
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 : Optional[str]
120
+ customized_prompt : str | None
118
121
  The customized prompt for the retrieve chat. Default is None.
119
- customized_answer_prefix : Optional[str]
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 : Optional[str]
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 : Optional[str]
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 : Optional[str]
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
- ] = "default"
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
- ] = "chroma"
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
- Optional[Union[str, list[str]]],
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
- ] = None
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
- ] = True
230
+ ]
228
231
  model: Annotated[
229
- Optional[str],
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
- ] = None
241
+ ]
239
242
  chunk_token_size: Annotated[
240
- Optional[int],
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
- ] = None
253
+ ]
251
254
  context_max_tokens: Annotated[
252
- Optional[int],
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
- ] = None
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
- ] = "multi_lines"
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
- ] = True
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
- ] = False
300
+ ]
298
301
  embedding_function: Annotated[
299
- Optional[str],
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
- ] = None
315
+ ]
313
316
  customized_prompt: Annotated[
314
- Optional[str],
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
- ] = None
325
+ ]
323
326
  customized_answer_prefix: Annotated[
324
- Optional[str],
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
- ] = True
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
- ] = "autogen-docs"
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
- ] = False
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
- ] = False
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
- ] = False
399
+ ]
397
400
  custom_token_count_function: Annotated[
398
- Optional[str],
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
- ] = None
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
- ] = False
426
+ ]
424
427
  custom_text_split_function: Annotated[
425
- Optional[str],
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
- ] = None
438
+ ]
436
439
  custom_text_types: Annotated[
437
- Optional[list[str]],
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
- ] = None
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
- ] = True
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
- ] = -1
475
+ ]
473
476
  n_results: Annotated[
474
- Optional[int],
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
- ] = None
485
- _embedding_function_string: Optional[str] = None
487
+ ]
488
+ _embedding_function_string: str | None = None
486
489
 
487
- _token_count_function_string: Optional[str] = None
490
+ _token_count_function_string: str | None = None
488
491
 
489
- _text_split_function_string: Optional[str] = None
492
+ _text_split_function_string: str | None = None
490
493
 
491
494
  @property
492
- def embedding_function_string(self) -> Optional[str]:
495
+ def embedding_function_string(self) -> str | None:
493
496
  """Get the embedding function string.
494
497
 
495
498
  Returns
496
499
  -------
497
- Optional[str]
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) -> Optional[str]:
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
- Optional[str]
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) -> Optional[str]:
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
- Optional[str]
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: Optional[str] = None,
527
- name_suffix: Optional[str] = None,
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: Optional[str] = None,
561
- name_suffix: Optional[str] = None,
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: Optional[str] = None,
595
- name_suffix: Optional[str] = None,
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
- raise ValueError(
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
- raise ValueError(
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
- raise ValueError(
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, Optional
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 : Optional[str]
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 : Optional[str]
31
+ connection_url : str | None
32
32
  The connection url for the vector db.
33
- wait_until_index_ready : Optional[float]
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 : Optional[float]
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
- Optional[str],
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
- ] = None
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
- ] = True
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
- ] = False
80
+ ]
81
81
  local_storage_path: Annotated[
82
- Optional[str],
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
- ] = None
91
+ ]
92
92
  connection_url: Annotated[
93
- Optional[str],
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
- ] = None
99
+ ]
100
100
  wait_until_index_ready: Annotated[
101
- Optional[float],
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
- ] = None
110
+ ]
111
111
  wait_until_document_ready: Annotated[
112
- Optional[float],
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
- ] = None
121
+ ]
122
122
  metadata: Annotated[
123
- Optional[dict[str, Any]],
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
- ] = None
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[ # pyright: ignore
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
- ] = "reasoning"
26
- data: Annotated[ # pyright: ignore
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, # pyright: ignore
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
- ] = "NEVER"
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
- ] = True
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
- ] = "beam_search"
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
- ] = 3
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
- ] = 1
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
- ] = 10
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
- ] = 3
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
- ] = "pool"
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
- ] = 3
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
- ] = 1.41
102
+ ]
103
103
 
104
104
 
105
105
  # reason_config (dict): Configuration for the reasoning method.