lionagi 0.13.2__tar.gz → 0.13.4__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 (273) hide show
  1. {lionagi-0.13.2 → lionagi-0.13.4}/.github/workflows/ci.yml +6 -0
  2. {lionagi-0.13.2 → lionagi-0.13.4}/PKG-INFO +15 -10
  3. {lionagi-0.13.2 → lionagi-0.13.4}/README.md +9 -7
  4. lionagi-0.13.4/cookbooks/using_claude_code.py +44 -0
  5. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/config.py +1 -1
  6. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/fields/action.py +0 -1
  7. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/fields/reason.py +0 -1
  8. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/file/save.py +1 -1
  9. lionagi-0.13.4/lionagi/libs/schema/as_readable.py +342 -0
  10. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/schema/extract_docstring.py +1 -2
  11. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/base.py +0 -2
  12. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/validate/string_similarity.py +1 -2
  13. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/models/hashable_model.py +0 -1
  14. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/models/schema_model.py +0 -1
  15. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/ReAct/utils.py +0 -1
  16. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/__init__.py +2 -0
  17. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/_act/act.py +0 -1
  18. lionagi-0.13.4/lionagi/operations/flow.py +436 -0
  19. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/interpret/interpret.py +1 -4
  20. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/manager.py +0 -1
  21. lionagi-0.13.4/lionagi/operations/node.py +107 -0
  22. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/plan/plan.py +0 -1
  23. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/select/utils.py +0 -2
  24. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/forms/flow.py +3 -1
  25. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/generic/pile.py +1 -2
  26. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/generic/processor.py +0 -1
  27. lionagi-0.13.4/lionagi/protocols/graph/__init__.py +9 -0
  28. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/graph/graph.py +1 -3
  29. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/mail/package.py +0 -1
  30. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/assistant_response.py +0 -2
  31. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/message.py +0 -1
  32. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/endpoint_config.py +6 -0
  33. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/match_endpoint.py +26 -8
  34. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/providers/claude_code_.py +8 -9
  35. lionagi-0.13.4/lionagi/service/connections/providers/claude_code_cli.py +411 -0
  36. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/providers/oai_.py +1 -1
  37. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/manager.py +0 -1
  38. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/rate_limited_processor.py +0 -2
  39. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/token_calculator.py +0 -3
  40. lionagi-0.13.4/lionagi/session/__init__.py +8 -0
  41. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/session/branch.py +0 -2
  42. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/session/session.py +47 -1
  43. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/settings.py +2 -3
  44. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/utils.py +6 -9
  45. lionagi-0.13.4/lionagi/version.py +1 -0
  46. {lionagi-0.13.2 → lionagi-0.13.4}/pyproject.toml +6 -2
  47. {lionagi-0.13.2 → lionagi-0.13.4}/uv.lock +311 -2
  48. lionagi-0.13.2/lionagi/libs/schema/as_readable.py +0 -396
  49. lionagi-0.13.2/lionagi/tools/__init__.py +0 -3
  50. lionagi-0.13.2/lionagi/tools/file/__init__.py +0 -3
  51. lionagi-0.13.2/lionagi/traits/__init__.py +0 -58
  52. lionagi-0.13.2/lionagi/traits/base.py +0 -216
  53. lionagi-0.13.2/lionagi/traits/composer.py +0 -343
  54. lionagi-0.13.2/lionagi/traits/protocols.py +0 -495
  55. lionagi-0.13.2/lionagi/traits/registry.py +0 -1071
  56. lionagi-0.13.2/lionagi/version.py +0 -1
  57. {lionagi-0.13.2 → lionagi-0.13.4}/.coveragerc +0 -0
  58. {lionagi-0.13.2 → lionagi-0.13.4}/.env.example +0 -0
  59. {lionagi-0.13.2 → lionagi-0.13.4}/.github/FUNDING.yml +0 -0
  60. {lionagi-0.13.2 → lionagi-0.13.4}/.github/dependabot.yml +0 -0
  61. {lionagi-0.13.2 → lionagi-0.13.4}/.github/workflows/codeql.yml +0 -0
  62. {lionagi-0.13.2 → lionagi-0.13.4}/.github/workflows/docs.yml +0 -0
  63. {lionagi-0.13.2 → lionagi-0.13.4}/.github/workflows/release.yml +0 -0
  64. {lionagi-0.13.2 → lionagi-0.13.4}/.gitignore +0 -0
  65. {lionagi-0.13.2 → lionagi-0.13.4}/.pre-commit-config.yaml +0 -0
  66. {lionagi-0.13.2 → lionagi-0.13.4}/.python-version +0 -0
  67. {lionagi-0.13.2 → lionagi-0.13.4}/CODE_OF_CONDUCT.md +0 -0
  68. {lionagi-0.13.2 → lionagi-0.13.4}/CONTRIBUTING.md +0 -0
  69. {lionagi-0.13.2 → lionagi-0.13.4}/LICENSE +0 -0
  70. {lionagi-0.13.2 → lionagi-0.13.4}/cookbooks/ch01_get_started.md +0 -0
  71. {lionagi-0.13.2 → lionagi-0.13.4}/cookbooks/ch02_concepts.md +0 -0
  72. {lionagi-0.13.2 → lionagi-0.13.4}/docs/Makefile +0 -0
  73. {lionagi-0.13.2 → lionagi-0.13.4}/docs/_static/custom.css +0 -0
  74. {lionagi-0.13.2 → lionagi-0.13.4}/docs/_templates/layout.html +0 -0
  75. {lionagi-0.13.2 → lionagi-0.13.4}/docs/conf.py +0 -0
  76. {lionagi-0.13.2 → lionagi-0.13.4}/docs/index.rst +0 -0
  77. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/action.rst +0 -0
  78. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/adapter.rst +0 -0
  79. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/branch.rst +0 -0
  80. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/branch_operations.rst +0 -0
  81. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/concepts.rst +0 -0
  82. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/element_id.rst +0 -0
  83. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/event.rst +0 -0
  84. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/form.rst +0 -0
  85. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/graph.rst +0 -0
  86. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/index.rst +0 -0
  87. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/instruct.rst +0 -0
  88. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/lib_file.rst +0 -0
  89. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/lib_nested.rst +0 -0
  90. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/lib_package.rst +0 -0
  91. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/lib_schema.rst +0 -0
  92. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/lib_validate.rst +0 -0
  93. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/log.rst +0 -0
  94. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/mail.rst +0 -0
  95. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/message.rst +0 -0
  96. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/models.rst +0 -0
  97. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/operative_step.rst +0 -0
  98. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/pile.rst +0 -0
  99. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/processor.rst +0 -0
  100. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/progression.rst +0 -0
  101. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/service.rst +0 -0
  102. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/session.rst +0 -0
  103. {lionagi-0.13.2 → lionagi-0.13.4}/docs/modules/utils.rst +0 -0
  104. {lionagi-0.13.2 → lionagi-0.13.4}/docs/tutorials/get_started.rst +0 -0
  105. {lionagi-0.13.2 → lionagi-0.13.4}/docs/tutorials/get_started_pt2.rst +0 -0
  106. {lionagi-0.13.2 → lionagi-0.13.4}/docs/tutorials/get_started_pt3.rst +0 -0
  107. {lionagi-0.13.2 → lionagi-0.13.4}/docs/tutorials/index.rst +0 -0
  108. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/__init__.py +0 -0
  109. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/_class_registry.py +0 -0
  110. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/_errors.py +0 -0
  111. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/_types.py +0 -0
  112. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/fields/__init__.py +0 -0
  113. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/fields/base.py +0 -0
  114. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/fields/code.py +0 -0
  115. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/fields/file.py +0 -0
  116. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/fields/instruct.py +0 -0
  117. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/fields/research.py +0 -0
  118. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/__init__.py +0 -0
  119. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/file/__init__.py +0 -0
  120. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/file/chunk.py +0 -0
  121. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/file/concat.py +0 -0
  122. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/file/concat_files.py +0 -0
  123. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/file/file_ops.py +0 -0
  124. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/file/params.py +0 -0
  125. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/file/process.py +0 -0
  126. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/nested/__init__.py +0 -0
  127. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/nested/flatten.py +0 -0
  128. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/nested/nfilter.py +0 -0
  129. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/nested/nget.py +0 -0
  130. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/nested/ninsert.py +0 -0
  131. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/nested/nmerge.py +0 -0
  132. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/nested/npop.py +0 -0
  133. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/nested/nset.py +0 -0
  134. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/nested/unflatten.py +0 -0
  135. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/nested/utils.py +0 -0
  136. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/package/__init__.py +0 -0
  137. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/package/imports.py +0 -0
  138. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/package/management.py +0 -0
  139. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/package/params.py +0 -0
  140. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/package/system.py +0 -0
  141. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/parse.py +0 -0
  142. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/schema/__init__.py +0 -0
  143. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/schema/extract_code_block.py +0 -0
  144. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/schema/function_to_schema.py +0 -0
  145. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/schema/json_schema.py +0 -0
  146. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/schema/load_pydantic_model_from_schema.py +0 -0
  147. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/__init__.py +0 -0
  148. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/base.py +0 -0
  149. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/llmlingua.py +0 -0
  150. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/perplexity.py +0 -0
  151. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/symbolic_compress_context.py +0 -0
  152. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang.py +0 -0
  153. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/frameworks/abstract_algebra.toml +0 -0
  154. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/frameworks/category_theory.toml +0 -0
  155. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/frameworks/complex_analysis.toml +0 -0
  156. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/frameworks/framework_options.json +0 -0
  157. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/frameworks/group_theory.toml +0 -0
  158. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/frameworks/math_logic.toml +0 -0
  159. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/frameworks/reflective_patterns.toml +0 -0
  160. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/frameworks/set_theory.toml +0 -0
  161. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/frameworks/topology_fundamentals.toml +0 -0
  162. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/mapping/lion_emoji_mapping.toml +0 -0
  163. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/mapping/python_math_mapping.toml +0 -0
  164. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/mapping/rust_chinese_mapping.toml +0 -0
  165. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/resources/utility/base_synthlang_system_prompt.toml +0 -0
  166. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/synthlang_/translate_to_synthlang.py +0 -0
  167. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/token_transform/types.py +0 -0
  168. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/validate/__init__.py +0 -0
  169. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/validate/common_field_validators.py +0 -0
  170. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/validate/fuzzy_match_keys.py +0 -0
  171. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/validate/fuzzy_validate_mapping.py +0 -0
  172. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/libs/validate/validate_boolean.py +0 -0
  173. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/models/__init__.py +0 -0
  174. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/models/field_model.py +0 -0
  175. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/models/model_params.py +0 -0
  176. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/models/note.py +0 -0
  177. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/models/operable_model.py +0 -0
  178. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/ReAct/ReAct.py +0 -0
  179. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/ReAct/__init__.py +0 -0
  180. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/_act/__init__.py +0 -0
  181. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/brainstorm/__init__.py +0 -0
  182. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/brainstorm/brainstorm.py +0 -0
  183. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/brainstorm/prompt.py +0 -0
  184. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/chat/__init__.py +0 -0
  185. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/chat/chat.py +0 -0
  186. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/communicate/__init__.py +0 -0
  187. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/communicate/communicate.py +0 -0
  188. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/instruct/__init__.py +0 -0
  189. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/instruct/instruct.py +0 -0
  190. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/interpret/__init__.py +0 -0
  191. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/operate/__init__.py +0 -0
  192. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/operate/operate.py +0 -0
  193. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/parse/__init__.py +0 -0
  194. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/parse/parse.py +0 -0
  195. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/plan/__init__.py +0 -0
  196. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/plan/prompt.py +0 -0
  197. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/select/__init__.py +0 -0
  198. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/select/select.py +0 -0
  199. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/translate/__init__.py +0 -0
  200. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/translate/translate.py +0 -0
  201. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/types.py +0 -0
  202. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/operations/utils.py +0 -0
  203. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/__init__.py +0 -0
  204. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/_concepts.py +0 -0
  205. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/action/__init__.py +0 -0
  206. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/action/function_calling.py +0 -0
  207. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/action/manager.py +0 -0
  208. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/action/tool.py +0 -0
  209. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/forms/__init__.py +0 -0
  210. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/forms/base.py +0 -0
  211. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/forms/form.py +0 -0
  212. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/forms/report.py +0 -0
  213. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/generic/__init__.py +0 -0
  214. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/generic/element.py +0 -0
  215. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/generic/event.py +0 -0
  216. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/generic/log.py +0 -0
  217. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/generic/progression.py +0 -0
  218. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/graph/edge.py +0 -0
  219. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/graph/node.py +0 -0
  220. {lionagi-0.13.2/lionagi/protocols/graph → lionagi-0.13.4/lionagi/protocols/mail}/__init__.py +0 -0
  221. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/mail/exchange.py +0 -0
  222. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/mail/mail.py +0 -0
  223. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/mail/mailbox.py +0 -0
  224. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/mail/manager.py +0 -0
  225. {lionagi-0.13.2/lionagi/protocols/mail → lionagi-0.13.4/lionagi/protocols/messages}/__init__.py +0 -0
  226. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/action_request.py +0 -0
  227. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/action_response.py +0 -0
  228. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/base.py +0 -0
  229. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/instruction.py +0 -0
  230. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/manager.py +0 -0
  231. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/system.py +0 -0
  232. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/templates/README.md +0 -0
  233. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/templates/action_request.jinja2 +0 -0
  234. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/templates/action_response.jinja2 +0 -0
  235. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/templates/assistant_response.jinja2 +0 -0
  236. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/templates/instruction_message.jinja2 +0 -0
  237. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/templates/system_message.jinja2 +0 -0
  238. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/messages/templates/tool_schemas.jinja2 +0 -0
  239. {lionagi-0.13.2/lionagi/protocols/messages → lionagi-0.13.4/lionagi/protocols/operatives}/__init__.py +0 -0
  240. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/operatives/operative.py +0 -0
  241. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/operatives/step.py +0 -0
  242. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/protocols/types.py +0 -0
  243. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/py.typed +0 -0
  244. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/__init__.py +0 -0
  245. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/__init__.py +0 -0
  246. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/api_calling.py +0 -0
  247. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/endpoint.py +0 -0
  248. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/header_factory.py +0 -0
  249. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/providers/__init__.py +0 -0
  250. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/providers/anthropic_.py +0 -0
  251. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/providers/exa_.py +0 -0
  252. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/providers/ollama_.py +0 -0
  253. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/connections/providers/perplexity_.py +0 -0
  254. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/imodel.py +0 -0
  255. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/resilience.py +0 -0
  256. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/third_party/README.md +0 -0
  257. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/third_party/__init__.py +0 -0
  258. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/third_party/anthropic_models.py +0 -0
  259. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/third_party/exa_models.py +0 -0
  260. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/third_party/openai_models.py +0 -0
  261. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/third_party/pplx_models.py +0 -0
  262. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/service/types.py +0 -0
  263. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/session/prompts.py +0 -0
  264. {lionagi-0.13.2/lionagi/protocols/operatives → lionagi-0.13.4/lionagi/tools}/__init__.py +0 -0
  265. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/tools/base.py +0 -0
  266. {lionagi-0.13.2/lionagi/session → lionagi-0.13.4/lionagi/tools/file}/__init__.py +0 -0
  267. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/tools/file/reader.py +0 -0
  268. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/tools/memory/tools.py +0 -0
  269. {lionagi-0.13.2 → lionagi-0.13.4}/lionagi/tools/types.py +0 -0
  270. {lionagi-0.13.2 → lionagi-0.13.4}/main.py +0 -0
  271. {lionagi-0.13.2 → lionagi-0.13.4}/scripts/README.md +0 -0
  272. {lionagi-0.13.2 → lionagi-0.13.4}/scripts/concat.py +0 -0
  273. {lionagi-0.13.2 → lionagi-0.13.4}/scripts/config.py +0 -0
