lionagi 0.2.4__tar.gz → 0.2.5__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (268) hide show
  1. {lionagi-0.2.4 → lionagi-0.2.5}/PKG-INFO +2 -2
  2. {lionagi-0.2.4 → lionagi-0.2.5}/README.md +1 -1
  3. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/engine/branch_engine.py +4 -1
  4. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/graph.py +4 -2
  5. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/node.py +2 -2
  6. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/session/directive_mixin.py +2 -2
  7. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/unit_mixin.py +1 -1
  8. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/work_edge.py +8 -6
  9. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/work_function.py +13 -6
  10. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/work_function_node.py +19 -8
  11. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/work_queue.py +4 -4
  12. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/work_task.py +14 -24
  13. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/worker.py +66 -39
  14. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/worker_engine.py +38 -13
  15. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/config/oai_configs.py +1 -1
  16. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/litellm.py +3 -4
  17. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_parse.py +2 -2
  18. lionagi-0.2.5/lionagi/tests/api/aws/conftest.py +25 -0
  19. lionagi-0.2.5/lionagi/tests/api/aws/test_aws_s3.py +6 -0
  20. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/generic/test_structure.py +2 -2
  21. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/graph/test_graph.py +1 -1
  22. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/graph/test_tree.py +1 -1
  23. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/mail/test_mail.py +4 -5
  24. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_structure/test_base_structure.py +1 -1
  25. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_structure/test_graph.py +1 -1
  26. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_structure/test_tree.py +1 -1
  27. lionagi-0.2.5/lionagi/version.py +1 -0
  28. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi.egg-info/PKG-INFO +2 -2
  29. lionagi-0.2.4/lionagi/tests/api/aws/conftest.py +0 -28
  30. lionagi-0.2.4/lionagi/tests/api/aws/test_aws_s3.py +0 -7
  31. lionagi-0.2.4/lionagi/version.py +0 -1
  32. {lionagi-0.2.4 → lionagi-0.2.5}/LICENSE +0 -0
  33. {lionagi-0.2.4 → lionagi-0.2.5}/README.rst +0 -0
  34. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/__init__.py +0 -0
  35. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/__init__.py +0 -0
  36. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/_setting/__init__.py +0 -0
  37. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/_setting/_setting.py +0 -0
  38. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/action/__init__.py +0 -0
  39. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/action/function_calling.py +0 -0
  40. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/action/manual.py +0 -0
  41. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/action/node.py +0 -0
  42. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/action/tool.py +0 -0
  43. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/action/tool_manager.py +0 -0
  44. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/__init__.py +0 -0
  45. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/base_agent.py +0 -0
  46. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/eval/__init__.py +0 -0
  47. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/eval/evaluator.py +0 -0
  48. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/eval/vote.py +0 -0
  49. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/learn/__init__.py +0 -0
  50. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/learn/learner.py +0 -0
  51. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/plan/__init__.py +0 -0
  52. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/plan/plan.py +0 -0
  53. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/plan/unit_template.py +0 -0
  54. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/__init__.py +0 -0
  55. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/_logger.py +0 -0
  56. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/abc/__init__.py +0 -0
  57. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/abc/component.py +0 -0
  58. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/abc/concepts.py +0 -0
  59. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/abc/exceptions.py +0 -0
  60. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/abc/util.py +0 -0
  61. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/exchange.py +0 -0
  62. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/flow.py +0 -0
  63. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/model.py +0 -0
  64. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/pile.py +0 -0
  65. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/progression.py +0 -0
  66. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/util.py +0 -0
  67. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/director/__init__.py +0 -0
  68. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/director/direct.py +0 -0
  69. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/director/director.py +0 -0
  70. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/engine/__init__.py +0 -0
  71. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/engine/instruction_map_engine.py +0 -0
  72. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/engine/sandbox_.py +0 -0
  73. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/engine/script_engine.py +0 -0
  74. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/executor/__init__.py +0 -0
  75. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/executor/base_executor.py +0 -0
  76. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/executor/graph_executor.py +0 -0
  77. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/executor/neo4j_executor.py +0 -0
  78. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/__init__.py +0 -0
  79. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/edge.py +0 -0
  80. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/edge_condition.py +0 -0
  81. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/hyperedge.py +0 -0
  82. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/tree.py +0 -0
  83. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/tree_node.py +0 -0
  84. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/mail/__init__.py +0 -0
  85. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/mail/mail.py +0 -0
  86. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/mail/mail_manager.py +0 -0
  87. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/mail/package.py +0 -0
  88. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/mail/start_mail.py +0 -0
  89. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/__init__.py +0 -0
  90. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/action_request.py +0 -0
  91. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/action_response.py +0 -0
  92. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/assistant_response.py +0 -0
  93. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/instruction.py +0 -0
  94. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/message.py +0 -0
  95. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/system.py +0 -0
  96. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/util.py +0 -0
  97. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/report/__init__.py +0 -0
  98. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/report/base.py +0 -0
  99. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/report/form.py +0 -0
  100. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/report/report.py +0 -0
  101. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/report/util.py +0 -0
  102. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/__init__.py +0 -0
  103. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/_default.py +0 -0
  104. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/action.py +0 -0
  105. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/base.py +0 -0
  106. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/boolean.py +0 -0
  107. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/choice.py +0 -0
  108. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/mapping.py +0 -0
  109. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/number.py +0 -0
  110. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/rulebook.py +0 -0
  111. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/string.py +0 -0
  112. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/util.py +0 -0
  113. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/session/__init__.py +0 -0
  114. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/session/branch.py +0 -0
  115. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/session/session.py +0 -0
  116. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/structure/__init__.py +0 -0
  117. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/structure/chain.py +0 -0
  118. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/structure/forest.py +0 -0
  119. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/structure/graph.py +0 -0
  120. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/structure/tree.py +0 -0
  121. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/__init__.py +0 -0
  122. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/parallel_unit.py +0 -0
  123. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/__init__.py +0 -0
  124. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/action.py +0 -0
  125. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/base.py +0 -0
  126. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/plan.py +0 -0
  127. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/predict.py +0 -0
  128. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/score.py +0 -0
  129. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/select.py +0 -0
  130. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/unit.py +0 -0
  131. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/unit_form.py +0 -0
  132. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/util.py +0 -0
  133. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/validator/__init__.py +0 -0
  134. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/validator/validator.py +0 -0
  135. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/__init__.py +0 -0
  136. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/work.py +0 -0
  137. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/worklog.py +0 -0
  138. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/__init__.py +0 -0
  139. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/compressor/__init__.py +0 -0
  140. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/compressor/base.py +0 -0
  141. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/compressor/llm_compressor.py +0 -0
  142. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/compressor/llm_summarizer.py +0 -0
  143. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/compressor/util.py +0 -0
  144. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/__init__.py +0 -0
  145. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/parser/__init__.py +0 -0
  146. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/parser/base_parser.py +0 -0
  147. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/template/__init__.py +0 -0
  148. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/template/base_template.py +0 -0
  149. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/template/schema.py +0 -0
  150. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/tokenizer.py +0 -0
  151. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/evaluator/__init__.py +0 -0
  152. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/evaluator/ast_evaluator.py +0 -0
  153. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/evaluator/base_evaluator.py +0 -0
  154. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/knowledge/__init__.py +0 -0
  155. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/knowledge/base.py +0 -0
  156. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/knowledge/graph.py +0 -0
  157. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/memory/__init__.py +0 -0
  158. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/strategies/__init__.py +0 -0
  159. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/strategies/base.py +0 -0
  160. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/__init__.py +0 -0
  161. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/__init__.py +0 -0
  162. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/autogen_/__init__.py +0 -0
  163. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/autogen_/autogen_.py +0 -0
  164. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/langchain_/__init__.py +0 -0
  165. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/langchain_/documents.py +0 -0
  166. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/langchain_/langchain_bridge.py +0 -0
  167. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/__init__.py +0 -0
  168. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/index.py +0 -0
  169. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/llama_index_bridge.py +0 -0
  170. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/llama_pack.py +0 -0
  171. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/node_parser.py +0 -0
  172. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/reader.py +0 -0
  173. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/textnode.py +0 -0
  174. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/pydantic_/__init__.py +0 -0
  175. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/pydantic_/pydantic_bridge.py +0 -0
  176. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/transformers_/__init__.py +0 -0
  177. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/transformers_/install_.py +0 -0
  178. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/chunker/__init__.py +0 -0
  179. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/chunker/chunk.py +0 -0
  180. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/config/__init__.py +0 -0
  181. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/config/mlx_configs.py +0 -0
  182. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/config/ollama_configs.py +0 -0
  183. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/config/openrouter_configs.py +0 -0
  184. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/loader/__init__.py +0 -0
  185. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/loader/load.py +0 -0
  186. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/loader/load_util.py +0 -0
  187. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/__init__.py +0 -0
  188. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/_mapping.py +0 -0
  189. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/mistralai.py +0 -0
  190. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/mlx_service.py +0 -0
  191. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/oai.py +0 -0
  192. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/ollama.py +0 -0
  193. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/openrouter.py +0 -0
  194. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/services.py +0 -0
  195. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/transformers.py +0 -0
  196. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/storage/__init__.py +0 -0
  197. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/storage/neo4j.py +0 -0
  198. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/storage/storage_util.py +0 -0
  199. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/storage/structure_excel.py +0 -0
  200. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/storage/to_csv.py +0 -0
  201. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/storage/to_excel.py +0 -0
  202. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/__init__.py +0 -0
  203. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_api.py +0 -0
  204. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_async.py +0 -0
  205. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_context.py +0 -0
  206. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_convert.py +0 -0
  207. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_dataframe.py +0 -0
  208. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_func_call.py +0 -0
  209. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_image.py +0 -0
  210. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_knowledge_graph.py +0 -0
  211. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_nested.py +0 -0
  212. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_queue.py +0 -0
  213. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_tokenize.py +0 -0
  214. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_validate.py +0 -0
  215. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/special_tokens.py +0 -0
  216. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/sys_util.py +0 -0
  217. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/__init__.py +0 -0
  218. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/coder/__init__.py +0 -0
  219. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/coder/add_feature.py +0 -0
  220. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/coder/base_prompts.py +0 -0
  221. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/coder/code_form.py +0 -0
  222. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/coder/coder.py +0 -0
  223. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/coder/util.py +0 -0
  224. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/researcher/__init__.py +0 -0
  225. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/researcher/data_source/__init__.py +0 -0
  226. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/researcher/data_source/finhub_.py +0 -0
  227. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/researcher/data_source/google_.py +0 -0
  228. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/researcher/data_source/wiki_.py +0 -0
  229. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/researcher/data_source/yfinance_.py +0 -0
  230. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/__init__.py +0 -0
  231. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/api/__init__.py +0 -0
  232. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/api/aws/__init__.py +0 -0
  233. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/integrations/__init__.py +0 -0
  234. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/__init__.py +0 -0
  235. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_api.py +0 -0
  236. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_convert.py +0 -0
  237. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_field_validators.py +0 -0
  238. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_func_call.py +0 -0
  239. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_nested.py +0 -0
  240. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_parse.py +0 -0
  241. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_queue.py +0 -0
  242. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_sys_util.py +0 -0
  243. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/__init__.py +0 -0
  244. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/collections/__init__.py +0 -0
  245. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/collections/test_component.py +0 -0
  246. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/collections/test_exchange.py +0 -0
  247. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/collections/test_flow.py +0 -0
  248. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/collections/test_pile.py +0 -0
  249. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/collections/test_progression.py +0 -0
  250. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/generic/__init__.py +0 -0
  251. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/generic/test_edge.py +0 -0
  252. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/generic/test_graph.py +0 -0
  253. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/generic/test_node.py +0 -0
  254. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/generic/test_tree_node.py +0 -0
  255. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/graph/__init__.py +0 -0
  256. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/mail/__init__.py +0 -0
  257. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_branch.py +0 -0
  258. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_form.py +0 -0
  259. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_report.py +0 -0
  260. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_structure/__init__.py +0 -0
  261. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_validator.py +0 -0
  262. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi.egg-info/SOURCES.txt +0 -0
  263. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi.egg-info/dependency_links.txt +0 -0
  264. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi.egg-info/requires.txt +0 -0
  265. {lionagi-0.2.4 → lionagi-0.2.5}/lionagi.egg-info/top_level.txt +0 -0
  266. {lionagi-0.2.4 → lionagi-0.2.5}/pyproject.toml +0 -0
  267. {lionagi-0.2.4 → lionagi-0.2.5}/setup.cfg +0 -0
  268. {lionagi-0.2.4 → lionagi-0.2.5}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lionagi
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Towards automated general intelligence.
5
5
  Author: HaiyangLi
