waldiez 0.5.6__py3-none-any.whl → 0.5.7__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 (107) hide show
  1. waldiez/_version.py +1 -1
  2. waldiez/cli.py +1 -1
  3. waldiez/exporter.py +1 -1
  4. waldiez/exporting/agent/code_execution.py +8 -1
  5. waldiez/exporting/agent/exporter.py +2 -1
  6. waldiez/exporting/agent/extras/captain_agent_extras.py +1 -0
  7. waldiez/exporting/agent/extras/doc_agent_extras.py +2 -3
  8. waldiez/exporting/agent/extras/group_manager_agent_extas.py +1 -0
  9. waldiez/exporting/agent/extras/handoffs/after_work.py +4 -4
  10. waldiez/exporting/agent/extras/handoffs/target.py +3 -0
  11. waldiez/exporting/agent/extras/rag/chroma_extras.py +0 -4
  12. waldiez/exporting/agent/extras/rag/mongo_extras.py +0 -1
  13. waldiez/exporting/agent/extras/rag/pgvector_extras.py +0 -2
  14. waldiez/exporting/agent/extras/rag/qdrant_extras.py +0 -3
  15. waldiez/exporting/agent/extras/rag/vector_db_extras.py +3 -2
  16. waldiez/exporting/agent/factory.py +11 -11
  17. waldiez/exporting/agent/processor.py +3 -2
  18. waldiez/exporting/chats/exporter.py +2 -2
  19. waldiez/exporting/chats/factory.py +5 -5
  20. waldiez/exporting/chats/processor.py +22 -1
  21. waldiez/exporting/chats/utils/sequential.py +3 -68
  22. waldiez/exporting/chats/utils/single.py +1 -38
  23. waldiez/exporting/core/context.py +39 -38
  24. waldiez/exporting/core/exporter.py +10 -10
  25. waldiez/exporting/core/exporters.py +36 -0
  26. waldiez/exporting/core/extras/base.py +2 -2
  27. waldiez/exporting/core/extras/chat_extras.py +4 -2
  28. waldiez/exporting/core/extras/path_resolver.py +6 -4
  29. waldiez/exporting/core/extras/serializer.py +1 -0
  30. waldiez/exporting/core/protocols.py +6 -0
  31. waldiez/exporting/core/result.py +8 -7
  32. waldiez/exporting/core/types.py +2 -2
  33. waldiez/exporting/core/utils/llm_config.py +2 -0
  34. waldiez/exporting/flow/factory.py +2 -2
  35. waldiez/exporting/flow/file_generator.py +8 -7
  36. waldiez/exporting/flow/merger.py +8 -7
  37. waldiez/exporting/flow/orchestrator.py +22 -8
  38. waldiez/exporting/flow/utils/__init__.py +2 -0
  39. waldiez/exporting/flow/utils/common.py +16 -0
  40. waldiez/exporting/flow/utils/logging.py +5 -2
  41. waldiez/exporting/models/factory.py +6 -7
  42. waldiez/exporting/tools/exporter.py +5 -5
  43. waldiez/exporting/tools/factory.py +4 -5
  44. waldiez/exporting/tools/processor.py +3 -3
  45. waldiez/exporting/tools/registration.py +1 -0
  46. waldiez/io/_ws.py +2 -0
  47. waldiez/io/models/content/audio.py +1 -0
  48. waldiez/io/models/content/file.py +1 -0
  49. waldiez/io/models/content/image.py +1 -0
  50. waldiez/io/models/content/text.py +1 -0
  51. waldiez/io/models/content/video.py +1 -0
  52. waldiez/io/models/user_input.py +1 -0
  53. waldiez/io/models/user_response.py +1 -0
  54. waldiez/io/mqtt.py +6 -3
  55. waldiez/io/redis.py +7 -9
  56. waldiez/io/structured.py +8 -6
  57. waldiez/io/utils.py +11 -4
  58. waldiez/io/ws.py +4 -3
  59. waldiez/logger.py +11 -1
  60. waldiez/models/agents/agent/agent.py +1 -0
  61. waldiez/models/agents/agent/agent_data.py +2 -2
  62. waldiez/models/agents/agent/nested_chat.py +1 -4
  63. waldiez/models/agents/agent/termination_message.py +0 -7
  64. waldiez/models/agents/agent/update_system_message.py +2 -2
  65. waldiez/models/agents/doc_agent/doc_agent_data.py +33 -26
  66. waldiez/models/agents/doc_agent/rag_query_engine.py +1 -1
  67. waldiez/models/agents/extra_requirements.py +5 -5
  68. waldiez/models/agents/group_manager/group_manager.py +3 -7
  69. waldiez/models/agents/group_manager/speakers.py +0 -7
  70. waldiez/models/agents/rag_user_proxy/rag_user_proxy.py +0 -2
  71. waldiez/models/agents/rag_user_proxy/rag_user_proxy_data.py +0 -2
  72. waldiez/models/agents/rag_user_proxy/retrieve_config.py +1 -17
  73. waldiez/models/agents/rag_user_proxy/vector_db_config.py +0 -5
  74. waldiez/models/chat/chat_data.py +0 -2
  75. waldiez/models/chat/chat_summary.py +5 -3
  76. waldiez/models/common/handoff.py +26 -18
  77. waldiez/models/common/naming.py +1 -0
  78. waldiez/models/flow/flow.py +9 -7
  79. waldiez/models/model/_llm.py +4 -2
  80. waldiez/models/model/extra_requirements.py +3 -3
  81. waldiez/models/model/model.py +3 -2
  82. waldiez/models/tool/extra_requirements.py +2 -2
  83. waldiez/models/tool/predefined/_google.py +3 -1
  84. waldiez/models/tool/predefined/_perplexity.py +4 -1
  85. waldiez/models/tool/predefined/_searxng.py +4 -1
  86. waldiez/models/tool/predefined/_wikipedia.py +5 -1
  87. waldiez/models/tool/tool.py +7 -7
  88. waldiez/models/tool/tool_data.py +39 -2
  89. waldiez/models/waldiez.py +29 -29
  90. waldiez/runner.py +1 -0
  91. waldiez/running/base_runner.py +9 -4
  92. waldiez/running/environment.py +2 -0
  93. waldiez/running/patch_io_stream.py +2 -0
  94. waldiez/running/post_run.py +3 -0
  95. waldiez/running/pre_run.py +1 -0
  96. waldiez/running/standard_runner.py +28 -4
  97. waldiez/running/timeline_processor.py +12 -1
  98. waldiez/running/utils.py +2 -0
  99. waldiez/utils/conflict_checker.py +1 -1
  100. waldiez/utils/version.py +1 -0
  101. {waldiez-0.5.6.dist-info → waldiez-0.5.7.dist-info}/METADATA +59 -57
  102. {waldiez-0.5.6.dist-info → waldiez-0.5.7.dist-info}/RECORD +106 -107
  103. waldiez/exporting/agent/extras/group/target.py +0 -178
  104. {waldiez-0.5.6.dist-info → waldiez-0.5.7.dist-info}/WHEEL +0 -0
  105. {waldiez-0.5.6.dist-info → waldiez-0.5.7.dist-info}/entry_points.txt +0 -0
  106. {waldiez-0.5.6.dist-info → waldiez-0.5.7.dist-info}/licenses/LICENSE +0 -0
  107. {waldiez-0.5.6.dist-info → waldiez-0.5.7.dist-info}/licenses/NOTICE.md +0 -0
