ag2 0.7.5__tar.gz → 0.7.6b1__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 ag2 might be problematic. Click here for more details.
- {ag2-0.7.5/ag2.egg-info → ag2-0.7.6b1}/PKG-INFO +3 -1
- {ag2-0.7.5 → ag2-0.7.6b1/ag2.egg-info}/PKG-INFO +3 -1
- ag2-0.7.6b1/ag2.egg-info/requires.txt +145 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/pyproject.toml +59 -27
- {ag2-0.7.5 → ag2-0.7.6b1}/setup_ag2.py +2 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/test/test_import_utils.py +68 -39
- {ag2-0.7.5 → ag2-0.7.6b1}/test/test_logging.py +12 -5
- {ag2-0.7.5 → ag2-0.7.6b1}/test/test_retrieve_utils.py +2 -2
- ag2-0.7.5/ag2.egg-info/requires.txt +0 -139
- {ag2-0.7.5 → ag2-0.7.6b1}/LICENSE +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/NOTICE.md +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/README.md +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/ag2.egg-info/SOURCES.txt +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/ag2.egg-info/dependency_links.txt +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/ag2.egg-info/top_level.txt +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/setup.cfg +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/test/test_browser_utils.py +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/test/test_code_utils.py +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/test/test_conftest.py +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/test/test_graph_utils.py +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/test/test_import.py +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/test/test_notebook.py +0 -0
- {ag2-0.7.5 → ag2-0.7.6b1}/test/test_token_count.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ag2
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.6b1
|
|
4
4
|
Summary: Alias package for pyautogen
|
|
5
5
|
Home-page: https://github.com/ag2ai/ag2
|
|
6
6
|
Author: Chi Wang & Qingyun Wu
|
|
@@ -13,6 +13,8 @@ Classifier: Operating System :: OS Independent
|
|
|
13
13
|
Requires-Python: >=3.9,<3.14
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
Provides-Extra: flaml
|
|
16
|
+
Provides-Extra: openai
|
|
17
|
+
Provides-Extra: openai-realtime
|
|
16
18
|
Provides-Extra: jupyter-executor
|
|
17
19
|
Provides-Extra: retrievechat
|
|
18
20
|
Provides-Extra: retrievechat-pgvector
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ag2
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.6b1
|
|
4
4
|
Summary: Alias package for pyautogen
|
|
5
5
|
Home-page: https://github.com/ag2ai/ag2
|
|
6
6
|
Author: Chi Wang & Qingyun Wu
|
|
@@ -13,6 +13,8 @@ Classifier: Operating System :: OS Independent
|
|
|
13
13
|
Requires-Python: >=3.9,<3.14
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
Provides-Extra: flaml
|
|
16
|
+
Provides-Extra: openai
|
|
17
|
+
Provides-Extra: openai-realtime
|
|
16
18
|
Provides-Extra: jupyter-executor
|
|
17
19
|
Provides-Extra: retrievechat
|
|
18
20
|
Provides-Extra: retrievechat-pgvector
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
pyautogen==0.7.6b1
|
|
2
|
+
|
|
3
|
+
[anthropic]
|
|
4
|
+
pyautogen[anthropic]==0.7.6b1
|
|
5
|
+
|
|
6
|
+
[autobuild]
|
|
7
|
+
pyautogen[autobuild]==0.7.6b1
|
|
8
|
+
|
|
9
|
+
[bedrock]
|
|
10
|
+
pyautogen[bedrock]==0.7.6b1
|
|
11
|
+
|
|
12
|
+
[blendsearch]
|
|
13
|
+
pyautogen[blendsearch]==0.7.6b1
|
|
14
|
+
|
|
15
|
+
[browser-use]
|
|
16
|
+
pyautogen[browser-use]==0.7.6b1
|
|
17
|
+
|
|
18
|
+
[captainagent]
|
|
19
|
+
pyautogen[captainagent]==0.7.6b1
|
|
20
|
+
|
|
21
|
+
[cerebras]
|
|
22
|
+
pyautogen[cerebras]==0.7.6b1
|
|
23
|
+
|
|
24
|
+
[cohere]
|
|
25
|
+
pyautogen[cohere]==0.7.6b1
|
|
26
|
+
|
|
27
|
+
[commsagent-discord]
|
|
28
|
+
pyautogen[commsagent-discord]==0.7.6b1
|
|
29
|
+
|
|
30
|
+
[commsagent-slack]
|
|
31
|
+
pyautogen[commsagent-slack]==0.7.6b1
|
|
32
|
+
|
|
33
|
+
[commsagent-telegram]
|
|
34
|
+
pyautogen[commsagent-telegram]==0.7.6b1
|
|
35
|
+
|
|
36
|
+
[cosmosdb]
|
|
37
|
+
pyautogen[cosmosdb]==0.7.6b1
|
|
38
|
+
|
|
39
|
+
[crawl4ai]
|
|
40
|
+
pyautogen[crawl4ai]==0.7.6b1
|
|
41
|
+
|
|
42
|
+
[dev]
|
|
43
|
+
pyautogen[dev]==0.7.6b1
|
|
44
|
+
|
|
45
|
+
[docs]
|
|
46
|
+
pyautogen[docs]==0.7.6b1
|
|
47
|
+
|
|
48
|
+
[flaml]
|
|
49
|
+
pyautogen[flaml]==0.7.6b1
|
|
50
|
+
|
|
51
|
+
[gemini]
|
|
52
|
+
pyautogen[gemini]==0.7.6b1
|
|
53
|
+
|
|
54
|
+
[graph]
|
|
55
|
+
pyautogen[graph]==0.7.6b1
|
|
56
|
+
|
|
57
|
+
[graph-rag-falkor-db]
|
|
58
|
+
pyautogen[graph-rag-falkor-db]==0.7.6b1
|
|
59
|
+
|
|
60
|
+
[groq]
|
|
61
|
+
pyautogen[groq]==0.7.6b1
|
|
62
|
+
|
|
63
|
+
[interop]
|
|
64
|
+
pyautogen[interop]==0.7.6b1
|
|
65
|
+
|
|
66
|
+
[interop-crewai]
|
|
67
|
+
pyautogen[interop-crewai]==0.7.6b1
|
|
68
|
+
|
|
69
|
+
[interop-langchain]
|
|
70
|
+
pyautogen[interop-langchain]==0.7.6b1
|
|
71
|
+
|
|
72
|
+
[interop-pydantic-ai]
|
|
73
|
+
pyautogen[interop-pydantic-ai]==0.7.6b1
|
|
74
|
+
|
|
75
|
+
[jupyter-executor]
|
|
76
|
+
pyautogen[jupyter-executor]==0.7.6b1
|
|
77
|
+
|
|
78
|
+
[lint]
|
|
79
|
+
pyautogen[lint]==0.7.6b1
|
|
80
|
+
|
|
81
|
+
[lmm]
|
|
82
|
+
pyautogen[lmm]==0.7.6b1
|
|
83
|
+
|
|
84
|
+
[long-context]
|
|
85
|
+
pyautogen[long-context]==0.7.6b1
|
|
86
|
+
|
|
87
|
+
[mathchat]
|
|
88
|
+
pyautogen[mathchat]==0.7.6b1
|
|
89
|
+
|
|
90
|
+
[mistral]
|
|
91
|
+
pyautogen[mistral]==0.7.6b1
|
|
92
|
+
|
|
93
|
+
[neo4j]
|
|
94
|
+
pyautogen[neo4j]==0.7.6b1
|
|
95
|
+
|
|
96
|
+
[ollama]
|
|
97
|
+
pyautogen[ollama]==0.7.6b1
|
|
98
|
+
|
|
99
|
+
[openai]
|
|
100
|
+
pyautogen[openai]==0.7.6b1
|
|
101
|
+
|
|
102
|
+
[openai-realtime]
|
|
103
|
+
pyautogen[openai-realtime]==0.7.6b1
|
|
104
|
+
|
|
105
|
+
[rag]
|
|
106
|
+
pyautogen[rag]==0.7.6b1
|
|
107
|
+
|
|
108
|
+
[redis]
|
|
109
|
+
pyautogen[redis]==0.7.6b1
|
|
110
|
+
|
|
111
|
+
[retrievechat]
|
|
112
|
+
pyautogen[retrievechat]==0.7.6b1
|
|
113
|
+
|
|
114
|
+
[retrievechat-couchbase]
|
|
115
|
+
pyautogen[retrievechat-couchbase]==0.7.6b1
|
|
116
|
+
|
|
117
|
+
[retrievechat-mongodb]
|
|
118
|
+
pyautogen[retrievechat-mongodb]==0.7.6b1
|
|
119
|
+
|
|
120
|
+
[retrievechat-pgvector]
|
|
121
|
+
pyautogen[retrievechat-pgvector]==0.7.6b1
|
|
122
|
+
|
|
123
|
+
[retrievechat-qdrant]
|
|
124
|
+
pyautogen[retrievechat-qdrant]==0.7.6b1
|
|
125
|
+
|
|
126
|
+
[teachable]
|
|
127
|
+
pyautogen[teachable]==0.7.6b1
|
|
128
|
+
|
|
129
|
+
[test]
|
|
130
|
+
pyautogen[test]==0.7.6b1
|
|
131
|
+
|
|
132
|
+
[together]
|
|
133
|
+
pyautogen[together]==0.7.6b1
|
|
134
|
+
|
|
135
|
+
[twilio]
|
|
136
|
+
pyautogen[twilio]==0.7.6b1
|
|
137
|
+
|
|
138
|
+
[types]
|
|
139
|
+
pyautogen[types]==0.7.6b1
|
|
140
|
+
|
|
141
|
+
[websockets]
|
|
142
|
+
pyautogen[websockets]==0.7.6b1
|
|
143
|
+
|
|
144
|
+
[websurfer]
|
|
145
|
+
pyautogen[websurfer]==0.7.6b1
|
|
@@ -51,19 +51,17 @@ classifiers = [
|
|
|
51
51
|
]
|
|
52
52
|
|
|
53
53
|
dependencies = [
|
|
54
|
-
"openai>=1.58",
|
|
55
54
|
"diskcache",
|
|
56
55
|
"termcolor",
|
|
57
56
|
"python-dotenv",
|
|
58
57
|
"tiktoken",
|
|
59
|
-
"numpy",
|
|
60
58
|
# Disallowing 2.6.0 can be removed when this is fixed https://github.com/pydantic/pydantic/issues/8705
|
|
61
59
|
"pydantic>=2.6.1,<3",
|
|
62
60
|
"docker",
|
|
63
61
|
"packaging",
|
|
64
|
-
"websockets>=14,<15",
|
|
65
62
|
"asyncer==0.0.8",
|
|
66
|
-
"
|
|
63
|
+
"fast-depends>=2.4.12,<3",
|
|
64
|
+
"httpx>=0.28.1,<1",
|
|
67
65
|
]
|
|
68
66
|
|
|
69
67
|
[project.optional-dependencies]
|
|
@@ -76,6 +74,16 @@ flaml = [
|
|
|
76
74
|
]
|
|
77
75
|
|
|
78
76
|
# public distributions
|
|
77
|
+
|
|
78
|
+
openai = [
|
|
79
|
+
"openai>=1.58",
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
openai-realtime = [
|
|
83
|
+
"autogen[openai]",
|
|
84
|
+
"openai[realtime]",
|
|
85
|
+
]
|
|
86
|
+
|
|
79
87
|
jupyter-executor = [
|
|
80
88
|
"jupyter-kernel-gateway",
|
|
81
89
|
"websocket-client",
|
|
@@ -104,6 +112,7 @@ retrievechat-pgvector = [
|
|
|
104
112
|
retrievechat-mongodb = [
|
|
105
113
|
"pyautogen[retrievechat]",
|
|
106
114
|
"pymongo>=4.0.0",
|
|
115
|
+
"numpy",
|
|
107
116
|
]
|
|
108
117
|
|
|
109
118
|
retrievechat-qdrant = [
|
|
@@ -115,10 +124,11 @@ retrievechat-qdrant = [
|
|
|
115
124
|
retrievechat-couchbase = [
|
|
116
125
|
"pyautogen[retrievechat]",
|
|
117
126
|
"couchbase>=4.3.0",
|
|
127
|
+
"numpy",
|
|
118
128
|
]
|
|
119
129
|
|
|
120
130
|
graph-rag-falkor-db = [
|
|
121
|
-
"graphrag_sdk==0.6.
|
|
131
|
+
"graphrag_sdk==0.6.1",
|
|
122
132
|
"falkordb>=1.0.10",
|
|
123
133
|
]
|
|
124
134
|
|
|
@@ -137,14 +147,16 @@ crawl4ai = [
|
|
|
137
147
|
]
|
|
138
148
|
|
|
139
149
|
browser-use = [
|
|
140
|
-
|
|
150
|
+
# ToDo: Restrict browser-use to a specific version
|
|
151
|
+
# browser-use>0.1.38 moved langchain-google-genai, aws, etc to its dev dependencies
|
|
152
|
+
"browser-use==0.1.37",
|
|
141
153
|
]
|
|
142
154
|
|
|
143
155
|
neo4j = [
|
|
144
156
|
"docx2txt==0.8",
|
|
145
|
-
"llama-index==0.12.
|
|
157
|
+
"llama-index==0.12.19",
|
|
146
158
|
"llama-index-graph-stores-neo4j==0.4.6",
|
|
147
|
-
"llama-index-core==0.12.
|
|
159
|
+
"llama-index-core==0.12.19",
|
|
148
160
|
"llama-index-readers-web==0.3.5",
|
|
149
161
|
]
|
|
150
162
|
|
|
@@ -175,13 +187,15 @@ teachable = ["chromadb"]
|
|
|
175
187
|
lmm = ["replicate", "pillow"]
|
|
176
188
|
graph = ["networkx", "matplotlib"]
|
|
177
189
|
gemini = [
|
|
190
|
+
"google-api-core",
|
|
178
191
|
"google-genai>=1.2.0,<2.0",
|
|
179
192
|
"google-cloud-aiplatform",
|
|
180
193
|
"google-auth",
|
|
181
194
|
"pillow",
|
|
182
195
|
"jsonschema",
|
|
183
|
-
"jsonref>=1,<2"
|
|
196
|
+
"jsonref>=1,<2",
|
|
184
197
|
]
|
|
198
|
+
|
|
185
199
|
together = ["together>=1.2"]
|
|
186
200
|
websurfer = ["beautifulsoup4", "markdownify", "pdfminer.six", "pathvalidate"]
|
|
187
201
|
redis = ["redis"]
|
|
@@ -192,7 +206,7 @@ anthropic = ["anthropic[vertex]>=0.23.1"]
|
|
|
192
206
|
cerebras = ["cerebras_cloud_sdk>=1.0.0"]
|
|
193
207
|
mistral = ["mistralai>=1.0.1"]
|
|
194
208
|
groq = ["groq>=0.9.0"]
|
|
195
|
-
cohere = ["cohere>=5.5
|
|
209
|
+
cohere = ["cohere>=5.13.5"]
|
|
196
210
|
ollama = ["ollama>=0.4.5", "fix_busted_json>=0.0.18"]
|
|
197
211
|
bedrock = ["boto3>=1.34.149"]
|
|
198
212
|
|
|
@@ -215,8 +229,19 @@ test = [
|
|
|
215
229
|
"fastapi==0.115.8",
|
|
216
230
|
]
|
|
217
231
|
|
|
218
|
-
# docs dependencies
|
|
219
232
|
docs = [
|
|
233
|
+
"mkdocs-material==9.6.4",
|
|
234
|
+
"mkdocstrings[python]==0.28.1",
|
|
235
|
+
"mkdocs-literate-nav==0.6.1",
|
|
236
|
+
"mdx-include==1.4.2",
|
|
237
|
+
"mkdocs-git-revision-date-localized-plugin==1.3.0",
|
|
238
|
+
"mike==2.1.3",
|
|
239
|
+
"typer==0.15.1",
|
|
240
|
+
"mkdocs-minify-plugin==0.8.0",
|
|
241
|
+
"mkdocs-macros-plugin==1.3.7", # includes with variables
|
|
242
|
+
"mkdocs-glightbox==0.4.0", # img zoom
|
|
243
|
+
"pillow", # required for mkdocs-glightbo
|
|
244
|
+
"cairosvg", # required for mkdocs-glightbo
|
|
220
245
|
"pdoc3==0.11.5",
|
|
221
246
|
"jinja2==3.1.5",
|
|
222
247
|
"pyyaml==6.0.2",
|
|
@@ -226,11 +251,11 @@ docs = [
|
|
|
226
251
|
|
|
227
252
|
types = [
|
|
228
253
|
"mypy==1.15.0",
|
|
229
|
-
"pyautogen[test]",
|
|
254
|
+
"pyautogen[test, openai]",
|
|
230
255
|
]
|
|
231
256
|
|
|
232
257
|
lint = [
|
|
233
|
-
"ruff==0.9.
|
|
258
|
+
"ruff==0.9.7",
|
|
234
259
|
"codespell==2.4.1",
|
|
235
260
|
"pyupgrade-directories==0.3.0",
|
|
236
261
|
]
|
|
@@ -240,7 +265,7 @@ dev = [
|
|
|
240
265
|
"pyautogen[lint,test,types,docs]",
|
|
241
266
|
"pre-commit==4.1.0",
|
|
242
267
|
"detect-secrets==1.5.0",
|
|
243
|
-
"uv==0.6.
|
|
268
|
+
"uv==0.6.2",
|
|
244
269
|
]
|
|
245
270
|
|
|
246
271
|
|
|
@@ -297,6 +322,7 @@ markers = [
|
|
|
297
322
|
"interop",
|
|
298
323
|
"browser_use",
|
|
299
324
|
"crawl4ai",
|
|
325
|
+
"websockets",
|
|
300
326
|
]
|
|
301
327
|
|
|
302
328
|
[tool.black]
|
|
@@ -378,28 +404,34 @@ convention = "google"
|
|
|
378
404
|
|
|
379
405
|
[tool.mypy]
|
|
380
406
|
files = [
|
|
381
|
-
"autogen/
|
|
382
|
-
"autogen/
|
|
407
|
+
"autogen/agentchat/contrib/rag",
|
|
408
|
+
"autogen/agentchat/contrib/graph_rag",
|
|
409
|
+
"autogen/agentchat/realtime_agent",
|
|
410
|
+
"autogen/agents",
|
|
383
411
|
"autogen/coding",
|
|
384
|
-
"autogen/
|
|
385
|
-
"autogen/
|
|
386
|
-
"autogen/tools",
|
|
412
|
+
"autogen/exception_utils.py",
|
|
413
|
+
"autogen/import_utils.py",
|
|
387
414
|
"autogen/interop",
|
|
388
|
-
"autogen/
|
|
415
|
+
"autogen/io",
|
|
416
|
+
"autogen/logger",
|
|
389
417
|
"autogen/messages",
|
|
390
|
-
"autogen/
|
|
391
|
-
"autogen/
|
|
418
|
+
"autogen/oai/oai_models",
|
|
419
|
+
"autogen/oai/openai_utils.py",
|
|
420
|
+
"autogen/tools",
|
|
392
421
|
"website/*.py",
|
|
393
|
-
"test/
|
|
394
|
-
"test/
|
|
395
|
-
"test/interop",
|
|
422
|
+
"test/agentchat/contrib/graph_rag",
|
|
423
|
+
# "test/agentchat/contrib/rag",
|
|
396
424
|
"test/agentchat/realtime_agent",
|
|
397
|
-
"test/
|
|
425
|
+
"test/agents",
|
|
398
426
|
"test/conftest.py",
|
|
427
|
+
"test/interop",
|
|
428
|
+
"test/io",
|
|
429
|
+
"test/messages",
|
|
399
430
|
"test/test_import_utils.py",
|
|
400
431
|
"test/test_import.py",
|
|
401
|
-
"test/
|
|
432
|
+
"test/tools",
|
|
402
433
|
"test/website",
|
|
434
|
+
"test/oai/test_oai_models.py",
|
|
403
435
|
]
|
|
404
436
|
|
|
405
437
|
exclude = [
|
|
@@ -29,6 +29,8 @@ setuptools.setup(
|
|
|
29
29
|
install_requires=["pyautogen==" + __version__],
|
|
30
30
|
extras_require={
|
|
31
31
|
"flaml": ["pyautogen[flaml]==" + __version__],
|
|
32
|
+
"openai": ["pyautogen[openai]==" + __version__],
|
|
33
|
+
"openai-realtime": ["pyautogen[openai-realtime]==" + __version__],
|
|
32
34
|
"jupyter-executor": ["pyautogen[jupyter-executor]==" + __version__],
|
|
33
35
|
"retrievechat": ["pyautogen[retrievechat]==" + __version__],
|
|
34
36
|
"retrievechat-pgvector": ["pyautogen[retrievechat-pgvector]==" + __version__],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
from typing import Any, Type
|
|
5
|
+
from typing import Any, Optional, Type, Union
|
|
6
6
|
|
|
7
7
|
import pytest
|
|
8
8
|
|
|
@@ -32,39 +32,48 @@ class TestOptionalImportBlock:
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
class TestRequiresOptionalImportCallables:
|
|
35
|
-
|
|
35
|
+
@pytest.mark.parametrize("except_for", [None, "dummy_function", ["dummy_function"]])
|
|
36
|
+
def test_function_attributes(self, except_for: Optional[Union[str, list[str]]]) -> None:
|
|
36
37
|
def dummy_function() -> None:
|
|
37
38
|
"""Dummy function to test requires_optional_import"""
|
|
38
39
|
pass
|
|
39
40
|
|
|
40
41
|
dummy_function.__module__ = "some_random_module.dummy_stuff"
|
|
41
42
|
|
|
42
|
-
actual = require_optional_import("some_optional_module", "optional_dep")(dummy_function)
|
|
43
|
+
actual = require_optional_import("some_optional_module", "optional_dep", except_for=except_for)(dummy_function)
|
|
43
44
|
|
|
44
45
|
assert actual is not None
|
|
45
46
|
assert actual.__module__ == "some_random_module.dummy_stuff"
|
|
46
47
|
assert actual.__name__ == "dummy_function"
|
|
47
48
|
assert actual.__doc__ == "Dummy function to test requires_optional_import"
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
if not except_for:
|
|
51
|
+
with pytest.raises(
|
|
52
|
+
ImportError,
|
|
53
|
+
match=r"Module 'some_optional_module' needed for some_random_module.dummy_stuff.dummy_function is missing, please install it using 'pip install ag2\[optional_dep\]'",
|
|
54
|
+
):
|
|
55
|
+
actual()
|
|
56
|
+
else:
|
|
53
57
|
actual()
|
|
54
58
|
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
@pytest.mark.parametrize("except_for", [None, "dummy_function", ["dummy_function"]])
|
|
60
|
+
def test_function_call(self, except_for: Optional[Union[str, list[str]]]) -> None:
|
|
61
|
+
@require_optional_import("some_optional_module", "optional_dep", except_for=except_for)
|
|
57
62
|
def dummy_function() -> None:
|
|
58
63
|
"""Dummy function to test requires_optional_import"""
|
|
59
64
|
pass
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
if not except_for:
|
|
67
|
+
with pytest.raises(
|
|
68
|
+
ImportError,
|
|
69
|
+
match=r"Module 'some_optional_module' needed for test.test_import_utils.dummy_function is missing, please install it using 'pip install ag2\[optional_dep\]'",
|
|
70
|
+
):
|
|
71
|
+
dummy_function()
|
|
72
|
+
else:
|
|
65
73
|
dummy_function()
|
|
66
74
|
|
|
67
|
-
|
|
75
|
+
@pytest.mark.parametrize("except_for", [None, "dummy_method", ["dummy_method"]])
|
|
76
|
+
def test_method_attributes(self, except_for: Optional[Union[str, list[str]]]) -> None:
|
|
68
77
|
class DummyClass:
|
|
69
78
|
def dummy_method(self) -> None:
|
|
70
79
|
"""Dummy method to test requires_optional_import"""
|
|
@@ -76,9 +85,9 @@ class TestRequiresOptionalImportCallables:
|
|
|
76
85
|
DummyClass.__module__ = "some_random_module.dummy_stuff"
|
|
77
86
|
DummyClass.dummy_method.__module__ = "some_random_module.dummy_stuff"
|
|
78
87
|
|
|
79
|
-
DummyClass.dummy_method = require_optional_import(
|
|
80
|
-
|
|
81
|
-
)
|
|
88
|
+
DummyClass.dummy_method = require_optional_import( # type: ignore[method-assign]
|
|
89
|
+
"some_optional_module", "optional_dep", except_for=except_for
|
|
90
|
+
)(DummyClass.dummy_method)
|
|
82
91
|
|
|
83
92
|
assert DummyClass.dummy_method is not None
|
|
84
93
|
assert DummyClass.dummy_method.__module__ == "some_random_module.dummy_stuff"
|
|
@@ -86,54 +95,74 @@ class TestRequiresOptionalImportCallables:
|
|
|
86
95
|
assert DummyClass.dummy_method.__doc__ == "Dummy method to test requires_optional_import"
|
|
87
96
|
|
|
88
97
|
dummy = DummyClass()
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
|
|
99
|
+
if not except_for:
|
|
100
|
+
with pytest.raises(
|
|
101
|
+
ImportError,
|
|
102
|
+
match=r"Module 'some_optional_module' needed for some_random_module.dummy_stuff.dummy_method is missing, please install it using 'pip install ag2\[optional_dep\]",
|
|
103
|
+
):
|
|
104
|
+
dummy.dummy_method()
|
|
105
|
+
else:
|
|
93
106
|
dummy.dummy_method()
|
|
94
107
|
|
|
95
|
-
|
|
108
|
+
@pytest.mark.parametrize("except_for", [None, "dummy_method", ["dummy_method"]])
|
|
109
|
+
def test_method_call(self, except_for: Optional[Union[str, list[str]]]) -> None:
|
|
96
110
|
class DummyClass:
|
|
97
|
-
@require_optional_import("some_optional_module", "optional_dep")
|
|
111
|
+
@require_optional_import("some_optional_module", "optional_dep", except_for=except_for)
|
|
98
112
|
def dummy_method(self) -> None:
|
|
99
113
|
"""Dummy method to test requires_optional_import"""
|
|
100
114
|
pass
|
|
101
115
|
|
|
102
116
|
dummy = DummyClass()
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
|
|
118
|
+
if not except_for:
|
|
119
|
+
with pytest.raises(
|
|
120
|
+
ImportError,
|
|
121
|
+
match=r"Module 'some_optional_module' needed for test.test_import_utils.dummy_method is missing, please install it using 'pip install ag2\[optional_dep\]'",
|
|
122
|
+
):
|
|
123
|
+
dummy.dummy_method()
|
|
124
|
+
else:
|
|
107
125
|
dummy.dummy_method()
|
|
108
126
|
|
|
109
|
-
|
|
127
|
+
@pytest.mark.parametrize("except_for", [None, "dummy_static_function", ["dummy_static_function"]])
|
|
128
|
+
def test_static_call(self, except_for: Optional[Union[str, list[str]]]) -> None:
|
|
110
129
|
class DummyClass:
|
|
111
|
-
@require_optional_import("some_optional_module", "optional_dep")
|
|
130
|
+
@require_optional_import("some_optional_module", "optional_dep", except_for=except_for)
|
|
112
131
|
@staticmethod
|
|
113
132
|
def dummy_static_function() -> None:
|
|
114
133
|
"""Dummy static function to test requires_optional_import"""
|
|
115
134
|
pass
|
|
116
135
|
|
|
117
136
|
dummy = DummyClass()
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
137
|
+
|
|
138
|
+
if not except_for:
|
|
139
|
+
with pytest.raises(
|
|
140
|
+
ImportError,
|
|
141
|
+
match=r"Module 'some_optional_module' needed for test.test_import_utils.dummy_static_function is missing, please install it using 'pip install ag2\[optional_dep\]'",
|
|
142
|
+
):
|
|
143
|
+
dummy.dummy_static_function()
|
|
144
|
+
else:
|
|
122
145
|
dummy.dummy_static_function()
|
|
123
146
|
|
|
124
|
-
|
|
147
|
+
@pytest.mark.parametrize("except_for", [None, "dummy_property", ["dummy_property"]])
|
|
148
|
+
def test_property_call(self, except_for: Optional[Union[str, list[str]]]) -> None:
|
|
125
149
|
class DummyClass:
|
|
126
150
|
@property
|
|
127
|
-
@require_optional_import("some_optional_module", "optional_dep")
|
|
151
|
+
@require_optional_import("some_optional_module", "optional_dep", except_for=except_for)
|
|
128
152
|
def dummy_property(self) -> int:
|
|
129
153
|
"""Dummy property to test requires_optional_import"""
|
|
130
154
|
return 4
|
|
131
155
|
|
|
132
156
|
dummy = DummyClass()
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
157
|
+
|
|
158
|
+
if not except_for:
|
|
159
|
+
with pytest.raises(
|
|
160
|
+
ImportError,
|
|
161
|
+
match=r"Module 'some_optional_module' needed for test.test_import_utils.dummy_property is missing, please install it using 'pip install ag2\[optional_dep\]'",
|
|
162
|
+
):
|
|
163
|
+
dummy.dummy_property
|
|
164
|
+
|
|
165
|
+
else:
|
|
137
166
|
dummy.dummy_property
|
|
138
167
|
|
|
139
168
|
|
|
@@ -13,7 +13,13 @@ from typing import Any, Callable
|
|
|
13
13
|
from unittest.mock import Mock, patch
|
|
14
14
|
|
|
15
15
|
import pytest
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
from autogen.import_utils import optional_import_block, skip_on_missing_imports
|
|
18
|
+
|
|
19
|
+
with optional_import_block() as result:
|
|
20
|
+
import openai # noqa: F401
|
|
21
|
+
from openai import AzureOpenAI
|
|
22
|
+
|
|
17
23
|
|
|
18
24
|
import autogen.runtime_logging
|
|
19
25
|
from autogen.logger.logger_utils import get_current_ts, to_dict
|
|
@@ -154,12 +160,13 @@ def test_log_function_use(db_connection):
|
|
|
154
160
|
assert row["returns"] == json.dumps(returns)
|
|
155
161
|
|
|
156
162
|
|
|
163
|
+
@skip_on_missing_imports(["openai"], "openai")
|
|
157
164
|
def test_log_new_agent(db_connection):
|
|
158
165
|
from autogen import AssistantAgent
|
|
159
166
|
|
|
160
167
|
cur = db_connection.cursor()
|
|
161
168
|
agent_name = "some_assistant"
|
|
162
|
-
config_list = [{"
|
|
169
|
+
config_list = [{"model": "gpt-4o", "api_key": "some_key"}]
|
|
163
170
|
|
|
164
171
|
agent = AssistantAgent(agent_name, llm_config={"config_list": config_list})
|
|
165
172
|
init_args = {"foo": "bar", "baz": {"other_key": "other_val"}, "a": None}
|
|
@@ -179,14 +186,13 @@ def test_log_new_agent(db_connection):
|
|
|
179
186
|
assert row["init_args"] == json.dumps(init_args)
|
|
180
187
|
|
|
181
188
|
|
|
189
|
+
@skip_on_missing_imports(["openai"], "openai")
|
|
182
190
|
def test_log_oai_wrapper(db_connection):
|
|
183
191
|
from autogen import OpenAIWrapper
|
|
184
192
|
|
|
185
193
|
cur = db_connection.cursor()
|
|
186
194
|
|
|
187
|
-
llm_config = {
|
|
188
|
-
"config_list": [{"api_type": "openai", "model": "gpt-4o", "api_key": "some_key", "base_url": "some url"}]
|
|
189
|
-
}
|
|
195
|
+
llm_config = {"config_list": [{"model": "gpt-4o", "api_key": "some_key", "base_url": "some url"}]}
|
|
190
196
|
init_args = {"llm_config": llm_config, "base_config": {}}
|
|
191
197
|
wrapper = OpenAIWrapper(**llm_config)
|
|
192
198
|
|
|
@@ -207,6 +213,7 @@ def test_log_oai_wrapper(db_connection):
|
|
|
207
213
|
assert "base_config" in saved_init_args
|
|
208
214
|
|
|
209
215
|
|
|
216
|
+
@skip_on_missing_imports(["openai"], "openai")
|
|
210
217
|
def test_log_oai_client(db_connection):
|
|
211
218
|
cur = db_connection.cursor()
|
|
212
219
|
|
|
@@ -213,7 +213,7 @@ class TestRetrieveUtils:
|
|
|
213
213
|
def test_retrieve_utils(self):
|
|
214
214
|
client = chromadb.PersistentClient(path="/tmp/chromadb")
|
|
215
215
|
create_vector_db_from_dir(
|
|
216
|
-
dir_path="./website/docs",
|
|
216
|
+
dir_path="./website/docs/home",
|
|
217
217
|
client=client,
|
|
218
218
|
collection_name="autogen-docs",
|
|
219
219
|
custom_text_types=["txt", "md", "rtf", "rst", "mdx"],
|
|
@@ -229,7 +229,7 @@ class TestRetrieveUtils:
|
|
|
229
229
|
search_string="AutoGen",
|
|
230
230
|
)
|
|
231
231
|
print(results["ids"][0])
|
|
232
|
-
assert len(results["ids"][0])
|
|
232
|
+
assert len(results["ids"][0]) > 0
|
|
233
233
|
|
|
234
234
|
@skip_on_missing_imports(["unstructured"], "unknown")
|
|
235
235
|
def test_unstructured(self):
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
pyautogen==0.7.5
|
|
2
|
-
|
|
3
|
-
[anthropic]
|
|
4
|
-
pyautogen[anthropic]==0.7.5
|
|
5
|
-
|
|
6
|
-
[autobuild]
|
|
7
|
-
pyautogen[autobuild]==0.7.5
|
|
8
|
-
|
|
9
|
-
[bedrock]
|
|
10
|
-
pyautogen[bedrock]==0.7.5
|
|
11
|
-
|
|
12
|
-
[blendsearch]
|
|
13
|
-
pyautogen[blendsearch]==0.7.5
|
|
14
|
-
|
|
15
|
-
[browser-use]
|
|
16
|
-
pyautogen[browser-use]==0.7.5
|
|
17
|
-
|
|
18
|
-
[captainagent]
|
|
19
|
-
pyautogen[captainagent]==0.7.5
|
|
20
|
-
|
|
21
|
-
[cerebras]
|
|
22
|
-
pyautogen[cerebras]==0.7.5
|
|
23
|
-
|
|
24
|
-
[cohere]
|
|
25
|
-
pyautogen[cohere]==0.7.5
|
|
26
|
-
|
|
27
|
-
[commsagent-discord]
|
|
28
|
-
pyautogen[commsagent-discord]==0.7.5
|
|
29
|
-
|
|
30
|
-
[commsagent-slack]
|
|
31
|
-
pyautogen[commsagent-slack]==0.7.5
|
|
32
|
-
|
|
33
|
-
[commsagent-telegram]
|
|
34
|
-
pyautogen[commsagent-telegram]==0.7.5
|
|
35
|
-
|
|
36
|
-
[cosmosdb]
|
|
37
|
-
pyautogen[cosmosdb]==0.7.5
|
|
38
|
-
|
|
39
|
-
[crawl4ai]
|
|
40
|
-
pyautogen[crawl4ai]==0.7.5
|
|
41
|
-
|
|
42
|
-
[dev]
|
|
43
|
-
pyautogen[dev]==0.7.5
|
|
44
|
-
|
|
45
|
-
[docs]
|
|
46
|
-
pyautogen[docs]==0.7.5
|
|
47
|
-
|
|
48
|
-
[flaml]
|
|
49
|
-
pyautogen[flaml]==0.7.5
|
|
50
|
-
|
|
51
|
-
[gemini]
|
|
52
|
-
pyautogen[gemini]==0.7.5
|
|
53
|
-
|
|
54
|
-
[graph]
|
|
55
|
-
pyautogen[graph]==0.7.5
|
|
56
|
-
|
|
57
|
-
[graph-rag-falkor-db]
|
|
58
|
-
pyautogen[graph-rag-falkor-db]==0.7.5
|
|
59
|
-
|
|
60
|
-
[groq]
|
|
61
|
-
pyautogen[groq]==0.7.5
|
|
62
|
-
|
|
63
|
-
[interop]
|
|
64
|
-
pyautogen[interop]==0.7.5
|
|
65
|
-
|
|
66
|
-
[interop-crewai]
|
|
67
|
-
pyautogen[interop-crewai]==0.7.5
|
|
68
|
-
|
|
69
|
-
[interop-langchain]
|
|
70
|
-
pyautogen[interop-langchain]==0.7.5
|
|
71
|
-
|
|
72
|
-
[interop-pydantic-ai]
|
|
73
|
-
pyautogen[interop-pydantic-ai]==0.7.5
|
|
74
|
-
|
|
75
|
-
[jupyter-executor]
|
|
76
|
-
pyautogen[jupyter-executor]==0.7.5
|
|
77
|
-
|
|
78
|
-
[lint]
|
|
79
|
-
pyautogen[lint]==0.7.5
|
|
80
|
-
|
|
81
|
-
[lmm]
|
|
82
|
-
pyautogen[lmm]==0.7.5
|
|
83
|
-
|
|
84
|
-
[long-context]
|
|
85
|
-
pyautogen[long-context]==0.7.5
|
|
86
|
-
|
|
87
|
-
[mathchat]
|
|
88
|
-
pyautogen[mathchat]==0.7.5
|
|
89
|
-
|
|
90
|
-
[mistral]
|
|
91
|
-
pyautogen[mistral]==0.7.5
|
|
92
|
-
|
|
93
|
-
[neo4j]
|
|
94
|
-
pyautogen[neo4j]==0.7.5
|
|
95
|
-
|
|
96
|
-
[ollama]
|
|
97
|
-
pyautogen[ollama]==0.7.5
|
|
98
|
-
|
|
99
|
-
[rag]
|
|
100
|
-
pyautogen[rag]==0.7.5
|
|
101
|
-
|
|
102
|
-
[redis]
|
|
103
|
-
pyautogen[redis]==0.7.5
|
|
104
|
-
|
|
105
|
-
[retrievechat]
|
|
106
|
-
pyautogen[retrievechat]==0.7.5
|
|
107
|
-
|
|
108
|
-
[retrievechat-couchbase]
|
|
109
|
-
pyautogen[retrievechat-couchbase]==0.7.5
|
|
110
|
-
|
|
111
|
-
[retrievechat-mongodb]
|
|
112
|
-
pyautogen[retrievechat-mongodb]==0.7.5
|
|
113
|
-
|
|
114
|
-
[retrievechat-pgvector]
|
|
115
|
-
pyautogen[retrievechat-pgvector]==0.7.5
|
|
116
|
-
|
|
117
|
-
[retrievechat-qdrant]
|
|
118
|
-
pyautogen[retrievechat-qdrant]==0.7.5
|
|
119
|
-
|
|
120
|
-
[teachable]
|
|
121
|
-
pyautogen[teachable]==0.7.5
|
|
122
|
-
|
|
123
|
-
[test]
|
|
124
|
-
pyautogen[test]==0.7.5
|
|
125
|
-
|
|
126
|
-
[together]
|
|
127
|
-
pyautogen[together]==0.7.5
|
|
128
|
-
|
|
129
|
-
[twilio]
|
|
130
|
-
pyautogen[twilio]==0.7.5
|
|
131
|
-
|
|
132
|
-
[types]
|
|
133
|
-
pyautogen[types]==0.7.5
|
|
134
|
-
|
|
135
|
-
[websockets]
|
|
136
|
-
pyautogen[websockets]==0.7.5
|
|
137
|
-
|
|
138
|
-
[websurfer]
|
|
139
|
-
pyautogen[websurfer]==0.7.5
|
|
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
|