@@ -6,6 +6,9 @@ on:
6
6
  pull_request:
7
7
  branches: [ main, develop ]
8
8
 
9
+ permissions:
10
+ contents: read
11
+
9
12
  jobs:
10
13
  test:
11
14
  runs-on: ubuntu-latest
@@ -52,6 +55,9 @@ jobs:
52
55
  needs: test
53
56
  runs-on: ubuntu-latest
54
57
  if: github.event_name == 'push' && github.ref == 'refs/heads/main'
58
+ permissions:
59
+ contents: read
60
+ packages: write
55
61
  steps:
56
62
  - uses: actions/checkout@v4
57
63
  - name: Set up Python
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lionagi
3
- Version: 0.13.2
3
+ Version: 0.13.4
4
4
  Summary: An Intelligence Operating System.
5
5
  Author-email: HaiyangLi <quantocean.li@gmail.com>, Liangbingyan Luo <llby_luo@outlook.com>
6
6
  License: Apache License
@@ -221,8 +221,11 @@ Classifier: Programming Language :: Python :: 3.13
221
221
  Requires-Python: >=3.10
222
222
  Requires-Dist: aiocache>=0.12.0
223
223
  Requires-Dist: aiohttp>=3.12.0
224
+ Requires-Dist: anyio>=4.8.0
224
225
  Requires-Dist: backoff>=2.2.1
