lionagi 0.12.3__py3-none-any.whl → 0.12.5__py3-none-any.whl

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 (74) hide show
  1. lionagi/config.py +123 -0
  2. lionagi/libs/schema/load_pydantic_model_from_schema.py +259 -0
  3. lionagi/libs/token_transform/perplexity.py +2 -4
  4. lionagi/libs/token_transform/synthlang_/translate_to_synthlang.py +1 -1
  5. lionagi/operations/chat/chat.py +2 -2
  6. lionagi/operations/communicate/communicate.py +20 -5
  7. lionagi/operations/parse/parse.py +131 -43
  8. lionagi/protocols/generic/pile.py +94 -33
  9. lionagi/protocols/graph/node.py +25 -19
  10. lionagi/protocols/messages/assistant_response.py +20 -1
  11. lionagi/service/connections/__init__.py +15 -0
  12. lionagi/service/connections/api_calling.py +230 -0
  13. lionagi/service/connections/endpoint.py +410 -0
  14. lionagi/service/connections/endpoint_config.py +137 -0
  15. lionagi/service/connections/header_factory.py +56 -0
  16. lionagi/service/connections/match_endpoint.py +49 -0
  17. lionagi/service/connections/providers/__init__.py +3 -0
  18. lionagi/service/connections/providers/anthropic_.py +87 -0
  19. lionagi/service/connections/providers/exa_.py +33 -0
  20. lionagi/service/connections/providers/oai_.py +166 -0
  21. lionagi/service/connections/providers/ollama_.py +122 -0
  22. lionagi/service/connections/providers/perplexity_.py +29 -0
  23. lionagi/service/imodel.py +36 -144
  24. lionagi/service/manager.py +1 -7
  25. lionagi/service/{endpoints/rate_limited_processor.py → rate_limited_processor.py} +4 -2
  26. lionagi/service/resilience.py +545 -0
  27. lionagi/service/third_party/README.md +71 -0
  28. lionagi/service/third_party/anthropic_models.py +159 -0
  29. lionagi/service/{providers/exa_/models.py → third_party/exa_models.py} +18 -13
  30. lionagi/service/third_party/openai_models.py +18241 -0
  31. lionagi/service/third_party/pplx_models.py +156 -0
  32. lionagi/service/types.py +5 -4
  33. lionagi/session/branch.py +12 -7
  34. lionagi/tools/file/reader.py +1 -1
  35. lionagi/tools/memory/tools.py +497 -0
  36. lionagi/version.py +1 -1
  37. {lionagi-0.12.3.dist-info → lionagi-0.12.5.dist-info}/METADATA +17 -19
  38. {lionagi-0.12.3.dist-info → lionagi-0.12.5.dist-info}/RECORD +43 -54
  39. lionagi/adapters/__init__.py +0 -1
  40. lionagi/adapters/adapter.py +0 -120
  41. lionagi/adapters/json_adapter.py +0 -181
  42. lionagi/adapters/pandas_/csv_adapter.py +0 -94
  43. lionagi/adapters/pandas_/excel_adapter.py +0 -94
  44. lionagi/adapters/pandas_/pd_dataframe_adapter.py +0 -81
  45. lionagi/adapters/pandas_/pd_series_adapter.py +0 -57
  46. lionagi/adapters/toml_adapter.py +0 -204
  47. lionagi/adapters/types.py +0 -21
  48. lionagi/service/endpoints/__init__.py +0 -3
  49. lionagi/service/endpoints/base.py +0 -706
  50. lionagi/service/endpoints/chat_completion.py +0 -116
  51. lionagi/service/endpoints/match_endpoint.py +0 -72
  52. lionagi/service/providers/__init__.py +0 -3
  53. lionagi/service/providers/anthropic_/__init__.py +0 -3
  54. lionagi/service/providers/anthropic_/messages.py +0 -99
  55. lionagi/service/providers/exa_/search.py +0 -80
  56. lionagi/service/providers/exa_/types.py +0 -7
  57. lionagi/service/providers/groq_/__init__.py +0 -3
  58. lionagi/service/providers/groq_/chat_completions.py +0 -56
  59. lionagi/service/providers/ollama_/__init__.py +0 -3
  60. lionagi/service/providers/ollama_/chat_completions.py +0 -134
  61. lionagi/service/providers/openai_/__init__.py +0 -3
  62. lionagi/service/providers/openai_/chat_completions.py +0 -101
  63. lionagi/service/providers/openai_/spec.py +0 -14
  64. lionagi/service/providers/openrouter_/__init__.py +0 -3
  65. lionagi/service/providers/openrouter_/chat_completions.py +0 -62
  66. lionagi/service/providers/perplexity_/__init__.py +0 -3
  67. lionagi/service/providers/perplexity_/chat_completions.py +0 -44
  68. lionagi/service/providers/perplexity_/models.py +0 -144
  69. lionagi/service/providers/types.py +0 -17
  70. /lionagi/{adapters/pandas_/__init__.py → py.typed} +0 -0
  71. /lionagi/service/{providers/exa_ → third_party}/__init__.py +0 -0
  72. /lionagi/service/{endpoints/token_calculator.py → token_calculator.py} +0 -0
  73. {lionagi-0.12.3.dist-info → lionagi-0.12.5.dist-info}/WHEEL +0 -0
  74. {lionagi-0.12.3.dist-info → lionagi-0.12.5.dist-info}/licenses/LICENSE +0 -0
@@ -2,19 +2,11 @@ lionagi/__init__.py,sha256=wg2mLxXbJ5pQKrRMIEoQ0_BlHrxjuR1zmc3SAYN7PBc,513
2
2
  lionagi/_class_registry.py,sha256=pfUO1DjFZIqr3OwnNMkFqL_fiEBrrf8-swkGmP_KDLE,3112
