agentUniverse 0.0.6.dev1__tar.gz → 0.0.8.dev1__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.
Files changed (209) hide show
  1. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/PKG-INFO +15 -7
  2. agentuniverse-0.0.8.dev1/agentuniverse/agent/action/knowledge/store/milvus_store.py +228 -0
  3. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/planning_agent/planning_agent.py +3 -2
  4. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/rag_agent/rag_agent.yaml +1 -1
  5. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/reviewing_agent/reviewing_agent.py +3 -2
  6. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/memory/chat_memory.py +3 -3
  7. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/memory/default/default_memory.py +2 -2
  8. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/memory/langchain_instance.py +8 -9
  9. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/executing_planner/executing_planner.py +16 -7
  10. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/expressing_planner/expressing_planner.py +16 -8
  11. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/peer_planner/peer_planner.py +13 -10
  12. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/planner.py +12 -15
  13. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/planning_planner/planning_planner.py +16 -8
  14. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/rag_planner/rag_planner.py +16 -8
  15. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/reviewing_planner/reviewing_planner.py +16 -8
  16. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/dal/request_library.py +31 -27
  17. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/flask_server.py +1 -0
  18. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/gunicorn_server.py +10 -0
  19. agentuniverse-0.0.8.dev1/agentuniverse/agent_serve/web/post_fork_queue.py +24 -0
  20. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/request_task.py +2 -4
  21. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/rpc/grpc/grpc_server_booster.py +9 -7
  22. agentuniverse-0.0.8.dev1/agentuniverse/agent_serve/web/web_booster.py +51 -0
  23. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/agentuniverse.py +17 -11
  24. agentuniverse-0.0.8.dev1/agentuniverse/base/annotation/trace.py +97 -0
  25. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/component/component_base.py +3 -1
  26. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/component/component_configer_util.py +4 -0
  27. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/component/component_enum.py +1 -0
  28. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/component/component_manager_base.py +6 -6
  29. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/application_configer/app_configer.py +7 -0
  30. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/component_configer/configers/llm_configer.py +12 -0
  31. agentuniverse-0.0.8.dev1/agentuniverse/base/config/component_configer/configers/sqldb_wrapper_config.py +83 -0
  32. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/util/memory_util.py +7 -0
  33. agentuniverse-0.0.8.dev1/agentuniverse/base/util/monitor/__init__.py +7 -0
  34. agentuniverse-0.0.8.dev1/agentuniverse/base/util/monitor/monitor.py +64 -0
  35. agentuniverse-0.0.8.dev1/agentuniverse/base/util/prompt/__init__.py +7 -0
  36. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/util/prompt_util.py +22 -12
  37. agentuniverse-0.0.8.dev1/agentuniverse/base/util/system_util.py +51 -0
  38. agentuniverse-0.0.8.dev1/agentuniverse/database/__init__.py +7 -0
  39. agentuniverse-0.0.8.dev1/agentuniverse/database/sqldb_wrapper.py +106 -0
  40. agentuniverse-0.0.8.dev1/agentuniverse/database/sqldb_wrapper_manager.py +13 -0
  41. agentuniverse-0.0.8.dev1/agentuniverse/llm/default/baichuan_openai_style_llm.py +66 -0
  42. agentuniverse-0.0.8.dev1/agentuniverse/llm/default/baichuan_openai_style_llm.yaml +10 -0
  43. agentuniverse-0.0.8.dev1/agentuniverse/llm/default/default_openai_llm.py +79 -0
  44. agentuniverse-0.0.8.dev1/agentuniverse/llm/default/kimi_openai_style_llm.py +72 -0
  45. agentuniverse-0.0.8.dev1/agentuniverse/llm/default/kimi_openai_style_llm.yaml +8 -0
  46. agentuniverse-0.0.8.dev1/agentuniverse/llm/default/qwen_openai_style_llm.py +73 -0
  47. agentuniverse-0.0.8.dev1/agentuniverse/llm/default/qwen_openai_style_llm.yaml +8 -0
  48. agentuniverse-0.0.8.dev1/agentuniverse/llm/default/wenxin_llm.py +139 -0
  49. agentuniverse-0.0.8.dev1/agentuniverse/llm/default/wenxin_llm.yaml +9 -0
  50. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/llm/langchain_instance.py +1 -1
  51. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/llm/llm.py +6 -1
  52. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/llm/openai_llm.py +28 -28
  53. agentuniverse-0.0.8.dev1/agentuniverse/llm/openai_style_langchain_instance.py +136 -0
  54. agentuniverse-0.0.8.dev1/agentuniverse/llm/openai_style_llm.py +187 -0
  55. agentuniverse-0.0.8.dev1/agentuniverse/llm/wenxin_langchain_instance.py +202 -0
  56. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/pyproject.toml +15 -7
  57. agentuniverse-0.0.6.dev1/agentuniverse/agent_serve/web/web_booster.py +0 -27
  58. agentuniverse-0.0.6.dev1/agentuniverse/base/prompt/__init__.py +0 -7
  59. agentuniverse-0.0.6.dev1/agentuniverse/base/util/system_util.py +0 -26
  60. agentuniverse-0.0.6.dev1/agentuniverse/llm/default/default_openai_llm.py +0 -41
  61. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/LICENSE +0 -0
  62. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/README_PYPI.md +0 -0
  63. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/__init__.py +0 -0
  64. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/__init__.py +0 -0
  65. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/__init__.py +0 -0
  66. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/__init__.py +0 -0
  67. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/embedding/__init__.py +0 -0
  68. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/embedding/embedding.py +0 -0
  69. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/embedding/openai_embedding.py +0 -0
  70. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/knowledge.py +0 -0
  71. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/knowledge_manager.py +0 -0
  72. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/reader/__init__.py +0 -0
  73. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/reader/file/__init__.py +0 -0
  74. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/reader/file/docx_reader.py +0 -0
  75. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/reader/file/file_reader.py +0 -0
  76. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/reader/file/pdf_reader.py +0 -0
  77. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/reader/file/pptx_reader.py +0 -0
  78. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/reader/file/web_pdf_reader.py +0 -0
  79. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/reader/reader.py +0 -0
  80. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/store/__init__.py +0 -0
  81. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/store/chroma_store.py +0 -0
  82. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/store/document.py +0 -0
  83. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/store/query.py +0 -0
  84. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/knowledge/store/store.py +0 -0
  85. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/tool/__init__.py +0 -0
  86. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/tool/enum.py +0 -0
  87. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/tool/tool.py +0 -0
  88. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/action/tool/tool_manager.py +0 -0
  89. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/agent.py +0 -0
  90. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/agent_manager.py +0 -0
  91. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/agent_model.py +0 -0
  92. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/__init__.py +0 -0
  93. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/executing_agent/__init__.py +0 -0
  94. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/executing_agent/default_cn_prompt.yaml +0 -0
  95. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/executing_agent/default_en_prompt.yaml +0 -0
  96. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/executing_agent/executing_agent.py +0 -0
  97. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/executing_agent/executing_agent.yaml +0 -0
  98. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/expressing_agent/__init__.py +0 -0
  99. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/expressing_agent/default_cn_prompt.yaml +0 -0
  100. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/expressing_agent/default_en_prompt.yaml +0 -0
  101. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/expressing_agent/expressing_agent.py +0 -0
  102. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/expressing_agent/expressing_agent.yaml +0 -0
  103. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/peer_agent/__init__.py +0 -0
  104. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/peer_agent/peer_agent.py +0 -0
  105. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/peer_agent/peer_agent.yaml +0 -0
  106. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/planning_agent/__init__.py +0 -0
  107. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/planning_agent/default_cn_prompt.yaml +0 -0
  108. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/planning_agent/default_en_prompt.yaml +0 -0
  109. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/planning_agent/planning_agent.yaml +0 -0
  110. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/rag_agent/__init__.py +0 -0
  111. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/rag_agent/default_cn_prompt.yaml +0 -0
  112. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/rag_agent/default_en_prompt.yaml +0 -0
  113. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/rag_agent/rag_agent.py +0 -0
  114. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/reviewing_agent/__init__.py +0 -0
  115. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/reviewing_agent/default_cn_prompt.yaml +0 -0
  116. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/reviewing_agent/default_en_prompt.yaml +0 -0
  117. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/default/reviewing_agent/reviewing_agent.yaml +0 -0
  118. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/input_object.py +0 -0
  119. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/memory/__init__.py +0 -0
  120. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/memory/default/__init__.py +0 -0
  121. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/memory/default/default_memory.yaml +0 -0
  122. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/memory/enum.py +0 -0
  123. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/memory/memory.py +0 -0
  124. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/memory/memory_manager.py +0 -0
  125. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/memory/message.py +0 -0
  126. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/memory/summarizer_cn_prompt.yaml +0 -0
  127. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/memory/summarizer_en_prompt.yaml +0 -0
  128. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/output_object.py +0 -0
  129. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/__init__.py +0 -0
  130. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/__init__.py +0 -0
  131. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/executing_planner/__init__.py +0 -0
  132. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/executing_planner/executing_planner.yaml +0 -0
  133. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/expressing_planner/__init__.py +0 -0
  134. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/expressing_planner/expressing_planner.yaml +0 -0
  135. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/peer_planner/__init__.py +0 -0
  136. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/peer_planner/peer_planner.yaml +0 -0
  137. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/planner_manager.py +0 -0
  138. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/planning_planner/__init__.py +0 -0
  139. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/planning_planner/planning_planner.yaml +0 -0
  140. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/rag_planner/__init__.py +0 -0
  141. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/rag_planner/rag_planner.yaml +0 -0
  142. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/reviewing_planner/__init__.py +0 -0
  143. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent/plan/planner/reviewing_planner/reviewing_planner.yaml +0 -0
  144. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/__init__.py +0 -0
  145. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/service.py +0 -0
  146. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/service_configer.py +0 -0
  147. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/service_instance.py +0 -0
  148. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/service_manager.py +0 -0
  149. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/__init__.py +0 -0
  150. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/dal/__init__.py +0 -0
  151. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/dal/entity/__init__.py +0 -0
  152. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/dal/entity/request_do.py +0 -0
  153. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/rpc/__init__.py +0 -0
  154. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/rpc/grpc/__init__.py +0 -0
  155. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/rpc/grpc/agentuniverse_service.proto +0 -0
  156. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/rpc/grpc/agentuniverse_service_pb2.py +0 -0
  157. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/rpc/grpc/agentuniverse_service_pb2_grpc.py +0 -0
  158. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/rpc/rpc_server.py +0 -0
  159. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/thread_with_result.py +0 -0
  160. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/agent_serve/web/web_util.py +0 -0
  161. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/__init__.py +0 -0
  162. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/annotation/__init__.py +0 -0
  163. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/annotation/singleton.py +0 -0
  164. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/component/__init__.py +0 -0
  165. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/component/application_component_manager.py +0 -0
  166. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/__init__.py +0 -0
  167. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/application_configer/__init__.py +0 -0
  168. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/application_configer/application_config_manager.py +0 -0
  169. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/component_configer/__init__.py +0 -0
  170. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/component_configer/component_configer.py +0 -0
  171. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/component_configer/configers/__init__.py +0 -0
  172. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/component_configer/configers/agent_configer.py +0 -0
  173. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/component_configer/configers/knowledge_configer.py +0 -0
  174. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/component_configer/configers/memory_configer.py +0 -0
  175. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/component_configer/configers/planner_configer.py +0 -0
  176. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/component_configer/configers/prompt_configer.py +0 -0
  177. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/component_configer/configers/tool_configer.py +0 -0
  178. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/config_type_enum.py +0 -0
  179. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/configer.py +0 -0
  180. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/custom_configer/__init__.py +0 -0
  181. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/config/custom_configer/custom_key_configer.py +0 -0
  182. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/context/__init__.py +0 -0
  183. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/context/framework_context.py +0 -0
  184. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/context/framework_context_manager.py +0 -0
  185. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/util/__init__.py +0 -0
  186. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/util/env_util.py +0 -0
  187. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/util/logging/__init__.py +0 -0
  188. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/util/logging/general_logger.py +0 -0
  189. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/util/logging/logging_config.py +0 -0
  190. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/base/util/logging/logging_util.py +0 -0
  191. {agentuniverse-0.0.6.dev1/agentuniverse/base → agentuniverse-0.0.8.dev1/agentuniverse/base/util}/prompt/combine_cn_prompt.yaml +0 -0
  192. {agentuniverse-0.0.6.dev1/agentuniverse/base → agentuniverse-0.0.8.dev1/agentuniverse/base/util}/prompt/combine_en_prompt.yaml +0 -0
  193. {agentuniverse-0.0.6.dev1/agentuniverse/base → agentuniverse-0.0.8.dev1/agentuniverse/base/util}/prompt/summary_cn_prompt.yaml +0 -0
  194. {agentuniverse-0.0.6.dev1/agentuniverse/base → agentuniverse-0.0.8.dev1/agentuniverse/base/util}/prompt/summary_en_prompt.yaml +0 -0
  195. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/llm/__init__.py +0 -0
  196. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/llm/default/__init__.py +0 -0
  197. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/llm/default/default_openai_llm.yaml +0 -0
  198. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/llm/llm_manager.py +0 -0
  199. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/llm/llm_output.py +0 -0
  200. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/prompt/__init__.py +0 -0
  201. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/prompt/chat_prompt.py +0 -0
  202. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/prompt/enum.py +0 -0
  203. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/prompt/prompt.py +0 -0
  204. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/prompt/prompt_manager.py +0 -0
  205. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse/prompt/prompt_model.py +0 -0
  206. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse_connector/__init__.py +0 -0
  207. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse_extension/__init__.py +0 -0
  208. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse_extension/logger/__init__.py +0 -0
  209. {agentuniverse-0.0.6.dev1 → agentuniverse-0.0.8.dev1}/agentuniverse_extension/logger/sls_sink.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agentUniverse