@@ -5,7 +5,6 @@
5
5
  from pathlib import Path
6
6
  from typing import Optional, Union
7
7
 
8
- from platformdirs import user_data_dir
9
8
  from pydantic import Field, model_validator
10
9
  from typing_extensions import Annotated, Self
11
10
 
@@ -78,19 +77,10 @@ class WaldiezDocAgentData(WaldiezAgentData):
78
77
  The instance with validated `parsed_docs_path`.
79
78
  """
80
79
  if not self.parsed_docs_path:
81
- data_dir = user_data_dir(
82
- appname="waldiez",
83
- appauthor="waldiez",
84
- )
85
- parsed_docs_path = Path(data_dir) / "parsed_docs"
86
- parsed_docs_path.mkdir(parents=True, exist_ok=True)
87
- self.parsed_docs_path = str(parsed_docs_path.resolve())
88
- resolved = Path(self.parsed_docs_path).resolve()
89
- if not resolved.is_absolute():
90
- self.parsed_docs_path = str(Path.cwd() / self.parsed_docs_path)
91
- if not Path(self.parsed_docs_path).is_dir():
92
- Path(self.parsed_docs_path).mkdir(parents=True, exist_ok=True)
93
- self.parsed_docs_path = str(Path(self.parsed_docs_path).resolve())
80
+ self.parsed_docs_path = get_parsed_docs_path()
81
+ parsed_docs_path = Path(self.parsed_docs_path).resolve()
82
+ parsed_docs_path.mkdir(parents=True, exist_ok=True)
83
+ self.parsed_docs_path = str(parsed_docs_path)
94
84
  return self
95
85
 
96
86
  def get_query_engine(self) -> WaldiezDocAgentQueryEngine:
@@ -134,16 +124,33 @@ class WaldiezDocAgentData(WaldiezAgentData):
134
124
  The parsed documents path for the document agent.
135
125
  """
