lionagi 0.8.6__tar.gz → 0.8.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. {lionagi-0.8.6 → lionagi-0.8.8}/PKG-INFO +77 -247
  2. lionagi-0.8.8/README.md +148 -0
  3. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/ReAct/ReAct.py +9 -5
  4. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/generic/event.py +10 -0
  5. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/generic/processor.py +10 -2
  6. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/endpoints/base.py +139 -26
  7. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/endpoints/chat_completion.py +10 -4
  8. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/endpoints/rate_limited_processor.py +17 -6
  9. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/imodel.py +65 -11
  10. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/session/branch.py +2 -0
  11. lionagi-0.8.8/lionagi/tools/file/__init__.py +0 -0
  12. {lionagi-0.8.6/lionagi/tools → lionagi-0.8.8/lionagi/tools/file}/reader.py +2 -2
  13. lionagi-0.8.8/lionagi/tools/types.py +3 -0
  14. lionagi-0.8.8/lionagi/version.py +1 -0
  15. {lionagi-0.8.6 → lionagi-0.8.8}/pyproject.toml +3 -2
  16. {lionagi-0.8.6 → lionagi-0.8.8}/uv.lock +57 -76
  17. lionagi-0.8.6/README.md +0 -318
  18. lionagi-0.8.6/lionagi/tools/types.py +0 -3
  19. lionagi-0.8.6/lionagi/version.py +0 -1
  20. {lionagi-0.8.6 → lionagi-0.8.8}/.env.example +0 -0
  21. {lionagi-0.8.6 → lionagi-0.8.8}/.github/FUNDING.yml +0 -0
  22. {lionagi-0.8.6 → lionagi-0.8.8}/.github/dependabot.yml +0 -0
  23. {lionagi-0.8.6 → lionagi-0.8.8}/.github/workflows/ci.yml +0 -0
  24. {lionagi-0.8.6 → lionagi-0.8.8}/.github/workflows/codeql.yml +0 -0
  25. {lionagi-0.8.6 → lionagi-0.8.8}/.github/workflows/docs.yml +0 -0
  26. {lionagi-0.8.6 → lionagi-0.8.8}/.github/workflows/release.yml +0 -0
  27. {lionagi-0.8.6 → lionagi-0.8.8}/.gitignore +0 -0
  28. {lionagi-0.8.6 → lionagi-0.8.8}/.pre-commit-config.yaml +0 -0
  29. {lionagi-0.8.6 → lionagi-0.8.8}/CODE_OF_CONDUCT.md +0 -0
  30. {lionagi-0.8.6 → lionagi-0.8.8}/CONTRIBUTING.md +0 -0
  31. {lionagi-0.8.6 → lionagi-0.8.8}/LICENSE +0 -0
  32. {lionagi-0.8.6 → lionagi-0.8.8}/cookbooks/ch01_get_started.md +0 -0
  33. {lionagi-0.8.6 → lionagi-0.8.8}/cookbooks/ch02_concepts.md +0 -0
  34. {lionagi-0.8.6 → lionagi-0.8.8}/dev_tools/count_code_base_lines.py +0 -0
  35. {lionagi-0.8.6 → lionagi-0.8.8}/docs/Makefile +0 -0
  36. {lionagi-0.8.6 → lionagi-0.8.8}/docs/_static/custom.css +0 -0
  37. {lionagi-0.8.6 → lionagi-0.8.8}/docs/_templates/layout.html +0 -0
  38. {lionagi-0.8.6 → lionagi-0.8.8}/docs/conf.py +0 -0
  39. {lionagi-0.8.6 → lionagi-0.8.8}/docs/index.rst +0 -0
  40. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/action.rst +0 -0
  41. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/adapter.rst +0 -0
  42. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/branch.rst +0 -0
  43. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/branch_operations.rst +0 -0
  44. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/concepts.rst +0 -0
  45. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/element_id.rst +0 -0
  46. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/event.rst +0 -0
  47. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/form.rst +0 -0
  48. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/graph.rst +0 -0
  49. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/index.rst +0 -0
  50. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/instruct.rst +0 -0
  51. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/lib_file.rst +0 -0
  52. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/lib_nested.rst +0 -0
  53. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/lib_package.rst +0 -0
  54. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/lib_schema.rst +0 -0
  55. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/lib_validate.rst +0 -0
  56. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/log.rst +0 -0
  57. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/mail.rst +0 -0
  58. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/message.rst +0 -0
  59. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/models.rst +0 -0
  60. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/operative_step.rst +0 -0
  61. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/pile.rst +0 -0
  62. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/processor.rst +0 -0
  63. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/progression.rst +0 -0
  64. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/service.rst +0 -0
  65. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/session.rst +0 -0
  66. {lionagi-0.8.6 → lionagi-0.8.8}/docs/modules/utils.rst +0 -0
  67. {lionagi-0.8.6 → lionagi-0.8.8}/docs/tutorials/get_started.rst +0 -0
  68. {lionagi-0.8.6 → lionagi-0.8.8}/docs/tutorials/get_started_pt2.rst +0 -0
  69. {lionagi-0.8.6 → lionagi-0.8.8}/docs/tutorials/get_started_pt3.rst +0 -0
  70. {lionagi-0.8.6 → lionagi-0.8.8}/docs/tutorials/index.rst +0 -0
  71. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/__init__.py +0 -0
  72. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/_class_registry.py +0 -0
  73. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/_errors.py +0 -0
  74. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/_types.py +0 -0
  75. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/__init__.py +0 -0
  76. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/file/__init__.py +0 -0
  77. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/file/chunk.py +0 -0
  78. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/file/file_ops.py +0 -0
  79. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/file/params.py +0 -0
  80. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/file/process.py +0 -0
  81. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/file/save.py +0 -0
  82. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/nested/__init__.py +0 -0
  83. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/nested/flatten.py +0 -0
  84. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/nested/nfilter.py +0 -0
  85. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/nested/nget.py +0 -0
  86. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/nested/ninsert.py +0 -0
  87. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/nested/nmerge.py +0 -0
  88. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/nested/npop.py +0 -0
  89. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/nested/nset.py +0 -0
  90. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/nested/unflatten.py +0 -0
  91. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/nested/utils.py +0 -0
  92. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/package/__init__.py +0 -0
  93. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/package/imports.py +0 -0
  94. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/package/management.py +0 -0
  95. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/package/params.py +0 -0
  96. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/package/system.py +0 -0
  97. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/parse.py +0 -0
  98. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/schema/__init__.py +0 -0
  99. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/schema/as_readable.py +0 -0
  100. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/schema/extract_code_block.py +0 -0
  101. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/schema/extract_docstring.py +0 -0
  102. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/schema/function_to_schema.py +0 -0
  103. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/schema/json_schema.py +0 -0
  104. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/token_transform/__init__.py +0 -0
  105. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/token_transform/llmlingua.py +0 -0
  106. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/token_transform/perplexity.py +0 -0
  107. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/token_transform/synthlang.py +0 -0
  108. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/validate/__init__.py +0 -0
  109. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/validate/common_field_validators.py +0 -0
  110. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/validate/fuzzy_match_keys.py +0 -0
  111. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/validate/fuzzy_validate_mapping.py +0 -0
  112. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/validate/string_similarity.py +0 -0
  113. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/libs/validate/validate_boolean.py +0 -0
  114. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/ReAct/__init__.py +0 -0
  115. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/ReAct/utils.py +0 -0
  116. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/__init__.py +0 -0
  117. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/_act/__init__.py +0 -0
  118. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/_act/act.py +0 -0
  119. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/brainstorm/__init__.py +0 -0
  120. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/brainstorm/brainstorm.py +0 -0
  121. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/brainstorm/prompt.py +0 -0
  122. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/chat/__init__.py +0 -0
  123. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/chat/chat.py +0 -0
  124. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/communicate/__init__.py +0 -0
  125. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/communicate/communicate.py +0 -0
  126. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/instruct/__init__.py +0 -0
  127. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/instruct/instruct.py +0 -0
  128. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/interpret/__init__.py +0 -0
  129. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/interpret/interpret.py +0 -0
  130. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/manager.py +0 -0
  131. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/operate/__init__.py +0 -0
  132. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/operate/operate.py +0 -0
  133. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/parse/__init__.py +0 -0
  134. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/parse/parse.py +0 -0
  135. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/plan/__init__.py +0 -0
  136. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/plan/plan.py +0 -0
  137. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/plan/prompt.py +0 -0
  138. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/select/__init__.py +0 -0
  139. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/select/select.py +0 -0
  140. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/select/utils.py +0 -0
  141. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/translate/__init__.py +0 -0
  142. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/translate/translate.py +0 -0
  143. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/types.py +0 -0
  144. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operations/utils.py +0 -0
  145. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/__init__.py +0 -0
  146. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/action/__init__.py +0 -0
  147. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/action/function_calling.py +0 -0
  148. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/action/manager.py +0 -0
  149. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/action/request_response_model.py +0 -0
  150. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/action/tool.py +0 -0
  151. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/action/utils.py +0 -0
  152. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/forms/__init__.py +0 -0
  153. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/forms/base.py +0 -0
  154. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/forms/flow.py +0 -0
  155. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/forms/form.py +0 -0
  156. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/forms/report.py +0 -0
  157. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/instruct/__init__.py +0 -0
  158. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/instruct/base.py +0 -0
  159. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/instruct/instruct.py +0 -0
  160. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/instruct/instruct_collection.py +0 -0
  161. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/instruct/node.py +0 -0
  162. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/instruct/prompts.py +0 -0
  163. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/instruct/reason.py +0 -0
  164. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/manager.py +0 -0
  165. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/models/__init__.py +0 -0
  166. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/models/field_model.py +0 -0
  167. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/models/model_params.py +0 -0
  168. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/models/note.py +0 -0
  169. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/models/operable_model.py +0 -0
  170. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/models/schema_model.py +0 -0
  171. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/operative.py +0 -0
  172. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/step.py +0 -0
  173. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/strategies/__init__.py +0 -0
  174. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/strategies/base.py +0 -0
  175. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/strategies/concurrent.py +0 -0
  176. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/strategies/concurrent_chunk.py +0 -0
  177. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/strategies/concurrent_sequential_chunk.py +0 -0
  178. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/strategies/params.py +0 -0
  179. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/strategies/sequential.py +0 -0
  180. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/strategies/sequential_chunk.py +0 -0
  181. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/strategies/sequential_concurrent_chunk.py +0 -0
  182. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/strategies/utils.py +0 -0
  183. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/operatives/types.py +0 -0
  184. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/__init__.py +0 -0
  185. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/_concepts.py +0 -0
  186. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/adapters/__init__.py +0 -0
  187. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/adapters/adapter.py +0 -0
  188. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/adapters/json_adapter.py +0 -0
  189. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/adapters/pandas_/__init__.py +0 -0
  190. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/adapters/pandas_/csv_adapter.py +0 -0
  191. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/adapters/pandas_/excel_adapter.py +0 -0
  192. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/adapters/pandas_/pd_dataframe_adapter.py +0 -0
  193. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/adapters/pandas_/pd_series_adapter.py +0 -0
  194. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/adapters/types.py +0 -0
  195. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/generic/__init__.py +0 -0
  196. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/generic/element.py +0 -0
  197. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/generic/log.py +0 -0
  198. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/generic/pile.py +0 -0
  199. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/generic/progression.py +0 -0
  200. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/graph/__init__.py +0 -0
  201. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/graph/edge.py +0 -0
  202. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/graph/graph.py +0 -0
  203. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/graph/node.py +0 -0
  204. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/mail/__init__.py +0 -0
  205. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/mail/exchange.py +0 -0
  206. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/mail/mail.py +0 -0
  207. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/mail/mailbox.py +0 -0
  208. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/mail/manager.py +0 -0
  209. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/mail/package.py +0 -0
  210. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/__init__.py +0 -0
  211. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/action_request.py +0 -0
  212. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/action_response.py +0 -0
  213. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/assistant_response.py +0 -0
  214. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/base.py +0 -0
  215. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/instruction.py +0 -0
  216. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/manager.py +0 -0
  217. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/message.py +0 -0
  218. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/system.py +0 -0
  219. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/templates/README.md +0 -0
  220. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/templates/action_request.jinja2 +0 -0
  221. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/templates/action_response.jinja2 +0 -0
  222. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/templates/assistant_response.jinja2 +0 -0
  223. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/templates/instruction_message.jinja2 +0 -0
  224. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/templates/system_message.jinja2 +0 -0
  225. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/messages/templates/tool_schemas.jinja2 +0 -0
  226. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/protocols/types.py +0 -0
  227. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/__init__.py +0 -0
  228. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/endpoints/__init__.py +0 -0
  229. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/endpoints/match_endpoint.py +0 -0
  230. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/endpoints/token_calculator.py +0 -0
  231. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/manager.py +0 -0
  232. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/__init__.py +0 -0
  233. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/anthropic_/__init__.py +0 -0
  234. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/anthropic_/messages.py +0 -0
  235. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/exa_/__init__.py +0 -0
  236. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/exa_/models.py +0 -0
  237. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/exa_/search.py +0 -0
  238. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/exa_/types.py +0 -0
  239. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/groq_/__init__.py +0 -0
  240. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/groq_/chat_completions.py +0 -0
  241. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/openai_/__init__.py +0 -0
  242. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/openai_/chat_completions.py +0 -0
  243. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/openrouter_/__init__.py +0 -0
  244. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/openrouter_/chat_completions.py +0 -0
  245. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/perplexity_/__init__.py +0 -0
  246. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/perplexity_/chat_completions.py +0 -0
  247. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/perplexity_/models.py +0 -0
  248. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/providers/types.py +0 -0
  249. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/service/types.py +0 -0
  250. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/session/__init__.py +0 -0
  251. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/session/session.py +0 -0
  252. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/settings.py +0 -0
  253. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/tools/__init__.py +0 -0
  254. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/tools/base.py +0 -0
  255. {lionagi-0.8.6 → lionagi-0.8.8}/lionagi/utils.py +0 -0
  256. {lionagi-0.8.6 → lionagi-0.8.8}/prompts/doc_style.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lionagi