6
6
  Author-email: Haiyang Li <ocean@lionagi.ai>
@@ -237,7 +237,7 @@ Requires-Dist: boto3>=1.34.131
237
237
  ### an AGentic Intelligence Operating System
238
238
 
239
239
  ```
240
- pip install lionagi==0.2.3
240
+ pip install lionagi==0.2.5
241
241
  ```
242
242
 
243
243
  **Powerful Intelligent Workflow Automation**
@@ -8,7 +8,7 @@
8
8
  ### an AGentic Intelligence Operating System
9
9
 
10
10
  ```
11
- pip install lionagi==0.2.3
11
+ pip install lionagi==0.2.5
12
12
  ```
13
13
 
14
14
  **Powerful Intelligent Workflow Automation**
@@ -57,7 +57,10 @@ class BranchExecutor(Branch, BaseExecutor):
57
57
  await self._process_condition(mail)
58
58
  elif mail.category == "end":
59
59
  self._process_end(mail)
60
- if key in self.mailbox.pending_ins and self.mailbox.pending_ins.get(key, Pile()).size() == 0:
60
+ if (
61
+ key in self.mailbox.pending_ins
62
+ and self.mailbox.pending_ins.get(key, Pile()).size() == 0
63
+ ):
61
64
  self.mailbox.pending_ins.pop(key)