136
126
  if not self.parsed_docs_path:
137
- data_dir = user_data_dir(
138
- appname="waldiez",
139
- appauthor="waldiez",
140
- )
141
- parsed_docs_path = Path(data_dir) / "parsed_docs"
142
- parsed_docs_path.mkdir(parents=True, exist_ok=True)
143
- self.parsed_docs_path = str(parsed_docs_path.resolve())
144
- resolved = Path(self.parsed_docs_path).resolve()
145
- if not resolved.is_absolute():
146
- self.parsed_docs_path = str(Path.cwd() / self.parsed_docs_path)
147
- if not Path(self.parsed_docs_path).is_dir():
148
- Path(self.parsed_docs_path).mkdir(parents=True, exist_ok=True)
127
+ self.parsed_docs_path = get_parsed_docs_path(self.parsed_docs_path)
149
128
  return str(self.parsed_docs_path)
129
+
130
+
131
+ def get_parsed_docs_path(
132
+ parsed_docs_path: Optional[Union[str, Path]] = None,
133
+ ) -> str:
134
+ """Get the parsed documents path for the document agent.
135
+
136
+ Parameters
137
+ ----------
138
+ parsed_docs_path : Optional[Union[str, Path]]
139
+ The path to the parsed documents.
140
+
141
+ Returns
142
+ -------
143
+ str
144
+ The parsed documents path for the document agent.
145
+ """
146
+ if not parsed_docs_path:
147
+ parsed_docs_path_str = str(Path.cwd() / "parsed_docs")
148
+ else:
149
+ parsed_docs_path_str = str(parsed_docs_path)
150
+ if not Path(parsed_docs_path_str).is_absolute():
151
+ parsed_docs_path_str = str(Path.cwd() / parsed_docs_path_str)
152
+ resolved_path = Path(parsed_docs_path_str).resolve()
153
+ if resolved_path.is_file():
154
+ resolved_path = resolved_path.parent
155
+ resolved_path.mkdir(parents=True, exist_ok=True)
156
+ return str(resolved_path)
@@ -93,7 +93,7 @@ def ensure_db_path(db_path: str | Path | None) -> str:
93
93
 
94
94
  Parameters
95
95
  ----------
96
- db_path : Optional[str]
96
+ db_path : str | Path | None
97
97
  The database path to validate.
98
98
 
99
99
  Returns
@@ -1,17 +1,17 @@
1
1
  # SPDX-License-Identifier: Apache-2.0.
2
2
  # Copyright (c) 2024 - 2025 Waldiez and contributors.
3
3
  """Extra requirements for agents."""
4
-
5
4
  # pylint: disable=line-too-long
6
- from typing import Iterator, Set
5
+
6
+ from typing import Set
7
7
 
8
8
  from .agent import WaldiezAgent
9
9
  from .rag_user_proxy import WaldiezRagUserProxy
10
10
 
11
11
 
12
12
  def get_retrievechat_extra_requirements(
13
- agents: Iterator[WaldiezAgent],
14
- ) -> Set[str]:
13
+ agents: list[WaldiezAgent],
14
+ ) -> set[str]:
15
15
  """Get the retrievechat extra requirements.
16
16
 
17
17
  Parameters
@@ -21,7 +21,7 @@ def get_retrievechat_extra_requirements(
21
21
 
22
22
  Returns
23
23
  -------
24
- Set[str]
24
+ set[str]
25
25
  The retrievechat extra requirements.
26
26
  """
27
27
  # https://github.com/ag2ai/ag2/blob/main/pyproject.toml
