lionagi 0.2.5__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 (266) hide show
  1. {lionagi-0.2.5 → lionagi-0.2.6}/PKG-INFO +1 -1
  2. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/model.py +32 -0
  3. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/session/directive_mixin.py +27 -3
  4. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/unit.py +18 -2
  5. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/unit_mixin.py +9 -11
  6. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/validator/validator.py +17 -4
  7. lionagi-0.2.6/lionagi/version.py +1 -0
  8. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi.egg-info/PKG-INFO +1 -1
  9. lionagi-0.2.5/lionagi/version.py +0 -1
  10. {lionagi-0.2.5 → lionagi-0.2.6}/LICENSE +0 -0
  11. {lionagi-0.2.5 → lionagi-0.2.6}/README.md +0 -0
  12. {lionagi-0.2.5 → lionagi-0.2.6}/README.rst +0 -0
  13. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/__init__.py +0 -0
  14. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/__init__.py +0 -0
  15. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/_setting/__init__.py +0 -0
  16. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/_setting/_setting.py +0 -0
  17. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/action/__init__.py +0 -0
  18. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/action/function_calling.py +0 -0
  19. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/action/manual.py +0 -0
  20. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/action/node.py +0 -0
  21. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/action/tool.py +0 -0
  22. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/action/tool_manager.py +0 -0
  23. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/agent/__init__.py +0 -0
  24. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/agent/base_agent.py +0 -0
  25. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/agent/eval/__init__.py +0 -0
  26. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/agent/eval/evaluator.py +0 -0
  27. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/agent/eval/vote.py +0 -0
  28. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/agent/learn/__init__.py +0 -0
  29. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/agent/learn/learner.py +0 -0
  30. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/agent/plan/__init__.py +0 -0
  31. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/agent/plan/plan.py +0 -0
  32. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/agent/plan/unit_template.py +0 -0
  33. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/__init__.py +0 -0
  34. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/_logger.py +0 -0
  35. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/abc/__init__.py +0 -0
  36. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/abc/component.py +0 -0
  37. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/abc/concepts.py +0 -0
  38. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/abc/exceptions.py +0 -0
  39. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/abc/util.py +0 -0
  40. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/exchange.py +0 -0
  41. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/flow.py +0 -0
  42. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/pile.py +0 -0
  43. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/progression.py +0 -0
  44. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/collections/util.py +0 -0
  45. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/director/__init__.py +0 -0
  46. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/director/direct.py +0 -0
  47. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/director/director.py +0 -0
  48. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/engine/__init__.py +0 -0
  49. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/engine/branch_engine.py +0 -0
  50. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/engine/instruction_map_engine.py +0 -0
  51. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/engine/sandbox_.py +0 -0
  52. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/engine/script_engine.py +0 -0
  53. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/executor/__init__.py +0 -0
  54. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/executor/base_executor.py +0 -0
  55. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/executor/graph_executor.py +0 -0
  56. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/executor/neo4j_executor.py +0 -0
  57. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/generic/__init__.py +0 -0
  58. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/generic/edge.py +0 -0
  59. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/generic/edge_condition.py +0 -0
  60. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/generic/graph.py +0 -0
  61. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/generic/hyperedge.py +0 -0
  62. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/generic/node.py +0 -0
  63. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/generic/tree.py +0 -0
  64. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/generic/tree_node.py +0 -0
  65. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/mail/__init__.py +0 -0
  66. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/mail/mail.py +0 -0
  67. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/mail/mail_manager.py +0 -0
  68. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/mail/package.py +0 -0
  69. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/mail/start_mail.py +0 -0
  70. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/message/__init__.py +0 -0
  71. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/message/action_request.py +0 -0
  72. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/message/action_response.py +0 -0
  73. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/message/assistant_response.py +0 -0
  74. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/message/instruction.py +0 -0
  75. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/message/message.py +0 -0
  76. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/message/system.py +0 -0
  77. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/message/util.py +0 -0
  78. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/report/__init__.py +0 -0
  79. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/report/base.py +0 -0
  80. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/report/form.py +0 -0
  81. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/report/report.py +0 -0
  82. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/report/util.py +0 -0
  83. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/rule/__init__.py +0 -0
  84. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/rule/_default.py +0 -0
  85. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/rule/action.py +0 -0
  86. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/rule/base.py +0 -0
  87. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/rule/boolean.py +0 -0
  88. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/rule/choice.py +0 -0
  89. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/rule/mapping.py +0 -0
  90. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/rule/number.py +0 -0
  91. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/rule/rulebook.py +0 -0
  92. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/rule/string.py +0 -0
  93. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/rule/util.py +0 -0
  94. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/session/__init__.py +0 -0
  95. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/session/branch.py +0 -0
  96. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/session/session.py +0 -0
  97. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/structure/__init__.py +0 -0
  98. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/structure/chain.py +0 -0
  99. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/structure/forest.py +0 -0
  100. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/structure/graph.py +0 -0
  101. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/structure/tree.py +0 -0
  102. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/__init__.py +0 -0
  103. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/parallel_unit.py +0 -0
  104. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/template/__init__.py +0 -0
  105. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/template/action.py +0 -0
  106. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/template/base.py +0 -0
  107. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/template/plan.py +0 -0
  108. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/template/predict.py +0 -0
  109. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/template/score.py +0 -0
  110. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/template/select.py +0 -0
  111. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/unit_form.py +0 -0
  112. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/unit/util.py +0 -0
  113. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/validator/__init__.py +0 -0
  114. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/work/__init__.py +0 -0
  115. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/work/work.py +0 -0
  116. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/work/work_edge.py +0 -0
  117. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/work/work_function.py +0 -0
  118. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/work/work_function_node.py +0 -0
  119. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/work/work_queue.py +0 -0
  120. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/work/work_task.py +0 -0
  121. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/work/worker.py +0 -0
  122. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/work/worker_engine.py +0 -0
  123. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/core/work/worklog.py +0 -0
  124. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/__init__.py +0 -0
  125. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/compressor/__init__.py +0 -0
  126. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/compressor/base.py +0 -0
  127. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/compressor/llm_compressor.py +0 -0
  128. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/compressor/llm_summarizer.py +0 -0
  129. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/compressor/util.py +0 -0
  130. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/directive/__init__.py +0 -0
  131. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/directive/parser/__init__.py +0 -0
  132. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/directive/parser/base_parser.py +0 -0
  133. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/directive/template/__init__.py +0 -0
  134. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/directive/template/base_template.py +0 -0
  135. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/directive/template/schema.py +0 -0
  136. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/directive/tokenizer.py +0 -0
  137. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/evaluator/__init__.py +0 -0
  138. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/evaluator/ast_evaluator.py +0 -0
  139. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/evaluator/base_evaluator.py +0 -0
  140. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/knowledge/__init__.py +0 -0
  141. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/knowledge/base.py +0 -0
  142. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/knowledge/graph.py +0 -0
  143. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/memory/__init__.py +0 -0
  144. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/strategies/__init__.py +0 -0
  145. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/experimental/strategies/base.py +0 -0
  146. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/__init__.py +0 -0
  147. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/__init__.py +0 -0
  148. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/autogen_/__init__.py +0 -0
  149. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/autogen_/autogen_.py +0 -0
  150. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/langchain_/__init__.py +0 -0
  151. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/langchain_/documents.py +0 -0
  152. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/langchain_/langchain_bridge.py +0 -0
  153. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/__init__.py +0 -0
  154. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/index.py +0 -0
  155. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/llama_index_bridge.py +0 -0
  156. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/llama_pack.py +0 -0
  157. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/node_parser.py +0 -0
  158. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/reader.py +0 -0
  159. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/llamaindex_/textnode.py +0 -0
  160. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/pydantic_/__init__.py +0 -0
  161. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/pydantic_/pydantic_bridge.py +0 -0
  162. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/transformers_/__init__.py +0 -0
  163. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/bridge/transformers_/install_.py +0 -0
  164. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/chunker/__init__.py +0 -0
  165. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/chunker/chunk.py +0 -0
  166. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/config/__init__.py +0 -0
  167. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/config/mlx_configs.py +0 -0
  168. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/config/oai_configs.py +0 -0
  169. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/config/ollama_configs.py +0 -0
  170. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/config/openrouter_configs.py +0 -0
  171. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/loader/__init__.py +0 -0
  172. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/loader/load.py +0 -0
  173. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/loader/load_util.py +0 -0
  174. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/provider/__init__.py +0 -0
  175. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/provider/_mapping.py +0 -0
  176. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/provider/litellm.py +0 -0
  177. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/provider/mistralai.py +0 -0
  178. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/provider/mlx_service.py +0 -0
  179. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/provider/oai.py +0 -0
  180. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/provider/ollama.py +0 -0
  181. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/provider/openrouter.py +0 -0
  182. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/provider/services.py +0 -0
  183. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/provider/transformers.py +0 -0
  184. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/storage/__init__.py +0 -0
  185. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/storage/neo4j.py +0 -0
  186. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/storage/storage_util.py +0 -0
  187. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/storage/structure_excel.py +0 -0
  188. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/storage/to_csv.py +0 -0
  189. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/integrations/storage/to_excel.py +0 -0
  190. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/__init__.py +0 -0
  191. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_api.py +0 -0
  192. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_async.py +0 -0
  193. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_context.py +0 -0
  194. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_convert.py +0 -0
  195. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_dataframe.py +0 -0
  196. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_func_call.py +0 -0
  197. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_image.py +0 -0
  198. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_knowledge_graph.py +0 -0
  199. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_nested.py +0 -0
  200. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_parse.py +0 -0
  201. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_queue.py +0 -0
  202. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_tokenize.py +0 -0
  203. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/ln_validate.py +0 -0
  204. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/special_tokens.py +0 -0
  205. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/libs/sys_util.py +0 -0
  206. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/__init__.py +0 -0
  207. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/coder/__init__.py +0 -0
  208. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/coder/add_feature.py +0 -0
  209. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/coder/base_prompts.py +0 -0
  210. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/coder/code_form.py +0 -0
  211. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/coder/coder.py +0 -0
  212. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/coder/util.py +0 -0
  213. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/researcher/__init__.py +0 -0
  214. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/researcher/data_source/__init__.py +0 -0
  215. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/researcher/data_source/finhub_.py +0 -0
  216. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/researcher/data_source/google_.py +0 -0
  217. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/researcher/data_source/wiki_.py +0 -0
  218. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/lions/researcher/data_source/yfinance_.py +0 -0
  219. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/__init__.py +0 -0
  220. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/api/__init__.py +0 -0
  221. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/api/aws/__init__.py +0 -0
  222. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/api/aws/conftest.py +0 -0
  223. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/api/aws/test_aws_s3.py +0 -0
  224. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/integrations/__init__.py +0 -0
  225. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/libs/__init__.py +0 -0
  226. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/libs/test_api.py +0 -0
  227. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/libs/test_convert.py +0 -0
  228. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/libs/test_field_validators.py +0 -0
  229. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/libs/test_func_call.py +0 -0
  230. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/libs/test_nested.py +0 -0
  231. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/libs/test_parse.py +0 -0
  232. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/libs/test_queue.py +0 -0
  233. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/libs/test_sys_util.py +0 -0
  234. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/__init__.py +0 -0
  235. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/collections/__init__.py +0 -0
  236. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/collections/test_component.py +0 -0
  237. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/collections/test_exchange.py +0 -0
  238. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/collections/test_flow.py +0 -0
  239. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/collections/test_pile.py +0 -0
  240. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/collections/test_progression.py +0 -0
  241. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/generic/__init__.py +0 -0
  242. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/generic/test_edge.py +0 -0
  243. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/generic/test_graph.py +0 -0
  244. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/generic/test_node.py +0 -0
  245. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/generic/test_structure.py +0 -0
  246. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/generic/test_tree_node.py +0 -0
  247. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/graph/__init__.py +0 -0
  248. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/graph/test_graph.py +0 -0
  249. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/graph/test_tree.py +0 -0
  250. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/mail/__init__.py +0 -0
  251. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/mail/test_mail.py +0 -0
  252. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/test_branch.py +0 -0
  253. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/test_form.py +0 -0
  254. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/test_report.py +0 -0
  255. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/test_structure/__init__.py +0 -0
  256. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/test_structure/test_base_structure.py +0 -0
  257. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/test_structure/test_graph.py +0 -0
  258. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/test_structure/test_tree.py +0 -0
  259. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi/tests/test_core/test_validator.py +0 -0
  260. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi.egg-info/SOURCES.txt +0 -0
  261. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi.egg-info/dependency_links.txt +0 -0
  262. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi.egg-info/requires.txt +0 -0
  263. {lionagi-0.2.5 → lionagi-0.2.6}/lionagi.egg-info/top_level.txt +0 -0
  264. {lionagi-0.2.5 → lionagi-0.2.6}/pyproject.toml +0 -0
  265. {lionagi-0.2.5 → lionagi-0.2.6}/setup.cfg +0 -0
  266. {lionagi-0.2.5 → 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.5
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>
@@ -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.
@@ -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
 
@@ -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
 
@@ -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
  """
@@ -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():
@@ -0,0 +1 @@
1
+ __version__ = "0.2.6"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lionagi
3
- Version: 0.2.5
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>
@@ -1 +0,0 @@
1
- __version__ = "0.2.5"
File without changes
File without changes
File without changes
File without changes