3
3
  lionagi/_errors.py,sha256=JlBTFJnRWtVYcRxKb7fWFiJHLbykl1E19mSJ8sXYVxg,455
4
4
  lionagi/_types.py,sha256=iDdYewsP9rDrM7QY19_NDTcWUk7swp8vnGCrloHMtUM,53
5
+ lionagi/config.py,sha256=dAhDFKtaaSfn6WT9dwX9Vd4TWWs6-Su1FgYIrFgYcgc,3709
6
+ lionagi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
7
  lionagi/settings.py,sha256=W52mM34E6jXF3GyqCFzVREKZrmnUqtZm_BVDsUiDI_s,1627
6
8
  lionagi/utils.py,sha256=uLTJKl7aTnFXV6ehA6zwiwEB7G2nQYKsO2pZ6mqFzUk,78908
7
- lionagi/version.py,sha256=Qu8-91hLcRe7wfW37PwNdivTonHHKLrqtJPOAq3Jvhc,23
8
- lionagi/adapters/__init__.py,sha256=FJBV1Fb7GR9mcRApEB9bNP3IRMQ9Qjg5aVTouZFyTBU,45
9
- lionagi/adapters/adapter.py,sha256=aW7s1OKAdxHd8HBv2UcThn-r2Q08EyArssNyFobMLuA,3357
10
- lionagi/adapters/json_adapter.py,sha256=EJj0Jev46ZhU3ZMnlYwyzN2rLxjLCVrMDpHkEuggBvk,4561
11
- lionagi/adapters/toml_adapter.py,sha256=XOx0Q41g9FoNVuGrce96ck3gxPo4G-3mwqSin5kGq9s,5441
12
- lionagi/adapters/types.py,sha256=CHfB39BSeyU11SDkXXkU_vzqy4v7kaR-2r0y6DYkhXc,660
13
- lionagi/adapters/pandas_/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- lionagi/adapters/pandas_/csv_adapter.py,sha256=HWie6Jlt8nR-EVJC_zmCFilaWszLNuk7EWUp8Xvr-H8,2358
15
- lionagi/adapters/pandas_/excel_adapter.py,sha256=ZqRT2xF93NLKNyMp16ePNzwUN3ntNkUy1dO3nbsrfak,2287
16
- lionagi/adapters/pandas_/pd_dataframe_adapter.py,sha256=ULGZVhK5aaOuTrmFq4x5SiuDScYetyYYUHeL8Hh13Eg,2279
17
- lionagi/adapters/pandas_/pd_series_adapter.py,sha256=TX3cqFtgEip8JqVqkjdJYOu4PQGpW1yYU6POhvz8Jeg,1388
9
+ lionagi/version.py,sha256=QFQfu3CUVe9Ncr8kv3aaBY3oWrZmv8xboen_Uwy7eXU,23
18
10
  lionagi/fields/__init__.py,sha256=8oU7Vfk-fKiULFKqhM6VpJMqdZcVXPTM7twVfNDN_SQ,603
19
11
  lionagi/fields/action.py,sha256=iWSApCM77jS0Oc28lb7G601Etkp-yjx5U1hfI_FQgfA,5792
20
12
  lionagi/fields/base.py,sha256=5CJc7j8kTTWzXwpYzkSAFzx4BglABfx3AElIATKB7bg,3857
@@ -54,15 +46,16 @@ lionagi/libs/schema/extract_code_block.py,sha256=PuJbJj1JnqR5fSZudowPcVPpEoKISLr
54
46
  lionagi/libs/schema/extract_docstring.py,sha256=aYyLSRlB8lTH9QF9-6a56uph3AAkNuTyZ0S_duf5-fw,5729
55
47
  lionagi/libs/schema/function_to_schema.py,sha256=XAB031WbYu3a7eFJyYjXVMAjmtWYSYr5kC_DYgjiuyM,5604
56
48
  lionagi/libs/schema/json_schema.py,sha256=cuHcaMr748O9g6suNGmRx4tRXcidd5-c7AMGjTIZyHM,7670
49
+ lionagi/libs/schema/load_pydantic_model_from_schema.py,sha256=WwmOqo4mlSjClYb8s0jOr4PODeFz777TxfeyBnzZ3rc,10899
57
50
  lionagi/libs/token_transform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
51
  lionagi/libs/token_transform/base.py,sha256=LBnaDgi4HNgaJJGwIzWcQjVMdu49i_93rRvOvMU22Rw,1545
59
52
  lionagi/libs/token_transform/llmlingua.py,sha256=DkeLUlrb7rGx3nZ04aADU9HXXu5mZTf_DBwT0xhzIv4,7
60
- lionagi/libs/token_transform/perplexity.py,sha256=tcVRjPBX3nuVqsoTkowCf6RBXuybO--owH1lf2Ywj1s,14470
53
+ lionagi/libs/token_transform/perplexity.py,sha256=EcINACZyMZfWyU9ESS0eBaFby9y44YMgaDC_ANfDtkw,14436
61
54
  lionagi/libs/token_transform/symbolic_compress_context.py,sha256=J8UleoCRDBvbFvmss2JjOvJfuBT7LXUW7AsRB-oQq7c,4598
62
55
  lionagi/libs/token_transform/synthlang.py,sha256=W6e-_265UXqVosM9X0TLKW53rNHvWCKhsWbVAop49Ac,259
63
56
  lionagi/libs/token_transform/types.py,sha256=4HgAfNDlJ_Hu18kLt59GHr_76eF3xLpNCTbOXlAYVlA,491
