waldiez 0.4.7__py3-none-any.whl → 0.4.9__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/__init__.py +5 -5
- waldiez/_version.py +1 -1
- waldiez/cli.py +97 -102
- waldiez/exporter.py +61 -19
- waldiez/exporting/__init__.py +25 -6
- waldiez/exporting/agent/__init__.py +7 -3
- waldiez/exporting/agent/code_execution.py +114 -0
- waldiez/exporting/agent/exporter.py +354 -0
- waldiez/exporting/agent/extras/__init__.py +15 -0
- waldiez/exporting/agent/extras/captain_agent_extras.py +315 -0
- waldiez/exporting/agent/extras/group/target.py +178 -0
- waldiez/exporting/agent/extras/group_manager_agent_extas.py +500 -0
- waldiez/exporting/agent/extras/group_member_extras.py +181 -0
- waldiez/exporting/agent/extras/handoffs/__init__.py +19 -0
- waldiez/exporting/agent/extras/handoffs/after_work.py +78 -0
- waldiez/exporting/agent/extras/handoffs/available.py +74 -0
- waldiez/exporting/agent/extras/handoffs/condition.py +158 -0
- waldiez/exporting/agent/extras/handoffs/handoff.py +171 -0
- waldiez/exporting/agent/extras/handoffs/target.py +189 -0
- waldiez/exporting/agent/extras/rag/__init__.py +10 -0
- waldiez/exporting/agent/{utils/rag_user/chroma_utils.py → extras/rag/chroma_extras.py} +37 -24
- waldiez/exporting/agent/{utils/rag_user/mongo_utils.py → extras/rag/mongo_extras.py} +10 -10
- waldiez/exporting/agent/{utils/rag_user/pgvector_utils.py → extras/rag/pgvector_extras.py} +13 -13
- waldiez/exporting/agent/{utils/rag_user/qdrant_utils.py → extras/rag/qdrant_extras.py} +13 -13
- waldiez/exporting/agent/{utils/rag_user/vector_db.py → extras/rag/vector_db_extras.py} +59 -46
- waldiez/exporting/agent/extras/rag_user_proxy_agent_extras.py +245 -0
- waldiez/exporting/agent/extras/reasoning_agent_extras.py +88 -0
- waldiez/exporting/agent/factory.py +95 -0
- waldiez/exporting/agent/processor.py +150 -0
- waldiez/exporting/agent/system_message.py +36 -0
- waldiez/exporting/agent/termination.py +50 -0
- waldiez/exporting/chats/__init__.py +7 -3
- waldiez/exporting/chats/exporter.py +97 -0
- waldiez/exporting/chats/factory.py +65 -0
- waldiez/exporting/chats/processor.py +226 -0
- waldiez/exporting/chats/utils/__init__.py +6 -5
- waldiez/exporting/chats/utils/common.py +11 -45
- waldiez/exporting/chats/utils/group.py +55 -0
- waldiez/exporting/chats/utils/nested.py +37 -52
- waldiez/exporting/chats/utils/sequential.py +72 -61
- waldiez/exporting/chats/utils/{single_chat.py → single.py} +48 -50
- waldiez/exporting/core/__init__.py +196 -0
- waldiez/exporting/core/constants.py +17 -0
- waldiez/exporting/core/content.py +69 -0
- waldiez/exporting/core/context.py +244 -0
- waldiez/exporting/core/enums.py +89 -0
- waldiez/exporting/core/errors.py +19 -0
- waldiez/exporting/core/exporter.py +390 -0
- waldiez/exporting/core/exporters.py +67 -0
- waldiez/exporting/core/extras/__init__.py +39 -0
- waldiez/exporting/core/extras/agent_extras/__init__.py +27 -0
- waldiez/exporting/core/extras/agent_extras/captain_extras.py +57 -0
- waldiez/exporting/core/extras/agent_extras/group_manager_extras.py +102 -0
- waldiez/exporting/core/extras/agent_extras/rag_user_extras.py +53 -0
- waldiez/exporting/core/extras/agent_extras/reasoning_extras.py +68 -0
- waldiez/exporting/core/extras/agent_extras/standard_extras.py +263 -0
- waldiez/exporting/core/extras/base.py +241 -0
- waldiez/exporting/core/extras/chat_extras.py +118 -0
- waldiez/exporting/core/extras/flow_extras.py +70 -0
- waldiez/exporting/core/extras/model_extras.py +73 -0
- waldiez/exporting/core/extras/path_resolver.py +93 -0
- waldiez/exporting/core/extras/serializer.py +138 -0
- waldiez/exporting/core/extras/tool_extras.py +82 -0
- waldiez/exporting/core/protocols.py +259 -0
- waldiez/exporting/core/result.py +705 -0
- waldiez/exporting/core/types.py +329 -0
- waldiez/exporting/core/utils/__init__.py +11 -0
- waldiez/exporting/core/utils/comment.py +33 -0
- waldiez/exporting/core/utils/llm_config.py +117 -0
- waldiez/exporting/core/validation.py +96 -0
- waldiez/exporting/flow/__init__.py +6 -2
- waldiez/exporting/flow/execution_generator.py +193 -0
- waldiez/exporting/flow/exporter.py +107 -0
- waldiez/exporting/flow/factory.py +94 -0
- waldiez/exporting/flow/file_generator.py +214 -0
- waldiez/exporting/flow/merger.py +387 -0
- waldiez/exporting/flow/orchestrator.py +411 -0
- waldiez/exporting/flow/utils/__init__.py +9 -36
- waldiez/exporting/flow/utils/common.py +206 -0
- waldiez/exporting/flow/utils/importing.py +373 -0
- waldiez/exporting/flow/utils/linting.py +200 -0
- waldiez/exporting/flow/utils/{logging_utils.py → logging.py} +23 -9
- waldiez/exporting/models/__init__.py +3 -1
- waldiez/exporting/models/exporter.py +233 -0
- waldiez/exporting/models/factory.py +66 -0
- waldiez/exporting/models/processor.py +139 -0
- waldiez/exporting/tools/__init__.py +11 -0
- waldiez/exporting/tools/exporter.py +207 -0
- waldiez/exporting/tools/factory.py +57 -0
- waldiez/exporting/tools/processor.py +248 -0
- waldiez/exporting/tools/registration.py +133 -0
- waldiez/io/__init__.py +128 -0
- waldiez/io/_ws.py +199 -0
- waldiez/io/models/__init__.py +60 -0
- waldiez/io/models/base.py +66 -0
- waldiez/io/models/constants.py +78 -0
- waldiez/io/models/content/__init__.py +23 -0
- waldiez/io/models/content/audio.py +43 -0
- waldiez/io/models/content/base.py +45 -0
- waldiez/io/models/content/file.py +43 -0
- waldiez/io/models/content/image.py +96 -0
- waldiez/io/models/content/text.py +37 -0
- waldiez/io/models/content/video.py +43 -0
- waldiez/io/models/user_input.py +269 -0
- waldiez/io/models/user_response.py +215 -0
- waldiez/io/mqtt.py +681 -0
- waldiez/io/redis.py +782 -0
- waldiez/io/structured.py +439 -0
- waldiez/io/utils.py +184 -0
- waldiez/io/ws.py +298 -0
- waldiez/logger.py +481 -0
- waldiez/models/__init__.py +108 -51
- waldiez/models/agents/__init__.py +34 -70
- waldiez/models/agents/agent/__init__.py +10 -4
- waldiez/models/agents/agent/agent.py +466 -65
- waldiez/models/agents/agent/agent_data.py +119 -47
- waldiez/models/agents/agent/agent_type.py +13 -2
- waldiez/models/agents/agent/code_execution.py +12 -12
- waldiez/models/agents/agent/human_input_mode.py +8 -0
- waldiez/models/agents/agent/{linked_skill.py → linked_tool.py} +7 -7
- waldiez/models/agents/agent/nested_chat.py +35 -7
- waldiez/models/agents/agent/termination_message.py +30 -22
- waldiez/models/agents/{swarm_agent → agent}/update_system_message.py +22 -22
- waldiez/models/agents/agents.py +58 -63
- waldiez/models/agents/assistant/assistant.py +4 -4
- waldiez/models/agents/assistant/assistant_data.py +13 -1
- waldiez/models/agents/{captain_agent → captain}/captain_agent.py +5 -5
- waldiez/models/agents/{captain_agent → captain}/captain_agent_data.py +5 -5
- waldiez/models/agents/extra_requirements.py +11 -16
- waldiez/models/agents/group_manager/group_manager.py +103 -13
- waldiez/models/agents/group_manager/group_manager_data.py +36 -14
- waldiez/models/agents/group_manager/speakers.py +77 -24
- waldiez/models/agents/{rag_user → rag_user_proxy}/__init__.py +16 -16
- waldiez/models/agents/rag_user_proxy/rag_user_proxy.py +64 -0
- waldiez/models/agents/{rag_user/rag_user_data.py → rag_user_proxy/rag_user_proxy_data.py} +6 -5
- waldiez/models/agents/{rag_user → rag_user_proxy}/retrieve_config.py +182 -114
- waldiez/models/agents/{rag_user → rag_user_proxy}/vector_db_config.py +13 -13
- waldiez/models/agents/reasoning/reasoning_agent.py +6 -6
- waldiez/models/agents/reasoning/reasoning_agent_data.py +110 -63
- waldiez/models/agents/reasoning/reasoning_agent_reason_config.py +38 -10
- waldiez/models/agents/user_proxy/user_proxy.py +11 -7
- waldiez/models/agents/user_proxy/user_proxy_data.py +2 -2
- waldiez/models/chat/__init__.py +2 -1
- waldiez/models/chat/chat.py +166 -87
- waldiez/models/chat/chat_data.py +99 -136
- waldiez/models/chat/chat_message.py +33 -23
- waldiez/models/chat/chat_nested.py +31 -30
- waldiez/models/chat/chat_summary.py +10 -8
- waldiez/models/common/__init__.py +52 -2
- waldiez/models/common/ag2_version.py +1 -1
- waldiez/models/common/base.py +38 -7
- waldiez/models/common/dict_utils.py +42 -17
- waldiez/models/common/handoff.py +459 -0
- waldiez/models/common/id_generator.py +19 -0
- waldiez/models/common/method_utils.py +130 -68
- waldiez/{exporting/base/utils → models/common}/naming.py +38 -61
- waldiez/models/common/waldiez_version.py +37 -0
- waldiez/models/flow/__init__.py +9 -2
- waldiez/models/flow/connection.py +18 -0
- waldiez/models/flow/flow.py +311 -215
- waldiez/models/flow/flow_data.py +207 -40
- waldiez/models/flow/info.py +85 -0
- waldiez/models/flow/naming.py +131 -0
- waldiez/models/model/__init__.py +7 -1
- waldiez/models/model/extra_requirements.py +3 -12
- waldiez/models/model/model.py +76 -21
- waldiez/models/model/model_data.py +108 -20
- waldiez/models/tool/__init__.py +16 -0
- waldiez/models/tool/extra_requirements.py +36 -0
- waldiez/models/{skill/skill.py → tool/tool.py} +88 -88
- waldiez/models/tool/tool_data.py +51 -0
- waldiez/models/tool/tool_type.py +8 -0
- waldiez/models/waldiez.py +97 -80
- waldiez/runner.py +115 -61
- waldiez/running/__init__.py +13 -7
- waldiez/running/environment.py +49 -68
- waldiez/running/gen_seq_diagram.py +16 -14
- waldiez/running/post_run.py +119 -0
- waldiez/running/pre_run.py +149 -0
- waldiez/running/util.py +134 -0
- waldiez/utils/__init__.py +2 -4
- waldiez/utils/cli_extras/jupyter.py +5 -3
- waldiez/utils/cli_extras/runner.py +6 -4
- waldiez/utils/cli_extras/studio.py +6 -4
- waldiez/utils/conflict_checker.py +15 -9
- waldiez/utils/flaml_warnings.py +5 -5
- waldiez/utils/version.py +47 -0
- {waldiez-0.4.7.dist-info → waldiez-0.4.9.dist-info}/METADATA +235 -91
- waldiez-0.4.9.dist-info/RECORD +203 -0
- waldiez/exporting/agent/agent_exporter.py +0 -297
- waldiez/exporting/agent/utils/__init__.py +0 -23
- waldiez/exporting/agent/utils/captain_agent.py +0 -263
- waldiez/exporting/agent/utils/code_execution.py +0 -65
- waldiez/exporting/agent/utils/group_manager.py +0 -220
- waldiez/exporting/agent/utils/rag_user/__init__.py +0 -7
- waldiez/exporting/agent/utils/rag_user/rag_user.py +0 -209
- waldiez/exporting/agent/utils/reasoning.py +0 -36
- waldiez/exporting/agent/utils/swarm_agent.py +0 -469
- waldiez/exporting/agent/utils/teachability.py +0 -41
- waldiez/exporting/agent/utils/termination_message.py +0 -44
- waldiez/exporting/base/__init__.py +0 -25
- waldiez/exporting/base/agent_position.py +0 -75
- waldiez/exporting/base/base_exporter.py +0 -118
- waldiez/exporting/base/export_position.py +0 -48
- waldiez/exporting/base/import_position.py +0 -23
- waldiez/exporting/base/mixin.py +0 -137
- waldiez/exporting/base/utils/__init__.py +0 -18
- waldiez/exporting/base/utils/comments.py +0 -96
- waldiez/exporting/base/utils/path_check.py +0 -68
- waldiez/exporting/base/utils/to_string.py +0 -84
- waldiez/exporting/chats/chats_exporter.py +0 -240
- waldiez/exporting/chats/utils/swarm.py +0 -210
- waldiez/exporting/flow/flow_exporter.py +0 -528
- waldiez/exporting/flow/utils/agent_utils.py +0 -204
- waldiez/exporting/flow/utils/chat_utils.py +0 -71
- waldiez/exporting/flow/utils/def_main.py +0 -77
- waldiez/exporting/flow/utils/flow_content.py +0 -202
- waldiez/exporting/flow/utils/flow_names.py +0 -116
- waldiez/exporting/flow/utils/importing_utils.py +0 -227
- waldiez/exporting/models/models_exporter.py +0 -199
- waldiez/exporting/models/utils.py +0 -174
- waldiez/exporting/skills/__init__.py +0 -9
- waldiez/exporting/skills/skills_exporter.py +0 -176
- waldiez/exporting/skills/utils.py +0 -369
- waldiez/models/agents/agent/teachability.py +0 -70
- waldiez/models/agents/rag_user/rag_user.py +0 -60
- waldiez/models/agents/swarm_agent/__init__.py +0 -50
- waldiez/models/agents/swarm_agent/after_work.py +0 -179
- waldiez/models/agents/swarm_agent/on_condition.py +0 -105
- waldiez/models/agents/swarm_agent/on_condition_available.py +0 -142
- waldiez/models/agents/swarm_agent/on_condition_target.py +0 -40
- waldiez/models/agents/swarm_agent/swarm_agent.py +0 -107
- waldiez/models/agents/swarm_agent/swarm_agent_data.py +0 -124
- waldiez/models/flow/utils.py +0 -232
- waldiez/models/skill/__init__.py +0 -16
- waldiez/models/skill/extra_requirements.py +0 -36
- waldiez/models/skill/skill_data.py +0 -53
- waldiez/models/skill/skill_type.py +0 -8
- waldiez/running/running.py +0 -369
- waldiez/utils/pysqlite3_checker.py +0 -308
- waldiez/utils/rdps_checker.py +0 -122
- waldiez-0.4.7.dist-info/RECORD +0 -149
- /waldiez/models/agents/{captain_agent → captain}/__init__.py +0 -0
- /waldiez/models/agents/{captain_agent → captain}/captain_agent_lib_entry.py +0 -0
- {waldiez-0.4.7.dist-info → waldiez-0.4.9.dist-info}/WHEEL +0 -0
- {waldiez-0.4.7.dist-info → waldiez-0.4.9.dist-info}/entry_points.txt +0 -0
- {waldiez-0.4.7.dist-info → waldiez-0.4.9.dist-info}/licenses/LICENSE +0 -0
- {waldiez-0.4.7.dist-info → waldiez-0.4.9.dist-info}/licenses/NOTICE.md +0 -0
|
@@ -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,
|
|
8
|
+
from typing import Any, Optional
|
|
9
9
|
|
|
10
10
|
from pydantic import ConfigDict, Field, model_validator
|
|
11
11
|
from pydantic.alias_generators import to_camel
|
|
@@ -15,7 +15,7 @@ from ...common import WaldiezBase
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
# pylint: disable=line-too-long
|
|
18
|
-
class
|
|
18
|
+
class WaldiezRagUserProxyVectorDbConfig(WaldiezBase):
|
|
19
19
|
"""The config for the vector db.
|
|
20
20
|
|
|
21
21
|
Attributes
|
|
@@ -36,7 +36,7 @@ class WaldiezRagUserVectorDbConfig(WaldiezBase):
|
|
|
36
36
|
wait_until_document_ready : Optional[float]
|
|
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
|
-
metadata : Optional[
|
|
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
42
|
|
|
@@ -61,7 +61,7 @@ class WaldiezRagUserVectorDbConfig(WaldiezBase):
|
|
|
61
61
|
title="Model",
|
|
62
62
|
description="The model to use for the vector db embeddings.",
|
|
63
63
|
),
|
|
64
|
-
]
|
|
64
|
+
] = None
|
|
65
65
|
use_memory: Annotated[
|
|
66
66
|
bool,
|
|
67
67
|
Field(
|
|
@@ -71,7 +71,7 @@ class WaldiezRagUserVectorDbConfig(WaldiezBase):
|
|
|
71
71
|
"Whether to use memory for the vector db (if qdrant is used)."
|
|
72
72
|
),
|
|
73
73
|
),
|
|
74
|
-
]
|
|
74
|
+
] = True
|
|
75
75
|
use_local_storage: Annotated[
|
|
76
76
|
bool,
|
|
77
77
|
Field(
|
|
@@ -82,7 +82,7 @@ class WaldiezRagUserVectorDbConfig(WaldiezBase):
|
|
|
82
82
|
"(if qdrant or chroma is used)."
|
|
83
83
|
),
|
|
84
84
|
),
|
|
85
|
-
]
|
|
85
|
+
] = False
|
|
86
86
|
local_storage_path: Annotated[
|
|
87
87
|
Optional[str],
|
|
88
88
|
Field(
|
|
@@ -93,7 +93,7 @@ class WaldiezRagUserVectorDbConfig(WaldiezBase):
|
|
|
93
93
|
"(if qdrant is used)."
|
|
94
94
|
),
|
|
95
95
|
),
|
|
96
|
-
]
|
|
96
|
+
] = None
|
|
97
97
|
connection_url: Annotated[
|
|
98
98
|
Optional[str],
|
|
99
99
|
Field(
|
|
@@ -101,7 +101,7 @@ class WaldiezRagUserVectorDbConfig(WaldiezBase):
|
|
|
101
101
|
title="Connection URL",
|
|
102
102
|
description="The connection url for the vector db.",
|
|
103
103
|
),
|
|
104
|
-
]
|
|
104
|
+
] = None
|
|
105
105
|
wait_until_index_ready: Annotated[
|
|
106
106
|
Optional[float],
|
|
107
107
|
Field(
|
|
@@ -112,7 +112,7 @@ class WaldiezRagUserVectorDbConfig(WaldiezBase):
|
|
|
112
112
|
"None, the default, means no wait."
|
|
113
113
|
),
|
|
114
114
|
),
|
|
115
|
-
]
|
|
115
|
+
] = None
|
|
116
116
|
wait_until_document_ready: Annotated[
|
|
117
117
|
Optional[float],
|
|
118
118
|
Field(
|
|
@@ -123,9 +123,9 @@ class WaldiezRagUserVectorDbConfig(WaldiezBase):
|
|
|
123
123
|
"are ready. None, the default, means no wait."
|
|
124
124
|
),
|
|
125
125
|
),
|
|
126
|
-
]
|
|
126
|
+
] = None
|
|
127
127
|
metadata: Annotated[
|
|
128
|
-
Optional[
|
|
128
|
+
Optional[dict[str, Any]],
|
|
129
129
|
Field(
|
|
130
130
|
None,
|
|
131
131
|
title="Metadata",
|
|
@@ -136,7 +136,7 @@ class WaldiezRagUserVectorDbConfig(WaldiezBase):
|
|
|
136
136
|
'"hnsw:M": 32}'
|
|
137
137
|
),
|
|
138
138
|
),
|
|
139
|
-
]
|
|
139
|
+
] = None
|
|
140
140
|
|
|
141
141
|
@model_validator(mode="after")
|
|
142
142
|
def validate_vector_db_config(self) -> Self:
|
|
@@ -147,7 +147,7 @@ class WaldiezRagUserVectorDbConfig(WaldiezBase):
|
|
|
147
147
|
|
|
148
148
|
Returns
|
|
149
149
|
-------
|
|
150
|
-
|
|
150
|
+
WaldiezRagUserProxyVectorDbConfig
|
|
151
151
|
The vector db config.
|
|
152
152
|
|
|
153
153
|
Raises
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Reasoning agent model."""
|
|
4
4
|
|
|
5
|
-
from typing import Any
|
|
5
|
+
from typing import Any
|
|
6
6
|
|
|
7
7
|
from pydantic import Field
|
|
8
8
|
from typing_extensions import Annotated, Literal
|
|
@@ -14,7 +14,7 @@ from .reasoning_agent_data import WaldiezReasoningAgentData
|
|
|
14
14
|
class WaldiezReasoningAgent(WaldiezAgent):
|
|
15
15
|
"""Reasoning agent model."""
|
|
16
16
|
|
|
17
|
-
agent_type: Annotated[
|
|
17
|
+
agent_type: Annotated[ # pyright: ignore
|
|
18
18
|
Literal["reasoning"],
|
|
19
19
|
Field(
|
|
20
20
|
"reasoning",
|
|
@@ -22,17 +22,17 @@ class WaldiezReasoningAgent(WaldiezAgent):
|
|
|
22
22
|
description="The agent type in a graph: 'reasoning'",
|
|
23
23
|
alias="agentType",
|
|
24
24
|
),
|
|
25
|
-
]
|
|
26
|
-
data: Annotated[
|
|
25
|
+
] = "reasoning"
|
|
26
|
+
data: Annotated[ # pyright: ignore
|
|
27
27
|
WaldiezReasoningAgentData,
|
|
28
28
|
Field(
|
|
29
29
|
title="Data",
|
|
30
30
|
description="The reasoning agent's data",
|
|
31
|
-
default_factory=WaldiezReasoningAgentData,
|
|
31
|
+
default_factory=WaldiezReasoningAgentData, # pyright: ignore
|
|
32
32
|
),
|
|
33
33
|
]
|
|
34
34
|
|
|
35
|
-
def get_reasoning_config(self) ->
|
|
35
|
+
def get_reasoning_config(self) -> dict[str, Any]:
|
|
36
36
|
"""Get the reasoning configuration based on its method.
|
|
37
37
|
|
|
38
38
|
Returns
|
|
@@ -2,48 +2,27 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Reasoning agent data model."""
|
|
4
4
|
|
|
5
|
-
from typing import Any
|
|
5
|
+
from typing import Any
|
|
6
6
|
|
|
7
7
|
from pydantic import Field
|
|
8
8
|
from typing_extensions import Annotated, Literal
|
|
9
9
|
|
|
10
|
-
from ..
|
|
10
|
+
from ..agent import WaldiezAgentData
|
|
11
11
|
from .reasoning_agent_reason_config import WaldiezReasoningAgentReasonConfig
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
class WaldiezReasoningAgentData(
|
|
14
|
+
class WaldiezReasoningAgentData(WaldiezAgentData):
|
|
15
15
|
"""Reasoning agent data model."""
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
human_input_mode: Annotated[
|
|
18
|
+
Literal["ALWAYS", "NEVER", "TERMINATE"],
|
|
19
19
|
Field(
|
|
20
|
-
|
|
21
|
-
title="
|
|
22
|
-
description="
|
|
23
|
-
alias="
|
|
24
|
-
deprecated=True,
|
|
20
|
+
"NEVER",
|
|
21
|
+
title="Human input mode",
|
|
22
|
+
description="The human input mode, Defaults to `NEVER`",
|
|
23
|
+
alias="humanInputMode",
|
|
25
24
|
),
|
|
26
|
-
] =
|
|
27
|
-
beam_size: Annotated[
|
|
28
|
-
int,
|
|
29
|
-
Field(
|
|
30
|
-
3,
|
|
31
|
-
title="Beam size",
|
|
32
|
-
description="Number of parallel reasoning paths to maintain",
|
|
33
|
-
alias="beamSize",
|
|
34
|
-
deprecated=True,
|
|
35
|
-
),
|
|
36
|
-
] = 3
|
|
37
|
-
answer_approach: Annotated[
|
|
38
|
-
Literal["pool", "best"],
|
|
39
|
-
Field(
|
|
40
|
-
"pool",
|
|
41
|
-
title="Answer approach",
|
|
42
|
-
description="How to generate final answer",
|
|
43
|
-
alias="answerApproach",
|
|
44
|
-
deprecated=True,
|
|
45
|
-
),
|
|
46
|
-
] = "pool"
|
|
25
|
+
] = "NEVER"
|
|
47
26
|
verbose: Annotated[
|
|
48
27
|
bool,
|
|
49
28
|
Field(
|
|
@@ -51,7 +30,7 @@ class WaldiezReasoningAgentData(WaldiezAssistantData):
|
|
|
51
30
|
title="Verbose",
|
|
52
31
|
description="Whether to show intermediate steps",
|
|
53
32
|
),
|
|
54
|
-
]
|
|
33
|
+
] = True
|
|
55
34
|
reason_config: Annotated[
|
|
56
35
|
WaldiezReasoningAgentReasonConfig,
|
|
57
36
|
Field(
|
|
@@ -62,16 +41,112 @@ class WaldiezReasoningAgentData(WaldiezAssistantData):
|
|
|
62
41
|
),
|
|
63
42
|
]
|
|
64
43
|
|
|
65
|
-
|
|
44
|
+
@property
|
|
45
|
+
def method(self) -> str:
|
|
46
|
+
"""Get the method of the reasoning agent.
|
|
47
|
+
|
|
48
|
+
Returns
|
|
49
|
+
-------
|
|
50
|
+
str
|
|
51
|
+
The method of the reasoning agent.
|
|
52
|
+
|
|
53
|
+
"""
|
|
54
|
+
return self.reason_config.method
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def max_depth(self) -> int:
|
|
58
|
+
"""Get the maximum depth of the reasoning agent.
|
|
59
|
+
|
|
60
|
+
Returns
|
|
61
|
+
-------
|
|
62
|
+
int
|
|
63
|
+
The maximum depth of the reasoning agent.
|
|
64
|
+
|
|
65
|
+
"""
|
|
66
|
+
return self.reason_config.max_depth
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def beam_size(self) -> int:
|
|
70
|
+
"""Get the beam size of the reasoning agent.
|
|
71
|
+
|
|
72
|
+
Returns
|
|
73
|
+
-------
|
|
74
|
+
int
|
|
75
|
+
The beam size of the reasoning agent.
|
|
76
|
+
|
|
77
|
+
"""
|
|
78
|
+
return self.reason_config.beam_size
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def answer_approach(self) -> str:
|
|
82
|
+
"""Get the answer approach of the reasoning agent.
|
|
83
|
+
|
|
84
|
+
Returns
|
|
85
|
+
-------
|
|
86
|
+
str
|
|
87
|
+
The answer approach of the reasoning agent.
|
|
88
|
+
|
|
89
|
+
"""
|
|
90
|
+
return self.reason_config.answer_approach
|
|
91
|
+
|
|
92
|
+
@property
|
|
93
|
+
def forest_size(self) -> int:
|
|
94
|
+
"""Get the forest size of the reasoning agent.
|
|
95
|
+
|
|
96
|
+
Returns
|
|
97
|
+
-------
|
|
98
|
+
int
|
|
99
|
+
The forest size of the reasoning agent.
|
|
100
|
+
|
|
101
|
+
"""
|
|
102
|
+
return self.reason_config.forest_size
|
|
103
|
+
|
|
104
|
+
@property
|
|
105
|
+
def rating_scale(self) -> int:
|
|
106
|
+
"""Get the rating scale of the reasoning agent.
|
|
107
|
+
|
|
108
|
+
Returns
|
|
109
|
+
-------
|
|
110
|
+
int
|
|
111
|
+
The rating scale of the reasoning agent.
|
|
112
|
+
|
|
113
|
+
"""
|
|
114
|
+
return self.reason_config.rating_scale
|
|
115
|
+
|
|
116
|
+
@property
|
|
117
|
+
def exploration_constant(self) -> float:
|
|
118
|
+
"""Get the exploration constant of the reasoning agent.
|
|
119
|
+
|
|
120
|
+
Returns
|
|
121
|
+
-------
|
|
122
|
+
float
|
|
123
|
+
The exploration constant of the reasoning agent.
|
|
124
|
+
|
|
125
|
+
"""
|
|
126
|
+
return self.reason_config.exploration_constant
|
|
127
|
+
|
|
128
|
+
@property
|
|
129
|
+
def nsim(self) -> int:
|
|
130
|
+
"""Get the number of simulations of the reasoning agent.
|
|
131
|
+
|
|
132
|
+
Returns
|
|
133
|
+
-------
|
|
134
|
+
int
|
|
135
|
+
The number of simulations of the reasoning agent.
|
|
136
|
+
|
|
137
|
+
"""
|
|
138
|
+
return self.reason_config.nsim
|
|
139
|
+
|
|
140
|
+
def get_reasoning_config(self) -> dict[str, Any]:
|
|
66
141
|
"""Get the reasoning configuration based on the reason_config method.
|
|
67
142
|
|
|
68
143
|
Returns
|
|
69
144
|
-------
|
|
70
|
-
|
|
145
|
+
dict[str, Any]
|
|
71
146
|
The reasoning configuration.
|
|
72
147
|
|
|
73
148
|
"""
|
|
74
|
-
reason_dict:
|
|
149
|
+
reason_dict: dict[str, Any] = {
|
|
75
150
|
"method": self.reason_config.method,
|
|
76
151
|
"max_depth": self.reason_config.max_depth,
|
|
77
152
|
"forest_size": self.reason_config.forest_size,
|
|
@@ -86,31 +161,3 @@ class WaldiezReasoningAgentData(WaldiezAssistantData):
|
|
|
86
161
|
self.reason_config.exploration_constant
|
|
87
162
|
)
|
|
88
163
|
return reason_dict
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
# reason_config (dict): Configuration for the reasoning method.
|
|
92
|
-
# Supported parameters:
|
|
93
|
-
# method (str): The search strategy to use. Options:
|
|
94
|
-
# - "beam_search" (default): Uses beam search with parallel paths
|
|
95
|
-
# - "mcts": Uses Monte Carlo Tree Search for exploration
|
|
96
|
-
# - "lats": Uses Language Agent Tree Search with per-step rewards
|
|
97
|
-
# - "dfs": Uses depth-first search
|
|
98
|
-
# (equivalent to beam_search with beam_size=1)
|
|
99
|
-
# Common parameters:
|
|
100
|
-
# max_depth (int): Maximum depth of reasoning tree (default: 3)
|
|
101
|
-
# forest_size (int):
|
|
102
|
-
# Number of independent trees to maintain (default: 1)
|
|
103
|
-
# rating_scale (int):
|
|
104
|
-
# Scale for grading responses, e.g. 1-10 (default: 10)
|
|
105
|
-
# Beam Search specific:
|
|
106
|
-
# beam_size (int): Number of parallel paths to maintain (default: 3)
|
|
107
|
-
# answer_approach (str):
|
|
108
|
-
# How to select final answer, "pool" or "best" (default: "pool")
|
|
109
|
-
# MCTS/LATS specific:
|
|
110
|
-
# nsim (int): Number of simulations to run (default: 3)
|
|
111
|
-
# exploration_constant (float):
|
|
112
|
-
# UCT exploration parameter (default: 1.41)
|
|
113
|
-
# Example configs:
|
|
114
|
-
# `{"method": "beam_search", "beam_size": 5, "max_depth": 4}`
|
|
115
|
-
# `{"method": "mcts", "nsim": 10, "exploration_constant": 2.0}`
|
|
116
|
-
# `{"method": "lats", "nsim": 5, "forest_size": 3}`
|
|
@@ -7,7 +7,7 @@ from typing_extensions import Annotated, Literal
|
|
|
7
7
|
|
|
8
8
|
from ...common import WaldiezBase
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
ReasonConfigMethod = Literal["beam_search", "mcts", "lats", "dfs"]
|
|
11
11
|
"""Possible reasoning methods."""
|
|
12
12
|
|
|
13
13
|
|
|
@@ -37,13 +37,13 @@ class WaldiezReasoningAgentReasonConfig(WaldiezBase):
|
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
39
|
method: Annotated[
|
|
40
|
-
|
|
40
|
+
ReasonConfigMethod,
|
|
41
41
|
Field(
|
|
42
42
|
"beam_search",
|
|
43
43
|
title="Method",
|
|
44
44
|
description="The search strategy to use.",
|
|
45
45
|
),
|
|
46
|
-
]
|
|
46
|
+
] = "beam_search"
|
|
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
|
-
]
|
|
54
|
+
] = 3
|
|
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
|
-
]
|
|
62
|
+
] = 1
|
|
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
|
-
]
|
|
70
|
+
] = 10
|
|
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
|
-
]
|
|
78
|
+
] = 3
|
|
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
|
-
]
|
|
86
|
+
] = "pool"
|
|
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
|
-
]
|
|
94
|
+
] = 3
|
|
95
95
|
exploration_constant: Annotated[
|
|
96
96
|
float,
|
|
97
97
|
Field(
|
|
@@ -99,4 +99,32 @@ class WaldiezReasoningAgentReasonConfig(WaldiezBase):
|
|
|
99
99
|
title="Exploration constant",
|
|
100
100
|
description="UCT exploration parameter.",
|
|
101
101
|
),
|
|
102
|
-
]
|
|
102
|
+
] = 1.41
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
# reason_config (dict): Configuration for the reasoning method.
|
|
106
|
+
# Supported parameters:
|
|
107
|
+
# method (str): The search strategy to use. Options:
|
|
108
|
+
# - "beam_search" (default): Uses beam search with parallel paths
|
|
109
|
+
# - "mcts": Uses Monte Carlo Tree Search for exploration
|
|
110
|
+
# - "lats": Uses Language Agent Tree Search with per-step rewards
|
|
111
|
+
# - "dfs": Uses depth-first search
|
|
112
|
+
# (equivalent to beam_search with beam_size=1)
|
|
113
|
+
# Common parameters:
|
|
114
|
+
# max_depth (int): Maximum depth of reasoning tree (default: 3)
|
|
115
|
+
# forest_size (int):
|
|
116
|
+
# Number of independent trees to maintain (default: 1)
|
|
117
|
+
# rating_scale (int):
|
|
118
|
+
# Scale for grading responses, e.g. 1-10 (default: 10)
|
|
119
|
+
# Beam Search specific:
|
|
120
|
+
# beam_size (int): Number of parallel paths to maintain (default: 3)
|
|
121
|
+
# answer_approach (str):
|
|
122
|
+
# How to select final answer, "pool" or "best" (default: "pool")
|
|
123
|
+
# MCTS/LATS specific:
|
|
124
|
+
# nsim (int): Number of simulations to run (default: 3)
|
|
125
|
+
# exploration_constant (float):
|
|
126
|
+
# UCT exploration parameter (default: 1.41)
|
|
127
|
+
# Example configs:
|
|
128
|
+
# `{"method": "beam_search", "beam_size": 5, "max_depth": 4}`
|
|
129
|
+
# `{"method": "mcts", "nsim": 10, "exploration_constant": 2.0}`
|
|
130
|
+
# `{"method": "lats", "nsim": 5, "forest_size": 3}`
|
|
@@ -18,26 +18,30 @@ class WaldiezUserProxy(WaldiezAgent):
|
|
|
18
18
|
|
|
19
19
|
Attributes
|
|
20
20
|
----------
|
|
21
|
-
agent_type : Literal["user"]
|
|
21
|
+
agent_type : Literal["user", "user_proxy"]
|
|
22
22
|
The agent type: 'user' for a user proxy agent
|
|
23
23
|
data : WaldiezUserProxyData
|
|
24
24
|
The user proxy agent's data
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
|
-
agent_type: Annotated[
|
|
28
|
-
Literal["user"],
|
|
27
|
+
agent_type: Annotated[ # pyright: ignore
|
|
28
|
+
Literal["user", "user_proxy"],
|
|
29
29
|
Field(
|
|
30
|
-
"
|
|
30
|
+
"user_proxy",
|
|
31
31
|
title="Agent type",
|
|
32
|
-
description=
|
|
32
|
+
description=(
|
|
33
|
+
"The agent type in a graph. "
|
|
34
|
+
"`user` is deprecated and will be removed in future versions. "
|
|
35
|
+
"Use `user_proxy` instead."
|
|
36
|
+
),
|
|
33
37
|
alias="agentType",
|
|
34
38
|
),
|
|
35
39
|
]
|
|
36
|
-
data: Annotated[
|
|
40
|
+
data: Annotated[ # pyright: ignore
|
|
37
41
|
WaldiezUserProxyData,
|
|
38
42
|
Field(
|
|
39
43
|
title="Data",
|
|
40
44
|
description="The user proxy agent's data",
|
|
41
|
-
default_factory=WaldiezUserProxyData,
|
|
45
|
+
default_factory=WaldiezUserProxyData, # pyright: ignore
|
|
42
46
|
),
|
|
43
47
|
]
|
|
@@ -24,9 +24,9 @@ class WaldiezUserProxyData(WaldiezAgentData):
|
|
|
24
24
|
human_input_mode: Annotated[
|
|
25
25
|
Literal["ALWAYS", "NEVER", "TERMINATE"],
|
|
26
26
|
Field(
|
|
27
|
-
"ALWAYS",
|
|
27
|
+
default="ALWAYS",
|
|
28
28
|
title="Human input mode",
|
|
29
29
|
description="The human input mode, Defaults to `ALWAYS`",
|
|
30
30
|
alias="humanInputMode",
|
|
31
31
|
),
|
|
32
|
-
]
|
|
32
|
+
] = "ALWAYS"
|
waldiez/models/chat/__init__.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez chat related models."""
|
|
4
4
|
|
|
5
|
-
from .chat import WaldiezChat
|
|
5
|
+
from .chat import WaldiezChat, WaldiezChatType
|
|
6
6
|
from .chat_data import WaldiezChatData
|
|
7
7
|
from .chat_message import (
|
|
8
8
|
CALLABLE_MESSAGE,
|
|
@@ -37,4 +37,5 @@ __all__ = [
|
|
|
37
37
|
"WaldiezChatNested",
|
|
38
38
|
"WaldiezChatSummary",
|
|
39
39
|
"WaldiezChatSummaryMethod",
|
|
40
|
+
"WaldiezChatType",
|
|
40
41
|
]
|