62
65
 
63
66
  async def execute(self, refresh_time=1) -> None:
@@ -202,7 +202,9 @@ class Graph(Node):
202
202
 
203
203
  return g
204
204
 
205
- def display(self, node_label="class_name", edge_label="label", draw_kwargs={}, **kwargs):
205
+ def display(
206
+ self, node_label="class_name", edge_label="label", draw_kwargs={}, **kwargs
207
+ ):
206
208
  """Display the graph using NetworkX and Matplotlib."""
207
209
  from lionagi.libs import SysUtil
208
210
 
@@ -224,7 +226,7 @@ class Graph(Node):
224
226
  node_color="orange",
225
227
  alpha=0.9,
226
228
  labels=nx.get_node_attributes(g, node_label),
227
- **draw_kwargs
229
+ **draw_kwargs,
228
230
  )
229
231
 
230
232
  labels = nx.get_edge_attributes(g, edge_label)
@@ -124,7 +124,7 @@ class Node(Component, Relatable):
124
124
  label: str | None = None,
125
125
  bundle: bool = False,
126
126
  edge_class: Callable = Edge,
127
- **kwargs
127
+ **kwargs,
128
128
  ) -> None:
129
129
  """
130
130
  Establish directed relationship from this node to another.
@@ -150,7 +150,7 @@ class Node(Component, Relatable):
150
150
  condition=condition,
151
151
  bundle=bundle,
152
152
  label=label,
153
- **kwargs
153
+ **kwargs,
154
154
  )
155
155
 
156
156
  self.relations[direction].include(edge)
@@ -248,7 +248,7 @@ class DirectiveMixin:
248
248
  form.action_response.update(_dict)
249
249
 
250
250
  return form
251
-
251
+
252
252
  form = await _directive.direct(
253
253
  instruction=instruction,
254
254
  context=context,
@@ -283,5 +283,5 @@ class DirectiveMixin:
283
283
  if not hasattr(form, "action_response"):
284
284
  form.append_to_request("action_response", {})
285
285
  form.action_response.update(_dict)
286
-
286
+
287
287
  return form
@@ -658,7 +658,7 @@ class DirectiveMixin(ABC):
658
658
  if allow_action and not tools:
659
659
  tools = True
660
660
 
661
- tool_schema=None
661
+ tool_schema = None
662
662
  if tools:
663
663
  tool_schema = branch.tool_manager.get_tool_schema(tools)
664
664
 
@@ -21,19 +21,19 @@ class WorkEdge(Edge, Progressable):
21
21
  other than "from_work" and "from_result".
22
22
  associated_worker (Worker): The worker to which this WorkEdge belongs.
23
23
  """