3
- Version: 0.0.6.dev1
3
+ Version: 0.0.8.dev1
4
4
  Summary: agentUniverse is a framework for developing applications powered by multi-agent base on large language model.
5
5
  Home-page: https://github.com/alipay/agentUniverse
6
6
  Author: AntGroup
@@ -13,26 +13,34 @@ Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Provides-Extra: log-ext
16
+ Provides-Extra: store-ext
17
+ Requires-Dist: Jinja2 (>=3.1.4,<4.0.0)
16
18
  Requires-Dist: SQLAlchemy (==2.0.25)
17
19
  Requires-Dist: aliyun-log-python-sdk (==0.8.8) ; extra == "log-ext"
20
+ Requires-Dist: anthropic (>=0.26.0,<0.27.0)
18
21
  Requires-Dist: cffi (>=1.15.1,<2.0.0)
19
22
  Requires-Dist: chromadb (==0.4.24)
20
- Requires-Dist: flask (==2.2)
23
+ Requires-Dist: dashscope (>=1.19.1,<2.0.0)
24
+ Requires-Dist: flask (>=2.3.2,<3.0.0)
21
25
  Requires-Dist: flask_cors (==4.0.0)
22
26
  Requires-Dist: googleapis-common-protos (>=1.63.0,<2.0.0)
