waldiez 0.5.5__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.5.dist-info → waldiez-0.5.7.dist-info}/METADATA +59 -57
  102. {waldiez-0.5.5.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.5.dist-info → waldiez-0.5.7.dist-info}/WHEEL +0 -0
  105. {waldiez-0.5.5.dist-info → waldiez-0.5.7.dist-info}/entry_points.txt +0 -0
  106. {waldiez-0.5.5.dist-info → waldiez-0.5.7.dist-info}/licenses/LICENSE +0 -0
  107. {waldiez-0.5.5.dist-info → waldiez-0.5.7.dist-info}/licenses/NOTICE.md +0 -0
@@ -5,7 +5,7 @@
5
5
  import json
6
6
  import re
7
7
  from pathlib import Path
8
- from typing import Any, Union
8
+ from typing import Any
9
9
 
10
10
  from pydantic import Field, model_validator
11
11
  from typing_extensions import Annotated, Literal, Self
@@ -44,9 +44,9 @@ class WaldiezTool(WaldiezBase):
44
44
  The tags of the tool.
45
45
  requirements : list[str]
46
46
  The requirements of the tool.
47
- created_at : str
47
+ created_at : str, optional
48
48
  The date and time when the tool was created.
49
- updated_at : str
49
+ updated_at : str, optional
50
50
  The date and time when the tool was last updated.
51
51
  data : WaldiezToolData
52
52
  The data of the tool. See `WaldiezToolData`.
@@ -81,7 +81,7 @@ class WaldiezTool(WaldiezBase):
81
81
  description="The tags of the tool.",
82
82
  default_factory=list,
83
83
  ),
84
- ]
84
+ ] = []
85
85
  requirements: Annotated[
86
86
  list[str],
87
87
  Field(
@@ -89,7 +89,7 @@ class WaldiezTool(WaldiezBase):
89
89
  description="The requirements of the tool.",
90
90
  default_factory=list,
91
91
  ),
92
- ]
92
+ ] = []
93
93
  data: Annotated[
94
94
  WaldiezToolData,
95
95
  Field(..., title="Data", description="The data of the tool."),
@@ -112,12 +112,12 @@ class WaldiezTool(WaldiezBase):
112
112
  ]
113
113
 
114
114
  @staticmethod
115
- def load(data_or_path: Union[str, Path, dict[str, Any]]) -> "WaldiezTool":
115
+ def load(data_or_path: str | Path | dict[str, Any]) -> "WaldiezTool":
116
116
  """Load a tool from a read-only file.
117
117
 
118
118
  Parameters
119
119
  ----------
120
- data_or_path : Union[str, Path, dict[str, Any]]
120
+ data_or_path : str | Path | dict[str, Any]
121
121
  The path to the read-only file or the loaded data.
122
122
 
123
123
  Returns
@@ -4,8 +4,8 @@
4
4
 
5
5
  from typing import Any
6
6
 
7
- from pydantic import Field
8
- from typing_extensions import Annotated
7
+ from pydantic import Field, SerializationInfo, model_serializer, model_validator
8
+ from typing_extensions import Annotated, Self
9
9
 
10
10
  from ..common import WaldiezBase
11
11
  from .tool_type import WaldiezToolType
@@ -61,3 +61,40 @@ class WaldiezToolData(WaldiezBase):
61
61
  ),
62
62
  ),
63
63
  ] = {}
64
+
65
+ _raw_content: str = ""
66
+
67
+ @model_validator(mode="after")
68
+ def validate_tool_data(self) -> Self:
69
+ """Validate the tool data.
70
+
71
+ Returns
72
+ -------
73
+ Self
74
+ The validated tool data.
75
+ """
76
+ self._raw_content = self.content
77
+
78
+ return self
79
+
80
+ @model_serializer(mode="plain", when_used="always")
81
+ def serialize_tool_data(self, info: SerializationInfo) -> dict[str, Any]:
82
+ """Serialize the tool data.
83
+
84
+ Parameters
85
+ ----------
86
+ info : SerializationInfo
87
+ The serialization information.
88
+
89
+ Returns
90
+ -------
91
+ dict[str, Any]
92
+ The serialized tool data.
93
+ """
94
+ tool_type_key = "toolType" if info.by_alias else "tool_type"
95
+ return {
96
+ tool_type_key: self.tool_type,
97
+ "content": self._raw_content,
98
+ "secrets": self.secrets,
99
+ "kwargs": self.kwargs,
100
+ }
waldiez/models/waldiez.py CHANGED
@@ -11,7 +11,7 @@ definitions and their optional additional tools to be used.
11
11
  import json
12
12
  from dataclasses import dataclass
13
13
  from pathlib import Path
14
- from typing import Any, Iterator, Optional
14
+ from typing import Any, Iterator
15
15
 
16
16
  from .agents import (
17
17
  WaldiezAgent,
@@ -43,11 +43,11 @@ class Waldiez:
43
43
  def from_dict(
44
44
  cls,
45
45
  data: dict[str, Any],
46
- flow_id: Optional[str] = None,
47
- name: Optional[str] = None,
48
- description: Optional[str] = None,
49
- tags: Optional[list[str]] = None,
50
- requirements: Optional[list[str]] = None,
46
+ flow_id: str | None = None,
47
+ name: str | None = None,
48
+ description: str | None = None,
49
+ tags: list[str] | None = None,
50
+ requirements: list[str] | None = None,
51
51
  ) -> "Waldiez":
52
52
  """Create a Waldiez from dict.
