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
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0.
|
|
2
|
+
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
# pylint: disable=too-many-arguments,too-many-positional-arguments
|
|
4
|
+
# pylint: disable=too-many-return-statements,too-many-instance-attributes
|
|
5
|
+
"""Export agents."""
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any, Callable, Optional, Union
|
|
9
|
+
|
|
10
|
+
from waldiez.models import (
|
|
11
|
+
WaldiezAgent,
|
|
12
|
+
WaldiezAgentConnection,
|
|
13
|
+
WaldiezChat,
|
|
14
|
+
WaldiezModel,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
from ..core import (
|
|
18
|
+
ContentOrder,
|
|
19
|
+
Exporter,
|
|
20
|
+
ExporterContext,
|
|
21
|
+
ExportPosition,
|
|
22
|
+
StandardExtras,
|
|
23
|
+
)
|
|
24
|
+
from .code_execution import CodeExecutionProcessor
|
|
25
|
+
from .extras.captain_agent_extras import CaptainAgentProcessor
|
|
26
|
+
from .extras.group_manager_agent_extas import GroupManagerProcessor
|
|
27
|
+
from .extras.group_member_extras import GroupMemberAgentProcessor
|
|
28
|
+
from .extras.rag_user_proxy_agent_extras import RagUserProxyAgentProcessor
|
|
29
|
+
from .extras.reasoning_agent_extras import ReasoningAgentProcessor
|
|
30
|
+
from .processor import AgentProcessor
|
|
31
|
+
from .system_message import SystemMessageProcessor
|
|
32
|
+
from .termination import TerminationProcessor
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class AgentExporter(Exporter[StandardExtras]):
|
|
36
|
+
"""Agent exporter with standard extras."""
|
|
37
|
+
|
|
38
|
+
def __init__(
|
|
39
|
+
self,
|
|
40
|
+
agent: WaldiezAgent,
|
|
41
|
+
agent_names: dict[str, str],
|
|
42
|
+
models: tuple[list[WaldiezModel], dict[str, str]],
|
|
43
|
+
chats: tuple[list[WaldiezChat], dict[str, str]],
|
|
44
|
+
tool_names: dict[str, str],
|
|
45
|
+
is_async: bool = False,
|
|
46
|
+
for_notebook: bool = False,
|
|
47
|
+
cache_seed: Optional[int] = None,
|
|
48
|
+
initial_chats: Optional[list[WaldiezAgentConnection]] = None,
|
|
49
|
+
group_chat_members: Optional[list[WaldiezAgent]] = None,
|
|
50
|
+
arguments_resolver: Optional[
|
|
51
|
+
Callable[[WaldiezAgent], list[str]]
|
|
52
|
+
] = None,
|
|
53
|
+
output_dir: Optional[Union[str, Path]] = None,
|
|
54
|
+
context: Optional[ExporterContext] = None,
|
|
55
|
+
**kwargs: Any,
|
|
56
|
+
):
|
|
57
|
+
"""Initialize the agent exporter.
|
|
58
|
+
|
|
59
|
+
Parameters
|
|
60
|
+
----------
|
|
61
|
+
agent : WaldiezAgent
|
|
62
|
+
The agent to export.
|
|
63
|
+
agent_names : dict[str, str]
|
|
64
|
+
Mapping of agent IDs to names.
|
|
65
|
+
models : tuple[list[WaldiezModel], dict[str, str]]
|
|
66
|
+
All models and model names mapping.
|
|
67
|
+
chats : tuple[list[WaldiezChat], dict[str, str]]
|
|
68
|
+
All chats and chat names mapping.
|
|
69
|
+
tool_names : dict[str, str]
|
|
70
|
+
Mapping of tool IDs to names.
|
|
71
|
+
is_async : bool, optional
|
|
72
|
+
Whether the flow is async, by default False
|
|
73
|
+
for_notebook : bool, optional
|
|
74
|
+
Whether exporting for notebook, by default False
|
|
75
|
+
cache_seed : Optional[int], optional
|
|
76
|
+
Cache seed if any, by default None
|
|
77
|
+
initial_chats : Optional[list[WaldiezAgentConnection]], optional
|
|
78
|
+
Initial chats for group managers, by default None
|
|
79
|
+
group_chat_members : Optional[list[WaldiezAgent]], optional
|
|
80
|
+
Group chat members if group manager, by default None
|
|
81
|
+
arguments_resolver : Optional[Callable], optional
|
|
82
|
+
Function to resolve additional arguments, by default None
|
|
83
|
+
output_dir : Optional[Union[str, Path]], optional
|
|
84
|
+
Output directory for generated files, by default None
|
|
85
|
+
context : Optional[ExporterContext], optional
|
|
86
|
+
Exporter context with dependencies, by default None
|
|
87
|
+
**kwargs : Any
|
|
88
|
+
Additional keyword arguments.
|
|
89
|
+
"""
|
|
90
|
+
super().__init__(context, **kwargs)
|
|
91
|
+
|
|
92
|
+
self.agent = agent
|
|
93
|
+
self.agent_names = agent_names
|
|
94
|
+
self.models = models[0]
|
|
95
|
+
self.model_names = models[1]
|
|
96
|
+
self.all_chats = chats[0]
|
|
97
|
+
self.chat_names = chats[1]
|
|
98
|
+
self.tool_names = tool_names
|
|
99
|
+
self.is_async = is_async
|
|
100
|
+
self.for_notebook = for_notebook
|
|
101
|
+
self.cache_seed = cache_seed
|
|
102
|
+
self.initial_chats = initial_chats or []
|
|
103
|
+
self.group_chat_members = group_chat_members or []
|
|
104
|
+
self.arguments_resolver = arguments_resolver or fallback_args_resolver
|
|
105
|
+
self.output_dir = Path(output_dir) if output_dir else None
|
|
106
|
+
|
|
107
|
+
# Initialize extras based on agent type
|
|
108
|
+
self._extras = self._create_agent_extras()
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def extras(self) -> StandardExtras:
|
|
112
|
+
"""Get the agent extras."""
|
|
113
|
+
return self._extras
|
|
114
|
+
|
|
115
|
+
def _create_agent_extras(self) -> StandardExtras:
|
|
116
|
+
"""Create and populate agent extras based on agent type."""
|
|
117
|
+
# Determine the appropriate extras type
|
|
118
|
+
if self.agent.is_group_manager:
|
|
119
|
+
return self._create_group_manager_extras()
|
|
120
|
+
if self.agent.is_group_member:
|
|
121
|
+
return self._create_group_member_extras()
|
|
122
|
+
if self.agent.is_captain:
|
|
123
|
+
return self._create_captain_extras()
|
|
124
|
+
if self.agent.is_reasoning:
|
|
125
|
+
return self.create_reasoning_extras()
|
|
126
|
+
if self.agent.is_rag_user:
|
|
127
|
+
return self._create_rag_user_extras()
|
|
128
|
+
return self._create_standard_extras()
|
|
129
|
+
|
|
130
|
+
def _create_standard_extras(self) -> StandardExtras:
|
|
131
|
+
"""Create standard agent extras."""
|
|
132
|
+
extras = StandardExtras(self.agent.id)
|
|
133
|
+
|
|
134
|
+
# Process code execution
|
|
135
|
+
if self.agent.data.code_execution_config is not False:
|
|
136
|
+
code_processor = CodeExecutionProcessor(
|
|
137
|
+
agent=self.agent,
|
|
138
|
+
agent_name=self.agent_names[self.agent.id],
|
|
139
|
+
tool_names=self.tool_names,
|
|
140
|
+
)
|
|
141
|
+
code_config = code_processor.process()
|
|
142
|
+
extras.set_code_execution(code_config)
|
|
143
|
+
|
|
144
|
+
# Process termination message
|
|
145
|
+
termination_processor = TerminationProcessor(
|
|
146
|
+
agent=self.agent,
|
|
147
|
+
agent_name=self.agent_names[self.agent.id],
|
|
148
|
+
)
|
|
149
|
+
termination_config = termination_processor.process()
|
|
150
|
+
extras.set_termination_config(termination_config)
|
|
151
|
+
|
|
152
|
+
# Process system message
|
|
153
|
+
system_message_processor = SystemMessageProcessor(
|
|
154
|
+
agent=self.agent,
|
|
155
|
+
)
|
|
156
|
+
system_message_config = system_message_processor.process()
|
|
157
|
+
extras.set_system_message_config(system_message_config)
|
|
158
|
+
|
|
159
|
+
return extras
|
|
160
|
+
|
|
161
|
+
def _create_group_manager_extras(self) -> StandardExtras:
|
|
162
|
+
"""Create group manager agent extras."""
|
|
163
|
+
# Start with standard extras
|
|
164
|
+
standard_extras = self._create_standard_extras()
|
|
165
|
+
|
|
166
|
+
# Add group manager specific processing
|
|
167
|
+
group_manager_processor = GroupManagerProcessor(
|
|
168
|
+
agent=self.agent,
|
|
169
|
+
agent_names=self.agent_names,
|
|
170
|
+
all_models=self.models,
|
|
171
|
+
model_names=self.model_names,
|
|
172
|
+
initial_chats=self.initial_chats,
|
|
173
|
+
group_chat_members=self.group_chat_members,
|
|
174
|
+
serializer=(self.context.get_serializer().serialize),
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
group_manager_extras = group_manager_processor.process(
|
|
178
|
+
system_message_config=standard_extras.system_message_config,
|
|
179
|
+
termination_config=standard_extras.termination_config,
|
|
180
|
+
code_execution_config=standard_extras.code_execution_config,
|
|
181
|
+
)
|
|
182
|
+
return group_manager_extras
|
|
183
|
+
|
|
184
|
+
def _create_group_member_extras(self) -> StandardExtras:
|
|
185
|
+
"""Create group member agent extras."""
|
|
186
|
+
# Start with standard extras
|
|
187
|
+
extras = self._create_standard_extras()
|
|
188
|
+
# Add group member specific processing
|
|
189
|
+
group_member_processor = GroupMemberAgentProcessor(
|
|
190
|
+
agent=self.agent,
|
|
191
|
+
agent_names=self.agent_names,
|
|
192
|
+
tool_names=self.tool_names,
|
|
193
|
+
chat_names=self.chat_names,
|
|
194
|
+
all_chats=self.all_chats,
|
|
195
|
+
serializer=self.context.get_serializer().serialize,
|
|
196
|
+
)
|
|
197
|
+
group_member_results = group_member_processor.process()
|
|
198
|
+
if group_member_results.before_agent:
|
|
199
|
+
extras.append_before_agent(group_member_results.before_agent)
|
|
200
|
+
# Add group member specific arguments
|
|
201
|
+
for arg in group_member_results.extra_arguments:
|
|
202
|
+
extras.add_arg(arg)
|
|
203
|
+
# Add group member specific imports
|
|
204
|
+
for import_stmt in group_member_results.extra_imports:
|
|
205
|
+
extras.add_import(import_stmt)
|
|
206
|
+
if group_member_results.after_agent:
|
|
207
|
+
extras.append_after_agent(group_member_results.after_agent)
|
|
208
|
+
return extras
|
|
209
|
+
|
|
210
|
+
def _create_rag_user_extras(self) -> StandardExtras:
|
|
211
|
+
"""Create RAG user agent extras."""
|
|
212
|
+
# Start with standard extras
|
|
213
|
+
extras = self._create_standard_extras()
|
|
214
|
+
|
|
215
|
+
rag_processor = RagUserProxyAgentProcessor(
|
|
216
|
+
agent=self.agent,
|
|
217
|
+
agent_name=self.agent_names[self.agent.id],
|
|
218
|
+
model_names=self.model_names,
|
|
219
|
+
)
|
|
220
|
+
rag_result = rag_processor.process()
|
|
221
|
+
# Add RAG user specific arguments
|
|
222
|
+
for arg in rag_result.extra_args:
|
|
223
|
+
extras.add_arg(arg)
|
|
224
|
+
# Add RAG user specific imports
|
|
225
|
+
extras.add_imports(rag_result.extra_imports)
|
|
226
|
+
if rag_result.before_agent:
|
|
227
|
+
extras.prepend_before_agent(rag_result.before_agent)
|
|
228
|
+
return extras
|
|
229
|
+
|
|
230
|
+
def _create_captain_extras(self) -> StandardExtras:
|
|
231
|
+
"""Create captain agent extras."""
|
|
232
|
+
# Start with standard extras
|
|
233
|
+
extras = self._create_standard_extras()
|
|
234
|
+
|
|
235
|
+
# Add captain specific processing
|
|
236
|
+
captain_processor = CaptainAgentProcessor(
|
|
237
|
+
agent=self.agent,
|
|
238
|
+
agent_names=self.agent_names,
|
|
239
|
+
all_models=self.models,
|
|
240
|
+
serializer=(
|
|
241
|
+
self.context.get_serializer()
|
|
242
|
+
if self.context.serializer
|
|
243
|
+
else None
|
|
244
|
+
),
|
|
245
|
+
output_dir=self.output_dir,
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
captain_result = captain_processor.process(
|
|
249
|
+
system_message_config=extras.system_message_config,
|
|
250
|
+
termination_config=extras.termination_config,
|
|
251
|
+
code_execution_config=extras.code_execution_config,
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
# # Add captain arguments
|
|
255
|
+
for arg in captain_result.extra_args:
|
|
256
|
+
extras.add_arg(arg)
|
|
257
|
+
|
|
258
|
+
# # Add captain imports
|
|
259
|
+
extras.add_imports(captain_result.extra_imports)
|
|
260
|
+
|
|
261
|
+
# # Add any captain-specific before content
|
|
262
|
+
if captain_result.before_agent:
|
|
263
|
+
extras.append_before_agent(captain_result.before_agent)
|
|
264
|
+
|
|
265
|
+
return extras
|
|
266
|
+
|
|
267
|
+
def create_reasoning_extras(self) -> StandardExtras:
|
|
268
|
+
"""Create reasoning-specific extras for the agent.
|
|
269
|
+
|
|
270
|
+
Returns
|
|
271
|
+
-------
|
|
272
|
+
StandardExtras
|
|
273
|
+
The reasoning-specific extras.
|
|
274
|
+
"""
|
|
275
|
+
# Start with standard extras
|
|
276
|
+
extras = self._create_standard_extras()
|
|
277
|
+
|
|
278
|
+
reasoning_processor = ReasoningAgentProcessor(
|
|
279
|
+
agent=self.agent,
|
|
280
|
+
serializer=(
|
|
281
|
+
self.context.get_serializer()
|
|
282
|
+
if self.context.serializer
|
|
283
|
+
else None
|
|
284
|
+
),
|
|
285
|
+
)
|
|
286
|
+
# Process reasoning-specific content
|
|
287
|
+
reason_extras = reasoning_processor.process(
|
|
288
|
+
code_execution_config=extras.code_execution_config,
|
|
289
|
+
termination_config=extras.termination_config,
|
|
290
|
+
system_message_config=extras.system_message_config,
|
|
291
|
+
)
|
|
292
|
+
# Add reasoning arguments
|
|
293
|
+
for arg in reason_extras.extra_args:
|
|
294
|
+
extras.add_arg(arg)
|
|
295
|
+
|
|
296
|
+
return reason_extras
|
|
297
|
+
|
|
298
|
+
def generate_main_content(self) -> Optional[str]:
|
|
299
|
+
"""Generate the main agent definition.
|
|
300
|
+
|
|
301
|
+
Returns
|
|
302
|
+
-------
|
|
303
|
+
Optional[str]
|
|
304
|
+
The main agent definition content, or None if not applicable.
|
|
305
|
+
"""
|
|
306
|
+
# Use AgentProcessor to generate the main definition
|
|
307
|
+
agent_processor = AgentProcessor(
|
|
308
|
+
agent=self.agent,
|
|
309
|
+
agent_names=self.agent_names,
|
|
310
|
+
arguments_resolver=self.arguments_resolver,
|
|
311
|
+
extras=self.extras,
|
|
312
|
+
)
|
|
313
|
+
result = agent_processor.process().content
|
|
314
|
+
if result:
|
|
315
|
+
# Add the main agent definition content
|
|
316
|
+
self.add_content(
|
|
317
|
+
result,
|
|
318
|
+
ExportPosition.AGENTS,
|
|
319
|
+
order=(
|
|
320
|
+
ContentOrder.MAIN_CONTENT
|
|
321
|
+
if not self.agent.is_group_manager
|
|
322
|
+
else ContentOrder.LATE_CLEANUP
|
|
323
|
+
),
|
|
324
|
+
)
|
|
325
|
+
self.extras.append_after_all_agents(result)
|
|
326
|
+
return result
|
|
327
|
+
|
|
328
|
+
def _add_default_imports(self) -> None:
|
|
329
|
+
"""Add default imports for agents."""
|
|
330
|
+
# Add default agent imports
|
|
331
|
+
if hasattr(self.agent, "ag2_imports"):
|
|
332
|
+
for import_stmt in self.agent.ag2_imports:
|
|
333
|
+
self.add_import(import_stmt)
|
|
334
|
+
|
|
335
|
+
# Add tools import if agent has tools
|
|
336
|
+
if self.agent.data.tools:
|
|
337
|
+
self.add_import("from autogen import register_function")
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
# pylint: disable=unused-argument
|
|
341
|
+
def fallback_args_resolver(agent: WaldiezAgent) -> list[str]:
|
|
342
|
+
"""Fallback resolver for agent arguments.
|
|
343
|
+
|
|
344
|
+
Parameters
|
|
345
|
+
----------
|
|
346
|
+
agent : WaldiezAgent
|
|
347
|
+
The agent for which to resolve arguments.
|
|
348
|
+
|
|
349
|
+
Returns
|
|
350
|
+
-------
|
|
351
|
+
list[str]
|
|
352
|
+
An empty list (no extra args).
|
|
353
|
+
"""
|
|
354
|
+
return []
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0.
|
|
2
|
+
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
"""Agents exporter extras."""
|
|
4
|
+
|
|
5
|
+
from .captain_agent_extras import CaptainAgentProcessor
|
|
6
|
+
from .group_manager_agent_extas import GroupManagerProcessor
|
|
7
|
+
from .group_member_extras import GroupMemberAgentProcessor
|
|
8
|
+
from .reasoning_agent_extras import ReasoningAgentProcessor
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"CaptainAgentProcessor",
|
|
12
|
+
"GroupManagerProcessor",
|
|
13
|
+
"GroupMemberAgentProcessor",
|
|
14
|
+
"ReasoningAgentProcessor",
|
|
15
|
+
]
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0.
|
|
2
|
+
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
# pylint: disable=too-few-public-methods,no-self-use
|
|
4
|
+
"""Captain agent configuration processor."""
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
import uuid
|
|
9
|
+
from datetime import datetime, timezone
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Any, Optional
|
|
12
|
+
|
|
13
|
+
from waldiez.models import (
|
|
14
|
+
WaldiezAgent,
|
|
15
|
+
WaldiezCaptainAgent,
|
|
16
|
+
WaldiezModel,
|
|
17
|
+
WaldiezModelData,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
from ...core import (
|
|
21
|
+
CodeExecutionConfig,
|
|
22
|
+
DefaultSerializer,
|
|
23
|
+
Serializer,
|
|
24
|
+
SystemMessageConfig,
|
|
25
|
+
TerminationConfig,
|
|
26
|
+
)
|
|
27
|
+
from ...core.extras.agent_extras import CaptainExtras
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class CaptainAgentProcessor:
|
|
31
|
+
"""Processor for captain agent configuration."""
|
|
32
|
+
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
agent: WaldiezAgent,
|
|
36
|
+
agent_names: dict[str, str],
|
|
37
|
+
all_models: list[WaldiezModel],
|
|
38
|
+
serializer: Optional[Serializer] = None,
|
|
39
|
+
output_dir: Optional[Path] = None,
|
|
40
|
+
):
|
|
41
|
+
self.agent = agent
|
|
42
|
+
self.agent_names = agent_names
|
|
43
|
+
self.all_models = all_models
|
|
44
|
+
self.serializer = serializer or DefaultSerializer()
|
|
45
|
+
self.output_dir = output_dir
|
|
46
|
+
|
|
47
|
+
def process(
|
|
48
|
+
self,
|
|
49
|
+
code_execution_config: Optional[CodeExecutionConfig] = None,
|
|
50
|
+
termination_config: Optional[TerminationConfig] = None,
|
|
51
|
+
system_message_config: Optional[SystemMessageConfig] = None,
|
|
52
|
+
) -> CaptainExtras:
|
|
53
|
+
"""Process group manager and return extras.
|
|
54
|
+
|
|
55
|
+
Parameters
|
|
56
|
+
----------
|
|
57
|
+
code_execution_config : CodeExecutionConfig, optional
|
|
58
|
+
Configuration for code execution, by default None.
|
|
59
|
+
termination_config : TerminationConfig, optional
|
|
60
|
+
Configuration for termination, by default None.
|
|
61
|
+
system_message_config : SystemMessageConfig, optional
|
|
62
|
+
Configuration for system messages, by default None.
|
|
63
|
+
|
|
64
|
+
Returns
|
|
65
|
+
-------
|
|
66
|
+
CaptainExtras
|
|
67
|
+
The processed result containing extra arguments, before content,
|
|
68
|
+
imports, and environment variables.
|
|
69
|
+
"""
|
|
70
|
+
result = CaptainExtras(
|
|
71
|
+
instance_id=self.agent.id,
|
|
72
|
+
code_execution_config=code_execution_config,
|
|
73
|
+
termination_config=termination_config,
|
|
74
|
+
system_message_config=system_message_config,
|
|
75
|
+
)
|
|
76
|
+
if not self.agent.is_captain or not isinstance(
|
|
77
|
+
self.agent, WaldiezCaptainAgent
|
|
78
|
+
):
|
|
79
|
+
return result
|
|
80
|
+
agent_name = self.agent_names[self.agent.id]
|
|
81
|
+
save_path = str(self.output_dir) if self.output_dir else "."
|
|
82
|
+
if save_path != ".":
|
|
83
|
+
os.makedirs(save_path, exist_ok=True)
|
|
84
|
+
result.add_arg("agent_config_save_path=os.getcwd()", tabs=1)
|
|
85
|
+
if self.agent.data.agent_lib:
|
|
86
|
+
lib_dict = [
|
|
87
|
+
lib.model_dump(by_alias=False)
|
|
88
|
+
for lib in self.agent.data.agent_lib
|
|
89
|
+
]
|
|
90
|
+
lib_json_name = f"{agent_name}_agent_lib.json"
|
|
91
|
+
agent_lib_path = os.path.join(save_path, lib_json_name)
|
|
92
|
+
with open(agent_lib_path, "w", encoding="utf-8", newline="\n") as f:
|
|
93
|
+
json.dump(lib_dict, f, ensure_ascii=False, indent=4)
|
|
94
|
+
result.add_arg(f'agent_lib="{lib_json_name}"', tabs=1)
|
|
95
|
+
if self.agent.data.tool_lib:
|
|
96
|
+
result.add_arg(f'tool_lib="{self.agent.data.tool_lib}"', tabs=1)
|
|
97
|
+
nested_config = self._generate_nested_config(
|
|
98
|
+
self.agent,
|
|
99
|
+
agent_name,
|
|
100
|
+
save_path,
|
|
101
|
+
)
|
|
102
|
+
result.set_nested_config(nested_config)
|
|
103
|
+
serialized_nested_config = self.serializer.serialize(nested_config)
|
|
104
|
+
result.add_arg(f"nested_config={serialized_nested_config}", tabs=1)
|
|
105
|
+
return result
|
|
106
|
+
|
|
107
|
+
def _generate_nested_config(
|
|
108
|
+
self,
|
|
109
|
+
agent: WaldiezCaptainAgent,
|
|
110
|
+
agent_name: str,
|
|
111
|
+
save_path: str,
|
|
112
|
+
) -> dict[str, Any]:
|
|
113
|
+
"""Generate the nested config for the captain agent.
|
|
114
|
+
|
|
115
|
+
Parameters
|
|
116
|
+
----------
|
|
117
|
+
agent_name : str
|
|
118
|
+
The agent name.
|
|
119
|
+
save_path : str
|
|
120
|
+
The path to save the nested config.
|
|
121
|
+
|
|
122
|
+
Returns
|
|
123
|
+
-------
|
|
124
|
+
dict[str, Any]
|
|
125
|
+
The nested config.
|
|
126
|
+
"""
|
|
127
|
+
config_file_or_env_name = f"{agent_name}_llm_config.json"
|
|
128
|
+
llm_config_list = self._get_llm_configs()
|
|
129
|
+
os.makedirs(save_path, exist_ok=True)
|
|
130
|
+
config_file_or_env_path = os.path.join(
|
|
131
|
+
save_path, config_file_or_env_name
|
|
132
|
+
)
|
|
133
|
+
with open(
|
|
134
|
+
config_file_or_env_path, "w", encoding="utf-8", newline="\n"
|
|
135
|
+
) as f:
|
|
136
|
+
json.dump(llm_config_list, f, ensure_ascii=False, indent=4)
|
|
137
|
+
llm_config = llm_config_list[0]
|
|
138
|
+
if "temperature" not in llm_config:
|
|
139
|
+
llm_config["temperature"] = 1
|
|
140
|
+
if "top_p" not in llm_config:
|
|
141
|
+
llm_config["top_p"] = 0.95
|
|
142
|
+
if "max_tokens" not in llm_config:
|
|
143
|
+
llm_config["max_tokens"] = 2048
|
|
144
|
+
return {
|
|
145
|
+
"autobuild_init_config": {
|
|
146
|
+
"config_file_or_env": config_file_or_env_name,
|
|
147
|
+
"builder_model": llm_config["model"],
|
|
148
|
+
"agent_model": llm_config["model"],
|
|
149
|
+
},
|
|
150
|
+
"autobuild_build_config": self._get_auto_build_build_config(
|
|
151
|
+
llm_config
|
|
152
|
+
),
|
|
153
|
+
"group_chat_config": {"max_round": agent.data.max_round},
|
|
154
|
+
"group_chat_llm_config": None,
|
|
155
|
+
"max_turns": agent.data.max_turns,
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
def _get_llm_configs(self) -> list[dict[str, Any]]:
|
|
159
|
+
"""Get the LLM configurations for the captain agent.
|
|
160
|
+
|
|
161
|
+
Returns
|
|
162
|
+
-------
|
|
163
|
+
list[dict[str, Any]]
|
|
164
|
+
The list of LLM configurations.
|
|
165
|
+
"""
|
|
166
|
+
temperature = 1
|
|
167
|
+
top_p = 0.95
|
|
168
|
+
max_tokens = 2048
|
|
169
|
+
models_in_list: list[WaldiezModel] = []
|
|
170
|
+
config_list: list[dict[str, Any]] = []
|
|
171
|
+
for model_id in self.agent.data.model_ids:
|
|
172
|
+
model = self._get_waldiez_model(model_id)
|
|
173
|
+
if model not in models_in_list:
|
|
174
|
+
models_in_list.append(model)
|
|
175
|
+
llm_config = model.get_llm_config(skip_price=True)
|
|
176
|
+
config_list.append(llm_config)
|
|
177
|
+
if not config_list:
|
|
178
|
+
default_model = self._get_default_model(uuid.uuid4().hex)
|
|
179
|
+
default_llm_config = default_model.get_llm_config(skip_price=True)
|
|
180
|
+
if "temperature" not in default_llm_config:
|
|
181
|
+
default_llm_config["temperature"] = temperature
|
|
182
|
+
if "top_p" not in default_llm_config:
|
|
183
|
+
default_llm_config["top_p"] = top_p
|
|
184
|
+
if "max_tokens" not in default_llm_config:
|
|
185
|
+
default_llm_config["max_tokens"] = max_tokens
|
|
186
|
+
config_list.append(default_llm_config)
|
|
187
|
+
return config_list
|
|
188
|
+
|
|
189
|
+
def _get_auto_build_build_config(
|
|
190
|
+
self,
|
|
191
|
+
llm_config: dict[str, Any],
|
|
192
|
+
) -> dict[str, Any]:
|
|
193
|
+
"""Get the auto build build config.
|
|
194
|
+
|
|
195
|
+
Parameters
|
|
196
|
+
----------
|
|
197
|
+
llm_config : dict[str, Any]
|
|
198
|
+
The LLM configuration.
|
|
199
|
+
|
|
200
|
+
Returns
|
|
201
|
+
-------
|
|
202
|
+
dict[str, Any]
|
|
203
|
+
The auto build build config.
|
|
204
|
+
"""
|
|
205
|
+
coding = False
|
|
206
|
+
code_execution_config: dict[str, Any] = {
|
|
207
|
+
"timeout": 300,
|
|
208
|
+
"work_dir": "groupchat",
|
|
209
|
+
"last_n_messages": 1,
|
|
210
|
+
"use_docker": False,
|
|
211
|
+
}
|
|
212
|
+
if self.agent.data.code_execution_config is not False:
|
|
213
|
+
coding = True
|
|
214
|
+
code_execution_config["work_dir"] = (
|
|
215
|
+
self.agent.data.code_execution_config.work_dir or "groupchat"
|
|
216
|
+
)
|
|
217
|
+
code_execution_config["last_n_messages"] = (
|
|
218
|
+
self.agent.data.code_execution_config.last_n_messages or 1
|
|
219
|
+
)
|
|
220
|
+
code_execution_config["timeout"] = (
|
|
221
|
+
self.agent.data.code_execution_config.timeout or 300
|
|
222
|
+
)
|
|
223
|
+
return {
|
|
224
|
+
"default_llm_config": {
|
|
225
|
+
"temperature": llm_config["temperature"],
|
|
226
|
+
"top_p": llm_config["top_p"],
|
|
227
|
+
"max_tokens": llm_config["max_tokens"],
|
|
228
|
+
},
|
|
229
|
+
"code_execution_config": code_execution_config,
|
|
230
|
+
"coding": coding,
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
def _get_waldiez_model(self, model_id: str) -> WaldiezModel:
|
|
234
|
+
"""Get the Waldiez model by its ID.
|
|
235
|
+
|
|
236
|
+
Parameters
|
|
237
|
+
----------
|
|
238
|
+
model_id : str
|
|
239
|
+
The model's ID.
|
|
240
|
+
|
|
241
|
+
Returns
|
|
242
|
+
-------
|
|
243
|
+
WaldiezModel
|
|
244
|
+
The Waldiez model.
|
|
245
|
+
"""
|
|
246
|
+
for model in self.all_models:
|
|
247
|
+
if model.id == model_id:
|
|
248
|
+
return model
|
|
249
|
+
return self._get_default_model(model_id)
|
|
250
|
+
|
|
251
|
+
def _get_default_model(self, model_id: str) -> WaldiezModel:
|
|
252
|
+
"""Get the default model.
|
|
253
|
+
|
|
254
|
+
Parameters
|
|
255
|
+
----------
|
|
256
|
+
model_id : str
|
|
257
|
+
The model's id.
|
|
258
|
+
|
|
259
|
+
Returns
|
|
260
|
+
-------
|
|
261
|
+
WaldiezModel
|
|
262
|
+
The default model.
|
|
263
|
+
"""
|
|
264
|
+
now = (
|
|
265
|
+
datetime.now(tz=timezone.utc)
|
|
266
|
+
.isoformat(timespec="milliseconds")
|
|
267
|
+
.replace("+00:00", "Z")
|
|
268
|
+
)
|
|
269
|
+
return WaldiezModel(
|
|
270
|
+
id=model_id,
|
|
271
|
+
type="model",
|
|
272
|
+
name="gpt-4o",
|
|
273
|
+
description="The GPT-4o model.",
|
|
274
|
+
tags=["gpt-4o"],
|
|
275
|
+
requirements=[],
|
|
276
|
+
created_at=now,
|
|
277
|
+
updated_at=now,
|
|
278
|
+
data=WaldiezModelData(
|
|
279
|
+
api_type="openai",
|
|
280
|
+
temperature=1,
|
|
281
|
+
top_p=0.95,
|
|
282
|
+
max_tokens=2048,
|
|
283
|
+
base_url=None,
|
|
284
|
+
api_key=None,
|
|
285
|
+
api_version=None,
|
|
286
|
+
default_headers={},
|
|
287
|
+
price=None,
|
|
288
|
+
),
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
# DEFAULT_NESTED_CONFIG = {
|
|
293
|
+
# "autobuild_init_config": {
|
|
294
|
+
# "config_file_or_env": "OAI_CONFIG_LIST",
|
|
295
|
+
# "builder_model": "gpt-4o",
|
|
296
|
+
# "agent_model": "gpt-4o",
|
|
297
|
+
# },
|
|
298
|
+
# "autobuild_build_config": {
|
|
299
|
+
# "default_llm_config": {
|
|
300
|
+
# "temperature": 1,
|
|
301
|
+
# "top_p": 0.95,
|
|
302
|
+
# "max_tokens": 2048
|
|
303
|
+
# },
|
|
304
|
+
# "code_execution_config": {
|
|
305
|
+
# "timeout": 300,
|
|
306
|
+
# "work_dir": "groupchat",
|
|
307
|
+
# "last_n_messages": 1,
|
|
308
|
+
# "use_docker": False,
|
|
309
|
+
# },
|
|
310
|
+
# "coding": True,
|
|
311
|
+
# },
|
|
312
|
+
# "group_chat_config": {"max_round": 10},
|
|
313
|
+
# "group_chat_llm_config": None,
|
|
314
|
+
# "max_turns": 5,
|
|
315
|
+
# }
|