lionagi 0.7.5__tar.gz → 0.7.7__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 (260) hide show
  1. {lionagi-0.7.5 → lionagi-0.7.7}/.env.example +1 -0
  2. {lionagi-0.7.5 → lionagi-0.7.7}/PKG-INFO +2 -1
  3. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/__init__.py +4 -0
  4. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/token_transform/synthlang.py +8 -2
  5. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/interpret/interpret.py +5 -1
  6. lionagi-0.7.7/lionagi/operations/manager.py +22 -0
  7. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/operate/operate.py +13 -2
  8. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/instruct/base.py +2 -0
  9. lionagi-0.7.7/lionagi/operatives/instruct/instruct.py +153 -0
  10. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/instruct/prompts.py +2 -0
  11. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/instruct/reason.py +33 -9
  12. lionagi-0.7.7/lionagi/service/endpoints/match_endpoint.py +65 -0
  13. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/imodel.py +17 -3
  14. lionagi-0.7.7/lionagi/service/providers/exa_/__init__.py +0 -0
  15. lionagi-0.7.7/lionagi/service/providers/exa_/models.py +160 -0
  16. lionagi-0.7.7/lionagi/service/providers/exa_/search.py +80 -0
  17. lionagi-0.7.7/lionagi/service/providers/exa_/types.py +7 -0
  18. lionagi-0.7.7/lionagi/service/providers/types.py +17 -0
  19. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/session/branch.py +93 -6
  20. lionagi-0.7.7/lionagi/version.py +1 -0
  21. {lionagi-0.7.5 → lionagi-0.7.7}/pyproject.toml +2 -1
  22. lionagi-0.7.5/lionagi/operatives/instruct/instruct.py +0 -105
  23. lionagi-0.7.5/lionagi/service/endpoints/match_endpoint.py +0 -60
  24. lionagi-0.7.5/lionagi/version.py +0 -1
  25. {lionagi-0.7.5 → lionagi-0.7.7}/.github/FUNDING.yml +0 -0
  26. {lionagi-0.7.5 → lionagi-0.7.7}/.github/dependabot.yml +0 -0
  27. {lionagi-0.7.5 → lionagi-0.7.7}/.github/workflows/ci.yml +0 -0
  28. {lionagi-0.7.5 → lionagi-0.7.7}/.github/workflows/codeql.yml +0 -0
  29. {lionagi-0.7.5 → lionagi-0.7.7}/.github/workflows/docs.yml +0 -0
  30. {lionagi-0.7.5 → lionagi-0.7.7}/.github/workflows/release.yml +0 -0
  31. {lionagi-0.7.5 → lionagi-0.7.7}/.gitignore +0 -0
  32. {lionagi-0.7.5 → lionagi-0.7.7}/.pre-commit-config.yaml +0 -0
  33. {lionagi-0.7.5 → lionagi-0.7.7}/CODE_OF_CONDUCT.md +0 -0
  34. {lionagi-0.7.5 → lionagi-0.7.7}/CONTRIBUTING.md +0 -0
  35. {lionagi-0.7.5 → lionagi-0.7.7}/LICENSE +0 -0
  36. {lionagi-0.7.5 → lionagi-0.7.7}/README.md +0 -0
  37. {lionagi-0.7.5 → lionagi-0.7.7}/cookbooks/ch01_get_started.md +0 -0
  38. {lionagi-0.7.5 → lionagi-0.7.7}/cookbooks/ch02_concepts.md +0 -0
  39. {lionagi-0.7.5 → lionagi-0.7.7}/cookbooks/ch10_e2e_project.md +0 -0
  40. {lionagi-0.7.5 → lionagi-0.7.7}/cookbooks/ch11_performance.md +0 -0
  41. {lionagi-0.7.5 → lionagi-0.7.7}/cookbooks/ch12_graph.md +0 -0
  42. {lionagi-0.7.5 → lionagi-0.7.7}/cookbooks/ch3_internal_tools.md +0 -0
  43. {lionagi-0.7.5 → lionagi-0.7.7}/cookbooks/ch4_structured_forms.md +0 -0
  44. {lionagi-0.7.5 → lionagi-0.7.7}/cookbooks/ch5_react.md +0 -0
  45. {lionagi-0.7.5 → lionagi-0.7.7}/cookbooks/ch6_multi_branch.md +0 -0
  46. {lionagi-0.7.5 → lionagi-0.7.7}/cookbooks/ch7_multi_agent.md +0 -0
  47. {lionagi-0.7.5 → lionagi-0.7.7}/cookbooks/ch8_rate_limiting.md +0 -0
  48. {lionagi-0.7.5 → lionagi-0.7.7}/cookbooks/ch9_data_adapter.md +0 -0
  49. {lionagi-0.7.5 → lionagi-0.7.7}/dev_tools/count_code_base_lines.py +0 -0
  50. {lionagi-0.7.5 → lionagi-0.7.7}/docs/Makefile +0 -0
  51. {lionagi-0.7.5 → lionagi-0.7.7}/docs/_static/custom.css +0 -0
  52. {lionagi-0.7.5 → lionagi-0.7.7}/docs/_templates/layout.html +0 -0
  53. {lionagi-0.7.5 → lionagi-0.7.7}/docs/conf.py +0 -0
  54. {lionagi-0.7.5 → lionagi-0.7.7}/docs/index.rst +0 -0
  55. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/action.rst +0 -0
  56. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/adapter.rst +0 -0
  57. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/branch.rst +0 -0
  58. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/branch_operations.rst +0 -0
  59. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/concepts.rst +0 -0
  60. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/element_id.rst +0 -0
  61. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/event.rst +0 -0
  62. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/form.rst +0 -0
  63. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/graph.rst +0 -0
  64. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/index.rst +0 -0
  65. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/instruct.rst +0 -0
  66. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/lib_file.rst +0 -0
  67. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/lib_nested.rst +0 -0
  68. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/lib_package.rst +0 -0
  69. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/lib_schema.rst +0 -0
  70. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/lib_validate.rst +0 -0
  71. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/log.rst +0 -0
  72. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/mail.rst +0 -0
  73. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/message.rst +0 -0
  74. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/models.rst +0 -0
  75. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/operative_step.rst +0 -0
  76. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/pile.rst +0 -0
  77. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/processor.rst +0 -0
  78. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/progression.rst +0 -0
  79. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/service.rst +0 -0
  80. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/session.rst +0 -0
  81. {lionagi-0.7.5 → lionagi-0.7.7}/docs/modules/utils.rst +0 -0
  82. {lionagi-0.7.5 → lionagi-0.7.7}/docs/tutorials/get_started.rst +0 -0
  83. {lionagi-0.7.5 → lionagi-0.7.7}/docs/tutorials/get_started_pt2.rst +0 -0
  84. {lionagi-0.7.5 → lionagi-0.7.7}/docs/tutorials/get_started_pt3.rst +0 -0
  85. {lionagi-0.7.5 → lionagi-0.7.7}/docs/tutorials/index.rst +0 -0
  86. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/_class_registry.py +0 -0
  87. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/_errors.py +0 -0
  88. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/_types.py +0 -0
  89. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/__init__.py +0 -0
  90. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/file/__init__.py +0 -0
  91. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/file/chunk.py +0 -0
  92. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/file/file_ops.py +0 -0
  93. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/file/params.py +0 -0
  94. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/file/process.py +0 -0
  95. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/file/save.py +0 -0
  96. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/nested/__init__.py +0 -0
  97. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/nested/flatten.py +0 -0
  98. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/nested/nfilter.py +0 -0
  99. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/nested/nget.py +0 -0
  100. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/nested/ninsert.py +0 -0
  101. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/nested/nmerge.py +0 -0
  102. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/nested/npop.py +0 -0
  103. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/nested/nset.py +0 -0
  104. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/nested/unflatten.py +0 -0
  105. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/nested/utils.py +0 -0
  106. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/package/__init__.py +0 -0
  107. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/package/imports.py +0 -0
  108. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/package/management.py +0 -0
  109. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/package/params.py +0 -0
  110. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/package/system.py +0 -0
  111. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/parse.py +0 -0
  112. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/schema/__init__.py +0 -0
  113. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/schema/as_readable.py +0 -0
  114. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/schema/extract_code_block.py +0 -0
  115. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/schema/extract_docstring.py +0 -0
  116. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/schema/function_to_schema.py +0 -0
  117. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/schema/json_schema.py +0 -0
  118. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/token_transform/__init__.py +0 -0
  119. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/token_transform/llmlingua.py +0 -0
  120. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/token_transform/perplexity.py +0 -0
  121. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/validate/__init__.py +0 -0
  122. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/validate/common_field_validators.py +0 -0
  123. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/validate/fuzzy_match_keys.py +0 -0
  124. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/validate/fuzzy_validate_mapping.py +0 -0
  125. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/validate/string_similarity.py +0 -0
  126. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/libs/validate/validate_boolean.py +0 -0
  127. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/ReAct/ReAct.py +0 -0
  128. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/ReAct/__init__.py +0 -0
  129. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/ReAct/utils.py +0 -0
  130. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/__init__.py +0 -0
  131. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/_act/__init__.py +0 -0
  132. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/_act/act.py +0 -0
  133. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/brainstorm/__init__.py +0 -0
  134. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/brainstorm/brainstorm.py +0 -0
  135. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/brainstorm/prompt.py +0 -0
  136. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/chat/__init__.py +0 -0
  137. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/chat/chat.py +0 -0
  138. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/communicate/__init__.py +0 -0
  139. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/communicate/communicate.py +0 -0
  140. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/instruct/__init__.py +0 -0
  141. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/instruct/instruct.py +0 -0
  142. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/interpret/__init__.py +0 -0
  143. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/operate/__init__.py +0 -0
  144. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/parse/__init__.py +0 -0
  145. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/parse/parse.py +0 -0
  146. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/plan/__init__.py +0 -0
  147. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/plan/plan.py +0 -0
  148. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/plan/prompt.py +0 -0
  149. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/select/__init__.py +0 -0
  150. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/select/select.py +0 -0
  151. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/select/utils.py +0 -0
  152. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/translate/__init__.py +0 -0
  153. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/translate/translate.py +0 -0
  154. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/types.py +0 -0
  155. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operations/utils.py +0 -0
  156. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/__init__.py +0 -0
  157. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/action/__init__.py +0 -0
  158. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/action/function_calling.py +0 -0
  159. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/action/manager.py +0 -0
  160. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/action/request_response_model.py +0 -0
  161. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/action/tool.py +0 -0
  162. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/action/utils.py +0 -0
  163. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/forms/__init__.py +0 -0
  164. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/forms/base.py +0 -0
  165. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/forms/form.py +0 -0
  166. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/forms/report.py +0 -0
  167. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/forms/utils.py +0 -0
  168. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/instruct/__init__.py +0 -0
  169. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/instruct/instruct_collection.py +0 -0
  170. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/instruct/node.py +0 -0
  171. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/manager.py +0 -0
  172. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/models/__init__.py +0 -0
  173. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/models/field_model.py +0 -0
  174. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/models/model_params.py +0 -0
  175. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/models/note.py +0 -0
  176. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/models/operable_model.py +0 -0
  177. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/models/schema_model.py +0 -0
  178. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/operative.py +0 -0
  179. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/step.py +0 -0
  180. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/strategies/__init__.py +0 -0
  181. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/strategies/base.py +0 -0
  182. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/strategies/concurrent.py +0 -0
  183. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/strategies/concurrent_chunk.py +0 -0
  184. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/strategies/concurrent_sequential_chunk.py +0 -0
  185. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/strategies/params.py +0 -0
  186. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/strategies/sequential.py +0 -0
  187. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/strategies/sequential_chunk.py +0 -0
  188. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/strategies/sequential_concurrent_chunk.py +0 -0
  189. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/strategies/utils.py +0 -0
  190. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/operatives/types.py +0 -0
  191. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/__init__.py +0 -0
  192. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/_concepts.py +0 -0
  193. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/adapters/__init__.py +0 -0
  194. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/adapters/adapter.py +0 -0
  195. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/adapters/json_adapter.py +0 -0
  196. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/adapters/pandas_/__init__.py +0 -0
  197. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/adapters/pandas_/csv_adapter.py +0 -0
  198. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/adapters/pandas_/excel_adapter.py +0 -0
  199. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/adapters/pandas_/pd_dataframe_adapter.py +0 -0
  200. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/adapters/pandas_/pd_series_adapter.py +0 -0
  201. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/adapters/types.py +0 -0
  202. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/generic/__init__.py +0 -0
  203. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/generic/element.py +0 -0
  204. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/generic/event.py +0 -0
  205. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/generic/log.py +0 -0
  206. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/generic/pile.py +0 -0
  207. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/generic/processor.py +0 -0
  208. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/generic/progression.py +0 -0
  209. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/graph/__init__.py +0 -0
  210. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/graph/edge.py +0 -0
  211. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/graph/graph.py +0 -0
  212. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/graph/node.py +0 -0
  213. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/mail/__init__.py +0 -0
  214. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/mail/exchange.py +0 -0
  215. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/mail/mail.py +0 -0
  216. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/mail/mailbox.py +0 -0
  217. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/mail/manager.py +0 -0
  218. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/mail/package.py +0 -0
  219. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/__init__.py +0 -0
  220. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/action_request.py +0 -0
  221. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/action_response.py +0 -0
  222. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/assistant_response.py +0 -0
  223. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/base.py +0 -0
  224. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/instruction.py +0 -0
  225. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/manager.py +0 -0
  226. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/message.py +0 -0
  227. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/system.py +0 -0
  228. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/templates/README.md +0 -0
  229. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/templates/action_request.jinja2 +0 -0
  230. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/templates/action_response.jinja2 +0 -0
  231. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/templates/assistant_response.jinja2 +0 -0
  232. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/templates/instruction_message.jinja2 +0 -0
  233. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/templates/system_message.jinja2 +0 -0
  234. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/messages/templates/tool_schemas.jinja2 +0 -0
  235. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/protocols/types.py +0 -0
  236. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/__init__.py +0 -0
  237. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/endpoints/__init__.py +0 -0
  238. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/endpoints/base.py +0 -0
  239. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/endpoints/chat_completion.py +0 -0
  240. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/endpoints/rate_limited_processor.py +0 -0
  241. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/endpoints/token_calculator.py +0 -0
  242. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/manager.py +0 -0
  243. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/providers/__init__.py +0 -0
  244. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/providers/anthropic_/__init__.py +0 -0
  245. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/providers/anthropic_/messages.py +0 -0
  246. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/providers/groq_/__init__.py +0 -0
  247. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/providers/groq_/chat_completions.py +0 -0
  248. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/providers/openai_/__init__.py +0 -0
  249. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/providers/openai_/chat_completions.py +0 -0
  250. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/providers/openrouter_/__init__.py +0 -0
  251. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/providers/openrouter_/chat_completions.py +0 -0
  252. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/providers/perplexity_/__init__.py +0 -0
  253. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/providers/perplexity_/chat_completions.py +0 -0
  254. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/service/types.py +0 -0
  255. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/session/__init__.py +0 -0
  256. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/session/session.py +0 -0
  257. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/settings.py +0 -0
  258. {lionagi-0.7.5 → lionagi-0.7.7}/lionagi/utils.py +0 -0
  259. {lionagi-0.7.5 → lionagi-0.7.7}/prompts/doc_style.md +0 -0
  260. {lionagi-0.7.5 → lionagi-0.7.7}/uv.lock +0 -0