@@ -13,6 +13,7 @@ from .group_manager_data import WaldiezGroupManagerData
13
13
  from .speakers import WaldiezGroupManagerSpeakers
14
14
 
15
15
 
16
+ # noinspection PyNestedDecorators
16
17
  class WaldiezGroupManager(WaldiezAgent):
17
18
  """Group chat manager agent.
18
19
 
@@ -26,11 +27,6 @@ class WaldiezGroupManager(WaldiezAgent):
26
27
  The agent type: 'group_manager' for a group manager agent
27
28
  data : WaldiezGroupManagerData
28
29
  The group manager agent's data.
29
-
30
- Functions
31
- ---------
32
- validate_transitions(agent_ids: list[str])
33
- Validate the transitions.
34
30
  """
35
31
 
36
32
  agent_type: Annotated[ # pyright: ignore
@@ -174,6 +170,6 @@ class WaldiezGroupManager(WaldiezAgent):
174
170
  ) in speakers.allowed_or_disallowed_transitions.items():
175
171
  if agent_id not in agent_ids:
176
172
  raise ValueError(f"Invalid agent id: {agent_id}")
177
- for agent_id in transitions:
178
- if agent_id not in agent_ids:
173
+ for target_agent_id in transitions:
174
+ if target_agent_id not in agent_ids:
179
175
  raise ValueError(f"Invalid agent id: {agent_id}")
@@ -75,13 +75,6 @@ class WaldiezGroupManagerSpeakers(WaldiezBase):
75
75
  The type of transition rules to use if
76
76
  if a mapping (agent => list[agents]) is used:
77
77
  `allowed` (default) or `disallowed`
78
- custom_method_string : Optional[str]
79
- The custom method string.
80
-
81
- Functions
82
- ---------
83
- validate_group_speakers_config()
84
- Validate the speakers config.
85
78
  """
86
79
 
87
80
  selection_method: Annotated[
@@ -25,8 +25,6 @@ class WaldiezRagUserProxy(WaldiezAgent):
25
25
  data : WaldiezRagUserProxyData
26
26
  The RAG user agent's data.
27
27
  See `WaldiezRagUserProxyData` for more info.
28
- retrieve_config : WaldiezRagUserProxyRetrieveConfig
29
- The RAG user agent's retrieve config.
30
28
  """
31
29
 
