ag2 0.9.2__py3-none-any.whl → 0.9.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ag2 might be problematic. Click here for more details.
- {ag2-0.9.2.dist-info → ag2-0.9.4.dist-info}/METADATA +14 -10
- {ag2-0.9.2.dist-info → ag2-0.9.4.dist-info}/RECORD +35 -29
- autogen/agentchat/contrib/agent_optimizer.py +6 -3
- autogen/agentchat/contrib/capabilities/transforms.py +22 -9
- autogen/agentchat/conversable_agent.py +51 -5
- autogen/agentchat/group/group_utils.py +81 -27
- autogen/agentchat/group/guardrails.py +171 -0
- autogen/agentchat/group/handoffs.py +81 -5
- autogen/agentchat/group/on_context_condition.py +2 -2
- autogen/agentchat/group/patterns/pattern.py +7 -1
- autogen/agentchat/group/targets/transition_target.py +10 -0
- autogen/agentchat/groupchat.py +95 -8
- autogen/agentchat/realtime/experimental/realtime_swarm.py +12 -4
- autogen/agents/experimental/document_agent/document_agent.py +232 -40
- autogen/agents/experimental/websurfer/websurfer.py +9 -1
- autogen/events/agent_events.py +6 -0
- autogen/events/helpers.py +8 -0
- autogen/mcp/helpers.py +45 -0
- autogen/mcp/mcp_proxy/mcp_proxy.py +2 -3
- autogen/messages/agent_messages.py +1 -1
- autogen/oai/gemini.py +41 -17
- autogen/oai/gemini_types.py +2 -1
- autogen/oai/oai_models/chat_completion.py +1 -1
- autogen/tools/experimental/__init__.py +4 -0
- autogen/tools/experimental/browser_use/browser_use.py +4 -11
- autogen/tools/experimental/firecrawl/__init__.py +7 -0
- autogen/tools/experimental/firecrawl/firecrawl_tool.py +853 -0
- autogen/tools/experimental/searxng/__init__.py +7 -0
- autogen/tools/experimental/searxng/searxng_search.py +141 -0
- autogen/version.py +1 -1
- templates/client_template/main.jinja2 +5 -2
- templates/main.jinja2 +1 -1
- {ag2-0.9.2.dist-info → ag2-0.9.4.dist-info}/WHEEL +0 -0
- {ag2-0.9.2.dist-info → ag2-0.9.4.dist-info}/licenses/LICENSE +0 -0
- {ag2-0.9.2.dist-info → ag2-0.9.4.dist-info}/licenses/NOTICE.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ag2
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.4
|
|
4
4
|
Summary: A programming framework for agentic AI
|
|
5
5
|
Project-URL: Homepage, https://ag2.ai/
|
|
6
6
|
Project-URL: Documentation, https://docs.ag2.ai
|
|
@@ -72,7 +72,7 @@ Requires-Dist: azure-cosmos>=4.2.0; extra == 'cosmosdb'
|
|
|
72
72
|
Provides-Extra: crawl4ai
|
|
73
73
|
Requires-Dist: crawl4ai<0.5,>=0.4.247; extra == 'crawl4ai'
|
|
74
74
|
Provides-Extra: deepseek
|
|
75
|
-
Requires-Dist: openai>=1.
|
|
75
|
+
Requires-Dist: openai>=1.87.0; extra == 'deepseek'
|
|
76
76
|
Provides-Extra: dev
|
|
77
77
|
Requires-Dist: cairosvg; extra == 'dev'
|
|
78
78
|
Requires-Dist: codespell==2.4.1; extra == 'dev'
|
|
@@ -96,7 +96,7 @@ Requires-Dist: mypy==1.15.0; extra == 'dev'
|
|
|
96
96
|
Requires-Dist: nbclient==0.10.2; extra == 'dev'
|
|
97
97
|
Requires-Dist: nbconvert==7.16.6; extra == 'dev'
|
|
98
98
|
Requires-Dist: nbformat==5.10.4; extra == 'dev'
|
|
99
|
-
Requires-Dist: openai>=1.
|
|
99
|
+
Requires-Dist: openai>=1.87.0; extra == 'dev'
|
|
100
100
|
Requires-Dist: pandas==2.2.3; extra == 'dev'
|
|
101
101
|
Requires-Dist: pdoc3==0.11.6; extra == 'dev'
|
|
102
102
|
Requires-Dist: pillow; extra == 'dev'
|
|
@@ -130,6 +130,8 @@ Requires-Dist: pillow; extra == 'docs'
|
|
|
130
130
|
Requires-Dist: pyyaml==6.0.2; extra == 'docs'
|
|
131
131
|
Requires-Dist: termcolor==3.0.1; extra == 'docs'
|
|
132
132
|
Requires-Dist: typer==0.15.2; extra == 'docs'
|
|
133
|
+
Provides-Extra: duckduckgo
|
|
134
|
+
Requires-Dist: duckduckgo-search>=8.0.2; extra == 'duckduckgo'
|
|
133
135
|
Provides-Extra: flaml
|
|
134
136
|
Requires-Dist: flaml; extra == 'flaml'
|
|
135
137
|
Requires-Dist: numpy<2.0.0,>=1.24.0; (python_version < '3.13') and extra == 'flaml'
|
|
@@ -138,14 +140,14 @@ Provides-Extra: gemini
|
|
|
138
140
|
Requires-Dist: google-api-core; extra == 'gemini'
|
|
139
141
|
Requires-Dist: google-auth; extra == 'gemini'
|
|
140
142
|
Requires-Dist: google-cloud-aiplatform; extra == 'gemini'
|
|
141
|
-
Requires-Dist: google-genai>=1.
|
|
143
|
+
Requires-Dist: google-genai>=1.20.0; extra == 'gemini'
|
|
142
144
|
Requires-Dist: jsonschema; extra == 'gemini'
|
|
143
145
|
Requires-Dist: pillow; extra == 'gemini'
|
|
144
146
|
Provides-Extra: gemini-realtime
|
|
145
147
|
Requires-Dist: google-api-core; extra == 'gemini-realtime'
|
|
146
148
|
Requires-Dist: google-auth; extra == 'gemini-realtime'
|
|
147
149
|
Requires-Dist: google-cloud-aiplatform; extra == 'gemini-realtime'
|
|
148
|
-
Requires-Dist: google-genai>=1.
|
|
150
|
+
Requires-Dist: google-genai>=1.20.0; extra == 'gemini-realtime'
|
|
149
151
|
Requires-Dist: jsonschema; extra == 'gemini-realtime'
|
|
150
152
|
Requires-Dist: pillow; extra == 'gemini-realtime'
|
|
151
153
|
Requires-Dist: websockets<16,>=14.0; extra == 'gemini-realtime'
|
|
@@ -198,7 +200,7 @@ Provides-Extra: mathchat
|
|
|
198
200
|
Requires-Dist: sympy; extra == 'mathchat'
|
|
199
201
|
Requires-Dist: wolframalpha; extra == 'mathchat'
|
|
200
202
|
Provides-Extra: mcp
|
|
201
|
-
Requires-Dist: mcp
|
|
203
|
+
Requires-Dist: mcp>=1.9.4; (python_version >= '3.10') and extra == 'mcp'
|
|
202
204
|
Provides-Extra: mcp-proxy-gen
|
|
203
205
|
Requires-Dist: fastapi-code-generator>=0.5.4; extra == 'mcp-proxy-gen'
|
|
204
206
|
Requires-Dist: fastapi<1,>=0.112; extra == 'mcp-proxy-gen'
|
|
@@ -216,9 +218,9 @@ Provides-Extra: ollama
|
|
|
216
218
|
Requires-Dist: fix-busted-json>=0.0.18; extra == 'ollama'
|
|
217
219
|
Requires-Dist: ollama>=0.4.7; extra == 'ollama'
|
|
218
220
|
Provides-Extra: openai
|
|
219
|
-
Requires-Dist: openai>=1.
|
|
221
|
+
Requires-Dist: openai>=1.87.0; extra == 'openai'
|
|
220
222
|
Provides-Extra: openai-realtime
|
|
221
|
-
Requires-Dist: openai>=1.
|
|
223
|
+
Requires-Dist: openai>=1.87.0; extra == 'openai-realtime'
|
|
222
224
|
Requires-Dist: openai[realtime]; extra == 'openai-realtime'
|
|
223
225
|
Provides-Extra: rag
|
|
224
226
|
Requires-Dist: chromadb<1,>=0.5; extra == 'rag'
|
|
@@ -282,6 +284,8 @@ Requires-Dist: protobuf==5.29.3; extra == 'retrievechat-qdrant'
|
|
|
282
284
|
Requires-Dist: pypdf; extra == 'retrievechat-qdrant'
|
|
283
285
|
Requires-Dist: qdrant-client; extra == 'retrievechat-qdrant'
|
|
284
286
|
Requires-Dist: sentence-transformers<=4.1.0; extra == 'retrievechat-qdrant'
|
|
287
|
+
Provides-Extra: tavily
|
|
288
|
+
Requires-Dist: tavily-python>=0.7.4; extra == 'tavily'
|
|
285
289
|
Provides-Extra: teachable
|
|
286
290
|
Requires-Dist: chromadb; extra == 'teachable'
|
|
287
291
|
Provides-Extra: test
|
|
@@ -309,7 +313,7 @@ Requires-Dist: mock==5.2.0; extra == 'types'
|
|
|
309
313
|
Requires-Dist: mypy==1.15.0; extra == 'types'
|
|
310
314
|
Requires-Dist: nbconvert==7.16.6; extra == 'types'
|
|
311
315
|
Requires-Dist: nbformat==5.10.4; extra == 'types'
|
|
312
|
-
Requires-Dist: openai>=1.
|
|
316
|
+
Requires-Dist: openai>=1.87.0; extra == 'types'
|
|
313
317
|
Requires-Dist: pandas==2.2.3; extra == 'types'
|
|
314
318
|
Requires-Dist: pytest-asyncio==0.26.0; extra == 'types'
|
|
315
319
|
Requires-Dist: pytest-cov==6.1.1; extra == 'types'
|
|
@@ -678,7 +682,7 @@ AG2 supports more advanced concepts to help you build your AI agent workflows. Y
|
|
|
678
682
|
|
|
679
683
|
- [Structured Output](https://docs.ag2.ai/latest/docs/user-guide/basic-concepts/structured-outputs)
|
|
680
684
|
- [Ending a conversation](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/orchestration/ending-a-chat/)
|
|
681
|
-
- [Retrieval Augmented Generation (RAG)](https://docs.ag2.ai/docs/user-guide/advanced-concepts/rag)
|
|
685
|
+
- [Retrieval Augmented Generation (RAG)](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/rag/)
|
|
682
686
|
- [Code Execution](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/code-execution)
|
|
683
687
|
- [Tools with Secrets](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/tools/tools-with-secrets/)
|
|
684
688
|
|
|
@@ -14,7 +14,7 @@ autogen/retrieve_utils.py,sha256=R3Yp5d8dH4o9ayLZrGn4rCjIaY4glOHIiyQjwClmdi8,200
|
|
|
14
14
|
autogen/runtime_logging.py,sha256=yCmZODvwqYR91m8lX3Q4SoPcY-DK48NF4m56CP6Om3c,4692
|
|
15
15
|
autogen/token_count_utils.py,sha256=n4wTFVNHwrfjZkrErFr8kNig2K-YCGgMLWsjDRS9D6g,10797
|
|
16
16
|
autogen/types.py,sha256=qu-7eywhakW2AxQ5lYisLLeIg45UoOW-b3ErIuyRTuw,1000
|
|
17
|
-
autogen/version.py,sha256=
|
|
17
|
+
autogen/version.py,sha256=zukvVxK3WY_ypC-a8Iy7A_baGAoqr3cT-lhYYnSMhhM,193
|
|
18
18
|
autogen/_website/__init__.py,sha256=c8B9TpO07x9neD0zsJWj6AaEdlcP-WvxrvVOGWLtamk,143
|
|
19
19
|
autogen/_website/generate_api_references.py,sha256=yKqyeSP_NE27wwLYWsZbTYRceEoxzNxPXqn6vsIzEvk,14789
|
|
20
20
|
autogen/_website/generate_mkdocs.py,sha256=TkmLnUDv1Ms5cGClXPmenA8nxmwg4kR0E-FHCVjw_og,43246
|
|
@@ -25,12 +25,12 @@ autogen/agentchat/__init__.py,sha256=d5jPpXeavynP9eh5uMIgJKbK3-3tywJBa6l3L9X4l34
|
|
|
25
25
|
autogen/agentchat/agent.py,sha256=HePNJ5BXJTcZtaD2a8CoTeHAoLUUy3scM6Ihm-NsSWk,5828
|
|
26
26
|
autogen/agentchat/assistant_agent.py,sha256=XTJvD66r4qYkdNAJJLr1CC-wTYFJWvhmD5_G0WbbX2I,5741
|
|
27
27
|
autogen/agentchat/chat.py,sha256=6Gx2t1-Xa8kP6ZoUihHBNGOqNlrGhhqLPKrckL0n-RI,14003
|
|
28
|
-
autogen/agentchat/conversable_agent.py,sha256
|
|
29
|
-
autogen/agentchat/groupchat.py,sha256=
|
|
28
|
+
autogen/agentchat/conversable_agent.py,sha256=-BNwxfqSaHQi428a6xgz_53ThPC8LDsdHzHiWzNsPtc,192671
|
|
29
|
+
autogen/agentchat/groupchat.py,sha256=vdK8zUX2CG8fR5pkPGWX7Zn7DFwLvld0bpaRv3vOBEo,89471
|
|
30
30
|
autogen/agentchat/user_proxy_agent.py,sha256=-gbDblRvE09FGuVB6-y5ZT9Cpvv--rM3FMi8PnPIFBA,7445
|
|
31
31
|
autogen/agentchat/utils.py,sha256=2ZweUqe4ynxji0jnvd0r9Uxg3n0elif4a-jZOyeeqcg,8238
|
|
32
32
|
autogen/agentchat/contrib/__init__.py,sha256=tOTe4nwbKj7elHpftAy3zS_embMDzncrKL98XKhY6-c,168
|
|
33
|
-
autogen/agentchat/contrib/agent_optimizer.py,sha256=
|
|
33
|
+
autogen/agentchat/contrib/agent_optimizer.py,sha256=Y0H9unXXCOmBo6P-njtH3L_vmMCdwp0B9Kiihg8HBy4,22431
|
|
34
34
|
autogen/agentchat/contrib/gpt_assistant_agent.py,sha256=0zne7MZBVYlxvYdI-Iu2BRziPSYQPZ1fg0XjfFzt9BA,25051
|
|
35
35
|
autogen/agentchat/contrib/img_utils.py,sha256=BNc1ELE2dSzmFCc_9zwcdazmUxDZZrQv8jgXJZaheCM,15121
|
|
36
36
|
autogen/agentchat/contrib/llamaindex_conversable_agent.py,sha256=sAbBmYIBB4RJt-GhgNzA5QSX4CP0q2eusQNa6K2_LA4,4595
|
|
@@ -58,7 +58,7 @@ autogen/agentchat/contrib/capabilities/teachability.py,sha256=tn3o7q-5vC7O-EFy7I
|
|
|
58
58
|
autogen/agentchat/contrib/capabilities/text_compressors.py,sha256=tm5WDf0AC0VznFJ44Hy7zHh_Erar2c1OjExVt1MG8j8,2985
|
|
59
59
|
autogen/agentchat/contrib/capabilities/tools_capability.py,sha256=iSECQqsHp-MBWu6Huo6OAH4ehSI04QYDGQBjUupFsPI,773
|
|
60
60
|
autogen/agentchat/contrib/capabilities/transform_messages.py,sha256=bFUxDkq0jWLcgccE3Zp4_JD12zIVRE7AMVFwSJqssSY,3783
|
|
61
|
-
autogen/agentchat/contrib/capabilities/transforms.py,sha256=
|
|
61
|
+
autogen/agentchat/contrib/capabilities/transforms.py,sha256=Ow3zPEPAnUfHoiH96vNxvjWGk5TVCqtttyqlkS3X2Dk,26292
|
|
62
62
|
autogen/agentchat/contrib/capabilities/transforms_util.py,sha256=XjTkE_i-SArRPBuLmVaZYhJMY2RgNHjz2m_iF-lKUJM,4559
|
|
63
63
|
autogen/agentchat/contrib/capabilities/vision_capability.py,sha256=kHUeIPvICOR-tLQ6g6AdNWtcbhrUKPIfg42ISqGzrA4,9872
|
|
64
64
|
autogen/agentchat/contrib/captainagent/__init__.py,sha256=12X-ClPVPXBnN59wduSLhQ-PmUWXO45vvafHPQOUVV8,414
|
|
@@ -132,24 +132,25 @@ autogen/agentchat/group/context_expression.py,sha256=zFWPV3yfV-0ayYXfrhRq6iWQZnR
|
|
|
132
132
|
autogen/agentchat/group/context_str.py,sha256=EHjpDr8MLMl5AMXktMi9Wp4BIL_1hbIeJPMEXlLkTjs,1270
|
|
133
133
|
autogen/agentchat/group/context_variables.py,sha256=d2Q31aoV2o_5QSd3Oh1fYDIV0fDaaHOOsjNQ92TC_H0,5649
|
|
134
134
|
autogen/agentchat/group/group_tool_executor.py,sha256=lCUg0Z_R8u0mRsWE350p6pGNj-6fJUMGqWqs3xmznCQ,9104
|
|
135
|
-
autogen/agentchat/group/group_utils.py,sha256=
|
|
136
|
-
autogen/agentchat/group/
|
|
135
|
+
autogen/agentchat/group/group_utils.py,sha256=nNHtAAS2tAvaA3VsXPYDBIV6vBve8PoVvYMs0Ps7GzI,27586
|
|
136
|
+
autogen/agentchat/group/guardrails.py,sha256=OMqQgXtscfYHS6ET1x2HT6Cpi2gtnkEbNKQgWqnZtDw,5964
|
|
137
|
+
autogen/agentchat/group/handoffs.py,sha256=ergiOsXC4z8N44LTUh-abIPrErjkXZWFRMXflinNq1Y,11743
|
|
137
138
|
autogen/agentchat/group/llm_condition.py,sha256=wfuEET1VhyVVGedYxcyuhX_Vus6uZHxUl_SPpu4YIsc,2951
|
|
138
139
|
autogen/agentchat/group/multi_agent_chat.py,sha256=oKAWiziaSZ0otwfGhSWaR26dYbfRQj_vau_P5Z1dvfY,7688
|
|
139
140
|
autogen/agentchat/group/on_condition.py,sha256=ZxLiI4APceCGUcPFnLrsik7DEX9YgRW200k1QIhyaWg,2185
|
|
140
|
-
autogen/agentchat/group/on_context_condition.py,sha256=
|
|
141
|
+
autogen/agentchat/group/on_context_condition.py,sha256=GwB2qb2V7RbaOJPeXYXinuxDQ8ou0kvp7-9jZ85KFfk,2084
|
|
141
142
|
autogen/agentchat/group/reply_result.py,sha256=KUJ2HWpRLEyc5SIVh60-GirsN7jFg-ceAeT4p7I0ZyQ,740
|
|
142
143
|
autogen/agentchat/group/speaker_selection_result.py,sha256=2pvl-9zJ1al0AbAmLDqGRm9JgfmS-lyEOFiZoKIkUHY,1623
|
|
143
144
|
autogen/agentchat/group/patterns/__init__.py,sha256=SUw-biSWow_uGHuHcMA3Pu2cq_CTTVeIqY2J8A5fq8A,446
|
|
144
145
|
autogen/agentchat/group/patterns/auto.py,sha256=h0LjzGHv3yRqDCAnlOfjofkYNKiVzSKVc64T_o8e7wY,6075
|
|
145
146
|
autogen/agentchat/group/patterns/manual.py,sha256=8ltqGFtt9xfyADl_OZFD0g-HydFQvDdrc35iwT612ok,6324
|
|
146
|
-
autogen/agentchat/group/patterns/pattern.py,sha256=
|
|
147
|
+
autogen/agentchat/group/patterns/pattern.py,sha256=8DS9lMloLPemY10aIqTnttuRTd50YPN2-UFCj7wjhBk,10868
|
|
147
148
|
autogen/agentchat/group/patterns/random.py,sha256=yrNCYwcodhdcquNEkdaWO_T32jJjiqaslLithAX1dSM,3367
|
|
148
149
|
autogen/agentchat/group/patterns/round_robin.py,sha256=nS7nsQJKCq9lD0wyCx__gkWK3N9Z8bvlY2stUfE9JxA,3895
|
|
149
150
|
autogen/agentchat/group/targets/__init__.py,sha256=AJNSbl9iMe2hiDmZojTp8h889o5OYN3V7f2_2nr8px4,145
|
|
150
151
|
autogen/agentchat/group/targets/group_chat_target.py,sha256=4_bzVg1ODSIx7UfP8O9OdvTlRNtFuqZt77YqKFIwh74,5364
|
|
151
152
|
autogen/agentchat/group/targets/group_manager_target.py,sha256=Cp4Wbmp3a7fZBTN-s5eQEDRNyKWq9KYihRlzx1blnZQ,6276
|
|
152
|
-
autogen/agentchat/group/targets/transition_target.py,sha256=
|
|
153
|
+
autogen/agentchat/group/targets/transition_target.py,sha256=punRNX630N4HQrMmpVAeSCkdHDEd3CG51KHwlUM3JLo,16742
|
|
153
154
|
autogen/agentchat/group/targets/transition_utils.py,sha256=fzRnaJtUEnNswkmamQH08X43xX2kV0SWGIWEV72TtIo,219
|
|
154
155
|
autogen/agentchat/realtime/__init__.py,sha256=c8B9TpO07x9neD0zsJWj6AaEdlcP-WvxrvVOGWLtamk,143
|
|
155
156
|
autogen/agentchat/realtime/experimental/__init__.py,sha256=leYemaQJXulYnp5atRJZE247EL5VJtdDoF_p1XJFQzM,619
|
|
@@ -158,7 +159,7 @@ autogen/agentchat/realtime/experimental/function_observer.py,sha256=M0cXXJNoBQ8s
|
|
|
158
159
|
autogen/agentchat/realtime/experimental/realtime_agent.py,sha256=i8rxU-Tjk2Pz-WOZJ5PuRymaMvVLH66lqH2LJ85PxLM,5713
|
|
159
160
|
autogen/agentchat/realtime/experimental/realtime_events.py,sha256=zmRr3pwPJpme5VZEADIz5vg9IZoT3Z1NAc3vt1RdWLk,1083
|
|
160
161
|
autogen/agentchat/realtime/experimental/realtime_observer.py,sha256=nTouVj5-il0q2_P2LTpyb4pnHqyfwP5MJh_QmMJF3e8,3061
|
|
161
|
-
autogen/agentchat/realtime/experimental/realtime_swarm.py,sha256=
|
|
162
|
+
autogen/agentchat/realtime/experimental/realtime_swarm.py,sha256=ENR7URgzaa4roTTLPAbUr44TT9FznG57kAU_0PIb34s,17809
|
|
162
163
|
autogen/agentchat/realtime/experimental/websockets.py,sha256=bj9b5eq80L3KlGWPP6nn7uyfT_Z47kQqtIRbQkeE5SI,667
|
|
163
164
|
autogen/agentchat/realtime/experimental/audio_adapters/__init__.py,sha256=rd0pEy91LYq0JMvIk8Fv7ZKIQLK7oZbVdgVAwNZDCmQ,315
|
|
164
165
|
autogen/agentchat/realtime/experimental/audio_adapters/twilio_audio_adapter.py,sha256=-O10rpqPKZKxZO58rQOxPnwECe-RQJoSUTU_K8i0A98,6110
|
|
@@ -185,7 +186,7 @@ autogen/agents/experimental/discord/discord.py,sha256=S5OkCgXJj2AnkEXZ3Z-pRG3_iD
|
|
|
185
186
|
autogen/agents/experimental/document_agent/__init__.py,sha256=YNuO2YqxckrfAxcmRcI5JmiE7w52lkyVdLyvWxmbSUw,603
|
|
186
187
|
autogen/agents/experimental/document_agent/chroma_query_engine.py,sha256=izKOopdDpmMfoAOCChR3evlLgJZkMh-x4XvsxiO9ol4,13864
|
|
187
188
|
autogen/agents/experimental/document_agent/docling_doc_ingest_agent.py,sha256=3QBqyZxtQCidxEdwwEHE0WRMgW1Q1nnFZnm9Z3ahwZI,5060
|
|
188
|
-
autogen/agents/experimental/document_agent/document_agent.py,sha256=
|
|
189
|
+
autogen/agents/experimental/document_agent/document_agent.py,sha256=3QVW_Gt9IMFmXKtw9oWzUroa0N_lK9S3Ry4lnMzugkA,29628
|
|
189
190
|
autogen/agents/experimental/document_agent/document_conditions.py,sha256=yahgDlnG6ORw9RQ6GLLrn_ZczHv9XrLcdouo6M9rSZQ,2051
|
|
190
191
|
autogen/agents/experimental/document_agent/document_utils.py,sha256=g8PBcOFbVWtqP6rnRHJtY97ZJDXADcPzylkKZnhJfNA,14088
|
|
191
192
|
autogen/agents/experimental/document_agent/inmemory_query_engine.py,sha256=UFv0u2V0QG3mne9BuQksWggEjGSmO4em4VGkU1Zm2to,8966
|
|
@@ -198,7 +199,7 @@ autogen/agents/experimental/slack/slack.py,sha256=QzT0awsZpAVCs5mmXeHT-V6uhKik8n
|
|
|
198
199
|
autogen/agents/experimental/telegram/__init__.py,sha256=Y-HQJXmeux9QVY-Jjy22WO8cPWryxwaKEbhcypdUImY,209
|
|
199
200
|
autogen/agents/experimental/telegram/telegram.py,sha256=q-1i1xPVYxOUjABUvKRo5B9sPvF3p2bAQLQi9POndMM,3097
|
|
200
201
|
autogen/agents/experimental/websurfer/__init__.py,sha256=I3D0sIBDW9zxSOM0wNXdFfMZQIpiutet-9ikrm0WD0s,212
|
|
201
|
-
autogen/agents/experimental/websurfer/websurfer.py,sha256=
|
|
202
|
+
autogen/agents/experimental/websurfer/websurfer.py,sha256=MT6VIXmPscjY8LdweXL_txTNsNkpHtwSqR_475QYMeM,2908
|
|
202
203
|
autogen/agents/experimental/wikipedia/__init__.py,sha256=ytX_85hqagdyl3I72kYQM2-3bR7rG_SI5cyx8pKSG2I,212
|
|
203
204
|
autogen/agents/experimental/wikipedia/wikipedia.py,sha256=51fjVlmNDZfq3JrGIkknPXz41y_VJcMXfHNnnW58L0s,3942
|
|
204
205
|
autogen/cache/__init__.py,sha256=HF7qJyJpzqTYXSwUyVUxAFTY0eakw5OFwhyg_KO3QwE,375
|
|
@@ -226,10 +227,10 @@ autogen/coding/jupyter/jupyter_client.py,sha256=ROXAWOKG_EJ_oFNuyqUd_3uOBPUTRoTh
|
|
|
226
227
|
autogen/coding/jupyter/jupyter_code_executor.py,sha256=Z2vZvou6QzpMBg0IgOzVRoCADswd15mvfkktIjGhUMY,6374
|
|
227
228
|
autogen/coding/jupyter/local_jupyter_server.py,sha256=7b8yi5qK8ms2e5-PRCrzmXKGp1iC5KgpMU8xiqQ9u8o,6589
|
|
228
229
|
autogen/events/__init__.py,sha256=XwCA6Rsq9AyjgeecGuiwHcAvDQMmKXgGomw5iLDIU5Q,358
|
|
229
|
-
autogen/events/agent_events.py,sha256=
|
|
230
|
+
autogen/events/agent_events.py,sha256=LSCOMwA-nlBSboE5jOh-Da2Pm7hghiwjfzYTz_bS30k,31112
|
|
230
231
|
autogen/events/base_event.py,sha256=5K1wzDBAio9wLxahErSvE0-UbFfMuSTxBp6EI8SbPGU,3475
|
|
231
232
|
autogen/events/client_events.py,sha256=2skE5f9BxQmwJv22vNe-s1ReDXE-DsadeAmMWlrmltc,5466
|
|
232
|
-
autogen/events/helpers.py,sha256=
|
|
233
|
+
autogen/events/helpers.py,sha256=JNwnEfaFylWEaQivURXQ5_7DjsjmCZyiWRI4mQH0ueY,1528
|
|
233
234
|
autogen/events/print_event.py,sha256=_B_60nnB0yFwWpv-LT2c-Zp_b-moREtafP4lDI8uJzk,1275
|
|
234
235
|
autogen/extensions/__init__.py,sha256=tOTe4nwbKj7elHpftAy3zS_embMDzncrKL98XKhY6-c,168
|
|
235
236
|
autogen/fast_depends/__init__.py,sha256=4KNQsBQmoDf5RIZsnOuMFy7t6-Y1hnKjIplGdbo_k8Y,465
|
|
@@ -276,17 +277,18 @@ autogen/logger/logger_utils.py,sha256=H9hcsRyEcUcfxTYWf5cRjtNghF4h3FT8sr4IIuqQum
|
|
|
276
277
|
autogen/logger/sqlite_logger.py,sha256=sRwMx42zh85QWLz1BqKyVySI8OwEB_NjM3ObLOW-mcI,18685
|
|
277
278
|
autogen/mcp/__init__.py,sha256=6BDDmw0sjLZRjyHnd-Gfh9BE-pTKTv5bkow9W6odHtQ,213
|
|
278
279
|
autogen/mcp/__main__.py,sha256=C7nXbWxG3yGsWKRgFnhSsbQOmshLnz6ZOcCxK2TWWio,2487
|
|
280
|
+
autogen/mcp/helpers.py,sha256=J5_J6n3jMJUEJH5K8k9BeUb6ymQgRUI0hC1gbY7rlwM,1533
|
|
279
281
|
autogen/mcp/mcp_client.py,sha256=7c_lHgBJEs77TFYjLcTlVrEu_0z4EafPPY3PgteY87c,7400
|
|
280
282
|
autogen/mcp/mcp_proxy/__init__.py,sha256=3HTU-TqHLk4XSXeBV1UFd9XkQ1B0yOuXXyGseXvDVec,518
|
|
281
283
|
autogen/mcp/mcp_proxy/fastapi_code_generator_helpers.py,sha256=dx-w2tGVMnh8pzY2NuXlMD7oIF7_5Gvc5oSbHIySEpc,2110
|
|
282
|
-
autogen/mcp/mcp_proxy/mcp_proxy.py,sha256=
|
|
284
|
+
autogen/mcp/mcp_proxy/mcp_proxy.py,sha256=NfjNsUnqpPQ_FrKJPiPUL7aDE9SZ_wNB0ZHAsiJHq9I,22131
|
|
283
285
|
autogen/mcp/mcp_proxy/operation_grouping.py,sha256=1n4o5qhkQd2hVr7OaOMsRhInDveDGkCozLudsBVusC4,6349
|
|
284
286
|
autogen/mcp/mcp_proxy/operation_renaming.py,sha256=G5J4VdxUAwSvOo-DsqIUbCfV9TnH3riaHLI6IpctDF8,3956
|
|
285
287
|
autogen/mcp/mcp_proxy/patch_fastapi_code_generator.py,sha256=vBr8P890nsFvK4iuFicrdNskooHlBQeTQ6jbb5kcPAk,3490
|
|
286
288
|
autogen/mcp/mcp_proxy/security.py,sha256=HUcdIE1CCmvuWBPUlvjoKOJV-05sve6pcKHalgm9Z8E,13611
|
|
287
289
|
autogen/mcp/mcp_proxy/security_schema_visitor.py,sha256=UafLMd5zcz0COcc5Vfvt6bP3LQ3jmaBwQIlWhovN9H4,1345
|
|
288
290
|
autogen/messages/__init__.py,sha256=ZuLvvIQRkNE5fotPe6MSS_YzOUkmfIqGSfOZZOZQ3go,321
|
|
289
|
-
autogen/messages/agent_messages.py,sha256=
|
|
291
|
+
autogen/messages/agent_messages.py,sha256=gzsJdzk2slAfSn8ZcXNW6hPegrYPNIEphdhHaqP19Zg,30451
|
|
290
292
|
autogen/messages/base_message.py,sha256=MbYEXM0dWHl31y7o08PGeJNcpK67hpoQpUMgnZ8qTGE,3808
|
|
291
293
|
autogen/messages/client_messages.py,sha256=9yVn4zug44sLIZQFKiCjOK2ML7uFAADflmGudgPV850,5653
|
|
292
294
|
autogen/messages/print_message.py,sha256=51UpH-rkLrRxz_QxAhEMdjVAipiwkLirOuGtkuTvQL4,1393
|
|
@@ -297,8 +299,8 @@ autogen/oai/cerebras.py,sha256=8hiSBq88l2yTXUJPV7AvGXRCtwvW0Y9hIYUnYK2S2os,12462
|
|
|
297
299
|
autogen/oai/client.py,sha256=BB_6Heny6_7lq8q7ZAPKohHAK63zs9UGzRoUknTxjYY,65051
|
|
298
300
|
autogen/oai/client_utils.py,sha256=lVbHyff7OnpdM-tXskC23xLdFccj2AalTdWA4DxzxS4,7543
|
|
299
301
|
autogen/oai/cohere.py,sha256=pRcQWjbzKbZ1RfC1vk9WGjgndwjHbIaOVoKEYdV2L6c,19421
|
|
300
|
-
autogen/oai/gemini.py,sha256=
|
|
301
|
-
autogen/oai/gemini_types.py,sha256=
|
|
302
|
+
autogen/oai/gemini.py,sha256=bc_RQwtoGi7DnwQwPie7ZdvsqpD1AjYwzjVwnIKP39U,43168
|
|
303
|
+
autogen/oai/gemini_types.py,sha256=i4wT8ytD2cO9nCUWm2FKLKVVxyd31wMhOpnrvnIiKIc,5888
|
|
302
304
|
autogen/oai/groq.py,sha256=pQWtaAY_AjT30XKbZNHXDzWsawBys3yFWlfy6K4Nqr8,12431
|
|
303
305
|
autogen/oai/mistral.py,sha256=SlOYPdnNLHuTEHBGCzsemG9sLEgphdUukRurERdMsvI,12677
|
|
304
306
|
autogen/oai/ollama.py,sha256=t0fIgDCoIfsQZ3hhpseam5N-fbpI7-fw82bG55mA8nU,29103
|
|
@@ -306,7 +308,7 @@ autogen/oai/openai_utils.py,sha256=4kEu50WeTGGG2uh1fOeMxRIZkEoov-YkkTgx2n5DhkM,3
|
|
|
306
308
|
autogen/oai/together.py,sha256=Sj4LOk9RrBG3Bb5IVsrjBYz-hDECCyCgofsCdtk6PSM,14867
|
|
307
309
|
autogen/oai/oai_models/__init__.py,sha256=cILDaaCCvSC3aAX85iLwE1RCpNEokA9925Zse5hX2K4,549
|
|
308
310
|
autogen/oai/oai_models/_models.py,sha256=jr5nlvk7Be4W7wDVnwyjDL6m2CSj0RY1nOL1W3Kq0xI,478
|
|
309
|
-
autogen/oai/oai_models/chat_completion.py,sha256
|
|
311
|
+
autogen/oai/oai_models/chat_completion.py,sha256=xs6OH9bWDzN5YQjDRmbJSPr19zySRwJOmyPtJJiNC-M,3188
|
|
310
312
|
autogen/oai/oai_models/chat_completion_audio.py,sha256=a55i5E1EnT8qWdiKxbwF2kmgt4fih6x6HaChjs0ZuZE,950
|
|
311
313
|
autogen/oai/oai_models/chat_completion_message.py,sha256=6MbrdgmqoAz0dUuyZZtM4NQd80ljVm3zDpP9_-l5zyw,2808
|
|
312
314
|
autogen/oai/oai_models/chat_completion_message_tool_call.py,sha256=CWuqlwrk8VMSevpOZAMMPyw9KzNVnxEOfYs9y5tN5zw,1206
|
|
@@ -320,15 +322,17 @@ autogen/tools/toolkit.py,sha256=1tOmTGJ96RhkJrrtAViKUyEcwacA6ztoIbYbnf8NgTU,2558
|
|
|
320
322
|
autogen/tools/contrib/__init__.py,sha256=DWEjPK6xCR2ihAXXdquQZmiuqRLA3Pqb8QV8W1RtS3k,202
|
|
321
323
|
autogen/tools/contrib/time/__init__.py,sha256=dplie5aBJZ8VoKy6EKcQMLTtSgcCkNDYzpdsC2I0YWk,195
|
|
322
324
|
autogen/tools/contrib/time/time.py,sha256=tPi49vOUwfvujbYA-zS00CWcLW-y18CPyQ1gnJG6iRg,1271
|
|
323
|
-
autogen/tools/experimental/__init__.py,sha256=
|
|
325
|
+
autogen/tools/experimental/__init__.py,sha256=jGyt9GVoJO6VsZdmBLzwTxXZGBbWEwdLrUjn-rWQ6os,1588
|
|
324
326
|
autogen/tools/experimental/browser_use/__init__.py,sha256=kfxCajXcVMDH6CZq-lWh2p8PKxOwT9yjC_Za0jr4zUg,290
|
|
325
|
-
autogen/tools/experimental/browser_use/browser_use.py,sha256=
|
|
327
|
+
autogen/tools/experimental/browser_use/browser_use.py,sha256=KfU4MI_BWaHepv0bDMf9HTDUaHTJThuBJI8R_BPpjmg,5561
|
|
326
328
|
autogen/tools/experimental/crawl4ai/__init__.py,sha256=UjFJLSZ9P5xT6WCV0RDPtwt4MHuwPdK90TU7ByXhLWs,207
|
|
327
329
|
autogen/tools/experimental/crawl4ai/crawl4ai.py,sha256=MsOLtbPHRpRrCnRJPQVVVNwmsBcgsWLSHNXDOF-47ws,6088
|
|
328
330
|
autogen/tools/experimental/deep_research/__init__.py,sha256=9SFcDEj2OHxNSlXP11lf1uHENlfUeO47ROcOSD9GCDs,220
|
|
329
331
|
autogen/tools/experimental/deep_research/deep_research.py,sha256=1ZwZjVR1gKHvlWaT7I9_8qrEPTCYhManMci4ZHApIdE,14970
|
|
330
332
|
autogen/tools/experimental/duckduckgo/__init__.py,sha256=hstpKQfvd5YD7X0iMuvJFlui3MtJVGbz5XpkOSaoy18,232
|
|
331
333
|
autogen/tools/experimental/duckduckgo/duckduckgo_search.py,sha256=NCByIKfJz9CXj_IuRQdM8cIEwP_p_ZIt9aFpOjVfzYc,3532
|
|
334
|
+
autogen/tools/experimental/firecrawl/__init__.py,sha256=L-_y07Pzq4TeIIIoYce-catqiZI8f1UAAQpUoL-iYmA,215
|
|
335
|
+
autogen/tools/experimental/firecrawl/firecrawl_tool.py,sha256=4Qj5rFGdQelWJ0OUEVquMZKkxZg5thE-A6Eo9nRPbsU,34803
|
|
332
336
|
autogen/tools/experimental/google/__init__.py,sha256=_j5i9rzajzilQetKCPh5QkX60p1iOri2Yw69zIKAdU0,461
|
|
333
337
|
autogen/tools/experimental/google/model.py,sha256=hm3ynXSJAjeld85iSHo9QgIehoWEqeVhbSPC3EaHm0M,515
|
|
334
338
|
autogen/tools/experimental/google/toolkit_protocol.py,sha256=Jg9aSy4sKDr-yYVxevYr7zbEcmA9EwFWrJBOogLfKJU,485
|
|
@@ -353,14 +357,16 @@ autogen/tools/experimental/perplexity/__init__.py,sha256=VxWG2HfcxwBhLUV4LnAlte9
|
|
|
353
357
|
autogen/tools/experimental/perplexity/perplexity_search.py,sha256=UZtyS9Pde3_VXufuZVuiBw87MiOiAWwVyXqstzE7Rlk,9976
|
|
354
358
|
autogen/tools/experimental/reliable/__init__.py,sha256=GLvfvsFLfBANFVcOptIa_Tm71YsHt5U7X5N9quqDZW0,479
|
|
355
359
|
autogen/tools/experimental/reliable/reliable.py,sha256=5s3aD5u-6JJrXqbSQBcW2qxNfyvx3MQ--IcZ6wMdsvE,64687
|
|
360
|
+
autogen/tools/experimental/searxng/__init__.py,sha256=IiScuchBMO0wDPUo58s41aQbr0CrTkumHeZj-eSzZJo,223
|
|
361
|
+
autogen/tools/experimental/searxng/searxng_search.py,sha256=Mi_FskvurZqZxFvDfrq59AxyeA8QE02A9lTeDufeNH8,4909
|
|
356
362
|
autogen/tools/experimental/tavily/__init__.py,sha256=rvztagn7FpWiXZwJtZmKbIFBteBenaedwsiUViDyC4Y,220
|
|
357
363
|
autogen/tools/experimental/tavily/tavily_search.py,sha256=S1Aj519kaEIwOAJXTc9Y__GHyY--vvc-P-5nh3ksCOQ,7810
|
|
358
364
|
autogen/tools/experimental/web_search_preview/__init__.py,sha256=8vd1XWS14883MQ4U4dHvMP8aAKAtMILLnqRJNzgNh6A,233
|
|
359
365
|
autogen/tools/experimental/web_search_preview/web_search_preview.py,sha256=bLKZSl0670uh82C3OCceRD0WaRfEPtQ4o06PTsQ3kKk,4818
|
|
360
366
|
autogen/tools/experimental/wikipedia/__init__.py,sha256=jS_gUMyz-uCWr75yKv2esIiGz0ijNDNokt6wovQULLE,274
|
|
361
367
|
autogen/tools/experimental/wikipedia/wikipedia.py,sha256=Cw7luG34J6if_5D40C_039BTA6l_LvOiEg6FY5UysC4,11545
|
|
362
|
-
templates/main.jinja2,sha256=
|
|
363
|
-
templates/client_template/main.jinja2,sha256=
|
|
368
|
+
templates/main.jinja2,sha256=mu7z_4NjI1XMEwQx9KaFQixi4ImfwY0FZQaYUJVBnSc,1765
|
|
369
|
+
templates/client_template/main.jinja2,sha256=9_1pmPNLlPZpfcE0KqXJ6uBVzQtmFqWbxs2xyzCOfxY,2115
|
|
364
370
|
templates/config_template/config.jinja2,sha256=A-p-YBsnEm1iftBIhuIBfIyCY-qw34KWcxalmM6KPWc,167
|
|
365
371
|
autogen/agentchat/contrib/captainagent/tools/README.md,sha256=454O-irP4gjSdYnFgoE0i3BfueXO0qFONxe3GMxMpHg,1677
|
|
366
372
|
autogen/agentchat/contrib/captainagent/tools/__init__.py,sha256=tOTe4nwbKj7elHpftAy3zS_embMDzncrKL98XKhY6-c,168
|
|
@@ -399,8 +405,8 @@ autogen/agentchat/contrib/captainagent/tools/math/modular_inverse_sum.py,sha256=
|
|
|
399
405
|
autogen/agentchat/contrib/captainagent/tools/math/simplify_mixed_numbers.py,sha256=iqgpFJdyBHPPNCqkehSIbeuV8Rabr2eDMilT23Wx7PI,1687
|
|
400
406
|
autogen/agentchat/contrib/captainagent/tools/math/sum_of_digit_factorials.py,sha256=-6T5r6Er4mONPldRxv3F9tLoE7Og3qmeSeTC7Du_tTg,596
|
|
401
407
|
autogen/agentchat/contrib/captainagent/tools/math/sum_of_primes_below.py,sha256=Xig7K3A3DRnbv-UXfyo5bybGZUQYAQsltthfTYW5eV8,509
|
|
402
|
-
ag2-0.9.
|
|
403
|
-
ag2-0.9.
|
|
404
|
-
ag2-0.9.
|
|
405
|
-
ag2-0.9.
|
|
406
|
-
ag2-0.9.
|
|
408
|
+
ag2-0.9.4.dist-info/METADATA,sha256=YnCG5kxaDTMI72s4N3OPKiuuepUwQVYLdKjgte3l6ZA,35268
|
|
409
|
+
ag2-0.9.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
410
|
+
ag2-0.9.4.dist-info/licenses/LICENSE,sha256=GEFQVNayAR-S_rQD5l8hPdgvgyktVdy4Bx5-v90IfRI,11384
|
|
411
|
+
ag2-0.9.4.dist-info/licenses/NOTICE.md,sha256=07iCPQGbth4pQrgkSgZinJGT5nXddkZ6_MGYcBd2oiY,1134
|
|
412
|
+
ag2-0.9.4.dist-info/RECORD,,
|
|
@@ -140,7 +140,7 @@ History:
|
|
|
140
140
|
|
|
141
141
|
According to the information I provide, please take one of four actions to manipulate list B using the functions you know.
|
|
142
142
|
Instead of returning TERMINATE directly or taking no action, you should try your best to optimize the function list. Only take no action if you really think the current list is optimal, as more actions will harm performance in future tasks.
|
|
143
|
-
Even adding a general function that can substitute the assistant
|
|
143
|
+
Even adding a general function that can substitute the assistant's repeated suggestions of Python code with the same functionality could also be helpful.
|
|
144
144
|
"""
|
|
145
145
|
|
|
146
146
|
|
|
@@ -176,14 +176,15 @@ class AgentOptimizer:
|
|
|
176
176
|
def __init__(
|
|
177
177
|
self,
|
|
178
178
|
max_actions_per_step: int,
|
|
179
|
-
llm_config: Union[LLMConfig, dict[str, Any]],
|
|
179
|
+
llm_config: Optional[Union[LLMConfig, dict[str, Any]]] = None,
|
|
180
180
|
optimizer_model: Optional[str] = "gpt-4-1106-preview",
|
|
181
181
|
):
|
|
182
182
|
"""(These APIs are experimental and may change in the future.)
|
|
183
183
|
|
|
184
184
|
Args:
|
|
185
185
|
max_actions_per_step (int): the maximum number of actions that the optimizer can take in one step.
|
|
186
|
-
llm_config (LLMConfig or dict): llm inference configuration.
|
|
186
|
+
llm_config (LLMConfig or dict or None): llm inference configuration.
|
|
187
|
+
If None, the current LLMConfig from context is used.
|
|
187
188
|
Please refer to [OpenAIWrapper.create](https://docs.ag2.ai/latest/docs/api-reference/autogen/OpenAIWrapper/#autogen.OpenAIWrapper.create) for available options.
|
|
188
189
|
When using OpenAI or Azure OpenAI endpoints, please specify a non-empty 'model' either in `llm_config` or in each config of 'config_list' in `llm_config`.
|
|
189
190
|
optimizer_model: the model used for the optimizer.
|
|
@@ -203,6 +204,8 @@ class AgentOptimizer:
|
|
|
203
204
|
self._failure_functions_performance = []
|
|
204
205
|
self._best_performance = -1
|
|
205
206
|
|
|
207
|
+
if llm_config is None:
|
|
208
|
+
llm_config = LLMConfig.current
|
|
206
209
|
assert isinstance(llm_config, (dict, LLMConfig)), "llm_config must be a dict or LLMConfig"
|
|
207
210
|
llm_config = copy.deepcopy(llm_config)
|
|
208
211
|
self.llm_config = llm_config
|
|
@@ -60,15 +60,23 @@ class MessageHistoryLimiter:
|
|
|
60
60
|
It trims the conversation history by removing older messages, retaining only the most recent messages.
|
|
61
61
|
"""
|
|
62
62
|
|
|
63
|
-
def __init__(
|
|
63
|
+
def __init__(
|
|
64
|
+
self,
|
|
65
|
+
max_messages: Optional[int] = None,
|
|
66
|
+
keep_first_message: bool = False,
|
|
67
|
+
exclude_names: Optional[list[str]] = None,
|
|
68
|
+
):
|
|
64
69
|
"""Args:
|
|
65
70
|
max_messages Optional[int]: Maximum number of messages to keep in the context. Must be greater than 0 if not None.
|
|
66
71
|
keep_first_message bool: Whether to keep the original first message in the conversation history.
|
|
67
72
|
Defaults to False.
|
|
73
|
+
exclude_names Optional[list[str]]: List of message sender names to exclude from the message history.
|
|
74
|
+
Messages from these senders will be filtered out before applying the message limit. Defaults to None.
|
|
68
75
|
"""
|
|
69
76
|
self._validate_max_messages(max_messages)
|
|
70
77
|
self._max_messages = max_messages
|
|
71
78
|
self._keep_first_message = keep_first_message
|
|
79
|
+
self._exclude_names = exclude_names
|
|
72
80
|
|
|
73
81
|
def apply_transform(self, messages: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
74
82
|
"""Truncates the conversation history to the specified maximum number of messages.
|
|
@@ -83,25 +91,30 @@ class MessageHistoryLimiter:
|
|
|
83
91
|
Returns:
|
|
84
92
|
List[Dict]: A new list containing the most recent messages up to the specified maximum.
|
|
85
93
|
"""
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
|
|
95
|
+
exclude_names = getattr(self, "_exclude_names", None)
|
|
96
|
+
|
|
97
|
+
filtered = [msg for msg in messages if msg.get("name") not in exclude_names] if exclude_names else messages
|
|
98
|
+
|
|
99
|
+
if self._max_messages is None or len(filtered) <= self._max_messages:
|
|
100
|
+
return filtered
|
|
88
101
|
|
|
89
102
|
truncated_messages = []
|
|
90
103
|
remaining_count = self._max_messages
|
|
91
104
|
|
|
92
105
|
# Start with the first message if we need to keep it
|
|
93
|
-
if self._keep_first_message:
|
|
94
|
-
truncated_messages = [
|
|
106
|
+
if self._keep_first_message and filtered:
|
|
107
|
+
truncated_messages = [filtered[0]]
|
|
95
108
|
remaining_count -= 1
|
|
96
109
|
|
|
97
110
|
# Loop through messages in reverse
|
|
98
|
-
for i in range(len(
|
|
111
|
+
for i in range(len(filtered) - 1, 0, -1):
|
|
99
112
|
if remaining_count > 1:
|
|
100
|
-
truncated_messages.insert(1 if self._keep_first_message else 0,
|
|
113
|
+
truncated_messages.insert(1 if self._keep_first_message else 0, filtered[i])
|
|
101
114
|
if remaining_count == 1: # noqa: SIM102
|
|
102
115
|
# If there's only 1 slot left and it's a 'tools' message, ignore it.
|
|
103
|
-
if
|
|
104
|
-
truncated_messages.insert(1,
|
|
116
|
+
if filtered[i].get("role") != "tool":
|
|
117
|
+
truncated_messages.insert(1, filtered[i])
|
|
105
118
|
|
|
106
119
|
remaining_count -= 1
|
|
107
120
|
if remaining_count == 0:
|
|
@@ -77,13 +77,13 @@ from .chat import (
|
|
|
77
77
|
initiate_chats,
|
|
78
78
|
)
|
|
79
79
|
from .group.context_variables import ContextVariables
|
|
80
|
+
from .group.guardrails import Guardrail
|
|
80
81
|
from .group.handoffs import Handoffs
|
|
81
82
|
from .utils import consolidate_chat_info, gather_usage_summary
|
|
82
83
|
|
|
83
84
|
if TYPE_CHECKING:
|
|
84
85
|
from .group.on_condition import OnCondition
|
|
85
86
|
from .group.on_context_condition import OnContextCondition
|
|
86
|
-
|
|
87
87
|
__all__ = ("ConversableAgent",)
|
|
88
88
|
|
|
89
89
|
logger = logging.getLogger(__name__)
|
|
@@ -224,6 +224,8 @@ class ConversableAgent(LLMAgent):
|
|
|
224
224
|
handoffs (Handoffs): Handoffs object containing all handoff transition conditions.
|
|
225
225
|
"""
|
|
226
226
|
self.handoffs = handoffs if handoffs is not None else Handoffs()
|
|
227
|
+
self.input_guardrails: list["Guardrail"] = []
|
|
228
|
+
self.output_guardrails: list["Guardrail"] = []
|
|
227
229
|
|
|
228
230
|
# we change code_execution_config below and we have to make sure we don't change the input
|
|
229
231
|
# in case of UserProxyAgent, without this we could even change the default value {}
|
|
@@ -1471,7 +1473,11 @@ class ConversableAgent(LLMAgent):
|
|
|
1471
1473
|
self.send(msg2send, recipient, request_reply=True, silent=silent)
|
|
1472
1474
|
|
|
1473
1475
|
else: # No breaks in the for loop, so we have reached max turns
|
|
1474
|
-
iostream.send(
|
|
1476
|
+
iostream.send(
|
|
1477
|
+
TerminationEvent(
|
|
1478
|
+
termination_reason=f"Maximum turns ({max_turns}) reached", sender=self, recipient=recipient
|
|
1479
|
+
)
|
|
1480
|
+
)
|
|
1475
1481
|
else:
|
|
1476
1482
|
self._prepare_chat(recipient, clear_history)
|
|
1477
1483
|
if isinstance(message, Callable):
|
|
@@ -1651,7 +1657,11 @@ class ConversableAgent(LLMAgent):
|
|
|
1651
1657
|
break
|
|
1652
1658
|
await self.a_send(msg2send, recipient, request_reply=True, silent=silent)
|
|
1653
1659
|
else: # No breaks in the for loop, so we have reached max turns
|
|
1654
|
-
iostream.send(
|
|
1660
|
+
iostream.send(
|
|
1661
|
+
TerminationEvent(
|
|
1662
|
+
termination_reason=f"Maximum turns ({max_turns}) reached", sender=self, recipient=recipient
|
|
1663
|
+
)
|
|
1664
|
+
)
|
|
1655
1665
|
else:
|
|
1656
1666
|
self._prepare_chat(recipient, clear_history)
|
|
1657
1667
|
if isinstance(message, Callable):
|
|
@@ -2587,7 +2597,7 @@ class ConversableAgent(LLMAgent):
|
|
|
2587
2597
|
self._consecutive_auto_reply_counter[sender] = 0
|
|
2588
2598
|
|
|
2589
2599
|
if termination_reason:
|
|
2590
|
-
iostream.send(TerminationEvent(termination_reason=termination_reason))
|
|
2600
|
+
iostream.send(TerminationEvent(termination_reason=termination_reason, sender=self, recipient=sender))
|
|
2591
2601
|
|
|
2592
2602
|
return True, None
|
|
2593
2603
|
|
|
@@ -2727,7 +2737,7 @@ class ConversableAgent(LLMAgent):
|
|
|
2727
2737
|
self._consecutive_auto_reply_counter[sender] = 0
|
|
2728
2738
|
|
|
2729
2739
|
if termination_reason:
|
|
2730
|
-
iostream.send(TerminationEvent(termination_reason=termination_reason))
|
|
2740
|
+
iostream.send(TerminationEvent(termination_reason=termination_reason, sender=self, recipient=sender))
|
|
2731
2741
|
|
|
2732
2742
|
return True, None
|
|
2733
2743
|
|
|
@@ -3994,6 +4004,42 @@ class ConversableAgent(LLMAgent):
|
|
|
3994
4004
|
"""
|
|
3995
4005
|
self.handoffs.add_many(conditions)
|
|
3996
4006
|
|
|
4007
|
+
def register_input_guardrail(self, guardrail: "Guardrail") -> None:
|
|
4008
|
+
"""
|
|
4009
|
+
Register a guardrail to be used for input validation.
|
|
4010
|
+
|
|
4011
|
+
Args:
|
|
4012
|
+
guardrail: The guardrail to register.
|
|
4013
|
+
"""
|
|
4014
|
+
self.input_guardrails.append(guardrail)
|
|
4015
|
+
|
|
4016
|
+
def register_input_guardrails(self, guardrails: list["Guardrail"]) -> None:
|
|
4017
|
+
"""
|
|
4018
|
+
Register multiple guardrails to be used for input validation.
|
|
4019
|
+
|
|
4020
|
+
Args:
|
|
4021
|
+
guardrails: List of guardrails to register.
|
|
4022
|
+
"""
|
|
4023
|
+
self.input_guardrails.extend(guardrails)
|
|
4024
|
+
|
|
4025
|
+
def register_output_guardrail(self, guardrail: "Guardrail") -> None:
|
|
4026
|
+
"""
|
|
4027
|
+
Register a guardrail to be used for output validation.
|
|
4028
|
+
|
|
4029
|
+
Args:
|
|
4030
|
+
guardrail: The guardrail to register.
|
|
4031
|
+
"""
|
|
4032
|
+
self.output_guardrails.append(guardrail)
|
|
4033
|
+
|
|
4034
|
+
def register_output_guardrails(self, guardrails: list["Guardrail"]) -> None:
|
|
4035
|
+
"""
|
|
4036
|
+
Register multiple guardrails to be used for output validation.
|
|
4037
|
+
|
|
4038
|
+
Args:
|
|
4039
|
+
guardrails: List of guardrails to register.
|
|
4040
|
+
"""
|
|
4041
|
+
self.output_guardrails.extend(guardrails)
|
|
4042
|
+
|
|
3997
4043
|
|
|
3998
4044
|
@export_module("autogen")
|
|
3999
4045
|
def register_function(
|