lionagi 0.2.4__tar.gz → 0.2.6__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.6}/PKG-INFO +2 -2
  2. {lionagi-0.2.4 → lionagi-0.2.6}/README.md +1 -1
  3. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/model.py +32 -0
  4. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/engine/branch_engine.py +4 -1
  5. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/generic/graph.py +4 -2
  6. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/generic/node.py +2 -2
  7. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/session/directive_mixin.py +29 -5
  8. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/unit.py +18 -2
  9. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/unit_mixin.py +10 -12
  10. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/validator/validator.py +17 -4
  11. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/work/work_edge.py +8 -6
  12. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/work/work_function.py +13 -6
  13. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/work/work_function_node.py +19 -8
  14. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/work/work_queue.py +4 -4
  15. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/work/work_task.py +14 -24
  16. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/work/worker.py +66 -39
  17. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/work/worker_engine.py +38 -13
  18. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/config/oai_configs.py +1 -1
  19. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/provider/litellm.py +3 -4
  20. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_parse.py +2 -2
  21. lionagi-0.2.6/lionagi/tests/api/aws/conftest.py +25 -0
  22. lionagi-0.2.6/lionagi/tests/api/aws/test_aws_s3.py +6 -0
  23. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/generic/test_structure.py +2 -2
  24. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/graph/test_graph.py +1 -1
  25. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/graph/test_tree.py +1 -1
  26. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/mail/test_mail.py +4 -5
  27. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/test_structure/test_base_structure.py +1 -1
  28. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/test_structure/test_graph.py +1 -1
  29. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/test_structure/test_tree.py +1 -1
  30. lionagi-0.2.6/lionagi/version.py +1 -0
  31. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi.egg-info/PKG-INFO +2 -2
  32. lionagi-0.2.4/lionagi/tests/api/aws/conftest.py +0 -28
  33. lionagi-0.2.4/lionagi/tests/api/aws/test_aws_s3.py +0 -7
  34. lionagi-0.2.4/lionagi/version.py +0 -1
  35. {lionagi-0.2.4 → lionagi-0.2.6}/LICENSE +0 -0
  36. {lionagi-0.2.4 → lionagi-0.2.6}/README.rst +0 -0
  37. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/__init__.py +0 -0
  38. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/__init__.py +0 -0
  39. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/_setting/__init__.py +0 -0
  40. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/_setting/_setting.py +0 -0
  41. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/action/__init__.py +0 -0
  42. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/action/function_calling.py +0 -0
  43. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/action/manual.py +0 -0
  44. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/action/node.py +0 -0
  45. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/action/tool.py +0 -0
  46. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/action/tool_manager.py +0 -0
  47. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/agent/__init__.py +0 -0
  48. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/agent/base_agent.py +0 -0
  49. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/agent/eval/__init__.py +0 -0
  50. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/agent/eval/evaluator.py +0 -0
  51. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/agent/eval/vote.py +0 -0
  52. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/agent/learn/__init__.py +0 -0
  53. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/agent/learn/learner.py +0 -0
  54. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/agent/plan/__init__.py +0 -0
  55. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/agent/plan/plan.py +0 -0
  56. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/agent/plan/unit_template.py +0 -0
  57. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/__init__.py +0 -0
  58. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/_logger.py +0 -0
  59. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/abc/__init__.py +0 -0
  60. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/abc/component.py +0 -0
  61. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/abc/concepts.py +0 -0
  62. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/abc/exceptions.py +0 -0
  63. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/abc/util.py +0 -0
  64. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/exchange.py +0 -0
  65. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/flow.py +0 -0
  66. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/pile.py +0 -0
  67. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/progression.py +0 -0
  68. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/collections/util.py +0 -0
  69. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/director/__init__.py +0 -0
  70. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/director/direct.py +0 -0
  71. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/director/director.py +0 -0
  72. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/engine/__init__.py +0 -0
  73. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/engine/instruction_map_engine.py +0 -0
  74. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/engine/sandbox_.py +0 -0
  75. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/engine/script_engine.py +0 -0
  76. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/executor/__init__.py +0 -0
  77. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/executor/base_executor.py +0 -0
  78. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/executor/graph_executor.py +0 -0
  79. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/executor/neo4j_executor.py +0 -0
  80. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/generic/__init__.py +0 -0
  81. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/generic/edge.py +0 -0
  82. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/generic/edge_condition.py +0 -0
  83. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/generic/hyperedge.py +0 -0
  84. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/generic/tree.py +0 -0
  85. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/generic/tree_node.py +0 -0
  86. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/mail/__init__.py +0 -0
  87. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/mail/mail.py +0 -0
  88. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/mail/mail_manager.py +0 -0
  89. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/mail/package.py +0 -0
  90. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/mail/start_mail.py +0 -0
  91. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/message/__init__.py +0 -0
  92. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/message/action_request.py +0 -0
  93. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/message/action_response.py +0 -0
  94. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/message/assistant_response.py +0 -0
  95. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/message/instruction.py +0 -0
  96. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/message/message.py +0 -0
  97. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/message/system.py +0 -0
  98. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/message/util.py +0 -0
  99. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/report/__init__.py +0 -0
  100. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/report/base.py +0 -0
  101. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/report/form.py +0 -0
  102. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/report/report.py +0 -0
  103. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/report/util.py +0 -0
  104. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/rule/__init__.py +0 -0
  105. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/rule/_default.py +0 -0
  106. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/rule/action.py +0 -0
  107. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/rule/base.py +0 -0
  108. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/rule/boolean.py +0 -0
  109. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/rule/choice.py +0 -0
  110. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/rule/mapping.py +0 -0
  111. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/rule/number.py +0 -0
  112. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/rule/rulebook.py +0 -0
  113. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/rule/string.py +0 -0
  114. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/rule/util.py +0 -0
  115. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/session/__init__.py +0 -0
  116. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/session/branch.py +0 -0
  117. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/session/session.py +0 -0
  118. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/structure/__init__.py +0 -0
  119. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/structure/chain.py +0 -0
  120. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/structure/forest.py +0 -0
  121. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/structure/graph.py +0 -0
  122. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/structure/tree.py +0 -0
  123. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/__init__.py +0 -0
  124. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/parallel_unit.py +0 -0
  125. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/template/__init__.py +0 -0
  126. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/template/action.py +0 -0
  127. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/template/base.py +0 -0
  128. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/template/plan.py +0 -0
  129. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/template/predict.py +0 -0
  130. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/template/score.py +0 -0
  131. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/template/select.py +0 -0
  132. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/unit_form.py +0 -0
  133. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/unit/util.py +0 -0
  134. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/validator/__init__.py +0 -0
  135. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/work/__init__.py +0 -0
  136. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/work/work.py +0 -0
  137. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/core/work/worklog.py +0 -0
  138. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/__init__.py +0 -0
  139. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/compressor/__init__.py +0 -0
  140. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/compressor/base.py +0 -0
  141. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/compressor/llm_compressor.py +0 -0
  142. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/compressor/llm_summarizer.py +0 -0
  143. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/compressor/util.py +0 -0
  144. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/directive/__init__.py +0 -0
  145. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/directive/parser/__init__.py +0 -0
  146. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/directive/parser/base_parser.py +0 -0
  147. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/directive/template/__init__.py +0 -0
  148. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/directive/template/base_template.py +0 -0
  149. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/directive/template/schema.py +0 -0
  150. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/directive/tokenizer.py +0 -0
  151. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/evaluator/__init__.py +0 -0
  152. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/evaluator/ast_evaluator.py +0 -0
  153. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/evaluator/base_evaluator.py +0 -0
  154. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/knowledge/__init__.py +0 -0
  155. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/knowledge/base.py +0 -0
  156. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/knowledge/graph.py +0 -0
  157. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/memory/__init__.py +0 -0
  158. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/strategies/__init__.py +0 -0
  159. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/experimental/strategies/base.py +0 -0
  160. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/__init__.py +0 -0
  161. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/__init__.py +0 -0
  162. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/autogen_/__init__.py +0 -0
  163. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/autogen_/autogen_.py +0 -0
  164. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/langchain_/__init__.py +0 -0
  165. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/langchain_/documents.py +0 -0
  166. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/langchain_/langchain_bridge.py +0 -0
  167. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/__init__.py +0 -0
  168. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/index.py +0 -0
  169. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/llama_index_bridge.py +0 -0
  170. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/llama_pack.py +0 -0
  171. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/node_parser.py +0 -0
  172. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/reader.py +0 -0
  173. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/textnode.py +0 -0
  174. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/pydantic_/__init__.py +0 -0
  175. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/pydantic_/pydantic_bridge.py +0 -0
  176. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/transformers_/__init__.py +0 -0
  177. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/bridge/transformers_/install_.py +0 -0
  178. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/chunker/__init__.py +0 -0
  179. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/chunker/chunk.py +0 -0
  180. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/config/__init__.py +0 -0
  181. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/config/mlx_configs.py +0 -0
  182. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/config/ollama_configs.py +0 -0
  183. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/config/openrouter_configs.py +0 -0
  184. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/loader/__init__.py +0 -0
  185. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/loader/load.py +0 -0
  186. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/loader/load_util.py +0 -0
  187. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/provider/__init__.py +0 -0
  188. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/provider/_mapping.py +0 -0
  189. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/provider/mistralai.py +0 -0
  190. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/provider/mlx_service.py +0 -0
  191. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/provider/oai.py +0 -0
  192. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/provider/ollama.py +0 -0
  193. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/provider/openrouter.py +0 -0
  194. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/provider/services.py +0 -0
  195. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/provider/transformers.py +0 -0
  196. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/storage/__init__.py +0 -0
  197. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/storage/neo4j.py +0 -0
  198. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/storage/storage_util.py +0 -0
  199. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/storage/structure_excel.py +0 -0
  200. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/storage/to_csv.py +0 -0
  201. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/integrations/storage/to_excel.py +0 -0
  202. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/__init__.py +0 -0
  203. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_api.py +0 -0
  204. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_async.py +0 -0
  205. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_context.py +0 -0
  206. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_convert.py +0 -0
  207. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_dataframe.py +0 -0
  208. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_func_call.py +0 -0
  209. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_image.py +0 -0
  210. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_knowledge_graph.py +0 -0
  211. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_nested.py +0 -0
  212. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_queue.py +0 -0
  213. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_tokenize.py +0 -0
  214. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/ln_validate.py +0 -0
  215. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/special_tokens.py +0 -0
  216. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/libs/sys_util.py +0 -0
  217. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/__init__.py +0 -0
  218. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/coder/__init__.py +0 -0
  219. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/coder/add_feature.py +0 -0
  220. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/coder/base_prompts.py +0 -0
  221. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/coder/code_form.py +0 -0
  222. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/coder/coder.py +0 -0
  223. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/coder/util.py +0 -0
  224. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/researcher/__init__.py +0 -0
  225. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/researcher/data_source/__init__.py +0 -0
  226. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/researcher/data_source/finhub_.py +0 -0
  227. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/researcher/data_source/google_.py +0 -0
  228. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/researcher/data_source/wiki_.py +0 -0
  229. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/lions/researcher/data_source/yfinance_.py +0 -0
  230. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/__init__.py +0 -0
  231. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/api/__init__.py +0 -0
  232. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/api/aws/__init__.py +0 -0
  233. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/integrations/__init__.py +0 -0
  234. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/libs/__init__.py +0 -0
  235. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/libs/test_api.py +0 -0
  236. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/libs/test_convert.py +0 -0
  237. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/libs/test_field_validators.py +0 -0
  238. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/libs/test_func_call.py +0 -0
  239. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/libs/test_nested.py +0 -0
  240. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/libs/test_parse.py +0 -0
  241. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/libs/test_queue.py +0 -0
  242. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/libs/test_sys_util.py +0 -0
  243. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/__init__.py +0 -0
  244. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/collections/__init__.py +0 -0
  245. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/collections/test_component.py +0 -0
  246. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/collections/test_exchange.py +0 -0
  247. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/collections/test_flow.py +0 -0
  248. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/collections/test_pile.py +0 -0
  249. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/collections/test_progression.py +0 -0
  250. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/generic/__init__.py +0 -0
  251. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/generic/test_edge.py +0 -0
  252. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/generic/test_graph.py +0 -0
  253. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/generic/test_node.py +0 -0
  254. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/generic/test_tree_node.py +0 -0
  255. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/graph/__init__.py +0 -0
  256. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/mail/__init__.py +0 -0
  257. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/test_branch.py +0 -0
  258. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/test_form.py +0 -0
  259. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/test_report.py +0 -0
  260. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/test_structure/__init__.py +0 -0
  261. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi/tests/test_core/test_validator.py +0 -0
  262. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi.egg-info/SOURCES.txt +0 -0
  263. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi.egg-info/dependency_links.txt +0 -0
  264. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi.egg-info/requires.txt +0 -0
  265. {lionagi-0.2.4 → lionagi-0.2.6}/lionagi.egg-info/top_level.txt +0 -0
  266. {lionagi-0.2.4 → lionagi-0.2.6}/pyproject.toml +0 -0
  267. {lionagi-0.2.4 → lionagi-0.2.6}/setup.cfg +0 -0
  268. {lionagi-0.2.4 → lionagi-0.2.6}/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.6
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**
@@ -322,6 +322,38 @@ class iModel:
322
322
  node.add_field("embedding", embed["data"][0]["embedding"])
