waldiez 0.3.10__py3-none-any.whl → 0.3.12__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/exporter.py +6 -69
- waldiez/exporting/agent/agent_exporter.py +22 -15
- waldiez/exporting/agent/utils/__init__.py +2 -4
- waldiez/exporting/agent/utils/captain_agent.py +254 -0
- waldiez/exporting/chats/chats_exporter.py +3 -3
- waldiez/exporting/chats/utils/sequential.py +1 -0
- waldiez/exporting/chats/utils/single_chat.py +3 -0
- waldiez/exporting/flow/flow_exporter.py +11 -3
- waldiez/exporting/flow/utils/def_main.py +15 -6
- waldiez/exporting/flow/utils/flow_content.py +11 -10
- waldiez/exporting/flow/utils/importing_utils.py +1 -0
- waldiez/exporting/models/models_exporter.py +7 -0
- waldiez/exporting/models/utils.py +4 -0
- waldiez/models/__init__.py +6 -0
- waldiez/models/agents/__init__.py +14 -0
- waldiez/models/agents/agent/agent.py +71 -8
- waldiez/models/agents/agents.py +13 -3
- waldiez/models/agents/captain_agent/__init__.py +15 -0
- waldiez/models/agents/captain_agent/captain_agent.py +45 -0
- waldiez/models/agents/captain_agent/captain_agent_data.py +62 -0
- waldiez/models/agents/captain_agent/captain_agent_lib_entry.py +38 -0
- waldiez/models/agents/extra_requirements.py +88 -0
- waldiez/models/common/__init__.py +2 -0
- waldiez/models/common/ag2_version.py +30 -0
- waldiez/models/common/base.py +4 -0
- waldiez/models/common/date_utils.py +2 -0
- waldiez/models/common/dict_utils.py +2 -0
- waldiez/models/flow/__init__.py +2 -0
- waldiez/models/flow/flow.py +88 -10
- waldiez/models/flow/flow_data.py +15 -1
- waldiez/models/flow/utils.py +61 -1
- waldiez/models/model/__init__.py +2 -0
- waldiez/models/model/extra_requirements.py +55 -0
- waldiez/models/model/model.py +8 -2
- waldiez/models/model/model_data.py +2 -1
- waldiez/models/waldiez.py +26 -75
- {waldiez-0.3.10.dist-info → waldiez-0.3.12.dist-info}/METADATA +38 -29
- {waldiez-0.3.10.dist-info → waldiez-0.3.12.dist-info}/RECORD +43 -37
- waldiez/exporting/agent/utils/agent_class_name.py +0 -36
- waldiez/exporting/agent/utils/agent_imports.py +0 -55
- {waldiez-0.3.10.dist-info → waldiez-0.3.12.dist-info}/WHEEL +0 -0
- {waldiez-0.3.10.dist-info → waldiez-0.3.12.dist-info}/entry_points.txt +0 -0
- {waldiez-0.3.10.dist-info → waldiez-0.3.12.dist-info}/licenses/LICENSE +0 -0
- {waldiez-0.3.10.dist-info → waldiez-0.3.12.dist-info}/licenses/NOTICE.md +0 -0
waldiez/models/flow/flow.py
CHANGED
|
@@ -126,6 +126,7 @@ class WaldiezFlow(WaldiezBase):
|
|
|
126
126
|
_ordered_flow: Optional[
|
|
127
127
|
List[Tuple[WaldiezChat, WaldiezAgent, WaldiezAgent]]
|
|
128
128
|
] = None
|
|
129
|
+
_single_agent_mode: bool = False
|
|
129
130
|
|
|
130
131
|
@property
|
|
131
132
|
def is_async(self) -> bool:
|
|
@@ -139,15 +140,15 @@ class WaldiezFlow(WaldiezBase):
|
|
|
139
140
|
return self.data.is_async
|
|
140
141
|
|
|
141
142
|
@property
|
|
142
|
-
def
|
|
143
|
-
"""Check if the flow has
|
|
143
|
+
def cache_seed(self) -> Optional[int]:
|
|
144
|
+
"""Check if the flow has caching disabled.
|
|
144
145
|
|
|
145
146
|
Returns
|
|
146
147
|
-------
|
|
147
148
|
bool
|
|
148
|
-
True if the flow has
|
|
149
|
+
True if the flow has caching disabled, False otherwise.
|
|
149
150
|
"""
|
|
150
|
-
return
|
|
151
|
+
return self.data.cache_seed
|
|
151
152
|
|
|
152
153
|
@property
|
|
153
154
|
def is_swarm_flow(self) -> bool:
|
|
@@ -162,6 +163,17 @@ class WaldiezFlow(WaldiezBase):
|
|
|
162
163
|
agent.agent_type == "swarm" for agent in self.data.agents.members
|
|
163
164
|
)
|
|
164
165
|
|
|
166
|
+
@property
|
|
167
|
+
def is_single_agent_mode(self) -> bool:
|
|
168
|
+
"""Check if the flow is in single agent mode.
|
|
169
|
+
|
|
170
|
+
Returns
|
|
171
|
+
-------
|
|
172
|
+
bool
|
|
173
|
+
True if the flow is in single agent mode, False otherwise.
|
|
174
|
+
"""
|
|
175
|
+
return self._single_agent_mode
|
|
176
|
+
|
|
165
177
|
@property
|
|
166
178
|
def ordered_flow(
|
|
167
179
|
self,
|
|
@@ -417,6 +429,7 @@ class WaldiezFlow(WaldiezBase):
|
|
|
417
429
|
|
|
418
430
|
- unique node ids
|
|
419
431
|
- there are at least two agents
|
|
432
|
+
- (or a single agent but not a group manager or a swarm agent)
|
|
420
433
|
- all the agents connect to at least one other agent
|
|
421
434
|
- all the linked agent skills are found in the flow
|
|
422
435
|
- all the linked agent models are found in the flow
|
|
@@ -440,14 +453,13 @@ class WaldiezFlow(WaldiezBase):
|
|
|
440
453
|
If the agents do not connect to any other node.
|
|
441
454
|
If the manager's group chat has no members.
|
|
442
455
|
"""
|
|
456
|
+
all_members = list(self.data.agents.members)
|
|
457
|
+
if len(all_members) == 1:
|
|
458
|
+
return self.validate_single_agent_mode(all_members[0])
|
|
443
459
|
if not self.ordered_flow:
|
|
444
460
|
raise ValueError("The ordered flow is empty.")
|
|
445
|
-
model_ids =
|
|
446
|
-
|
|
447
|
-
raise ValueError("Model IDs must be unique.")
|
|
448
|
-
skills_ids = [skill.id for skill in self.data.skills]
|
|
449
|
-
if len(skills_ids) != len(set(skills_ids)):
|
|
450
|
-
raise ValueError("Skill IDs must be unique.")
|
|
461
|
+
model_ids = self.validate_flow_models()
|
|
462
|
+
skills_ids = self.validate_flow_skills()
|
|
451
463
|
self.data.agents.validate_flow(model_ids, skills_ids)
|
|
452
464
|
self._validate_agent_connections()
|
|
453
465
|
if self.is_swarm_flow:
|
|
@@ -458,3 +470,69 @@ class WaldiezFlow(WaldiezBase):
|
|
|
458
470
|
all_chats=self.data.chats,
|
|
459
471
|
)
|
|
460
472
|
return self
|
|
473
|
+
|
|
474
|
+
def validate_flow_models(self) -> List[str]:
|
|
475
|
+
"""Validate the flow models.
|
|
476
|
+
|
|
477
|
+
Returns
|
|
478
|
+
-------
|
|
479
|
+
List[str]
|
|
480
|
+
The list of model IDs.
|
|
481
|
+
|
|
482
|
+
Raises
|
|
483
|
+
------
|
|
484
|
+
ValueError
|
|
485
|
+
If the model IDs are not unique.
|
|
486
|
+
"""
|
|
487
|
+
model_ids = [model.id for model in self.data.models]
|
|
488
|
+
if len(model_ids) != len(set(model_ids)):
|
|
489
|
+
raise ValueError("Model IDs must be unique.")
|
|
490
|
+
return model_ids
|
|
491
|
+
|
|
492
|
+
def validate_flow_skills(self) -> List[str]:
|
|
493
|
+
"""Validate the flow skills.
|
|
494
|
+
|
|
495
|
+
Returns
|
|
496
|
+
-------
|
|
497
|
+
List[str]
|
|
498
|
+
The list of skill IDs.
|
|
499
|
+
|
|
500
|
+
Raises
|
|
501
|
+
------
|
|
502
|
+
ValueError
|
|
503
|
+
If the skill IDs are not unique.
|
|
504
|
+
"""
|
|
505
|
+
skill_ids = [skill.id for skill in self.data.skills]
|
|
506
|
+
if len(skill_ids) != len(set(skill_ids)):
|
|
507
|
+
raise ValueError("Skill IDs must be unique.")
|
|
508
|
+
return skill_ids
|
|
509
|
+
|
|
510
|
+
def validate_single_agent_mode(self, member: WaldiezAgent) -> Self:
|
|
511
|
+
"""Flow validation for single agent mode.
|
|
512
|
+
|
|
513
|
+
Parameters
|
|
514
|
+
----------
|
|
515
|
+
member : WaldiezAgent
|
|
516
|
+
The only agent in the flow
|
|
517
|
+
Returns
|
|
518
|
+
-------
|
|
519
|
+
WaldiezFlow
|
|
520
|
+
The validated flow.
|
|
521
|
+
|
|
522
|
+
Raises
|
|
523
|
+
------
|
|
524
|
+
ValueError
|
|
525
|
+
- If the only agent is a group manager or a swarm agent.
|
|
526
|
+
- If the model IDs are not unique.
|
|
527
|
+
- If the skill IDs are not unique.
|
|
528
|
+
"""
|
|
529
|
+
if member.agent_type in ["manager", "swarm"]:
|
|
530
|
+
raise ValueError(
|
|
531
|
+
"In single agent mode, "
|
|
532
|
+
"the agent must not be a group manager or a swarm agent."
|
|
533
|
+
)
|
|
534
|
+
model_ids = self.validate_flow_models()
|
|
535
|
+
skills_ids = self.validate_flow_skills()
|
|
536
|
+
self.data.agents.validate_flow(model_ids, skills_ids)
|
|
537
|
+
self._single_agent_mode = True
|
|
538
|
+
return self
|
waldiez/models/flow/flow_data.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez flow data."""
|
|
4
4
|
|
|
5
|
-
from typing import Any, Dict, List
|
|
5
|
+
from typing import Any, Dict, List, Optional
|
|
6
6
|
|
|
7
7
|
from pydantic import Field, model_validator
|
|
8
8
|
from typing_extensions import Annotated, Self
|
|
@@ -40,6 +40,8 @@ class WaldiezFlowData(WaldiezBase):
|
|
|
40
40
|
The chats of the flow. See `WaldiezChat`.
|
|
41
41
|
is_async : bool
|
|
42
42
|
Whether the flow is asynchronous or not.
|
|
43
|
+
cache_seed : Optional[int]
|
|
44
|
+
The seed for the cache. If None, the seed is not set. Default is 41.
|
|
43
45
|
"""
|
|
44
46
|
|
|
45
47
|
# the ones below (nodes,edges, viewport) we ignore
|
|
@@ -109,6 +111,18 @@ class WaldiezFlowData(WaldiezBase):
|
|
|
109
111
|
title="Is Async",
|
|
110
112
|
),
|
|
111
113
|
]
|
|
114
|
+
cache_seed: Annotated[
|
|
115
|
+
Optional[int],
|
|
116
|
+
Field(
|
|
117
|
+
41,
|
|
118
|
+
alias="cacheSeed",
|
|
119
|
+
description=(
|
|
120
|
+
"The seed for the cache. If None, the seed is not set."
|
|
121
|
+
"Default is 41."
|
|
122
|
+
),
|
|
123
|
+
title="Cache Seed",
|
|
124
|
+
),
|
|
125
|
+
] = 41
|
|
112
126
|
|
|
113
127
|
@model_validator(mode="after")
|
|
114
128
|
def validate_flow_chats(self) -> Self:
|
waldiez/models/flow/utils.py
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import uuid
|
|
6
6
|
from datetime import datetime, timezone
|
|
7
|
-
from typing import List
|
|
7
|
+
from typing import Any, Dict, List, Optional
|
|
8
8
|
|
|
9
9
|
from ..agents import (
|
|
10
10
|
WaldiezAgent,
|
|
@@ -170,3 +170,63 @@ def merge_nested_chat_messages(
|
|
|
170
170
|
chat_ids_added.append(chat.id)
|
|
171
171
|
nested_chat.messages.sort(key=lambda x: chat_ids_added.index(x.id))
|
|
172
172
|
return [nested_chat]
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def get_flow_data(
|
|
176
|
+
data: Dict[str, Any],
|
|
177
|
+
flow_id: Optional[str] = None,
|
|
178
|
+
name: Optional[str] = None,
|
|
179
|
+
description: Optional[str] = None,
|
|
180
|
+
tags: Optional[List[str]] = None,
|
|
181
|
+
requirements: Optional[List[str]] = None,
|
|
182
|
+
) -> Dict[str, Any]:
|
|
183
|
+
"""Get the flow from the passed data dict.
|
|
184
|
+
|
|
185
|
+
Parameters
|
|
186
|
+
----------
|
|
187
|
+
data : Dict[str, Any]
|
|
188
|
+
The data dict.
|
|
189
|
+
flow_id : Optional[str], optional
|
|
190
|
+
The flow ID, by default None.
|
|
191
|
+
name : Optional[str], optional
|
|
192
|
+
The flow name, by default None.
|
|
193
|
+
description : Optional[str], optional
|
|
194
|
+
The flow description, by default None.
|
|
195
|
+
tags : Optional[List[str]], optional
|
|
196
|
+
The flow tags, by default None.
|
|
197
|
+
requirements : Optional[List[str]], optional
|
|
198
|
+
The flow requirements, by default None.
|
|
199
|
+
|
|
200
|
+
Returns
|
|
201
|
+
-------
|
|
202
|
+
Dict[str, Any]
|
|
203
|
+
The flow data.
|
|
204
|
+
|
|
205
|
+
Raises
|
|
206
|
+
------
|
|
207
|
+
ValueError
|
|
208
|
+
If the flow type is not "flow".
|
|
209
|
+
"""
|
|
210
|
+
item_type = data.get("type", "flow")
|
|
211
|
+
if item_type != "flow":
|
|
212
|
+
# empty flow (from exported model/skill ?)
|
|
213
|
+
raise ValueError(f"Invalid flow type: {item_type}")
|
|
214
|
+
from_args = {
|
|
215
|
+
"id": flow_id,
|
|
216
|
+
"name": name,
|
|
217
|
+
"description": description,
|
|
218
|
+
"tags": tags,
|
|
219
|
+
"requirements": requirements,
|
|
220
|
+
}
|
|
221
|
+
for key, value in from_args.items():
|
|
222
|
+
if value:
|
|
223
|
+
data[key] = value
|
|
224
|
+
if "name" not in data:
|
|
225
|
+
data["name"] = "Waldiez Flow"
|
|
226
|
+
if "description" not in data:
|
|
227
|
+
data["description"] = "Waldiez Flow description"
|
|
228
|
+
if "tags" not in data:
|
|
229
|
+
data["tags"] = []
|
|
230
|
+
if "requirements" not in data:
|
|
231
|
+
data["requirements"] = []
|
|
232
|
+
return data
|
waldiez/models/model/__init__.py
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez model."""
|
|
4
4
|
|
|
5
|
+
from .extra_requirements import get_models_extra_requirements
|
|
5
6
|
from .model import DEFAULT_BASE_URLS, WaldiezModel
|
|
6
7
|
from .model_data import WaldiezModelAPIType, WaldiezModelData, WaldiezModelPrice
|
|
7
8
|
|
|
8
9
|
__all__ = [
|
|
10
|
+
"get_models_extra_requirements",
|
|
9
11
|
"DEFAULT_BASE_URLS",
|
|
10
12
|
"WaldiezModel",
|
|
11
13
|
"WaldiezModelData",
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0.
|
|
2
|
+
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
"""Waldiez model extra requirements."""
|
|
4
|
+
|
|
5
|
+
from typing import Iterator, Set
|
|
6
|
+
|
|
7
|
+
from .model import WaldiezModel
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_models_extra_requirements(
|
|
11
|
+
models: Iterator[WaldiezModel], autogen_version: str
|
|
12
|
+
) -> Set[str]:
|
|
13
|
+
"""Get the models extra requirements.
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
models : List[WaldiezModel]
|
|
18
|
+
The models.
|
|
19
|
+
autogen_version : str
|
|
20
|
+
The autogen version.
|
|
21
|
+
|
|
22
|
+
Returns
|
|
23
|
+
-------
|
|
24
|
+
List[str]
|
|
25
|
+
The models extra requirements.
|
|
26
|
+
"""
|
|
27
|
+
model_requirements: Set[str] = set()
|
|
28
|
+
# ref: https://github.com/ag2ai/ag2/blob/main/pyproject.toml
|
|
29
|
+
models_with_additional_requirements = [
|
|
30
|
+
"together",
|
|
31
|
+
"gemini",
|
|
32
|
+
"mistral",
|
|
33
|
+
"groq",
|
|
34
|
+
"anthropic",
|
|
35
|
+
"cohere",
|
|
36
|
+
"bedrock", # we might add this later
|
|
37
|
+
]
|
|
38
|
+
for model in models:
|
|
39
|
+
if model.data.api_type == "google":
|
|
40
|
+
model_requirements.add(f"pyautogen[gemini]=={autogen_version}")
|
|
41
|
+
continue
|
|
42
|
+
if model.data.api_type in models_with_additional_requirements:
|
|
43
|
+
model_requirements.add(
|
|
44
|
+
f"pyautogen[{model.data.api_type}]=={autogen_version}"
|
|
45
|
+
)
|
|
46
|
+
return model_requirements
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# for bedrock, there are some additional params needed
|
|
50
|
+
# (both here and on the ui part):
|
|
51
|
+
# aws_region (mandatory)
|
|
52
|
+
# aws_access_key (or environment variable: AWS_ACCESS_KEY)
|
|
53
|
+
# aws_secret_key (or environment variable: AWS_SECRET_KEY)
|
|
54
|
+
# aws_session_token (or environment variable: AWS_SESSION_TOKEN)
|
|
55
|
+
# aws_profile_name
|
waldiez/models/model/model.py
CHANGED
|
@@ -19,6 +19,7 @@ DEFAULT_BASE_URLS: Dict[WaldiezModelAPIType, str] = {
|
|
|
19
19
|
"groq": "https://api.groq.com/openai/v1",
|
|
20
20
|
"together": "https://api.together.xyz/v1",
|
|
21
21
|
"nim": "https://integrate.api.nvidia.com/v1",
|
|
22
|
+
"cohere": "https://api.cohere.com",
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
|
|
@@ -63,7 +64,7 @@ class WaldiezModel(WaldiezBase):
|
|
|
63
64
|
description: Annotated[
|
|
64
65
|
str,
|
|
65
66
|
Field(
|
|
66
|
-
|
|
67
|
+
"Model's Description",
|
|
67
68
|
title="Description",
|
|
68
69
|
description="The description of the model.",
|
|
69
70
|
),
|
|
@@ -118,6 +119,7 @@ class WaldiezModel(WaldiezBase):
|
|
|
118
119
|
- groq: 'GROQ_API_KEY',
|
|
119
120
|
- together: 'TOGETHER_API_KEY',
|
|
120
121
|
- nim: 'NIM_API_KEY',
|
|
122
|
+
- cohere: 'COHERE_API_KEY',
|
|
121
123
|
- other: 'OPENAI_API_KEY'
|
|
122
124
|
"""
|
|
123
125
|
env_key = "OPENAI_API_KEY"
|
|
@@ -142,14 +144,18 @@ class WaldiezModel(WaldiezBase):
|
|
|
142
144
|
- groq: 'GROQ_API_KEY',
|
|
143
145
|
- together: 'TOGETHER_API_KEY',
|
|
144
146
|
- nim: 'NIM_API_KEY',
|
|
147
|
+
- cohere: 'COHERE_API_KEY',
|
|
145
148
|
- other: 'OPENAI_API_KEY'
|
|
146
149
|
"""
|
|
147
150
|
if self.data.api_key and self.data.api_key != "REPLACE_ME":
|
|
151
|
+
os.environ[self.api_key_env_key] = self.data.api_key
|
|
148
152
|
return self.data.api_key
|
|
149
153
|
env_key = self.api_key_env_key
|
|
150
154
|
api_key = os.environ.get(
|
|
151
155
|
env_key, getattr(self.data, "api_key", "REPLACE_ME")
|
|
152
156
|
)
|
|
157
|
+
if api_key and api_key != "REPLACE_ME":
|
|
158
|
+
os.environ[env_key] = api_key
|
|
153
159
|
return api_key or "REPLACE_ME"
|
|
154
160
|
|
|
155
161
|
@property
|
|
@@ -219,7 +225,7 @@ def set_default_base_url(
|
|
|
219
225
|
Dict[str, Any]
|
|
220
226
|
The llm config dictionary with the default base url set.
|
|
221
227
|
"""
|
|
222
|
-
if api_type in ("openai", "other", "azure"):
|
|
228
|
+
if api_type in ("openai", "other", "azure", "cohere"):
|
|
223
229
|
return llm_config
|
|
224
230
|
if "base_url" not in llm_config or not llm_config["base_url"]:
|
|
225
231
|
dict_copy = llm_config.copy()
|
|
@@ -20,6 +20,7 @@ WaldiezModelAPIType = Literal[
|
|
|
20
20
|
"groq",
|
|
21
21
|
"together",
|
|
22
22
|
"nim",
|
|
23
|
+
"cohere",
|
|
23
24
|
"other",
|
|
24
25
|
]
|
|
25
26
|
|
|
@@ -53,7 +54,7 @@ class WaldiezModelData(WaldiezBase):
|
|
|
53
54
|
The base url of the model, by default None.
|
|
54
55
|
api_key : Optional[str]
|
|
55
56
|
The api key to use with the model, by default None.
|
|
56
|
-
api_type :
|
|
57
|
+
api_type : WaldiezModelAPIType
|
|
57
58
|
The api type of the model.
|
|
58
59
|
api_version : Optional[str]
|
|
59
60
|
The api version of the model, by default None.
|
waldiez/models/waldiez.py
CHANGED
|
@@ -8,16 +8,18 @@ definitions and their optional additional skills to be used.
|
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
import json
|
|
11
|
-
import warnings
|
|
12
11
|
from dataclasses import dataclass
|
|
13
|
-
from functools import cache
|
|
14
12
|
from pathlib import Path
|
|
15
13
|
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
|
16
14
|
|
|
17
|
-
from .agents import
|
|
15
|
+
from .agents import (
|
|
16
|
+
WaldiezAgent,
|
|
17
|
+
get_retrievechat_extra_requirements,
|
|
18
|
+
)
|
|
18
19
|
from .chat import WaldiezChat
|
|
19
|
-
from .
|
|
20
|
-
from .
|
|
20
|
+
from .common import get_autogen_version
|
|
21
|
+
from .flow import WaldiezFlow, get_flow_data
|
|
22
|
+
from .model import WaldiezModel, get_models_extra_requirements
|
|
21
23
|
from .skill import WaldiezSkill
|
|
22
24
|
|
|
23
25
|
|
|
@@ -62,7 +64,7 @@ class Waldiez:
|
|
|
62
64
|
Waldiez
|
|
63
65
|
The Waldiez.
|
|
64
66
|
"""
|
|
65
|
-
flow =
|
|
67
|
+
flow = get_flow_data(
|
|
66
68
|
data,
|
|
67
69
|
flow_id=flow_id,
|
|
68
70
|
name=name,
|
|
@@ -211,11 +213,22 @@ class Waldiez:
|
|
|
211
213
|
"""Check if the flow is asynchronous."""
|
|
212
214
|
return self.flow.is_async
|
|
213
215
|
|
|
216
|
+
@property
|
|
217
|
+
def cache_seed(self) -> Optional[int]:
|
|
218
|
+
"""Get the cache seed."""
|
|
219
|
+
return self.flow.cache_seed
|
|
220
|
+
|
|
221
|
+
@property
|
|
222
|
+
def is_single_agent_mode(self) -> bool:
|
|
223
|
+
"""Check if the flow is single agent mode."""
|
|
224
|
+
return self.flow.is_single_agent_mode
|
|
225
|
+
|
|
214
226
|
@property
|
|
215
227
|
def requirements(self) -> List[str]:
|
|
216
228
|
"""Get the flow requirements."""
|
|
217
|
-
autogen_version =
|
|
229
|
+
autogen_version = get_autogen_version()
|
|
218
230
|
requirements_list = filter(
|
|
231
|
+
# we use the fixed "pyautogen=={autogen_version}" below
|
|
219
232
|
lambda requirement: not (
|
|
220
233
|
requirement.startswith("pyautogen")
|
|
221
234
|
or requirement.startswith("ag2")
|
|
@@ -224,30 +237,15 @@ class Waldiez:
|
|
|
224
237
|
self.flow.requirements,
|
|
225
238
|
)
|
|
226
239
|
requirements = set(requirements_list)
|
|
240
|
+
requirements.add(f"pyautogen=={autogen_version}")
|
|
227
241
|
if self.has_rag_agents:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
requirements.add(f"pyautogen=={autogen_version}")
|
|
242
|
+
rag_extras = get_retrievechat_extra_requirements(self.agents)
|
|
243
|
+
requirements.update(rag_extras)
|
|
231
244
|
if self.has_multimodal_agents:
|
|
232
245
|
requirements.add(f"pyautogen[lmm]=={autogen_version}")
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
"gemini",
|
|
237
|
-
"mistral",
|
|
238
|
-
"groq",
|
|
239
|
-
"anthropic",
|
|
240
|
-
"cohere",
|
|
241
|
-
"bedrock",
|
|
242
|
-
]
|
|
243
|
-
for model in self.models:
|
|
244
|
-
if model.data.api_type == "google":
|
|
245
|
-
requirements.add(f"pyautogen[gemini]=={autogen_version}")
|
|
246
|
-
continue
|
|
247
|
-
if model.data.api_type in models_with_additional_requirements:
|
|
248
|
-
requirements.add(
|
|
249
|
-
f"pyautogen[{model.data.api_type}]=={autogen_version}"
|
|
250
|
-
)
|
|
246
|
+
requirements.update(
|
|
247
|
+
get_models_extra_requirements(self.models, autogen_version)
|
|
248
|
+
)
|
|
251
249
|
return sorted(list(requirements))
|
|
252
250
|
|
|
253
251
|
def get_flow_env_vars(self) -> List[Tuple[str, str]]:
|
|
@@ -297,50 +295,3 @@ class Waldiez:
|
|
|
297
295
|
The swarm agents and the user agent.
|
|
298
296
|
"""
|
|
299
297
|
return self.flow.get_swarm_chat_members(initial_agent)
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
def _get_flow(
|
|
303
|
-
data: Dict[str, Any],
|
|
304
|
-
flow_id: Optional[str] = None,
|
|
305
|
-
name: Optional[str] = None,
|
|
306
|
-
description: Optional[str] = None,
|
|
307
|
-
tags: Optional[List[str]] = None,
|
|
308
|
-
requirements: Optional[List[str]] = None,
|
|
309
|
-
) -> Dict[str, Any]:
|
|
310
|
-
"""Get the flow."""
|
|
311
|
-
item_type = data.get("type", "flow")
|
|
312
|
-
if item_type != "flow":
|
|
313
|
-
# empty flow (from exported model/skill ?)
|
|
314
|
-
raise ValueError(f"Invalid flow type: {item_type}")
|
|
315
|
-
from_args = {
|
|
316
|
-
"id": flow_id,
|
|
317
|
-
"name": name,
|
|
318
|
-
"description": description,
|
|
319
|
-
"tags": tags,
|
|
320
|
-
"requirements": requirements,
|
|
321
|
-
}
|
|
322
|
-
for key, value in from_args.items():
|
|
323
|
-
if value:
|
|
324
|
-
data[key] = value
|
|
325
|
-
if "name" not in data:
|
|
326
|
-
data["name"] = "Waldiez Flow"
|
|
327
|
-
if "description" not in data:
|
|
328
|
-
data["description"] = "Waldiez Flow description"
|
|
329
|
-
if "tags" not in data:
|
|
330
|
-
data["tags"] = []
|
|
331
|
-
if "requirements" not in data:
|
|
332
|
-
data["requirements"] = []
|
|
333
|
-
return data
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
@cache
|
|
337
|
-
def _get_autogen_version() -> str:
|
|
338
|
-
"""Get the autogen version."""
|
|
339
|
-
# pylint: disable=import-outside-toplevel
|
|
340
|
-
with warnings.catch_warnings():
|
|
341
|
-
warnings.simplefilter("ignore")
|
|
342
|
-
try:
|
|
343
|
-
from autogen.version import __version__ as ag2 # type: ignore
|
|
344
|
-
except ImportError as error: # pragma: no cover
|
|
345
|
-
raise ValueError("pyautogen is not installed.") from error
|
|
346
|
-
return ag2
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: waldiez
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.12
|
|
4
4
|
Summary: waldiez
|
|
5
5
|
Project-URL: homepage, https://waldiez.github.io/waldiez/python
|
|
6
6
|
Project-URL: repository, https://github.com/waldiez/python.git
|
|
@@ -20,38 +20,47 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
20
20
|
Requires-Python: <3.13,>=3.10
|
|
21
21
|
Requires-Dist: aiocsv==1.3.2
|
|
22
22
|
Requires-Dist: aiofiles==24.1.0
|
|
23
|
-
Requires-Dist: aiosqlite==0.
|
|
23
|
+
Requires-Dist: aiosqlite==0.21.0
|
|
24
24
|
Requires-Dist: asyncer==0.0.8
|
|
25
25
|
Requires-Dist: graphviz==0.20.3
|
|
26
26
|
Requires-Dist: httpx<1
|
|
27
27
|
Requires-Dist: jupytext
|
|
28
28
|
Requires-Dist: pandas>=2
|
|
29
29
|
Requires-Dist: parso==0.8.4
|
|
30
|
-
Requires-Dist: pyautogen==0.7.
|
|
30
|
+
Requires-Dist: pyautogen==0.7.3
|
|
31
31
|
Requires-Dist: pydantic<3,>=2.6.1
|
|
32
32
|
Requires-Dist: typer<0.16,>=0.9
|
|
33
33
|
Provides-Extra: ag2-extras
|
|
34
|
-
Requires-Dist:
|
|
35
|
-
Requires-Dist: chromadb;
|
|
36
|
-
Requires-Dist:
|
|
34
|
+
Requires-Dist: beautifulsoup4; extra == 'ag2-extras'
|
|
35
|
+
Requires-Dist: chromadb>=0.5.23; extra == 'ag2-extras'
|
|
36
|
+
Requires-Dist: crewai-tools==0.33.0; extra == 'ag2-extras'
|
|
37
|
+
Requires-Dist: crewai>0.98.0; extra == 'ag2-extras'
|
|
38
|
+
Requires-Dist: embedchain==0.1.126; extra == 'ag2-extras'
|
|
39
|
+
Requires-Dist: huggingface-hub; extra == 'ag2-extras'
|
|
40
|
+
Requires-Dist: ipython; extra == 'ag2-extras'
|
|
41
|
+
Requires-Dist: langchain-community<1,>=0.3.12; extra == 'ag2-extras'
|
|
42
|
+
Requires-Dist: markdownify; extra == 'ag2-extras'
|
|
37
43
|
Requires-Dist: pgvector>=0.3.6; extra == 'ag2-extras'
|
|
44
|
+
Requires-Dist: protobuf>=4.25.3; extra == 'ag2-extras'
|
|
38
45
|
Requires-Dist: psycopg[binary]>=3.2.3; extra == 'ag2-extras'
|
|
39
|
-
Requires-Dist:
|
|
40
|
-
Requires-Dist: pyautogen[
|
|
41
|
-
Requires-Dist: pyautogen[
|
|
42
|
-
Requires-Dist: pyautogen[
|
|
43
|
-
Requires-Dist: pyautogen[
|
|
44
|
-
Requires-Dist: pyautogen[
|
|
45
|
-
Requires-Dist: pyautogen[
|
|
46
|
-
Requires-Dist: pyautogen[
|
|
47
|
-
Requires-Dist: pyautogen[
|
|
48
|
-
Requires-Dist: pyautogen[
|
|
49
|
-
Requires-Dist: pyautogen[
|
|
50
|
-
Requires-Dist: pyautogen[
|
|
51
|
-
Requires-Dist:
|
|
52
|
-
Requires-Dist: pymongo>=4.
|
|
53
|
-
Requires-Dist:
|
|
54
|
-
Requires-Dist:
|
|
46
|
+
Requires-Dist: psycopg[binary]>=3.2.4; extra == 'ag2-extras'
|
|
47
|
+
Requires-Dist: pyautogen[anthropic]==0.7.3; extra == 'ag2-extras'
|
|
48
|
+
Requires-Dist: pyautogen[bedrock]==0.7.3; extra == 'ag2-extras'
|
|
49
|
+
Requires-Dist: pyautogen[cohere]==0.7.3; extra == 'ag2-extras'
|
|
50
|
+
Requires-Dist: pyautogen[gemini]==0.7.3; extra == 'ag2-extras'
|
|
51
|
+
Requires-Dist: pyautogen[groq]==0.7.3; extra == 'ag2-extras'
|
|
52
|
+
Requires-Dist: pyautogen[lmm]==0.7.3; extra == 'ag2-extras'
|
|
53
|
+
Requires-Dist: pyautogen[mistral]==0.7.3; extra == 'ag2-extras'
|
|
54
|
+
Requires-Dist: pyautogen[neo4j]==0.7.3; extra == 'ag2-extras'
|
|
55
|
+
Requires-Dist: pyautogen[ollama]==0.7.3; extra == 'ag2-extras'
|
|
56
|
+
Requires-Dist: pyautogen[together]==0.7.3; extra == 'ag2-extras'
|
|
57
|
+
Requires-Dist: pyautogen[websurfer]==0.7.3; extra == 'ag2-extras'
|
|
58
|
+
Requires-Dist: pydantic-ai==0.0.21; extra == 'ag2-extras'
|
|
59
|
+
Requires-Dist: pymongo>=4.11; extra == 'ag2-extras'
|
|
60
|
+
Requires-Dist: pypdf; extra == 'ag2-extras'
|
|
61
|
+
Requires-Dist: qdrant-client[fastembed]; extra == 'ag2-extras'
|
|
62
|
+
Requires-Dist: sentence-transformers; extra == 'ag2-extras'
|
|
63
|
+
Requires-Dist: weaviate-client==4.10.2; extra == 'ag2-extras'
|
|
55
64
|
Provides-Extra: dev
|
|
56
65
|
Requires-Dist: autoflake==2.3.1; extra == 'dev'
|
|
57
66
|
Requires-Dist: bandit==1.8.2; extra == 'dev'
|
|
@@ -64,7 +73,7 @@ Requires-Dist: pre-commit==4.1.0; extra == 'dev'
|
|
|
64
73
|
Requires-Dist: pydocstyle==6.3.0; extra == 'dev'
|
|
65
74
|
Requires-Dist: pylint==3.3.4; extra == 'dev'
|
|
66
75
|
Requires-Dist: python-dotenv==1.0.1; extra == 'dev'
|
|
67
|
-
Requires-Dist: ruff==0.9.
|
|
76
|
+
Requires-Dist: ruff==0.9.4; extra == 'dev'
|
|
68
77
|
Requires-Dist: toml; (python_version <= '3.10') and extra == 'dev'
|
|
69
78
|
Requires-Dist: types-pyyaml==6.0.12.20241230; extra == 'dev'
|
|
70
79
|
Requires-Dist: types-toml==0.10.8.20240310; extra == 'dev'
|
|
@@ -74,16 +83,16 @@ Requires-Dist: mdx-include==1.4.2; extra == 'docs'
|
|
|
74
83
|
Requires-Dist: mdx-truly-sane-lists==1.3; extra == 'docs'
|
|
75
84
|
Requires-Dist: mkdocs-jupyter==0.25.1; extra == 'docs'
|
|
76
85
|
Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == 'docs'
|
|
77
|
-
Requires-Dist: mkdocs-material==9.
|
|
78
|
-
Requires-Dist: mkdocs-minify-html-plugin==0.2.
|
|
86
|
+
Requires-Dist: mkdocs-material==9.6.2; extra == 'docs'
|
|
87
|
+
Requires-Dist: mkdocs-minify-html-plugin==0.2.4; extra == 'docs'
|
|
79
88
|
Requires-Dist: mkdocs==1.6.1; extra == 'docs'
|
|
80
|
-
Requires-Dist: mkdocstrings-python==1.
|
|
81
|
-
Requires-Dist: mkdocstrings[crystal,python]==0.
|
|
89
|
+
Requires-Dist: mkdocstrings-python==1.14.1; extra == 'docs'
|
|
90
|
+
Requires-Dist: mkdocstrings[crystal,python]==0.28.0; extra == 'docs'
|
|
82
91
|
Provides-Extra: jupyter
|
|
83
92
|
Requires-Dist: jupyterlab>=4.3.0; extra == 'jupyter'
|
|
84
|
-
Requires-Dist: waldiez-jupyter==0.3.
|
|
93
|
+
Requires-Dist: waldiez-jupyter==0.3.12; extra == 'jupyter'
|
|
85
94
|
Provides-Extra: studio
|
|
86
|
-
Requires-Dist: waldiez-studio==0.3.
|
|
95
|
+
Requires-Dist: waldiez-studio==0.3.12; extra == 'studio'
|
|
87
96
|
Provides-Extra: test
|
|
88
97
|
Requires-Dist: pytest-asyncio==0.25.3; extra == 'test'
|
|
89
98
|
Requires-Dist: pytest-cov==6.0.0; extra == 'test'
|