23
27
  Requires-Dist: grpcio (==1.63.0)
24
- Requires-Dist: gunicorn (==21.2.0)
25
- Requires-Dist: langchain (==0.0.352)
26
- Requires-Dist: langchain-core (==0.1.3)
28
+ Requires-Dist: gunicorn (>=22.0.0,<23.0.0)
29
+ Requires-Dist: langchain (==0.1.20)
30
+ Requires-Dist: langchain-community (==0.0.38)
31
+ Requires-Dist: langchain-core (==0.1.52)
27
32
  Requires-Dist: loguru (==0.7.2)
28
33
  Requires-Dist: myst-parser (>=2.0.0,<3.0.0)
29
34
  Requires-Dist: openai (==1.13.3)
30
35
  Requires-Dist: pydantic (>=2.6.4,<3.0.0)
31
- Requires-Dist: requests (>=2.31.0,<3.0.0)
36
+ Requires-Dist: pymilvus (>=2.4.3,<3.0.0) ; extra == "store-ext"
37
+ Requires-Dist: qianfan (>=0.3.12,<0.4.0)
38
+ Requires-Dist: requests (>=2.32.0,<3.0.0)
32
39
  Requires-Dist: sphinx (>=7.2.6,<8.0.0)
33
40
  Requires-Dist: sphinx-rtd-theme (>=2.0.0,<3.0.0)
34
41
  Requires-Dist: tiktoken (==0.5.2)
35
- Requires-Dist: werkzeug (==2.2.2)
42
+ Requires-Dist: tqdm (>=4.66.3,<5.0.0)
43
+ Requires-Dist: werkzeug (>=3.0.3,<4.0.0)
36
44
  Project-URL: Repository, https://github.com/alipay/agentUniverse