323
323
  node._meta_insert("embedding_meta", payload)
324
324
 
325
+ async def format_structure(
326
+ self,
327
+ data: str | dict,
328
+ json_schema: dict | str = None,
329
+ request_fields: dict | list = None,
330
+ **kwargs,
331
+ ) -> dict:
332
+ if json_schema:
333
+ kwargs["response_format"] = {
334
+ "type": "json_schema",
335
+ "json_schema": json_schema,
336
+ }
337
+ kwargs["model"] = kwargs.pop("model", "gpt-4o-mini")
338
+ if not request_fields and not json_schema:
339
+ raise ValueError("Either request_fields or json_schema must be provided")
340
+ request_fields = request_fields or json_schema["properties"]
341
+
342
+ messages = [
343
+ {
344
+ "role": "system",
345
+ "content": "You are a helpful json formatting assistant.",
346
+ },
347
+ {
348
+ "role": "user",
349
+ "content": f"can you please format the given data into given json schema?"
350
+ f"--- data --- {data} |||| ----json fields required --- {request_fields}",
351
+ },
352
+ ]
353
+
354
+ result = await self.call_chat_completion(messages, **kwargs)
355
+ return result["choices"][0]["message"]["content"]
356
+
325
357
  def to_dict(self):
326
358
  """
327
359
  Converts the model instance to a dictionary representation.
@@ -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)
@@ -51,6 +51,10 @@ class DirectiveMixin:
51
51
  return_branch=False,
52
52
  images=None,
53
53
  image_path=None,
54
+ template=None,
55
+ verbose=True,
56
+ formatter=None,
57
+ format_kwargs=None,
54
58
  **kwargs,
55
59
  ):
56
60
  """