24
+
24
25
  convert_function: Callable = Field(
25
26
  ...,
26
- description="Function to transform the result of the previous work into parameters for the next work."
27
+ description="Function to transform the result of the previous work into parameters for the next work.",
27
28
  )
28
29
 
29
30
  convert_function_kwargs: dict = Field(
30
31
  {},
31
- description="parameters for the worklink function other than \"from_work\" and \"from_result\""
32
+ description='parameters for the worklink function other than "from_work" and "from_result"',
32
33
  )
33
34
 
34
35
  associated_worker: Worker = Field(
35
- ...,
36
- description="The worker to which this WorkEdge belongs."
36
+ ..., description="The worker to which this WorkEdge belongs."
37
37
  )
38
38
 
39
39
  @field_validator("convert_function", mode="before")
@@ -81,8 +81,10 @@ class WorkEdge(Edge, Progressable):
81
81
  StopIteration: If the task has no available steps left to proceed.
82
82
  """
83
83
  if task.available_steps == 0:
84
- task.status_note = ("Task stopped proceeding further as all available steps have been used up, "
85
- "but the task has not yet reached completion.")
84
+ task.status_note = (
85
+ "Task stopped proceeding further as all available steps have been used up, "
86
+ "but the task has not yet reached completion."
87
+ )
86
88
  return
87
89
  func_signature = inspect.signature(self.convert_function)
88
90
  kwargs = self.convert_function_kwargs.copy()
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  """
16
+
16
17
  import asyncio
17
18
  import logging
18
19
 
@@ -33,7 +34,13 @@ class WorkFunction:
33
34
  """
34
35
 
35
36
  def __init__(
36
- self, assignment, function, retry_kwargs=None, guidance=None, capacity=10, refresh_time=1
37
+ self,
38
+ assignment,
39
+ function,
40
+ retry_kwargs=None,
41
+ guidance=None,
42
+ capacity=10,
43
+ refresh_time=1,
37
44
  ):
38
45
  """
39
46
  Initializes a WorkFunction instance.
@@ -69,11 +76,11 @@ class WorkFunction:
69
76
  @property
70
77
  def execution_mode(self):
71
78
  """
72
- Gets the execution mode of the work function's queue.
79
+ Gets the execution mode of the work function's queue.
73
80
 
74
- Returns:
75
- bool: The execution mode of the work function's queue.
76
- """
81
+ Returns:
82
+ bool: The execution mode of the work function's queue.
83
+ """
77
84
  return self.worklog.queue.execution_mode
78
85
 
79
86
  def is_progressable(self):
@@ -121,4 +128,4 @@ class WorkFunction:
121
128
  """
122
129
  Stops the execution of the work function's queue.
123
130
  """
124
- await self.worklog.stop()
131
+ await self.worklog.stop()
@@ -21,7 +21,16 @@ class WorkFunctionNode(WorkFunction, Node):
21
21
  refresh_time (int): The time interval to refresh the work log queue.
22
22
  """
23
23
 