@@ -4,3 +4,4 @@
4
4
  # PERPLEXITY_API_KEY=
5
5
  # GROQ_API_KEY=
6
6
  # OPENROUTER_API_KEY=
7
+ # EXA_API_KEY=
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lionagi
3
- Version: 0.7.5
3
+ Version: 0.7.7
4
4
  Summary: An Intelligence Operating System.
5
5
  Author-email: HaiyangLi <quantocean.li@gmail.com>
6
6
  License: Apache License
@@ -214,6 +214,7 @@ Classifier: License :: OSI Approved :: Apache Software License
214
214
  Classifier: Operating System :: OS Independent
215
215
  Classifier: Programming Language :: Python :: 3
216
216
  Classifier: Programming Language :: Python :: 3 :: Only
217
+ Classifier: Programming Language :: Python :: 3.10
217
218
  Classifier: Programming Language :: Python :: 3.11
218
219
  Classifier: Programming Language :: Python :: 3.12
219
220
  Classifier: Programming Language :: Python :: 3.13
@@ -2,6 +2,8 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
+ from pydantic import BaseModel, Field
6
+
5
7
  from . import _types as types
6
8
  from .operations import types as op
7
9
  from .operatives import types as ops_types # deprecated
@@ -20,4 +22,6 @@ __all__ = (
20
22
  "ops_types",
21
23
  "op",
22
24
  "__version__",
25
+ "BaseModel",
26
+ "Field",
23
27
  )
