ag2 0.7.0__tar.gz → 0.7.1__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.0/ag2.egg-info → ag2-0.7.1}/PKG-INFO +1 -1
- {ag2-0.7.0 → ag2-0.7.1/ag2.egg-info}/PKG-INFO +1 -1
- ag2-0.7.1/ag2.egg-info/requires.txt +106 -0
- {ag2-0.7.0 → ag2-0.7.1}/pyproject.toml +86 -18
- {ag2-0.7.0 → ag2-0.7.1}/test/test_browser_utils.py +1 -1
- {ag2-0.7.0 → ag2-0.7.1}/test/test_code_utils.py +2 -4
- {ag2-0.7.0 → ag2-0.7.1}/test/test_graph_utils.py +0 -1
- {ag2-0.7.0 → ag2-0.7.1}/test/test_logging.py +10 -10
- {ag2-0.7.0 → ag2-0.7.1}/test/test_notebook.py +13 -5
- {ag2-0.7.0 → ag2-0.7.1}/test/test_pydantic.py +2 -2
- {ag2-0.7.0 → ag2-0.7.1}/test/test_retrieve_utils.py +3 -4
- {ag2-0.7.0 → ag2-0.7.1}/test/test_token_count.py +28 -1
- ag2-0.7.0/ag2.egg-info/requires.txt +0 -106
- {ag2-0.7.0 → ag2-0.7.1}/LICENSE +0 -0
- {ag2-0.7.0 → ag2-0.7.1}/NOTICE.md +0 -0
- {ag2-0.7.0 → ag2-0.7.1}/README.md +0 -0
- {ag2-0.7.0 → ag2-0.7.1}/ag2.egg-info/SOURCES.txt +0 -0
- {ag2-0.7.0 → ag2-0.7.1}/ag2.egg-info/dependency_links.txt +0 -0
- {ag2-0.7.0 → ag2-0.7.1}/ag2.egg-info/top_level.txt +0 -0
- {ag2-0.7.0 → ag2-0.7.1}/setup.cfg +0 -0
- {ag2-0.7.0 → ag2-0.7.1}/setup_ag2.py +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
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
|
|
@@ -62,7 +62,7 @@ dependencies = [
|
|
|
62
62
|
"python-dotenv",
|
|
63
63
|
"tiktoken",
|
|
64
64
|
# Disallowing 2.6.0 can be removed when this is fixed https://github.com/pydantic/pydantic/issues/8705
|
|
65
|
-
"pydantic>=
|
|
65
|
+
"pydantic>=2.6.1,<3",
|
|
66
66
|
"docker",
|
|
67
67
|
"packaging",
|
|
68
68
|
"websockets>=14,<15",
|
|
@@ -71,6 +71,7 @@ dependencies = [
|
|
|
71
71
|
]
|
|
72
72
|
|
|
73
73
|
[project.optional-dependencies]
|
|
74
|
+
|
|
74
75
|
# public distributions
|
|
75
76
|
jupyter-executor = [
|
|
76
77
|
"jupyter-kernel-gateway",
|
|
@@ -131,6 +132,8 @@ twilio = [
|
|
|
131
132
|
interop-crewai = [
|
|
132
133
|
"crewai[tools]>=0.86,<1; python_version>='3.10' and python_version<'3.13'",
|
|
133
134
|
"weaviate-client==4.10.2; python_version>='3.10' and python_version<'3.13'",
|
|
135
|
+
# crewai uses litellm, litellm introduced uvloop as deps with version 1.57.5 which does not support win32
|
|
136
|
+
"litellm<1.57.5; sys_platform=='win32'",
|
|
134
137
|
]
|
|
135
138
|
interop-langchain = ["langchain-community>=0.3.12,<1"]
|
|
136
139
|
interop-pydantic-ai = ["pydantic-ai==0.0.13"]
|
|
@@ -138,11 +141,6 @@ interop =[
|
|
|
138
141
|
"pyautogen[interop-crewai, interop-langchain, interop-pydantic-ai]",
|
|
139
142
|
]
|
|
140
143
|
|
|
141
|
-
types = [
|
|
142
|
-
"mypy==1.9.0",
|
|
143
|
-
"pyautogen[test, jupyter-executor, interop]",
|
|
144
|
-
]
|
|
145
|
-
|
|
146
144
|
# pysqlite3-binary used so it doesn't need to compile pysqlite3
|
|
147
145
|
autobuild = ["chromadb", "sentence-transformers", "huggingface-hub", "pysqlite3-binary"]
|
|
148
146
|
|
|
@@ -171,10 +169,12 @@ cerebras = ["cerebras_cloud_sdk>=1.0.0"]
|
|
|
171
169
|
mistral = ["mistralai>=1.0.1"]
|
|
172
170
|
groq = ["groq>=0.9.0"]
|
|
173
171
|
cohere = ["cohere>=5.5.8"]
|
|
174
|
-
ollama = ["ollama>=0.
|
|
172
|
+
ollama = ["ollama>=0.4.5", "fix_busted_json>=0.0.18"]
|
|
175
173
|
bedrock = ["boto3>=1.34.149"]
|
|
176
174
|
|
|
177
|
-
|
|
175
|
+
## dev dependencies
|
|
176
|
+
|
|
177
|
+
# test dependencies
|
|
178
178
|
test = [
|
|
179
179
|
"ipykernel",
|
|
180
180
|
"nbconvert",
|
|
@@ -187,6 +187,32 @@ test = [
|
|
|
187
187
|
"fastapi>=0.115.0,<1",
|
|
188
188
|
]
|
|
189
189
|
|
|
190
|
+
docs = [
|
|
191
|
+
"pydoc-markdown",
|
|
192
|
+
"pyyaml==6.0.2",
|
|
193
|
+
"termcolor",
|
|
194
|
+
"nbclient",
|
|
195
|
+
]
|
|
196
|
+
|
|
197
|
+
types = [
|
|
198
|
+
"mypy==1.9.0",
|
|
199
|
+
"pyautogen[test, jupyter-executor, interop]",
|
|
200
|
+
]
|
|
201
|
+
|
|
202
|
+
lint = [
|
|
203
|
+
"ruff==0.9.1",
|
|
204
|
+
"codespell==2.3.0",
|
|
205
|
+
"pyupgrade-directories==0.3.0",
|
|
206
|
+
]
|
|
207
|
+
|
|
208
|
+
dev = [
|
|
209
|
+
"pyautogen[lint,test,types,docs]",
|
|
210
|
+
"pre-commit==4.0.1",
|
|
211
|
+
"detect-secrets==1.5.0",
|
|
212
|
+
"uv==0.5.16",
|
|
213
|
+
]
|
|
214
|
+
|
|
215
|
+
|
|
190
216
|
[project.urls]
|
|
191
217
|
Homepage = "https://ag2.ai/"
|
|
192
218
|
Documentation = "https://docs.ag2.ai/docs/Home"
|
|
@@ -215,7 +241,17 @@ exclude = ["test", "notebook"]
|
|
|
215
241
|
|
|
216
242
|
[tool.pytest.ini_options]
|
|
217
243
|
addopts = '--cov=. --cov-append --cov-branch --cov-report=xml -m "not conda"'
|
|
218
|
-
|
|
244
|
+
testpaths = [
|
|
245
|
+
"test",
|
|
246
|
+
]
|
|
247
|
+
markers = [
|
|
248
|
+
"conda: test related to conda forge distribution",
|
|
249
|
+
"all",
|
|
250
|
+
"openai",
|
|
251
|
+
"gemini",
|
|
252
|
+
"redis",
|
|
253
|
+
"docker",
|
|
254
|
+
]
|
|
219
255
|
|
|
220
256
|
[tool.black]
|
|
221
257
|
# https://github.com/psf/black
|
|
@@ -224,21 +260,44 @@ exclude = "(.eggs|.git|.hg|.mypy_cache|.venv|_build|buck-out|build|dist)"
|
|
|
224
260
|
|
|
225
261
|
|
|
226
262
|
[tool.ruff]
|
|
263
|
+
fix = true
|
|
227
264
|
line-length = 120
|
|
265
|
+
target-version = 'py39'
|
|
266
|
+
#include = ["autogen", "test", "docs"]
|
|
267
|
+
#exclude = []
|
|
228
268
|
|
|
229
269
|
[tool.ruff.lint]
|
|
230
270
|
# Enable Pyflakes `E` and `F` codes by default.
|
|
231
271
|
select = [
|
|
232
|
-
"E",
|
|
233
|
-
"W",
|
|
234
|
-
"
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
"
|
|
272
|
+
"E", # pycodestyle errors https://docs.astral.sh/ruff/rules/#error-e
|
|
273
|
+
"W", # pycodestyle warnings https://docs.astral.sh/ruff/rules/#warning-w
|
|
274
|
+
"C90", # mccabe https://docs.astral.sh/ruff/rules/#mccabe-c90
|
|
275
|
+
"N", # pep8-naming https://docs.astral.sh/ruff/rules/#pep8-naming-n
|
|
276
|
+
# "D", # pydocstyle https://docs.astral.sh/ruff/rules/#pydocstyle-d
|
|
277
|
+
"I", # isort https://docs.astral.sh/ruff/rules/#isort-i
|
|
278
|
+
"F", # pyflakes https://docs.astral.sh/ruff/rules/#pyflakes-f
|
|
279
|
+
"ASYNC", # flake8-async https://docs.astral.sh/ruff/rules/#flake8-async-async
|
|
280
|
+
# "C4", # flake8-comprehensions https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
|
|
281
|
+
# "B", # flake8-bugbear https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
|
|
282
|
+
"Q", # flake8-quotes https://docs.astral.sh/ruff/rules/#flake8-quotes-q
|
|
283
|
+
# "T20", # flake8-print https://docs.astral.sh/ruff/rules/#flake8-print-t20
|
|
284
|
+
# "SIM", # flake8-simplify https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
|
|
285
|
+
# "PT", # flake8-pytest-style https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
|
|
286
|
+
# "PTH", # flake8-use-pathlib https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
|
|
287
|
+
# "TCH", # flake8-type-checking https://docs.astral.sh/ruff/rules/#flake8-type-checking-tch
|
|
288
|
+
# "RUF", # Ruff-specific rules https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
|
|
289
|
+
# "PERF", # Perflint https://docs.astral.sh/ruff/rules/#perflint-perf
|
|
290
|
+
"RUF022", # Sort __all__ https://docs.astral.sh/ruff/rules/unsorted-dunder-all/
|
|
239
291
|
]
|
|
240
|
-
ignore = ["E501", "F401", "F403", "C901"]
|
|
241
292
|
|
|
293
|
+
ignore = ["E501", "F403", "C901",
|
|
294
|
+
"E402",
|
|
295
|
+
"E721",
|
|
296
|
+
"ASYNC109",
|
|
297
|
+
"E501", # line too long, handled by formatter later
|
|
298
|
+
"D100", "D101", "D102", "D103", "D104",
|
|
299
|
+
"C901", # too complex
|
|
300
|
+
]
|
|
242
301
|
# Exclude a variety of commonly ignored directories.
|
|
243
302
|
exclude = [
|
|
244
303
|
".eggs",
|
|
@@ -255,12 +314,21 @@ exclude = [
|
|
|
255
314
|
"math_utils\\.py$",
|
|
256
315
|
"**/cap/py/autogencap/proto/*",
|
|
257
316
|
]
|
|
258
|
-
unfixable = ["F401"]
|
|
259
317
|
|
|
260
318
|
[tool.ruff.lint.mccabe]
|
|
261
319
|
# Unlike Flake8, default to a complexity level of 10.
|
|
262
320
|
max-complexity = 10
|
|
263
321
|
|
|
322
|
+
[tool.ruff.lint.isort]
|
|
323
|
+
case-sensitive = true
|
|
324
|
+
|
|
325
|
+
[tool.ruff.format]
|
|
326
|
+
docstring-code-format = true
|
|
327
|
+
|
|
328
|
+
[tool.ruff.lint.pydocstyle]
|
|
329
|
+
convention = "google"
|
|
330
|
+
|
|
331
|
+
|
|
264
332
|
[tool.mypy]
|
|
265
333
|
files = [
|
|
266
334
|
"autogen/logger",
|
|
@@ -167,7 +167,7 @@ def test_bing_search():
|
|
|
167
167
|
)
|
|
168
168
|
|
|
169
169
|
assert BING_STRING in browser.visit_page("bing: " + BING_QUERY)
|
|
170
|
-
assert
|
|
170
|
+
assert browser.page_title == BING_TITLE
|
|
171
171
|
assert len(browser.viewport_pages) == 1
|
|
172
172
|
assert browser.viewport_pages[0] == (0, len(browser.page_content))
|
|
173
173
|
|
|
@@ -161,9 +161,7 @@ def scrape(url):
|
|
|
161
161
|
text = soup.find("div", {"id": "bodyContent"}).text
|
|
162
162
|
return title, text
|
|
163
163
|
```
|
|
164
|
-
""".replace(
|
|
165
|
-
"\n", "\r\n"
|
|
166
|
-
)
|
|
164
|
+
""".replace("\n", "\r\n")
|
|
167
165
|
)
|
|
168
166
|
print(codeblocks)
|
|
169
167
|
assert len(codeblocks) == 1 and codeblocks[0][0] == "python"
|
|
@@ -390,7 +388,7 @@ def test_create_virtual_env_with_extra_args():
|
|
|
390
388
|
|
|
391
389
|
def _test_improve(credentials_all: Credentials):
|
|
392
390
|
try:
|
|
393
|
-
import openai
|
|
391
|
+
import openai # noqa: F401
|
|
394
392
|
except ImportError:
|
|
395
393
|
return
|
|
396
394
|
config_list = credentials_all.config_list
|
|
@@ -171,9 +171,9 @@ def test_log_new_agent(db_connection):
|
|
|
171
171
|
"""
|
|
172
172
|
|
|
173
173
|
for row in cur.execute(query):
|
|
174
|
-
assert (
|
|
175
|
-
|
|
176
|
-
)
|
|
174
|
+
assert row["session_id"] and str(uuid.UUID(row["session_id"], version=4)) == row["session_id"], (
|
|
175
|
+
"session id is not valid uuid"
|
|
176
|
+
)
|
|
177
177
|
assert row["name"] == agent_name
|
|
178
178
|
assert row["class"] == "AssistantAgent"
|
|
179
179
|
assert row["init_args"] == json.dumps(init_args)
|
|
@@ -195,9 +195,9 @@ def test_log_oai_wrapper(db_connection):
|
|
|
195
195
|
"""
|
|
196
196
|
|
|
197
197
|
for row in cur.execute(query):
|
|
198
|
-
assert (
|
|
199
|
-
|
|
200
|
-
)
|
|
198
|
+
assert row["session_id"] and str(uuid.UUID(row["session_id"], version=4)) == row["session_id"], (
|
|
199
|
+
"session id is not valid uuid"
|
|
200
|
+
)
|
|
201
201
|
saved_init_args = json.loads(row["init_args"])
|
|
202
202
|
assert "config_list" in saved_init_args
|
|
203
203
|
assert "api_key" not in saved_init_args["config_list"][0]
|
|
@@ -223,9 +223,9 @@ def test_log_oai_client(db_connection):
|
|
|
223
223
|
"""
|
|
224
224
|
|
|
225
225
|
for row in cur.execute(query):
|
|
226
|
-
assert (
|
|
227
|
-
|
|
228
|
-
)
|
|
226
|
+
assert row["session_id"] and str(uuid.UUID(row["session_id"], version=4)) == row["session_id"], (
|
|
227
|
+
"session id is not valid uuid"
|
|
228
|
+
)
|
|
229
229
|
assert row["class"] == "AzureOpenAI"
|
|
230
230
|
saved_init_args = json.loads(row["init_args"])
|
|
231
231
|
assert "api_version" in saved_init_args
|
|
@@ -236,7 +236,7 @@ def test_to_dict():
|
|
|
236
236
|
from autogen import Agent
|
|
237
237
|
from autogen.coding import LocalCommandLineCodeExecutor
|
|
238
238
|
|
|
239
|
-
agent_executor = LocalCommandLineCodeExecutor(work_dir=Path(
|
|
239
|
+
agent_executor = LocalCommandLineCodeExecutor(work_dir=Path())
|
|
240
240
|
|
|
241
241
|
agent1 = autogen.ConversableAgent(
|
|
242
242
|
"alice",
|
|
@@ -11,14 +11,12 @@ import sys
|
|
|
11
11
|
|
|
12
12
|
import pytest
|
|
13
13
|
|
|
14
|
-
from .conftest import skip_openai
|
|
15
|
-
|
|
16
14
|
try:
|
|
17
|
-
import openai
|
|
15
|
+
import openai # noqa: F401
|
|
18
16
|
except ImportError:
|
|
19
17
|
skip = True
|
|
20
18
|
else:
|
|
21
|
-
skip = False
|
|
19
|
+
skip = False
|
|
22
20
|
|
|
23
21
|
|
|
24
22
|
here = os.path.abspath(os.path.dirname(__file__))
|
|
@@ -54,6 +52,7 @@ def run_notebook(input_nb, output_nb="executed_openai_notebook.ipynb", save=Fals
|
|
|
54
52
|
nbformat.write(nb, nb_executed_file)
|
|
55
53
|
|
|
56
54
|
|
|
55
|
+
@pytest.mark.openai
|
|
57
56
|
@pytest.mark.skipif(
|
|
58
57
|
skip or not sys.version.startswith("3.13"),
|
|
59
58
|
reason="do not run if openai is not installed or py!=3.13",
|
|
@@ -62,6 +61,7 @@ def test_agentchat_auto_feedback_from_code(save=False):
|
|
|
62
61
|
run_notebook("agentchat_auto_feedback_from_code_execution.ipynb", save=save)
|
|
63
62
|
|
|
64
63
|
|
|
64
|
+
@pytest.mark.openai
|
|
65
65
|
@pytest.mark.skipif(
|
|
66
66
|
skip or not sys.version.startswith("3.11"),
|
|
67
67
|
reason="do not run if openai is not installed or py!=3.11",
|
|
@@ -70,6 +70,7 @@ def _test_oai_completion(save=False):
|
|
|
70
70
|
run_notebook("oai_completion.ipynb", save=save)
|
|
71
71
|
|
|
72
72
|
|
|
73
|
+
@pytest.mark.openai
|
|
73
74
|
@pytest.mark.skipif(
|
|
74
75
|
skip or not sys.version.startswith("3.12"),
|
|
75
76
|
reason="do not run if openai is not installed or py!=3.12",
|
|
@@ -78,6 +79,7 @@ def test_agentchat_function_call(save=False):
|
|
|
78
79
|
run_notebook("agentchat_function_call.ipynb", save=save)
|
|
79
80
|
|
|
80
81
|
|
|
82
|
+
@pytest.mark.openai
|
|
81
83
|
@pytest.mark.skipif(
|
|
82
84
|
skip or not sys.version.startswith("3.10"),
|
|
83
85
|
reason="do not run if openai is not installed or py!=3.10",
|
|
@@ -86,6 +88,7 @@ def test_agentchat_function_call_currency_calculator(save=False):
|
|
|
86
88
|
run_notebook("agentchat_function_call_currency_calculator.ipynb", save=save)
|
|
87
89
|
|
|
88
90
|
|
|
91
|
+
@pytest.mark.openai
|
|
89
92
|
@pytest.mark.skipif(
|
|
90
93
|
skip or not sys.version.startswith("3.13"),
|
|
91
94
|
reason="do not run if openai is not installed or py!=3.13",
|
|
@@ -94,14 +97,16 @@ def test_agentchat_function_call_async(save=False):
|
|
|
94
97
|
run_notebook("agentchat_function_call_async.ipynb", save=save)
|
|
95
98
|
|
|
96
99
|
|
|
100
|
+
@pytest.mark.openai
|
|
97
101
|
@pytest.mark.skipif(
|
|
98
102
|
skip or not sys.version.startswith("3.12"),
|
|
99
103
|
reason="do not run if openai is not installed or py!=3.12",
|
|
100
104
|
)
|
|
101
|
-
def _test_agentchat_MathChat(save=False):
|
|
105
|
+
def _test_agentchat_MathChat(save=False): # noqa: N802
|
|
102
106
|
run_notebook("agentchat_MathChat.ipynb", save=save)
|
|
103
107
|
|
|
104
108
|
|
|
109
|
+
@pytest.mark.openai
|
|
105
110
|
@pytest.mark.skipif(
|
|
106
111
|
skip or not sys.version.startswith("3.10"),
|
|
107
112
|
reason="do not run if openai is not installed or py!=3.10",
|
|
@@ -110,6 +115,7 @@ def _test_oai_chatgpt_gpt4(save=False):
|
|
|
110
115
|
run_notebook("oai_chatgpt_gpt4.ipynb", save=save)
|
|
111
116
|
|
|
112
117
|
|
|
118
|
+
@pytest.mark.openai
|
|
113
119
|
@pytest.mark.skipif(
|
|
114
120
|
skip or not sys.version.startswith("3.12"),
|
|
115
121
|
reason="do not run if openai is not installed or py!=3.12",
|
|
@@ -118,6 +124,7 @@ def test_agentchat_groupchat_finite_state_machine(save=False):
|
|
|
118
124
|
run_notebook("agentchat_groupchat_finite_state_machine.ipynb", save=save)
|
|
119
125
|
|
|
120
126
|
|
|
127
|
+
@pytest.mark.openai
|
|
121
128
|
@pytest.mark.skipif(
|
|
122
129
|
skip or not sys.version.startswith("3.11"),
|
|
123
130
|
reason="do not run if openai is not installed or py!=3.11",
|
|
@@ -126,6 +133,7 @@ def test_agentchat_cost_token_tracking(save=False):
|
|
|
126
133
|
run_notebook("agentchat_cost_token_tracking.ipynb", save=save)
|
|
127
134
|
|
|
128
135
|
|
|
136
|
+
@pytest.mark.openai
|
|
129
137
|
@pytest.mark.skipif(
|
|
130
138
|
skip or not sys.version.startswith("3.11"),
|
|
131
139
|
reason="do not run if openai is not installed or py!=3.11",
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
#
|
|
5
5
|
# Portions derived from https://github.com/microsoft/autogen are under the MIT License.
|
|
6
6
|
# SPDX-License-Identifier: MIT
|
|
7
|
-
from typing import Annotated,
|
|
7
|
+
from typing import Annotated, Optional, Union
|
|
8
8
|
|
|
9
|
-
from pydantic import BaseModel
|
|
9
|
+
from pydantic import BaseModel
|
|
10
10
|
|
|
11
11
|
from autogen._pydantic import model_dump, model_dump_json, type2schema
|
|
12
12
|
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
# SPDX-License-Identifier: MIT
|
|
7
7
|
#!/usr/bin/env python3 -m pytest
|
|
8
8
|
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
"""
|
|
9
|
+
"""Unit test for retrieve_utils.py"""
|
|
10
|
+
|
|
12
11
|
import pytest
|
|
13
12
|
|
|
14
13
|
try:
|
|
@@ -32,7 +31,7 @@ else:
|
|
|
32
31
|
import os
|
|
33
32
|
|
|
34
33
|
try:
|
|
35
|
-
from unstructured.partition.auto import partition
|
|
34
|
+
from unstructured.partition.auto import partition # noqa: F401
|
|
36
35
|
|
|
37
36
|
HAS_UNSTRUCTURED = True
|
|
38
37
|
except ImportError:
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import pytest
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
|
-
from autogen.agentchat.contrib.img_utils import num_tokens_from_gpt_image
|
|
12
|
+
from autogen.agentchat.contrib.img_utils import num_tokens_from_gpt_image # noqa: F401
|
|
13
13
|
|
|
14
14
|
img_util_imported = True
|
|
15
15
|
except ImportError:
|
|
@@ -17,6 +17,7 @@ except ImportError:
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
from autogen.token_count_utils import (
|
|
20
|
+
_num_token_from_messages,
|
|
20
21
|
count_token,
|
|
21
22
|
get_max_token_limit,
|
|
22
23
|
num_tokens_from_functions,
|
|
@@ -69,6 +70,32 @@ def test_num_tokens_from_functions(input_functions, expected_count):
|
|
|
69
70
|
assert num_tokens_from_functions(input_functions) == expected_count
|
|
70
71
|
|
|
71
72
|
|
|
73
|
+
@pytest.mark.parametrize(
|
|
74
|
+
"model, expected_count",
|
|
75
|
+
[
|
|
76
|
+
("mistral-", 524),
|
|
77
|
+
("deepseek-chat", 524),
|
|
78
|
+
("claude", 524),
|
|
79
|
+
("gemini", 524),
|
|
80
|
+
],
|
|
81
|
+
)
|
|
82
|
+
def test_num_token_from_messages(model: str, expected_count: int) -> None:
|
|
83
|
+
messages = [
|
|
84
|
+
{
|
|
85
|
+
"content": "You are a helpful AI assistant.\nSolve tasks using your coding and language skills.\nIn the following cases, suggest python code (in a python coding block) or shell script (in a sh coding block) for the user to execute.\n 1. When you need to collect info, use the code to output the info you need, for example, browse or search the web, download/read a file, print the content of a webpage or a file, get the current date/time, check the operating system. After sufficient info is printed and the task is ready to be solved based on your language skill, you can solve the task by yourself.\n 2. When you need to perform some task with code, use the code to perform the task and output the result. Finish the task smartly.\nSolve the task step by step if you need to. If a plan is not provided, explain your plan first. Be clear which step uses code, and which step uses your language skill.\nWhen using code, you must indicate the script type in the code block. The user cannot provide any other feedback or perform any other action beyond executing the code you suggest. The user can't modify your code. So do not suggest incomplete code which requires users to modify. Don't use a code block if it's not intended to be executed by the user.\nIf you want the user to save the code in a file before executing it, put # filename: <filename> inside the code block as the first line. Don't include multiple code blocks in one response. Do not ask users to copy and paste the result. Instead, use 'print' function for the output when relevant. Check the execution result returned by the user.\nIf the result indicates there is an error, fix the error and output the code again. Suggest the full code instead of partial code or code changes. If the error can't be fixed or if the task is not solved even after the code is executed successfully, analyze the problem, revisit your assumption, collect additional info you need, and think of a different approach to try.\nWhen you find an answer, verify the answer carefully. Include verifiable evidence in your response if possible.\nReply \"TERMINATE\" in the end when everything is done.\n ",
|
|
86
|
+
"role": "system",
|
|
87
|
+
},
|
|
88
|
+
{"content": "Hi", "role": "user", "name": "user_proxy"},
|
|
89
|
+
{
|
|
90
|
+
"content": "Hello! How can I assist you today? If you have a specific task or question, feel free to share it, and I'll do my best to help.",
|
|
91
|
+
"role": "assistant",
|
|
92
|
+
"name": "assistant",
|
|
93
|
+
},
|
|
94
|
+
{"content": "okkk", "role": "user", "name": "user_proxy"},
|
|
95
|
+
]
|
|
96
|
+
assert _num_token_from_messages(messages=messages, model=model) == expected_count
|
|
97
|
+
|
|
98
|
+
|
|
72
99
|
@pytest.mark.skipif(not img_util_imported, reason="img_utils not imported")
|
|
73
100
|
def test_num_tokens_from_gpt_image():
|
|
74
101
|
# mock num_tokens_from_gpt_image function
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
pyautogen==0.7.0
|
|
2
|
-
|
|
3
|
-
[anthropic]
|
|
4
|
-
pyautogen[anthropic]==0.7.0
|
|
5
|
-
|
|
6
|
-
[autobuild]
|
|
7
|
-
pyautogen[autobuild]==0.7.0
|
|
8
|
-
|
|
9
|
-
[bedrock]
|
|
10
|
-
pyautogen[bedrock]==0.7.0
|
|
11
|
-
|
|
12
|
-
[blendsearch]
|
|
13
|
-
pyautogen[blendsearch]==0.7.0
|
|
14
|
-
|
|
15
|
-
[captainagent]
|
|
16
|
-
pyautogen[captainagent]==0.7.0
|
|
17
|
-
|
|
18
|
-
[cerebras]
|
|
19
|
-
pyautogen[cerebras]==0.7.0
|
|
20
|
-
|
|
21
|
-
[cohere]
|
|
22
|
-
pyautogen[cohere]==0.7.0
|
|
23
|
-
|
|
24
|
-
[cosmosdb]
|
|
25
|
-
pyautogen[cosmosdb]==0.7.0
|
|
26
|
-
|
|
27
|
-
[gemini]
|
|
28
|
-
pyautogen[gemini]==0.7.0
|
|
29
|
-
|
|
30
|
-
[graph]
|
|
31
|
-
pyautogen[graph]==0.7.0
|
|
32
|
-
|
|
33
|
-
[graph-rag-falkor-db]
|
|
34
|
-
pyautogen[graph-rag-falkor-db]==0.7.0
|
|
35
|
-
|
|
36
|
-
[groq]
|
|
37
|
-
pyautogen[groq]==0.7.0
|
|
38
|
-
|
|
39
|
-
[interop]
|
|
40
|
-
pyautogen[interop]==0.7.0
|
|
41
|
-
|
|
42
|
-
[interop-crewai]
|
|
43
|
-
pyautogen[interop-crewai]==0.7.0
|
|
44
|
-
|
|
45
|
-
[interop-langchain]
|
|
46
|
-
pyautogen[interop-langchain]==0.7.0
|
|
47
|
-
|
|
48
|
-
[interop-pydantic-ai]
|
|
49
|
-
pyautogen[interop-pydantic-ai]==0.7.0
|
|
50
|
-
|
|
51
|
-
[jupyter-executor]
|
|
52
|
-
pyautogen[jupyter-executor]==0.7.0
|
|
53
|
-
|
|
54
|
-
[lmm]
|
|
55
|
-
pyautogen[lmm]==0.7.0
|
|
56
|
-
|
|
57
|
-
[long-context]
|
|
58
|
-
pyautogen[long-context]==0.7.0
|
|
59
|
-
|
|
60
|
-
[mathchat]
|
|
61
|
-
pyautogen[mathchat]==0.7.0
|
|
62
|
-
|
|
63
|
-
[mistral]
|
|
64
|
-
pyautogen[mistral]==0.7.0
|
|
65
|
-
|
|
66
|
-
[neo4j]
|
|
67
|
-
pyautogen[neo4j]==0.7.0
|
|
68
|
-
|
|
69
|
-
[ollama]
|
|
70
|
-
pyautogen[ollama]==0.7.0
|
|
71
|
-
|
|
72
|
-
[redis]
|
|
73
|
-
pyautogen[redis]==0.7.0
|
|
74
|
-
|
|
75
|
-
[retrievechat]
|
|
76
|
-
pyautogen[retrievechat]==0.7.0
|
|
77
|
-
|
|
78
|
-
[retrievechat-mongodb]
|
|
79
|
-
pyautogen[retrievechat-mongodb]==0.7.0
|
|
80
|
-
|
|
81
|
-
[retrievechat-pgvector]
|
|
82
|
-
pyautogen[retrievechat-pgvector]==0.7.0
|
|
83
|
-
|
|
84
|
-
[retrievechat-qdrant]
|
|
85
|
-
pyautogen[retrievechat-qdrant]==0.7.0
|
|
86
|
-
|
|
87
|
-
[teachable]
|
|
88
|
-
pyautogen[teachable]==0.7.0
|
|
89
|
-
|
|
90
|
-
[test]
|
|
91
|
-
pyautogen[test]==0.7.0
|
|
92
|
-
|
|
93
|
-
[together]
|
|
94
|
-
pyautogen[together]==0.7.0
|
|
95
|
-
|
|
96
|
-
[twilio]
|
|
97
|
-
pyautogen[twilio]==0.7.0
|
|
98
|
-
|
|
99
|
-
[types]
|
|
100
|
-
pyautogen[types]==0.7.0
|
|
101
|
-
|
|
102
|
-
[websockets]
|
|
103
|
-
pyautogen[websockets]==0.7.0
|
|
104
|
-
|
|
105
|
-
[websurfer]
|
|
106
|
-
pyautogen[websurfer]==0.7.0
|
{ag2-0.7.0 → ag2-0.7.1}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|