@@ -114,7 +118,15 @@ class DirectiveMixin:
114
118
  >>> print(result)
115
119
  """
116
120
 
117
- directive = Unit(self, imodel=imodel, rulebook=rulebook)
121
+ directive = Unit(
122
+ self,
123
+ imodel=imodel,
124
+ rulebook=rulebook,
125
+ template=template,
126
+ verbose=verbose,
127
+ formatter=formatter,
128
+ format_kwargs=format_kwargs,
129
+ )
118
130
  if system:
119
131
  self.add_message(system=system)
120
132
 
@@ -174,7 +186,10 @@ class DirectiveMixin:
174
186
  directive=None,
175
187
  images=None,
176
188
  image_path=None,
177
- verbose=False,
189
+ template=None,
190
+ verbose=True,
191
+ formatter=None,
192
+ format_kwargs=None,
178
193
  **kwargs,
179
194
  ):
180
195
  """
@@ -220,7 +235,14 @@ class DirectiveMixin:
220
235
 
221
236
  images = ImageUtil.read_image_to_base64(image_path)
222
237
 
223
- _directive = Unit(self, imodel=imodel, rulebook=rulebook, verbose=verbose)
238
+ _directive = Unit(
239
+ self,
240
+ imodel=imodel,
241
+ rulebook=rulebook,
242
+ verbose=verbose,
243
+ formatter=formatter,
244
+ format_kwargs=format_kwargs,
245
+ )
224
246
 
