lionagi 0.3.7__tar.gz → 0.4.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. lionagi-0.4.0/PKG-INFO +241 -0
  2. lionagi-0.4.0/README.md +223 -0
  3. lionagi-0.4.0/lionagi/core/director/operations/select.py +3 -0
  4. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/rule/choice.py +2 -2
  5. lionagi-0.4.0/lionagi/operations/__init__.py +6 -0
  6. lionagi-0.4.0/lionagi/operations/brainstorm.py +87 -0
  7. lionagi-0.4.0/lionagi/operations/config.py +6 -0
  8. lionagi-0.4.0/lionagi/operations/rank.py +102 -0
  9. lionagi-0.4.0/lionagi/operations/score.py +144 -0
  10. lionagi-0.4.0/lionagi/operations/select.py +141 -0
  11. lionagi-0.4.0/lionagi/version.py +1 -0
  12. {lionagi-0.3.7 → lionagi-0.4.0}/pyproject.toml +2 -4
  13. lionagi-0.3.7/PKG-INFO +0 -70
  14. lionagi-0.3.7/README.md +0 -50
  15. lionagi-0.3.7/lionagi/core/director/models/__init__.py +0 -13
  16. lionagi-0.3.7/lionagi/core/director/models/action_model.py +0 -61
  17. lionagi-0.3.7/lionagi/core/director/models/brainstorm_model.py +0 -42
  18. lionagi-0.3.7/lionagi/core/director/models/plan_model.py +0 -51
  19. lionagi-0.3.7/lionagi/core/director/models/reason_model.py +0 -63
  20. lionagi-0.3.7/lionagi/core/director/models/step_model.py +0 -65
  21. lionagi-0.3.7/lionagi/core/director/operations/select.py +0 -93
  22. lionagi-0.3.7/lionagi/lions/judge/forms/__init__.py +0 -0
  23. lionagi-0.3.7/lionagi/lions/judge/services/__init__.py +0 -0
  24. lionagi-0.3.7/lionagi/lions/researcher/__init__.py +0 -0
  25. lionagi-0.3.7/lionagi/lions/researcher/data_source/__init__.py +0 -0
  26. lionagi-0.3.7/lionagi/operations/brainstorm/__init__.py +0 -0
  27. lionagi-0.3.7/lionagi/operations/brainstorm.py +0 -0
  28. lionagi-0.3.7/lionagi/operations/chat/__init__.py +0 -0
  29. lionagi-0.3.7/lionagi/operations/models/__init__.py +0 -0
  30. lionagi-0.3.7/lionagi/operations/plan/__init__.py +0 -0
  31. lionagi-0.3.7/lionagi/operations/plan/base.py +0 -0
  32. lionagi-0.3.7/lionagi/operations/query/__init__.py +0 -0
  33. lionagi-0.3.7/lionagi/operations/rank/__init__.py +0 -0
  34. lionagi-0.3.7/lionagi/operations/react/__init__.py +0 -0
  35. lionagi-0.3.7/lionagi/operations/route/__init__.py +0 -0
  36. lionagi-0.3.7/lionagi/operations/score/__init__.py +0 -0
  37. lionagi-0.3.7/lionagi/operations/select/__init__.py +0 -0
  38. lionagi-0.3.7/lionagi/operations/strategize/__init__.py +0 -0
  39. lionagi-0.3.7/lionagi/version.py +0 -1
  40. {lionagi-0.3.7 → lionagi-0.4.0}/LICENSE +0 -0
  41. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/__init__.py +0 -0
  42. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/__init__.py +0 -0
  43. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/_setting/__init__.py +0 -0
  44. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/_setting/_setting.py +0 -0
  45. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/action/README.md +0 -0
  46. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/action/__init__.py +0 -0
  47. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/action/function_calling.py +0 -0
  48. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/action/manual.py +0 -0
  49. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/action/node.py +0 -0
  50. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/action/tool.py +0 -0
  51. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/action/tool_manager.py +0 -0
  52. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/agent/README.md +0 -0
  53. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/agent/__init__.py +0 -0
  54. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/agent/base_agent.py +0 -0
  55. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/agent/eval/README.md +0 -0
  56. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/agent/eval/__init__.py +0 -0
  57. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/agent/eval/evaluator.py +0 -0
  58. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/agent/eval/vote.py +0 -0
  59. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/agent/learn/__init__.py +0 -0
  60. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/agent/learn/learner.py +0 -0
  61. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/agent/plan/__init__.py +0 -0
  62. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/agent/plan/plan.py +0 -0
  63. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/agent/plan/unit_template.py +0 -0
  64. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/README.md +0 -0
  65. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/__init__.py +0 -0
  66. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/_logger.py +0 -0
  67. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/abc/README.md +0 -0
  68. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/abc/__init__.py +0 -0
  69. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/abc/component.py +0 -0
  70. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/abc/concepts.py +0 -0
  71. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/abc/exceptions.py +0 -0
  72. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/abc/util.py +0 -0
  73. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/exchange.py +0 -0
  74. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/flow.py +0 -0
  75. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/model.py +0 -0
  76. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/pile.py +0 -0
  77. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/progression.py +0 -0
  78. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/collections/util.py +0 -0
  79. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/director/README.md +0 -0
  80. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/director/__init__.py +0 -0
  81. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/director/direct.py +0 -0
  82. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/director/director.py +0 -0
  83. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/director/operations/__init__.py +0 -0
  84. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/director/operations/utils.py +0 -0
  85. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/engine/__init__.py +0 -0
  86. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/engine/branch_engine.py +0 -0
  87. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/engine/instruction_map_engine.py +0 -0
  88. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/engine/sandbox_.py +0 -0
  89. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/engine/script_engine.py +0 -0
  90. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/executor/__init__.py +0 -0
  91. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/executor/base_executor.py +0 -0
  92. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/executor/graph_executor.py +0 -0
  93. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/executor/neo4j_executor.py +0 -0
  94. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/generic/README.md +0 -0
  95. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/generic/__init__.py +0 -0
  96. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/generic/edge.py +0 -0
  97. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/generic/edge_condition.py +0 -0
  98. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/generic/graph.py +0 -0
  99. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/generic/hyperedge.py +0 -0
  100. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/generic/node.py +0 -0
  101. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/generic/registry/component_registry/__init__.py +0 -0
  102. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/generic/tree.py +0 -0
  103. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/generic/tree_node.py +0 -0
  104. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/mail/__init__.py +0 -0
  105. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/mail/mail.py +0 -0
  106. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/mail/mail_manager.py +0 -0
  107. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/mail/package.py +0 -0
  108. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/mail/start_mail.py +0 -0
  109. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/message/__init__.py +0 -0
  110. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/message/action_request.py +0 -0
  111. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/message/action_response.py +0 -0
  112. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/message/assistant_response.py +0 -0
  113. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/message/instruction.py +0 -0
  114. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/message/message.py +0 -0
  115. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/message/system.py +0 -0
  116. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/message/util.py +0 -0
  117. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/report/__init__.py +0 -0
  118. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/report/base.py +0 -0
  119. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/report/form.py +0 -0
  120. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/report/report.py +0 -0
  121. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/report/util.py +0 -0
  122. {lionagi-0.3.7/lionagi/core/operations → lionagi-0.4.0/lionagi/core/rule}/__init__.py +0 -0
  123. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/rule/_default.py +0 -0
  124. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/rule/action.py +0 -0
  125. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/rule/base.py +0 -0
  126. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/rule/boolean.py +0 -0
  127. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/rule/mapping.py +0 -0
  128. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/rule/number.py +0 -0
  129. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/rule/rulebook.py +0 -0
  130. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/rule/string.py +0 -0
  131. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/rule/util.py +0 -0
  132. {lionagi-0.3.7/lionagi/core/operations/chat → lionagi-0.4.0/lionagi/core/session}/__init__.py +0 -0
  133. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/session/branch.py +0 -0
  134. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/session/directive_mixin.py +0 -0
  135. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/session/session.py +0 -0
  136. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/structure/__init__.py +0 -0
  137. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/structure/chain.py +0 -0
  138. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/structure/forest.py +0 -0
  139. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/structure/graph.py +0 -0
  140. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/structure/tree.py +0 -0
  141. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/unit/__init__.py +0 -0
  142. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/unit/parallel_unit.py +0 -0
  143. {lionagi-0.3.7/lionagi/core/operations/direct → lionagi-0.4.0/lionagi/core/unit/template}/__init__.py +0 -0
  144. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/unit/template/action.py +0 -0
  145. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/unit/template/base.py +0 -0
  146. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/unit/template/plan.py +0 -0
  147. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/unit/template/predict.py +0 -0
  148. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/unit/template/score.py +0 -0
  149. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/unit/template/select.py +0 -0
  150. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/unit/unit.py +0 -0
  151. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/unit/unit_form.py +0 -0
  152. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/unit/unit_mixin.py +0 -0
  153. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/unit/util.py +0 -0
  154. {lionagi-0.3.7/lionagi/core/operative → lionagi-0.4.0/lionagi/core/validator}/__init__.py +0 -0
  155. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/validator/validator.py +0 -0
  156. {lionagi-0.3.7/lionagi/core/rule → lionagi-0.4.0/lionagi/core/work}/__init__.py +0 -0
  157. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/work/work.py +0 -0
  158. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/work/work_edge.py +0 -0
  159. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/work/work_function.py +0 -0
  160. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/work/work_function_node.py +0 -0
  161. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/work/work_queue.py +0 -0
  162. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/work/work_task.py +0 -0
  163. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/work/worker.py +0 -0
  164. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/work/worker_engine.py +0 -0
  165. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/core/work/worklog.py +0 -0
  166. {lionagi-0.3.7/lionagi/core/session → lionagi-0.4.0/lionagi/experimental}/__init__.py +0 -0
  167. {lionagi-0.3.7/lionagi/core/unit/template → lionagi-0.4.0/lionagi/experimental/compressor}/__init__.py +0 -0
  168. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/compressor/base.py +0 -0
  169. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/compressor/llm_compressor.py +0 -0
  170. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/compressor/llm_summarizer.py +0 -0
  171. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/compressor/util.py +0 -0
  172. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/directive/README.md +0 -0
  173. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/directive/__init__.py +0 -0
  174. {lionagi-0.3.7/lionagi/core/validator → lionagi-0.4.0/lionagi/experimental/directive/parser}/__init__.py +0 -0
  175. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/directive/parser/base_parser.py +0 -0
  176. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/directive/parser/base_syntax.txt +0 -0
  177. {lionagi-0.3.7/lionagi/core/work → lionagi-0.4.0/lionagi/experimental/directive/template}/__init__.py +0 -0
  178. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/directive/template/base_template.py +0 -0
  179. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/directive/template/schema.py +0 -0
  180. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/directive/tokenizer.py +0 -0
  181. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/evaluator/README.md +0 -0
  182. {lionagi-0.3.7/lionagi/experimental → lionagi-0.4.0/lionagi/experimental/evaluator}/__init__.py +0 -0
  183. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/evaluator/ast_evaluator.py +0 -0
  184. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/evaluator/base_evaluator.py +0 -0
  185. {lionagi-0.3.7/lionagi/experimental/compressor → lionagi-0.4.0/lionagi/experimental/knowledge}/__init__.py +0 -0
  186. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/knowledge/base.py +0 -0
  187. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/knowledge/graph.py +0 -0
  188. {lionagi-0.3.7/lionagi/experimental/directive/parser → lionagi-0.4.0/lionagi/experimental/memory}/__init__.py +0 -0
  189. {lionagi-0.3.7/lionagi/experimental/directive/template → lionagi-0.4.0/lionagi/experimental/strategies}/__init__.py +0 -0
  190. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/experimental/strategies/base.py +0 -0
  191. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/__init__.py +0 -0
  192. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/bridge/__init__.py +0 -0
  193. {lionagi-0.3.7/lionagi/experimental/evaluator → lionagi-0.4.0/lionagi/integrations/bridge/autogen_}/__init__.py +0 -0
  194. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/bridge/autogen_/autogen_.py +0 -0
  195. {lionagi-0.3.7/lionagi/experimental/knowledge → lionagi-0.4.0/lionagi/integrations/bridge/langchain_}/__init__.py +0 -0
  196. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/bridge/langchain_/documents.py +0 -0
  197. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/bridge/langchain_/langchain_bridge.py +0 -0
  198. {lionagi-0.3.7/lionagi/experimental/memory → lionagi-0.4.0/lionagi/integrations/bridge/llamaindex_}/__init__.py +0 -0
  199. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/bridge/llamaindex_/index.py +0 -0
  200. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/bridge/llamaindex_/llama_index_bridge.py +0 -0
  201. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/bridge/llamaindex_/llama_pack.py +0 -0
  202. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/bridge/llamaindex_/node_parser.py +0 -0
  203. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/bridge/llamaindex_/reader.py +0 -0
  204. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/bridge/llamaindex_/textnode.py +0 -0
  205. {lionagi-0.3.7/lionagi/experimental/strategies → lionagi-0.4.0/lionagi/integrations/bridge/pydantic_}/__init__.py +0 -0
  206. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/bridge/pydantic_/pydantic_bridge.py +0 -0
  207. {lionagi-0.3.7/lionagi/integrations/bridge/autogen_ → lionagi-0.4.0/lionagi/integrations/bridge/transformers_}/__init__.py +0 -0
  208. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/bridge/transformers_/install_.py +0 -0
  209. {lionagi-0.3.7/lionagi/integrations/bridge/langchain_ → lionagi-0.4.0/lionagi/integrations/chunker}/__init__.py +0 -0
  210. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/chunker/chunk.py +0 -0
  211. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/config/__init__.py +0 -0
  212. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/config/mlx_configs.py +0 -0
  213. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/config/oai_configs.py +0 -0
  214. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/config/ollama_configs.py +0 -0
  215. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/config/openrouter_configs.py +0 -0
  216. {lionagi-0.3.7/lionagi/integrations/bridge/llamaindex_ → lionagi-0.4.0/lionagi/integrations/langchain_}/__init__.py +0 -0
  217. {lionagi-0.3.7/lionagi/integrations/bridge/pydantic_ → lionagi-0.4.0/lionagi/integrations/llamaindex_}/__init__.py +0 -0
  218. {lionagi-0.3.7/lionagi/integrations/bridge/transformers_ → lionagi-0.4.0/lionagi/integrations/loader}/__init__.py +0 -0
  219. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/loader/load.py +0 -0
  220. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/loader/load_util.py +0 -0
  221. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/provider/__init__.py +0 -0
  222. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/provider/_mapping.py +0 -0
  223. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/provider/litellm.py +0 -0
  224. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/provider/mistralai.py +0 -0
  225. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/provider/mlx_service.py +0 -0
  226. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/provider/oai.py +0 -0
  227. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/provider/ollama.py +0 -0
  228. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/provider/openrouter.py +0 -0
  229. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/provider/services.py +0 -0
  230. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/provider/transformers.py +0 -0
  231. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/storage/__init__.py +0 -0
  232. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/storage/neo4j.py +0 -0
  233. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/storage/storage_util.py +0 -0
  234. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/storage/structure_excel.py +0 -0
  235. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/storage/to_csv.py +0 -0
  236. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/integrations/storage/to_excel.py +0 -0
  237. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/__init__.py +0 -0
  238. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_api.py +0 -0
  239. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_async.py +0 -0
  240. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_context.py +0 -0
  241. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_convert.py +0 -0
  242. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_dataframe.py +0 -0
  243. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_func_call.py +0 -0
  244. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_image.py +0 -0
  245. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_knowledge_graph.py +0 -0
  246. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_nested.py +0 -0
  247. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_parse.py +0 -0
  248. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_queue.py +0 -0
  249. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_tokenize.py +0 -0
  250. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/ln_validate.py +0 -0
  251. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/special_tokens.py +0 -0
  252. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/libs/sys_util.py +0 -0
  253. {lionagi-0.3.7/lionagi/integrations/chunker → lionagi-0.4.0/lionagi/lions}/__init__.py +0 -0
  254. {lionagi-0.3.7/lionagi/integrations/langchain_ → lionagi-0.4.0/lionagi/lions/coder}/__init__.py +0 -0
  255. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/coder/add_feature.py +0 -0
  256. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/coder/base_prompts.py +0 -0
  257. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/coder/code_form.py +0 -0
  258. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/coder/coder.py +0 -0
  259. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/coder/util.py +0 -0
  260. {lionagi-0.3.7/lionagi/integrations/llamaindex_ → lionagi-0.4.0/lionagi/lions/director}/__init__.py +0 -0
  261. {lionagi-0.3.7/lionagi/integrations/loader → lionagi-0.4.0/lionagi/lions/judge}/__init__.py +0 -0
  262. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/judge/config.py +0 -0
  263. {lionagi-0.3.7/lionagi/lions → lionagi-0.4.0/lionagi/lions/judge/data}/__init__.py +0 -0
  264. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/judge/data/sample_codes.py +0 -0
  265. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/judge/data/sample_rurbic.py +0 -0
  266. {lionagi-0.3.7/lionagi/lions/coder → lionagi-0.4.0/lionagi/lions/judge/forms}/__init__.py +0 -0
  267. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/judge/forms/code_analysis_form.py +0 -0
  268. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/judge/rubric.py +0 -0
  269. {lionagi-0.3.7/lionagi/lions/director → lionagi-0.4.0/lionagi/lions/judge/services}/__init__.py +0 -0
  270. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/judge/services/judge_code.py +0 -0
  271. {lionagi-0.3.7/lionagi/lions/judge → lionagi-0.4.0/lionagi/lions/researcher}/__init__.py +0 -0
  272. {lionagi-0.3.7/lionagi/lions/judge/data → lionagi-0.4.0/lionagi/lions/researcher/data_source}/__init__.py +0 -0
  273. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/researcher/data_source/finhub_.py +0 -0
  274. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/researcher/data_source/google_.py +0 -0
  275. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/researcher/data_source/wiki_.py +0 -0
  276. {lionagi-0.3.7 → lionagi-0.4.0}/lionagi/lions/researcher/data_source/yfinance_.py +0 -0
