waldiez 0.1.8__tar.gz → 0.1.10__tar.gz
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-0.1.8 → waldiez-0.1.10}/PKG-INFO +5 -4
- {waldiez-0.1.8 → waldiez-0.1.10}/README.md +1 -1
- {waldiez-0.1.8 → waldiez-0.1.10}/pyproject.toml +4 -4
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/_version.py +1 -1
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/agent.py +7 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/rag_user/chroma_utils.py +9 -7
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/rag_user/rag_user.py +9 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/utils/path_check.py +8 -5
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/agent/agent_data.py +11 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/waldiez.py +7 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/runner.py +31 -6
- {waldiez-0.1.8 → waldiez-0.1.10}/.gitignore +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/LICENSE +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/__main__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/cli.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporter.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/agent_skills.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/code_execution.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/group_manager.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/llm_config.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/rag_user/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/rag_user/mongo_utils.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/rag_user/pgvector_utils.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/rag_user/qdrant_utils.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/rag_user/vector_db.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/teachability.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/agents/termination_message.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/chats/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/chats/chats.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/chats/helpers.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/chats/nested.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/flow/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/flow/def_main.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/flow/flow.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/models/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/skills/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/utils/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/utils/comments.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/utils/importing.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/utils/logging_utils.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/utils/method_utils.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/utils/naming.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/exporting/utils/object_string.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/io/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/agent/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/agent/agent.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/agent/code_execution.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/agent/linked_skill.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/agent/nested_chat.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/agent/teachability.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/agent/termination_message.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/agents.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/assistant/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/assistant/assistant.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/assistant/assistant_data.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/group_manager/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/group_manager/group_manager.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/group_manager/group_manager_data.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/group_manager/speakers.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/rag_user/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/rag_user/rag_user.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/rag_user/rag_user_data.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/rag_user/retrieve_config.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/rag_user/vector_db_config.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/user_proxy/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/user_proxy/user_proxy.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/agents/user_proxy/user_proxy_data.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/chat/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/chat/chat.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/chat/chat_data.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/chat/chat_message.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/chat/chat_nested.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/chat/chat_summary.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/common/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/common/base.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/common/method_utils.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/flow/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/flow/flow.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/flow/flow_data.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/model/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/model/model.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/model/model_data.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/skill/__init__.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/skill/skill.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/models/skill/skill_data.py +0 -0
- {waldiez-0.1.8 → waldiez-0.1.10}/waldiez/py.typed +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: waldiez
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.10
|
|
4
4
|
Summary: waldiez
|
|
5
5
|
Project-URL: homepage, https://waldiez.github.io/waldiez/
|
|
6
6
|
Project-URL: repository, https://github.com/waldiez/waldiez.git
|
|
7
|
-
Author-email: Panagiotis Kasnesis <pkasnesis@thingenious.io>, Lazaros Toumanidis <laztoum@protonmail.com>
|
|
7
|
+
Author-email: Panagiotis Kasnesis <pkasnesis@thingenious.io>, Lazaros Toumanidis <laztoum@protonmail.com>, Stella Ioannidou <stella@humancentered.gr>
|
|
8
8
|
Classifier: Development Status :: 3 - Alpha
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
10
10
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -23,6 +23,7 @@ Requires-Dist: ag2[anthropic]==0.3.2; extra == 'ag2-extras'
|
|
|
23
23
|
Requires-Dist: ag2[bedrock]==0.3.2; extra == 'ag2-extras'
|
|
24
24
|
Requires-Dist: ag2[gemini]==0.3.2; extra == 'ag2-extras'
|
|
25
25
|
Requires-Dist: ag2[groq]==0.3.2; extra == 'ag2-extras'
|
|
26
|
+
Requires-Dist: ag2[lmm]==0.3.2; extra == 'ag2-extras'
|
|
26
27
|
Requires-Dist: ag2[mistral]==0.3.2; extra == 'ag2-extras'
|
|
27
28
|
Requires-Dist: ag2[retrievechat-mongodb]==0.3.2; extra == 'ag2-extras'
|
|
28
29
|
Requires-Dist: ag2[retrievechat-pgvector]==0.3.2; extra == 'ag2-extras'
|
|
@@ -55,7 +56,7 @@ Requires-Dist: mdx-include==1.4.2; extra == 'docs'
|
|
|
55
56
|
Requires-Dist: mdx-truly-sane-lists==1.3; extra == 'docs'
|
|
56
57
|
Requires-Dist: mkdocs-jupyter==0.25.1; extra == 'docs'
|
|
57
58
|
Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == 'docs'
|
|
58
|
-
Requires-Dist: mkdocs-material==9.5.
|
|
59
|
+
Requires-Dist: mkdocs-material==9.5.45; extra == 'docs'
|
|
59
60
|
Requires-Dist: mkdocs-minify-html-plugin==0.2.3; extra == 'docs'
|
|
60
61
|
Requires-Dist: mkdocs==1.6.1; extra == 'docs'
|
|
61
62
|
Requires-Dist: mkdocstrings-python==1.12.2; extra == 'docs'
|
|
@@ -71,7 +72,7 @@ Description-Content-Type: text/markdown
|
|
|
71
72
|
|
|
72
73
|
# Waldiez
|
|
73
74
|
|
|
74
|
-
 [](https://coveralls.io/github/waldiez/waldiez) [ [](https://coveralls.io/github/waldiez/waldiez) [](https://badge.fury.io/py/waldiez)
|
|
75
76
|
|
|
76
77
|
Translate a Waldiez flow:
|
|
77
78
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Waldiez
|
|
2
2
|
|
|
3
|
-
 [](https://coveralls.io/github/waldiez/waldiez) [ [](https://coveralls.io/github/waldiez/waldiez) [](https://badge.fury.io/py/waldiez)
|
|
4
4
|
|
|
5
5
|
Translate a Waldiez flow:
|
|
6
6
|
|
|
@@ -4,6 +4,7 @@ description = 'waldiez'
|
|
|
4
4
|
authors = [
|
|
5
5
|
{ name = 'Panagiotis Kasnesis', email = 'pkasnesis@thingenious.io' },
|
|
6
6
|
{ name= 'Lazaros Toumanidis', email= 'laztoum@protonmail.com' },
|
|
7
|
+
{ name = 'Stella Ioannidou', email = 'stella@humancentered.gr'}
|
|
7
8
|
]
|
|
8
9
|
readme = "README.md"
|
|
9
10
|
requires-python = '>=3.10,<3.13'
|
|
@@ -65,6 +66,7 @@ ag2_extras =[
|
|
|
65
66
|
'ag2[gemini]==0.3.2',
|
|
66
67
|
'ag2[together]==0.3.2',
|
|
67
68
|
'ag2[anthropic]==0.3.2',
|
|
69
|
+
'ag2[lmm]==0.3.2',
|
|
68
70
|
'ag2[mistral]==0.3.2',
|
|
69
71
|
'ag2[groq]==0.3.2',
|
|
70
72
|
'ag2[bedrock]==0.3.2',
|
|
@@ -87,7 +89,7 @@ docs = [
|
|
|
87
89
|
'mkdocs==1.6.1',
|
|
88
90
|
'mkdocs-jupyter==0.25.1',
|
|
89
91
|
'mkdocs-macros-plugin==1.3.7',
|
|
90
|
-
'mkdocs-material==9.5.
|
|
92
|
+
'mkdocs-material==9.5.45',
|
|
91
93
|
'mkdocs-minify-html-plugin==0.2.3',
|
|
92
94
|
'mkdocstrings[crystal,python]==0.27.0',
|
|
93
95
|
'mkdocstrings-python==1.12.2'
|
|
@@ -146,8 +148,6 @@ warn_unused_ignores = true
|
|
|
146
148
|
plugins = [
|
|
147
149
|
'pydantic.mypy'
|
|
148
150
|
]
|
|
149
|
-
# 'mypy_zope:plugin'
|
|
150
|
-
# ]
|
|
151
151
|
exclude = [
|
|
152
152
|
'.venv',
|
|
153
153
|
'.local',
|
|
@@ -200,7 +200,7 @@ unsafe-load-any-extension="no"
|
|
|
200
200
|
|
|
201
201
|
[tool.pylint.messages_control]
|
|
202
202
|
enable=["c-extension-no-member"]
|
|
203
|
-
[tool.pylint.
|
|
203
|
+
[tool.pylint.format]
|
|
204
204
|
max-line-length=80
|
|
205
205
|
[tool.pylint.similarities]
|
|
206
206
|
ignore-imports="yes"
|
|
@@ -26,6 +26,8 @@ def get_agent_class_name(agent: WaldiezAgent) -> str:
|
|
|
26
26
|
str
|
|
27
27
|
The agent class name.
|
|
28
28
|
"""
|
|
29
|
+
if agent.data.is_multimodal:
|
|
30
|
+
return "MultimodalConversableAgent"
|
|
29
31
|
if agent.agent_type == "assistant":
|
|
30
32
|
return "AssistantAgent"
|
|
31
33
|
if agent.agent_type == "user":
|
|
@@ -63,6 +65,11 @@ def get_agent_imports(agent_class: str) -> Set[str]:
|
|
|
63
65
|
"from autogen.agentchat.contrib.retrieve_user_proxy_agent "
|
|
64
66
|
"import RetrieveUserProxyAgent"
|
|
65
67
|
)
|
|
68
|
+
elif agent_class == "MultimodalConversableAgent":
|
|
69
|
+
imports.add(
|
|
70
|
+
"from autogen.agentchat.contrib.multimodal_conversable_agent "
|
|
71
|
+
"import MultimodalConversableAgent"
|
|
72
|
+
)
|
|
66
73
|
return imports
|
|
67
74
|
|
|
68
75
|
|
|
@@ -32,9 +32,12 @@ def _get_chroma_client_string(agent: WaldiezRagUser) -> Tuple[str, str]:
|
|
|
32
32
|
# SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes
|
|
33
33
|
# in position 2-3: truncated \UXXXXXXXX escape
|
|
34
34
|
local_path = Path(agent.retrieve_config.db_config.local_storage_path)
|
|
35
|
-
client_str +=
|
|
35
|
+
client_str += (
|
|
36
|
+
f'PersistentClient(path=r"{local_path}", '
|
|
37
|
+
"settings=Settings(anonymized_telemetry=False))"
|
|
38
|
+
)
|
|
36
39
|
else:
|
|
37
|
-
client_str += "Client()"
|
|
40
|
+
client_str += "Client(Settings(anonymized_telemetry=False))"
|
|
38
41
|
return client_str, to_import
|
|
39
42
|
|
|
40
43
|
|
|
@@ -97,15 +100,15 @@ def get_chroma_db_args(
|
|
|
97
100
|
- The custom embedding function.
|
|
98
101
|
- Any additional content to be used before the `kwargs` string.
|
|
99
102
|
"""
|
|
100
|
-
client_str,
|
|
103
|
+
client_str, client_to_import = _get_chroma_client_string(agent)
|
|
101
104
|
embedding_function_arg, to_import_embedding, embedding_function_body = (
|
|
102
105
|
_get_chroma_embedding_function_string(agent, agent_name)
|
|
103
106
|
)
|
|
104
|
-
to_import = {
|
|
107
|
+
to_import = {client_to_import, "from chromadb.config import Settings"}
|
|
105
108
|
if to_import_embedding:
|
|
106
109
|
to_import.add(to_import_embedding)
|
|
107
110
|
kwarg_string = (
|
|
108
|
-
f" client={
|
|
111
|
+
f" client={agent_name}_client,\n"
|
|
109
112
|
f" embedding_function={embedding_function_arg},\n"
|
|
110
113
|
)
|
|
111
114
|
# The RAG example:
|
|
@@ -115,11 +118,10 @@ def get_chroma_db_args(
|
|
|
115
118
|
# https://github.com/microsoft/autogen/issues/3551#issuecomment-2366930994
|
|
116
119
|
# manually initializing the collection before running the flow,
|
|
117
120
|
# might be a workaround.
|
|
118
|
-
content_before = ""
|
|
121
|
+
content_before = f"{agent_name}_client = {client_str}\n"
|
|
119
122
|
collection_name = agent.retrieve_config.collection_name
|
|
120
123
|
get_or_create = agent.retrieve_config.get_or_create
|
|
121
124
|
if collection_name:
|
|
122
|
-
content_before = f"{agent_name}_client = {client_str}\n"
|
|
123
125
|
if get_or_create:
|
|
124
126
|
content_before += (
|
|
125
127
|
f"{agent_name}_client.get_or_create_collection("
|
|
@@ -69,6 +69,15 @@ def get_rag_user_retrieve_config_str(
|
|
|
69
69
|
args_content = "\n".join(before_vector_db)
|
|
70
70
|
# add the vector_db arg
|
|
71
71
|
args_content += f',\n "vector_db": {vector_db_arg},\n'
|
|
72
|
+
# we should not need to include the client, but let's do it
|
|
73
|
+
# to avoid later issues (with telemetry or other client settings)
|
|
74
|
+
# https://github.com/ag2ai/ag2/blob/main/autogen/agentchat/\
|
|
75
|
+
# contrib/retrieve_user_proxy_agent.py#L265-L266
|
|
76
|
+
if (
|
|
77
|
+
f"{agent_name}_client" in before_the_args
|
|
78
|
+
and agent.retrieve_config.vector_db == "chroma"
|
|
79
|
+
):
|
|
80
|
+
args_content += f' "client": {agent_name}_client,\n'
|
|
72
81
|
args_content += closing_arg
|
|
73
82
|
return before_the_args, args_content, imports
|
|
74
83
|
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
from pathlib import Path
|
|
5
|
+
from typing import Optional
|
|
5
6
|
|
|
6
7
|
# pylint: disable=broad-except
|
|
7
8
|
|
|
8
9
|
|
|
9
|
-
def
|
|
10
|
+
def _check_local_path(string: str) -> Optional[Path]:
|
|
10
11
|
"""Check if a string is a local path.
|
|
11
12
|
|
|
12
13
|
Parameters
|
|
@@ -21,9 +22,11 @@ def _is_local_path(string: str) -> bool:
|
|
|
21
22
|
"""
|
|
22
23
|
try:
|
|
23
24
|
path = Path(string).resolve()
|
|
24
|
-
return path.exists()
|
|
25
25
|
except Exception: # pragma: no cover
|
|
26
|
-
return
|
|
26
|
+
return None
|
|
27
|
+
if path.exists():
|
|
28
|
+
return path
|
|
29
|
+
return None
|
|
27
30
|
|
|
28
31
|
|
|
29
32
|
def get_path_string(string: str) -> str:
|
|
@@ -41,8 +44,8 @@ def get_path_string(string: str) -> str:
|
|
|
41
44
|
"""
|
|
42
45
|
# On windows, we get paths like "C:\path\to\file"
|
|
43
46
|
# if so, let's try to avoid invalid escape sequences
|
|
44
|
-
if not
|
|
47
|
+
if not _check_local_path(string):
|
|
45
48
|
return string
|
|
46
49
|
if os.name == "nt": # pragma: no cover
|
|
47
50
|
return f"r'{string}'"
|
|
48
|
-
return f"
|
|
51
|
+
return f"{Path(string).resolve()}"
|
|
@@ -40,6 +40,8 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
40
40
|
A list of skills (id and executor) to register.
|
|
41
41
|
nested_chats : List[WaldiezAgentNestedChat]
|
|
42
42
|
A list of nested chats (triggered_by, messages), to register.
|
|
43
|
+
is_multimodal: bool
|
|
44
|
+
A flag to indicate if the agent is multimodal.
|
|
43
45
|
"""
|
|
44
46
|
|
|
45
47
|
model_config = ConfigDict(
|
|
@@ -149,3 +151,12 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
149
151
|
alias="nestedChats",
|
|
150
152
|
),
|
|
151
153
|
]
|
|
154
|
+
is_multimodal: Annotated[
|
|
155
|
+
bool,
|
|
156
|
+
Field(
|
|
157
|
+
False,
|
|
158
|
+
title="Is multimodal",
|
|
159
|
+
description="A flag to indicate if the agent is multimodal.",
|
|
160
|
+
alias="isMultimodal",
|
|
161
|
+
),
|
|
162
|
+
] = False
|
|
@@ -145,6 +145,11 @@ class Waldiez:
|
|
|
145
145
|
"""Check if the flow has RAG agents."""
|
|
146
146
|
return any(agent.agent_type == "rag_user" for agent in self.agents)
|
|
147
147
|
|
|
148
|
+
@property
|
|
149
|
+
def has_multimodal_agents(self) -> bool:
|
|
150
|
+
"""Check if the flow has multimodal agents."""
|
|
151
|
+
return any(agent.data.is_multimodal for agent in self.agents)
|
|
152
|
+
|
|
148
153
|
@property
|
|
149
154
|
def chats(self) -> List[Tuple[WaldiezChat, WaldiezAgent, WaldiezAgent]]:
|
|
150
155
|
"""Get the chats."""
|
|
@@ -214,6 +219,8 @@ class Waldiez:
|
|
|
214
219
|
requirements.add(f"ag2[retrievechat]=={autogen_version}")
|
|
215
220
|
else:
|
|
216
221
|
requirements.add(f"ag2=={autogen_version}")
|
|
222
|
+
if self.has_multimodal_agents:
|
|
223
|
+
requirements.add(f"ag2[lmm]=={autogen_version}")
|
|
217
224
|
# ref: https://github.com/ag2ai/ag2/blob/main/setup.py
|
|
218
225
|
models_with_additional_requirements = [
|
|
219
226
|
"together",
|
|
@@ -235,10 +235,31 @@ class WaldiezRunner:
|
|
|
235
235
|
os.environ[var_key] = var_value
|
|
236
236
|
|
|
237
237
|
def _do_run(
|
|
238
|
-
self,
|
|
238
|
+
self,
|
|
239
|
+
output_path: Optional[Union[str, Path]],
|
|
240
|
+
uploads_root: Optional[Union[str, Path]],
|
|
239
241
|
) -> Union["ChatResult", List["ChatResult"]]:
|
|
240
|
-
"""Run the Waldiez workflow.
|
|
242
|
+
"""Run the Waldiez workflow.
|
|
243
|
+
|
|
244
|
+
Parameters
|
|
245
|
+
----------
|
|
246
|
+
output_path : Optional[Union[str, Path]]
|
|
247
|
+
The output path.
|
|
248
|
+
uploads_root : Optional[Union[str, Path]]
|
|
249
|
+
The runtime uploads root.
|
|
250
|
+
|
|
251
|
+
Returns
|
|
252
|
+
-------
|
|
253
|
+
Union[ChatResult, List[ChatResult]]
|
|
254
|
+
The result(s) of the chat(s).
|
|
255
|
+
"""
|
|
241
256
|
results: Union["ChatResult", List["ChatResult"]] = []
|
|
257
|
+
if not uploads_root:
|
|
258
|
+
uploads_root = Path(tempfile.mkdtemp())
|
|
259
|
+
else:
|
|
260
|
+
uploads_root = Path(uploads_root)
|
|
261
|
+
if not uploads_root.exists():
|
|
262
|
+
uploads_root.mkdir(parents=True)
|
|
242
263
|
temp_dir = Path(tempfile.mkdtemp())
|
|
243
264
|
file_name = "flow.py" if not output_path else Path(output_path).name
|
|
244
265
|
if file_name.endswith((".json", ".waldiez")):
|
|
@@ -270,6 +291,7 @@ class WaldiezRunner:
|
|
|
270
291
|
def _run(
|
|
271
292
|
self,
|
|
272
293
|
output_path: Optional[Union[str, Path]],
|
|
294
|
+
uploads_root: Optional[Union[str, Path]],
|
|
273
295
|
) -> Union["ChatResult", List["ChatResult"]]:
|
|
274
296
|
self._install_requirements()
|
|
275
297
|
token = self._stream.get()
|
|
@@ -278,13 +300,14 @@ class WaldiezRunner:
|
|
|
278
300
|
from .io import WaldiezIOStream
|
|
279
301
|
|
|
280
302
|
with WaldiezIOStream.set_default(token):
|
|
281
|
-
return self._do_run(output_path)
|
|
282
|
-
return self._do_run(output_path)
|
|
303
|
+
return self._do_run(output_path, uploads_root)
|
|
304
|
+
return self._do_run(output_path, uploads_root)
|
|
283
305
|
|
|
284
306
|
def run(
|
|
285
307
|
self,
|
|
286
308
|
stream: Optional["WaldiezIOStream"] = None,
|
|
287
309
|
output_path: Optional[Union[str, Path]] = None,
|
|
310
|
+
uploads_root: Optional[Union[str, Path]] = None,
|
|
288
311
|
) -> Union["ChatResult", List["ChatResult"]]:
|
|
289
312
|
"""Run the Waldiez workflow.
|
|
290
313
|
|
|
@@ -294,11 +317,13 @@ class WaldiezRunner:
|
|
|
294
317
|
The stream to use, by default None.
|
|
295
318
|
output_path : Optional[Union[str, Path]], optional
|
|
296
319
|
The output path, by default None.
|
|
320
|
+
uploads_root : Optional[Union[str, Path]], optional
|
|
321
|
+
The uploads root, to get user-uploaded files, by default None.
|
|
297
322
|
|
|
298
323
|
Returns
|
|
299
324
|
-------
|
|
300
325
|
Union[ChatResult, List[ChatResult]]
|
|
301
|
-
The result of the chat(s).
|
|
326
|
+
The result(s) of the chat(s).
|
|
302
327
|
|
|
303
328
|
Raises
|
|
304
329
|
------
|
|
@@ -311,7 +336,7 @@ class WaldiezRunner:
|
|
|
311
336
|
token = self._stream.set(stream)
|
|
312
337
|
file_path = output_path or self._file_path
|
|
313
338
|
try:
|
|
314
|
-
return self._run(file_path)
|
|
339
|
+
return self._run(file_path, uploads_root)
|
|
315
340
|
finally:
|
|
316
341
|
self._running = False
|
|
317
342
|
self._stream.reset(token)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|