24
- def __init__(self, assignment, function, retry_kwargs=None, guidance=None, capacity=10, refresh_time=1, **kwargs):
24
+ def __init__(
25
+ self,
26
+ assignment,
27
+ function,
28
+ retry_kwargs=None,
29
+ guidance=None,
30
+ capacity=10,
31
+ refresh_time=1,
32
+ **kwargs,
33
+ ):
25
34
  """
26
35
  Initializes a WorkFunctionNode instance.
27
36
 
@@ -35,10 +44,12 @@ class WorkFunctionNode(WorkFunction, Node):
35
44
  **kwargs: Additional keyword arguments for the Node initialization.
36
45
  """
37
46
  Node.__init__(self, **kwargs)
38
- WorkFunction.__init__(self,
39
- assignment=assignment,
40
- function=function,
41
- retry_kwargs=retry_kwargs,
42
- guidance=guidance,
43
- capacity=capacity,
44
- refresh_time=refresh_time)
47
+ WorkFunction.__init__(
48
+ self,
49
+ assignment=assignment,
50
+ function=function,
51
+ retry_kwargs=retry_kwargs,
52
+ guidance=guidance,
53
+ capacity=capacity,
54
+ refresh_time=refresh_time,
55
+ )
@@ -90,11 +90,11 @@ class WorkQueue:
90
90
 
91
91
  async def execute(self):
92
92
  """
93
- Continuously executes the process method at a specified refresh interval.
93
+ Continuously executes the process method at a specified refresh interval.
94
94
 
95
- Args:
96
- refresh_time (int, optional): The time in seconds to wait between
97
- successive calls to `process`. Defaults to 1.
95
+ Args:
96
+ refresh_time (int, optional): The time in seconds to wait between
97
+ successive calls to `process`. Defaults to 1.
98
98
  """
99
99
  self.execution_mode = True
100
100
  self._stop_event.clear()
@@ -20,39 +20,24 @@ class WorkTask(Component):
20
20
  current_work (Work | None): The current work in progress.
21
21
  post_processing (Callable | None): The post-processing function to be executed after the entire task is successfully completed.
22
22
  """
23
- name: str | None = Field(
24
- None,
25
- description="Name of the task"
26
- )
23
+
24
+ name: str | None = Field(None, description="Name of the task")
27
25
 
28
26
  status: WorkStatus = Field(
29
- WorkStatus.PENDING,
30
- description="The current status of the task"
27
+ WorkStatus.PENDING, description="The current status of the task"
31
28
  )
32
29
 
33
- status_note: str = Field(
34
- None,
35
- description="Note for tasks current status"
36
- )
30
+ status_note: str = Field(None, description="Note for tasks current status")
37
31
 
38
- work_history: list[Work] = Field(
39
- [],
40
- description="List of works processed"
41
- )
32
+ work_history: list[Work] = Field([], description="List of works processed")
42
33
 
43
- max_steps: int | None = Field(
44
- 10,
45
- description="Maximum number of works allowed"
46
- )
34
+ max_steps: int | None = Field(10, description="Maximum number of works allowed")
47
35
 
48
- current_work: Work | None = Field(
49
- None,
50
- description="The current work in progress"
51
- )
36
+ current_work: Work | None = Field(None, description="The current work in progress")
52
37
 
53
38
  post_processing: Callable | None = Field(
54
39
  None,
55
- description="The post-processing function to be executed after the entire task has been successfully completed."
40
+ description="The post-processing function to be executed after the entire task has been successfully completed.",
56
41
  )
57
42
 
58
43
  @field_validator("max_steps", mode="before")
@@ -108,7 +93,12 @@ class WorkTask(Component):
108
93
  Returns:
109
94
  WorkTask: A new instance of WorkTask with the same attributes.
110
95
  """
111
- new_worktask = WorkTask(name=self.name, status=self.status, max_steps=self.max_steps, current_work=self.current_work)
96
+ new_worktask = WorkTask(
97
+ name=self.name,
98
+ status=self.status,
99
+ max_steps=self.max_steps,
100
+ current_work=self.current_work,
101
+ )
112
102
  for work in self.work_history:
113
103
  new_worktask.work_history.append(work)
114
104
  return new_worktask
@@ -93,7 +93,9 @@ class Worker(ABC):
93
93
 
94
94
  """
95
95
  if form_key not in self.forms.keys():
96
- raise ValueError(f"Unable to change default form. Key {form_key} does not exist.")
96
+ raise ValueError(
97
+ f"Unable to change default form. Key {form_key} does not exist."
98
+ )
97
99
  self.default_form = self.forms[form_key]
98
100
 
99
101
  def _get_decorated_functions(self, decorator_attr, name_only=True):
@@ -108,7 +110,9 @@ class Worker(ABC):
108
110
  list: List of decorated function names or tuples containing function details.
109
111
  """
110
112
  decorated_functions = []
111
- for name, func in inspect.getmembers(self.__class__, predicate=inspect.isfunction):
113
+ for name, func in inspect.getmembers(
114
+ self.__class__, predicate=inspect.isfunction
115
+ ):
112
116
  if hasattr(func, decorator_attr):
