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
@@ -1,178 +0,0 @@
1
- # SPDX-License-Identifier: Apache-2.0.
2
- # Copyright (c) 2024 - 2025 Waldiez and contributors.
3
- # pylint: disable=too-few-public-methods
4
- """Transition target processor for Waldiez agents."""
5
-
6
- from dataclasses import dataclass, field
7
- from typing import Callable, Set
8
-
9
- from waldiez.exporting.chats.utils.nested import get_nested_chat_queue
10
- from waldiez.models import (
11
- WaldiezAgent,
12
- WaldiezAgentTarget,
13
- WaldiezChat,
14
- WaldiezGroupOrNestedTarget,
15
- WaldiezRandomAgentTarget,
16
- WaldiezTransitionTarget,
17
- )
18
-
19
-
20
- @dataclass
21
- class TargetResult:
22
- """Result from processing a transition target."""
23
-
24
- target_string: str = ""
25
- after_agent: str = ""
26
- extra_imports: Set[str] = field(default_factory=set) # pyright: ignore
27
-
28
-
29
- class TransitionTargetProcessor:
30
- """Processor for transition targets."""
31
-
32
- def __init__(
33
- self,
34
- agent: WaldiezAgent,
35
- agent_names: dict[str, str],
36
- chat_names: dict[str, str],
37
- all_chats: list[WaldiezChat],
38
- serializer: Callable[..., str],
39
- ) -> None:
40
- """Initialize the processor with agent names and context.
41
-
42
- Parameters
43
- ----------
44
- agent_names : dict[str, str]
45
- Mapping of agent IDs to their names.
46
- """
47
- self.agent_names = agent_names
48
- self.chat_names = chat_names
49
- self.agent = agent
50
- self.agent_name = agent_names[agent.id]
51
- self.all_chats = all_chats
52
- self.serializer = serializer
53
-
54
- def process(self, target: WaldiezTransitionTarget) -> TargetResult:
55
- """Process transition target based on its type.
56
-
57
- Parameters
58
- ----------
59
- target : WaldiezTransitionTarget
60
- The transition target to process.
61
-
62
- Returns
63
- -------
64
- TargetResult
65
- The processed result containing the target string,
66
- after_agent code, and extra imports.
67
-
68
- Raises
69
- ------
70
- ValueError
71
- If the target type is unknown.
72
- """
73
- result = TargetResult()
74
- where = "autogen.agentchat.group"
75
- if target.target_type == "GroupManagerTarget":
76
- where += ".targets.group_manager_target"
77
- result.extra_imports.add(f"from {where} import {target.target_type}")
78
-
79
- processors: dict[str, Callable[[WaldiezTransitionTarget], str]] = {
80
- "AgentTarget": self._process_agent_target,
81
- "RandomAgentTarget": self._process_random_agent_target,
82
- "GroupChatTarget": self._process_group_chat_target,
83
- "NestedChatTarget": self._process_nested_chat_target,
84
- "AskUserTarget": self._process_simple_target,
85
- "GroupManagerTarget": self._process_simple_target,
86
- "RevertToUserTarget": self._process_simple_target,
87
- "StayTarget": self._process_simple_target,
88
- "TerminateTarget": self._process_simple_target,
89
- }
90
-
91
- processor = processors.get(target.target_type)
92
- if not processor:
93
- raise ValueError(f"Unknown target type: {target.target_type}")
94
-
95
- result.target_string = processor(target)
96
-
97
- # Special handling for nested chat targets
98
- if target.target_type == "NestedChatTarget":
99
- nested_result = self._process_nested_chat_target_full(target)
100
- result.after_agent = nested_result.after_agent
101
-
102
- return result
103
-
104
- def _process_agent_target(self, target: WaldiezTransitionTarget) -> str:
105
- """Process agent target."""
106
- if not isinstance(target, WaldiezAgentTarget):
107
- raise ValueError(
108
- "Expected WaldiezAgentTarget for agent target processing."
109
- )
110
- agent_name = self.agent_names[target.value[0]]
111
- return f"AgentTarget({agent_name})"
112
-
113
- def _process_random_agent_target(
114
- self, target: WaldiezTransitionTarget
115
- ) -> str:
116
- """Process random agent target."""
117
- if not isinstance(target, WaldiezRandomAgentTarget):
118
- raise ValueError(
119
- "Expected WaldiezRandomAgentTarget"
120
- " for random agent target processing."
121
- )
122
- agent_vars = [self.agent_names[agent_id] for agent_id in target.value]
123
- agents_str = ", ".join(agent_vars)
124
- return f"RandomAgentTarget([{agents_str}])"
125
-
126
- def _process_group_chat_target(
127
- self, target: WaldiezTransitionTarget
128
- ) -> str:
129
- """Process group chat target."""
130
- if not isinstance(target, WaldiezGroupOrNestedTarget):
131
- raise ValueError(
132
- "Expected WaldiezGroupOrNestedTarget for group chat target "
133
- "processing."
134
- )
135
- chat_name = self.chat_names[target.value[0]]
136
- return f"GroupChatTarget({chat_name})"
137
-
138
- def _process_nested_chat_target(self, _: WaldiezTransitionTarget) -> str:
139
- """Process nested chat target (simple string only)."""
140
- chat_name = f"{self.agent_name}_handoff_nested_chat_queue"
141
- target_arg = f'nested_chat_config={{"chat_queue": {chat_name}}}'
142
- return f"NestedChatTarget({target_arg})"
143
-
144
- def _process_nested_chat_target_full(
145
- self, _: WaldiezTransitionTarget
146
- ) -> TargetResult:
147
- """Process nested chat target with full configuration."""
148
- result = TargetResult()
149
-
150
- chat_queue, extra_methods = get_nested_chat_queue(
151
- nested_chat=self.agent.data.nested_chats[0],
152
- agent=self.agent,
153
- agent_names=self.agent_names,
154
- chat_names=self.chat_names,
155
- all_chats=self.all_chats,
156
- serializer=self.serializer,
157
- )
158
-
159
- chat_name = f"{self.agent_name}_handoff_nested_chat_queue"
160
-
161
- if extra_methods:
162
- result.after_agent += "\n".join(extra_methods) + "\n"
163
-
164
- result.after_agent += (
165
- f"{chat_name}: list[dict[str, Any]] = {chat_queue}\n\n"
166
- )
167
- return result
168
-
169
- # pylint: disable=no-self-use
170
- def _process_simple_target(self, target: WaldiezTransitionTarget) -> str:
171
- """Process simple targets that don't need parameters.
172
-
173
- Parameters
174
- ----------
175
- target : WaldiezTransitionTarget
176
- The target to process.
177
- """
178
- return f"{target.target_type}()"