ag2 0.4b1__tar.gz → 0.4.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.

Files changed (174) hide show
  1. {ag2-0.4b1/ag2.egg-info → ag2-0.4.1}/PKG-INFO +9 -6
  2. {ag2-0.4b1 → ag2-0.4.1}/README.md +8 -5
  3. {ag2-0.4b1 → ag2-0.4.1/ag2.egg-info}/PKG-INFO +9 -6
  4. {ag2-0.4b1 → ag2-0.4.1}/ag2.egg-info/SOURCES.txt +43 -0
  5. {ag2-0.4b1 → ag2-0.4.1}/ag2.egg-info/requires.txt +4 -3
  6. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/agent_builder.py +1 -0
  7. ag2-0.4.1/autogen/agentchat/contrib/agent_eval/agent_eval.py +107 -0
  8. ag2-0.4.1/autogen/agentchat/contrib/agent_eval/criterion.py +47 -0
  9. ag2-0.4.1/autogen/agentchat/contrib/agent_eval/critic_agent.py +47 -0
  10. ag2-0.4.1/autogen/agentchat/contrib/agent_eval/quantifier_agent.py +42 -0
  11. ag2-0.4.1/autogen/agentchat/contrib/agent_eval/subcritic_agent.py +48 -0
  12. ag2-0.4.1/autogen/agentchat/contrib/agent_eval/task.py +43 -0
  13. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/data_analysis/calculate_correlation.py +41 -0
  14. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/data_analysis/calculate_skewness_and_kurtosis.py +29 -0
  15. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/data_analysis/detect_outlier_iqr.py +29 -0
  16. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/data_analysis/detect_outlier_zscore.py +29 -0
  17. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/data_analysis/explore_csv.py +22 -0
  18. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/data_analysis/shapiro_wilk_test.py +31 -0
  19. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/information_retrieval/arxiv_download.py +26 -0
  20. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/information_retrieval/arxiv_search.py +55 -0
  21. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/information_retrieval/extract_pdf_image.py +54 -0
  22. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/information_retrieval/extract_pdf_text.py +39 -0
  23. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/information_retrieval/get_wikipedia_text.py +22 -0
  24. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/information_retrieval/get_youtube_caption.py +35 -0
  25. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/information_retrieval/image_qa.py +61 -0
  26. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/information_retrieval/optical_character_recognition.py +62 -0
  27. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/information_retrieval/perform_web_search.py +48 -0
  28. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/information_retrieval/scrape_wikipedia_tables.py +34 -0
  29. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/information_retrieval/transcribe_audio_file.py +22 -0
  30. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/information_retrieval/youtube_download.py +36 -0
  31. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/calculate_circle_area_from_diameter.py +22 -0
  32. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/calculate_day_of_the_week.py +19 -0
  33. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/calculate_fraction_sum.py +29 -0
  34. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/calculate_matrix_power.py +32 -0
  35. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/calculate_reflected_point.py +17 -0
  36. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/complex_numbers_product.py +26 -0
  37. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/compute_currency_conversion.py +24 -0
  38. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/count_distinct_permutations.py +28 -0
  39. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/evaluate_expression.py +29 -0
  40. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/find_continuity_point.py +35 -0
  41. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/fraction_to_mixed_numbers.py +40 -0
  42. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/modular_inverse_sum.py +23 -0
  43. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/simplify_mixed_numbers.py +37 -0
  44. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/sum_of_digit_factorials.py +16 -0
  45. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/math/sum_of_primes_below.py +16 -0
  46. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/requirements.txt +10 -0
  47. ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools/tool_description.tsv +34 -0
  48. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/captainagent.py +3 -0
  49. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/graph_rag/document.py +6 -0
  50. ag2-0.4.1/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py +111 -0
  51. ag2-0.4.1/autogen/agentchat/contrib/graph_rag/falkor_graph_rag_capability.py +81 -0
  52. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/graph_rag/graph_query_engine.py +7 -1
  53. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/graph_rag/graph_rag_capability.py +12 -4
  54. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/retrieve_user_proxy_agent.py +7 -3
  55. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/swarm_agent.py +69 -20
  56. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/tool_retriever.py +6 -0
  57. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/base.py +2 -2
  58. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/docker_commandline_code_executor.py +2 -2
  59. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/factory.py +2 -2
  60. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/func_with_reqs.py +2 -2
  61. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/jupyter/base.py +2 -2
  62. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/jupyter/docker_jupyter_server.py +2 -2
  63. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/jupyter/embedded_ipython_code_executor.py +2 -2
  64. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/jupyter/jupyter_client.py +2 -2
  65. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/jupyter/jupyter_code_executor.py +2 -2
  66. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/jupyter/local_jupyter_server.py +2 -2
  67. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/local_commandline_code_executor.py +2 -2
  68. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/markdown_code_extractor.py +2 -2
  69. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/utils.py +2 -2
  70. ag2-0.4.1/autogen/extensions/__init__.py +0 -0
  71. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/bedrock.py +6 -0
  72. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/cerebras.py +6 -0
  73. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/ollama.py +6 -0
  74. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/openai_utils.py +1 -0
  75. {ag2-0.4b1 → ag2-0.4.1}/autogen/token_count_utils.py +2 -0
  76. {ag2-0.4b1 → ag2-0.4.1}/autogen/version.py +1 -1
  77. {ag2-0.4b1 → ag2-0.4.1}/setup.py +18 -4
  78. ag2-0.4b1/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py +0 -76
  79. {ag2-0.4b1 → ag2-0.4.1}/LICENSE +0 -0
  80. {ag2-0.4b1 → ag2-0.4.1}/NOTICE.md +0 -0
  81. {ag2-0.4b1 → ag2-0.4.1}/ag2.egg-info/dependency_links.txt +0 -0
  82. {ag2-0.4b1 → ag2-0.4.1}/ag2.egg-info/top_level.txt +0 -0
  83. {ag2-0.4b1 → ag2-0.4.1}/autogen/__init__.py +0 -0
  84. {ag2-0.4b1 → ag2-0.4.1}/autogen/_pydantic.py +0 -0
  85. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/__init__.py +0 -0
  86. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/agent.py +0 -0
  87. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/assistant_agent.py +0 -0
  88. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/chat.py +0 -0
  89. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/__init__.py +0 -0
  90. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/agent_optimizer.py +0 -0
  91. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/capabilities/__init__.py +0 -0
  92. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/capabilities/agent_capability.py +0 -0
  93. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/capabilities/generate_images.py +0 -0
  94. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/capabilities/teachability.py +0 -0
  95. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/capabilities/text_compressors.py +0 -0
  96. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/capabilities/transform_messages.py +0 -0
  97. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/capabilities/transforms.py +0 -0
  98. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/capabilities/transforms_util.py +0 -0
  99. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/capabilities/vision_capability.py +0 -0
  100. {ag2-0.4b1/autogen/agentchat/contrib/graph_rag → ag2-0.4.1/autogen/agentchat/contrib/captainagent/tools}/__init__.py +0 -0
  101. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/gpt_assistant_agent.py +0 -0
  102. {ag2-0.4b1/autogen/agentchat/contrib/vectordb → ag2-0.4.1/autogen/agentchat/contrib/graph_rag}/__init__.py +0 -0
  103. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/img_utils.py +0 -0
  104. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/llamaindex_conversable_agent.py +0 -0
  105. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/llava_agent.py +0 -0
  106. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/math_user_proxy_agent.py +0 -0
  107. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/multimodal_conversable_agent.py +0 -0
  108. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/qdrant_retrieve_user_proxy_agent.py +0 -0
  109. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/retrieve_assistant_agent.py +0 -0
  110. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/society_of_mind_agent.py +0 -0
  111. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/text_analyzer_agent.py +0 -0
  112. {ag2-0.4b1/autogen/extensions → ag2-0.4.1/autogen/agentchat/contrib/vectordb}/__init__.py +0 -0
  113. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/vectordb/base.py +0 -0
  114. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/vectordb/chromadb.py +0 -0
  115. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/vectordb/mongodb.py +0 -0
  116. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/vectordb/pgvectordb.py +0 -0
  117. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/vectordb/qdrant.py +0 -0
  118. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/vectordb/utils.py +0 -0
  119. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/contrib/web_surfer.py +0 -0
  120. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/conversable_agent.py +0 -0
  121. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/groupchat.py +0 -0
  122. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/user_proxy_agent.py +0 -0
  123. {ag2-0.4b1 → ag2-0.4.1}/autogen/agentchat/utils.py +0 -0
  124. {ag2-0.4b1 → ag2-0.4.1}/autogen/browser_utils.py +0 -0
  125. {ag2-0.4b1 → ag2-0.4.1}/autogen/cache/__init__.py +0 -0
  126. {ag2-0.4b1 → ag2-0.4.1}/autogen/cache/abstract_cache_base.py +0 -0
  127. {ag2-0.4b1 → ag2-0.4.1}/autogen/cache/cache.py +0 -0
  128. {ag2-0.4b1 → ag2-0.4.1}/autogen/cache/cache_factory.py +0 -0
  129. {ag2-0.4b1 → ag2-0.4.1}/autogen/cache/cosmos_db_cache.py +0 -0
  130. {ag2-0.4b1 → ag2-0.4.1}/autogen/cache/disk_cache.py +0 -0
  131. {ag2-0.4b1 → ag2-0.4.1}/autogen/cache/in_memory_cache.py +0 -0
  132. {ag2-0.4b1 → ag2-0.4.1}/autogen/cache/redis_cache.py +0 -0
  133. {ag2-0.4b1 → ag2-0.4.1}/autogen/code_utils.py +0 -0
  134. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/__init__.py +0 -0
  135. {ag2-0.4b1 → ag2-0.4.1}/autogen/coding/jupyter/__init__.py +0 -0
  136. {ag2-0.4b1 → ag2-0.4.1}/autogen/exception_utils.py +0 -0
  137. {ag2-0.4b1 → ag2-0.4.1}/autogen/formatting_utils.py +0 -0
  138. {ag2-0.4b1 → ag2-0.4.1}/autogen/function_utils.py +0 -0
  139. {ag2-0.4b1 → ag2-0.4.1}/autogen/graph_utils.py +0 -0
  140. {ag2-0.4b1 → ag2-0.4.1}/autogen/io/__init__.py +0 -0
  141. {ag2-0.4b1 → ag2-0.4.1}/autogen/io/base.py +0 -0
  142. {ag2-0.4b1 → ag2-0.4.1}/autogen/io/console.py +0 -0
  143. {ag2-0.4b1 → ag2-0.4.1}/autogen/io/websockets.py +0 -0
  144. {ag2-0.4b1 → ag2-0.4.1}/autogen/logger/__init__.py +0 -0
  145. {ag2-0.4b1 → ag2-0.4.1}/autogen/logger/base_logger.py +0 -0
  146. {ag2-0.4b1 → ag2-0.4.1}/autogen/logger/file_logger.py +0 -0
  147. {ag2-0.4b1 → ag2-0.4.1}/autogen/logger/logger_factory.py +0 -0
  148. {ag2-0.4b1 → ag2-0.4.1}/autogen/logger/logger_utils.py +0 -0
  149. {ag2-0.4b1 → ag2-0.4.1}/autogen/logger/sqlite_logger.py +0 -0
  150. {ag2-0.4b1 → ag2-0.4.1}/autogen/math_utils.py +0 -0
  151. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/__init__.py +0 -0
  152. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/anthropic.py +0 -0
  153. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/client.py +0 -0
  154. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/client_utils.py +0 -0
  155. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/cohere.py +0 -0
  156. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/completion.py +0 -0
  157. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/gemini.py +0 -0
  158. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/groq.py +0 -0
  159. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/mistral.py +0 -0
  160. {ag2-0.4b1 → ag2-0.4.1}/autogen/oai/together.py +0 -0
  161. {ag2-0.4b1 → ag2-0.4.1}/autogen/retrieve_utils.py +0 -0
  162. {ag2-0.4b1 → ag2-0.4.1}/autogen/runtime_logging.py +0 -0
  163. {ag2-0.4b1 → ag2-0.4.1}/autogen/types.py +0 -0
  164. {ag2-0.4b1 → ag2-0.4.1}/pyproject.toml +0 -0
  165. {ag2-0.4b1 → ag2-0.4.1}/setup.cfg +0 -0
  166. {ag2-0.4b1 → ag2-0.4.1}/test/test_browser_utils.py +0 -0
  167. {ag2-0.4b1 → ag2-0.4.1}/test/test_code_utils.py +0 -0
  168. {ag2-0.4b1 → ag2-0.4.1}/test/test_function_utils.py +0 -0
  169. {ag2-0.4b1 → ag2-0.4.1}/test/test_graph_utils.py +0 -0
  170. {ag2-0.4b1 → ag2-0.4.1}/test/test_logging.py +0 -0
  171. {ag2-0.4b1 → ag2-0.4.1}/test/test_notebook.py +0 -0
  172. {ag2-0.4b1 → ag2-0.4.1}/test/test_pydantic.py +0 -0
  173. {ag2-0.4b1 → ag2-0.4.1}/test/test_retrieve_utils.py +0 -0
  174. {ag2-0.4b1 → ag2-0.4.1}/test/test_token_count.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ag2