113
117
  if name_only:
114
118
  decorated_functions.append(name)
@@ -121,11 +125,18 @@ class Worker(ABC):
121
125
  """
122
126
  Validates worklink functions to ensure they have the required parameters.
123
127
  """
124
- worklink_decorated_function = self._get_decorated_functions(decorator_attr="_worklink_decorator_params", name_only=False)
128
+ worklink_decorated_function = self._get_decorated_functions(
129
+ decorator_attr="_worklink_decorator_params", name_only=False
130
+ )
125
131
  for func_name, func, _ in worklink_decorated_function:
126
132
  func_signature = inspect.signature(func)
127
- if "from_work" not in func_signature.parameters and "from_result" not in func_signature.parameters:
128
- raise ValueError(f"Either \"from_work\" or \"from_result\" must be a parameter in function {func_name}")
133
+ if (
134
+ "from_work" not in func_signature.parameters
135
+ and "from_result" not in func_signature.parameters
136
+ ):
137
+ raise ValueError(
138
+ f'Either "from_work" or "from_result" must be a parameter in function {func_name}'
139
+ )
129
140
 
130
141
  def construct_all_work_functions(self):
131
142
  """
@@ -133,7 +144,9 @@ class Worker(ABC):
133
144
  """
134
145
  if getattr(self, "work_functions", None) is None:
135
146
  self.work_functions = {}
136
- work_decorated_function = self._get_decorated_functions(decorator_attr="_work_decorator_params", name_only=False)
147
+ work_decorated_function = self._get_decorated_functions(
148
+ decorator_attr="_work_decorator_params", name_only=False
149
+ )
137
150
  for func_name, func, dec_params in work_decorated_function:
138
151
  if func_name not in self.work_functions:
139
152
  self.work_functions[func_name] = WorkFunction(**dec_params)
@@ -174,7 +187,7 @@ class Worker(ABC):
174
187
  retry_kwargs=retry_kwargs or {},
175
188
  guidance=guidance or function.__doc__,
176
189
  capacity=capacity,
177
- refresh_time=refresh_time
190
+ refresh_time=refresh_time,
178
191
  )
179
192
 
180
193
  work_func: WorkFunction = self.work_functions[function.__name__]
@@ -183,7 +196,9 @@ class Worker(ABC):
183
196
  if form_param_key:
184
197
  func_signature = inspect.signature(function)
185
198
  if form_param_key not in func_signature.parameters:
186
- raise KeyError(f"Failed to locate form. \"{form_param_key}\" is not defined in the function.")
199
+ raise KeyError(
200
+ f'Failed to locate form. "{form_param_key}" is not defined in the function.'
201
+ )
187
202
  if "self" in func_signature.parameters:
188
203
  bound_args = func_signature.bind(None, *args, **kwargs)
189
204
  else:
@@ -199,14 +214,18 @@ class Worker(ABC):
199
214
  form = self.forms.get(form_key) or self.default_form
200
215
 
201
216
  if form:
202
- subform = form.__class__(assignment=work_func.assignment, task=work_func.guidance)
217
+ subform = form.__class__(
218
+ assignment=work_func.assignment, task=work_func.guidance
219
+ )
203
220
  for k in subform.input_fields:
204
221
  v = getattr(form, k, None)
205
222
  setattr(subform, k, v)
206
223
  subform.origin = form
207
224
  kwargs = {"form": subform} | kwargs
208
225
  else:
209
- raise ValueError(f"Cannot locate form in Worker's forms and default_form is not available.")
226
+ raise ValueError(
227
+ f"Cannot locate form in Worker's forms and default_form is not available."
228
+ )
210
229
 
211
230
  task = work_func.perform(self, *args, **kwargs)
212
231
  work = Work(async_task=task, async_task_name=work_func.name)
@@ -221,7 +240,7 @@ def work(
221
240
  guidance=None,
222
241
  retry_kwargs=None,
223
242
  timeout=10,
224
- refresh_time=1
243
+ refresh_time=1,
225
244
  ):
226
245
  """
227
246
  Decorator to mark a method as a work function.
@@ -271,23 +290,22 @@ def work(
271
290
  refresh_time=refresh_time,
272
291
  **kwargs,
273
292
  )
274
- wrapper._work_decorator_params = {"assignment": assignment,
275
- "function": func,
276
- "retry_kwargs": retry_kwargs,
277
- "guidance": guidance,
278
- "capacity": capacity,
279
- "refresh_time": refresh_time}
293
+
294
+ wrapper._work_decorator_params = {
295
+ "assignment": assignment,
296
+ "function": func,
297
+ "retry_kwargs": retry_kwargs,
298
+ "guidance": guidance,
299
+ "capacity": capacity,
300
+ "refresh_time": refresh_time,
301
+ }
280
302
 
281
303
  return wrapper
282
304
 
283
305
  return decorator
284
306
 
285
307
 
286
- def worklink(
287
- from_: str,
288
- to_: str,
289
- auto_schedule: bool = True
290
- ):
308
+ def worklink(from_: str, to_: str, auto_schedule: bool = True):
291
309
  """
