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.
- waldiez/_version.py +1 -1
- waldiez/cli.py +1 -1
- waldiez/exporter.py +1 -1
- waldiez/exporting/agent/code_execution.py +8 -1
- waldiez/exporting/agent/exporter.py +2 -1
- waldiez/exporting/agent/extras/captain_agent_extras.py +1 -0
- waldiez/exporting/agent/extras/doc_agent_extras.py +2 -3
- waldiez/exporting/agent/extras/group_manager_agent_extas.py +1 -0
- waldiez/exporting/agent/extras/handoffs/after_work.py +4 -4
- waldiez/exporting/agent/extras/handoffs/target.py +3 -0
- waldiez/exporting/agent/extras/rag/chroma_extras.py +0 -4
- waldiez/exporting/agent/extras/rag/mongo_extras.py +0 -1
- waldiez/exporting/agent/extras/rag/pgvector_extras.py +0 -2
- waldiez/exporting/agent/extras/rag/qdrant_extras.py +0 -3
- waldiez/exporting/agent/extras/rag/vector_db_extras.py +3 -2
- waldiez/exporting/agent/factory.py +11 -11
- waldiez/exporting/agent/processor.py +3 -2
- waldiez/exporting/chats/exporter.py +2 -2
- waldiez/exporting/chats/factory.py +5 -5
- waldiez/exporting/chats/processor.py +22 -1
- waldiez/exporting/chats/utils/sequential.py +3 -68
- waldiez/exporting/chats/utils/single.py +1 -38
- waldiez/exporting/core/context.py +39 -38
- waldiez/exporting/core/exporter.py +10 -10
- waldiez/exporting/core/exporters.py +36 -0
- waldiez/exporting/core/extras/base.py +2 -2
- waldiez/exporting/core/extras/chat_extras.py +4 -2
- waldiez/exporting/core/extras/path_resolver.py +6 -4
- waldiez/exporting/core/extras/serializer.py +1 -0
- waldiez/exporting/core/protocols.py +6 -0
- waldiez/exporting/core/result.py +8 -7
- waldiez/exporting/core/types.py +2 -2
- waldiez/exporting/core/utils/llm_config.py +2 -0
- waldiez/exporting/flow/factory.py +2 -2
- waldiez/exporting/flow/file_generator.py +8 -7
- waldiez/exporting/flow/merger.py +8 -7
- waldiez/exporting/flow/orchestrator.py +22 -8
- waldiez/exporting/flow/utils/__init__.py +2 -0
- waldiez/exporting/flow/utils/common.py +16 -0
- waldiez/exporting/flow/utils/logging.py +5 -2
- waldiez/exporting/models/factory.py +6 -7
- waldiez/exporting/tools/exporter.py +5 -5
- waldiez/exporting/tools/factory.py +4 -5
- waldiez/exporting/tools/processor.py +3 -3
- waldiez/exporting/tools/registration.py +1 -0
- waldiez/io/_ws.py +2 -0
- waldiez/io/models/content/audio.py +1 -0
- waldiez/io/models/content/file.py +1 -0
- waldiez/io/models/content/image.py +1 -0
- waldiez/io/models/content/text.py +1 -0
- waldiez/io/models/content/video.py +1 -0
- waldiez/io/models/user_input.py +1 -0
- waldiez/io/models/user_response.py +1 -0
- waldiez/io/mqtt.py +6 -3
- waldiez/io/redis.py +7 -9
- waldiez/io/structured.py +8 -6
- waldiez/io/utils.py +11 -4
- waldiez/io/ws.py +4 -3
- waldiez/logger.py +11 -1
- waldiez/models/agents/agent/agent.py +1 -0
- waldiez/models/agents/agent/agent_data.py +2 -2
- waldiez/models/agents/agent/nested_chat.py +1 -4
- waldiez/models/agents/agent/termination_message.py +0 -7
- waldiez/models/agents/agent/update_system_message.py +2 -2
- waldiez/models/agents/doc_agent/doc_agent_data.py +33 -26
- waldiez/models/agents/doc_agent/rag_query_engine.py +1 -1
- waldiez/models/agents/extra_requirements.py +5 -5
- waldiez/models/agents/group_manager/group_manager.py +3 -7
- waldiez/models/agents/group_manager/speakers.py +0 -7
- waldiez/models/agents/rag_user_proxy/rag_user_proxy.py +0 -2
- waldiez/models/agents/rag_user_proxy/rag_user_proxy_data.py +0 -2
- waldiez/models/agents/rag_user_proxy/retrieve_config.py +1 -17
- waldiez/models/agents/rag_user_proxy/vector_db_config.py +0 -5
- waldiez/models/chat/chat_data.py +0 -2
- waldiez/models/chat/chat_summary.py +5 -3
- waldiez/models/common/handoff.py +26 -18
- waldiez/models/common/naming.py +1 -0
- waldiez/models/flow/flow.py +9 -7
- waldiez/models/model/_llm.py +4 -2
- waldiez/models/model/extra_requirements.py +3 -3
- waldiez/models/model/model.py +3 -2
- waldiez/models/tool/extra_requirements.py +2 -2
- waldiez/models/tool/predefined/_google.py +3 -1
- waldiez/models/tool/predefined/_perplexity.py +4 -1
- waldiez/models/tool/predefined/_searxng.py +4 -1
- waldiez/models/tool/predefined/_wikipedia.py +5 -1
- waldiez/models/tool/tool.py +7 -7
- waldiez/models/tool/tool_data.py +39 -2
- waldiez/models/waldiez.py +29 -29
- waldiez/runner.py +1 -0
- waldiez/running/base_runner.py +9 -4
- waldiez/running/environment.py +2 -0
- waldiez/running/patch_io_stream.py +2 -0
- waldiez/running/post_run.py +3 -0
- waldiez/running/pre_run.py +1 -0
- waldiez/running/standard_runner.py +28 -4
- waldiez/running/timeline_processor.py +12 -1
- waldiez/running/utils.py +2 -0
- waldiez/utils/conflict_checker.py +1 -1
- waldiez/utils/version.py +1 -0
- {waldiez-0.5.6.dist-info → waldiez-0.5.7.dist-info}/METADATA +59 -57
- {waldiez-0.5.6.dist-info → waldiez-0.5.7.dist-info}/RECORD +106 -107
- waldiez/exporting/agent/extras/group/target.py +0 -178
- {waldiez-0.5.6.dist-info → waldiez-0.5.7.dist-info}/WHEEL +0 -0
- {waldiez-0.5.6.dist-info → waldiez-0.5.7.dist-info}/entry_points.txt +0 -0
- {waldiez-0.5.6.dist-info → waldiez-0.5.7.dist-info}/licenses/LICENSE +0 -0
- {waldiez-0.5.6.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}()"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|