64
57
  lionagi/libs/token_transform/synthlang_/base.py,sha256=GDle72c8EjFz_3hg_k-y0YmksBsn5TSRVTw5_cwfWTo,4109
65
- lionagi/libs/token_transform/synthlang_/translate_to_synthlang.py,sha256=lRBpeKGhyNlf8ngigjYAw56QbIAVZWLQUzRg2wpwMfQ,4956
58
+ lionagi/libs/token_transform/synthlang_/translate_to_synthlang.py,sha256=guA5v8CQRdAOsznsUSoK_x2JFzGbHE079AijDqqPPOw,4946
66
59
  lionagi/libs/token_transform/synthlang_/resources/frameworks/abstract_algebra.toml,sha256=2TuOAo97g8mNhdPH96HP8vYZpnC8neiP-KlhVqbp1Us,970
67
60
  lionagi/libs/token_transform/synthlang_/resources/frameworks/category_theory.toml,sha256=Stg9W3h8o7VkQ9tdAfSZmR3LctFqcH6OhOPdaw9BlIg,1064
68
61
  lionagi/libs/token_transform/synthlang_/resources/frameworks/complex_analysis.toml,sha256=iE6FS7Cn5_uJRG5-StLuMM4XVAk95bxhbYWwlstw_tA,1044
@@ -102,9 +95,9 @@ lionagi/operations/brainstorm/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5
102
95
  lionagi/operations/brainstorm/brainstorm.py,sha256=N9LpFZCdYn8L8AnTFOoMnjK7nkFrjgrfj2Vhz759dXM,18701
103
96
  lionagi/operations/brainstorm/prompt.py,sha256=Dqi4NNeztdI4iutggRqjnOrG4a4E2JtwIAtRnjZ_ghQ,610
104
97
  lionagi/operations/chat/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
105
- lionagi/operations/chat/chat.py,sha256=xJAH2H0zyVvxiL3XtW3MC6YrwCCB1uCkwcQIJ1YsIOk,5466
98
+ lionagi/operations/chat/chat.py,sha256=F5ugFtMm4OdNCQhaKN-0ezIcfInR_za5I7WbBC9qfzQ,5493
106
99
  lionagi/operations/communicate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
107
- lionagi/operations/communicate/communicate.py,sha256=dPaPqg898biY6j_FlgH4HEJxTK6T_87ixXWhD6kbk40,3077
100
+ lionagi/operations/communicate/communicate.py,sha256=J23XkCk_oUD-cGYOuy4stwrwbeiQYLnq2l8xNX2ri5U,3670
108
101
  lionagi/operations/instruct/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
109
102
  lionagi/operations/instruct/instruct.py,sha256=7pxhyP5jxwpgqjmQNb1rnGF4QAVlbMENpsyl22mbKRM,794
110
103
  lionagi/operations/interpret/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
@@ -112,7 +105,7 @@ lionagi/operations/interpret/interpret.py,sha256=8_F3oYaoYK8MDcK4iCwksBP7sI0UlgB
112
105
  lionagi/operations/operate/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
113
106
  lionagi/operations/operate/operate.py,sha256=cMc-n_uBPC8L8URIHHdR9N2LiwFlOiVv8yazmrFxX8g,7358
114
107
  lionagi/operations/parse/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
115
- lionagi/operations/parse/parse.py,sha256=Jvne8zuOqsgyXBxlH08EEEl-gb8-zkxvbihcwWKBW68,3295
108
+ lionagi/operations/parse/parse.py,sha256=xS9uIxBzHLGD-1VpBVgGUhxF-tQDkF2KLmIpErM47RQ,6661
116
109
  lionagi/operations/plan/__init__.py,sha256=yGBPll6lOqVjadbTvDLGrTlMx3FfBW-e00z7AMvg7Uo,156
117
110
  lionagi/operations/plan/plan.py,sha256=ndExZm_kE04i6npJq1rhyRdKaoXWpVk3F-dEN59I_94,15305
118
111
  lionagi/operations/plan/prompt.py,sha256=GUNZ8RpHIa89D-_y7GK--Spg0JADI3K13sjf_w3a2mI,993
@@ -137,13 +130,13 @@ lionagi/protocols/generic/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGv
137
130
  lionagi/protocols/generic/element.py,sha256=Eaij2YpTWsGk28Tqjazmjmc_tOnalH7_iGFZrL6QJb4,14420
138
131
  lionagi/protocols/generic/event.py,sha256=InjBd2K9aSYxgai1c20d4jaJOkEx5VGFfb7iZbiMiNA,5200
139
132
  lionagi/protocols/generic/log.py,sha256=vepclOaY3fdR1QgFDj9usOffsx9T-9PbgwXjTvm6twQ,7441
140
- lionagi/protocols/generic/pile.py,sha256=DfD1hOc7Mb3Iv-HMBPF9Y9HBjUYEJLUot-3AKniEjSo,31299
133
+ lionagi/protocols/generic/pile.py,sha256=L965LgVKhaxpEe_5dOwjYFZ1UAGeWmUtZ4Tf0MRznHw,33562
141
134
  lionagi/protocols/generic/processor.py,sha256=LTF9Enb-9jj5Wuy_jLanAhiesc5-Gm6WiSntZoAAm8w,10382
142
135
  lionagi/protocols/generic/progression.py,sha256=qlITq1qzV119iR5qR__fBAzV489S7d4t20E8uDRicEw,15189
143
136
  lionagi/protocols/graph/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
144
137
  lionagi/protocols/graph/edge.py,sha256=lgxeceoazM4Jl2Un_owLpJOanqw2m4XPk3-dXGp1u8g,5229