292
310
  Decorator to create a link between two work functions.
293
311
 
@@ -299,26 +317,31 @@ def worklink(
299
317
  Returns:
300
318
  Callable: The decorated function.
301
319
  """
320
+
302
321
  def decorator(func):
303
322
  @wraps(func)
304
323
  async def wrapper(
305
- self: Worker,
306
- *args,
307
- func=func,
308
- from_=from_,
309
- to_=to_,
310
- **kwargs
324
+ self: Worker, *args, func=func, from_=from_, to_=to_, **kwargs
311
325
  ):
312
326
  if not inspect.iscoroutinefunction(func):
313
327
  raise TypeError(f"{func.__name__} must be an asynchronous function")
314
328
 
315
- work_funcs = self._get_decorated_functions(decorator_attr="_work_decorator_params")
329
+ work_funcs = self._get_decorated_functions(
330
+ decorator_attr="_work_decorator_params"
331
+ )
316
332
  if from_ not in work_funcs or to_ not in work_funcs:
317
- raise ValueError("Invalid link. 'from_' and 'to_' must be the name of work decorated functions.")
333
+ raise ValueError(
334
+ "Invalid link. 'from_' and 'to_' must be the name of work decorated functions."
335
+ )
318
336
 
319
337
  func_signature = inspect.signature(func)
320
- if "from_work" not in func_signature.parameters and "from_result" not in func_signature.parameters:
321
- raise ValueError(f"Either \"from_work\" or \"from_result\" must be a parameter in function {func.__name__}")
338
+ if (
339
+ "from_work" not in func_signature.parameters
340
+ and "from_result" not in func_signature.parameters
341
+ ):
342
+ raise ValueError(
343
+ f'Either "from_work" or "from_result" must be a parameter in function {func.__name__}'
344
+ )
322
345
 
323
346
  if "self" in func_signature.parameters:
324
347
  bound_args = func_signature.bind(None, *args, **kwargs)
@@ -331,10 +354,14 @@ def worklink(
331
354
 
332
355
  if from_work := arguments.get("from_work"):
333
356
  if not isinstance(from_work, Work):
334
- raise ValueError("Invalid type for from_work. Only work objects are accepted.")
357
+ raise ValueError(
358
+ "Invalid type for from_work. Only work objects are accepted."
359
+ )
335
360
  if from_work.async_task_name != from_:
336
- raise ValueError(f"Invalid work object in from_work. "
337
- f"async_task_name \"{from_work.async_task_name}\" does not match from_ \"{from_}\"")
361
+ raise ValueError(
362
+ f"Invalid work object in from_work. "
363
+ f'async_task_name "{from_work.async_task_name}" does not match from_ "{from_}"'
364
+ )
338
365
 
339
366
  next_params = await func(self, *args, **kwargs)
340
367
  to_work_func = getattr(self, to_)
@@ -347,7 +374,9 @@ def worklink(
347
374
  if wrapper.auto_schedule:
348
375
  return await to_work_func(**next_params)
349
376
  elif isinstance(next_params, tuple) and len(next_params) == 2:
350
- if isinstance(next_params[0], list) and isinstance(next_params[1], dict):
377
+ if isinstance(next_params[0], list) and isinstance(
378
+ next_params[1], dict
379
+ ):
351
380
  if wrapper.auto_schedule:
352
381
  return await to_work_func(*next_params[0], **next_params[1])
353
382
  else:
@@ -358,9 +387,7 @@ def worklink(
358
387
  return next_params
359
388
 
360
389
  wrapper.auto_schedule = auto_schedule
361
- wrapper._worklink_decorator_params = {"func": func,
362
- "from_": from_,
363
- "to_": to_}
390
+ wrapper._worklink_decorator_params = {"func": func, "from_": from_, "to_": to_}
364
391
 
365
392
  return wrapper
366
393
 
@@ -41,7 +41,15 @@ class WorkerEngine:
41
41
  self.refresh_time = refresh_time
42
42
  self._stop_event = asyncio.Event()
43
43
 
44
- async def add_task(self, *args, task_function: str, task_name=None, task_max_steps=10, task_post_processing=None, **kwargs):
44
+ async def add_task(
45
+ self,
46
+ *args,
47
+ task_function: str,
48
+ task_name=None,
49
+ task_max_steps=10,
50
+ task_post_processing=None,
51
+ **kwargs,
52
+ ):
45
53
  """
46
54
  Adds a new task to the task queue.
47
55
 
@@ -56,7 +64,11 @@ class WorkerEngine:
56
64
  Returns:
57
65
  WorkTask: The newly created task.
58
66
  """
59
- task = WorkTask(name=task_name, max_steps=task_max_steps, post_processing=task_post_processing)
67
+ task = WorkTask(
68
+ name=task_name,
69
+ max_steps=task_max_steps,
70
+ post_processing=task_post_processing,
71
+ )
60
72
  self.tasks.append(task)
61
73
  function = getattr(self.worker, task_function)
62
74
  work = await function(*args, **kwargs)
@@ -66,7 +78,7 @@ class WorkerEngine:
66
78
 
67
79
  async def activate_work_queues(self):
68
80
  """
69
- Activates the work queues for all work functions.
81
+ Activates the work queues for all work functions.
70
82
  """
71
83
  for work_function in self.worker.work_functions.values():
72
84
  if not work_function.worklog.queue.execution_mode:
@@ -141,11 +153,12 @@ class WorkerEngine:
141
153
  Executes tasks continuously until stopped.
142
154
  """
143
155
  self._stop_event.clear()
144
-
156
+
145
157
  async def execute_lasting_inner():
146
158
  while not self.stopped:
147
159
  await self.execute(stop_queue=False)
148
160
  await asyncio.sleep(self.refresh_time)
161
+
149
162
  asyncio.create_task(execute_lasting_inner())
150
163
 
151
164
  def _construct_work_functions(self):
@@ -154,26 +167,38 @@ class WorkerEngine:
154
167
  """
155
168
  if getattr(self.worker, "work_functions", None) is None:
156
169
  self.worker.work_functions = {}
157
- work_decorated_function = self.worker._get_decorated_functions(decorator_attr="_work_decorator_params",
158
- name_only=False)
170
+ work_decorated_function = self.worker._get_decorated_functions(
171
+ decorator_attr="_work_decorator_params", name_only=False
172
+ )
159
173
  for func_name, func, dec_params in work_decorated_function:
160
174
  if func_name not in self.worker.work_functions:
161
175
  self.worker.work_functions[func_name] = WorkFunctionNode(**dec_params)
162
176
  self.worker_graph.add_node(self.worker.work_functions[func_name])
163
177
  else:
164
- if not isinstance(self.worker.work_functions[func_name], WorkFunctionNode):
165
- raise TypeError(f"WorkFunction {func_name} already exists but is not a WorkFunctionNode. "
166
- f"If you would like to use it in WorkerEngine, please convert it to a "
167
- f"WorkFunctionNode, or initiate a new worker, or pop it from work_function dict")
178
+ if not isinstance(
179
+ self.worker.work_functions[func_name], WorkFunctionNode
180
+ ):
181
+ raise TypeError(
182
+ f"WorkFunction {func_name} already exists but is not a WorkFunctionNode. "
183
+ f"If you would like to use it in WorkerEngine, please convert it to a "
184
+ f"WorkFunctionNode, or initiate a new worker, or pop it from work_function dict"
185
+ )
168
186
 
169
187
  def _construct_workedges(self):
170
188
  """
171
189
  Constructs work edges for the worker graph.
172
190
  """
173
- worklink_decorated_function = self.worker._get_decorated_functions(decorator_attr="_worklink_decorator_params",
174
- name_only=False)
191
+ worklink_decorated_function = self.worker._get_decorated_functions(
192
+ decorator_attr="_worklink_decorator_params", name_only=False
193
+ )
175
194
 
176
195
  for func_name, func, dec_params in worklink_decorated_function:
177
196
  head = self.worker.work_functions[dec_params["from_"]]
178
197
  tail = self.worker.work_functions[dec_params["to_"]]
179
- self.worker_graph.add_edge(head=head, tail=tail, convert_function=func, associated_worker=self.worker, edge_class=WorkEdge)
198
+ self.worker_graph.add_edge(
199
+ head=head,
200
+ tail=tail,
201
+ convert_function=func,
202
+ associated_worker=self.worker,
203
+ edge_class=WorkEdge,
204
+ )
@@ -4,7 +4,7 @@ API_key_schema = ("OPENAI_API_KEY",)
4
4
 
5
5
  # ChatCompletion
6
6
  oai_chat_llmconfig = {
7
- "model": "gpt-4o",
7
+ "model": "gpt-4o-2024-08-06",
8
8
  "frequency_penalty": 0,
9
9
  "max_tokens": None,
10
10
  "n": 1,
@@ -27,8 +27,9 @@ class LiteLLMService(BaseService):
27
27
  SysUtil.check_import("litellm")
28
28
 
29
29
  import litellm
30
+
30
31
  litellm.drop_params = True
31
-
32
+
32
33
  self.acompletion = litellm.acompletion
33
34
  self.model = model
34
35
  self.kwargs = kwargs
@@ -45,9 +46,7 @@ class LiteLLMService(BaseService):
45
46
  kwargs["model"] = self.model or kwargs.get("model")
46
47
 
47
48
  try:
48
- completion = await self.acompletion(
49
- messages=messages, **kwargs
50
- )
49
+ completion = await self.acompletion(messages=messages, **kwargs)
51
50
  return payload, completion.model_dump()
52
51
  except Exception as e:
53
52
  self.status_tracker.num_tasks_failed += 1