225
226
  Requires-Dist: jinja2>=3.1.0
227
+ Requires-Dist: json-repair>=0.47.8
228
+ Requires-Dist: matplotlib>=3.9.0
226
229
  Requires-Dist: pillow>=11.0.0
227
230
  Requires-Dist: psutil>=7.0.0
228
231
  Requires-Dist: pydantic-settings>=2.8.0
@@ -234,7 +237,7 @@ Provides-Extra: all
234
237
  Requires-Dist: claude-code-sdk>=0.0.14; extra == 'all'
235
238
  Requires-Dist: docling>=2.15.1; extra == 'all'
236
239
  Requires-Dist: fastmcp>=2.10.5; extra == 'all'
237
- Requires-Dist: ollama>=0.5.0; extra == 'all'
240
+ Requires-Dist: ollama>=0.4.0; extra == 'all'
238
241
  Requires-Dist: rich>=13.0.0; extra == 'all'
239
242
  Provides-Extra: claude-code
240
243
  Requires-Dist: claude-code-sdk>=0.0.14; extra == 'claude-code'
@@ -249,7 +252,7 @@ Requires-Dist: pre-commit>=4.0.1; extra == 'lint'
249
252
  Provides-Extra: mcp
250
253
  Requires-Dist: fastmcp>=2.10.5; extra == 'mcp'