53
53
 
@@ -55,15 +55,15 @@ class Waldiez:
55
55
  ----------
56
56
  data : dict[str, Any]
57
57
  The data.
58
- flow_id : Optional[str], optional
58
+ flow_id : str | None, optional
59
59
  The flow id, by default None (retrieved from data or generated).
60
- name : Optional[str], optional
60
+ name: str | None, optional
61
61
  The name, by default None (retrieved from data).
62
- description : Optional[str], optional
62
+ description : str | None, optional
63
63
  The description, by default None (retrieved from data).
64
- tags : Optional[list[str]], optional
64
+ tags: list[str] | None, optional
65
65
  The tags, by default None (retrieved from data).
66
- requirements : Optional[list[str]], optional
66
+ requirements: list[str] | None, optional
67
67
  The requirements, by default None (retrieved from data).
68
68
 
69
69
  Returns
@@ -86,10 +86,10 @@ class Waldiez:
86
86
  def load(
87
87
  cls,
88
88
  waldiez_file: str | Path,
89
- name: Optional[str] = None,
90
- description: Optional[str] = None,
91
- tags: Optional[list[str]] = None,
92
- requirements: Optional[list[str]] = None,
89
+ name: str | None = None,
90
+ description: str | None = None,
91
+ tags: list[str] | None = None,
92
+ requirements: list[str] | None = None,
93
93
  ) -> "Waldiez":
94
94
  """Load a Waldiez from a file.
95
95
 
@@ -97,14 +97,14 @@ class Waldiez:
97
97
  ----------
98
98
  waldiez_file : Union[str, Path]
99
99
  The Waldiez file.
100
- name : Optional[str], optional
101
- The name, by default None.
102
- description : Optional[str], optional
103
- The description, by default None.
104
- tags : Optional[list[str]], optional
105
- The tags, by default None.
106
- requirements : Optional[list[str]], optional
107
- The requirements, by default None.
100
+ name: str | None, optional
101
+ The name, by default None (retrieved from data).
102
+ description : str | None, optional
103
+ The description, by default None (retrieved from data).
104
+ tags: list[str] | None, optional
105
+ The tags, by default None (retrieved from data).
106
+ requirements: list[str] | None, optional
107
+ The requirements, by default None (retrieved from data).
108
108
 
109
109
  Returns
110
110
  -------
@@ -133,7 +133,7 @@ class Waldiez:
133
133
  )
134
134
 
135
135
  def model_dump_json(
136
- self, by_alias: bool = True, indent: Optional[int] = None
136
+ self, by_alias: bool = True, indent: int | None = None
137
137
  ) -> str:
138
138
  """Get the model dump json.