37
45
  Description-Content-Type: text/markdown
38
46
 
@@ -0,0 +1,228 @@
1
+ # !/usr/bin/env python3
2
+ # -*- coding:utf-8 -*-
3
+
4
+ # @Time : 2024/5/30 10:22
5
+ # @Author : fanen.lhy
6
+ # @Email : fanen.lhy@antgroup.com
7
+ # @FileName: milvus_store.py
8
+ from typing import List, Optional
9
+
10
+ try:
11
+ from pymilvus import connections, Collection, CollectionSchema, \
12
+ FieldSchema, DataType, utility
13
+ except ImportError as e:
14
+ raise ImportError(
15
+ "pymilvus is not installed. Please install it with 'pip install pymilvus'") from e
16
+
17
+ from agentuniverse.agent.action.knowledge.store.document import Document
18
+ from agentuniverse.agent.action.knowledge.store.query import Query
19
+ from agentuniverse.agent.action.knowledge.store.store import Store
20
+
21
+ DEFAULT_CONNECTION_ARGS = {
22
+ "host": "localhost",
23
+ "port": "19530"
24
+ }
25
+
26
+ DEFAULT_SEARCH_ARGS = {
27
+ "metric_type": "L2",
28
+ "params": {"nprobe": 10}
29
+ }
30
+
31
+ DEFAULT_INDEX_PARAMS = {
32
+ "metric_type": "L2",
33
+ "index_type": "HNSW",
34
+ "params": {"M": 8, "efConstruction": 64},
35
+ }
36
+
37
+
38
+ class MilvusStore(Store):
39
+ collection_name: Optional[str] = 'milvus_db'
40
+ collection: Collection = None
41
+ connection_name: str = 'default_connection'
42
+
43
+ def __init__(
44
+ self,
45
+ connection_args: dict = None,
46
+ **kwargs
47
+ ):
48
+ """Initialize the Milvus store class."""
49
+ super().__init__(**kwargs)
50
+ if not connection_args:
51
+ connection_args = DEFAULT_CONNECTION_ARGS
52
+ host = connection_args["host"]
53
+ port = connection_args["port"]
54
+ db_name = connection_args.get("db_name", "default")
55
+ self.connection_name = f"{host}_{port}_{db_name}"
56
+ self._connect_to_milvus(connection_args)
57
+ if utility.has_collection(self.collection_name,
58
+ using=self.connection_name):
59
+ self.collection = Collection(
60
+ self.collection_name, using=self.connection_name
61
+ )
62
+ self.collection.load()
63
+
64
+
65
+ def _connect_to_milvus(self, connection_args: dict):
66
+ """Connect to Milvus server."""
67
+ if not connections.has_connection(self.connection_name):
68
+ connections.connect(
69
+ alias=self.connection_name, **connection_args
70
+ )
71
+
72
+ def _create_or_load_collection(self,
73
+ dim: int = 128,
74
+ max_length: int = 65535,
75
+ index_params: dict = None):
76
+ """
77
+ Create a new collection or load an existing collection.
78
+
79
+ This method handles the creation of a new collection with specified parameters
80
+ or loads an existing collection if it already exists. Collections are used
81
+ to store data with specific dimensional attributes and indexing parameters.
82
+
83
+ Parameters:
84
+ - dim (int): The dimension of the collection, default is 128.
85
+ - max_length (int): The maximum length of the collection, default is 65535.
86
+ - index_params (dict, optional): Additional parameters for indexing. This
87
+ dictionary can include specific configurations for the index creation or loading.
88
+
89
+ Returns:
90
+ None
91
+ """
92
+ if utility.has_collection(self.collection_name,
93
+ using=self.connection_name):
94
+ self.collection = Collection(
95
+ self.collection_name, using=self.connection_name
96
+ )
97
+ else:
98
+ if not index_params:
99
+ index_params = DEFAULT_INDEX_PARAMS
100
+ fields = [
101
+ FieldSchema(name="id", dtype=DataType.VARCHAR, max_length=100,
102
+ is_primary=True),
103
+ FieldSchema(name="embedding", dtype=DataType.FLOAT_VECTOR,
104
+ dim=dim),
105
+ FieldSchema(name="text", dtype=DataType.VARCHAR,
106
+ max_length=max_length),
107
+ FieldSchema(name="metadata", dtype=DataType.JSON)
108
+ ]
109
+ schema = CollectionSchema(fields, "Milvus collection schema")
110
+ self.collection = Collection(self.collection_name, schema,
111
+ using=self.connection_name)
112
+ self.collection.create_index(
113
+ field_name="embedding",
114
+ index_params=index_params
115
+ )
116
+ self.collection.load()
117
+
118
+ def query(self,
119
+ query: Query,
120
+ search_args: dict = None,
121
+ **kwargs) -> List[Document]:
122
+ """
123
+ Query the Milvus collection with the given query and return the top k results.
124
+
125
+ Parameters:
126
+ - query (Query): The query object that contains the parameters and data for the search.
127
+ - search_args (dict, optional): A dictionary of additional arguments for the search.
128
+ This can include parameters such as the number of results to return, specific search
129
+ algorithms, or other configurations.
130
+
131
+ Returns:
132
+ - List[Document]: A list of Document objects that are the top k results from the query.
133
+ """
134
+ if not self.collection:
135
+ return self.to_documents([])
136
+ embedding = query.embedding
137
+ if self.embedding_model is not None and len(embedding) == 0:
138
+ embedding = self.embedding_model.get_embeddings([query.query_str])[
139
+ 0]
140
+ if not search_args:
141
+ search_args = DEFAULT_SEARCH_ARGS
142
+ if len(embedding) > 0:
143
+ query_result = self.collection.search(
144
+ data=[embedding],
145
+ anns_field="embedding",
146
+ param=search_args,
147
+ limit=query.similarity_top_k,
148
+ output_fields=["id", "text", "embedding", "metadata"]
149
+ )
150
+ else:
151
+ query_result = []
152
+ return self.to_documents(query_result)
153
+
154
+
155
+ def upsert_document(self,
156
+ documents: List[Document],
157
+ max_length: int = 65535,
158
+ index_params: dict = None,
159
+ **kwargs):
160
+ """
161
+ This method inserts new documents or updates existing documents in the collection.
162
+ The upsert operation ensures that the documents are either added if they do not
163
+ already exist or updated if they do.
164
+
165
+ Parameters:
166
+ - documents (List[Document]): A list of Document objects to be upserted into the collection.
167
+ - max_length (int): The maximum length of the collection, default is 65535.
168
+ - index_params (dict, optional): Additional parameters for indexing. This dictionary
169
+ can include specific configurations for the index creation or updating.
170
+
171
+ Returns:
172
+ None
173
+ """
174
+ for document in documents:
175
+ embedding = document.embedding
176
+ if self.embedding_model is not None and len(embedding) == 0:
177
+ embedding = self.embedding_model.get_embeddings([document.text])[0]
178
+ if not self.collection:
179
+ self._create_or_load_collection(
180
+ dim=len(embedding),
181
+ max_length=max_length,
182
+ index_params=index_params
183
+ )
184
+ expr = f'id == "{document.id}"'
185
+ existing_docs = self.collection.query(expr)
186
+ entities = [
187
+ [document.id],
188
+ [embedding],
189
+ [document.text],
190
+ [document.metadata]
191
+ ]
192
+ if existing_docs:
193
+ self.collection.delete(expr)
194
+ self.collection.insert(entities)
195
+ else:
196
+ self.collection.insert(entities)
197
+ self.collection.load()
198
+
199
+ def insert_documents(self,
200
+ documents: List[Document],
201
+ max_length: int = 65535,
202
+ index_params: dict = None,
203
+ ):
204
+ """Insert documents to the Milvus collection."""
205
+ self.upsert_document(documents, max_length, index_params)
206
+
207
+ def update_document(self, documents: List[Document], **kwargs):
208
+ """Update document into the store."""
209
+ self.upsert_document(documents)
210
+
211
+ @staticmethod
212
+ def to_documents(query_result) -> List[Document]:
213
+ """Convert the query results of Milvus to the AgentUniverse(AU)
214
+ document format."""
215
+ if query_result is None:
216
+ return []
217
+ documents = []
218
+ for result in query_result:
219
+ for res in result:
220
+ documents.append(Document(
221
+ id=res.fields.get("id"),
222
+ text=res.fields.get("text"),
223
+ embedding=res.fields.get("embedding")
224
+ if res.fields.get("embedding") else [],
225
+ metadata=res.fields.get("metadata")
226
+ if res.fields.get("metadata") else None)
227
+ )
228
+ return documents
@@ -5,7 +5,8 @@
5
5
  # @Email : lc299034@antgroup.com