251
254
  Provides-Extra: ollama
252
- Requires-Dist: ollama>=0.5.0; extra == 'ollama'
255
+ Requires-Dist: ollama>=0.4.0; extra == 'ollama'
253
256
  Provides-Extra: reader
254
257
  Requires-Dist: docling>=2.15.1; extra == 'reader'
255
258
  Provides-Extra: rich
@@ -271,7 +274,7 @@ Description-Content-Type: text/markdown
271
274
 
272
275
  # LION - Language InterOperable Network
273
276
 
274
- ## An Intelligence Operating System SDK
277
+ ## An Agentic Intelligence SDK
275
278
 
276
279
  LionAGI is a robust framework for orchestrating multi-step AI operations with
277
280
  precise control. Bring together multiple models, advanced ReAct reasoning, tool
@@ -407,19 +410,21 @@ LionAGI now supports Anthropic's [Claude Code SDK](https://github.com/anthropics
407
410
  from lionagi import iModel, Branch
408
411
 
409
412
  # Create a Claude Code model
410
- coder = iModel(
413
+ model = iModel(
411
414
  provider="claude_code",
412
- endpoint="code",
413
- model="claude-sonnet-4-20250514",
415
+ endpoint="query_cli",
416
+ model="sonnet",
414
417
  allowed_tools=["Write", "Read", "Edit"], # Control which tools Claude can use
418
+ permission_mode = "bypassPermissions", # Bypass tool permission checks (use with caution!),
419
+ verbose_output=True, # Enable detailed output for debugging
415
420
  )
416
421
 
417
422
  # Start a coding session
418
- branch = Branch(chat_model=coder)
419
- response = await branch.chat("Create a Python function to calculate fibonacci numbers")
423
+ branch = Branch(chat_model=model)
424
+ response = await branch.communicate("Explain the architecture of protocols, operations, and branch")
420
425
 
421
426
  # Claude Code maintains session context automatically
422
- response2 = await branch.chat("Now optimize it for performance")
427
+ response2 = await branch.communicate("how do these parts form lionagi system")
423
428
  ```
424
429
 
425
430
  Key features:
@@ -8,7 +8,7 @@
8
8
 
9
9
  # LION - Language InterOperable Network
10
10
 
11
- ## An Intelligence Operating System SDK
11
+ ## An Agentic Intelligence SDK
12
12
 
13
13
  LionAGI is a robust framework for orchestrating multi-step AI operations with
14
14
  precise control. Bring together multiple models, advanced ReAct reasoning, tool
@@ -144,19 +144,21 @@ LionAGI now supports Anthropic's [Claude Code SDK](https://github.com/anthropics
144
144
  from lionagi import iModel, Branch
145
145
 
146
146
  # Create a Claude Code model
147
- coder = iModel(
147
+ model = iModel(
148
148
  provider="claude_code",
149
- endpoint="code",
150
- model="claude-sonnet-4-20250514",
149
+ endpoint="query_cli",
150
+ model="sonnet",
151
151
  allowed_tools=["Write", "Read", "Edit"], # Control which tools Claude can use
152
+ permission_mode = "bypassPermissions", # Bypass tool permission checks (use with caution!),
153
+ verbose_output=True, # Enable detailed output for debugging
152
154
  )
153
155
 
154
156
  # Start a coding session
155
- branch = Branch(chat_model=coder)
156
- response = await branch.chat("Create a Python function to calculate fibonacci numbers")
157
+ branch = Branch(chat_model=model)
158
+ response = await branch.communicate("Explain the architecture of protocols, operations, and branch")
157
159
 
158
160
  # Claude Code maintains session context automatically
159
- response2 = await branch.chat("Now optimize it for performance")
161
+ response2 = await branch.communicate("how do these parts form lionagi system")
160
162
  ```
161
163
 
162
164
  Key features:
@@ -0,0 +1,44 @@
1
+ from lionagi import Branch, iModel
2
+
3
+ BASE_CONFIG = {
4
+ "provider": "claude_code",
5
+ "endpoint": "query_cli",
6
+ "model": "sonnet",
7
+ "api_key": "dummy_api_key",
8
+ "allowed_tools": ["Read"],
9
+ "permission_mode": "bypassPermissions",
10
+ "verbose_output": True,
11
+ "cli_display_theme": "dark",
12
+ }
13
+
14
+ prompt = """
15
+ Read into lionagi, explain to me the
16
+ 1. architecture of protocols and operations
17
+ 2. how branch, and session work together
18
+ 3. how do these parts form lionagi system
19
+ """
20
+
21
+
22
+ async def main():
23
+ try:
24
+ k_model = iModel(cwd="lionagi", **BASE_CONFIG)
25
+ investigator = Branch(
26
+ name="lionagi_investigator",
27
+ chat_model=k_model,
28
+ parse_model=k_model,
29
+ )
30
+
31
+ print(f"User:\n{prompt}\n")
32
+ response = await investigator.communicate(prompt)
33
+
34
+ except Exception as e:
35
+ print(f"Error: {e}")
36
+ import traceback
37
+
38
+ traceback.print_exc()
39
+
40
+
41
+ if __name__ == "__main__":
42
+ import anyio
43
+
44
+ anyio.run(main)
@@ -68,7 +68,7 @@ class AppSettings(BaseSettings, frozen=True):
68
68
  LIONAGI_EMBEDDING_MODEL: str = "text-embedding-3-small"
69
69
 
70
70
  LIONAGI_CHAT_PROVIDER: str = "openai"
71
- LIONAGI_CHAT_MODEL: str = "gpt-4o"
71
+ LIONAGI_CHAT_MODEL: str = "gpt-4.1-nano"
72
72
 
73
73
  # default storage
74
74
  LIONAGI_AUTO_STORE_EVENT: bool = False
@@ -21,7 +21,6 @@ __all__ = (
21
21
 
22
22
 
23
23
  def parse_action_request(content: str | dict) -> list[dict]:
24
-
25
24
  json_blocks = []
26
25
 
27
26
  if isinstance(content, BaseModel):
@@ -11,7 +11,6 @@ __all__ = ("Reason",)
11
11
 
12
12
 
13
13
  class Reason(HashableModel):
14
-
15
14
  title: str | None = None
16
15
  content: str | None = None
17
16
  confidence_score: float | None = Field(
@@ -82,7 +82,7 @@ def save_chunks(
82
82
  for i, chunk in enumerate(chunks):
83
83
  file_path = create_path(
84
84
  directory=output_path,
85
- filename=f"chunk_{i+1}",
85
+ filename=f"chunk_{i + 1}",
86
86
  extension="json",
87
87
  timestamp=timestamp,
88
88
  random_hash_digits=random_hash_digits,
@@ -0,0 +1,342 @@
1
+ # Copyright (c) 2023 - 2025, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ import json
6
+ import sys
7
+ from typing import Any
8
+
9
+ from lionagi.utils import to_dict
10
+
11
+ # Try to import rich for enhanced console output
12
+ try:
13
+ from rich.align import Align
14
+ from rich.box import MINIMAL, ROUNDED
15
+ from rich.console import Console
16
+ from rich.markdown import Markdown
17
+ from rich.padding import Padding
18
+ from rich.panel import Panel
19
+ from rich.style import Style
20
+ from rich.syntax import Syntax
21
+ from rich.text import Text
22
+ from rich.theme import Theme
23
+
24
+ DARK_THEME = Theme(
25
+ {
26
+ "info": "bright_cyan",
27
+ "warning": "bright_yellow",
28
+ "error": "bold bright_red",
29
+ "success": "bold bright_green",
30
+ "panel.border": "bright_blue",
31
+ "panel.title": "bold bright_cyan",
32
+ "markdown.h1": "bold bright_magenta",
33
+ "markdown.h2": "bold bright_blue",
34
+ "markdown.h3": "bold bright_cyan",
35
+ "markdown.h4": "bold bright_green",
36
+ "markdown.code": "bright_yellow on grey23",
37
+ "markdown.code_block": "bright_white on grey15",
38
+ "markdown.paragraph": "bright_white",
39
+ "markdown.text": "bright_white",
40
+ "markdown.emph": "italic bright_yellow",
41
+ "markdown.strong": "bold bright_white",
42
+ "markdown.item": "bright_cyan",
43
+ "markdown.item.bullet": "bright_blue",
44
+ "json.key": "bright_cyan",
45
+ "json.string": "bright_green",
46
+ "json.number": "bright_yellow",
47
+ "json.boolean": "bright_magenta",
48
+ "json.null": "bright_red",
49
+ "yaml.key": "bright_cyan",
50
+ "yaml.string": "bright_green",
51
+ "yaml.number": "bright_yellow",
52
+ "yaml.boolean": "bright_magenta",
53
+ }
54
+ )
55
+
56
+ LIGHT_THEME = Theme(
57
+ {
58
+ "info": "blue",
59
+ "warning": "dark_orange",
60
+ "error": "bold red",
61
+ "success": "bold green4",
62
+ "panel.border": "blue",
63
+ "panel.title": "bold blue",
64
+ "markdown.h1": "bold dark_magenta",
65
+ "markdown.h2": "bold dark_blue",
66
+ "markdown.h3": "bold dark_cyan",
67
+ "markdown.h4": "bold dark_green",
68
+ "markdown.code": "dark_orange on grey93",
69
+ "markdown.code_block": "black on grey82",
70
+ "markdown.paragraph": "black",
71
+ "markdown.text": "black",
72
+ "markdown.emph": "italic dark_orange",
73
+ "markdown.strong": "bold black",
74
+ "markdown.item": "dark_blue",
75
+ "markdown.item.bullet": "blue",
76
+ "json.key": "dark_blue",
77
+ "json.string": "dark_green",
78
+ "json.number": "dark_orange",
79
+ "json.boolean": "dark_magenta",
80
+ "json.null": "dark_red",
81
+ "yaml.key": "dark_blue",
82
+ "yaml.string": "dark_green",
83
+ "yaml.number": "dark_orange",
84
+ "yaml.boolean": "dark_magenta",
85
+ }
86
+ )
87
+ RICH_AVAILABLE = True
88
+ except ImportError:
89
+ RICH_AVAILABLE = False
90
+ DARK_THEME = None
91
+ LIGHT_THEME = None
92
+
93
+
94
+ def in_notebook() -> bool:
95
+ """
96
+ Checks if we're running inside a Jupyter notebook.
97
+ Returns True if yes, False otherwise.
98
+ """
99
+ try:
100
+ from IPython import get_ipython
101
+
102
+ shell = get_ipython().__class__.__name__
103
+ return "ZMQInteractiveShell" in shell
104
+ except Exception:
105
+ return False
106
+
107
+
108
+ def in_console() -> bool:
109
+ """
110
+ Checks if we're running in a console/terminal environment.
111
+ Returns True if stdout is a TTY and not in a notebook.
112
+ """
113
+ return (
114
+ hasattr(sys.stdout, "isatty")
115
+ and sys.stdout.isatty()
116
+ and not in_notebook()
117
+ )
118
+
119
+
120
+ def format_dict(data: Any, indent: int = 0) -> str:
121
+ """
122
+ Recursively format Python data (dicts, lists, strings, etc.) into a
123
+ YAML-like readable string.
124
+
125
+ - Multi-line strings are displayed using a '|' block style, each line indented.
126
+ - Lists are shown with a '- ' prefix per item at the appropriate indentation.
127
+ - Dict keys are shown as "key:" lines, with values on subsequent lines if complex.
128
+ """
129
+ lines = []
130
+ prefix = " " * indent # 2 spaces per indent level
131
+
132
+ if isinstance(data, dict):
133
+ for key, value in data.items():
134
+ if isinstance(value, dict):
135
+ # Nested dict
136
+ lines.append(f"{prefix}{key}:")
137
+ lines.append(format_dict(value, indent + 1))
138
+ elif isinstance(value, list):
139
+ # List under a key
140
+ lines.append(f"{prefix}{key}:")
141
+ for item in value:
142
+ item_str = format_dict(item, indent + 2).lstrip()
143
+ lines.append(f"{prefix} - {item_str}")
144
+ elif isinstance(value, str) and "\n" in value:
145
+ # Multi-line string
146
+ lines.append(f"{prefix}{key}: |")
147
+ subprefix = " " * (indent + 1)
148
+ for line in value.splitlines():
149
+ lines.append(f"{subprefix}{line}")
150
+ else:
151
+ # Simple single-line scalar
152
+ item_str = format_dict(value, indent + 1).lstrip()
153
+ lines.append(f"{prefix}{key}: {item_str}")
154
+ return "\n".join(lines)
155
+
156
+ elif isinstance(data, list):
157
+ # For top-level or nested lists
158
+ for item in data:
159
+ item_str = format_dict(item, indent + 1).lstrip()
160
+ lines.append(f"{prefix}- {item_str}")
161
+ return "\n".join(lines)
162
+
163
+ # Base case: single-line scalar
164
+ return prefix + str(data)
165
+
166
+
167
+ def as_readable(
168
+ input_: Any,
169
+ /,
170
+ *,
171
+ md: bool = False,
172
+ format_curly: bool = False,
173
+ display_str: bool = False,
174
+ max_chars: int | None = None,
175
+ use_rich: bool = True,
176
+ theme: str = "dark",
177
+ max_panel_width: int = 140,
178
+ panel: bool = True,
179
+ border: bool = True,
180
+ ) -> str:
181
+ """
182
+ Convert `input_` into a human-readable string. If `format_curly=True`, uses
183
+ a YAML-like style (`format_dict`). Otherwise, pretty-printed JSON.
184
+
185
+ - For Pydantic models or nested data, uses `to_dict` to get a dictionary.
186
+ - If the result is a list of items, each is processed and concatenated.
187
+ - When in console and rich is available, provides syntax highlighting.
188
+
189
+ Args:
190
+ input_: The data to convert (could be a single item or list).
191
+ md: If True, wraps the final output in code fences for Markdown display.
192
+ format_curly: If True, use `format_dict`. Otherwise, produce JSON text.
193
+ display_str: If True, prints the output instead of returning it.
194
+ max_chars: If set, truncates output to this many characters.
195
+ use_rich: If True and rich is available, uses rich for console output.
196
+ theme: Color theme - "dark" (default) or "light". Dark uses GitHub Dark Dimmed,
197
+ light uses Solarized Light inspired colors.
198
+ max_panel_width: Maximum width for panels and code blocks in characters.
199
+ panel: If True, wraps the output in a panel for better visibility.
200
+
201
+ Returns:
202
+ A formatted string representation of `input_` (unless display_str=True).
203
+ """
204
+
205
+ # 1) Convert the input to a Python dict/list structure
206
+ # (handles recursion, Pydantic models, etc.)
207
+ def to_dict_safe(obj: Any) -> Any:
208
+ # Attempt to call to_dict with typical recursion flags
209
+ to_dict_kwargs = {
210
+ "use_model_dump": True,
211
+ "fuzzy_parse": True,
212
+ "recursive": True,
213
+ "recursive_python_only": False,
214
+ "max_recursive_depth": 5,
215
+ }
216
+ return to_dict(obj, **to_dict_kwargs)
217
+
218
+ def _inner(i_: Any) -> Any:
219
+ items = []
220
+ try:
221
+ if isinstance(i_, list):
222
+ # Already a list. Convert each item
223
+ items = [to_dict_safe(x) for x in i_]
224
+ else:
225
+ # Single item
226
+ maybe_list = to_dict_safe(i_)
227
+ # If it's a list, store as items; else just single
228
+ items = (
229
+ maybe_list
230
+ if isinstance(maybe_list, list)
231
+ else [maybe_list]
232
+ )
233
+ except Exception:
234
+ # If conversion fails, fallback to str
235
+ return str(i_)
236
+
237
+ # 2) For each item in `items`, either format with YAML-like or JSON
238
+ rendered = []
239
+ for item in items:
240
+ if format_curly:
241
+ # YAML-like
242
+ rendered.append(format_dict(item))
243
+ else:
244
+ # JSON approach
245
+ try:
246
+ # Provide indentation, ensure ASCII not forced
247
+ rendered.append(
248
+ json.dumps(item, indent=2, ensure_ascii=False)
249
+ )
250
+ except Exception:
251
+ # fallback
252
+ rendered.append(str(item))
253
+
254
+ # 3) Combine
255
+ final_str = "\n\n".join(rendered).strip()
256
+
257
+ # 4) If Markdown requested, wrap with code fences
258
+ if md:
259
+ if format_curly:
260
+ return f"```yaml\n{final_str}\n```"
261
+ else:
262
+ return f"```json\n{final_str}\n```"
263
+
264
+ return final_str
265
+
266
+ str_ = _inner(input_).strip()
267
+ if max_chars is not None and len(str_) > max_chars:
268
+ trunc = str_[:max_chars] + "...\n\n[Truncated output]"
269
+ str_ = trunc + ("\n```" if str_.endswith("\n```") else "")
270
+
271
+ # -------------------- PRINT / DISPLAY LOGIC ---------------------------
272
+ if not display_str:
273
+ return str_ # caller will handle printing
274
+
275
+ # (1) IPython notebook --------------------------------------------------
276
+ if md and in_notebook():
277
+ from IPython.display import Markdown, display
278
+
279
+ display(Markdown(str_))
280
+ return
281
+
282
+ # (2) Rich console ------------------------------------------------------
283
+ if RICH_AVAILABLE and in_console() and use_rich:
284
+ console_theme = DARK_THEME if theme == "dark" else LIGHT_THEME
285
+ syntax_theme = "github-dark" if theme == "dark" else "solarized-light"
286
+ console = Console(theme=console_theme)
287
+
288
+ # determine prose / fenced code
289
+ is_fenced_code = (
290
+ md and str_.startswith("```") and str_.rstrip().endswith("```")
291
+ )
292
+ is_prose_md = md and not is_fenced_code
293
+ panel_width = min(console.width - 4, max_panel_width)
294
+
295
+ def _out(rich_obj):
296
+ if not panel:
297
+ console.print(Padding(rich_obj, (0, 0, 0, 2)))
298
+ return
299
+
300
+ console.print(
301
+ Padding(
302
+ Panel(
303
+ Align.left(rich_obj, pad=False),
304
+ border_style="panel.border" if border else "",
305
+ box=ROUNDED if border else MINIMAL,
306
+ width=panel_width,
307
+ expand=False,
308
+ ),
309
+ (0, 0, 0, 4),
310
+ )
311
+ )
312
+
313
+ # 2‑a prose markdown ------------------------------------------------
314
+ if is_prose_md:
315
+ from rich.markdown import Markdown as RichMarkdown
316
+
317
+ _out(RichMarkdown(str_, code_theme=syntax_theme))
318
+ return
319
+
320
+ # 2‑b code (fenced or explicit) -------------------------------------
321
+ if is_fenced_code:
322
+ lines = str_.splitlines()
323
+ lang, code = (
324
+ (lines[0][3:].strip() or ("yaml" if format_curly else "json")),
325
+ "\n".join(lines[1:-1]),
326
+ )
327
+ else:
328
+ lang, code = ("yaml" if format_curly else "json"), str_
329
+
330
+ syntax = Syntax(
331
+ code,
332
+ lang,
333
+ theme=syntax_theme,
334
+ line_numbers=False,
335
+ word_wrap=True,
336
+ background_color="default",
337
+ )
338
+ _out(syntax)
339
+ return
340
+
341
+ # (3) Plain fallback ----------------------------------------------------
342
+ print(str_)
@@ -52,8 +52,7 @@ def extract_docstring(
52
52
  )
53
53
  else:
54
54
  raise ValueError(
55
- f'{style} is not supported. Please choose either "google" or'
56
- ' "reST".'
55
+ f'{style} is not supported. Please choose either "google" or "reST".'
57
56
  )
58
57
  return func_description, params_description
59
58
 
@@ -21,7 +21,6 @@ __all__ = (
21
21
 
22
22
 
23
23
  class SynthlangFramework(Resource):
24
-
25
24
  category: ResourceCategory = Field(
26
25
  default=ResourceCategory.FRAMEWORK, frozen=True
27
26
  )
@@ -72,7 +71,6 @@ class SynthlangFramework(Resource):
72
71
  framework_options: list[FRAMEWORK_CHOICES] = None,
73
72
  additional_text: str = "",
74
73
  ) -> str:
75
-
76
74
  framework_options_text = self.build_framework_text(framework_options)
77
75
  base_prompt = self.load_base_system_prompt()
78
76
  template_details = (
@@ -297,8 +297,7 @@ def string_similarity(
297
297
  score_func = algorithm
298
298
  else:
299
299
  raise ValueError(
300
- "algorithm must be a string specifying a built-in algorithm or "
301
- "a callable"
300
+ "algorithm must be a string specifying a built-in algorithm or a callable"
302
301
  )
303
302
 
304
303
  # Calculate similarities
@@ -5,7 +5,6 @@ from lionagi.utils import UNDEFINED, hash_dict
5
5
 
6
6
 
7
7
  class HashableModel(BaseModel):
8
-
9
8
  def to_dict(self, **kwargs) -> dict:
10
9
  """provides interface, specific methods need to be implemented in subclass kwargs for pydantic model_dump"""
11
10
  return {
@@ -10,7 +10,6 @@ __all__ = ("SchemaModel",)
10
10
 
11
11
 
12
12
  class SchemaModel(HashableModel):
13
-
14
13
  model_config = ConfigDict(
15
14
  extra="forbid",
16
15
  validate_default=False,
@@ -113,7 +113,6 @@ class ReActAnalysis(HashableModel):
113
113
 
114
114
 
115
115
  class Analysis(HashableModel):
116
-
117
116
  answer: str | None = None
118
117
 
119
118
  @field_validator("answer", mode="before")
@@ -2,4 +2,6 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
+ from .flow import flow
6
+ from .node import BranchOperations, Operation
5
7
  from .types import *
@@ -20,7 +20,6 @@ async def _act(
20
20
  suppress_errors: bool = False,
21
21
  verbose_action: bool = False,
22
22
  ) -> "ActionResponseModel":
23
-
24
23
  _request = {}
25
24
 
26
25
  if isinstance(action_request, BaseModel):