139
139
 
@@ -143,7 +143,7 @@ class Waldiez:
143
143
  ----------
144
144
  by_alias : bool, optional
145
145
  Use alias (toCamel), by default True.
146
- indent : Optional[int], optional
146
+ indent : int | None, optional
147
147
  The indent, by default None.
148
148
 
149
149
  Returns
@@ -250,7 +250,7 @@ class Waldiez:
250
250
  return self.flow.is_async
251
251
 
252
252
  @property
253
- def cache_seed(self) -> Optional[int]:
253
+ def cache_seed(self) -> int | None:
254
254
  """Get the cache seed."""
255
255
  return self.flow.cache_seed
256
256
 
@@ -275,7 +275,7 @@ class Waldiez:
275
275
  requirements = set(requirements_list)
276
276
  requirements.add(f"ag2[openai]=={autogen_version}")
277
277
  if self.has_rag_agents: # pragma: no branch
278
- rag_extras = get_retrievechat_extra_requirements(self.agents)
278
+ rag_extras = get_retrievechat_extra_requirements(list(self.agents))
279
279
  requirements.update(rag_extras)
280
280
  if self.has_multimodal_agents: # pragma: no branch
281
281
  requirements.add(f"ag2[lmm]=={autogen_version}")
@@ -291,13 +291,13 @@ class Waldiez:
291
291
  )
292
292
  requirements.update(
293
293
  get_models_extra_requirements(
294
- self.models,
294
+ list(self.models),
295
295
  autogen_version=autogen_version,
296
296
  )
297
297
  )
298
298
  requirements.update(
299
299
  get_tools_extra_requirements(
300
- self.tools,
300
+ list(self.tools),
301
301
  autogen_version=autogen_version,
302
302
  )
303
303
  )
waldiez/runner.py CHANGED
@@ -92,6 +92,7 @@ class WaldiezRunner(WaldiezBaseRunner):
92
92
  """Factory class for creating Waldiez runners."""
93
93
 
94
94
  # pylint: disable=super-init-not-called
95
+ # noinspection PyMissingConstructor
95
96
  def __init__(
96
97
  self,
97
98
  waldiez: Waldiez,
@@ -212,6 +212,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
212
212
  uploads_root: Path | None,
213
213
  skip_mmd: bool,
214
214
  skip_timeline: bool,
215
+ **kwargs: Any,
215
216
  ) -> Union[list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]]:
216
217
  """Run the Waldiez flow."""
217
218
  raise NotImplementedError(
@@ -225,6 +226,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
225
226
  uploads_root: Path | None,
226
227
  skip_mmd: bool,
227
228
  skip_timeline: bool,
229
+ **kwargs: Any,
228
230
  ) -> Union[list["AsyncRunResponseProtocol"], list["RunResponseProtocol"]]:
229
231
  """Run the Waldiez flow asynchronously."""
230
232
  raise NotImplementedError(
@@ -262,8 +264,6 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
262
264
  The path to the output file.
263
265
  uploads_root : Path | None
264
266
  The root path for uploads, if any.
265
- structured_io : bool
266
- Whether to use structured IO instead of the default 'input/print'.
267
267
  skip_mmd : bool
268
268
  Whether to skip generating the mermaid diagram.
269
269
  """
@@ -444,6 +444,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
444
444
  structured_io: bool | None = None,
445
445
  skip_mmd: bool = False,
446
446
  skip_timeline: bool = False,
447
+ **kwargs: Any,
447
448
  ) -> Union[list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]]:
448
449
  """Run the Waldiez flow in blocking mode.
449
450
 
@@ -460,6 +461,8 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
460
461
  Whether to skip generating the mermaid diagram, by default False.
461
462
  skip_timeline : bool
462
463
  Whether to skip generating the timeline JSON.
464
+ **kwargs : Any
465
+ Additional keyword arguments for the run method.
463
466
 
464
467
  Returns
465
468
  -------
@@ -498,7 +501,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
498
501
  WaldiezBaseRunner._running = True
499
502
  results: Union[
500
503
  list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]
501
- ] = []
504
+ ]
502
505
  old_env_vars = set_env_vars(self.waldiez.get_flow_env_vars())