32
30
  agent_type: Annotated[ # pyright: ignore
@@ -16,8 +16,6 @@ class WaldiezRagUserProxyData(WaldiezUserProxyData):
16
16
 
17
17
  Attributes
18
18
  ----------
19
- use_message_generator: bool
20
- Whether to use the message generator in user's chats. Defaults to False.
21
19
  retrieve_config : WaldiezRagUserProxyRetrieveConfig
22
20
  The RAG user agent's retrieve config.
23
21
 
@@ -50,6 +50,7 @@ CUSTOM_TEXT_SPLIT_FUNCTION_TYPES = (
50
50
  ["str", "int", "str", "bool", "int"],
51
51
  "list[str]",
52
52
  )
53
+ # noinspection HttpUrlsUsage
53
54
  NOT_LOCAL = (
54
55
  "http://",
55
56
  "https://",
@@ -162,25 +163,8 @@ class WaldiezRagUserProxyRetrieveConfig(WaldiezBase):
162
163
  distance_threshold : float
163
164
  The threshold for the distance score, only distance smaller than it
164
165
  will be returned. Will be ignored if < 0. Default is -1.
165
- embedding_function_string : Optional[str]
166
- The embedding function string (if use_custom_embedding is True).
167
- token_count_function_string : Optional[str]
168
- The token count function string (if use_custom_token_count is True).
169
- text_split_function_string : Optional[str]
170
- The text split function string (if use_custom_text_split is True).
171
166
  n_results: Optional[int]
172
167
  The number of results to return. Default is None, which will return all
173
-
174
- Functions
175
- ---------
176
- validate_custom_embedding_function
177
- Validate the custom embedding function.
178
- validate_custom_token_count_function
179
- Validate the custom token count function.
180
- validate_custom_text_split_function
181
- Validate the custom text split function.
182
- validate_rag_user_data
183
- Validate the RAG user data.
184
168
  """
185
169
 
186
170
  task: Annotated[
@@ -39,11 +39,6 @@ class WaldiezRagUserProxyVectorDbConfig(WaldiezBase):
39
39
  metadata : Optional[dict[str, Any]]
40
40
  The metadata to use for the vector db.
41
41
  Example: {"hnsw:space": "ip", "hnsw:construction_ef": 30, "hnsw:M": 32}
42
-
43
- Functions
44
- ---------
45
- validate_vector_db_config()
46
- Validate the vector db config.
47
42
  """
48
43
 
49
44
  model_config = ConfigDict(
@@ -57,8 +57,6 @@ class WaldiezChatData(WaldiezBase):
57
57
  Whether to run the chat silently, by default False (not silent).
58
58
  summary_args : Optional[dict[str, Any]]
59
59
  The summary args to use in autogen.
60
- handoff_condition : Optional[WaldiezHandoffCondition], optional
61
- The handoff condition to use, by default None (for group chat).
62
60
  real_source : Optional[str]
63
61
  The real source of the chat (overrides the source).
64
62
  real_target : Optional[str]
@@ -66,7 +66,7 @@ class WaldiezChatSummary(WaldiezBase):
66
66
  @classmethod
67
67
  def validate_summary_method(
68
68
  cls, value: Optional[WaldiezChatSummaryMethod]
69
- ) -> Optional[WaldiezChatSummaryMethod]:
69
+ ) -> WaldiezChatSummaryMethod | None:
70
70
  """Validate the summary method.
71
71
 
72
72
  Parameters
@@ -76,7 +76,7 @@ class WaldiezChatSummary(WaldiezBase):
76
76
 
77
77
  Returns
78
78
  -------
79
- Optional[WaldiezChatSummaryMethod]
79
+ WaldiezChatSummaryMethod | None
80
80
  The validated message summary method
81
81
  """
82
82
  if str(value).lower() == "none":
@@ -85,6 +85,8 @@ class WaldiezChatSummary(WaldiezBase):
85
85
  return "last_msg"
86
86
  if value == "reflectionWithLlm":
87
87
  return "reflection_with_llm"
88
+ if value not in ("last_msg", "reflection_with_llm"):
89
+ return None
88
90
  return value
89
91
 
90
92
  # noinspection PyNestedDecorators
@@ -107,7 +109,7 @@ class WaldiezChatSummary(WaldiezBase):
107
109
  Any
108
110
  The serialized value.
109
111
  """
110
- if info.by_alias is True:
112
+ if info.by_alias:
111
113
  if value == "reflection_with_llm":
112
114
  return "reflectionWithLlm"
113
115
  if value == "last_msg":
@@ -27,6 +27,7 @@ __all__ = [
27
27
  "WaldiezHandoffTransition",
28
28
  "WaldiezLLMBasedCondition",
29
29
  "WaldiezContextBasedCondition",
30
+ "WaldiezDefaultCondition",
30
31
  ]
31
32
 
32
33
 
@@ -39,9 +40,6 @@ class WaldiezAgentTarget(WaldiezBase):
39
40
  The type of the transition target.
40
41
  value : str
41
42
  The agent id to transfer control to.
42
- order : int
43
- The order of the target in the list of targets.
44
- If -1, the order is automatically determined by the json data.
45
43
  """
46
44
 
47
45
  target_type: Annotated[
@@ -67,9 +65,6 @@ class WaldiezRandomAgentTarget(WaldiezBase):
67
65
  The type of the transition target.
68
66
  value : list[str]
69
67
  A list of agent ids to randomly select from.
70
- order : int
71
- The order of the target in the list of targets.
72
- If -1, the order is automatically determined by the json data.
73
68
  """
74
69
 
75
70
  target_type: Annotated[
@@ -104,11 +99,9 @@ class WaldiezSimpleTarget(WaldiezBase):
104
99
  "TerminateTarget"
105
100
  ]
106
101
  The type of the transition target.
107
- order : int
108
- The order of the target in the list of targets.
109
- If -1, the order is automatically determined by the json data.
110
- target : str
111
- The id of the group or nested chat to transfer control to.
102
+ value : list[str]
103
+ A list of values for the target, not actually used
104
+ (just for consistency with other targets).
112
105
  """
113
106
 
114
107
  target_type: Annotated[
@@ -140,8 +133,6 @@ class WaldiezGroupOrNestedTarget(WaldiezBase):
140
133
  The type of the transition target.
141
134
  value : str
142
135
  The id of the group or nested chat to transfer control to.
143
- order : int
144
- The order of the target in the list of targets.
145
136
  """
146
137
 
147
138
  target_type: Annotated[
@@ -338,10 +329,14 @@ class WaldiezTransitionAvailability(WaldiezBase):
338
329
 
339
330
  Attributes
340
331
  ----------
341
- available : bool
342
- Whether the transition is available.
343
- data : dict[str, Any]
344
- Additional data for the availability condition.
332
+ type : Literal["string", "expression", "none"]
333
+ The type of the availability condition.
334
+ Can be "string", "expression", or "none".
335
+ value : str
336
+ The value of the availability condition.
337
+ If type is "none", this value is ignored.
338
+ If type is "string", this is a string condition.
339
+ If type is "expression", this is an expression condition.
345
340
  """
346
341
 
347
342
  type: Literal["string", "expression", "none"] = "none"
@@ -371,7 +366,20 @@ WaldiezHandoffTransition = Union[
371
366
 
372
367
 
373
368
  class WaldiezHandoff(WaldiezBase):
374
- """Handoff class for Waldiez agents and chats."""
369
+ """Handoff class for Waldiez agents and chats.
370
+
371
+ Attributes
372
+ ----------
373
+ target : WaldiezTransitionTarget
374
+ The target to transfer control to.
375
+ Can be an agent, group, nested chat, or simple target.
376
+ condition : WaldiezHandoffCondition
377
+ The condition to use for the handoff.
378
+ If not provided, the handoff will always be available.
379
+ available : WaldiezTransitionAvailability
380
+ The availability of the handoff.
381
+ If not provided, the handoff will always be available.
382
+ """
375
383
 
376
384
  target: Annotated[
377
385
  WaldiezTransitionTarget,
@@ -41,6 +41,7 @@ def get_valid_python_variable_name(
41
41
  # \W matches any non-word character, but in Python's re module,
42
42
  # \w includes Unicode letters by default, so we need to be more explicit
43
43
  # to replace Unicode letters with underscores for valid Python identifiers
44
+ # noinspection RegExpSimplifiable
44
45
  possible = re.sub(r"[^\w]", "_", possible) # Replace non-word chars
45
46
  possible = re.sub(r"[^\x00-\x7F]", "_", possible) # Replace non-ASCII chars
46
47
 
@@ -4,7 +4,6 @@
4
4
  """Waldiez flow model."""
5
5
 
6
6
  from functools import cached_property
7
- from typing import Optional
8
7
 
9
8
  from pydantic import Field, model_validator
10
9
  from typing_extensions import Annotated, Literal, Self
@@ -133,7 +132,7 @@ class WaldiezFlow(WaldiezBase):
133
132
  description="The date and time when the flow was last updated.",
134
133
  ),
135
134
  ]
136
- _ordered_flow: Optional[list[WaldiezAgentConnection]] = None
135
+ _ordered_flow: list[WaldiezAgentConnection] | None = None
137
136
  _single_agent_mode: bool = False
138
137
  _is_group_chat: bool = False
139
138
 
@@ -160,7 +159,7 @@ class WaldiezFlow(WaldiezBase):
160
159
  return self._is_group_chat
161
160
 
162
161
  @property
163
- def cache_seed(self) -> Optional[int]:
162
+ def cache_seed(self) -> int | None:
164
163
  """Check if the flow has caching disabled.
165
164
 
166
165
  Returns
@@ -351,6 +350,7 @@ class WaldiezFlow(WaldiezBase):
351
350
  ) -> list[WaldiezAgentConnection]:
352
351
  """Get the ordered flow."""
353
352
  if self._is_group_chat:
353
+ # noinspection PyTypeChecker
354
354
  return self._get_group_chat_flow()
355
355
  # in the chats, there is the 'order' field, we use this,
356
356
  # we only keep the ones with order >=0
@@ -408,7 +408,7 @@ class WaldiezFlow(WaldiezBase):
408
408
 
409
409
  Returns
410
410
  -------
411
- list[tuple[WaldiezChat, WaldiezAgent, WaldiezAgent]]
411
+ list[WaldiezAgentConnection]
412
412
  The ordered flow for group chat.
413
413
  """
414
414
  # in a group chat there is no "order", the group manager
@@ -427,8 +427,8 @@ class WaldiezFlow(WaldiezBase):
427
427
  # )
428
428
  # in the second case, the chat would be:
429
429
  # user.run(manager, ...)
430
- user_agent: Optional[WaldiezAgent] = None
431
- to_root_manager: Optional[WaldiezChat] = None
430
+ user_agent: WaldiezAgent | None = None
431
+ to_root_manager: WaldiezChat | None = None
432
432
  root_manager: WaldiezGroupManager = self.get_root_group_manager()
433
433
  for chat in self.data.chats:
434
434
  if chat.target == root_manager.id:
@@ -438,7 +438,9 @@ class WaldiezFlow(WaldiezBase):
438
438
  user_agent = source
439
439
  to_root_manager = chat
440
440
  break
441
- if not to_root_manager or not user_agent:
441
+ if not to_root_manager:
442
+ return []
443
+ if not user_agent:
442
444
  return []
443
445
  return [
444
446
  {
@@ -104,8 +104,8 @@ def get_llm_imports(model: "WaldiezModel") -> set[str]:
104
104
 
105
105
  Returns
106
106
  -------
107
- str
108
- The LLM import statements for the model.
107
+ set[str]
108
+ A set of import statements needed for the model's LLM.
109
109
 
110
110
  Raises
111
111
  ------
@@ -358,6 +358,7 @@ def do_cohere_llm(model: "WaldiezModel") -> tuple[str, str]:
358
358
  return arg, before
359
359
 
360
360
 
361
+ # noinspection DuplicatedCode
361
362
  def do_deepseek_llm(model: "WaldiezModel") -> tuple[str, str]:
362
363
  """Get the DeepSeek LLM argument and any content before it.
363
364
 
@@ -394,6 +395,7 @@ def do_google_llm(model: "WaldiezModel") -> tuple[str, str]:
394
395
  return arg, before
395
396
 
396
397
 
398
+ # noinspection DuplicatedCode
397
399
  def do_groq_llm(model: "WaldiezModel") -> tuple[str, str]:
398
400
  """Get the Groq LLM argument and any content before it.
399
401
 
@@ -2,14 +2,14 @@
2
2
  # Copyright (c) 2024 - 2025 Waldiez and contributors.
3
3
  """Waldiez model extra requirements."""
4
4
 
5
- from typing import Iterator, Set
5
+ from typing import Set
6
6
 
7
7
  from .model import WaldiezModel
8
8
 
9
9
 
10
10
  def get_models_extra_requirements(
11
- models: Iterator[WaldiezModel], autogen_version: str
12
- ) -> Set[str]:
11
+ models: list[WaldiezModel], autogen_version: str
12
+ ) -> set[str]:
13
13
  """Get the models extra requirements.
14
14
 
15
15
  Parameters
@@ -272,6 +272,7 @@ class WaldiezModel(WaldiezBase):
272
272
  return get_llm_arg(self)
273
273
 
274
274
 
275
+ # noinspection PyTypeChecker
275
276
  def set_default_base_url(
276
277
  llm_config: dict[str, Any], api_type: WaldiezModelAPIType
277
278
  ) -> dict[str, Any]:
@@ -303,7 +304,7 @@ def set_default_base_url(
303
304
 
304
305
  def set_bedrock_aws_config(
305
306
  llm_config: dict[str, Any],
306
- aws_config: Optional[WaldiezModelAWS],
307
+ aws_config: WaldiezModelAWS | None,
307
308
  ) -> dict[str, Any]:
308
309
  """Set the AWS config for Bedrock.
309
310
 
@@ -311,7 +312,7 @@ def set_bedrock_aws_config(
311
312
  ----------
312
313
  llm_config : dict[str, Any]
313
314
  The llm config dictionary.
314
- aws_config : Optional[WaldiezModelAWS]
315
+ aws_config : WaldiezModelAWS | None
315
316
  The passed aws config if any.
316
317
 
317
318
  Returns
@@ -2,14 +2,14 @@
2
2
  # Copyright (c) 2024 - 2025 Waldiez and contributors.
3
3
  """Waldiez tool extra requirements."""
4
4
 
5
- from typing import Iterator, Set
5
+ from typing import Set
6
6
 
7
7
  from .predefined import get_predefined_tool_requirements
8
8
  from .tool import WaldiezTool
9
9
 
10
10
 
11
11
  def get_tools_extra_requirements(
12
- tools: Iterator[WaldiezTool],
12
+ tools: list[WaldiezTool],
13
13
  autogen_version: str,
14
14
  ) -> Set[str]:
15
15
  """Get the tools extra requirements.
@@ -106,10 +106,12 @@ class GoogleSearchToolImpl(PredefinedTool):
106
106
  if name not in kwargs:
107
107
  missing.append(name)
108
108
  elif not isinstance(kwargs[name], type_of):
109
+ # pylint: disable=broad-exception-caught
110
+ # noinspection PyBroadException
109
111
  try:
110
112
  kwargs[name] = type_of(kwargs[name])
111
113
  self._kwargs[name] = kwargs[name]
112
- except Exception: # pylint: disable=broad-except
114
+ except Exception:
113
115
  invalid.append(name)
114
116
  else:
115
117
  if name in self._kwargs:
@@ -77,6 +77,7 @@ class PerplexitySearchToolImpl(PredefinedTool):
77
77
  missing_secrets.append("PERPLEXITY_API_KEY")
78
78
  return missing_secrets
79
79
 
80
+ # noinspection DuplicatedCode
80
81
  def validate_kwargs(self, kwargs: dict[str, Any]) -> list[str]:
81
82
  """Validate keyword arguments and return list of missing required ones.
82
83
 
@@ -93,11 +94,13 @@ class PerplexitySearchToolImpl(PredefinedTool):
93
94
  for key, value in self.kwargs.items():
94
95
  if key in kwargs: # pragma: no branch
95
96
  type_of = self.kwarg_types.get(key, str)
97
+ # pylint: disable=broad-exception-caught
98
+ # noinspection PyBroadException
96
99
  try:
97
100
  casted = type_of(value)
98
101
  if key in self.kwargs: # pragma: no branch
99
102
  self.kwargs[key] = casted
100
- except Exception: # pylint: disable=broad-except
103
+ except Exception:
101
104
  pass
102
105
  return []
103
106
 
@@ -68,6 +68,7 @@ class SearxNGSearchToolImpl(PredefinedTool):
68
68
  """
69
69
  return [] # No secrets required for this tool.
70
70
 
71
+ # noinspection DuplicatedCode
71
72
  def validate_kwargs(self, kwargs: dict[str, Any]) -> list[str]:
72
73
  """Validate keyword arguments and return list of missing required ones.
73
74
 
@@ -84,11 +85,13 @@ class SearxNGSearchToolImpl(PredefinedTool):
84
85
  for key, value in self.kwargs.items():
85
86
  if key in kwargs: # pragma: no branch
86
87
  type_of = self.kwarg_types.get(key, str)
88
+ # pylint: disable=broad-exception-caught
89
+ # noinspection PyBroadException
87
90
  try:
88
91
  casted = type_of(value)
89
92
  if key in self.kwargs: # pragma: no branch
90
93
  self.kwargs[key] = casted
91
- except Exception: # pylint: disable=broad-except
94
+ except Exception:
92
95
  pass
93
96
  return []
94
97
 
@@ -73,6 +73,7 @@ class WikipediaSearchToolImpl(PredefinedTool):
73
73
  """
74
74
  return []
75
75
 
76
+ # noinspection DuplicatedCode
76
77
  def validate_kwargs(self, kwargs: dict[str, Any]) -> list[str]:
77
78
  """Validate keyword arguments and return list of missing required ones.
78
79
 
@@ -89,14 +90,17 @@ class WikipediaSearchToolImpl(PredefinedTool):
89
90
  for key, value in self.kwargs.items():
90
91
  if key in kwargs:
91
92
  type_of = self.kwargs_types.get(key, str)
93
+ # pylint: disable=broad-exception-caught
94
+ # noinspection PyBroadException
92
95
  try:
93
96
  casted = type_of(value)
94
97
  if key in self.kwargs:
95
98
  self.kwargs[key] = casted
96
- except Exception: # pylint: disable=broad-except
99
+ except Exception:
97
100
  pass
98
101
  return []
99
102
 
103
+ # pylint: disable=unused-argument
100
104
  def get_content(
101
105
  self,
102
106
  secrets: dict[str, str],