@@ -387,10 +387,16 @@ async def translate_to_synthlang(
387
387
  calculator = TokenCalculator()
388
388
 
389
389
  len_tokens = calculator.tokenize(text, return_tokens=False)
390
- out = await branch.communicate(
390
+
391
+ kwargs["guidance"] = (
392
+ "Following SynthLang, translate the provided text into SynthLang syntax. "
393
+ "Shrink the token size by 60-85%. Return only the translated text.\n\n"
394
+ + kwargs.get("guidance", "")
395
+ )
396
+
397
+ out = await branch.chat(
391
398
  instruction=f"Converts the given text into SynthLang's hyper-efficient format.",
392
399
  context="Text to convert:\n\n" + text,
393
- guidance=f"Following SynthLang, translate the provided text into SynthLang syntax. Shrink the token size by 60-85%. Return only the translated text.",
394
400
  **kwargs,
395
401
  )
396
402
  if sys1:
@@ -13,6 +13,7 @@ async def interpret(
13
13
  text: str,
14
14
  domain: str | None = None,
15
15
  style: str | None = None,
16
+ sample_writing: str | None = None,
16
17
  **kwargs,
17
18
  ) -> str:
18
19
  instruction = (
@@ -25,14 +26,17 @@ async def interpret(
25
26
  f"Desired style: {style or 'concise'}. "
26
27
  "You can add or clarify context if needed."
27
28
  )
29
+ if sample_writing:
30
+ guidance += f" Sample writing: {sample_writing}"
31
+
28
32
  context = [f"User input: {text}"]
29
33
 
30
34
  # Default temperature if none provided
31
35
  kwargs["temperature"] = kwargs.get("temperature", 0.1)
36
+ kwargs["guidance"] = guidance + "\n" + kwargs.get("guidance", "")
32
37
 
33
38
  refined_prompt = await branch.chat(
34
39
  instruction=instruction,
35
- guidance=guidance,
36
40
  context=context,
37
41
  **kwargs,
38
42
  )
@@ -0,0 +1,22 @@
1
+ from typing import Callable
2
+
3
+ from lionagi.protocols._concepts import Manager
4
+
5
+ """
6
+ experimental
7
+ """
8
+
9
+
10
+ class OperationManager(Manager):
11
+
12
+ def __init__(self, *args, **kwargs):
13
+ super().__init__()
14
+ self.registry: dict[str, Callable] = {}
15
+ self.register_operations(*args, **kwargs)
16
+
17
+ def register_operations(self, *args, **kwargs) -> None:
18
+ operations = {}
19
+ if args:
20
+ operations = {i.__name__ for i in args if hasattr(i, "__name__")}
21
+ operations.update(kwargs)
22
+ self.registry.update(operations)
@@ -47,6 +47,9 @@ async def operate(
47
47
  actions: bool = False,
48
48
  reason: bool = False,
49
49
  action_kwargs: dict = None,
50
+ action_strategy: Literal[
51
+ "sequential", "concurrent", "batch"
52
+ ] = "concurrent",
50
53
  field_models: list[FieldModel] = None,
51
54
  exclude_fields: list | dict | None = None,
52
55
  request_params: ModelParams = None,
@@ -97,6 +100,8 @@ async def operate(
97
100
  instruct.reason = True
98
101
  if actions:
99
102
  instruct.actions = True
103
+ if action_strategy:
104
+ instruct.action_strategy = action_strategy
100
105
 
101
106
  # 1) Create or update the Operative
102
107
  operative = Step.request_operative(
@@ -178,9 +183,15 @@ async def operate(
178
183
  getattr(response_model, "action_required", None) is True
179
184
  and getattr(response_model, "action_requests", None) is not None
180
185
  ):
186
+ action_kwargs = action_kwargs or {}
187
+ action_kwargs["strategy"] = (
188
+ instruct.action_strategy
189
+ if instruct.action_strategy
190
+ else action_kwargs.get("strategy", "concurrent")
191
+ )
192
+
181
193
  action_response_models = await branch.act(
182
- response_model.action_requests,
183
- **(action_kwargs or {}),
194
+ response_model.action_requests, **action_kwargs
184
195
  )
185
196
  # Possibly refine the operative with the tool outputs
186
197
  operative = Step.respond_operative(
@@ -2,6 +2,8 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
+ """deprecated"""
6
+
5
7
  from pydantic import JsonValue
6
8
 
7
9
  from lionagi.libs.validate.common_field_validators import (
@@ -0,0 +1,153 @@
1
+ # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from typing import Any, ClassVar, Literal
6
+
7
+ from pydantic import Field, JsonValue, field_validator
8
+
9
+ from lionagi.libs.validate.common_field_validators import (
10
+ validate_boolean_field,
11
+ validate_nullable_jsonvalue_field,
12
+ )
13
+ from lionagi.utils import HashableModel, to_num
14
+
15
+ from ..models.field_model import FieldModel
16
+
17
+ __all__ = (
18
+ "Instruct",
19
+ "InstructResponse",
20
+ "INSTRUCT_FIELD",
21
+ "LIST_INSTRUCT_FIELD",
22
+ )
23
+
24
+
25
+ class Instruct(HashableModel):
26
+ """Model for defining instruction parameters and execution requirements.
27
+
28
+ Attributes:
29
+ instruction (JsonValue | None): The primary instruction.
30
+ guidance (JsonValue | None): Execution guidance.
31
+ context (JsonValue | None): Task context.
32
+ """
33
+
34
+ reserved_kwargs: ClassVar[list[str]] = [
35
+ "operative_model",
36
+ "field_models",
37
+ "operative",
38
+ "reason",
39
+ "actions",
40
+ "action_strategy",
41
+ "batch_size",
42
+ "request_params",
43
+ "response_params",
44
+ ]
45
+ instruction: JsonValue | None = Field(
46
+ None,
47
+ title="Primary Instruction",
48
+ description=(
49
+ "A clear, actionable task definition. Specify:\n"
50
+ "1) The primary goal or objective\n"
51
+ "2) Key success criteria or constraints\n"
52
+ "\n"
53
+ "Guidelines:\n"
54
+ "- Start with a direct action verb (e.g., 'Analyze', 'Generate', 'Create')\n"
55
+ "- Include scope, boundaries, or constraints\n"
56
+ "- Provide success criteria if relevant\n"
57
+ "- For complex tasks, break them into logical steps"
58
+ ),
59
+ )
60
+ guidance: JsonValue | None = Field(
61
+ None,
62
+ title="Guidance",
63
+ description=(
64
+ "Strategic direction and constraints for executing the task. "
65
+ "Include:\n"
66
+ "1) Preferred methods or frameworks\n"
67
+ "2) Quality benchmarks (e.g., speed, clarity)\n"
68
+ "3) Resource or environmental constraints\n"
69
+ "4) Relevant compliance or standards\n"
70
+ "Use None if no special guidance."
71
+ ),
72
+ )
73
+ context: JsonValue | None = Field(
74
+ None,
75
+ description=(
76
+ "Background information and current-state data needed for the task. "
77
+ "Should be:\n"
78
+ "1) Directly relevant\n"
79
+ "2) Sufficient to perform the task\n"
80
+ "3) Free of extraneous detail\n"
81
+ "Include environment, prior outcomes, system states, or dependencies. "
82
+ "Use None if no additional context is needed."
83
+ ),
84
+ )
85
+ reason: bool | None = Field(
86
+ None,
87
+ description=(
88
+ "Include a thoughtful explanation of decisions, trade-offs, "
89
+ "and insights. Encourage deeper introspection on why certain "
90
+ "choices were made, potential alternatives, and how confidence "
91
+ "was shaped. If not needed, set to None."
92
+ ),
93
+ )
94
+ actions: bool | None = Field(
95
+ None,
96
+ description=(
97
+ "Controls execution mode. "
98
+ "True: Execute specified actions. "
99
+ "False: Analysis/recommendations only. "
100
+ "None: Contextual execution."
101
+ ),
102
+ )
103
+ action_strategy: Literal["batch", "sequential", "concurrent"] | None = (
104
+ Field(
105
+ None,
106
+ description="Action strategy to use for executing actions. Default "
107
+ "is 'concurrent'. Only provide for if actions are enabled.",
108
+ )
109
+ )
110
+ batch_size: int | None = Field(
111
+ None,
112
+ description="Batch size for executing actions. Only provide for 'batch' strategy.",
113
+ )
114
+
115
+ @field_validator("instruction", "guidance", "context", mode="before")
116
+ def _validate_instruction(cls, v):
117
+ return validate_nullable_jsonvalue_field(cls, v)
118
+
119
+ @field_validator("reason", "actions", mode="before")
120
+ def _validate_reason(cls, v):
121
+ return validate_boolean_field(cls, v)
122
+
123
+ @field_validator("action_strategy", mode="before")
124
+ def _validate_action_strategy(cls, v):
125
+ if v not in ["batch", "sequential", "concurrent"]:
126
+ return "concurrent"
127
+ return v
128
+
129
+ @field_validator("batch_size", mode="before")
130
+ def _validate_batch_size(cls, v):
131
+ try:
132
+ return to_num(v, num_type=int)
133
+ except Exception:
134
+ return None
135
+
136
+
137
+ INSTRUCT_FIELD = FieldModel(
138
+ name="instruct_model",
139
+ annotation=Instruct | None,
140
+ default=None,
141
+ )
142
+
143
+
144
+ class InstructResponse(HashableModel):
145
+ instruct: Instruct
146
+ response: Any | None = None
147
+
148
+
149
+ LIST_INSTRUCT_FIELD_MODEL = FieldModel(
150
+ name="instruct_models",
151
+ annotation=list[Instruct] | None,
152
+ default=None,
153
+ )
@@ -2,6 +2,8 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
+ """deprecated"""
6
+
5
7
  instruction_field_description = (
6
8
  "A clear, actionable task definition. Specify:\n"
7
9
  "1) The primary goal or objective\n"
@@ -2,13 +2,19 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
- from pydantic import BaseModel, field_validator
5
+ from pydantic import BaseModel, Field, field_validator
6
6
 
7
7
  from lionagi.utils import to_num
8
8
 
9
9
  from ..models.field_model import FieldModel
10
10
 
11
+ __all__ = (
12
+ "Reason",
13
+ "REASON_FIELD",
14
+ )
15
+
11
16
 
17
+ # deprecated
12
18
  def validate_confidence_score(cls, value) -> float:
13
19
  try:
14
20
  return to_num(
@@ -22,6 +28,7 @@ def validate_confidence_score(cls, value) -> float:
22
28
  return -1
23
29
 
24
30
 
31
+ # deprecated
25
32
  confidence_description = (
26
33
  "Numeric confidence score (0.0 to 1.0, up to three decimals) indicating "
27
34
  "how well you've met user expectations. Use this guide:\n"
@@ -31,6 +38,7 @@ confidence_description = (
31
38
  " • 0.0-0.5: Off track"
32
39
  )
33
40
 
41
+ # deprecated
34
42
  CONFIDENCE_SCORE_FIELD = FieldModel(
35
43
  name="confidence_score",
36
44
  annotation=float | None,
@@ -47,13 +55,32 @@ class Reason(BaseModel):
47
55
 
48
56
  title: str | None = None
49
57
  content: str | None = None
50
- confidence_score: float | None = CONFIDENCE_SCORE_FIELD.field_info
51
-
52
- @field_validator(
53
- "confidence_score", **CONFIDENCE_SCORE_FIELD.validator_kwargs
58
+ confidence_score: float | None = Field(
59
+ None,
60
+ title="Confidence Score",
61
+ description=(
62
+ "Numeric confidence score (0.0 to 1.0, up to three decimals) indicating "
63
+ "how well you've met user expectations. Use this guide:\n"
64
+ " • 1.0: Highly confident\n"
65
+ " • 0.8-1.0: Reasonably sure\n"
66
+ " • 0.5-0.8: Re-check or refine\n"
67
+ " • 0.0-0.5: Off track"
68
+ ),
69
+ examples=[0.821, 0.257, 0.923, 0.439],
54
70
  )
71
+
72
+ @field_validator("confidence_score", mode="before")
55
73
  def _validate_confidence(cls, v):
56
- return CONFIDENCE_SCORE_FIELD.validator(cls, v)
74
+ try:
75
+ return to_num(
76
+ v,
77
+ upper_bound=1,
78
+ lower_bound=0,
79
+ num_type=float,
80
+ precision=3,
81
+ )
82
+ except Exception:
83
+ return -1
57
84
 
58
85
 
59
86
  REASON_FIELD = FieldModel(
@@ -62,6 +89,3 @@ REASON_FIELD = FieldModel(
62
89
  title="Reason",
63
90
  description="**Provide a concise reason for the decision made.**",
64
91
  )
65
-
66
-
67
- __all__ = ["Reason"]
@@ -0,0 +1,65 @@
1
+ # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from .chat_completion import EndPoint
6
+
7
+
8
+ def match_endpoint(
9
+ provider: str,
10
+ base_url: str,
11
+ endpoint: str,
12
+ endpoint_params: list[str] | None = None,
13
+ ) -> EndPoint:
14
+
15
+ if endpoint in ["chat/completions", "chat", "messages"]:
16
+ from ..providers.openai_.chat_completions import (
17
+ OpenAIChatCompletionEndPoint,
18
+ )
19
+
20
+ if provider == "openai":
21
+ return OpenAIChatCompletionEndPoint()
22
+
23
+ if provider == "anthropic":
24
+ from ..providers.anthropic_.messages import (
25
+ AnthropicChatCompletionEndPoint,
26
+ )
27
+
28
+ return AnthropicChatCompletionEndPoint()
29
+
30
+ if provider == "groq":
31
+ from ..providers.groq_.chat_completions import (
32
+ GroqChatCompletionEndPoint,
33
+ )
34
+
35
+ return GroqChatCompletionEndPoint()
36
+
37
+ if provider == "perplexity":
38
+ from ..providers.perplexity_.chat_completions import (
39
+ PerplexityChatCompletionEndPoint,
40
+ )
41
+
42
+ return PerplexityChatCompletionEndPoint()
43
+
44
+ if provider == "openrouter":
45
+ from ..providers.openrouter_.chat_completions import (
46
+ OpenRouterChatCompletionEndPoint,
47
+ )
48
+
49
+ return OpenRouterChatCompletionEndPoint()
50
+
51
+ return OpenAIChatCompletionEndPoint(
52
+ config={
53
+ "provider": provider,
54
+ "base_url": base_url,
55
+ "endpoint": endpoint,
56
+ "endpoint_params": endpoint_params,
57
+ }
58
+ )
59
+
60
+ if provider == "exa" and endpoint == "search":
61
+ from ..providers.exa_.search import ExaSearchEndPoint
62
+
63
+ return ExaSearchEndPoint()
64
+
65
+ raise ValueError(f"Unsupported endpoint: {endpoint}")
@@ -102,6 +102,8 @@ class iModel:
102
102
  api_key = "PERPLEXITY_API_KEY"
103
103
  case "groq":
104
104
  api_key = "GROQ_API_KEY"
105
+ case "exa":
106
+ api_key = "EXA_API_KEY"
105
107
 
106
108
  if os.getenv(api_key, None) is not None:
107
109
  self.api_key_scheme = api_key
@@ -198,7 +200,9 @@ class iModel:
198
200
  except Exception as e:
199
201
  raise ValueError(f"Failed to stream API call: {e}")
200
202
 
201
- async def invoke(self, **kwargs) -> APICalling | None:
203
+ async def invoke(
204
+ self, api_call: APICalling = None, **kwargs
205
+ ) -> APICalling | None:
202
206
  """Invokes a rate-limited API call with the given arguments.
203
207
 
204
208
  Args:
@@ -215,8 +219,9 @@ class iModel:
215
219
  If the call fails or if an error occurs during invocation.
216
220
  """
217
221
  try:
218
- kwargs.pop("stream", None)
219
- api_call = self.create_api_calling(**kwargs)
222
+ if api_call is None:
223
+ kwargs.pop("stream", None)
224
+ api_call = self.create_api_calling(**kwargs)
220
225
  if (
221
226
  self.executor.processor is None
222
227
  or self.executor.processor.is_stopped()
@@ -252,6 +257,15 @@ class iModel:
252
257
  """
253
258
  return self.endpoint.sequential_exchange
254
259
 
260
+ @property
261
+ def model_name(self) -> str:
262
+ """str: The name of the model used by the endpoint.
263
+
264
+ Returns:
265
+ The model name if available; otherwise, an empty string.
266
+ """
267
+ return self.kwargs.get("model", "")
268
+
255
269
  def to_dict(self):
256
270
  kwargs = self.kwargs
257
271
  if "kwargs" in self.kwargs:
@@ -0,0 +1,160 @@
1
+ from enum import Enum
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+
6
+ class CategoryEnum(str, Enum):
7
+ company = "company"
8
+ research_paper = "research paper"
9
+ news = "news"
10
+ pdf = "pdf"
11
+ github = "github"
12
+ tweet = "tweet"
13
+ personal_site = "personal site"
14
+ linkedin_profile = "linkedin profile"
15
+ financial_report = "financial report"
16
+
17
+
18
+ class LivecrawlEnum(str, Enum):
19
+ never = "never"
20
+ fallback = "fallback"
21
+ always = "always"
22
+
23
+
24
+ class SearchTypeEnum(str, Enum):
25
+ keyword = "keyword"
26
+ neural = "neural"
27
+ auto = "auto"
28
+
29
+
30
+ class ContentsText(BaseModel):
31
+ includeHtmlTags: bool | None = Field(
32
+ default=False,
33
+ description="Whether to include HTML tags in the text. Set to True if you want to retain HTML structure for the LLM to interpret.",
34
+ )
35
+ maxCharacters: int | None = Field(
36
+ default=None,
37
+ description="The maximum number of characters to return from the webpage text.",
38
+ )
39
+
40
+
41
+ class ContentsHighlights(BaseModel):
42
+ highlightsPerUrl: int | None = Field(
43
+ default=1,
44
+ description="The number of highlight snippets you want per page.",
45
+ )
46
+ numSentences: int | None = Field(
47
+ default=5,
48
+ description="Number of sentences to return in each highlight snippet.",
49
+ )
50
+ query: None | str = Field(
51
+ default=None,
52
+ description="A specific query used to generate the highlight snippets.",
53
+ )
54
+
55
+
56
+ class ContentsSummary(BaseModel):
57
+ query: None | str = Field(
58
+ default=None,
59
+ description="A specific query used to generate a summary of the webpage.",
60
+ )
61
+
62
+
63
+ class ContentsExtras(BaseModel):
64
+ links: int | None = Field(
65
+ default=None, description="Number of links to return from each page."
66
+ )
67
+ imageLinks: int | None = Field(
68
+ default=None, description="Number of images to return for each result."
69
+ )
70
+
71
+
72
+ class Contents(BaseModel):
73
+ text: None | ContentsText = Field(
74
+ default=None,
75
+ description="Return full or partial text for each page, with optional HTML structure or size limit.",
76
+ )
77
+ highlights: None | ContentsHighlights = Field(
78
+ default=None, description="Return snippet highlights for each page."
79
+ )
80
+ summary: None | ContentsSummary = Field(
81
+ default=None, description="Return a short summary of each page."
82
+ )
83
+ livecrawl: None | LivecrawlEnum = Field(
84
+ default=LivecrawlEnum.never,
85
+ description="Livecrawling setting for each page. Options: never, fallback, always.",
86
+ )
87
+ livecrawlTimeout: int | None = Field(
88
+ default=10000,
89
+ description="Timeout in milliseconds for livecrawling. Default 10000.",
90
+ )
91
+ subpages: int | None = Field(
92
+ default=None,
93
+ description="Number of subpages to crawl within each URL.",
94
+ )
95
+ subpageTarget: None | str | list[str] = Field(
96
+ default=None,
97
+ description="A target subpage or multiple subpages (list) to crawl, e.g. 'cited papers'.",
98
+ )
99
+ extras: None | ContentsExtras = Field(
100
+ default=None,
101
+ description="Additional extras like links or images to return for each page.",
102
+ )
103
+
104
+
105
+ class ExaSearchRequest(BaseModel):
106
+ query: str = Field(
107
+ ...,
108
+ description="The main query string describing what you're looking for.",
109
+ )
110
+ category: None | CategoryEnum = Field(
111
+ default=None,
112
+ description="A data category to focus on, such as 'company', 'research paper', 'news', etc.",
113
+ )
114
+ type: None | SearchTypeEnum = Field(
115
+ default=None,
116
+ description="The type of search to run. Can be 'auto', 'keyword', or 'neural'.",
117
+ )
118
+ useAutoprompt: None | bool = Field(
119
+ default=False,
120
+ description="If True, Exa auto-optimizes your query for best results (neural or auto search only).",
121
+ )
122
+ numResults: int | None = Field(
123
+ default=10, description="Number of results to return. Default is 10."
124
+ )
125
+ includeDomains: None | list[str] = Field(
126
+ default=None,
127
+ description="List of domains you want to include exclusively.",
128
+ )
129
+ excludeDomains: None | list[str] = Field(
130
+ default=None,
131
+ description="List of domains you do NOT want to see in the results.",
132
+ )
133
+ startCrawlDate: None | str = Field(
134
+ default=None,
135
+ description="Include results crawled after this ISO date (e.g., '2023-01-01T00:00:00.000Z').",
136
+ )
137
+ endCrawlDate: None | str = Field(
138
+ default=None,
139
+ description="Include results crawled before this ISO date.",
140
+ )
141
+ startPublishedDate: None | str = Field(
142
+ default=None,
143
+ description="Only return results published after this ISO date.",
144
+ )
145
+ endPublishedDate: None | str = Field(
146
+ default=None,
147
+ description="Only return results published before this ISO date.",
148
+ )
149
+ includeText: None | list[str] = Field(
150
+ default=None,
151
+ description="Strings that must appear in the webpage text. Only a single string up to 5 words is currently supported.",
152
+ )
153
+ excludeText: None | list[str] = Field(
154
+ default=None,
155
+ description="Strings that must NOT appear in the webpage text. Only a single string up to 5 words is currently supported.",
156
+ )
157
+ contents: None | Contents = Field(
158
+ default=None,
159
+ description="Dict defining the different ways you want to retrieve webpage contents, including text, highlights, or summaries.",
160
+ )