6
6
  # @FileName: planning_agent.py
7
7
  """Planning agent module."""
8
- import json
8
+ from langchain.output_parsers.json import parse_json_markdown
9
+
9
10
  from agentuniverse.agent.agent import Agent
10
11
  from agentuniverse.agent.input_object import InputObject
11
12
 
@@ -44,7 +45,7 @@ class PlanningAgent(Agent):
44
45
  dict: Agent result object.
45
46
  """
46
47
  output = planner_result.get('output')
47
- output = json.loads(output)
48
+ output = parse_json_markdown(output)
48
49
  planner_result['framework'] = output['framework']
49
50
  planner_result['thought'] = output['thought']
50
51
  return planner_result
@@ -4,7 +4,7 @@ info:
4
4
  profile:
5
5
  llm_model:
6
6
  name: 'default_openai_llm'
7
- model_name: 'gpt-4'
7
+ model_name: 'gpt-4o'
8
8
  plan:
9
9
  planner:
10
10
  name: 'rag_planner'
@@ -5,7 +5,8 @@
5
5
  # @Email : lc299034@antgroup.com
6
6
  # @FileName: reviewing_agent.py
7
7
  """Reviewing Agent class."""
8
- import json
8
+ from langchain.output_parsers.json import parse_json_markdown
9
+
9
10
  from agentuniverse.agent.agent import Agent
10
11
  from agentuniverse.agent.input_object import InputObject
11
12
 
@@ -46,7 +47,7 @@ class ReviewingAgent(Agent):
46
47
  agent_result = dict()
47
48
 
48
49
  output = planner_result.get('output')
49
- output = json.loads(output)
50
+ output = parse_json_markdown(output)
50
51
  is_useful = output.get('is_useful')
51
52
  if is_useful is None:
52
53
  is_useful = False
@@ -70,10 +70,10 @@ class ChatMemory(Memory):
70
70
  ChatMemory: the ChatMemory object
71
71
  """
72
72
  super().initialize_by_component_configer(component_configer)
73
- if component_configer.input_key:
73
+ if hasattr(component_configer, 'input_key') and component_configer.input_key:
74
74
  self.input_key = component_configer.input_key
75
- if component_configer.output_key:
75
+ if hasattr(component_configer, 'output_key') and component_configer.output_key:
76
76
  self.output_key = component_configer.output_key
77
- if component_configer.prompt_version:
77
+ if hasattr(component_configer, 'prompt_version') and component_configer.prompt_version:
78
78
  self.prompt_version = component_configer.prompt_version