145
138
  lionagi/protocols/graph/graph.py,sha256=ks3zJWdwycUW_3Q4dz3f_ZLYhOALpg76t5J3HEzDcy4,10237
146
- lionagi/protocols/graph/node.py,sha256=cklw0PJcWPmFW8jGaZGT5enJDEkqulxRHgdMjRDKCl4,3799
139
+ lionagi/protocols/graph/node.py,sha256=_bQ9h_s_X6dVyV4pueEfiKiFapOkDL-HuH2MboUekYI,4250
147
140
  lionagi/protocols/mail/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
148
141
  lionagi/protocols/mail/exchange.py,sha256=P1PcrFylIBeiQa8kox9H1qyJ4kjhUlbLiTUT8rs1OXg,7041
149
142
  lionagi/protocols/mail/mail.py,sha256=RB5CUft_4J85H9nM9g6aRXomTaqKwF5xVjJacPAhoa8,1356
@@ -153,7 +146,7 @@ lionagi/protocols/mail/package.py,sha256=DyedMJaCRp4kf9MJtprcrN55rPoSR_v6MXdbINo
153
146
  lionagi/protocols/messages/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
154
147
  lionagi/protocols/messages/action_request.py,sha256=-tG9ViTSiZ2beM0onE6C552H5oth-sHLHP6KsBV8OMk,6868
155
148
  lionagi/protocols/messages/action_response.py,sha256=SM3_vA9QPXz3Gc9uPhXm3zOXYheHZZGtl67Yff48Vu8,5272
156
- lionagi/protocols/messages/assistant_response.py,sha256=LTSmW9ZbDnV6tSjNMoecICI2_wqNirG5D4CT1IpDtvs,5797
149
+ lionagi/protocols/messages/assistant_response.py,sha256=6bNyY2YkFHKPY3HECSb8Tj82dW4-VA5yVs2P3M_MM4Q,6796
157
150
  lionagi/protocols/messages/base.py,sha256=Ng1Q8yIIIFauUv53LnwDeyOrM-cSCfsHM1GwkxChf2o,2317
158
151
  lionagi/protocols/messages/instruction.py,sha256=0dUsUYd6xYsbOHU7GafvqBkpDQQoFOXJXT-UoJArYWU,21146
159
152
  lionagi/protocols/messages/manager.py,sha256=e1jW5JH_3jZpZbFCvWZX0TG0DCgzANRUejW_6NqbtDc,17182
@@ -170,45 +163,41 @@ lionagi/protocols/operatives/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5Z
170
163
  lionagi/protocols/operatives/operative.py,sha256=PXEMzD6tFM5PPK9kkPaSb7DBIzy7TNC3f2evuGhWhpg,6677
171
164
  lionagi/protocols/operatives/step.py,sha256=AXXRhjsbWqkoMDQ_JyqsfQItQsjBJmldugJz36mA4N0,9772
172
165
  lionagi/service/__init__.py,sha256=DMGXIqPsmut9H5GT0ZeSzQIzYzzPwI-2gLXydpbwiV8,21