3
- Version: 0.8.6
3
+ Version: 0.8.8
4
4
  Summary: An Intelligence Operating System.
5
5
  Author-email: HaiyangLi <quantocean.li@gmail.com>
6
6
  License: Apache License
@@ -222,11 +222,11 @@ Requires-Python: >=3.10
222
222
  Requires-Dist: aiocache>=0.12.0
223
223
  Requires-Dist: aiohttp>=3.11.0
224
224
  Requires-Dist: jinja2>=3.1.0
225
- Requires-Dist: litellm>=1.55.3
226
225
  Requires-Dist: pandas>=2.0.0
227
226
  Requires-Dist: pillow>=10.0.0
228
227
  Requires-Dist: pydantic>=2.0.0
229
228
  Requires-Dist: python-dotenv>=1.0.1
229
+ Requires-Dist: tiktoken>=0.8.0
230
230
  Description-Content-Type: text/markdown
231
231
 
232
232
  ![PyPI - Version](https://img.shields.io/pypi/v/lionagi?labelColor=233476aa&color=231fc935)
@@ -235,310 +235,137 @@ Description-Content-Type: text/markdown
235
235
 
236
236
  [Documentation](https://lion-agi.github.io/lionagi/) | [Discord](https://discord.gg/aqSJ2v46vu) | [PyPI](https://pypi.org/project/lionagi/) | [Roadmap](https://trello.com/b/3seomsrI/lionagi)
237
237
 
238
- # LION Framework
239
- ### Language InterOperable Network - The Future of Controlled AI Operations
238
+ # LION - Language InterOperable Network
240
239
 
241
- > Harness the power of next-generation AI while maintaining complete control and reliability.
240
+ ## An Intelligence Operating System
242
241
 
243
- ## Why LION?
242
+ LionAGI is a robust framework for orchestrating multi-step AI operations with precise control. Bring together multiple models, advanced ReAct reasoning, tool integrations, and custom validations in a single coherent pipeline.
244
243
 
245
- 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.
246
-
247
- LION is designed to be:
248
- - 🔒 **Controlled**: Built-in safety mechanisms and verification
249
- - 🎯 **Precise**: Exact control over AI behaviors
250
- - 🔧 **Flexible**: Build any workflow you need
251
- - 🚀 **Efficient**: Minimal dependencies, maximum performance
244
+ ## Why LionAGI?
252
245
 
246
+ - **Structured**: LLM interactions are validated and typed (via Pydantic).
247
+ - **Expandable**: Integrate multiple providers (OpenAI, Anthropic, Perplexity, custom) with minimal friction.
248
+ - **Controlled**: Built-in safety checks, concurrency strategies, and advanced multi-step flows—like ReAct with verbose outputs.
249
+ - **Transparent**: Real-time logging, message introspection, and easy debugging of tool usage.
253
250
 
254
251
 
255
252
  ## Installation
256
253
 
257
- LION maintains minimal dependencies for maximum reliability:
258
-
259
- ```bash
260
- uv pip install lionagi
254
+ ```
255
+ pip install lionagi
261
256
  ```
262
257
 
263
258
  Dependencies:
264
- - litellm
265
- - jinja2
266
- - pandas
267
- - pillow
268
- - python-dotenv
269
-
259
+ • aiocahce
260
+ • aiohttp
261
+ • jinja2
262
+ • pandas
263
+ • pillow
264
+ • pydantic
265
+ • python-dotenv
266
+ • tiktoken
270
267
 
271
268
  ## Quick Start
272
-
273
269
  ```python
274
- from lionagi import iModel, Branch
270
+ from lionagi import Branch, iModel
275
271
 
276
- # Initialize model
277
- gpt4o = iModel(provider="openai", task="chat", model="gpt-4o")
272
+ # Pick a model
273
+ gpt4o = iModel(provider="openai", model="gpt-4o")
278
274
 
275
+ # Create a Branch (conversation context)
279
276
  hunter = Branch(
280
- system="you are a hilarious dragon hunter who responds in 10 words rhymes",
281
- imodel=gpt4o,
277
+ system="you are a hilarious dragon hunter who responds in 10 words rhymes.",
278
+ chat_model=gpt4o,
282
279
  )
283
280
 
284
- # Chat asynchronously
285
- print(await hunter.communicate("I am a dragon"))
281
+ # Communicate asynchronously
282
+ response = await hunter.communicate("I am a dragon")
283
+ print(response)
286
284
  ```
287
285
 
288
286
  ```
289
287
  You claim to be a dragon, oh what a braggin'!
290
288
  ```
289
+ ### Structured Responses
291
290
 
292
- ## 📦 Features
293
-
294
- ### 1. Model Agnostic Structured Output
295
-
296
- LION provides a unified interface for interacting with any AI model, regardless of the underlying architecture. This allows you to easily switch between models without changing your code.
291
+ Use Pydantic to keep outputs structured:
297
292
 
298
293
  ```python
299
294
  from pydantic import BaseModel
300
295
 
301
296
  class Joke(BaseModel):
302
- joke: str
297
+ joke: str
303
298
 
304
- sonnet = iModel(
305
- provider="anthropic",
306
- model="claude-3-5-sonnet-20241022",
307
- max_tokens=100, # max_tokens is required for anthropic models
299
+ res = await hunter.communicate(
300
+ "Tell me a short dragon joke",
301
+ response_format=Joke
308
302
  )
309
-
310
- response = await hunter.communicate(
311
- instruction="I am a dragon",
312
- response_format=Joke, # structured output in given pydantic model
313
- clear_messages=True, # refresh the conversation
314
- imodel=sonnet, # use sonnet model, which doesn't support structured output
315
- )
316
-
317
303
  print(type(response))
318
304
  print(response.joke)
319
305
  ```
320
-
321
306
  ```
322
307
  <class '__main__.Joke'>
323
- Joke(joke='With fiery claws, dragons hide their laughter flaws!')
308
+ With fiery claws, dragons hide their laughter flaws!
324
309
  ```
325
310
 
311
+ ### ReAct and Tools
326
312
 
327
- ### 2. Complete Observability
313
+ LionAGI supports advanced multi-step reasoning with ReAct. Tools let the LLM invoke external actions:
328
314
 
329
315
  ```python
330
- # using perplexity model
331
- pplx_small = iModel(
332
- provider="perplexity",
333
- task="chat/completions",
334
- model="llama-3.1-sonar-small-128k-online",
335
- max_tokens=1000,
336
- )
337
-
338
- b = await hunter.communicate(
339
- instruction="What makes a well-behaved dragon?",
340
- clear_messages=True, # refresh the conversation
341
- imodel=pplx_small, # use perplexity model
316
+ from lionagi.tools.types import ReaderTool
317
+
318
+ branch = Branch(chat_model=gpt4o, tools=ReaderTool)
319
+ result = await branch.ReAct(
320
+ instruct={
321
+ "instruction": "Summarize my PDF and compare with relevant papers.",
322
+ "context": {"paper_file_path": "/path/to/paper.pdf"},
323
+ },
324
+ extension_allowed=True, # allow multi-round expansions
325
+ max_extensions=5,
326
+ verbose=True, # see step-by-step chain-of-thought
342
327
  )
343
-
344
- print(b)
345
- ```
346
-
347
- ```
348
- A well-behaved dragon is one that's calm and bright,
349
- No stress or fear, just a peaceful night.
350
- It's active, not lethargic, with a happy face,
351
- And behaviors like digging, not a frantic pace.
352
- It's social, friendly, and never a fright,
353
- Just a gentle soul, shining with delight
354
- ```
355
-
356
- ```python
357
- hunter.msgs.last_response.model_response
358
- ```
359
-
360
- ```
361
- {'id': '1be10f4c-0936-4050-ab48-91bd86ab11a5',
362
- 'model': 'llama-3.1-sonar-small-128k-online',
363
- 'object': 'chat.completion',
364
- 'created': 1734369700,
365
- 'choices': [{'index': 0,
366
- 'message': {'role': 'assistant',
367
- 'content': "A well-behaved dragon is one that's calm and bright,\nNo stress or fear, just a peaceful night.\nIt's active, not lethargic, with a happy face,\nAnd behaviors like digging, not a frantic pace.\nIt's social, friendly, and never a fright,\nJust a gentle soul, shining with delight"},
368
- 'finish_reason': 'stop',
369
- 'delta': {'role': 'assistant', 'content': ''}}],
370
- 'usage': {'prompt_tokens': 40, 'completion_tokens': 69, 'total_tokens': 109},
371
- 'citations': [{'url': 'https://dragonsdiet.com/blogs/dragon-care/15-bearded-dragon-behaviors-and-what-they-could-mean'},
372
- {'url': 'https://masterbraeokk.tripod.com/dragons/behavior.html'},
373
- {'url': 'https://files.eric.ed.gov/fulltext/ED247607.pdf'},
374
- {'url': 'https://www.travelchinaguide.com/intro/social_customs/zodiac/dragon/five-elements.htm'},
375
- {'url': 'https://www.travelchinaguide.com/intro/social_customs/zodiac/dragon/'}]}
328
+ print(result)
376
329
  ```
377
330
 
331
+ The LLM can now open the PDF, read in slices, fetch references, and produce a final structured summary.
378
332
 
379
- ### 3. Easy composition of complex workflows
380
-
333
+ ### Observability & Debugging
334
+ - Inspect messages:
381
335
  ```python
382
- # chain of thoughts
383
- from pydantic import Field
384
-
385
- class Reason(BaseModel):
386
- reason: str
387
- confidence_score: float
388
-
389
- class Thought(BaseModel):
390
- thought: str
391
-
392
- class Analysis(BaseModel):
393
- thought: list[Thought] = Field(
394
- default_factory=list,
395
- description="concise Chain of thoughts from you, 3 step, each in 8 words"
396
- )
397
- analysis: str = Field(
398
- ...,
399
- description="Final analysis of the dragon's psyche in 20 words",
400
- )
401
- reason: list[Reason] = Field(
402
- default_factory=list,
403
- description="Concise Reasoning behind the analysis, 3 support, each in 8 words"
404
- )
405
-
406
- context1 = "I am a dragon, I think therefore I am, I suffer from shiny objects syndrome"
407
- context2 = "I like food and poetry, I use uv sometimes, it's cool but I am not familiar with pip"
408
-
409
- async def analyze(context) -> Analysis:
410
- psychologist = Branch(
411
- system="you are a renowned dragon psychologist",
412
- imodel=gpt4o,
413
- )
414
- return await psychologist.communicate(
415
- instruction="analyze the dragon's psyche using chain of thoughts",
416
- guidance="think step by step, reason with logic",
417
- context=context,
418
- response_format=Analysis,
419
- )
420
-
336
+ df = branch.to_df()
337
+ print(df.tail())
421
338
  ```
339
+ - Action logs show each tool call, arguments, and outcomes.
340
+ - Verbose ReAct provides chain-of-thought analysis (helpful for debugging multi-step flows).
422
341
 
423
- ```python
424
- result1 = await analyze(context1)
425
-
426
- print("\nThoughts:")
427
- for i in result1.thought:
428
- print(i.thought)
429
-
430
- print("\nAnalysis:")
431
- print(result1.analysis)
432
-
433
- print("\nReasoning:")
434
- for i in result1.reason:
435
- print(i.reason)
436
- ```
437
-
438
- ```
439
-
440
- Thoughts:
441
- Dragons are attracted to shiny objects naturally.
442
- This suggests a strong affinity for hoarding.
443
- Reflects the dragon's inherent desire for possession.
444
-
445
- Analysis:
446
- The dragon demonstrates a compulsive hoarding behavior linked to attraction for shiny objects.
447
-
448
- Reasoning:
449
- Shiny objects trigger instinctual hoarding behavior.
450
- Possession indicates a symbol of power and security.
451
- Hoarding is reinforced by evolutionary survival mechanisms.
452
- ```
342
+ ### Example: Multi-Model Orchestration
453
343
 
454
344
  ```python
455
- result2 = await analyze(context2)
345
+ from lionagi import Branch, iModel
456
346
 
457
- print("\nThoughts:")
458
- for i in result2.thought:
459
- print(i.thought)
460
-
461
- print("\nAnalysis:")
462
- print(result2.analysis)
347
+ gpt4o = iModel(provider="openai", model="gpt-4o")
348
+ sonnet = iModel(
349
+ provider="anthropic",
350
+ model="claude-3-5-sonnet-20241022",
351
+ max_tokens=1000, # max_tokens is required for anthropic models
352
+ )
463
353
 
464
- print("\nReasoning:")
465
- for i in result2.reason:
466
- print(i.reason)
354
+ branch = Branch(chat_model=gpt4o)
355
+ # Switch mid-flow
356
+ analysis = await branch.communicate("Analyze these stats", imodel=sonnet)
467
357
  ```
468
358
 
469
- ```
470
- Thoughts:
471
- Dragon enjoys both food and poetry regularly.
472
- Dragon uses uv light with frequent interest.
473
- Dragon is unfamiliar and not comfortable with pip.
474
-
475
- Analysis:
476
- The dragon is curious and exploratory, yet selectively cautious about unfamiliar methodologies.
477
-
478
- Reasoning:
479
- Preference for food and poetry suggests curiosity.
480
- Frequent uv light use indicates exploratory nature.
481
- Discomfort with pip usage shows selective caution.
482
- ```
359
+ Seamlessly route to different models in the same workflow.
483
360
 
361
+ ## Community & Contributing
484
362
 
363
+ We welcome issues, ideas, and pull requests:
364
+ - Discord: Join to chat or get help
365
+ - Issues / PRs: GitHub
485
366
 
486
- ## 🌟 Example Workflow
487
-
488
- 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.
489
-
490
- ```mermaid
491
- sequenceDiagram
492
- autonumber
493
- participant Client
494
- participant Orchestrator
495
- participant ResearchAgent
496
- participant AnalysisAgent
497
- participant ValidationAgent
498
- participant Tools
499
-
500
- Client->>+Orchestrator: Submit Complex Task
501
- Note over Orchestrator: Task Analysis & Planning
502
-
503
- %% Research Phase
504
- Orchestrator->>+ResearchAgent: Delegate Research
505
- activate ResearchAgent
506
- ResearchAgent->>Tools: Access Data Sources
507
- Tools-->>ResearchAgent: Raw Data
508
- ResearchAgent-->>-Orchestrator: Research Results
509
- deactivate ResearchAgent
510
-
511
- %% Analysis Phase
512
- Orchestrator->>+AnalysisAgent: Process Data
513
- activate AnalysisAgent
514
- AnalysisAgent->>Tools: Apply Models
515
- Tools-->>AnalysisAgent: Analysis Results
516
- AnalysisAgent-->>-Orchestrator: Processed Insights
517
- deactivate AnalysisAgent
518
-
519
- %% Validation Phase
520
- Orchestrator->>+ValidationAgent: Verify Results
521
- activate ValidationAgent
522
- ValidationAgent->>Tools: Apply Safety Checks
523
- Tools-->>ValidationAgent: Validation Status
524
- ValidationAgent-->>-Orchestrator: Verified Results
525
- deactivate ValidationAgent
526
-
527
- Orchestrator-->>-Client: Return Validated Output
367
+ ### Citation
528
368
  ```
529
-
530
-
531
- ## 🤝 Contributing
532
-
533
- Join our [Discord community](https://discord.gg/aqSJ2v46vu) to:
534
- - Share ideas
535
- - Report issues
536
- - Contribute code
537
- - Learn from others
538
-
539
- ## 📚 Citation
540
-
541
- ```bibtex
542
369
  @software{Li_LionAGI_2023,
543
370
  author = {Haiyang Li},
544
371
  month = {12},
@@ -547,3 +374,6 @@ Join our [Discord community](https://discord.gg/aqSJ2v46vu) to:
547
374
  url = {https://github.com/lion-agi/lionagi},
548
375
  }
549
376
  ```
377
+
378
+ **🦁 LionAGI**
379
+ > Because real AI orchestration demands more than a single prompt. Try it out and discover the next evolution in structured, multi-model, safe AI.
@@ -0,0 +1,148 @@
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
+ ![Python Version](https://img.shields.io/badge/python-3.10%2B-blue)
4
+
5
+ [Documentation](https://lion-agi.github.io/lionagi/) | [Discord](https://discord.gg/aqSJ2v46vu) | [PyPI](https://pypi.org/project/lionagi/) | [Roadmap](https://trello.com/b/3seomsrI/lionagi)
6
+
7
+ # LION - Language InterOperable Network
8
+
9
+ ## An Intelligence Operating System
10
+
11
+ LionAGI is a robust framework for orchestrating multi-step AI operations with precise control. Bring together multiple models, advanced ReAct reasoning, tool integrations, and custom validations in a single coherent pipeline.
12
+
13
+ ## Why LionAGI?
14
+
15
+ - **Structured**: LLM interactions are validated and typed (via Pydantic).
16
+ - **Expandable**: Integrate multiple providers (OpenAI, Anthropic, Perplexity, custom) with minimal friction.
17
+ - **Controlled**: Built-in safety checks, concurrency strategies, and advanced multi-step flows—like ReAct with verbose outputs.
18
+ - **Transparent**: Real-time logging, message introspection, and easy debugging of tool usage.
19
+
20
+
21
+ ## Installation
22
+
23
+ ```
24
+ pip install lionagi
25
+ ```
26
+
27
+ Dependencies:
28
+ • aiocahce
29
+ • aiohttp
30
+ • jinja2
31
+ • pandas
32
+ • pillow
33
+ • pydantic
34
+ • python-dotenv
35
+ • tiktoken
36
+
37
+ ## Quick Start
38
+ ```python
39
+ from lionagi import Branch, iModel
40
+
41
+ # Pick a model
42
+ gpt4o = iModel(provider="openai", model="gpt-4o")
43
+
44
+ # Create a Branch (conversation context)
45
+ hunter = Branch(
46
+ system="you are a hilarious dragon hunter who responds in 10 words rhymes.",
47
+ chat_model=gpt4o,
48
+ )
49
+
50
+ # Communicate asynchronously
51
+ response = await hunter.communicate("I am a dragon")
52
+ print(response)
53
+ ```
54
+
55
+ ```
56
+ You claim to be a dragon, oh what a braggin'!
57
+ ```
58
+ ### Structured Responses
59
+
60
+ Use Pydantic to keep outputs structured:
61
+
62
+ ```python
63
+ from pydantic import BaseModel
64
+
65
+ class Joke(BaseModel):
66
+ joke: str
67
+
68
+ res = await hunter.communicate(
69
+ "Tell me a short dragon joke",
70
+ response_format=Joke
71
+ )
72
+ print(type(response))
73
+ print(response.joke)
74
+ ```
75
+ ```
76
+ <class '__main__.Joke'>
77
+ With fiery claws, dragons hide their laughter flaws!
78
+ ```
79
+
80
+ ### ReAct and Tools
81
+
82
+ LionAGI supports advanced multi-step reasoning with ReAct. Tools let the LLM invoke external actions:
83
+
84
+ ```python
85
+ from lionagi.tools.types import ReaderTool
86
+
87
+ branch = Branch(chat_model=gpt4o, tools=ReaderTool)
88
+ result = await branch.ReAct(
89
+ instruct={
90
+ "instruction": "Summarize my PDF and compare with relevant papers.",
91
+ "context": {"paper_file_path": "/path/to/paper.pdf"},
92
+ },
93
+ extension_allowed=True, # allow multi-round expansions
94
+ max_extensions=5,
95
+ verbose=True, # see step-by-step chain-of-thought
96
+ )
97
+ print(result)
98
+ ```
99
+
100
+ The LLM can now open the PDF, read in slices, fetch references, and produce a final structured summary.
101
+
102
+ ### Observability & Debugging
103
+ - Inspect messages:
104
+ ```python
105
+ df = branch.to_df()
106
+ print(df.tail())
107
+ ```
108
+ - Action logs show each tool call, arguments, and outcomes.
109
+ - Verbose ReAct provides chain-of-thought analysis (helpful for debugging multi-step flows).
110
+
111
+ ### Example: Multi-Model Orchestration
112
+
113
+ ```python
114
+ from lionagi import Branch, iModel
115
+
116
+ gpt4o = iModel(provider="openai", model="gpt-4o")
117
+ sonnet = iModel(
118
+ provider="anthropic",
119
+ model="claude-3-5-sonnet-20241022",
120
+ max_tokens=1000, # max_tokens is required for anthropic models
121
+ )
122
+
123
+ branch = Branch(chat_model=gpt4o)
124
+ # Switch mid-flow
125
+ analysis = await branch.communicate("Analyze these stats", imodel=sonnet)
126
+ ```
127
+
128
+ Seamlessly route to different models in the same workflow.
129
+
130
+ ## Community & Contributing
131
+
132
+ We welcome issues, ideas, and pull requests:
133
+ - Discord: Join to chat or get help
134
+ - Issues / PRs: GitHub
135
+
136
+ ### Citation
137
+ ```
138
+ @software{Li_LionAGI_2023,
139
+ author = {Haiyang Li},
140
+ month = {12},
141
+ year = {2023},
142
+ title = {LionAGI: Towards Automated General Intelligence},
143
+ url = {https://github.com/lion-agi/lionagi},
144
+ }
145
+ ```
146
+
147
+ **🦁 LionAGI**
148
+ > Because real AI orchestration demands more than a single prompt. Try it out and discover the next evolution in structured, multi-model, safe AI.
@@ -28,8 +28,8 @@ async def ReAct(
28
28
  tools: Any = None,
29
29
  tool_schemas: Any = None,
30
30
  response_format: type[BaseModel] | BaseModel = None,
31
- extension_allowed: bool = False,
32
- max_extensions: int | None = None,
31
+ extension_allowed: bool = True,
32
+ max_extensions: int | None = 3,
33
33
  response_kwargs: dict | None = None,
34
34
  return_analysis: bool = False,
35
35
  analysis_model: iModel | None = None,
@@ -54,6 +54,8 @@ async def ReAct(
54
54
  sample_writing=interpret_sample,
55
55
  **(interpret_kwargs or {}),
56
56
  )
57
+ if verbose_analysis:
58
+ print(f"Interpreted instruction: {instruction_str}")
57
59
 
58
60
  # Convert Instruct to dict if necessary
59
61
  instruct_dict = (
@@ -92,9 +94,11 @@ async def ReAct(
92
94
  )
93
95
 
94
96
  # Validate and clamp max_extensions if needed
95
- if max_extensions and max_extensions > 5:
96
- logging.warning("max_extensions should not exceed 5; defaulting to 5.")
97
- max_extensions = 5
97
+ if max_extensions and max_extensions > 100:
98
+ logging.warning(
99
+ "max_extensions should not exceed 100; defaulting to 100."
100
+ )
101
+ max_extensions = 100
98
102
 
99
103
  # Step 2: Possibly loop through expansions if extension_needed
100
104
  extensions = max_extensions
@@ -86,6 +86,7 @@ class Event(Element):
86
86
  """
87
87
 
88
88
  execution: Execution = Field(default_factory=Execution)
89
+ streaming: bool = False
89
90
 
90
91
  @field_serializer("execution")
91
92
  def _serialize_execution(self, val: Execution) -> dict:
@@ -160,6 +161,15 @@ class Event(Element):
160
161
  """
161
162
  raise NotImplementedError("Override in subclass.")
162
163
 
164
+ async def stream(self) -> None:
165
+ """Performs the event action asynchronously, streaming results.
166
+
167
+ Raises:
168
+ NotImplementedError: This base method must be overridden by
169
+ subclasses.
170
+ """
171
+ raise NotImplementedError("Override in subclass.")
172
+
163
173
  @classmethod
164
174
  def from_dict(cls, data: dict) -> "Event":
165
175
  """Not implemented. Events cannot be fully recreated once done.
@@ -31,6 +31,7 @@ class Processor(Observer):
31
31
  self,
32
32
  queue_capacity: int,
33
33
  capacity_refresh_time: float,
34
+ concurrency_limit: int,
34
35
  ) -> None:
35
36
  """Initializes a Processor instance.
36
37
 
@@ -56,6 +57,10 @@ class Processor(Observer):
56
57
  self._available_capacity = queue_capacity
57
58
  self._execution_mode = False
58
59
  self._stop_event = asyncio.Event()
60
+ if concurrency_limit:
61
+ self._concurrency_sem = asyncio.Semaphore(concurrency_limit)
62
+ else:
63
+ self._concurrency_sem = None
59
64
 
60
65
  @property
61
66
  def available_capacity(self) -> int:
@@ -144,8 +149,11 @@ class Processor(Observer):
144
149
  next_event = await self.dequeue()
145
150
 
146
151
  if await self.request_permission(**next_event.request):
147
- next_event.status = EventStatus.PROCESSING
148
- task = asyncio.create_task(next_event.invoke())
152
+
153
+ if next_event.streaming:
154
+ task = asyncio.create_task(next_event.stream())
155
+ else:
156
+ task = asyncio.create_task(next_event.invoke())
149
157
  tasks.add(task)
150
158
 
151
159
  prev_event = next_event