79
79
  return self
@@ -6,7 +6,7 @@
6
6
  # @Email : wangchongshi.wcs@antgroup.com
7
7
  # @FileName: default_memory.py
8
8
  from agentuniverse.agent.memory.chat_memory import ChatMemory
9
- from agentuniverse.llm.openai_llm import OpenAILLM
9
+ from agentuniverse.llm.default.default_openai_llm import DefaultOpenAILLM
10
10
 
11
11
 
12
12
  class DefaultMemory(ChatMemory):
@@ -24,4 +24,4 @@ class DefaultMemory(ChatMemory):
24
24
  default memory uses OpenAILLM(gpt-3.5-turbo) object as the memory llm.
25
25
  """
26
26
  super().__init__(**kwargs)
27
- self.llm = OpenAILLM(model_name="gpt-3.5-turbo")
27
+ self.llm = DefaultOpenAILLM(model_name="gpt-4o")
@@ -7,10 +7,8 @@
7
7
  # @FileName: langchain_instance.py
8
8
  from typing import List, Optional, Dict, Any
9
9
 
10
- from langchain.chains import LLMChain
11
10
  from langchain_core.messages import BaseMessage, get_buffer_string
12
11
  from langchain.memory import ConversationSummaryBufferMemory, ConversationTokenBufferMemory
13
- from langchain.memory.summary import SummarizerMixin
14
12
 
15
13
  from agentuniverse.agent.memory.enum import ChatMessageEnum
16
14
  from agentuniverse.agent.memory.message import Message
@@ -18,7 +16,7 @@ from agentuniverse.prompt.prompt import Prompt
18
16
  from agentuniverse.prompt.prompt_manager import PromptManager
19
17
 
20
18
 
21
- class AuConversationSummaryBufferMemory(ConversationSummaryBufferMemory, SummarizerMixin):
19
+ class AuConversationSummaryBufferMemory(ConversationSummaryBufferMemory):
22
20
  """Long term memory to store conversation memory.
23
21
 
24
22
  If memories exceeds the max tokens limit,