173
- lionagi/service/imodel.py,sha256=OaoEsL1SrltEqDR-dCDSKzEy2wF8BUNnCc-3fsJmESE,15289
174
- lionagi/service/manager.py,sha256=FkuqAtLErqLmXNnDtuAdTUFo4uuE_VL660BBGBhzInU,1435
175
- lionagi/service/types.py,sha256=CHPi8Bxl_yJ1pl2jYZBOrTHbT8_oO9sK75d4LMB651g,486
176
- lionagi/service/endpoints/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
177
- lionagi/service/endpoints/base.py,sha256=lIxjzGIIVu9AQ_FdgR_u7XKDZXrJNfEZbGahmq3crFo,26126
178
- lionagi/service/endpoints/chat_completion.py,sha256=nihV7kCYm7ixdm8dH0JW7vKjqH9yIom4QDXGeDwuO6E,2964
179
- lionagi/service/endpoints/match_endpoint.py,sha256=x2T-ftzdqCrdITRLkH8UNRDY2Pm359DnX2RDXTBnbpc,2082
180
- lionagi/service/endpoints/rate_limited_processor.py,sha256=-hBWStV3W57emw4AmXJBLM20NapFPLwiXmLX3p6tNrE,5187
181
- lionagi/service/endpoints/token_calculator.py,sha256=zpbk1YlFW5M_e-vs9YJyhDThMm3U3IaZ7hKm-_6XrDU,6460
182
- lionagi/service/providers/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
183
- lionagi/service/providers/types.py,sha256=NS91ysRFwOs0cpNeQgFhmtl7JrSz2pJm-tt7sZILmQY,683
184
- lionagi/service/providers/anthropic_/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
185
- lionagi/service/providers/anthropic_/messages.py,sha256=EnV2vh60k0aQvtnUitHzTlSmyrFxTVxcXAldANg7Rzc,3148
186
- lionagi/service/providers/exa_/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
187
- lionagi/service/providers/exa_/models.py,sha256=263KP-JSxbxmomNrFeYjB_cebquoMOsCJeWsiKZ0mL4,5420
188
- lionagi/service/providers/exa_/search.py,sha256=Z3pyJH8KiWiquJSJw8Rd6D7x43BwTFHb2ESsgSicCk0,1932
189
- lionagi/service/providers/exa_/types.py,sha256=8ODjXpFajBE9-DGqBJNS--GObwmLSDi667xS84z_AgA,139
190
- lionagi/service/providers/groq_/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
191
- lionagi/service/providers/groq_/chat_completions.py,sha256=q1p_1qus4vduWWBzs9V_KbNrqU2Tu2o8TZm6Fh09fw4,1343
192
- lionagi/service/providers/ollama_/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
193
- lionagi/service/providers/ollama_/chat_completions.py,sha256=hsxgmMq-ujGAlrNQ3pF8q2hA9BVqol7HObGu9kR_t4s,3796
194
- lionagi/service/providers/openai_/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
195
- lionagi/service/providers/openai_/chat_completions.py,sha256=CxALMCOP3KH16O583xngkAfFot8Hvbr_o1HeLvCh0Us,2938
196
- lionagi/service/providers/openai_/spec.py,sha256=GJkndsSQmGT-DpSnePz077HK7YQ-xp6-SCTlws6RRf0,217
197
- lionagi/service/providers/openrouter_/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
198
- lionagi/service/providers/openrouter_/chat_completions.py,sha256=0pdXjJCXmCPPbKKVubrnqofaodTOxWTJam8fd3NgrNk,1525
199
- lionagi/service/providers/perplexity_/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
200
- lionagi/service/providers/perplexity_/chat_completions.py,sha256=O4MIS_3xIINGjkAZdlw0Bu_jAfBDR4VZA1F8JW2EU1M,1197
201
- lionagi/service/providers/perplexity_/models.py,sha256=Fm5NbmWMdFkDKS0Cec__bNvs3St27lgqxFbHKyNCLsw,4945
166
+ lionagi/service/imodel.py,sha256=ho5vINb0xQVOmUsZj1TR4hfXsfNPqsyW1tfDH2Us-nU,11211
167
+ lionagi/service/manager.py,sha256=9-dIE4ZftI94RLLLPXH-yB4E3zfnbTs3yppdFDPNchM,1165
168
+ lionagi/service/rate_limited_processor.py,sha256=PnO0rBf9ObKhD3vtl6pYZX3nHVDvMPdOww59zCWgslQ,5230
169
+ lionagi/service/resilience.py,sha256=uYJYZQ9M-tje8ME3vJmYabXwKHF1c3Ij4-WrdCwogcs,18742
170
+ lionagi/service/token_calculator.py,sha256=zpbk1YlFW5M_e-vs9YJyhDThMm3U3IaZ7hKm-_6XrDU,6460
171
+ lionagi/service/types.py,sha256=6zavqBxK1Fj0nB9eZgJn3JICxmdT-n0nn8YWZFzM5LU,508
172
+ lionagi/service/connections/__init__.py,sha256=yHQZ7OJpCftd6CStYR8inbxjJydYdmv9kCvbUBhJ2zU,362
173
+ lionagi/service/connections/api_calling.py,sha256=KMO4BQf3z-WM2-pG2lhoNzxMb-zzCMKMhbrQPOPIwgI,7929
174
+ lionagi/service/connections/endpoint.py,sha256=HqeLUP0XvUrPpsHraYbKXO9EUIuoivChWju30dVgFrs,14494
175
+ lionagi/service/connections/endpoint_config.py,sha256=jCgMOujN5KzQ2miOrfEqKrVZW3jlZEgBp2R3_2sXynI,4380
176
+ lionagi/service/connections/header_factory.py,sha256=22sG4ian3MiNklF6SdQqkEYgtWKOZik_yDE0Lna6BiE,1754
177
+ lionagi/service/connections/match_endpoint.py,sha256=lwFFpiEfkaMuznjQcqfJlvDLm5EVUs9scAnthVghPuY,1571
178
+ lionagi/service/connections/providers/__init__.py,sha256=3lzOakDoBWmMaNnT2g-YwktPKa_Wme4lnPRSmOQfayY,105
179
+ lionagi/service/connections/providers/anthropic_.py,sha256=SUPnw2UqjY5wuHXLHas6snMTzhQ-UuixvPYbkVnXn34,3083
180
+ lionagi/service/connections/providers/exa_.py,sha256=GGWaD9jd5gKM257OfUaIBBKIqR1NrNcBE67p_7JbK7g,938
181
+ lionagi/service/connections/providers/oai_.py,sha256=rKZdGufX4vpj88rr98KqoOHzHa7HgH_pCVWjCqAq-XU,4971
182
+ lionagi/service/connections/providers/ollama_.py,sha256=jdx6dGeChwVk5TFfFRbpnrpKzj8YQZw6D5iWJ6zYmfk,4096
183
+ lionagi/service/connections/providers/perplexity_.py,sha256=9MH9YmMy9Jg7JDMJHQxxMYHyjJ4NP0OlN7sCuhla85I,917
184
+ lionagi/service/third_party/README.md,sha256=qFjWnI8rmLivIyr6Tc-hRZh-rQwntROp76af4MBNJJc,2214
185
+ lionagi/service/third_party/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
186
+ lionagi/service/third_party/anthropic_models.py,sha256=wA2NiiPJzkkVF_-wFgnTJoKwvuoduqHw-yVSetp0XZI,4014
187
+ lionagi/service/third_party/exa_models.py,sha256=G_hnekcy-DillPLzMoDQ8ZisVAL8Mp7iMAK4xqAT_3w,5470
188
+ lionagi/service/third_party/openai_models.py,sha256=sF-fQ726CnaDBgLY_r2NdPqc3GicPKhZjh5F8IfjBO0,501904
189
+ lionagi/service/third_party/pplx_models.py,sha256=Nkm1ftESBa_NwP9ITBUNqLmAZ3Jh92aL732g_i6T8LQ,5947
202
190
  lionagi/session/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