lionagi-0.4.0/PKG-INFO ADDED
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.1
2
+ Name: lionagi
3
+ Version: 0.4.0
4
+ Summary: Towards automated general intelligence.
5
+ Author: HaiyangLi
6
+ Author-email: quantocean.li@gmail.com
7
+ Requires-Python: >=3.10,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Requires-Dist: aiocache (>=0.12.0,<0.13.0)
13
+ Requires-Dist: ipython (>=8.0.0,<9.0.0)
14
+ Requires-Dist: lion-core (==0.5.6)
15
+ Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
16
+ Description-Content-Type: text/markdown
17
+
18
+ ![PyPI - Version](https://img.shields.io/pypi/v/lionagi?labelColor=233476aa&color=231fc935)
19
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/lionagi?color=blue)
20
+ ![Dependencies](https://img.shields.io/badge/dependencies-4-brightgreen)
21
+ ![Python Version](https://img.shields.io/badge/python-3.10%2B-blue)
22
+
23
+ [Documentation](https://ocean-lion.com/Welcome) | [Discord](https://discord.gg/aqSJ2v46vu) | [PyPI](https://pypi.org/project/lionagi/) | [Roadmap](https://trello.com/b/3seomsrI/lionagi)
24
+
25
+ # LION Framework
26
+ ### Language InterOperable Network - The Future of Controlled AI Operations
27
+
28
+ > Harness the power of next-generation AI while maintaining complete control and reliability.
29
+
30
+ ## Why LION?
31
+
32
+ The AI revolution is transforming how we work - but with great power comes great responsibility. LION provides the control mechanisms and reliability features needed to safely integrate advanced AI capabilities into enterprise workflows.
33
+
34
+ LION is designed to be:
35
+ - 🔒 **Controlled**: Built-in safety mechanisms and verification
36
+ - 🎯 **Precise**: Exact control over AI behaviors
37
+ - 🔧 **Flexible**: Build any workflow you need
38
+ - 🚀 **Efficient**: Minimal dependencies, maximum performance
39
+
40
+ ## Quick Start
41
+
42
+ ```python
43
+ from lionagi import Branch, iModel
44
+
45
+ # Initialize model
46
+ gpt4o = iModel(provider="openai", model="gpt-4o")
47
+
48
+ # Create a branch with personality
49
+ comedian = Branch(
50
+ system="you are a sarcastic dragon hunter",
51
+ imodel=gpt4o
52
+ )
53
+
54
+ # Chat asynchronously
55
+ response = await comedian.chat(
56
+ "tell me a joke on knight vs dragon"
57
+ )
58
+ ```
59
+
60
+ ## Installation
61
+
62
+ LION maintains minimal dependencies for maximum reliability:
63
+
64
+ ```bash
65
+ pip install lionagi
66
+ ```
67
+
68
+ Dependencies:
69
+ - aiocache
70
+ - lion-core
71
+ - python-dotenv
72
+ - IPython
73
+
74
+ ## 🌟 Example Workflow
75
+
76
+ Below is an example of what you can build with LION. Note that these are sample implementations - LION provides the building blocks, you create the workflows that fit your needs.
77
+
78
+ ```mermaid
79
+ sequenceDiagram
80
+ autonumber
81
+ participant Client
82
+ participant Orchestrator
83
+ participant ResearchAgent
84
+ participant AnalysisAgent
85
+ participant ValidationAgent
86
+ participant Tools
87
+
88
+ Client->>+Orchestrator: Submit Complex Task
89
+ Note over Orchestrator: Task Analysis & Planning
90
+
91
+ %% Research Phase
92
+ Orchestrator->>+ResearchAgent: Delegate Research
93
+ activate ResearchAgent
94
+ ResearchAgent->>Tools: Access Data Sources
95
+ Tools-->>ResearchAgent: Raw Data
96
+ ResearchAgent-->>-Orchestrator: Research Results
97
+ deactivate ResearchAgent
98
+
99
+ %% Analysis Phase
100
+ Orchestrator->>+AnalysisAgent: Process Data
101
+ activate AnalysisAgent
102
+ AnalysisAgent->>Tools: Apply Models
103
+ Tools-->>AnalysisAgent: Analysis Results
104
+ AnalysisAgent-->>-Orchestrator: Processed Insights
105
+ deactivate AnalysisAgent
106
+
107
+ %% Validation Phase
108
+ Orchestrator->>+ValidationAgent: Verify Results
109
+ activate ValidationAgent
110
+ ValidationAgent->>Tools: Apply Safety Checks
111
+ Tools-->>ValidationAgent: Validation Status
112
+ ValidationAgent-->>-Orchestrator: Verified Results
113
+ deactivate ValidationAgent
114
+
115
+ Orchestrator-->>-Client: Return Validated Output
116
+ ```
117
+
118
+ ## 🏗️ System Architecture
119
+
120
+ Here's how you can structure your LION-powered system. Each component can be customized to your specific needs.
121
+
122
+ ```mermaid
123
+ graph TB
124
+ subgraph Client Layer
125
+ CL[Client Application]
126
+ end
127
+
128
+ subgraph Orchestration Layer
129
+ ORC[Orchestrator]
130
+ SEC[Security Controls]
131
+ MON[Monitoring]
132
+ end
133
+
134
+ subgraph Agent Layer
135
+ subgraph Specialized Agents
136
+ RA[Research Agent]
137
+ AA[Analysis Agent]
138
+ VA[Validation Agent]
139
+ end
140
+
141
+ subgraph Agent Controls
142
+ AC[Access Control]
143
+ AM[Action Monitor]
144
+ VE[Verification]
145
+ end
146
+ end
147
+
148
+ subgraph Resource Layer
149
+ subgraph Tool Management
150
+ TM[Tool Registry]
151
+ TP[Tool Policies]
152
+ end
153
+
154
+ subgraph Data Sources
155
+ DS[Data Access]
156
+ DV[Data Validation]
157
+ end
158
+ end
159
+
160
+ %% Connections
161
+ CL --> ORC
162
+ ORC --> RA & AA & VA
163
+ RA & AA & VA --> AC
164
+ AC --> TM
165
+ TM --> DS
166
+
167
+ %% Control Flow
168
+ ORC --> SEC
169
+ SEC --> MON
170
+ MON --> AM
171
+ AM --> VE
172
+ VE --> TP
173
+ TP --> DV
174
+
175
+ classDef primary fill:#1e40af,stroke:#1e3a8a,color:#fff
176
+ classDef secondary fill:#3b82f6,stroke:#2563eb,color:#fff
177
+ classDef control fill:#7c3aed,stroke:#6d28d9,color:#fff
178
+ ```
179
+
180
+ ## 🛠️ Building Blocks
181
+
182
+ LION provides the essential components you need to build reliable AI workflows:
183
+
184
+ - **Branch**: Core conversation unit with built-in safety mechanisms
185
+ - **iModel**: Standardized interface to AI models
186
+ - **Tools**: Framework for safe tool integration
187
+ - **Exchange**: Reliable message passing between components
188
+
189
+ Each component is designed to be:
190
+ - Fully customizable to your needs
191
+ - Safe by default
192
+ - Easy to integrate
193
+ - Highly reliable
194
+
195
+ ## 🎯 Key Use Cases
196
+
197
+ - **Enterprise Operations**
198
+ - Complex workflow automation
199
+ - Data analysis and processing
200
+ - Decision support systems
201
+
202
+ - **AI Integration**
203
+ - Controlled model deployment
204
+ - Safe tool usage
205
+ - Reliable agent operations
206
+
207
+ - **Development**
208
+ - Rapid prototyping
209
+ - System integration
210
+ - Workflow optimization
211
+
212
+ ## 🔒 Built for Reliability
213
+
214
+ LION isn't just another framework - it's your partner in responsible AI adoption. Build enterprise-grade AI systems with:
215
+
216
+ - Complete control over AI behaviors
217
+ - Comprehensive audit trails
218
+ - Built-in safety mechanisms
219
+ - Minimal dependencies
220
+ - Maximum reliability
221
+
222
+ ## 🤝 Contributing
223
+
224
+ Join our [Discord community](https://discord.gg/aqSJ2v46vu) to:
225
+ - Share ideas
226
+ - Report issues
227
+ - Contribute code
228
+ - Learn from others
229
+
230
+ ## 📚 Citation
231
+
232
+ ```bibtex
233
+ @software{Li_LionAGI_2023,
234
+ author = {Haiyang Li},
235
+ month = {12},
236
+ year = {2023},
237
+ title = {LionAGI: Intelligent Integration Framework},
238
+ url = {https://github.com/lion-agi/lionagi},
239
+ }
240
+ ```
241
+
@@ -0,0 +1,223 @@
1
+ ![PyPI - Version](https://img.shields.io/pypi/v/lionagi?labelColor=233476aa&color=231fc935)
2
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/lionagi?color=blue)
3
+ ![Dependencies](https://img.shields.io/badge/dependencies-4-brightgreen)
4
+ ![Python Version](https://img.shields.io/badge/python-3.10%2B-blue)
5
+
6
+ [Documentation](https://ocean-lion.com/Welcome) | [Discord](https://discord.gg/aqSJ2v46vu) | [PyPI](https://pypi.org/project/lionagi/) | [Roadmap](https://trello.com/b/3seomsrI/lionagi)
7
+
8
+ # LION Framework
9
+ ### Language InterOperable Network - The Future of Controlled AI Operations
10
+
11
+ > Harness the power of next-generation AI while maintaining complete control and reliability.
12
+
13
+ ## Why LION?
14
+
15
+ The AI revolution is transforming how we work - but with great power comes great responsibility. LION provides the control mechanisms and reliability features needed to safely integrate advanced AI capabilities into enterprise workflows.
16
+
17
+ LION is designed to be:
18
+ - 🔒 **Controlled**: Built-in safety mechanisms and verification
19
+ - 🎯 **Precise**: Exact control over AI behaviors
20
+ - 🔧 **Flexible**: Build any workflow you need
21
+ - 🚀 **Efficient**: Minimal dependencies, maximum performance
22
+
23
+ ## Quick Start
24
+
25
+ ```python
26
+ from lionagi import Branch, iModel
27
+
28
+ # Initialize model
29
+ gpt4o = iModel(provider="openai", model="gpt-4o")
30
+
31
+ # Create a branch with personality
32
+ comedian = Branch(
33
+ system="you are a sarcastic dragon hunter",
34
+ imodel=gpt4o
35
+ )
36
+
37
+ # Chat asynchronously
38
+ response = await comedian.chat(
39
+ "tell me a joke on knight vs dragon"
40
+ )
41
+ ```
42
+
43
+ ## Installation
44
+
45
+ LION maintains minimal dependencies for maximum reliability:
46
+
47
+ ```bash
48
+ pip install lionagi
49
+ ```
50
+
51
+ Dependencies:
52
+ - aiocache
53
+ - lion-core
54
+ - python-dotenv
55
+ - IPython
56
+
57
+ ## 🌟 Example Workflow
58
+
59
+ Below is an example of what you can build with LION. Note that these are sample implementations - LION provides the building blocks, you create the workflows that fit your needs.
60
+
61
+ ```mermaid
62
+ sequenceDiagram
63
+ autonumber
64
+ participant Client
65
+ participant Orchestrator
66
+ participant ResearchAgent
67
+ participant AnalysisAgent
68
+ participant ValidationAgent
69
+ participant Tools
70
+
71
+ Client->>+Orchestrator: Submit Complex Task
72
+ Note over Orchestrator: Task Analysis & Planning
73
+
74
+ %% Research Phase
75
+ Orchestrator->>+ResearchAgent: Delegate Research
76
+ activate ResearchAgent
77
+ ResearchAgent->>Tools: Access Data Sources
78
+ Tools-->>ResearchAgent: Raw Data
79
+ ResearchAgent-->>-Orchestrator: Research Results
80
+ deactivate ResearchAgent
81
+
82
+ %% Analysis Phase
83
+ Orchestrator->>+AnalysisAgent: Process Data
84
+ activate AnalysisAgent
85
+ AnalysisAgent->>Tools: Apply Models
86
+ Tools-->>AnalysisAgent: Analysis Results
87
+ AnalysisAgent-->>-Orchestrator: Processed Insights
88
+ deactivate AnalysisAgent
89
+
90
+ %% Validation Phase
91
+ Orchestrator->>+ValidationAgent: Verify Results
92
+ activate ValidationAgent
93
+ ValidationAgent->>Tools: Apply Safety Checks
94
+ Tools-->>ValidationAgent: Validation Status
95
+ ValidationAgent-->>-Orchestrator: Verified Results
96
+ deactivate ValidationAgent
97
+
98
+ Orchestrator-->>-Client: Return Validated Output
99
+ ```
100
+
101
+ ## 🏗️ System Architecture
102
+
103
+ Here's how you can structure your LION-powered system. Each component can be customized to your specific needs.
104
+
105
+ ```mermaid
106
+ graph TB
107
+ subgraph Client Layer
108
+ CL[Client Application]
109
+ end
110
+
111
+ subgraph Orchestration Layer
112
+ ORC[Orchestrator]
113
+ SEC[Security Controls]
114
+ MON[Monitoring]
115
+ end
116
+
117
+ subgraph Agent Layer
118
+ subgraph Specialized Agents
119
+ RA[Research Agent]
120
+ AA[Analysis Agent]
121
+ VA[Validation Agent]
122
+ end
123
+
124
+ subgraph Agent Controls
125
+ AC[Access Control]
126
+ AM[Action Monitor]
127
+ VE[Verification]
128
+ end
129
+ end
130
+
131
+ subgraph Resource Layer
132
+ subgraph Tool Management
133
+ TM[Tool Registry]
134
+ TP[Tool Policies]
135
+ end
136
+
137
+ subgraph Data Sources
138
+ DS[Data Access]
139
+ DV[Data Validation]
140
+ end
141
+ end
142
+
143
+ %% Connections
144
+ CL --> ORC
145
+ ORC --> RA & AA & VA
146
+ RA & AA & VA --> AC
147
+ AC --> TM
148
+ TM --> DS
149
+
150
+ %% Control Flow
151
+ ORC --> SEC
152
+ SEC --> MON
153
+ MON --> AM
154
+ AM --> VE
155
+ VE --> TP
156
+ TP --> DV
157
+
158
+ classDef primary fill:#1e40af,stroke:#1e3a8a,color:#fff
159
+ classDef secondary fill:#3b82f6,stroke:#2563eb,color:#fff
160
+ classDef control fill:#7c3aed,stroke:#6d28d9,color:#fff
161
+ ```
162
+
163
+ ## 🛠️ Building Blocks
164
+
165
+ LION provides the essential components you need to build reliable AI workflows:
166
+
167
+ - **Branch**: Core conversation unit with built-in safety mechanisms
168
+ - **iModel**: Standardized interface to AI models
169
+ - **Tools**: Framework for safe tool integration
170
+ - **Exchange**: Reliable message passing between components
171
+
172
+ Each component is designed to be:
173
+ - Fully customizable to your needs
174
+ - Safe by default
175
+ - Easy to integrate
176
+ - Highly reliable
177
+
178
+ ## 🎯 Key Use Cases
179
+
180
+ - **Enterprise Operations**
181
+ - Complex workflow automation
182
+ - Data analysis and processing
183
+ - Decision support systems
184
+
185
+ - **AI Integration**
186
+ - Controlled model deployment
187
+ - Safe tool usage
188
+ - Reliable agent operations
189
+
190
+ - **Development**
191
+ - Rapid prototyping
192
+ - System integration
193
+ - Workflow optimization
194
+
195
+ ## 🔒 Built for Reliability
196
+
197
+ LION isn't just another framework - it's your partner in responsible AI adoption. Build enterprise-grade AI systems with:
198
+
199
+ - Complete control over AI behaviors
200
+ - Comprehensive audit trails
201
+ - Built-in safety mechanisms
202
+ - Minimal dependencies
203
+ - Maximum reliability
204
+
205
+ ## 🤝 Contributing
206
+
207
+ Join our [Discord community](https://discord.gg/aqSJ2v46vu) to:
208
+ - Share ideas
209
+ - Report issues
210
+ - Contribute code
211
+ - Learn from others
212
+
213
+ ## 📚 Citation
214
+
215
+ ```bibtex
216
+ @software{Li_LionAGI_2023,
217
+ author = {Haiyang Li},
218
+ month = {12},
219
+ year = {2023},
220
+ title = {LionAGI: Intelligent Integration Framework},
221
+ url = {https://github.com/lion-agi/lionagi},
222
+ }
223
+ ```
@@ -0,0 +1,3 @@
1
+ from lionagi.operations.select import select
2
+
3
+ __all__ = ["select"]
@@ -1,4 +1,4 @@
1
- from lionfuncs import choose_most_similar
1
+ from lionfuncs import string_similarity
2
2
 
3
3
  from lionagi.core.rule.base import Rule
4
4
 
@@ -45,4 +45,4 @@ class ChoiceRule(Rule):
45
45
  Returns:
46
46
  str: The most similar value from the set of predefined choices.
47
47
  """
48
- return choose_most_similar(value, self.keys)
48
+ return string_similarity(value, self.keys, choose_most_similar=True)
@@ -0,0 +1,6 @@
1
+ from .brainstorm import brainstorm
2
+ from .rank import rank
3
+ from .score import score
4
+ from .select import select
5
+
6
+ __all__ = ["brainstorm", "rank", "score", "select"]
@@ -0,0 +1,87 @@
1
+ from typing import Any
2
+
3
+ from lion_core.operative.step_model import StepModel
4
+ from lion_core.session.branch import Branch
5
+ from lion_service import iModel
6
+ from pydantic import BaseModel, Field
7
+
8
+ from .config import DEFAULT_CHAT_CONFIG
9
+
10
+
11
+ class BrainstormModel(BaseModel):
12
+
13
+ topic: str = Field(
14
+ default_factory=str,
15
+ description="**Specify the topic or theme for the brainstorming session.**",
16
+ )
17
+ ideas: list[StepModel] = Field(
18
+ default_factory=list,
19
+ description="**Provide a list of ideas needed to accomplish the objective. Each step should be as described in a `PlanStepModel`.**",
20
+ )
21
+
22
+
23
+ PROMPT = "Please follow prompt and provide {num_steps} different ideas for the next step"
24
+
25
+
26
+ async def brainstorm(
27
+ num_steps: int = 3,
28
+ instruction=None,
29
+ guidance=None,
30
+ context=None,
31
+ system=None,
32
+ reason: bool = False,
33
+ actions: bool = False,
34
+ tools: Any = None,
35
+ imodel: iModel = None,
36
+ branch: Branch = None,
37
+ sender=None,
38
+ recipient=None,
39
+ clear_messages: bool = False,
40
+ system_sender=None,
41
+ system_datetime=None,
42
+ return_branch=False,
43
+ num_parse_retries: int = 3,
44
+ retry_imodel: iModel = None,
45
+ branch_user=None,
46
+ **kwargs, # additional operate arguments
47
+ ):
48
+ if branch and branch.imodel:
49
+ imodel = imodel or branch.imodel
50
+ else:
51
+ imodel = imodel or iModel(**DEFAULT_CHAT_CONFIG)
52
+
53
+ prompt = PROMPT.format(num_steps=num_steps)
54
+
55
+ branch = branch or Branch(imodel=imodel)
56
+ if branch_user:
57
+ branch.user = branch_user
58
+
59
+ if system:
60
+ branch.add_message(
61
+ system=system,
62
+ system_datetime=system_datetime,
63
+ sender=system_sender,
64
+ )
65
+ _context = [{"operation": prompt}]
66
+ if context:
67
+ _context.append(context)
68
+
69
+ response = await branch.operate(
70
+ instruction=instruction,
71
+ guidance=guidance,
72
+ context=_context,
73
+ sender=sender,
74
+ recipient=recipient,
75
+ reason=reason,
76
+ actions=actions,
77
+ tools=tools,
78
+ clear_messages=clear_messages,
79
+ operative_model=BrainstormModel,
80
+ retry_imodel=retry_imodel,
81
+ num_parse_retries=num_parse_retries,
82
+ imodel=imodel,
83
+ **kwargs,
84
+ )
85
+ if return_branch:
86
+ return response, branch
87
+ return response
@@ -0,0 +1,6 @@
1
+ DEFAULT_CHAT_CONFIG = {
2
+ "provider": "openai",
3
+ "task": "chat",
4
+ "model": "gpt-4o-mini",
5
+ "api_key": "OPENAI_API_KEY",
6
+ }
@@ -0,0 +1,102 @@
1
+ import asyncio
2
+ from typing import Any
3
+
4
+ import numpy as np
5
+ from lion_core.session.branch import Branch
6
+ from lion_core.session.session import Session
7
+ from lion_service import iModel
8
+ from lionfuncs import alcall, to_list
9
+
10
+ from .config import DEFAULT_CHAT_CONFIG
11
+ from .score import score
12
+
13
+ PROMPT = (
14
+ "Given all items: \n {choices} \n\n Please follow prompt and give score "
15
+ "to the item of interest: \n {item} \n\n"
16
+ )
17
+
18
+
19
+ async def rank(
20
+ choices: list[Any],
21
+ num_scorers: int = 5,
22
+ instruction=None,
23
+ guidance=None,
24
+ context=None,
25
+ system=None,
26
+ reason: bool = False,
27
+ actions: bool = False,
28
+ tools: Any = None,
29
+ imodel: iModel = None,
30
+ branch: Branch = None, # branch won't be used for the vote, it is for configuration
31
+ clear_messages: bool = False,
32
+ system_sender=None,
33
+ system_datetime=None,
34
+ num_parse_retries: int = 0,
35
+ retry_imodel: iModel = None,
36
+ return_session: bool = False,
37
+ **kwargs, # additional kwargs for score function
38
+ ) -> dict:
39
+
40
+ if branch and branch.imodel:
41
+ imodel = imodel or branch.imodel
42
+ else:
43
+ imodel = imodel or iModel(**DEFAULT_CHAT_CONFIG)
44
+
45
+ branch = branch or Branch(imodel=imodel)
46
+ session = Session(default_branch=branch)
47
+
48
+ async def _score(item):
49
+ async with session.branches.async_lock:
50
+ b_ = session.new_branch(messages=session.default_branch.messages)
51
+
52
+ prompt = PROMPT.format(choices=choices, item=item)
53
+ if instruction:
54
+ prompt = f"{instruction}\n\n{prompt} \n\n "
55
+
56
+ kwargs["branch"] = b_
57
+ kwargs["score_range"] = kwargs.get("score_range", (1, 10))
58
+ kwargs["num_scores"] = kwargs.get("num_scores", 1)
59
+ kwargs["precision"] = kwargs.get("precision", 1)
60
+
61
+ response = await score(
62
+ instruction=prompt,
63
+ guidance=guidance,
64
+ context=context,
65
+ system=system,
66
+ system_datetime=system_datetime,
67
+ system_sender=system_sender,
68
+ sender=session.ln_id,
69
+ recipient=b_.ln_id,
70
+ default_score=-1,
71
+ reason=reason,
72
+ actions=actions,
73
+ tools=tools,
74
+ clear_messages=clear_messages,
75
+ num_parse_retries=num_parse_retries,
76
+ retry_imodel=retry_imodel,
77
+ **kwargs,
78
+ )
79
+
80
+ if response.score == -1:
81
+ return None
82
+
83
+ return response
84
+
85
+ async def _group_score(item):
86
+ tasks = [asyncio.create_task(_score(item)) for _ in range(num_scorers)]
87
+ responses = await asyncio.gather(*tasks)
88
+ responses = [i for i in responses if i is not None]
89
+ scores = to_list(
90
+ [i.score for i in responses], dropna=True, flatten=True
91
+ )
92
+ return {
93
+ "item": item,
94
+ "scores": scores,
95
+ "average": np.mean(scores) if scores else -1,
96
+ }
97
+
98
+ results = await alcall(choices, _group_score)
99
+ results = sorted(results, key=lambda x: x["average"], reverse=True)
100
+ if return_session:
101
+ return results, session
102
+ return results