225
247
  idx = len(self.progress)
226
248
  if directive and isinstance(directive, str):
@@ -232,6 +254,7 @@ class DirectiveMixin:
232
254
  reason=reason,
233
255
  confidence=confidence,
234
256
  images=images,
257
+ template=template,
235
258
  **kwargs,
236
259
  )
237
260
 
@@ -248,7 +271,7 @@ class DirectiveMixin:
248
271
  form.action_response.update(_dict)
249
272
 
250
273
  return form
251
-
274
+
252
275
  form = await _directive.direct(
253
276
  instruction=instruction,
254
277
  context=context,
@@ -269,6 +292,7 @@ class DirectiveMixin:
269
292
  plan_num_step=plan_num_step,
270
293
  predict_num_sentences=predict_num_sentences,
271
294
  images=images,
295
+ template=template,
272
296
  **kwargs,
273
297
  )
274
298
 
@@ -283,5 +307,5 @@ class DirectiveMixin:
283
307
  if not hasattr(form, "action_response"):
284
308
  form.append_to_request("action_response", {})
285
309
  form.action_response.update(_dict)
286
-
310
+
287
311
  return form
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  """
16
16
 
17
+ from typing import Callable
17
18
  from lionagi.libs.ln_convert import strip_lower
18
19
  from lionagi.libs.ln_func_call import rcall
19
20
  from lionagi.core.collections.abc import Directive
@@ -40,7 +41,14 @@ class Unit(Directive, DirectiveMixin):
40
41
  default_template = UnitForm
41
42
 
42
43
  def __init__(
43
- self, branch, imodel: iModel = None, template=None, rulebook=None, verbose=False
44
+ self,
45
+ branch,
46
+ imodel: iModel = None,
47
+ template=None,
48
+ rulebook=None,
49
+ verbose=False,
50
+ formatter: Callable = None,
51
+ format_kwargs: dict = {},
44
52
  ) -> None:
45
53
  self.branch = branch
46
54
  if imodel and isinstance(imodel, iModel):
@@ -49,7 +57,11 @@ class Unit(Directive, DirectiveMixin):
49
57
  else:
50
58
  self.imodel = branch.imodel
51
59
  self.form_template = template or self.default_template
52
- self.validator = Validator(rulebook=rulebook) if rulebook else Validator()
60
+ rule_config = {"formatter": formatter, "format_kwargs": format_kwargs}
61
+ if rulebook:
62
+ rule_config["rulebook"] = rulebook
63
+
64
+ self.validator = Validator(**rule_config)
53
65
  self.verbose = verbose
54
66
 
55
67
  async def chat(
@@ -71,6 +83,8 @@ class Unit(Directive, DirectiveMixin):
71
83
  clear_messages=False,
72
84
  use_annotation=True,
73
85
  return_branch=False,
86
+ formatter=None,
87
+ format_kwargs={},
74
88
  **kwargs,
75
89
  ):
76
90
  """
