ag2 0.7.1__tar.gz → 0.7.2b1__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.1 → ag2-0.7.2b1}/NOTICE.md +5 -5
- {ag2-0.7.1/ag2.egg-info → ag2-0.7.2b1}/PKG-INFO +19 -15
- {ag2-0.7.1 → ag2-0.7.2b1}/README.md +3 -3
- {ag2-0.7.1 → ag2-0.7.2b1/ag2.egg-info}/PKG-INFO +19 -15
- {ag2-0.7.1 → ag2-0.7.2b1}/ag2.egg-info/SOURCES.txt +3 -0
- ag2-0.7.2b1/ag2.egg-info/requires.txt +118 -0
- {ag2-0.7.1 → ag2-0.7.2b1}/pyproject.toml +54 -42
- {ag2-0.7.1 → ag2-0.7.2b1}/setup_ag2.py +19 -11
- {ag2-0.7.1 → ag2-0.7.2b1}/test/test_browser_utils.py +13 -6
- {ag2-0.7.1 → ag2-0.7.2b1}/test/test_code_utils.py +8 -4
- ag2-0.7.2b1/test/test_conftest.py +34 -0
- ag2-0.7.2b1/test/test_import.py +84 -0
- ag2-0.7.2b1/test/test_import_utils.py +171 -0
- {ag2-0.7.1 → ag2-0.7.2b1}/test/test_notebook.py +6 -8
- {ag2-0.7.1 → ag2-0.7.2b1}/test/test_retrieve_utils.py +25 -23
- {ag2-0.7.1 → ag2-0.7.2b1}/test/test_token_count.py +5 -5
- ag2-0.7.1/ag2.egg-info/requires.txt +0 -106
- {ag2-0.7.1 → ag2-0.7.2b1}/LICENSE +0 -0
- {ag2-0.7.1 → ag2-0.7.2b1}/ag2.egg-info/dependency_links.txt +0 -0
- {ag2-0.7.1 → ag2-0.7.2b1}/ag2.egg-info/top_level.txt +0 -0
- {ag2-0.7.1 → ag2-0.7.2b1}/setup.cfg +0 -0
- {ag2-0.7.1 → ag2-0.7.2b1}/test/test_graph_utils.py +0 -0
- {ag2-0.7.1 → ag2-0.7.2b1}/test/test_logging.py +0 -0
- {ag2-0.7.1 → ag2-0.7.2b1}/test/test_pydantic.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## NOTICE
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2023-
|
|
3
|
+
Copyright (c) 2023-2025, Owners of https://github.com/ag2ai
|
|
4
4
|
|
|
5
5
|
This project is a fork of https://github.com/microsoft/autogen.
|
|
6
6
|
|
|
@@ -12,8 +12,8 @@ This project, i.e., https://github.com/ag2ai/ag2, is licensed under the Apache L
|
|
|
12
12
|
|
|
13
13
|
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
MIT-licensed contributions:
|
|
16
|
+
The MIT license applies to portions of code originating from the [original repository](https://github.com/microsoft/autogen).
|
|
17
|
+
For specific details on merged commits, please refer to the project's commit history.
|
|
18
18
|
|
|
19
|
-
Last updated:
|
|
19
|
+
Last updated: 01/16/2025
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ag2
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2b1
|
|
4
4
|
Summary: Alias package for pyautogen
|
|
5
5
|
Home-page: https://github.com/ag2ai/ag2
|
|
6
6
|
Author: Chi Wang & Qingyun Wu
|
|
@@ -12,15 +12,22 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
13
|
Requires-Python: >=3.9,<3.14
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
|
-
Provides-Extra:
|
|
16
|
-
Provides-Extra:
|
|
17
|
-
Provides-Extra: mathchat
|
|
15
|
+
Provides-Extra: flaml
|
|
16
|
+
Provides-Extra: jupyter-executor
|
|
18
17
|
Provides-Extra: retrievechat
|
|
19
18
|
Provides-Extra: retrievechat-pgvector
|
|
20
19
|
Provides-Extra: retrievechat-mongodb
|
|
21
20
|
Provides-Extra: retrievechat-qdrant
|
|
22
21
|
Provides-Extra: graph-rag-falkor-db
|
|
22
|
+
Provides-Extra: neo4j
|
|
23
|
+
Provides-Extra: twilio
|
|
24
|
+
Provides-Extra: interop-crewai
|
|
25
|
+
Provides-Extra: interop-langchain
|
|
26
|
+
Provides-Extra: interop-pydantic-ai
|
|
27
|
+
Provides-Extra: interop
|
|
23
28
|
Provides-Extra: autobuild
|
|
29
|
+
Provides-Extra: blendsearch
|
|
30
|
+
Provides-Extra: mathchat
|
|
24
31
|
Provides-Extra: captainagent
|
|
25
32
|
Provides-Extra: teachable
|
|
26
33
|
Provides-Extra: lmm
|
|
@@ -31,8 +38,6 @@ Provides-Extra: websurfer
|
|
|
31
38
|
Provides-Extra: redis
|
|
32
39
|
Provides-Extra: cosmosdb
|
|
33
40
|
Provides-Extra: websockets
|
|
34
|
-
Provides-Extra: jupyter-executor
|
|
35
|
-
Provides-Extra: types
|
|
36
41
|
Provides-Extra: long-context
|
|
37
42
|
Provides-Extra: anthropic
|
|
38
43
|
Provides-Extra: cerebras
|
|
@@ -41,12 +46,11 @@ Provides-Extra: groq
|
|
|
41
46
|
Provides-Extra: cohere
|
|
42
47
|
Provides-Extra: ollama
|
|
43
48
|
Provides-Extra: bedrock
|
|
44
|
-
Provides-Extra:
|
|
45
|
-
Provides-Extra:
|
|
46
|
-
Provides-Extra:
|
|
47
|
-
Provides-Extra:
|
|
48
|
-
Provides-Extra:
|
|
49
|
-
Provides-Extra: neo4j
|
|
49
|
+
Provides-Extra: test
|
|
50
|
+
Provides-Extra: docs
|
|
51
|
+
Provides-Extra: types
|
|
52
|
+
Provides-Extra: lint
|
|
53
|
+
Provides-Extra: dev
|
|
50
54
|
License-File: LICENSE
|
|
51
55
|
License-File: NOTICE.md
|
|
52
56
|
|
|
@@ -57,7 +61,7 @@ License-File: NOTICE.md
|
|
|
57
61
|
[](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml)
|
|
58
62
|

|
|
59
63
|
[](https://discord.gg/pAbnFJrkgZ)
|
|
60
|
-
[](https://x.com/
|
|
64
|
+
[](https://x.com/Chi_Wang_)
|
|
61
65
|
|
|
62
66
|
<!-- [](https://badge.fury.io/nu/AutoGen.Core) -->
|
|
63
67
|
|
|
@@ -72,7 +76,7 @@ License-File: NOTICE.md
|
|
|
72
76
|
> **:tada: IMPORTANT**
|
|
73
77
|
>
|
|
74
78
|
> :fire: :tada: **Nov 11, 2024:** We are evolving AutoGen into **AG2**!
|
|
75
|
-
> A new organization [
|
|
79
|
+
> A new organization [AG2AI](https://github.com/ag2ai) is created to host the development of AG2 and related projects with open governance. Check [AG2's new look](https://ag2.ai/).
|
|
76
80
|
>
|
|
77
81
|
> We invite collaborators from all organizations and individuals to join the development.
|
|
78
82
|
|
|
@@ -139,7 +143,7 @@ AG2 (formerly AutoGen) is an open-source programming framework for building AI a
|
|
|
139
143
|
The project is currently maintained by a [dynamic group of volunteers](MAINTAINERS.md) from several organizations. Contact project administrators Chi Wang and Qingyun Wu via [support@ag2.ai](mailto:support@ag2.ai) if you are interested in becoming a maintainer.
|
|
140
144
|
|
|
141
145
|
|
|
142
|
-

|
|
143
147
|
|
|
144
148
|
|
|
145
149
|
<p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml)
|
|
6
6
|

|
|
7
7
|
[](https://discord.gg/pAbnFJrkgZ)
|
|
8
|
-
[](https://x.com/
|
|
8
|
+
[](https://x.com/Chi_Wang_)
|
|
9
9
|
|
|
10
10
|
<!-- [](https://badge.fury.io/nu/AutoGen.Core) -->
|
|
11
11
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
> **:tada: IMPORTANT**
|
|
21
21
|
>
|
|
22
22
|
> :fire: :tada: **Nov 11, 2024:** We are evolving AutoGen into **AG2**!
|
|
23
|
-
> A new organization [
|
|
23
|
+
> A new organization [AG2AI](https://github.com/ag2ai) is created to host the development of AG2 and related projects with open governance. Check [AG2's new look](https://ag2.ai/).
|
|
24
24
|
>
|
|
25
25
|
> We invite collaborators from all organizations and individuals to join the development.
|
|
26
26
|
|
|
@@ -87,7 +87,7 @@ AG2 (formerly AutoGen) is an open-source programming framework for building AI a
|
|
|
87
87
|
The project is currently maintained by a [dynamic group of volunteers](MAINTAINERS.md) from several organizations. Contact project administrators Chi Wang and Qingyun Wu via [support@ag2.ai](mailto:support@ag2.ai) if you are interested in becoming a maintainer.
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-

|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
<p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ag2
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2b1
|
|
4
4
|
Summary: Alias package for pyautogen
|
|
5
5
|
Home-page: https://github.com/ag2ai/ag2
|
|
6
6
|
Author: Chi Wang & Qingyun Wu
|
|
@@ -12,15 +12,22 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
13
|
Requires-Python: >=3.9,<3.14
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
|
-
Provides-Extra:
|
|
16
|
-
Provides-Extra:
|
|
17
|
-
Provides-Extra: mathchat
|
|
15
|
+
Provides-Extra: flaml
|
|
16
|
+
Provides-Extra: jupyter-executor
|
|
18
17
|
Provides-Extra: retrievechat
|
|
19
18
|
Provides-Extra: retrievechat-pgvector
|
|
20
19
|
Provides-Extra: retrievechat-mongodb
|
|
21
20
|
Provides-Extra: retrievechat-qdrant
|
|
22
21
|
Provides-Extra: graph-rag-falkor-db
|
|
22
|
+
Provides-Extra: neo4j
|
|
23
|
+
Provides-Extra: twilio
|
|
24
|
+
Provides-Extra: interop-crewai
|
|
25
|
+
Provides-Extra: interop-langchain
|
|
26
|
+
Provides-Extra: interop-pydantic-ai
|
|
27
|
+
Provides-Extra: interop
|
|
23
28
|
Provides-Extra: autobuild
|
|
29
|
+
Provides-Extra: blendsearch
|
|
30
|
+
Provides-Extra: mathchat
|
|
24
31
|
Provides-Extra: captainagent
|
|
25
32
|
Provides-Extra: teachable
|
|
26
33
|
Provides-Extra: lmm
|
|
@@ -31,8 +38,6 @@ Provides-Extra: websurfer
|
|
|
31
38
|
Provides-Extra: redis
|
|
32
39
|
Provides-Extra: cosmosdb
|
|
33
40
|
Provides-Extra: websockets
|
|
34
|
-
Provides-Extra: jupyter-executor
|
|
35
|
-
Provides-Extra: types
|
|
36
41
|
Provides-Extra: long-context
|
|
37
42
|
Provides-Extra: anthropic
|
|
38
43
|
Provides-Extra: cerebras
|
|
@@ -41,12 +46,11 @@ Provides-Extra: groq
|
|
|
41
46
|
Provides-Extra: cohere
|
|
42
47
|
Provides-Extra: ollama
|
|
43
48
|
Provides-Extra: bedrock
|
|
44
|
-
Provides-Extra:
|
|
45
|
-
Provides-Extra:
|
|
46
|
-
Provides-Extra:
|
|
47
|
-
Provides-Extra:
|
|
48
|
-
Provides-Extra:
|
|
49
|
-
Provides-Extra: neo4j
|
|
49
|
+
Provides-Extra: test
|
|
50
|
+
Provides-Extra: docs
|
|
51
|
+
Provides-Extra: types
|
|
52
|
+
Provides-Extra: lint
|
|
53
|
+
Provides-Extra: dev
|
|
50
54
|
License-File: LICENSE
|
|
51
55
|
License-File: NOTICE.md
|
|
52
56
|
|
|
@@ -57,7 +61,7 @@ License-File: NOTICE.md
|
|
|
57
61
|
[](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml)
|
|
58
62
|

|
|
59
63
|
[](https://discord.gg/pAbnFJrkgZ)
|
|
60
|
-
[](https://x.com/
|
|
64
|
+
[](https://x.com/Chi_Wang_)
|
|
61
65
|
|
|
62
66
|
<!-- [](https://badge.fury.io/nu/AutoGen.Core) -->
|
|
63
67
|
|
|
@@ -72,7 +76,7 @@ License-File: NOTICE.md
|
|
|
72
76
|
> **:tada: IMPORTANT**
|
|
73
77
|
>
|
|
74
78
|
> :fire: :tada: **Nov 11, 2024:** We are evolving AutoGen into **AG2**!
|
|
75
|
-
> A new organization [
|
|
79
|
+
> A new organization [AG2AI](https://github.com/ag2ai) is created to host the development of AG2 and related projects with open governance. Check [AG2's new look](https://ag2.ai/).
|
|
76
80
|
>
|
|
77
81
|
> We invite collaborators from all organizations and individuals to join the development.
|
|
78
82
|
|
|
@@ -139,7 +143,7 @@ AG2 (formerly AutoGen) is an open-source programming framework for building AI a
|
|
|
139
143
|
The project is currently maintained by a [dynamic group of volunteers](MAINTAINERS.md) from several organizations. Contact project administrators Chi Wang and Qingyun Wu via [support@ag2.ai](mailto:support@ag2.ai) if you are interested in becoming a maintainer.
|
|
140
144
|
|
|
141
145
|
|
|
142
|
-

|
|
143
147
|
|
|
144
148
|
|
|
145
149
|
<p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
|
|
@@ -10,7 +10,10 @@ ag2.egg-info/requires.txt
|
|
|
10
10
|
ag2.egg-info/top_level.txt
|
|
11
11
|
test/test_browser_utils.py
|
|
12
12
|
test/test_code_utils.py
|
|
13
|
+
test/test_conftest.py
|
|
13
14
|
test/test_graph_utils.py
|
|
15
|
+
test/test_import.py
|
|
16
|
+
test/test_import_utils.py
|
|
14
17
|
test/test_logging.py
|
|
15
18
|
test/test_notebook.py
|
|
16
19
|
test/test_pydantic.py
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
pyautogen==0.7.2b1
|
|
2
|
+
|
|
3
|
+
[anthropic]
|
|
4
|
+
pyautogen[anthropic]==0.7.2b1
|
|
5
|
+
|
|
6
|
+
[autobuild]
|
|
7
|
+
pyautogen[autobuild]==0.7.2b1
|
|
8
|
+
|
|
9
|
+
[bedrock]
|
|
10
|
+
pyautogen[bedrock]==0.7.2b1
|
|
11
|
+
|
|
12
|
+
[blendsearch]
|
|
13
|
+
pyautogen[blendsearch]==0.7.2b1
|
|
14
|
+
|
|
15
|
+
[captainagent]
|
|
16
|
+
pyautogen[captainagent]==0.7.2b1
|
|
17
|
+
|
|
18
|
+
[cerebras]
|
|
19
|
+
pyautogen[cerebras]==0.7.2b1
|
|
20
|
+
|
|
21
|
+
[cohere]
|
|
22
|
+
pyautogen[cohere]==0.7.2b1
|
|
23
|
+
|
|
24
|
+
[cosmosdb]
|
|
25
|
+
pyautogen[cosmosdb]==0.7.2b1
|
|
26
|
+
|
|
27
|
+
[dev]
|
|
28
|
+
pyautogen[dev]==0.7.2b1
|
|
29
|
+
|
|
30
|
+
[docs]
|
|
31
|
+
pyautogen[docs]==0.7.2b1
|
|
32
|
+
|
|
33
|
+
[flaml]
|
|
34
|
+
pyautogen[flaml]==0.7.2b1
|
|
35
|
+
|
|
36
|
+
[gemini]
|
|
37
|
+
pyautogen[gemini]==0.7.2b1
|
|
38
|
+
|
|
39
|
+
[graph]
|
|
40
|
+
pyautogen[graph]==0.7.2b1
|
|
41
|
+
|
|
42
|
+
[graph-rag-falkor-db]
|
|
43
|
+
pyautogen[graph-rag-falkor-db]==0.7.2b1
|
|
44
|
+
|
|
45
|
+
[groq]
|
|
46
|
+
pyautogen[groq]==0.7.2b1
|
|
47
|
+
|
|
48
|
+
[interop]
|
|
49
|
+
pyautogen[interop]==0.7.2b1
|
|
50
|
+
|
|
51
|
+
[interop-crewai]
|
|
52
|
+
pyautogen[interop-crewai]==0.7.2b1
|
|
53
|
+
|
|
54
|
+
[interop-langchain]
|
|
55
|
+
pyautogen[interop-langchain]==0.7.2b1
|
|
56
|
+
|
|
57
|
+
[interop-pydantic-ai]
|
|
58
|
+
pyautogen[interop-pydantic-ai]==0.7.2b1
|
|
59
|
+
|
|
60
|
+
[jupyter-executor]
|
|
61
|
+
pyautogen[jupyter-executor]==0.7.2b1
|
|
62
|
+
|
|
63
|
+
[lint]
|
|
64
|
+
pyautogen[lint]==0.7.2b1
|
|
65
|
+
|
|
66
|
+
[lmm]
|
|
67
|
+
pyautogen[lmm]==0.7.2b1
|
|
68
|
+
|
|
69
|
+
[long-context]
|
|
70
|
+
pyautogen[long-context]==0.7.2b1
|
|
71
|
+
|
|
72
|
+
[mathchat]
|
|
73
|
+
pyautogen[mathchat]==0.7.2b1
|
|
74
|
+
|
|
75
|
+
[mistral]
|
|
76
|
+
pyautogen[mistral]==0.7.2b1
|
|
77
|
+
|
|
78
|
+
[neo4j]
|
|
79
|
+
pyautogen[neo4j]==0.7.2b1
|
|
80
|
+
|
|
81
|
+
[ollama]
|
|
82
|
+
pyautogen[ollama]==0.7.2b1
|
|
83
|
+
|
|
84
|
+
[redis]
|
|
85
|
+
pyautogen[redis]==0.7.2b1
|
|
86
|
+
|
|
87
|
+
[retrievechat]
|
|
88
|
+
pyautogen[retrievechat]==0.7.2b1
|
|
89
|
+
|
|
90
|
+
[retrievechat-mongodb]
|
|
91
|
+
pyautogen[retrievechat-mongodb]==0.7.2b1
|
|
92
|
+
|
|
93
|
+
[retrievechat-pgvector]
|
|
94
|
+
pyautogen[retrievechat-pgvector]==0.7.2b1
|
|
95
|
+
|
|
96
|
+
[retrievechat-qdrant]
|
|
97
|
+
pyautogen[retrievechat-qdrant]==0.7.2b1
|
|
98
|
+
|
|
99
|
+
[teachable]
|
|
100
|
+
pyautogen[teachable]==0.7.2b1
|
|
101
|
+
|
|
102
|
+
[test]
|
|
103
|
+
pyautogen[test]==0.7.2b1
|
|
104
|
+
|
|
105
|
+
[together]
|
|
106
|
+
pyautogen[together]==0.7.2b1
|
|
107
|
+
|
|
108
|
+
[twilio]
|
|
109
|
+
pyautogen[twilio]==0.7.2b1
|
|
110
|
+
|
|
111
|
+
[types]
|
|
112
|
+
pyautogen[types]==0.7.2b1
|
|
113
|
+
|
|
114
|
+
[websockets]
|
|
115
|
+
pyautogen[websockets]==0.7.2b1
|
|
116
|
+
|
|
117
|
+
[websurfer]
|
|
118
|
+
pyautogen[websurfer]==0.7.2b1
|
|
@@ -55,12 +55,9 @@ dependencies = [
|
|
|
55
55
|
"openai>=1.58",
|
|
56
56
|
"diskcache",
|
|
57
57
|
"termcolor",
|
|
58
|
-
"flaml",
|
|
59
|
-
# numpy is installed by flaml, but we want to pin the version to below 2.x (see https://github.com/microsoft/autogen/issues/1960)
|
|
60
|
-
"numpy>=2.1; python_version>='3.13'", # numpy 2.1+ required for Python 3.13
|
|
61
|
-
"numpy>=1.24.0,<2.0.0; python_version<'3.13'", # numpy 1.24+ for older Python versions
|
|
62
58
|
"python-dotenv",
|
|
63
59
|
"tiktoken",
|
|
60
|
+
"numpy",
|
|
64
61
|
# Disallowing 2.6.0 can be removed when this is fixed https://github.com/pydantic/pydantic/issues/8705
|
|
65
62
|
"pydantic>=2.6.1,<3",
|
|
66
63
|
"docker",
|
|
@@ -72,6 +69,13 @@ dependencies = [
|
|
|
72
69
|
|
|
73
70
|
[project.optional-dependencies]
|
|
74
71
|
|
|
72
|
+
flaml = [
|
|
73
|
+
"flaml",
|
|
74
|
+
# numpy is installed by flaml, but we want to pin the version to below 2.x (see https://github.com/microsoft/autogen/issues/1960)
|
|
75
|
+
"numpy>=2.1; python_version>='3.13'", # numpy 2.1+ required for Python 3.13
|
|
76
|
+
"numpy>=1.24.0,<2.0.0; python_version<'3.13'", # numpy 1.24+ for older Python versions
|
|
77
|
+
]
|
|
78
|
+
|
|
75
79
|
# public distributions
|
|
76
80
|
jupyter-executor = [
|
|
77
81
|
"jupyter-kernel-gateway",
|
|
@@ -116,10 +120,10 @@ graph-rag-falkor-db = [
|
|
|
116
120
|
|
|
117
121
|
neo4j = [
|
|
118
122
|
"docx2txt==0.8",
|
|
119
|
-
"llama-index==0.12.
|
|
120
|
-
"llama-index-graph-stores-neo4j==0.4.
|
|
121
|
-
"llama-index-core==0.12.
|
|
122
|
-
"llama-index-readers-web==0.3.
|
|
123
|
+
"llama-index==0.12.11",
|
|
124
|
+
"llama-index-graph-stores-neo4j==0.4.5",
|
|
125
|
+
"llama-index-core==0.12.11",
|
|
126
|
+
"llama-index-readers-web==0.3.4",
|
|
123
127
|
]
|
|
124
128
|
|
|
125
129
|
# used for agentchat_realtime_swarm notebook and realtime agent twilio demo
|
|
@@ -176,40 +180,42 @@ bedrock = ["boto3>=1.34.149"]
|
|
|
176
180
|
|
|
177
181
|
# test dependencies
|
|
178
182
|
test = [
|
|
179
|
-
"ipykernel",
|
|
180
|
-
"nbconvert",
|
|
181
|
-
"nbformat",
|
|
182
|
-
"
|
|
183
|
-
"pytest-
|
|
184
|
-
"pytest
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"fastapi>=0.115.0,<1",
|
|
183
|
+
"ipykernel==6.29.5",
|
|
184
|
+
"nbconvert==7.16.5",
|
|
185
|
+
"nbformat==5.10.4",
|
|
186
|
+
"pytest-cov==6.0.0",
|
|
187
|
+
"pytest-asyncio==0.25.2",
|
|
188
|
+
"pytest==8.3.4",
|
|
189
|
+
"pandas==2.2.3",
|
|
190
|
+
"fastapi==0.115.6",
|
|
188
191
|
]
|
|
189
192
|
|
|
193
|
+
# docs dependencies
|
|
190
194
|
docs = [
|
|
191
|
-
"
|
|
195
|
+
"pdoc3==0.11.5",
|
|
196
|
+
"jinja2==3.1.5",
|
|
192
197
|
"pyyaml==6.0.2",
|
|
193
|
-
"termcolor",
|
|
194
|
-
"nbclient",
|
|
198
|
+
"termcolor==2.5.0",
|
|
199
|
+
"nbclient==0.10.2",
|
|
195
200
|
]
|
|
196
201
|
|
|
197
202
|
types = [
|
|
198
|
-
"mypy==1.
|
|
203
|
+
"mypy==1.14.1",
|
|
199
204
|
"pyautogen[test, jupyter-executor, interop]",
|
|
200
205
|
]
|
|
201
206
|
|
|
202
207
|
lint = [
|
|
203
|
-
"ruff==0.9.
|
|
208
|
+
"ruff==0.9.2",
|
|
204
209
|
"codespell==2.3.0",
|
|
205
210
|
"pyupgrade-directories==0.3.0",
|
|
206
211
|
]
|
|
207
212
|
|
|
208
213
|
dev = [
|
|
214
|
+
"toml==0.10.2",
|
|
209
215
|
"pyautogen[lint,test,types,docs]",
|
|
210
|
-
"pre-commit==4.0
|
|
216
|
+
"pre-commit==4.1.0",
|
|
211
217
|
"detect-secrets==1.5.0",
|
|
212
|
-
"uv==0.5.
|
|
218
|
+
"uv==0.5.21",
|
|
213
219
|
]
|
|
214
220
|
|
|
215
221
|
|
|
@@ -249,6 +255,7 @@ markers = [
|
|
|
249
255
|
"all",
|
|
250
256
|
"openai",
|
|
251
257
|
"gemini",
|
|
258
|
+
"anthropic",
|
|
252
259
|
"redis",
|
|
253
260
|
"docker",
|
|
254
261
|
]
|
|
@@ -263,8 +270,22 @@ exclude = "(.eggs|.git|.hg|.mypy_cache|.venv|_build|buck-out|build|dist)"
|
|
|
263
270
|
fix = true
|
|
264
271
|
line-length = 120
|
|
265
272
|
target-version = 'py39'
|
|
266
|
-
#
|
|
267
|
-
|
|
273
|
+
# Exclude a variety of commonly ignored directories.
|
|
274
|
+
exclude = [
|
|
275
|
+
".eggs",
|
|
276
|
+
".git",
|
|
277
|
+
".mypy_cache",
|
|
278
|
+
".ruff_cache",
|
|
279
|
+
"__pypackages__",
|
|
280
|
+
"_build",
|
|
281
|
+
"build",
|
|
282
|
+
"dist",
|
|
283
|
+
"docs",
|
|
284
|
+
# This file needs to be either upgraded or removed and therefore should be
|
|
285
|
+
# ignore from type checking for now
|
|
286
|
+
"math_utils\\.py$",
|
|
287
|
+
"setup_*.py",
|
|
288
|
+
]
|
|
268
289
|
|
|
269
290
|
[tool.ruff.lint]
|
|
270
291
|
# Enable Pyflakes `E` and `F` codes by default.
|
|
@@ -298,22 +319,6 @@ ignore = ["E501", "F403", "C901",
|
|
|
298
319
|
"D100", "D101", "D102", "D103", "D104",
|
|
299
320
|
"C901", # too complex
|
|
300
321
|
]
|
|
301
|
-
# Exclude a variety of commonly ignored directories.
|
|
302
|
-
exclude = [
|
|
303
|
-
".eggs",
|
|
304
|
-
".git",
|
|
305
|
-
".mypy_cache",
|
|
306
|
-
".ruff_cache",
|
|
307
|
-
"__pypackages__",
|
|
308
|
-
"_build",
|
|
309
|
-
"build",
|
|
310
|
-
"dist",
|
|
311
|
-
"docs",
|
|
312
|
-
# This file needs to be either upgraded or removed and therefore should be
|
|
313
|
-
# ignore from type checking for now
|
|
314
|
-
"math_utils\\.py$",
|
|
315
|
-
"**/cap/py/autogencap/proto/*",
|
|
316
|
-
]
|
|
317
322
|
|
|
318
323
|
[tool.ruff.lint.mccabe]
|
|
319
324
|
# Unlike Flake8, default to a complexity level of 10.
|
|
@@ -341,13 +346,20 @@ files = [
|
|
|
341
346
|
"autogen/interop",
|
|
342
347
|
"autogen/agentchat/realtime_agent",
|
|
343
348
|
"autogen/messages",
|
|
349
|
+
"autogen/import_utils.py",
|
|
350
|
+
"website/*.py",
|
|
344
351
|
"test/test_pydantic.py",
|
|
345
352
|
"test/io",
|
|
346
353
|
"test/tools",
|
|
347
354
|
"test/interop",
|
|
348
355
|
"test/agentchat/realtime_agent",
|
|
349
356
|
"test/messages",
|
|
357
|
+
"test/conftest.py",
|
|
358
|
+
"test/test_import_utils.py",
|
|
359
|
+
"test/test_import.py",
|
|
360
|
+
"test/website",
|
|
350
361
|
]
|
|
362
|
+
|
|
351
363
|
exclude = [
|
|
352
364
|
"autogen/math_utils\\.py",
|
|
353
365
|
"autogen/oai/completion\\.py",
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
+
# this file is autogenerated, please do not edit it directly
|
|
6
|
+
# instead, edit the corresponding setup.jinja file and run the ./scripts/build-setup-files.py script
|
|
7
|
+
|
|
5
8
|
import os
|
|
6
9
|
|
|
7
10
|
import setuptools
|
|
@@ -25,15 +28,22 @@ setuptools.setup(
|
|
|
25
28
|
long_description_content_type="text/markdown",
|
|
26
29
|
install_requires=["pyautogen==" + __version__],
|
|
27
30
|
extras_require={
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"mathchat": ["pyautogen[mathchat]==" + __version__],
|
|
31
|
+
"flaml": ["pyautogen[flaml]==" + __version__],
|
|
32
|
+
"jupyter-executor": ["pyautogen[jupyter-executor]==" + __version__],
|
|
31
33
|
"retrievechat": ["pyautogen[retrievechat]==" + __version__],
|
|
32
34
|
"retrievechat-pgvector": ["pyautogen[retrievechat-pgvector]==" + __version__],
|
|
33
35
|
"retrievechat-mongodb": ["pyautogen[retrievechat-mongodb]==" + __version__],
|
|
34
36
|
"retrievechat-qdrant": ["pyautogen[retrievechat-qdrant]==" + __version__],
|
|
35
37
|
"graph-rag-falkor-db": ["pyautogen[graph-rag-falkor-db]==" + __version__],
|
|
38
|
+
"neo4j": ["pyautogen[neo4j]==" + __version__],
|
|
39
|
+
"twilio": ["pyautogen[twilio]==" + __version__],
|
|
40
|
+
"interop-crewai": ["pyautogen[interop-crewai]==" + __version__],
|
|
41
|
+
"interop-langchain": ["pyautogen[interop-langchain]==" + __version__],
|
|
42
|
+
"interop-pydantic-ai": ["pyautogen[interop-pydantic-ai]==" + __version__],
|
|
43
|
+
"interop": ["pyautogen[interop]==" + __version__],
|
|
36
44
|
"autobuild": ["pyautogen[autobuild]==" + __version__],
|
|
45
|
+
"blendsearch": ["pyautogen[blendsearch]==" + __version__],
|
|
46
|
+
"mathchat": ["pyautogen[mathchat]==" + __version__],
|
|
37
47
|
"captainagent": ["pyautogen[captainagent]==" + __version__],
|
|
38
48
|
"teachable": ["pyautogen[teachable]==" + __version__],
|
|
39
49
|
"lmm": ["pyautogen[lmm]==" + __version__],
|
|
@@ -44,8 +54,6 @@ setuptools.setup(
|
|
|
44
54
|
"redis": ["pyautogen[redis]==" + __version__],
|
|
45
55
|
"cosmosdb": ["pyautogen[cosmosdb]==" + __version__],
|
|
46
56
|
"websockets": ["pyautogen[websockets]==" + __version__],
|
|
47
|
-
"jupyter-executor": ["pyautogen[jupyter-executor]==" + __version__],
|
|
48
|
-
"types": ["pyautogen[types]==" + __version__],
|
|
49
57
|
"long-context": ["pyautogen[long-context]==" + __version__],
|
|
50
58
|
"anthropic": ["pyautogen[anthropic]==" + __version__],
|
|
51
59
|
"cerebras": ["pyautogen[cerebras]==" + __version__],
|
|
@@ -54,12 +62,12 @@ setuptools.setup(
|
|
|
54
62
|
"cohere": ["pyautogen[cohere]==" + __version__],
|
|
55
63
|
"ollama": ["pyautogen[ollama]==" + __version__],
|
|
56
64
|
"bedrock": ["pyautogen[bedrock]==" + __version__],
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
65
|
+
"test": ["pyautogen[test]==" + __version__],
|
|
66
|
+
"docs": ["pyautogen[docs]==" + __version__],
|
|
67
|
+
"types": ["pyautogen[types]==" + __version__],
|
|
68
|
+
"lint": ["pyautogen[lint]==" + __version__],
|
|
69
|
+
"dev": ["pyautogen[dev]==" + __version__],
|
|
70
|
+
|
|
63
71
|
},
|
|
64
72
|
url="https://github.com/ag2ai/ag2",
|
|
65
73
|
author="Chi Wang & Qingyun Wu",
|
|
@@ -15,6 +15,9 @@ from tempfile import TemporaryDirectory
|
|
|
15
15
|
import pytest
|
|
16
16
|
import requests
|
|
17
17
|
|
|
18
|
+
from autogen.browser_utils import SimpleTextBrowser
|
|
19
|
+
from autogen.import_utils import optional_import_block
|
|
20
|
+
|
|
18
21
|
BLOG_POST_URL = "https://docs.ag2.ai/blog/2023-04-21-LLM-tuning-math"
|
|
19
22
|
BLOG_POST_TITLE = "Does Model and Inference Parameter Matter in LLM Applications? - A Case Study for MATH - AG2"
|
|
20
23
|
BLOG_POST_STRING = "Large language models (LLMs) are powerful tools that can generate natural language texts for various applications, such as chatbots, summarization, translation, and more. GPT-4 is currently the state of the art LLM in the world. Is model selection irrelevant? What about inference parameters?"
|
|
@@ -33,12 +36,16 @@ BING_QUERY = "Microsoft"
|
|
|
33
36
|
BING_TITLE = f"{BING_QUERY} - Search"
|
|
34
37
|
BING_STRING = f"A Bing search for '{BING_QUERY}' found"
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
|
|
40
|
+
with optional_import_block() as result:
|
|
41
|
+
import markdownify # noqa: F401
|
|
42
|
+
import pathvalidate # noqa: F401
|
|
43
|
+
import requests
|
|
44
|
+
from bs4 import BeautifulSoup # noqa: F401
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
skip_all = not result.is_successful
|
|
48
|
+
|
|
42
49
|
|
|
43
50
|
try:
|
|
44
51
|
BING_API_KEY = os.environ["BING_API_KEY"]
|
|
@@ -30,12 +30,13 @@ from autogen.code_utils import (
|
|
|
30
30
|
infer_lang,
|
|
31
31
|
is_docker_running,
|
|
32
32
|
)
|
|
33
|
+
from autogen.import_utils import optional_import_block
|
|
33
34
|
|
|
34
|
-
from .conftest import Credentials
|
|
35
|
+
from .conftest import Credentials
|
|
35
36
|
|
|
36
37
|
here = os.path.abspath(os.path.dirname(__file__))
|
|
37
38
|
|
|
38
|
-
if
|
|
39
|
+
if not is_docker_running() or not decide_use_docker(use_docker=None):
|
|
39
40
|
skip_docker_test = True
|
|
40
41
|
else:
|
|
41
42
|
skip_docker_test = False
|
|
@@ -179,6 +180,7 @@ def scrape(url):
|
|
|
179
180
|
assert len(codeblocks) == 1 and codeblocks[0] == ("", "source setup.sh")
|
|
180
181
|
|
|
181
182
|
|
|
183
|
+
@pytest.mark.docker
|
|
182
184
|
@pytest.mark.skipif(skip_docker_test, reason="docker is not running or requested to skip docker tests")
|
|
183
185
|
def test_execute_code(use_docker=True):
|
|
184
186
|
# Test execute code and save the code to a file.
|
|
@@ -243,6 +245,7 @@ def test_execute_code(use_docker=True):
|
|
|
243
245
|
assert isinstance(image, str)
|
|
244
246
|
|
|
245
247
|
|
|
248
|
+
@pytest.mark.docker
|
|
246
249
|
@pytest.mark.skipif(skip_docker_test, reason="docker is not running or requested to skip docker tests")
|
|
247
250
|
def test_execute_code_with_custom_filename_on_docker():
|
|
248
251
|
with tempfile.TemporaryDirectory() as tempdir:
|
|
@@ -257,6 +260,7 @@ def test_execute_code_with_custom_filename_on_docker():
|
|
|
257
260
|
assert image == "python:codetest.py"
|
|
258
261
|
|
|
259
262
|
|
|
263
|
+
@pytest.mark.docker
|
|
260
264
|
@pytest.mark.skipif(
|
|
261
265
|
skip_docker_test,
|
|
262
266
|
reason="docker is not running or requested to skip docker tests",
|
|
@@ -387,9 +391,9 @@ def test_create_virtual_env_with_extra_args():
|
|
|
387
391
|
|
|
388
392
|
|
|
389
393
|
def _test_improve(credentials_all: Credentials):
|
|
390
|
-
|
|
394
|
+
with optional_import_block() as result:
|
|
391
395
|
import openai # noqa: F401
|
|
392
|
-
|
|
396
|
+
if not result.is_successful:
|
|
393
397
|
return
|
|
394
398
|
config_list = credentials_all.config_list
|
|
395
399
|
improved, _ = improve_function(
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Copyright (c) 2023 - 2024, Owners of https://github.com/ag2ai
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
#
|
|
5
|
+
# Portions derived from https://github.com/microsoft/autogen are under the MIT License.
|
|
6
|
+
# SPDX-License-Identifier: MIT
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
import pytest
|
|
10
|
+
|
|
11
|
+
from .conftest import Credentials, credentials_all_llms
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@pytest.mark.parametrize("credentials_from_test_param", credentials_all_llms, indirect=True)
|
|
15
|
+
def test_credentials_from_test_param_fixture(
|
|
16
|
+
credentials_from_test_param: Credentials,
|
|
17
|
+
request: pytest.FixtureRequest,
|
|
18
|
+
) -> None:
|
|
19
|
+
# Get the parameter name request node
|
|
20
|
+
current_llm = request.node.callspec.id
|
|
21
|
+
|
|
22
|
+
assert current_llm is not None
|
|
23
|
+
assert isinstance(credentials_from_test_param, Credentials)
|
|
24
|
+
|
|
25
|
+
first_config = credentials_from_test_param.config_list[0]
|
|
26
|
+
if "gpt_4" in current_llm:
|
|
27
|
+
if "api_type" in first_config:
|
|
28
|
+
assert first_config["api_type"] == "openai"
|
|
29
|
+
elif "gemini" in current_llm:
|
|
30
|
+
assert first_config["api_type"] == "google"
|
|
31
|
+
elif "anthropic" in current_llm:
|
|
32
|
+
assert first_config["api_type"] == "anthropic"
|
|
33
|
+
else:
|
|
34
|
+
assert False, f"Unknown LLM fixture: {current_llm}"
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Copyright (c) 2023 - 2024, Owners of https://github.com/ag2ai
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
import importlib
|
|
7
|
+
import pkgutil
|
|
8
|
+
import sys
|
|
9
|
+
from collections.abc import Iterator
|
|
10
|
+
from contextlib import contextmanager
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Optional
|
|
13
|
+
|
|
14
|
+
import pytest
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@contextmanager
|
|
18
|
+
def add_to_sys_path(path: Optional[Path]) -> Iterator[None]:
|
|
19
|
+
if path is None:
|
|
20
|
+
yield
|
|
21
|
+
return
|
|
22
|
+
|
|
23
|
+
if not path.exists():
|
|
24
|
+
raise ValueError(f"Path {path} does not exist")
|
|
25
|
+
|
|
26
|
+
sys.path.append(str(path))
|
|
27
|
+
try:
|
|
28
|
+
yield
|
|
29
|
+
finally:
|
|
30
|
+
sys.path.remove(str(path))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def list_submodules(module_name: str, *, include_path: Optional[Path] = None, include_root: bool = True) -> list[str]:
|
|
34
|
+
"""List all submodules of a given module.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
module_name (str): The name of the module to list submodules for.
|
|
38
|
+
include_path (Optional[Path], optional): The path to the module. Defaults to None.
|
|
39
|
+
include_root (bool, optional): Whether to include the root module in the list. Defaults to True.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
list: A list of submodule names.
|
|
43
|
+
"""
|
|
44
|
+
with add_to_sys_path(include_path):
|
|
45
|
+
try:
|
|
46
|
+
module = importlib.import_module(module_name) # nosemgrep
|
|
47
|
+
except Exception:
|
|
48
|
+
return []
|
|
49
|
+
|
|
50
|
+
# Get the path of the module. This is necessary to find its submodules.
|
|
51
|
+
module_path = module.__path__
|
|
52
|
+
|
|
53
|
+
# Initialize an empty list to store the names of submodules
|
|
54
|
+
submodules = [module_name] if include_root else []
|
|
55
|
+
|
|
56
|
+
# Iterate over the submodules in the module's path
|
|
57
|
+
for _, name, ispkg in pkgutil.iter_modules(module_path, prefix=f"{module_name}."):
|
|
58
|
+
# Add the name of each submodule to the list
|
|
59
|
+
submodules.append(name)
|
|
60
|
+
|
|
61
|
+
if ispkg:
|
|
62
|
+
submodules.extend(list_submodules(name, include_root=False))
|
|
63
|
+
|
|
64
|
+
# Return the list of submodule names
|
|
65
|
+
return submodules
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def test_list_submodules() -> None:
|
|
69
|
+
# Specify the name of the module you want to inspect
|
|
70
|
+
module_name = "autogen"
|
|
71
|
+
|
|
72
|
+
# Get the list of submodules for the specified module
|
|
73
|
+
submodules = list_submodules(module_name)
|
|
74
|
+
|
|
75
|
+
assert len(submodules) > 0
|
|
76
|
+
assert "autogen" in submodules
|
|
77
|
+
assert "autogen.io" in submodules
|
|
78
|
+
assert "autogen.coding.jupyter" in submodules
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# todo: we should always run this
|
|
82
|
+
@pytest.mark.parametrize("module", list_submodules("autogen"))
|
|
83
|
+
def test_submodules(module: str) -> None:
|
|
84
|
+
importlib.import_module(module) # nosemgrep
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Copyright (c) 2023 - 2024, Owners of https://github.com/ag2ai
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
from typing import Any, Type
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
from autogen.import_utils import optional_import_block, require_optional_import
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TestOptionalImportBlock:
|
|
13
|
+
def test_optional_import_block(self) -> None:
|
|
14
|
+
with optional_import_block():
|
|
15
|
+
import ast
|
|
16
|
+
|
|
17
|
+
import some_module
|
|
18
|
+
import some_other_module
|
|
19
|
+
|
|
20
|
+
assert ast is not None
|
|
21
|
+
with pytest.raises(
|
|
22
|
+
UnboundLocalError,
|
|
23
|
+
match=r"(local variable 'some_module' referenced before assignment|cannot access local variable 'some_module' where it is not associated with a value)",
|
|
24
|
+
):
|
|
25
|
+
some_module
|
|
26
|
+
|
|
27
|
+
with pytest.raises(
|
|
28
|
+
UnboundLocalError,
|
|
29
|
+
match=r"(local variable 'some_other_module' referenced before assignment|cannot access local variable 'some_other_module' where it is not associated with a value)",
|
|
30
|
+
):
|
|
31
|
+
some_other_module
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class TestRequiresOptionalImportCallables:
|
|
35
|
+
def test_function_attributes(self) -> None:
|
|
36
|
+
def dummy_function() -> None:
|
|
37
|
+
"""Dummy function to test requires_optional_import"""
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
dummy_function.__module__ = "some_random_module.dummy_stuff"
|
|
41
|
+
|
|
42
|
+
actual = require_optional_import("some_optional_module", "optional_dep")(dummy_function)
|
|
43
|
+
|
|
44
|
+
assert actual is not None
|
|
45
|
+
assert actual.__module__ == "some_random_module.dummy_stuff"
|
|
46
|
+
assert actual.__name__ == "dummy_function"
|
|
47
|
+
assert actual.__doc__ == "Dummy function to test requires_optional_import"
|
|
48
|
+
|
|
49
|
+
with pytest.raises(
|
|
50
|
+
ImportError,
|
|
51
|
+
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\]'",
|
|
52
|
+
):
|
|
53
|
+
actual()
|
|
54
|
+
|
|
55
|
+
def test_function_call(self) -> None:
|
|
56
|
+
@require_optional_import("some_optional_module", "optional_dep")
|
|
57
|
+
def dummy_function() -> None:
|
|
58
|
+
"""Dummy function to test requires_optional_import"""
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
with pytest.raises(
|
|
62
|
+
ImportError,
|
|
63
|
+
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\]'",
|
|
64
|
+
):
|
|
65
|
+
dummy_function()
|
|
66
|
+
|
|
67
|
+
def test_method_attributes(self) -> None:
|
|
68
|
+
class DummyClass:
|
|
69
|
+
def dummy_method(self) -> None:
|
|
70
|
+
"""Dummy method to test requires_optional_import"""
|
|
71
|
+
pass
|
|
72
|
+
|
|
73
|
+
assert hasattr(DummyClass.dummy_method, "__module__")
|
|
74
|
+
assert DummyClass.dummy_method.__module__ == "test.test_import_utils"
|
|
75
|
+
|
|
76
|
+
DummyClass.__module__ = "some_random_module.dummy_stuff"
|
|
77
|
+
DummyClass.dummy_method.__module__ = "some_random_module.dummy_stuff"
|
|
78
|
+
|
|
79
|
+
DummyClass.dummy_method = require_optional_import("some_optional_module", "optional_dep")( # type: ignore[method-assign]
|
|
80
|
+
DummyClass.dummy_method
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
assert DummyClass.dummy_method is not None
|
|
84
|
+
assert DummyClass.dummy_method.__module__ == "some_random_module.dummy_stuff"
|
|
85
|
+
assert DummyClass.dummy_method.__name__ == "dummy_method"
|
|
86
|
+
assert DummyClass.dummy_method.__doc__ == "Dummy method to test requires_optional_import"
|
|
87
|
+
|
|
88
|
+
dummy = DummyClass()
|
|
89
|
+
with pytest.raises(
|
|
90
|
+
ImportError,
|
|
91
|
+
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\]",
|
|
92
|
+
):
|
|
93
|
+
dummy.dummy_method()
|
|
94
|
+
|
|
95
|
+
def test_method_call(self) -> None:
|
|
96
|
+
class DummyClass:
|
|
97
|
+
@require_optional_import("some_optional_module", "optional_dep")
|
|
98
|
+
def dummy_method(self) -> None:
|
|
99
|
+
"""Dummy method to test requires_optional_import"""
|
|
100
|
+
pass
|
|
101
|
+
|
|
102
|
+
dummy = DummyClass()
|
|
103
|
+
with pytest.raises(
|
|
104
|
+
ImportError,
|
|
105
|
+
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\]'",
|
|
106
|
+
):
|
|
107
|
+
dummy.dummy_method()
|
|
108
|
+
|
|
109
|
+
def test_static_call(self) -> None:
|
|
110
|
+
class DummyClass:
|
|
111
|
+
@require_optional_import("some_optional_module", "optional_dep")
|
|
112
|
+
@staticmethod
|
|
113
|
+
def dummy_static_function() -> None:
|
|
114
|
+
"""Dummy static function to test requires_optional_import"""
|
|
115
|
+
pass
|
|
116
|
+
|
|
117
|
+
dummy = DummyClass()
|
|
118
|
+
with pytest.raises(
|
|
119
|
+
ImportError,
|
|
120
|
+
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\]'",
|
|
121
|
+
):
|
|
122
|
+
dummy.dummy_static_function()
|
|
123
|
+
|
|
124
|
+
def test_property_call(self) -> None:
|
|
125
|
+
class DummyClass:
|
|
126
|
+
@property
|
|
127
|
+
@require_optional_import("some_optional_module", "optional_dep")
|
|
128
|
+
def dummy_property(self) -> int:
|
|
129
|
+
"""Dummy property to test requires_optional_import"""
|
|
130
|
+
return 4
|
|
131
|
+
|
|
132
|
+
dummy = DummyClass()
|
|
133
|
+
with pytest.raises(
|
|
134
|
+
ImportError,
|
|
135
|
+
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\]'",
|
|
136
|
+
):
|
|
137
|
+
dummy.dummy_property
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class TestRequiresOptionalImportClasses:
|
|
141
|
+
@pytest.fixture
|
|
142
|
+
def dummy_cls(self) -> Type[Any]:
|
|
143
|
+
@require_optional_import("some_optional_module", "optional_dep")
|
|
144
|
+
class DummyClass:
|
|
145
|
+
def dummy_method(self) -> None:
|
|
146
|
+
"""Dummy method to test requires_optional_import"""
|
|
147
|
+
pass
|
|
148
|
+
|
|
149
|
+
@staticmethod
|
|
150
|
+
def dummy_static_method() -> None:
|
|
151
|
+
"""Dummy static method to test requires_optional_import"""
|
|
152
|
+
pass
|
|
153
|
+
|
|
154
|
+
@classmethod
|
|
155
|
+
def dummy_class_method(cls) -> None:
|
|
156
|
+
"""Dummy class method to test requires_optional_import"""
|
|
157
|
+
pass
|
|
158
|
+
|
|
159
|
+
@property
|
|
160
|
+
def dummy_property(self) -> int:
|
|
161
|
+
"""Dummy property to test requires_optional_import"""
|
|
162
|
+
return 4
|
|
163
|
+
|
|
164
|
+
return DummyClass
|
|
165
|
+
|
|
166
|
+
def test_class_init_call(self, dummy_cls: Type[Any]) -> None:
|
|
167
|
+
with pytest.raises(
|
|
168
|
+
ImportError,
|
|
169
|
+
match=r"Module 'some_optional_module' needed for __init__ is missing, please install it using 'pip install ag2\[optional_dep\]'",
|
|
170
|
+
):
|
|
171
|
+
dummy_cls()
|
|
@@ -11,12 +11,12 @@ import sys
|
|
|
11
11
|
|
|
12
12
|
import pytest
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
from autogen.import_utils import optional_import_block
|
|
15
|
+
|
|
16
|
+
with optional_import_block() as result:
|
|
15
17
|
import openai # noqa: F401
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
else:
|
|
19
|
-
skip = False
|
|
18
|
+
|
|
19
|
+
skip = not result.is_successful
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
here = os.path.abspath(os.path.dirname(__file__))
|
|
@@ -24,7 +24,7 @@ here = os.path.abspath(os.path.dirname(__file__))
|
|
|
24
24
|
|
|
25
25
|
def run_notebook(input_nb, output_nb="executed_openai_notebook.ipynb", save=False):
|
|
26
26
|
import nbformat
|
|
27
|
-
from nbconvert.preprocessors import
|
|
27
|
+
from nbconvert.preprocessors import ExecutePreprocessor
|
|
28
28
|
|
|
29
29
|
try:
|
|
30
30
|
nb_loc = os.path.join(here, os.pardir, "notebook")
|
|
@@ -44,8 +44,6 @@ def run_notebook(input_nb, output_nb="executed_openai_notebook.ipynb", save=Fals
|
|
|
44
44
|
nb_output_file.write(output["text"].strip() + "\n")
|
|
45
45
|
elif "data" in output and "text/plain" in output["data"]:
|
|
46
46
|
nb_output_file.write(output["data"]["text/plain"].strip() + "\n")
|
|
47
|
-
except CellExecutionError:
|
|
48
|
-
raise
|
|
49
47
|
finally:
|
|
50
48
|
if save:
|
|
51
49
|
with open(os.path.join(here, output_nb), "w", encoding="utf-8") as nb_executed_file:
|
|
@@ -8,34 +8,36 @@
|
|
|
8
8
|
|
|
9
9
|
"""Unit test for retrieve_utils.py"""
|
|
10
10
|
|
|
11
|
+
import os
|
|
12
|
+
|
|
11
13
|
import pytest
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
from autogen.import_utils import optional_import_block
|
|
16
|
+
from autogen.retrieve_utils import (
|
|
17
|
+
create_vector_db_from_dir,
|
|
18
|
+
extract_text_from_pdf,
|
|
19
|
+
get_files_from_dir,
|
|
20
|
+
is_url,
|
|
21
|
+
parse_html_to_markdown,
|
|
22
|
+
query_vector_db,
|
|
23
|
+
split_files_to_chunks,
|
|
24
|
+
split_text_to_chunks,
|
|
25
|
+
)
|
|
26
|
+
from autogen.token_count_utils import count_token
|
|
27
|
+
|
|
28
|
+
with optional_import_block() as result:
|
|
29
|
+
import bs4 # noqa: F401
|
|
14
30
|
import chromadb
|
|
31
|
+
import markdownify # noqa: F401
|
|
32
|
+
import pypdf # noqa: F401
|
|
15
33
|
|
|
16
|
-
from autogen.retrieve_utils import (
|
|
17
|
-
create_vector_db_from_dir,
|
|
18
|
-
extract_text_from_pdf,
|
|
19
|
-
get_files_from_dir,
|
|
20
|
-
is_url,
|
|
21
|
-
parse_html_to_markdown,
|
|
22
|
-
query_vector_db,
|
|
23
|
-
split_files_to_chunks,
|
|
24
|
-
split_text_to_chunks,
|
|
25
|
-
)
|
|
26
|
-
from autogen.token_count_utils import count_token
|
|
27
|
-
except ImportError:
|
|
28
|
-
skip = True
|
|
29
|
-
else:
|
|
30
|
-
skip = False
|
|
31
|
-
import os
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
skip = not result.is_successful
|
|
36
|
+
|
|
37
|
+
with optional_import_block() as result:
|
|
34
38
|
from unstructured.partition.auto import partition # noqa: F401
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
except ImportError:
|
|
38
|
-
HAS_UNSTRUCTURED = False
|
|
40
|
+
HAS_UNSTRUCTURED = result.is_successful
|
|
39
41
|
|
|
40
42
|
test_dir = os.path.join(os.path.dirname(__file__), "test_files")
|
|
41
43
|
expected_text = """AutoGen is an advanced tool designed to assist developers in harnessing the capabilities
|
|
@@ -136,9 +138,9 @@ class TestRetrieveUtils:
|
|
|
136
138
|
assert isinstance(results, dict) and any("autogen" in res[0].lower() for res in results.get("documents", []))
|
|
137
139
|
|
|
138
140
|
def test_custom_vector_db(self):
|
|
139
|
-
|
|
141
|
+
with optional_import_block() as result:
|
|
140
142
|
import lancedb
|
|
141
|
-
|
|
143
|
+
if not result.is_successful:
|
|
142
144
|
return
|
|
143
145
|
from autogen.agentchat.contrib.retrieve_user_proxy_agent import RetrieveUserProxyAgent
|
|
144
146
|
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
import pytest
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
from autogen.agentchat.contrib.img_utils import num_tokens_from_gpt_image # noqa: F401
|
|
11
|
+
from autogen.import_utils import optional_import_block
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
with optional_import_block() as result:
|
|
14
|
+
from PIL import Image # noqa: F401
|
|
15
|
+
|
|
16
|
+
img_util_imported = result.is_successful
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
from autogen.token_count_utils import (
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
pyautogen==0.7.1
|
|
2
|
-
|
|
3
|
-
[anthropic]
|
|
4
|
-
pyautogen[anthropic]==0.7.1
|
|
5
|
-
|
|
6
|
-
[autobuild]
|
|
7
|
-
pyautogen[autobuild]==0.7.1
|
|
8
|
-
|
|
9
|
-
[bedrock]
|
|
10
|
-
pyautogen[bedrock]==0.7.1
|
|
11
|
-
|
|
12
|
-
[blendsearch]
|
|
13
|
-
pyautogen[blendsearch]==0.7.1
|
|
14
|
-
|
|
15
|
-
[captainagent]
|
|
16
|
-
pyautogen[captainagent]==0.7.1
|
|
17
|
-
|
|
18
|
-
[cerebras]
|
|
19
|
-
pyautogen[cerebras]==0.7.1
|
|
20
|
-
|
|
21
|
-
[cohere]
|
|
22
|
-
pyautogen[cohere]==0.7.1
|
|
23
|
-
|
|
24
|
-
[cosmosdb]
|
|
25
|
-
pyautogen[cosmosdb]==0.7.1
|
|
26
|
-
|
|
27
|
-
[gemini]
|
|
28
|
-
pyautogen[gemini]==0.7.1
|
|
29
|
-
|
|
30
|
-
[graph]
|
|
31
|
-
pyautogen[graph]==0.7.1
|
|
32
|
-
|
|
33
|
-
[graph-rag-falkor-db]
|
|
34
|
-
pyautogen[graph-rag-falkor-db]==0.7.1
|
|
35
|
-
|
|
36
|
-
[groq]
|
|
37
|
-
pyautogen[groq]==0.7.1
|
|
38
|
-
|
|
39
|
-
[interop]
|
|
40
|
-
pyautogen[interop]==0.7.1
|
|
41
|
-
|
|
42
|
-
[interop-crewai]
|
|
43
|
-
pyautogen[interop-crewai]==0.7.1
|
|
44
|
-
|
|
45
|
-
[interop-langchain]
|
|
46
|
-
pyautogen[interop-langchain]==0.7.1
|
|
47
|
-
|
|
48
|
-
[interop-pydantic-ai]
|
|
49
|
-
pyautogen[interop-pydantic-ai]==0.7.1
|
|
50
|
-
|
|
51
|
-
[jupyter-executor]
|
|
52
|
-
pyautogen[jupyter-executor]==0.7.1
|
|
53
|
-
|
|
54
|
-
[lmm]
|
|
55
|
-
pyautogen[lmm]==0.7.1
|
|
56
|
-
|
|
57
|
-
[long-context]
|
|
58
|
-
pyautogen[long-context]==0.7.1
|
|
59
|
-
|
|
60
|
-
[mathchat]
|
|
61
|
-
pyautogen[mathchat]==0.7.1
|
|
62
|
-
|
|
63
|
-
[mistral]
|
|
64
|
-
pyautogen[mistral]==0.7.1
|
|
65
|
-
|
|
66
|
-
[neo4j]
|
|
67
|
-
pyautogen[neo4j]==0.7.1
|
|
68
|
-
|
|
69
|
-
[ollama]
|
|
70
|
-
pyautogen[ollama]==0.7.1
|
|
71
|
-
|
|
72
|
-
[redis]
|
|
73
|
-
pyautogen[redis]==0.7.1
|
|
74
|
-
|
|
75
|
-
[retrievechat]
|
|
76
|
-
pyautogen[retrievechat]==0.7.1
|
|
77
|
-
|
|
78
|
-
[retrievechat-mongodb]
|
|
79
|
-
pyautogen[retrievechat-mongodb]==0.7.1
|
|
80
|
-
|
|
81
|
-
[retrievechat-pgvector]
|
|
82
|
-
pyautogen[retrievechat-pgvector]==0.7.1
|
|
83
|
-
|
|
84
|
-
[retrievechat-qdrant]
|
|
85
|
-
pyautogen[retrievechat-qdrant]==0.7.1
|
|
86
|
-
|
|
87
|
-
[teachable]
|
|
88
|
-
pyautogen[teachable]==0.7.1
|
|
89
|
-
|
|
90
|
-
[test]
|
|
91
|
-
pyautogen[test]==0.7.1
|
|
92
|
-
|
|
93
|
-
[together]
|
|
94
|
-
pyautogen[together]==0.7.1
|
|
95
|
-
|
|
96
|
-
[twilio]
|
|
97
|
-
pyautogen[twilio]==0.7.1
|
|
98
|
-
|
|
99
|
-
[types]
|
|
100
|
-
pyautogen[types]==0.7.1
|
|
101
|
-
|
|
102
|
-
[websockets]
|
|
103
|
-
pyautogen[websockets]==0.7.1
|
|
104
|
-
|
|
105
|
-
[websurfer]
|
|
106
|
-
pyautogen[websurfer]==0.7.1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|