503
506
  try:
504
507
  with chdir(to=temp_dir):
@@ -526,6 +529,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
526
529
  sys.path.pop(0)
527
530
  return results
528
531
 
532
+ # noinspection DuplicatedCode
529
533
  async def a_run(
530
534
  self,
531
535
  output_path: str | Path | None = None,
@@ -578,7 +582,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
578
582
  WaldiezBaseRunner._running = True
579
583
  results: Union[
580
584
  list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]
581
- ] = []
585
+ ]
582
586
  old_env_vars = set_env_vars(self.waldiez.get_flow_env_vars())
583
587
  try:
584
588
  async with a_chdir(to=temp_dir):
@@ -656,6 +660,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
656
660
  skip_timeline=skip_timeline,
657
661
  )
658
662
 
663
+ # noinspection DuplicatedCode
659
664
  async def a_start(
660
665
  self,
661
666
  output_path: str | Path | None,
@@ -135,6 +135,7 @@ def reload_autogen() -> None: # noqa: C901 # pragma: no cover
135
135
 
136
136
  except Exception as e:
137
137
  # If reload fails, at least try to re-import autogen
138
+ # noinspection PyBroadException
138
139
  try:
139
140
  import autogen # type: ignore # noqa: F401
140
141
 
@@ -174,6 +175,7 @@ def reload_chroma_if_needed() -> None: # pragma: no cover
174
175
  return
175
176
 
176
177
 
178
+ # noinspection DuplicatedCode
177
179
  def try_handle_the_np_thing() -> None:
178
180
  """Try to handle the numpy deprecation warning."""
179
181
  # we might get:
@@ -95,6 +95,7 @@ def get_printer() -> Callable[..., None]: # noqa: C901
95
95
  The printer function that handles Unicode encoding errors gracefully.
96
96
  """
97
97
  try:
98
+ # noinspection PyUnresolvedReferences
98
99
  from autogen.io import IOStream # pyright: ignore
99
100
 
100
101
  printer = IOStream.get_default().print
@@ -102,6 +103,7 @@ def get_printer() -> Callable[..., None]: # noqa: C901
102
103
  # Fallback to standard print if autogen is not available
103
104
  printer = print
104
105
 
106
+ # noinspection PyBroadException
105
107
  def safe_printer(*args: Any, **kwargs: Any) -> None: # noqa: C901
106
108
  """Safe printer that handles Unicode encoding errors.
107
109
 
@@ -15,6 +15,7 @@ from .patch_io_stream import get_printer
15
15
  from .timeline_processor import TimelineProcessor
16
16
 
17
17
 
18
+ # noinspection PyUnusedLocal
18
19
  def after_run(
19
20
  temp_dir: Path,
20
21
  output_file: Optional[Union[str, Path]],
@@ -71,6 +72,7 @@ def after_run(
71
72
  shutil.rmtree(temp_dir)
72
73
 
73
74
 
75
+ # noinspection PyBroadException
74
76
  def _make_mermaid_diagram(
75
77
  temp_dir: Path,
76
78
  output_file: Optional[Union[str, Path]],
@@ -93,6 +95,7 @@ def _make_mermaid_diagram(
93
95
  pass
94
96
 
95
97
 
98
+ # noinspection PyBroadException
96
99
  def _make_timeline_json(
97
100
  temp_dir: Path,
98
101
  ) -> None:
@@ -13,6 +13,7 @@ from .environment import in_virtualenv, is_root
13
13
  from .utils import strip_ansi
14
14
 
15
15
 
16
+ # noinspection PyUnresolvedReferences
16
17
  def install_requirements(
17
18
  extra_requirements: set[str],
18
19
  upgrade: bool = False,
@@ -15,6 +15,7 @@ variables specified in the waldiez file are set.
15
15
  """
16
16
 
17
17
  import asyncio
18
+ import getpass
18
19
  import importlib.util
19
20
  import sys
20
21
  import threading
@@ -35,6 +36,7 @@ if TYPE_CHECKING:
35
36
  AsyncRunResponseProtocol,
36
37
  RunResponseProtocol,
37
38
  )
39
+ from autogen.messages import BaseMessage # type: ignore
38
40
 
39
41
 
40
42
  class WaldiezStandardRunner(WaldiezBaseRunner):
@@ -77,6 +79,26 @@ class WaldiezStandardRunner(WaldiezBaseRunner):
77
79
  self._loaded_module = module
78
80
  return module
79
81
 
82
+ @staticmethod
83
+ def standard_input(prompt: str, *, password: bool = False) -> str:
84
+ """Fallback / common input function for the workflow.
85
+
86
+ Parameters
87
+ ----------
88
+ prompt : str
89
+ The prompt to display to the user.
90
+ password : bool, optional
91
+ If True, use getpass to hide input (default is False).
92
+
93
+ Returns
94
+ -------
95
+ str
96
+ The user input as a string.
97
+ """
98
+ if password:
99
+ return getpass.getpass(prompt)
100
+ return input(prompt)
101
+
80
102
  def _run(
81
103
  self,
82
104
  temp_dir: Path,
@@ -84,6 +106,7 @@ class WaldiezStandardRunner(WaldiezBaseRunner):
84
106
  uploads_root: Path | None,
85
107
  skip_mmd: bool,
86
108
  skip_timeline: bool,
109
+ **kwargs: Any,
87
110
  ) -> Union[list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]]:
88
111
  """Run the Waldiez workflow."""
89
112
  from autogen.io import IOStream # type: ignore
@@ -93,7 +116,7 @@ class WaldiezStandardRunner(WaldiezBaseRunner):
93
116
  self._print: Callable[..., None] = print
94
117
  self._input: (
95
118
  Callable[..., str] | Callable[..., Coroutine[Any, Any, str]]
96
- ) = input
119
+ ) = WaldiezStandardRunner.standard_input
97
120
  results_container: WaldiezRunResults = {
98
121
  "results": [],
99
122
  "exception": None,
@@ -134,7 +157,7 @@ class WaldiezStandardRunner(WaldiezBaseRunner):
134
157
 
135
158
  def _on_event(
136
159
  self,
137
- event: "BaseEvent",
160
+ event: Union["BaseEvent", "BaseMessage"],
138
161
  ) -> bool:
139
162
  """Process an event from the workflow."""
140
163
  self._event_count += 1
@@ -248,7 +271,7 @@ class WaldiezStandardRunner(WaldiezBaseRunner):
248
271
 
249
272
  async def _a_on_event(
250
273
  self,
251
- event: "BaseEvent",
274
+ event: Union["BaseEvent", "BaseMessage"],
252
275
  ) -> bool:
253
276
  """Process an event from the workflow asynchronously."""
254
277
  self._event_count += 1
@@ -293,6 +316,7 @@ class WaldiezStandardRunner(WaldiezBaseRunner):
293
316
  uploads_root: Path | None,
294
317
  skip_mmd: bool = False,
295
318
  skip_timeline: bool = False,
319
+ **kwargs: Any,
296
320
  ) -> Union[list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]]:
297
321
  """Run the Waldiez workflow asynchronously."""
298
322
 
@@ -304,7 +328,7 @@ class WaldiezStandardRunner(WaldiezBaseRunner):
304
328
 
305
329
  from waldiez.io import StructuredIOStream
306
330
 
307
- results: Union[list["AsyncRunResponseProtocol"], list["RunResponseProtocol"]] = []
331
+ results: Union[list["AsyncRunResponseProtocol"], list["RunResponseProtocol"]]
308
332
  try:
309
333
  self._loaded_module = self._load_module(output_file, temp_dir)
310
334
  if self._stop_requested.is_set():
@@ -64,6 +64,7 @@ DEFAULT_AGENT_COLOR = "#E5E7EB"
64
64
  LOG = WaldiezLogger()
65
65
 
66
66
 
67
+ # noinspection PyMethodMayBeStatic
67
68
  class TimelineProcessor:
68
69
  """Class to process timeline data from CSV files."""
69
70
 
@@ -147,6 +148,7 @@ class TimelineProcessor:
147
148
  default_name,
148
149
  )
149
150
  else:
151
+ # noinspection PyTypeChecker
150
152
  last_valid_name = current_name
151
153
 
152
154
  return data
@@ -215,6 +217,7 @@ class TimelineProcessor:
215
217
  pd.Timestamp
216
218
  The parsed datetime.
217
219
  """
220
+ # noinspection PyBroadException
218
221
  try:
219
222
  return pd.to_datetime(date_str)
220
223
  except Exception:
@@ -223,6 +226,7 @@ class TimelineProcessor:
223
226
  return coerced
224
227
  return pd.Timestamp("1970-01-01")
225
228
 
229
+ # noinspection PyMethodMayBeStatic
226
230
  def generate_agent_colors(self, agent_names: list[str]) -> dict[str, str]:
227
231
  """Generate color mapping for agents.
228
232
 
@@ -502,7 +506,11 @@ class TimelineProcessor:
502
506
  if matches:
503
507
  # Return the first match, but prefer longer matches
504
508
  best_match = max(matches, key=len)
505
- return best_match
509
+ return (
510
+ best_match
511
+ if isinstance(best_match, str)
512
+ else str(best_match)
513
+ )
506
514
 
507
515
  # Last resort: look for any word that might be a model name
508
516
  # This catches custom or unknown models
@@ -520,6 +528,7 @@ class TimelineProcessor:
520
528
 
521
529
  return "Unknown"
522
530
 
531
+ # noinspection PyTypeChecker
523
532
  def is_human_input_waiting_period(
524
533
  self,
525
534
  prev_session: Series,
@@ -631,6 +640,7 @@ class TimelineProcessor:
631
640
 
632
641
  return False
633
642
 
643
+ # noinspection PyTypeChecker
634
644
  def categorize_gap_activity(
635
645
  self,
636
646
  prev_session: Series,
@@ -727,6 +737,7 @@ class TimelineProcessor:
727
737
  "detail": f"Processing ({gap_duration:.1f}s)",
728
738
  }
729
739
 
740
+ # noinspection PyUnusedLocal
730
741
  def compress_timeline(
731
742
  self,
732
743
  ) -> tuple[list[dict[str, Any]], list[dict[str, Any]], float, float]:
waldiez/running/utils.py CHANGED
@@ -7,6 +7,8 @@ import os
7
7
  import re
8
8
  import subprocess
9
9
  import sys
10
+
11
+ # noinspection PyProtectedMember
10
12
  from asyncio.subprocess import Process
11
13
  from contextlib import asynccontextmanager, contextmanager
12
14
  from dataclasses import dataclass
@@ -40,6 +40,6 @@ def check_conflicts() -> None: # pragma: no cover
40
40
  """Check for conflicts."""
41
41
  # pylint: disable=global-statement
42
42
  global __waldiez_checked_conflicts
43
- if __waldiez_checked_conflicts is False:
43
+ if not __waldiez_checked_conflicts:
44
44
  __waldiez_checked_conflicts = True
45
45
  _check_conflicts()
waldiez/utils/version.py CHANGED
@@ -10,6 +10,7 @@ from pathlib import Path
10
10
 
11
11
  def _get_waldiez_version_from_importlib() -> str | None:
12
12
  """Get the Waldiez version from the version package."""
13
+ # noinspection PyBroadException
13
14
  try:
14
15
  return version("waldiez")
15
16
  except Exception: # pylint: disable=broad-exception-caught