@@ -119,6 +133,8 @@ class Unit(Directive, DirectiveMixin):
119
133
  clear_messages=clear_messages,
120
134
  use_annotation=use_annotation,
121
135
  return_branch=return_branch,
136
+ formatter=formatter,
137
+ format_kwargs=format_kwargs,
122
138
  **kwargs,
123
139
  )
124
140
 
@@ -257,7 +257,6 @@ class DirectiveMixin(ABC):
257
257
  form: Form = None,
258
258
  return_form: bool = True,
259
259
  strict: bool = False,
260
- rulebook: Any = None,
261
260
  use_annotation: bool = True,
262
261
  template_name: str = None,
263
262
  costs=None,
@@ -274,7 +273,6 @@ class DirectiveMixin(ABC):
274
273
  form: Form data.
275
274
  return_form: Flag indicating if form should be returned.
276
275
  strict: Flag indicating if strict validation should be applied.
277
- rulebook: Rulebook instance for validation.
278
276
  use_annotation: Flag indicating if annotations should be used.
279
277
  template_name: Template name for form.
280
278
 
@@ -295,8 +293,7 @@ class DirectiveMixin(ABC):
295
293
  response_ = self._process_model_response(_msg, requested_fields)
296
294
 
297
295
  if form:
298
- validator = Validator(rulebook=rulebook) if rulebook else self.validator
299
- form = await validator.validate_response(
296
+ form = await self.validator.validate_response(
300
297
  form=form,
301
298
  response=response_,
302
299
  strict=strict,
@@ -332,7 +329,6 @@ class DirectiveMixin(ABC):
332
329
  invoke_tool: bool = True,
333
330
  return_form: bool = True,
334
331
  strict: bool = False,
335
- rulebook: Any = None,
336
332
  imodel: Any = None,
337
333
  use_annotation: bool = True,
338
334
  branch: Any = None,
@@ -356,7 +352,6 @@ class DirectiveMixin(ABC):
356
352
  invoke_tool: Flag indicating if tools should be invoked.
357
353
  return_form: Flag indicating if form should be returned.
358
354
  strict: Flag indicating if strict validation should be applied.
359
- rulebook: Rulebook instance for validation.
360
355
  imodel: Model instance.
361
356
  use_annotation: Flag indicating if annotations should be used.
362
357
  branch: Branch instance.
@@ -400,9 +395,8 @@ class DirectiveMixin(ABC):
400
395
  form=form,
401
396
  return_form=return_form,
402
397
  strict=strict,
403
- rulebook=rulebook,
404
398
  use_annotation=use_annotation,
405
- costs=imodel.costs,
399
+ costs=imodel.costs or (0, 0),
406
400
  )
407
401
 
408
402
  return out_, branch if return_branch else out_
@@ -421,13 +415,14 @@ class DirectiveMixin(ABC):
421
415
  invoke_tool=True,
422
416
  return_form=True,
423
417
  strict=False,
424
- rulebook=None,
425
418
  imodel=None,
426
419
  images: Optional[str] = None,
427
420
  clear_messages=False,
428
421
  use_annotation=True,
429
422
  timeout: float = None,
430
423
  return_branch=False,
424
+ formatter=None,
425
+ format_kwargs={},
431
426
  **kwargs,
432
427
  ):