@@ -46,18 +44,18 @@ class AuConversationSummaryBufferMemory(ConversationSummaryBufferMemory, Summari
46
44
  @property
47
45
  def load_memory(self) -> List[BaseMessage]:
48
46
  """ General method: load the memory context from the memory buffer."""
49
- buffer = self.buffer
47
+ messages = self.chat_memory.messages
50
48
  if self.moving_summary_buffer != "":
51
49
  moving_messages: List[BaseMessage] = [
52
50
  self.summary_message_cls(content=self.moving_summary_buffer)
53
51
  ]
54
- buffer = moving_messages + buffer
55
- return buffer
52
+ messages = moving_messages + messages
53
+ return messages
56
54
 
57
55
  @property
58
56
  def load_memory_str(self) -> str:
59
57
  """ General method: load the memory context from the memory buffer as string format."""
60
- buffer = get_buffer_string(self.buffer)
58
+ buffer = get_buffer_string(self.chat_memory.messages)
61
59
  if self.moving_summary_buffer is not None:
62
60
  buffer = self.moving_summary_buffer + buffer
63
61
  return buffer
@@ -117,8 +115,9 @@ class AuConversationSummaryBufferMemory(ConversationSummaryBufferMemory, Summari
117
115
  )
118
116
  prompt_version = self.prompt_version if self.prompt_version else 'chat_memory.summarizer_cn'
119
117
  prompt: Prompt = PromptManager().get_instance_obj(prompt_version)
120
- chain = LLMChain(llm=self.llm, prompt=prompt.as_langchain())
121
- return chain.predict(summary=existing_summary, new_lines=new_lines)
118
+ chain = prompt.as_langchain() | self.llm
119
+ res = chain.invoke(input={'summary': existing_summary, 'new_lines': new_lines})
120
+ return res.content
122
121
 
123
122
 
124
123
  class AuConversationTokenBufferMemory(ConversationTokenBufferMemory):
@@ -7,12 +7,14 @@
7
7
  """Execution planner module."""
8
8
  import asyncio
9
9
 
10
- from langchain.chains import LLMChain
11
- from langchain_core.memory import BaseMemory
10
+ from langchain_core.chat_history import InMemoryChatMessageHistory
11
+ from langchain_core.runnables.history import RunnableWithMessageHistory
12
12
 
13
13
  from agentuniverse.agent.agent_model import AgentModel
14
14
  from agentuniverse.agent.input_object import InputObject
15
+ from agentuniverse.agent.memory.chat_memory import ChatMemory
15
16
  from agentuniverse.agent.plan.planner.planner import Planner
17
+ from agentuniverse.base.util.memory_util import generate_memories
16
18
  from agentuniverse.base.util.prompt_util import process_llm_token
17
19
  from agentuniverse.llm.llm import LLM
18
20
  from agentuniverse.prompt.prompt import Prompt
@@ -34,7 +36,7 @@ class ExecutingPlanner(Planner):
34
36
  dict: The planner result.
35
37
  """
36
38
 
37
- memory: BaseMemory = self.handle_memory(agent_model, planner_input)
39
+ memory: ChatMemory = self.handle_memory(agent_model, planner_input)
38
40
 
39
41
  self.handle_all_actions(agent_model, planner_input, input_object)
40
42
 
@@ -43,10 +45,17 @@ class ExecutingPlanner(Planner):
43
45
  prompt: Prompt = self.handle_prompt(agent_model, planner_input)
44
46
  process_llm_token(llm, prompt.as_langchain(), agent_model.profile, planner_input)
45
47
 
46
- llm_chain = LLMChain(llm=llm.as_langchain(),
47
- prompt=prompt.as_langchain(),
48
- output_key=self.output_key, memory=memory)
49
- return asyncio.run(llm_chain.acall(inputs=planner_input))
48
+ chat_history = memory.as_langchain().chat_memory if memory else InMemoryChatMessageHistory()
49
+
50
+ chain_with_history = RunnableWithMessageHistory(
51
+ prompt.as_langchain() | llm.as_langchain(),
52
+ lambda session_id: chat_history,
53
+ history_messages_key="chat_history",
54
+ input_messages_key=self.input_key,
55
+ )
56
+ res = asyncio.run(
57
+ chain_with_history.ainvoke(input=planner_input, config={"configurable": {"session_id": "unused"}}))
58
+ return {**planner_input, self.output_key: res.content, 'chat_history': generate_memories(chat_history)}
50
59
 
51
60
  def handle_prompt(self, agent_model: AgentModel, planner_input: dict) -> Prompt:
52
61
  """Prompt module processing.
@@ -7,12 +7,14 @@
7
7
  """Expressing planner module."""
8
8
  import asyncio
9
9
 
10
- from langchain.chains import LLMChain
11
- from langchain_core.memory import BaseMemory
10
+ from langchain_core.chat_history import InMemoryChatMessageHistory
11
+ from langchain_core.runnables.history import RunnableWithMessageHistory
12
12
 
13
13
  from agentuniverse.agent.agent_model import AgentModel
14
14
  from agentuniverse.agent.input_object import InputObject
15
+ from agentuniverse.agent.memory.chat_memory import ChatMemory
15
16
  from agentuniverse.agent.plan.planner.planner import Planner
17
+ from agentuniverse.base.util.memory_util import generate_memories
16
18
  from agentuniverse.base.util.prompt_util import process_llm_token
17
19
  from agentuniverse.llm.llm import LLM
18
20
  from agentuniverse.prompt.prompt import Prompt
@@ -33,18 +35,24 @@ class ExpressingPlanner(Planner):
33
35
  Returns:
34
36
  dict: The planner result.
35
37
  """
36
- memory: BaseMemory = self.handle_memory(agent_model, planner_input)
38
+ memory: ChatMemory = self.handle_memory(agent_model, planner_input)
37
39
 
38
40
  llm: LLM = self.handle_llm(agent_model)
39
41
 
40
42
  prompt: Prompt = self.handle_prompt(agent_model, planner_input)
41
43
  process_llm_token(llm, prompt.as_langchain(), agent_model.profile, planner_input)
42
44
 
43
- llm_chain = LLMChain(llm=llm.as_langchain(),
44
- prompt=prompt.as_langchain(),
45
- output_key=self.output_key, memory=memory)
46
-
47
- return asyncio.run(llm_chain.acall(inputs=planner_input))
45
+ chat_history = memory.as_langchain().chat_memory if memory else InMemoryChatMessageHistory()
46
+
47
+ chain_with_history = RunnableWithMessageHistory(
48
+ prompt.as_langchain() | llm.as_langchain(),
49
+ lambda session_id: chat_history,
50
+ history_messages_key="chat_history",
51
+ input_messages_key=self.input_key,
52
+ )
53
+ res = asyncio.run(
54
+ chain_with_history.ainvoke(input=planner_input, config={"configurable": {"session_id": "unused"}}))
55
+ return {**planner_input, self.output_key: res.content, 'chat_history': generate_memories(chat_history)}
48
56
 
49
57
  def handle_prompt(self, agent_model: AgentModel, planner_input: dict) -> Prompt:
50
58
  """Prompt module processing.
@@ -56,6 +56,8 @@ class PeerPlanner(Planner):
56
56
  agents = dict()
57
57
  for config_key, default_agent in default_sub_agents.items():
58
58
  config_data = planner_config.get(config_key, None)
59
+ if config_data == '':
60
+ continue
59
61
  agents[config_key] = AgentManager().get_instance_obj(config_data if config_data else default_agent)
60
62
  return agents
61
63
 
@@ -108,10 +110,10 @@ class PeerPlanner(Planner):
108
110
  reviewingAgent = agents.get('reviewing')
109
111
 
110
112
  for _ in range(retry_count):
111
- LOGGER.info(f"Starting peer agents, retry_count is {_}.")
113
+ LOGGER.info(f"Starting peer agents, retry_count is {_ + 1}.")
112
114
  if not planning_result or jump_step == "planning":
113
115
  if not planningAgent:
114
- LOGGER.warn("no planning agent, use default.")
116
+ LOGGER.warn("no planning agent.")
115
117
  planning_result = OutputObject({"framework": [agent_input.get('input')]})
116
118
  else:
117
119
  LOGGER.info(f"Starting planning agent.")
@@ -126,7 +128,7 @@ class PeerPlanner(Planner):
126
128
 
127
129
  if not executing_result or jump_step in ["planning", "executing"]:
128
130
  if not executingAgent:
129
- LOGGER.warn("no executing agent, use default.")
131
+ LOGGER.warn("no executing agent.")
130
132
  executing_result = OutputObject({})
131
133
  else:
132
134
  LOGGER.info(f"Starting executing agent.")
@@ -135,15 +137,16 @@ class PeerPlanner(Planner):
135
137
  input_object.add_data('executing_result', executing_result)
136
138
  # add executing agent log info
137
139
  logger_info = f"\nExecuting agent execution result is :\n"
138
- for index, one_exec_res in enumerate(executing_result.get_data('executing_result')):
139
- one_exec_log_info = f"[{index + 1}] input: {one_exec_res['input']}\n"
140
- one_exec_log_info += f"[{index + 1}] output: {one_exec_res['output']}\n"
141
- logger_info += one_exec_log_info
140
+ if executing_result.get_data('executing_result'):
141
+ for index, one_exec_res in enumerate(executing_result.get_data('executing_result')):
142
+ one_exec_log_info = f"[{index + 1}] input: {one_exec_res['input']}\n"
143
+ one_exec_log_info += f"[{index + 1}] output: {one_exec_res['output']}\n"
144
+ logger_info += one_exec_log_info
142
145
  LOGGER.info(logger_info)
143
146
 
144
147
  if not expressing_result or jump_step in ["planning", "executing", "expressing"]:
145
148
  if not expressingAgent:
146
- LOGGER.warn("no expression agent, use default.")
149
+ LOGGER.warn("no expression agent.")
147
150
  expressing_result = OutputObject({})
148
151
  else:
149
152
  LOGGER.info(f"Starting expressing agent.")
@@ -157,7 +160,7 @@ class PeerPlanner(Planner):
157
160
 
158
161
  if not reviewing_result or jump_step in ["planning", "executing", "expressing", "reviewing"]:
159
162
  if not reviewingAgent:
160
- LOGGER.warn("no expression agent, use default.")
163
+ LOGGER.warn("no expression agent.")
161
164
  loopResults.append({
162
165
  "planning_result": planning_result,
163
166
  "executing_result": executing_result,
@@ -169,7 +172,7 @@ class PeerPlanner(Planner):
169
172
  else:
170
173
  LOGGER.info(f"Starting reviewing agent.")
171
174
  reviewing_result = reviewingAgent.run(**input_object.to_dict())
172
- input_object.add_data('evaluator_result', reviewing_result)
175
+ input_object.add_data('reviewing_result', reviewing_result)
173
176
 
174
177
  # add reviewing agent log info
175
178
  logger_info = f"\nReviewing agent execution result is :\n"
@@ -5,12 +5,11 @@
5
5
  # @Email : lc299034@antgroup.com
6
6
  # @FileName: planner.py
7
7
  """Base class for Planner."""
8
- import copy
9
8
  from abc import abstractmethod
9
+ import copy
10
+ import logging
10
11
  from typing import Optional, List
11
12
 
12
- from langchain_core.memory import BaseMemory
13
-
14
13
  from agentuniverse.agent.action.knowledge.knowledge import Knowledge
15
14
  from agentuniverse.agent.action.knowledge.knowledge_manager import KnowledgeManager
16
15
  from agentuniverse.agent.action.knowledge.store.document import Document
@@ -18,6 +17,7 @@ from agentuniverse.agent.action.knowledge.store.query import Query
18
17
  from agentuniverse.agent.action.tool.tool_manager import ToolManager
19
18
  from agentuniverse.agent.agent_model import AgentModel
20
19
  from agentuniverse.agent.input_object import InputObject
20
+ from agentuniverse.agent.memory.chat_memory import ChatMemory
21
21
  from agentuniverse.agent.memory.memory import Memory
22
22
  from agentuniverse.agent.memory.message import Message
23
23
  from agentuniverse.agent.memory.memory_manager import MemoryManager
@@ -29,6 +29,8 @@ from agentuniverse.llm.llm_manager import LLMManager
29
29
  from agentuniverse.prompt.prompt import Prompt
30
30
  from agentuniverse.base.util.memory_util import generate_messages
31
31
 
32
+ logging.getLogger().setLevel(logging.ERROR)
33
+
32
34
 
33
35
  class Planner(ComponentBase):
34
36
  """
@@ -60,7 +62,7 @@ class Planner(ComponentBase):
60
62
  """
61
63
  pass
62
64
 
63
- def handle_memory(self, agent_model: AgentModel, planner_input: dict) -> BaseMemory | None:
65
+ def handle_memory(self, agent_model: AgentModel, planner_input: dict) -> ChatMemory | None:
64
66
  """Memory module processing.
65
67
 
66
68
  Args:
@@ -82,15 +84,11 @@ class Planner(ComponentBase):
82
84
  params['input_key'] = self.input_key
83
85
  params['output_key'] = self.output_key
84
86
 
85
- memory: Memory = MemoryManager().get_instance_obj(memory_name)
87
+ memory: ChatMemory = MemoryManager().get_instance_obj(component_instance_name=memory_name, new_instance=True)
86
88
  if memory is None:
87
89
  return None
88
- copied_memory = copy.deepcopy(memory)
89
- copied_memory.set_by_agent_model(**params)
90
- langchain_memory: BaseMemory = copied_memory.as_langchain()
91
-
92
- planner_input['chat_history'] = langchain_memory.load_memory_str
93
- return langchain_memory
90
+ memory.set_by_agent_model(**params)
91
+ return memory
94
92
 
95
93
  def handle_all_actions(self, agent_model: AgentModel, planner_input: dict, input_object: InputObject):
96
94
  """Tool and knowledge processing.
@@ -144,10 +142,9 @@ class Planner(ComponentBase):
144
142
  LLM: The language model.
145
143
  """
146
144
  llm_name = agent_model.profile.get('llm_model').get('name')
147
- llm: LLM = LLMManager().get_instance_obj(llm_name)
148
- copied_llm = copy.deepcopy(llm)
149
- copied_llm.set_by_agent_model(**agent_model.profile.get('llm_model'))
150
- return copied_llm
145
+ llm: LLM = LLMManager().get_instance_obj(component_instance_name=llm_name, new_instance=True)
146
+ llm.set_by_agent_model(**agent_model.profile.get('llm_model'))
147
+ return llm
151
148
 
152
149
  def initialize_by_component_configer(self, component_configer: PlannerConfiger) -> 'Planner':
153
150
  """Initialize the planner by the PlannerConfiger object.