3
- Version: 0.4b1
3
+ Version: 0.4.1
4
4
  Summary: A programming framework for agentic AI
5
5
  Home-page: https://github.com/ag2ai/ag2
6
6
  Author: Chi Wang & Qingyun Wu
@@ -46,6 +46,7 @@ License-File: NOTICE.md
46
46
 
47
47
  <a name="readme-top"></a>
48
48
 
49
+ ![Pypi Downloads](https://img.shields.io/pypi/dm/pyautogen?label=PyPI%20downloads)
49
50
  [![PyPI version](https://badge.fury.io/py/autogen.svg)](https://badge.fury.io/py/autogen)
50
51
  [![Build](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml/badge.svg)](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml)
51
52
  ![Python Version](https://img.shields.io/badge/3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)
@@ -62,9 +63,12 @@ License-File: NOTICE.md
62
63
  <br>
63
64
  </p> -->
64
65
 
65
- > [!IMPORTANT]
66
+ > **:tada: IMPORTANT**
66
67
  >
67
- > :fire: :tada: Nov 11, 2024: We are evolving AutoGen into AG2! A new organization [ag2ai](https://github.com/ag2ai) is created to host the development of AG2 and related projects with open governance. We invite collaborators from all organizations and individuals to join the development.
68
+ > :fire: :tada: **Nov 11, 2024:** We are evolving AutoGen into **AG2**!
69
+ > 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/).
70
+ >
71
+ > We invite collaborators from all organizations and individuals to join the development.
68
72
 
69
73
 
70
74
  :fire: :tada: AG2 is available via `ag2` (or its alias `autogen` or `pyautogen`) on PyPI! Starting with version 0.3.2, you can now install AG2 using:
@@ -137,8 +141,7 @@ AG2 (formerly AutoGen) is an open-source programming framework for building AI a
137
141
  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.
138
142
 
139
143
 
140
- ![AutoGen Overview](./website/static/img/autogen_agentchat.png)
141
-
144
+ ![AutoGen Overview](https://media.githubusercontent.com/media/ag2ai/ag2/refs/heads/main/website/static/img/autogen_agentchat.png)
142
145
 
143
146
 
144
147
  <p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
@@ -238,7 +241,7 @@ python test/twoagent.py
238
241
  After the repo is cloned.
239
242
  The figure below shows an example conversation flow with AG2.
240
243
 
241
- ![Agent Chat Example](./website/static/img/chat_example.png)
244
+ ![Agent Chat Example](https://media.githubusercontent.com/media/ag2ai/ag2/refs/heads/main/website/static/img/chat_example.png)
242
245
 
243
246
 
244
247
  Alternatively, the [sample code](https://github.com/ag2ai/build-with-ag2/blob/main/samples/simple_chat.py) here allows a user to chat with an AG2 agent in ChatGPT style.
@@ -1,5 +1,6 @@
1
1
  <a name="readme-top"></a>
2
2
 
3
+ ![Pypi Downloads](https://img.shields.io/pypi/dm/pyautogen?label=PyPI%20downloads)
3
4
  [![PyPI version](https://badge.fury.io/py/autogen.svg)](https://badge.fury.io/py/autogen)
4
5
  [![Build](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml/badge.svg)](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml)
5
6
  ![Python Version](https://img.shields.io/badge/3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)
@@ -16,9 +17,12 @@
16
17
  <br>
17
18
  </p> -->
18
19
 
19
- > [!IMPORTANT]
20
+ > **:tada: IMPORTANT**
20
21
  >
21
- > :fire: :tada: Nov 11, 2024: We are evolving AutoGen into AG2! A new organization [ag2ai](https://github.com/ag2ai) is created to host the development of AG2 and related projects with open governance. We invite collaborators from all organizations and individuals to join the development.
22
+ > :fire: :tada: **Nov 11, 2024:** We are evolving AutoGen into **AG2**!
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
+ >
25
+ > We invite collaborators from all organizations and individuals to join the development.
22
26
 
23
27
 
24
28
  :fire: :tada: AG2 is available via `ag2` (or its alias `autogen` or `pyautogen`) on PyPI! Starting with version 0.3.2, you can now install AG2 using:
@@ -91,8 +95,7 @@ AG2 (formerly AutoGen) is an open-source programming framework for building AI a
91
95
  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.
92
96
 
93
97
 
94
- ![AutoGen Overview](./website/static/img/autogen_agentchat.png)
95
-
98
+ ![AutoGen Overview](https://media.githubusercontent.com/media/ag2ai/ag2/refs/heads/main/website/static/img/autogen_agentchat.png)
96
99
 
97
100
 
98
101
  <p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
@@ -192,7 +195,7 @@ python test/twoagent.py
192
195
  After the repo is cloned.
193
196
  The figure below shows an example conversation flow with AG2.
194
197
 
195
- ![Agent Chat Example](./website/static/img/chat_example.png)
198
+ ![Agent Chat Example](https://media.githubusercontent.com/media/ag2ai/ag2/refs/heads/main/website/static/img/chat_example.png)
196
199
 
197
200
 
198
201
  Alternatively, the [sample code](https://github.com/ag2ai/build-with-ag2/blob/main/samples/simple_chat.py) here allows a user to chat with an AG2 agent in ChatGPT style.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ag2
3
- Version: 0.4b1
3
+ Version: 0.4.1
4
4
  Summary: A programming framework for agentic AI
5
5
  Home-page: https://github.com/ag2ai/ag2
6
6
  Author: Chi Wang & Qingyun Wu
@@ -46,6 +46,7 @@ License-File: NOTICE.md
46
46
 
47
47
  <a name="readme-top"></a>
48
48
 
49
+ ![Pypi Downloads](https://img.shields.io/pypi/dm/pyautogen?label=PyPI%20downloads)
49
50
  [![PyPI version](https://badge.fury.io/py/autogen.svg)](https://badge.fury.io/py/autogen)
50
51
  [![Build](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml/badge.svg)](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml)
51
52
  ![Python Version](https://img.shields.io/badge/3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)
@@ -62,9 +63,12 @@ License-File: NOTICE.md
62
63
  <br>
63
64
  </p> -->
64
65
 
65
- > [!IMPORTANT]
66
+ > **:tada: IMPORTANT**
66
67
  >
67
- > :fire: :tada: Nov 11, 2024: We are evolving AutoGen into AG2! A new organization [ag2ai](https://github.com/ag2ai) is created to host the development of AG2 and related projects with open governance. We invite collaborators from all organizations and individuals to join the development.
68
+ > :fire: :tada: **Nov 11, 2024:** We are evolving AutoGen into **AG2**!
69
+ > 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/).
70
+ >
71
+ > We invite collaborators from all organizations and individuals to join the development.
68
72
 
69
73
 
70
74
  :fire: :tada: AG2 is available via `ag2` (or its alias `autogen` or `pyautogen`) on PyPI! Starting with version 0.3.2, you can now install AG2 using:
@@ -137,8 +141,7 @@ AG2 (formerly AutoGen) is an open-source programming framework for building AI a
137
141
  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.
138
142
 
139
143
 
140
- ![AutoGen Overview](./website/static/img/autogen_agentchat.png)
141
-
144
+ ![AutoGen Overview](https://media.githubusercontent.com/media/ag2ai/ag2/refs/heads/main/website/static/img/autogen_agentchat.png)
142
145
 
143
146
 
144
147
  <p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
@@ -238,7 +241,7 @@ python test/twoagent.py
238
241
  After the repo is cloned.
239
242
  The figure below shows an example conversation flow with AG2.
240
243
 
241
- ![Agent Chat Example](./website/static/img/chat_example.png)
244
+ ![Agent Chat Example](https://media.githubusercontent.com/media/ag2ai/ag2/refs/heads/main/website/static/img/chat_example.png)
242
245
 
243
246
 
244
247
  Alternatively, the [sample code](https://github.com/ag2ai/build-with-ag2/blob/main/samples/simple_chat.py) here allows a user to chat with an AG2 agent in ChatGPT style.
@@ -48,6 +48,12 @@ autogen/agentchat/contrib/swarm_agent.py
48
48
  autogen/agentchat/contrib/text_analyzer_agent.py
49
49
  autogen/agentchat/contrib/tool_retriever.py
50
50
  autogen/agentchat/contrib/web_surfer.py
51
+ autogen/agentchat/contrib/agent_eval/agent_eval.py
52
+ autogen/agentchat/contrib/agent_eval/criterion.py
53
+ autogen/agentchat/contrib/agent_eval/critic_agent.py
54
+ autogen/agentchat/contrib/agent_eval/quantifier_agent.py
55
+ autogen/agentchat/contrib/agent_eval/subcritic_agent.py
56
+ autogen/agentchat/contrib/agent_eval/task.py
51
57
  autogen/agentchat/contrib/capabilities/__init__.py
52
58
  autogen/agentchat/contrib/capabilities/agent_capability.py
53
59
  autogen/agentchat/contrib/capabilities/generate_images.py
@@ -57,9 +63,46 @@ autogen/agentchat/contrib/capabilities/transform_messages.py
57
63
  autogen/agentchat/contrib/capabilities/transforms.py
58
64
  autogen/agentchat/contrib/capabilities/transforms_util.py
59
65
  autogen/agentchat/contrib/capabilities/vision_capability.py
66
+ autogen/agentchat/contrib/captainagent/tools/__init__.py
67
+ autogen/agentchat/contrib/captainagent/tools/requirements.txt
68
+ autogen/agentchat/contrib/captainagent/tools/tool_description.tsv
69
+ autogen/agentchat/contrib/captainagent/tools/data_analysis/calculate_correlation.py
70
+ autogen/agentchat/contrib/captainagent/tools/data_analysis/calculate_skewness_and_kurtosis.py
71
+ autogen/agentchat/contrib/captainagent/tools/data_analysis/detect_outlier_iqr.py
72
+ autogen/agentchat/contrib/captainagent/tools/data_analysis/detect_outlier_zscore.py
73
+ autogen/agentchat/contrib/captainagent/tools/data_analysis/explore_csv.py
74
+ autogen/agentchat/contrib/captainagent/tools/data_analysis/shapiro_wilk_test.py
75
+ autogen/agentchat/contrib/captainagent/tools/information_retrieval/arxiv_download.py
76
+ autogen/agentchat/contrib/captainagent/tools/information_retrieval/arxiv_search.py
77
+ autogen/agentchat/contrib/captainagent/tools/information_retrieval/extract_pdf_image.py
78
+ autogen/agentchat/contrib/captainagent/tools/information_retrieval/extract_pdf_text.py
79
+ autogen/agentchat/contrib/captainagent/tools/information_retrieval/get_wikipedia_text.py
80
+ autogen/agentchat/contrib/captainagent/tools/information_retrieval/get_youtube_caption.py
81
+ autogen/agentchat/contrib/captainagent/tools/information_retrieval/image_qa.py
82
+ autogen/agentchat/contrib/captainagent/tools/information_retrieval/optical_character_recognition.py
83
+ autogen/agentchat/contrib/captainagent/tools/information_retrieval/perform_web_search.py
84
+ autogen/agentchat/contrib/captainagent/tools/information_retrieval/scrape_wikipedia_tables.py
85
+ autogen/agentchat/contrib/captainagent/tools/information_retrieval/transcribe_audio_file.py
86
+ autogen/agentchat/contrib/captainagent/tools/information_retrieval/youtube_download.py
87
+ autogen/agentchat/contrib/captainagent/tools/math/calculate_circle_area_from_diameter.py
88
+ autogen/agentchat/contrib/captainagent/tools/math/calculate_day_of_the_week.py
89
+ autogen/agentchat/contrib/captainagent/tools/math/calculate_fraction_sum.py
90
+ autogen/agentchat/contrib/captainagent/tools/math/calculate_matrix_power.py
91
+ autogen/agentchat/contrib/captainagent/tools/math/calculate_reflected_point.py
92
+ autogen/agentchat/contrib/captainagent/tools/math/complex_numbers_product.py
93
+ autogen/agentchat/contrib/captainagent/tools/math/compute_currency_conversion.py
94
+ autogen/agentchat/contrib/captainagent/tools/math/count_distinct_permutations.py
95
+ autogen/agentchat/contrib/captainagent/tools/math/evaluate_expression.py
96
+ autogen/agentchat/contrib/captainagent/tools/math/find_continuity_point.py
97
+ autogen/agentchat/contrib/captainagent/tools/math/fraction_to_mixed_numbers.py
98
+ autogen/agentchat/contrib/captainagent/tools/math/modular_inverse_sum.py
99
+ autogen/agentchat/contrib/captainagent/tools/math/simplify_mixed_numbers.py
100
+ autogen/agentchat/contrib/captainagent/tools/math/sum_of_digit_factorials.py
101
+ autogen/agentchat/contrib/captainagent/tools/math/sum_of_primes_below.py
60
102
  autogen/agentchat/contrib/graph_rag/__init__.py
61
103
  autogen/agentchat/contrib/graph_rag/document.py
62
104
  autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py
105
+ autogen/agentchat/contrib/graph_rag/falkor_graph_rag_capability.py
63
106
  autogen/agentchat/contrib/graph_rag/graph_query_engine.py
64
107
  autogen/agentchat/contrib/graph_rag/graph_rag_capability.py
65
108
  autogen/agentchat/contrib/vectordb/__init__.py
@@ -20,7 +20,7 @@ anthropic>=0.23.1
20
20
  [autobuild]
21
21
  chromadb
22
22
  huggingface-hub
23
- pysqlite3
23
+ pysqlite3-binary
24
24
  sentence-transformers
25
25
 
26
26
  [bedrock]
@@ -32,7 +32,8 @@ flaml[blendsearch]
32
32
  [captainagent]
33
33
  chromadb
34
34
  huggingface-hub
35
- pysqlite3
35
+ pandas
36
+ pysqlite3-binary
36
37
  sentence-transformers
37
38
 
38
39
  [cerebras]
@@ -56,7 +57,7 @@ matplotlib
56
57
  networkx
57
58
 
58
59
  [graph_rag_falkor_db]
59
- graphrag_sdk
60
+ graphrag_sdk==0.3.3
60
61
 
61
62
  [groq]
62
63
  groq>=0.9.0
@@ -117,6 +117,7 @@ Suggest no more than {max_agents} experts with their name according to the follo
117
117
  # Task requirement
118
118
  - Expert's name should follow the format: [skill]_Expert.
119
119
  - Only reply the names of the experts, separated by ",".
120
+ - If coding skills are required, they should be limited to Python and Shell.
120
121
  For example: Python_Expert, Math_Expert, ... """
121
122
 
122
123
  AGENT_SYS_MSG_PROMPT = """# Your goal
@@ -0,0 +1,107 @@
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
+ from typing import Dict, List, Literal, Optional, Union
8
+
9
+ import autogen
10
+ from autogen.agentchat.contrib.agent_eval.criterion import Criterion
11
+ from autogen.agentchat.contrib.agent_eval.critic_agent import CriticAgent
12
+ from autogen.agentchat.contrib.agent_eval.quantifier_agent import QuantifierAgent
13
+ from autogen.agentchat.contrib.agent_eval.subcritic_agent import SubCriticAgent
14
+ from autogen.agentchat.contrib.agent_eval.task import Task
15
+
16
+
17
+ def generate_criteria(
18
+ llm_config: Optional[Union[Dict, Literal[False]]] = None,
19
+ task: Task = None,
20
+ additional_instructions: str = "",
21
+ max_round=2,
22
+ use_subcritic: bool = False,
23
+ ):
24
+ """
25
+ Creates a list of criteria for evaluating the utility of a given task.
26
+ Args:
27
+ llm_config (dict or bool): llm inference configuration.
28
+ task (Task): The task to evaluate.
29
+ additional_instructions (str): Additional instructions for the criteria agent.
30
+ max_round (int): The maximum number of rounds to run the conversation.
31
+ use_subcritic (bool): Whether to use the subcritic agent to generate subcriteria.
32
+ Returns:
33
+ list: A list of Criterion objects for evaluating the utility of the given task.
34
+ """
35
+ critic = CriticAgent(
36
+ system_message=CriticAgent.DEFAULT_SYSTEM_MESSAGE + "\n" + additional_instructions,
37
+ llm_config=llm_config,
38
+ )
39
+
40
+ critic_user = autogen.UserProxyAgent(
41
+ name="critic_user",
42
+ max_consecutive_auto_reply=0, # terminate without auto-reply
43
+ human_input_mode="NEVER",
44
+ code_execution_config={"use_docker": False},
45
+ )
46
+
47
+ agents = [critic_user, critic]
48
+
49
+ if use_subcritic:
50
+ subcritic = SubCriticAgent(
51
+ llm_config=llm_config,
52
+ )
53
+ agents.append(subcritic)
54
+
55
+ groupchat = autogen.GroupChat(
56
+ agents=agents, messages=[], max_round=max_round, speaker_selection_method="round_robin"
57
+ )
58
+ critic_manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config)
59
+
60
+ critic_user.initiate_chat(critic_manager, message=task.get_sys_message())
61
+ criteria = critic_user.last_message()
62
+ content = criteria["content"]
63
+ # need to strip out any extra code around the returned json
64
+ content = content[content.find("[") : content.rfind("]") + 1]
65
+ criteria = Criterion.parse_json_str(content)
66
+ return criteria
67
+
68
+
69
+ def quantify_criteria(
70
+ llm_config: Optional[Union[Dict, Literal[False]]] = None,
71
+ criteria: List[Criterion] = None,
72
+ task: Task = None,
73
+ test_case: str = "",
74
+ ground_truth: str = "",
75
+ ):
76
+ """
77
+ Quantifies the performance of a system using the provided criteria.
78
+ Args:
79
+ llm_config (dict or bool): llm inference configuration.
80
+ criteria ([Criterion]): A list of criteria for evaluating the utility of a given task.
81
+ task (Task): The task to evaluate.
82
+ test_case (str): The test case to evaluate.
83
+ ground_truth (str): The ground truth for the test case.
84
+ Returns:
85
+ dict: A dictionary where the keys are the criteria and the values are the assessed performance based on accepted values for each criteria.
86
+ """
87
+ quantifier = QuantifierAgent(
88
+ llm_config=llm_config,
89
+ )
90
+
91
+ quantifier_user = autogen.UserProxyAgent(
92
+ name="quantifier_user",
93
+ max_consecutive_auto_reply=0, # terminate without auto-reply
94
+ human_input_mode="NEVER",
95
+ code_execution_config={"use_docker": False},
96
+ )
97
+
98
+ quantifier_user.initiate_chat( # noqa: F841
99
+ quantifier,
100
+ message=task.get_sys_message()
101
+ + "Evaluation dictionary: "
102
+ + Criterion.write_json(criteria)
103
+ + "actual test case to evaluate: "
104
+ + test_case,
105
+ )
106
+ quantified_results = quantifier_user.last_message()
107
+ return {"actual_success": ground_truth, "estimated_performance": quantified_results["content"]}
@@ -0,0 +1,47 @@
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
+ from __future__ import annotations
8
+
9
+ import json
10
+ from typing import List
11
+
12
+ import pydantic_core
13
+ from pydantic import BaseModel
14
+ from pydantic.json import pydantic_encoder
15
+
16
+
17
+ class Criterion(BaseModel):
18
+ """
19
+ A class that represents a criterion for agent evaluation.
20
+ """
21
+
22
+ name: str
23
+ description: str
24
+ accepted_values: List[str]
25
+ sub_criteria: List[Criterion] = list()
26
+
27
+ @staticmethod
28
+ def parse_json_str(criteria: str):
29
+ """
30
+ Create a list of Criterion objects from a json string.
31
+ Args:
32
+ criteria (str): Json string that represents the criteria
33
+ returns:
34
+ [Criterion]: A list of Criterion objects that represents the json criteria information.
35
+ """
36
+ return [Criterion(**crit) for crit in json.loads(criteria)]
37
+
38
+ @staticmethod
39
+ def write_json(criteria):
40
+ """
41
+ Create a json string from a list of Criterion objects.
42
+ Args:
43
+ criteria ([Criterion]): A list of Criterion objects.
44
+ Returns:
45
+ str: A json string that represents the list of Criterion objects.
46
+ """
47
+ return json.dumps([crit.model_dump() for crit in criteria], indent=2)
@@ -0,0 +1,47 @@
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
+ from typing import Optional
8
+
9
+ from autogen.agentchat.conversable_agent import ConversableAgent
10
+
11
+
12
+ class CriticAgent(ConversableAgent):
13
+ """
14
+ An agent for creating list of criteria for evaluating the utility of a given task.
15
+ """
16
+
17
+ DEFAULT_SYSTEM_MESSAGE = """You are a helpful assistant. You suggest criteria for evaluating different tasks. They should be distinguishable, quantifiable and not redundant.
18
+ Convert the evaluation criteria into a list where each item is a criteria which consists of the following dictionary as follows
19
+ {"name": name of the criterion, "description": criteria description , "accepted_values": possible accepted inputs for this key}
20
+ Make sure "accepted_values" include the acceptable inputs for each key that are fine-grained and preferably multi-graded levels and "description" includes the criterion description.
21
+ Output just the criteria string you have created, no code.
22
+ """
23
+
24
+ DEFAULT_DESCRIPTION = "An AI agent for creating list criteria for evaluating the utility of a given task."
25
+
26
+ def __init__(
27
+ self,
28
+ name="critic",
29
+ system_message: Optional[str] = DEFAULT_SYSTEM_MESSAGE,
30
+ description: Optional[str] = DEFAULT_DESCRIPTION,
31
+ **kwargs,
32
+ ):
33
+ """
34
+ Args:
35
+ name (str): agent name.
36
+ system_message (str): system message for the ChatCompletion inference.
37
+ Please override this attribute if you want to reprogram the agent.
38
+ description (str): The description of the agent.
39
+ **kwargs (dict): Please refer to other kwargs in
40
+ [ConversableAgent](../../conversable_agent#__init__).
41
+ """
42
+ super().__init__(
43
+ name=name,
44
+ system_message=system_message,
45
+ description=description,
46
+ **kwargs,
47
+ )
@@ -0,0 +1,42 @@
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
+ from typing import Optional
8
+
9
+ from autogen.agentchat.conversable_agent import ConversableAgent
10
+
11
+
12
+ class QuantifierAgent(ConversableAgent):
13
+ """
14
+ An agent for quantifying the performance of a system using the provided criteria.
15
+ """
16
+
17
+ DEFAULT_SYSTEM_MESSAGE = """"You are a helpful assistant. You quantify the output of different tasks based on the given criteria.
18
+ The criterion is given in a json list format where each element is a distinct criteria.
19
+ The each element is a dictionary as follows {"name": name of the criterion, "description": criteria description , "accepted_values": possible accepted inputs for this key}
20
+ You are going to quantify each of the crieria for a given task based on the task description.
21
+ Return a dictionary where the keys are the criteria and the values are the assessed performance based on accepted values for each criteria.
22
+ Return only the dictionary, no code."""
23
+
24
+ DEFAULT_DESCRIPTION = "An AI agent for quantifing the performance of a system using the provided criteria."
25
+
26
+ def __init__(
27
+ self,
28
+ name="quantifier",
29
+ system_message: Optional[str] = DEFAULT_SYSTEM_MESSAGE,
30
+ description: Optional[str] = DEFAULT_DESCRIPTION,
31
+ **kwargs,
32
+ ):
33
+ """
34
+ Args:
35
+ name (str): agent name.
36
+ system_message (str): system message for the ChatCompletion inference.
37
+ Please override this attribute if you want to reprogram the agent.
38
+ description (str): The description of the agent.
39
+ **kwargs (dict): Please refer to other kwargs in
40
+ [ConversableAgent](../../conversable_agent#__init__).
41
+ """
42
+ super().__init__(name=name, system_message=system_message, description=description, **kwargs)
@@ -0,0 +1,48 @@
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
+ from typing import Optional
8
+
9
+ from autogen.agentchat.conversable_agent import ConversableAgent
10
+
11
+
12
+ class SubCriticAgent(ConversableAgent):
13
+ """
14
+ An agent for creating subcriteria from a given list of criteria for evaluating the utility of a given task.
15
+ """
16
+
17
+ DEFAULT_SYSTEM_MESSAGE = """You are a helpful assistant to the critic agent. You suggest sub criteria for evaluating different tasks based on the criteria provided by the critic agent (if you feel it is needed).
18
+ They should be distinguishable, quantifiable, and related to the overall theme of the critic's provided criteria.
19
+ You operate by taking in the description of the criteria. You then create a new key called sub criteria where you provide the sub criteria for the given criteria.
20
+ The value of the sub_criteria is a dictionary where the keys are the subcriteria and each value is as follows {"description": sub criteria description , "accepted_values": possible accepted inputs for this key}
21
+ Do this for each criteria provided by the critic (removing the criteria's accepted values). "accepted_values" include the acceptable inputs for each key that are fine-grained and preferably multi-graded levels. "description" includes the criterion description.
22
+ Once you have created the sub criteria for the given criteria, you return the json (make sure to include the contents of the critic's dictionary in the final dictionary as well).
23
+ Make sure to return a valid json and no code"""
24
+
25
+ DEFAULT_DESCRIPTION = "An AI agent for creating subcriteria from a given list of criteria."
26
+
27
+ def __init__(
28
+ self,
29
+ name="subcritic",
30
+ system_message: Optional[str] = DEFAULT_SYSTEM_MESSAGE,
31
+ description: Optional[str] = DEFAULT_DESCRIPTION,
32
+ **kwargs,
33
+ ):
34
+ """
35
+ Args:
36
+ name (str): agent name.
37
+ system_message (str): system message for the ChatCompletion inference.
38
+ Please override this attribute if you want to reprogram the agent.
39
+ description (str): The description of the agent.
40
+ **kwargs (dict): Please refer to other kwargs in
41
+ [ConversableAgent](../../conversable_agent#__init__).
42
+ """
43
+ super().__init__(
44
+ name=name,
45
+ system_message=system_message,
46
+ description=description,
47
+ **kwargs,
48
+ )
@@ -0,0 +1,43 @@
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
+ import json
8
+
9
+ from pydantic import BaseModel
10
+
11
+
12
+ class Task(BaseModel):
13
+ """
14
+ Class representing a task for agent completion, includes example agent execution for criteria generation.
15
+ """
16
+
17
+ name: str
18
+ description: str
19
+ successful_response: str
20
+ failed_response: str
21
+
22
+ def get_sys_message(self):
23
+ return f"""Task: {self.name}.
24
+ Task description: {self.description}
25
+ Task successful example: {self.successful_response}
26
+ Task failed example: {self.failed_response}
27
+ """
28
+
29
+ @staticmethod
30
+ def parse_json_str(task: str):
31
+ """
32
+ Create a Task object from a json object.
33
+ Args:
34
+ json_data (dict): A dictionary that represents the task.
35
+ Returns:
36
+ Task: A Task object that represents the json task information.
37
+ """
38
+ json_data = json.loads(task)
39
+ name = json_data.get("name")
40
+ description = json_data.get("description")
41
+ successful_response = json_data.get("successful_response")
42
+ failed_response = json_data.get("failed_response")
43
+ return Task(name, description, successful_response, failed_response)
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2023 - 2024, Owners of https://github.com/ag2ai
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+ def calculate_correlation(csv_path: str, column1: str, column2: str, method: str = "pearson") -> float:
5
+ """
6
+ Calculate the correlation between two columns in a CSV file.
7
+
8
+ Args:
9
+ csv_path (str): The path to the CSV file.
10
+ column1 (str): The name of the first column.
11
+ column2 (str): The name of the second column.
12
+ method (str or callable, optional): The method used to calculate the correlation.
13
+ - 'pearson' (default): Pearson correlation coefficient.
14
+ - 'kendall': Kendall Tau correlation coefficient.
15
+ - 'spearman': Spearman rank correlation coefficient.
16
+ - callable: A custom correlation function that takes two arrays and returns a scalar.
17
+
18
+ Returns:
19
+ float: The correlation coefficient between the two columns.
20
+ """
21
+ import pandas as pd
22
+
23
+ # Read the CSV file into a pandas DataFrame
24
+ df = pd.read_csv(csv_path)
25
+
26
+ # Select the specified columns
27
+ selected_columns = df[[column1, column2]]
28
+
29
+ # Calculate the correlation based on the specified method
30
+ if method == "pearson":
31
+ correlation = selected_columns.corr().iloc[0, 1]
32
+ elif method == "kendall":
33
+ correlation = selected_columns.corr(method="kendall").iloc[0, 1]
34
+ elif method == "spearman":
35
+ correlation = selected_columns.corr(method="spearman").iloc[0, 1]
36
+ elif callable(method):
37
+ correlation = selected_columns.corr(method=method).iloc[0, 1]
38
+ else:
39
+ raise ValueError("Invalid correlation method. Please choose 'pearson', 'kendall', 'spearman', or a callable.")
40
+
41
+ return correlation
@@ -0,0 +1,29 @@
1
+ # Copyright (c) 2023 - 2024, Owners of https://github.com/ag2ai
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+ def calculate_skewness_and_kurtosis(csv_file: str, column_name: str) -> tuple:
5
+ """
6
+ Calculate the skewness and kurtosis of a specified column in a CSV file. The kurtosis is calculated using the Fisher definition.
7
+ The two metrics are computed using scipy.stats functions.
8
+
9
+ Args:
10
+ csv_file (str): The path to the CSV file.
11
+ column_name (str): The name of the column to calculate skewness and kurtosis for.
12
+
13
+ Returns:
14
+ tuple: (skewness, kurtosis)
15
+ """
16
+ import pandas as pd
17
+ from scipy.stats import kurtosis, skew
18
+
19
+ # Read the CSV file into a pandas DataFrame
20
+ df = pd.read_csv(csv_file)
21
+
22
+ # Extract the specified column
23
+ column = df[column_name]
24
+
25
+ # Calculate the skewness and kurtosis
26
+ skewness = skew(column)
27
+ kurt = kurtosis(column)
28
+
29
+ return skewness, kurt