203
- lionagi/session/branch.py,sha256=-4VZJna20HrftkVJoYiEgCb4HrUlP6aBRA-XlrHageQ,69722
191
+ lionagi/session/branch.py,sha256=APvq4vQvlk6nPOWezL7sY59h2T-ndxONuBwYvu5ZcsA,69942
204
192
  lionagi/session/prompts.py,sha256=AhuHL19s0TijVZX3tMKUKMi6l88xeVdpkuEn2vJSRyU,3236
205
193
  lionagi/session/session.py,sha256=4Rk5_DB9y-yaqyfQ9tHYOMUy_0HCgCoGqeSc2Y5riu0,9172
206
194
  lionagi/tools/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
207
195
  lionagi/tools/base.py,sha256=cld32pyjaTUdyiqZ8hNyJjWKAhcJ8RQNhgImI7R8b-E,1940
208
196
  lionagi/tools/types.py,sha256=XtJLY0m-Yi_ZLWhm0KycayvqMCZd--HxfQ0x9vFUYDE,230
209
197
  lionagi/tools/file/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
210
- lionagi/tools/file/reader.py,sha256=K0PtEI1s-Ol-uthBUdGFzDLrQNFr4l1bRkosn2jios8,9539
211
- lionagi-0.12.3.dist-info/METADATA,sha256=YTtNnMWbydX_OzuGlBuYNztS6j54NQf3rlfntX0L4rI,19154
212
- lionagi-0.12.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
213
- lionagi-0.12.3.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
214
- lionagi-0.12.3.dist-info/RECORD,,
198
+ lionagi/tools/file/reader.py,sha256=0TdnfVGVCKuM58MmGM-NyVjhU9BFoitkNYEepdc0z_Y,9529
199
+ lionagi/tools/memory/tools.py,sha256=zTGBenVsF8Wuh303kWntmQSGlAFKonHNdh5ePuQ26KE,15948
200
+ lionagi-0.12.5.dist-info/METADATA,sha256=0vHIkYR3nyKPKxuivRY8XjNiVBk0UP0KvEbY2cxscEY,18960
201
+ lionagi-0.12.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
202
+ lionagi-0.12.5.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
203
+ lionagi-0.12.5.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- """deprecated, will be removed in v0.13.0"""
@@ -1,120 +0,0 @@
1
- # Copyright (c) 2023 - 2025, HaiyangLi <quantocean.li at gmail dot com>
2
- #
3
- # SPDX-License-Identifier: Apache-2.0
4
-
5
- """
6
- Defines the `Adapter` protocol (a formal interface), along with the
7
- `AdapterRegistry` that maps string/file extensions or object keys to
8
- specific adapter implementations.
9
- """
10
-
11
- import logging
12
- from typing import Any, Protocol, TypeVar, runtime_checkable
13
-
14
- from typing_extensions import get_protocol_members
15
-
16
- T = TypeVar("T")
17
-
18
- __all__ = (
19
- "Adapter",
20
- "ADAPTER_MEMBERS",
21
- "AdapterRegistry",
22
- )
23
-
24
-
25
- @runtime_checkable
26
- class Adapter(Protocol):
27
- """
28
- Describes a two-way converter that knows how to transform an object
29
- from an external representation to an internal format, and vice versa.
30
-
31
- Attributes
32
- ----------
33
- obj_key : str
34
- A unique key or extension that identifies what format this
35
- adapter supports (e.g. ".csv", "json", "pd_dataframe").
36
-
37
- Methods
38
- -------
39
- from_obj(subj_cls: type[T], obj: Any, /, many: bool, **kwargs) -> dict|list[dict]
40
- Converts a raw external object (file contents, JSON string, etc.)
41
- into a dictionary or list of dictionaries.
42
- to_obj(subj: T, /, many: bool, **kwargs) -> Any
43
- Converts an internal object (e.g., a Pydantic-based model)
44
- into the target format (file, JSON, DataFrame, etc.).
45
- """
46
-
47
- obj_key: str
48
-
49
- @classmethod
50
- def from_obj(
51
- cls,
52
- subj_cls: type[T],
53
- obj: Any,
54
- /,
55
- *,
56
- many: bool,
57
- **kwargs,
58
- ) -> dict | list[dict]: ...
59
-
60
- @classmethod
61
- def to_obj(
62
- cls,
63
- subj: T,
64
- /,
65
- *,
66
- many: bool,
67
- **kwargs,
68
- ) -> Any: ...
69
-
70
-
71
- ADAPTER_MEMBERS = get_protocol_members(Adapter) # duck typing
72
-
73
-
74
- class AdapterRegistry:
75
-
76
- _adapters: dict[str, Adapter] = {}
77
-
78
- @classmethod
79
- def list_adapters(cls) -> list[tuple[str | type, ...]]:
80
- return list(cls._adapters.keys())
81
-
82
- @classmethod
83
- def register(cls, adapter: type[Adapter]) -> None:
84
- for member in ADAPTER_MEMBERS:
85
- if not hasattr(adapter, member):
86
- _str = getattr(adapter, "obj_key", None) or repr(adapter)
87
- _str = _str[:50] if len(_str) > 50 else _str
88
- raise AttributeError(
89
- f"Adapter {_str} missing required methods."
90
- )
91
-
92
- if isinstance(adapter, type):
93
- cls._adapters[adapter.obj_key] = adapter()
94
- else:
95
- cls._adapters[adapter.obj_key] = adapter
96
-
97
- @classmethod
98
- def get(cls, obj_key: type | str) -> Adapter:
99
- try:
100
- return cls._adapters[obj_key]
101
- except Exception as e:
102
- logging.error(f"Error getting adapter for {obj_key}. Error: {e}")
103
-
104
- @classmethod
105
- def adapt_from(
106
- cls, subj_cls: type[T], obj: Any, obj_key: type | str, **kwargs
107
- ) -> dict | list[dict]:
108
- try:
109
- return cls.get(obj_key).from_obj(subj_cls, obj, **kwargs)
110
- except Exception as e:
111
- logging.error(f"Error adapting data from {obj_key}. Error: {e}")
112
- raise e
113
-
114
- @classmethod
115
- def adapt_to(cls, subj: T, obj_key: type | str, **kwargs) -> Any:
116
- try:
117
- return cls.get(obj_key).to_obj(subj, **kwargs)
118
- except Exception as e:
119
- logging.error(f"Error adapting data to {obj_key}. Error: {e}")
120
- raise e
@@ -1,181 +0,0 @@
1
- """
2
- Implements two adapters:
3
- - `JsonAdapter` for in-memory JSON strings
4
- - `JsonFileAdapter` for reading/writing JSON files
5
- """
6
-
7
- import json
8
- import logging
9
- from pathlib import Path
10
-
11
- from lionagi.protocols._concepts import Collective
12
-
13
- from .adapter import Adapter, T
14
-
15
-
16
- class JsonAdapter(Adapter):
17
- """
18
- Adapter that converts to/from JSON **strings** in memory.
19
- Example usage: taking a Python dictionary and making JSON,
20
- or parsing JSON string to a dict.
21
- """
22
-
23
- obj_key = "json"
24
-
25
- @classmethod
26
- def from_obj(
27
- cls,
28
- subj_cls: type[T],
29
- obj: str,
30
- /,
31
- *,
32
- many: bool = False,
33
- **kwargs,
34
- ) -> dict | list[dict]:
35
- """
36
- Convert a JSON string into a dict or list of dicts.
37
-
38
- Parameters
39
- ----------
40
- subj_cls : type[T]
41
- The target class for context (not always used).
42
- obj : str
43
- The JSON string.
44
- many : bool, optional
45
- If True, expects a JSON array (returns list[dict]).
46
- Otherwise returns a single dict or the first element.
47
- **kwargs
48
- Extra arguments for json.loads().
49
-
50
- Returns
51
- -------
52
- dict | list[dict]
53
- The loaded JSON data.
54
- """
55
- result = json.loads(obj, **kwargs)
56
- if many:
57
- return result if isinstance(result, list) else [result]
58
- if isinstance(result, list) and len(result) > 0:
59
- return result[0]
60
- return result
61
-
62
- @classmethod
63
- def to_obj(
64
- cls,
65
- subj: T,
66
- *,
67
- many: bool = False,
68
- **kwargs,
69
- ) -> str:
70
- """
71
- Convert an object (or collection) to a JSON string.
72
-
73
- Parameters
74
- ----------
75
- subj : T
76
- The object to serialize.
77
- many : bool, optional
78
- If True, convert multiple items to a JSON array.
79
- **kwargs
80
- Extra arguments for json.dumps().
81
-
82
- Returns
83
- -------
84
- str
85
- The resulting JSON string.
86
- """
87
- if many:
88
- if isinstance(subj, Collective):
89
- data = [i.to_dict() for i in subj]
90
- else:
91
- data = [subj.to_dict()]
92
- return json.dumps(data, **kwargs)
93
- return json.dumps(subj.to_dict(), **kwargs)
94
-
95
-
96
- class JsonFileAdapter(Adapter):
97
- """
98
- Adapter that reads/writes JSON data to/from a file on disk.
99
- The file extension key is ".json".
100
- """
101
-
102
- obj_key = ".json"
103
-
104
- @classmethod
105
- def from_obj(
106
- cls,
107
- subj_cls: type[T],
108
- obj: str | Path,
109
- /,
110
- *,
111
- many: bool = False,
112
- **kwargs,
113
- ) -> dict | list[dict]:
114
- """
115
- Read a JSON file from disk and return a dict or list of dicts.
116
-
117
- Parameters
118
- ----------
119
- subj_cls : type[T]
120
- The target class for context.
121
- obj : str | Path
122
- The JSON file path.
123
- many : bool
124
- If True, expects a list. Otherwise single dict or first element.
125
- **kwargs
126
- Extra arguments for json.load().
127
-
128
- Returns
129
- -------
130
- dict | list[dict]
131
- The loaded data from file.
132
- """
133
- with open(obj, encoding="utf-8") as f:
134
- result = json.load(f, **kwargs)
135
- if many:
136
- return result if isinstance(result, list) else [result]
137
- if isinstance(result, list) and len(result) > 0:
138
- return result[0]
139
- return result
140
-
141
- @classmethod
142
- def to_obj(
143
- cls,
144
- subj: T,
145
- /,
146
- *,
147
- fp: str | Path,
148
- many: bool = False,
149
- mode: str = "w",
150
- **kwargs,
151
- ) -> None:
152
- """
153
- Write a dict (or list) to a JSON file.
154
-
155
- Parameters
156
- ----------
157
- subj : T
158
- The object/collection to serialize.
159
- fp : str | Path
160
- The file path to write.
161
- many : bool
162
- If True, write as a JSON array of multiple items.
163
- **kwargs
164
- Extra arguments for json.dump().
165
-
166
- Returns
167
- -------
168
- None
169
- """
170
- with open(fp, mode, encoding="utf-8") as f:
171
- if many:
172
- if isinstance(subj, Collective):
173
- json.dump([i.to_dict() for i in subj], f, **kwargs)
174
- else:
175
- json.dump([subj.to_dict()], f, **kwargs)
176
- else:
177
- json.dump(subj.to_dict(), f, **kwargs)
178
- logging.info(f"JSON data saved to {fp}")
179
-
180
-
181
- # File: lionagi/protocols/adapters/json_adapter.py
@@ -1,94 +0,0 @@
1
- import logging
2
- from pathlib import Path
3
-
4
- import pandas as pd
5
-
6
- from lionagi.protocols._concepts import Collective
7
-
8
- from ..adapter import Adapter, T
9
-
10
-
11
- class CSVFileAdapter(Adapter):
12
- """
13
- Reads/writes CSV files to a list of dicts or vice versa,
14
- using `pandas`.
15
- """
16
-
17
- obj_key = ".csv"
18
-
19
- @classmethod
20
- def from_obj(
21
- cls,
22
- subj_cls: type[T],
23
- obj: str | Path,
24
- /,
25
- *,
26
- many: bool = False,
27
- **kwargs,
28
- ) -> list[dict]:
29
- """
30
- Read a CSV file into a list of dictionaries.
31
-
32
- Parameters
33
- ----------
34
- subj_cls : type[T]
35
- The target class for context (not used).
36
- obj : str | Path
37
- The CSV file path.
38
- many : bool, optional
39
- If True, returns list[dict]; if False, returns only
40
- the first dict.
41
- **kwargs
42
- Additional options for `pd.read_csv`.
43
-
44
- Returns
45
- -------
46
- list[dict]
47
- The parsed CSV data as a list of row dictionaries.
48
- """
49
- df: pd.DataFrame = pd.read_csv(obj, **kwargs)
50
- dicts_ = df.to_dict(orient="records")
51
- if many:
52
- return dicts_
53
- return dicts_[0] if len(dicts_) > 0 else {}
54
-
55
- @classmethod
56
- def to_obj(
57
- cls,
58
- subj: T,
59
- /,
60
- *,
61
- fp: str | Path,
62
- many: bool = False,
63
- **kwargs,
64
- ) -> None:
65
- """
66
- Write an object's data to a CSV file.
67
-
68
- Parameters
69
- ----------
70
- subj : T
71
- The item(s) to convert. If `many=True`, can be a Collective.
72
- fp : str | Path
73
- File path to write the CSV.
74
- many : bool
75
- If True, we assume a collection of items, else a single item.
76
- **kwargs
77
- Extra params for `DataFrame.to_csv`.
78
-
79
- Returns
80
- -------
81
- None
82
- """
83
- kwargs["index"] = False # By default, do not save index
84
- if many:
85
- if isinstance(subj, Collective):
86
- pd.DataFrame([i.to_dict() for i in subj]).to_csv(fp, **kwargs)
87
- else:
88
- pd.DataFrame([subj.to_dict()]).to_csv(fp, **kwargs)
89
- else:
90
- pd.DataFrame([subj.to_dict()]).to_csv(fp, **kwargs)
91
- logging.info(f"CSV data saved to {fp}")
92
-
93
-
94
- # File: lionagi/protocols/adapters/pandas_/csv_adapter.py
@@ -1,94 +0,0 @@
1
- """
2
- Provides an ExcelFileAdapter for reading/writing Excel (.xlsx) files
3
- via pandas.
4
- """
5
-
6
- import logging
7
- from pathlib import Path
8
-
9
- import pandas as pd
10
-
11
- from lionagi.protocols._concepts import Collective
12
-
13
- from ..adapter import Adapter, T
14
-
15
-
16
- class ExcelFileAdapter(Adapter):
17
- """
18
- Reads/writes Excel (XLSX) files, using `pandas`.
19
- """
20
-
21
- obj_key = ".xlsx"
22
-
23
- @classmethod
24
- def from_obj(
25
- cls,
26
- subj_cls: type[T],
27
- obj: str | Path,
28
- /,
29
- *,
30
- many: bool = False,
31
- **kwargs,
32
- ) -> list[dict]:
33
- """
34
- Read an Excel file into a list of dictionaries.
35
-
36
- Parameters
37
- ----------
38
- subj_cls : type[T]
39
- Target class for context.
40
- obj : str | Path
41
- The Excel file path.
42
- many : bool, optional
43
- If True, returns list[dict]. If False, returns single dict or first element.
44
- **kwargs
45
- Additional options for `pd.read_excel`.
46
-
47
- Returns
48
- -------
49
- list[dict]
50
- """
51
- df: pd.DataFrame = pd.read_excel(obj, **kwargs)
52
- dicts_ = df.to_dict(orient="records")
53
- if many:
54
- return dicts_
55
- return dicts_[0] if len(dicts_) > 0 else {}
56
-
57
- @classmethod
58
- def to_obj(
59
- cls,
60
- subj: T,
61
- /,
62
- *,
63
- fp: str | Path,
64
- many: bool = False,
65
- **kwargs,
66
- ) -> None:
67
- """
68
- Write data to an Excel file.
69
-
70
- Parameters
71
- ----------
72
- subj : T
73
- The object(s) to convert to Excel rows.
74
- fp : str | Path
75
- Path to save the XLSX file.
76
- many : bool
77
- If True, writes multiple items (e.g., a Collective).
78
- **kwargs
79
- Extra parameters for `DataFrame.to_excel`.
80
- """
81
- kwargs["index"] = False
82
- if many:
83
- if isinstance(subj, Collective):
84
- pd.DataFrame([i.to_dict() for i in subj]).to_excel(
85
- fp, **kwargs
86
- )
87
- else:
88
- pd.DataFrame([subj.to_dict()]).to_excel(fp, **kwargs)
89
- else:
90
- pd.DataFrame([subj.to_dict()]).to_excel(fp, **kwargs)
91
- logging.info(f"Excel data saved to {fp}")
92
-
93
-
94
- # File: lionagi/protocols/adapters/pandas_/excel_adapter.py