433
428
  """
@@ -470,13 +465,14 @@ class DirectiveMixin(ABC):
470
465
  invoke_tool=invoke_tool,
471
466
  return_form=return_form,
472
467
  strict=strict,
473
- rulebook=rulebook,
474
468
  imodel=imodel,
475
469
  use_annotation=use_annotation,
476
470
  timeout=timeout,
477
471
  branch=branch,
478
472
  clear_messages=clear_messages,
479
473
  return_branch=return_branch,
474
+ formatter=formatter,
475
+ format_kwargs=format_kwargs,
480
476
  **kwargs,
481
477
  )
482
478
 
@@ -609,7 +605,9 @@ class DirectiveMixin(ABC):
609
605
  clear_messages=False,
610
606
  return_branch=False,
611
607
  images: Optional[str] = None,
612
- verbose=None,
608
+ verbose=True,
609
+ formatter=None,
610
+ format_kwargs=None,
613
611
  **kwargs,
614
612
  ):
615
613
  """
@@ -658,7 +656,7 @@ class DirectiveMixin(ABC):
658
656
  if allow_action and not tools:
659
657
  tools = True
660
658
 
661
- tool_schema=None
659
+ tool_schema = None
662
660
  if tools:
663
661
  tool_schema = branch.tool_manager.get_tool_schema(tools)
664
662
 
@@ -14,10 +14,12 @@ See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  """
16
16
 
17
- from typing import Any, Dict, List, Union
17
+ import asyncio
18
+ from typing import Any, Dict, List, Union, Callable
18
19
  from lionagi.libs import SysUtil
19
20
  from lionagi.libs.ln_func_call import lcall
20
21
  from lionagi.core.collections.abc import FieldError
22
+ from lionagi.core.collections.model import iModel
21
23
  from ..rule.base import Rule
22
24
  from ..rule._default import DEFAULT_RULES
23
25
  from ..rule.rulebook import RuleBook
@@ -56,6 +58,8 @@ class Validator:
56
58
  order: List[str] = None,
57
59
  init_config: Dict[str, Dict] = None,
58
60
  active_rules: Dict[str, Rule] = None,
61
+ formatter: Callable = None,
62
+ format_kwargs: dict = {},
59
63
  ):
60
64
  """
61
65
  Initialize the Validator.
@@ -75,6 +79,8 @@ class Validator:
75
79
  )
76
80
  self.active_rules: Dict[str, Rule] = active_rules or self._initiate_rules()
77
81
  self.validation_log = []
82
+ self.formatter = formatter
83
+ self.format_kwargs = format_kwargs
78
84
 
79
85
  def _initiate_rules(self) -> Dict[str, Rule]:
80
86
  """
@@ -207,9 +213,16 @@ class Validator:
207
213
  if len(form.requested_fields) == 1:
208
214
  response = {form.requested_fields[0]: response}
209
215
  else:
210
- raise ValueError(
211
- "Response is a string, but form has multiple fields to be filled"
212
- )
216
+ if self.formatter:
217
+ if asyncio.iscoroutinefunction(self.formatter):
218
+ response = await self.formatter(response, **self.format_kwargs)
219
+ print("formatter used")
220
+ else:
221
+ response = self.formatter(response, **self.format_kwargs)
222
+ print("formatter used")
223
+
224
+ if not isinstance(response, dict):
225
+ raise ValueError(f"The form response format is invalid for filling.")
213
226
 
214
227
  dict_ = {}
215
228
  for k, v in response.items():
@@ -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