lionagi 0.1.0__tar.gz → 0.1.2__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. {lionagi-0.1.0/lionagi.egg-info → lionagi-0.1.2}/PKG-INFO +1 -1
  2. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/agent/base_agent.py +2 -3
  3. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/branch/base.py +1 -1
  4. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/branch/branch.py +2 -1
  5. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/branch/flow_mixin.py +1 -1
  6. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/branch/util.py +1 -1
  7. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/execute/base_executor.py +1 -4
  8. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/execute/branch_executor.py +66 -3
  9. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/execute/instruction_map_executor.py +48 -0
  10. lionagi-0.1.2/lionagi/core/execute/neo4j_executor.py +381 -0
  11. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/execute/structure_executor.py +120 -4
  12. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/flow/monoflow/ReAct.py +21 -19
  13. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/flow/monoflow/chat_mixin.py +1 -1
  14. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/flow/monoflow/followup.py +14 -13
  15. lionagi-0.1.2/lionagi/core/flow/polyflow/__init__.py +1 -0
  16. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/component.py +197 -122
  17. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/condition.py +3 -1
  18. lionagi-0.1.2/lionagi/core/generic/edge.py +162 -0
  19. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/graph/graph.py +1 -1
  20. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/mail/mail_manager.py +3 -2
  21. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/session/session.py +1 -1
  22. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/tool/tool_manager.py +10 -9
  23. lionagi-0.1.2/lionagi/experimental/directive/evaluator/ast_evaluator.py +115 -0
  24. lionagi-0.1.2/lionagi/experimental/directive/evaluator/base_evaluator.py +202 -0
  25. lionagi-0.1.2/lionagi/experimental/directive/evaluator/sandbox_.py +14 -0
  26. lionagi-0.1.2/lionagi/experimental/directive/evaluator/script_engine.py +83 -0
  27. lionagi-0.1.2/lionagi/experimental/directive/parser/base_parser.py +215 -0
  28. lionagi-0.1.2/lionagi/experimental/directive/schema.py +36 -0
  29. lionagi-0.1.2/lionagi/experimental/directive/template_/base_template.py +63 -0
  30. lionagi-0.1.2/lionagi/experimental/report/form.py +64 -0
  31. lionagi-0.1.2/lionagi/experimental/report/report.py +138 -0
  32. lionagi-0.1.2/lionagi/experimental/report/util.py +47 -0
  33. lionagi-0.1.2/lionagi/experimental/tool/function_calling.py +43 -0
  34. lionagi-0.1.2/lionagi/experimental/tool/manual.py +66 -0
  35. lionagi-0.1.2/lionagi/experimental/tool/schema.py +59 -0
  36. lionagi-0.1.2/lionagi/experimental/tool/tool_manager.py +138 -0
  37. lionagi-0.1.2/lionagi/experimental/tool/util.py +16 -0
  38. lionagi-0.1.2/lionagi/experimental/validator/rule.py +139 -0
  39. lionagi-0.1.2/lionagi/experimental/validator/validator.py +56 -0
  40. lionagi-0.1.2/lionagi/experimental/work/__init__.py +10 -0
  41. lionagi-0.1.2/lionagi/experimental/work/async_queue.py +54 -0
  42. lionagi-0.1.2/lionagi/experimental/work/schema.py +73 -0
  43. lionagi-0.1.2/lionagi/experimental/work/work_function.py +67 -0
  44. lionagi-0.1.2/lionagi/experimental/work/worker.py +56 -0
  45. lionagi-0.1.2/lionagi/experimental/work2/form.py +371 -0
  46. lionagi-0.1.2/lionagi/experimental/work2/report.py +289 -0
  47. lionagi-0.1.2/lionagi/experimental/work2/schema.py +30 -0
  48. lionagi-0.1.2/lionagi/experimental/work2/tests.py +72 -0
  49. lionagi-0.1.2/lionagi/experimental/work2/work_function.py +89 -0
  50. lionagi-0.1.2/lionagi/experimental/work2/worker.py +12 -0
  51. lionagi-0.1.2/lionagi/integrations/bridge/autogen_/__init__.py +0 -0
  52. lionagi-0.1.2/lionagi/integrations/bridge/autogen_/autogen_.py +124 -0
  53. lionagi-0.1.2/lionagi/integrations/bridge/langchain_/__init__.py +0 -0
  54. lionagi-0.1.2/lionagi/integrations/bridge/llamaindex_/__init__.py +0 -0
  55. lionagi-0.1.2/lionagi/integrations/bridge/llamaindex_/get_index.py +294 -0
  56. lionagi-0.1.2/lionagi/integrations/bridge/llamaindex_/index.py +0 -0
  57. lionagi-0.1.2/lionagi/integrations/bridge/llamaindex_/llama_pack.py +227 -0
  58. lionagi-0.1.2/lionagi/integrations/bridge/pydantic_/__init__.py +0 -0
  59. lionagi-0.1.2/lionagi/integrations/bridge/transformers_/__init__.py +0 -0
  60. lionagi-0.1.2/lionagi/integrations/bridge/transformers_/install_.py +36 -0
  61. lionagi-0.1.2/lionagi/integrations/chunker/__init__.py +0 -0
  62. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/config/oai_configs.py +1 -1
  63. lionagi-0.1.2/lionagi/integrations/config/ollama_configs.py +1 -0
  64. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/config/openrouter_configs.py +1 -1
  65. lionagi-0.1.2/lionagi/integrations/loader/__init__.py +0 -0
  66. lionagi-0.1.2/lionagi/integrations/storage/__init__.py +3 -0
  67. lionagi-0.1.2/lionagi/integrations/storage/neo4j.py +673 -0
  68. lionagi-0.1.2/lionagi/integrations/storage/storage_util.py +289 -0
  69. lionagi-0.1.2/lionagi/integrations/storage/structure_excel.py +268 -0
  70. lionagi-0.1.2/lionagi/integrations/storage/to_csv.py +63 -0
  71. lionagi-0.1.2/lionagi/integrations/storage/to_excel.py +76 -0
  72. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/libs/__init__.py +4 -0
  73. lionagi-0.1.2/lionagi/libs/ln_knowledge_graph.py +405 -0
  74. lionagi-0.1.2/lionagi/libs/ln_queue.py +101 -0
  75. lionagi-0.1.2/lionagi/libs/ln_tokenizer.py +57 -0
  76. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/libs/sys_util.py +1 -1
  77. lionagi-0.1.2/lionagi/lions/__init__.py +0 -0
  78. lionagi-0.1.2/lionagi/lions/coder/__init__.py +0 -0
  79. lionagi-0.1.2/lionagi/lions/coder/add_feature.py +20 -0
  80. lionagi-0.1.2/lionagi/lions/coder/base_prompts.py +22 -0
  81. lionagi-0.1.2/lionagi/lions/coder/coder.py +121 -0
  82. lionagi-0.1.2/lionagi/lions/coder/util.py +91 -0
  83. lionagi-0.1.2/lionagi/lions/researcher/__init__.py +0 -0
  84. lionagi-0.1.2/lionagi/lions/researcher/data_source/__init__.py +0 -0
  85. lionagi-0.1.2/lionagi/lions/researcher/data_source/finhub_.py +191 -0
  86. lionagi-0.1.2/lionagi/lions/researcher/data_source/google_.py +199 -0
  87. lionagi-0.1.2/lionagi/lions/researcher/data_source/wiki_.py +96 -0
  88. lionagi-0.1.2/lionagi/lions/researcher/data_source/yfinance_.py +21 -0
  89. lionagi-0.1.2/lionagi/tests/__init__.py +0 -0
  90. lionagi-0.1.2/lionagi/tests/integrations/__init__.py +0 -0
  91. lionagi-0.1.2/lionagi/tests/libs/__init__.py +0 -0
  92. lionagi-0.1.2/lionagi/tests/libs/test_async.py +0 -0
  93. lionagi-0.1.2/lionagi/tests/libs/test_queue.py +67 -0
  94. lionagi-0.1.2/lionagi/tests/test_core/__init__.py +0 -0
  95. lionagi-0.1.2/lionagi/tests/test_core/generic/__init__.py +0 -0
  96. lionagi-0.1.2/lionagi/tests/test_core/generic/test_component.py +89 -0
  97. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/test_core/test_branch.py +0 -1
  98. lionagi-0.1.2/lionagi/version.py +1 -0
  99. {lionagi-0.1.0 → lionagi-0.1.2/lionagi.egg-info}/PKG-INFO +1 -1
  100. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi.egg-info/SOURCES.txt +71 -1
  101. lionagi-0.1.0/lionagi/core/flow/polyflow/__init__.py +0 -1
  102. lionagi-0.1.0/lionagi/core/generic/edge.py +0 -110
  103. lionagi-0.1.0/lionagi/integrations/config/ollama_configs.py +0 -1
  104. lionagi-0.1.0/lionagi/version.py +0 -1
  105. {lionagi-0.1.0 → lionagi-0.1.2}/LICENSE +0 -0
  106. {lionagi-0.1.0 → lionagi-0.1.2}/README.md +0 -0
  107. {lionagi-0.1.0 → lionagi-0.1.2}/README.rst +0 -0
  108. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/__init__.py +0 -0
  109. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/__init__.py +0 -0
  110. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/agent/__init__.py +0 -0
  111. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/branch/__init__.py +0 -0
  112. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/branch/executable_branch.py +0 -0
  113. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/direct/__init__.py +0 -0
  114. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/direct/cot.py +0 -0
  115. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/direct/plan.py +0 -0
  116. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/direct/predict.py +0 -0
  117. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/direct/react.py +0 -0
  118. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/direct/score.py +0 -0
  119. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/direct/select.py +0 -0
  120. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/direct/sentiment.py +0 -0
  121. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/direct/utils.py +0 -0
  122. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/direct/vote.py +0 -0
  123. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/execute/__init__.py +0 -0
  124. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/flow/__init__.py +0 -0
  125. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/flow/baseflow.py +0 -0
  126. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/flow/mono_chat_mixin.py +0 -0
  127. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/flow/monoflow/__init__.py +0 -0
  128. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/flow/monoflow/chat.py +0 -0
  129. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/flow/polyflow/chat.py +0 -0
  130. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/form/__init__.py +0 -0
  131. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/form/action_form.py +0 -0
  132. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/form/field_validator.py +0 -0
  133. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/form/form.py +0 -0
  134. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/form/mixin.py +0 -0
  135. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/form/scored_form.py +0 -0
  136. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/__init__.py +0 -0
  137. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/action.py +0 -0
  138. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/data_logger.py +0 -0
  139. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/mail.py +0 -0
  140. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/mailbox.py +0 -0
  141. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/node.py +0 -0
  142. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/relation.py +0 -0
  143. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/signal.py +0 -0
  144. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/structure.py +0 -0
  145. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/transfer.py +0 -0
  146. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/generic/work.py +0 -0
  147. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/graph/__init__.py +0 -0
  148. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/graph/tree.py +0 -0
  149. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/mail/__init__.py +0 -0
  150. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/mail/schema.py +0 -0
  151. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/messages/__init__.py +0 -0
  152. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/messages/schema.py +0 -0
  153. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/session/__init__.py +0 -0
  154. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/tool/__init__.py +0 -0
  155. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/core/tool/tool.py +0 -0
  156. {lionagi-0.1.0/lionagi/integrations/bridge/langchain_ → lionagi-0.1.2/lionagi/experimental}/__init__.py +0 -0
  157. {lionagi-0.1.0/lionagi/integrations/bridge/llamaindex_ → lionagi-0.1.2/lionagi/experimental/directive}/__init__.py +0 -0
  158. {lionagi-0.1.0/lionagi/integrations/bridge/pydantic_ → lionagi-0.1.2/lionagi/experimental/directive/evaluator}/__init__.py +0 -0
  159. {lionagi-0.1.0/lionagi/integrations/chunker → lionagi-0.1.2/lionagi/experimental/directive/parser}/__init__.py +0 -0
  160. {lionagi-0.1.0/lionagi/integrations/loader → lionagi-0.1.2/lionagi/experimental/directive/template_}/__init__.py +0 -0
  161. {lionagi-0.1.0/lionagi/tests → lionagi-0.1.2/lionagi/experimental/report}/__init__.py +0 -0
  162. {lionagi-0.1.0/lionagi/tests/integrations → lionagi-0.1.2/lionagi/experimental/tool}/__init__.py +0 -0
  163. {lionagi-0.1.0/lionagi/tests/libs → lionagi-0.1.2/lionagi/experimental/validator}/__init__.py +0 -0
  164. {lionagi-0.1.0/lionagi/tests/test_core → lionagi-0.1.2/lionagi/experimental/work2}/__init__.py +0 -0
  165. /lionagi-0.1.0/lionagi/integrations/bridge/llamaindex_/index.py → /lionagi-0.1.2/lionagi/experimental/work2/util.py +0 -0
  166. /lionagi-0.1.0/lionagi/tests/libs/test_async.py → /lionagi-0.1.2/lionagi/experimental/work2/work.py +0 -0
  167. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/__init__.py +0 -0
  168. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/bridge/__init__.py +0 -0
  169. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/bridge/langchain_/documents.py +0 -0
  170. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/bridge/langchain_/langchain_bridge.py +0 -0
  171. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/bridge/llamaindex_/llama_index_bridge.py +0 -0
  172. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/bridge/llamaindex_/node_parser.py +0 -0
  173. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/bridge/llamaindex_/reader.py +0 -0
  174. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/bridge/llamaindex_/textnode.py +0 -0
  175. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/bridge/pydantic_/pydantic_bridge.py +0 -0
  176. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/chunker/chunk.py +0 -0
  177. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/config/__init__.py +0 -0
  178. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/config/mlx_configs.py +0 -0
  179. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/loader/load.py +0 -0
  180. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/loader/load_util.py +0 -0
  181. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/provider/__init__.py +0 -0
  182. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/provider/litellm.py +0 -0
  183. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/provider/mistralai.py +0 -0
  184. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/provider/mlx_service.py +0 -0
  185. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/provider/oai.py +0 -0
  186. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/provider/ollama.py +0 -0
  187. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/provider/openrouter.py +0 -0
  188. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/provider/services.py +0 -0
  189. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/integrations/provider/transformers.py +0 -0
  190. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/libs/ln_api.py +0 -0
  191. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/libs/ln_async.py +0 -0
  192. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/libs/ln_convert.py +0 -0
  193. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/libs/ln_dataframe.py +0 -0
  194. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/libs/ln_func_call.py +0 -0
  195. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/libs/ln_nested.py +0 -0
  196. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/libs/ln_parse.py +0 -0
  197. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/libs/ln_validate.py +0 -0
  198. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/libs/test_api.py +0 -0
  199. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/libs/test_convert.py +0 -0
  200. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/libs/test_field_validators.py +0 -0
  201. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/libs/test_func_call.py +0 -0
  202. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/libs/test_nested.py +0 -0
  203. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/libs/test_parse.py +0 -0
  204. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/libs/test_sys_util.py +0 -0
  205. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/test_core/test_base_branch.py +0 -0
  206. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/test_core/test_chat_flow.py +0 -0
  207. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/test_core/test_mail_manager.py +0 -0
  208. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/test_core/test_prompts.py +0 -0
  209. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/test_core/test_session.py +0 -0
  210. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/test_core/test_session_base_util.py +0 -0
  211. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi/tests/test_core/test_tool_manager.py +0 -0
  212. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi.egg-info/dependency_links.txt +0 -0
  213. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi.egg-info/requires.txt +0 -0
  214. {lionagi-0.1.0 → lionagi-0.1.2}/lionagi.egg-info/top_level.txt +0 -0
  215. {lionagi-0.1.0 → lionagi-0.1.2}/pyproject.toml +0 -0
  216. {lionagi-0.1.0 → lionagi-0.1.2}/setup.cfg +0 -0
  217. {lionagi-0.1.0 → lionagi-0.1.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lionagi
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Towards automated general intelligence.
5
5
  Author: HaiyangLi
6
6
  Author-email: Haiyang Li <ocean@lionagi.ai>
@@ -19,7 +19,7 @@ class BaseAgent(Node):
19
19
 
20
20
  def __init__(
21
21
  self,
22
- structure: StructureExecutor,
22
+ structure: BaseExecutor,
23
23
  executable: BaseExecutor,
24
24
  output_parser=None,
25
25
  **kwargs,
@@ -33,7 +33,7 @@ class BaseAgent(Node):
33
33
  output_parser: A function for parsing the agent's output (optional).
34
34
  """
35
35
  super().__init__()
36
- self.structure: StructureExecutor = structure
36
+ self.structure: BaseExecutor = structure
37
37
  self.executable: BaseExecutor = executable
38
38
  for v, k in kwargs.items():
39
39
  executable.__setattr__(v, k)
@@ -87,4 +87,3 @@ class BaseAgent(Node):
87
87
 
88
88
  if self.output_parser:
89
89
  return self.output_parser(self)
90
-
@@ -650,4 +650,4 @@ class BaseBranch(BaseNode, ABC):
650
650
  messages = self.messages["sender"] if use_sender else self.messages["role"]
651
651
  result = messages.value_counts().to_dict()
652
652
  result["total"] = len(self.messages)
653
- return result
653
+ return result
@@ -470,4 +470,5 @@ class Branch(BaseBranch, BranchFlowMixin):
470
470
  }:
471
471
  return True
472
472
  except Exception:
473
- return False
473
+ return False
474
+ return False
@@ -93,4 +93,4 @@ class BranchFlowMixin(ABC):
93
93
  output_prompt=output_prompt,
94
94
  out=out,
95
95
  **kwargs,
96
- )
96
+ )
@@ -320,4 +320,4 @@ class MessageUtil:
320
320
  else:
321
321
  with contextlib.suppress(Exception):
322
322
  answers.append(nested.nget(content, ["system_info"]))
323
- return "\n".join(answers)
323
+ return "\n".join(answers)
@@ -18,7 +18,7 @@ class BaseExecutor(BaseComponent, ABC):
18
18
  execute_stop: bool = Field(
19
19
  False, description="A flag indicating whether to stop execution."
20
20
  )
21
- context: dict | str | None = Field(
21
+ context: dict | str | list | None = Field(
22
22
  None, description="The context buffer for the next instruction."
23
23
  )
24
24
  execution_responses: list = Field(
@@ -28,9 +28,6 @@ class BaseExecutor(BaseComponent, ABC):
28
28
  verbose: bool = Field(
29
29
  True, description="A flag indicating whether to provide verbose output."
30
30
  )
31
- execute_stop: bool = Field(
32
- False, description="A flag indicating whether to stop execution."
33
- )
34
31
 
35
32
  def send(self, recipient_id: str, category: str, package: Any) -> None:
36
33
  """
@@ -11,6 +11,10 @@ from lionagi.core.execute.base_executor import BaseExecutor
11
11
  class BranchExecutor(Branch, BaseExecutor):
12
12
 
13
13
  async def forward(self) -> None:
14
+ """
15
+ Forwards the execution by processing all pending incoming mails in each branch. Depending on the category of the mail,
16
+ it processes starts, nodes, node lists, conditions, or ends, accordingly executing different functions.
17
+ """
14
18
  for key in list(self.pending_ins.keys()):
15
19
  while self.pending_ins[key]:
16
20
  mail = self.pending_ins[key].popleft()
@@ -26,11 +30,27 @@ class BranchExecutor(Branch, BaseExecutor):
26
30
  self._process_end(mail)
27
31
 
28
32
  async def execute(self, refresh_time=1) -> None:
33
+ """
34
+ Executes the forward process repeatedly at specified time intervals until execution is instructed to stop.
35
+
36
+ Args:
37
+ refresh_time (int): The interval, in seconds, at which the forward method is called repeatedly.
38
+ """
29
39
  while not self.execute_stop:
30
40
  await self.forward()
31
41
  await AsyncUtil.sleep(refresh_time)
32
42
 
33
43
  async def _process_node(self, mail: BaseMail):
44
+ """
45
+ Processes a single node based on the node type specified in the mail's package. It handles different types of nodes such as System,
46
+ Instruction, ActionNode, and generic nodes through separate processes.
47
+
48
+ Args:
49
+ mail (BaseMail): The mail containing the node to be processed along with associated details.
50
+
51
+ Raises:
52
+ ValueError: If an invalid mail is encountered or the process encounters errors.
53
+ """
34
54
  if isinstance(mail.package["package"], System):
35
55
  self._system_process(mail.package["package"], verbose=self.verbose)
36
56
  self.send(
@@ -74,11 +94,26 @@ class BranchExecutor(Branch, BaseExecutor):
74
94
  raise ValueError(f"Invalid mail to process. Mail:{mail}")
75
95
 
76
96
  def _process_node_list(self, mail: BaseMail):
97
+ """
98
+ Processes a list of nodes provided in the mail, but currently only sends an end signal as multiple path selection is not supported.
99
+
100
+ Args:
101
+ mail (BaseMail): The mail containing a list of nodes to be processed.
102
+
103
+ Raises:
104
+ ValueError: When trying to process multiple paths which is currently unsupported.
105
+ """
77
106
  self.send(mail.sender_id, "end", {"request_source": self.id_, "package": "end"})
78
107
  self.execute_stop = True
79
108
  raise ValueError("Multiple path selection is currently not supported")
80
109
 
81
110
  def _process_condition(self, mail: BaseMail):
111
+ """
112
+ Processes a condition associated with an edge based on the mail's package, setting up the result of the condition check.
113
+
114
+ Args:
115
+ mail (BaseMail): The mail containing the condition to be processed.
116
+ """
82
117
  relationship: Edge = mail.package["package"]
83
118
  check_result = relationship.condition(self)
84
119
  back_mail = {
@@ -93,6 +128,14 @@ class BranchExecutor(Branch, BaseExecutor):
93
128
  )
94
129
 
95
130
  def _system_process(self, system: System, verbose=True, context_verbose=False):
131
+ """
132
+ Processes a system node, possibly displaying its content and context if verbose is enabled.
133
+
134
+ Args:
135
+ system (System): The system node to process.
136
+ verbose (bool): Flag to enable verbose output.
137
+ context_verbose (bool): Flag to enable verbose output specifically for context.
138
+ """
96
139
  from lionagi.libs import SysUtil
97
140
 
98
141
  SysUtil.check_import("IPython")
@@ -111,6 +154,14 @@ class BranchExecutor(Branch, BaseExecutor):
111
154
  async def _instruction_process(
112
155
  self, instruction: Instruction, verbose=True, **kwargs
113
156
  ):
157
+ """
158
+ Processes an instruction node, possibly displaying its content if verbose is enabled, and handling any additional keyword arguments.
159
+
160
+ Args:
161
+ instruction (Instruction): The instruction node to process.
162
+ verbose (bool): Flag to enable verbose output.
163
+ **kwargs: Additional keyword arguments that might affect how instructions are processed.
164
+ """
114
165
  from lionagi.libs import SysUtil
115
166
 
116
167
  SysUtil.check_import("IPython")
@@ -146,6 +197,13 @@ class BranchExecutor(Branch, BaseExecutor):
146
197
  self.execution_responses.append(result)
147
198
 
148
199
  async def _action_process(self, action: ActionNode, verbose=True):
200
+ """
201
+ Processes an action node, executing the defined action along with any tools specified within the node.
202
+
203
+ Args:
204
+ action (ActionNode): The action node to process.
205
+ verbose (bool): Flag to enable verbose output of the action results.
206
+ """
149
207
  from lionagi.libs import SysUtil
150
208
 
151
209
  SysUtil.check_import("IPython")
@@ -196,7 +254,7 @@ class BranchExecutor(Branch, BaseExecutor):
196
254
  agent: The agent to process.
197
255
  verbose (bool): A flag indicating whether to provide verbose output (default: True).
198
256
  """
199
- context = self.responses
257
+ context = list(self.messages["content"])
200
258
  if verbose:
201
259
  print("*****************************************************")
202
260
  result = await agent.execute(context)
@@ -204,8 +262,13 @@ class BranchExecutor(Branch, BaseExecutor):
204
262
  if verbose:
205
263
  print("*****************************************************")
206
264
 
207
- self.context = result
208
- self.responses.append(result)
265
+ from pandas import DataFrame
266
+
267
+ if isinstance(result, DataFrame):
268
+ self.context = list(result["content"])
269
+ else:
270
+ self.context = result
271
+ self.execution_responses.append(result)
209
272
 
210
273
  def _process_start(self, mail):
211
274
  """
@@ -10,6 +10,18 @@ from lionagi.core.execute.branch_executor import BranchExecutor
10
10
 
11
11
 
12
12
  class InstructionMapExecutor(BaseExecutor):
13
+ """
14
+ Manages the execution of a mapped set of instructions across multiple branches within an executable structure.
15
+
16
+ Attributes:
17
+ branches (dict[str, BranchExecutor]): A dictionary of branch executors managing individual instruction flows.
18
+ structure_id (str): The identifier for the structure within which these branches operate.
19
+ mail_transfer (MailTransfer): Handles the transfer of mail between branches and other components.
20
+ branch_kwargs (dict): Keyword arguments used for initializing branches.
21
+ num_end_branches (int): Tracks the number of branches that have completed execution.
22
+ mail_manager (MailManager): Manages the distribution and collection of mails across branches.
23
+ """
24
+
13
25
  branches: dict[str, BranchExecutor] = Field(
14
26
  default_factory=dict, description="The branches of the instruction mapping."
15
27
  )
@@ -27,10 +39,20 @@ class InstructionMapExecutor(BaseExecutor):
27
39
  )
28
40
 
29
41
  def __init__(self, **kwargs):
42
+ """
43
+ Initializes an InstructionMapExecutor with the given parameters.
44
+
45
+ Args:
46
+ **kwargs: Arbitrary keyword arguments passed to the base executor and used for initializing branch executors.
47
+ """
30
48
  super().__init__(**kwargs)
31
49
  self.mail_manager = MailManager([self.mail_transfer])
32
50
 
33
51
  def transfer_ins(self):
52
+ """
53
+ Processes incoming mails, directing them appropriately based on their categories, and handles the initial setup
54
+ of branches or the routing of node and condition mails.
55
+ """
34
56
  for key in list(self.pending_ins.keys()):
35
57
  while self.pending_ins[key]:
36
58
  mail: BaseMail = self.pending_ins[key].popleft()
@@ -48,6 +70,10 @@ class InstructionMapExecutor(BaseExecutor):
48
70
  self.mail_transfer.pending_outs.append(mail)
49
71
 
50
72
  def transfer_outs(self):
73
+ """
74
+ Processes outgoing mails from the central mail transfer, handling end-of-execution notifications and routing
75
+ other mails to appropriate recipients.
76
+ """
51
77
  for key in list(self.mail_transfer.pending_ins.keys()):
52
78
  while self.mail_transfer.pending_ins[key]:
53
79
  mail: BaseMail = self.mail_transfer.pending_ins[key].popleft()
@@ -66,6 +92,12 @@ class InstructionMapExecutor(BaseExecutor):
66
92
  self.pending_outs.append(mail)
67
93
 
68
94
  def _process_start(self, start_mail: BaseMail):
95
+ """
96
+ Processes a start mail to initialize a new branch executor and configures it based on the mail's package content.
97
+
98
+ Args:
99
+ start_mail (BaseMail): The mail initiating the start of a new branch execution.
100
+ """
69
101
  branch = BranchExecutor(verbose=self.verbose, **self.branch_kwargs)
70
102
  branch.context = start_mail.package["context"]
71
103
  self.branches[branch.id_] = branch
@@ -80,6 +112,13 @@ class InstructionMapExecutor(BaseExecutor):
80
112
  self.pending_outs.append(mail)
81
113
 
82
114
  def _process_node_list(self, nl_mail: BaseMail):
115
+ """
116
+ Processes a node list mail, setting up new branches or propagating the execution context based on the node list
117
+ provided in the mail.
118
+
119
+ Args:
120
+ nl_mail (BaseMail): The mail containing a list of nodes to be processed in subsequent branches.
121
+ """
83
122
  source_branch_id = nl_mail.package["request_source"]
84
123
  node_list = nl_mail.package["package"]
85
124
  shared_context = self.branches[source_branch_id].context
@@ -115,6 +154,9 @@ class InstructionMapExecutor(BaseExecutor):
115
154
  self.mail_transfer.pending_outs.append(node_mail)
116
155
 
117
156
  async def forward(self):
157
+ """
158
+ Forwards the execution by processing all incoming and outgoing mails and advancing the state of all active branches.
159
+ """
118
160
  self.transfer_ins()
119
161
  self.transfer_outs()
120
162
  self.mail_manager.collect_all()
@@ -126,6 +168,12 @@ class InstructionMapExecutor(BaseExecutor):
126
168
  return
127
169
 
128
170
  async def execute(self, refresh_time=1):
171
+ """
172
+ Continuously executes the forward process at specified intervals until instructed to stop.
173
+
174
+ Args:
175
+ refresh_time (int): The time in seconds between execution cycles.
176
+ """
129
177
  while not self.execute_stop:
130
178
  await self.forward()
131
179
  await asyncio.sleep(refresh_time)