lionagi 0.6.0__py3-none-any.whl → 0.7.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. lionagi/__init__.py +2 -0
  2. lionagi/libs/token_transform/__init__.py +0 -0
  3. lionagi/libs/token_transform/llmlingua.py +1 -0
  4. lionagi/libs/token_transform/perplexity.py +439 -0
  5. lionagi/libs/token_transform/synthlang.py +409 -0
  6. lionagi/operations/ReAct/ReAct.py +126 -0
  7. lionagi/operations/ReAct/utils.py +28 -0
  8. lionagi/operations/__init__.py +1 -9
  9. lionagi/operations/_act/act.py +73 -0
  10. lionagi/operations/chat/__init__.py +3 -0
  11. lionagi/operations/chat/chat.py +173 -0
  12. lionagi/operations/communicate/__init__.py +0 -0
  13. lionagi/operations/communicate/communicate.py +167 -0
  14. lionagi/operations/instruct/__init__.py +3 -0
  15. lionagi/operations/instruct/instruct.py +29 -0
  16. lionagi/operations/interpret/__init__.py +3 -0
  17. lionagi/operations/interpret/interpret.py +40 -0
  18. lionagi/operations/operate/__init__.py +3 -0
  19. lionagi/operations/operate/operate.py +189 -0
  20. lionagi/operations/parse/__init__.py +3 -0
  21. lionagi/operations/parse/parse.py +125 -0
  22. lionagi/operations/plan/plan.py +3 -3
  23. lionagi/operations/select/__init__.py +0 -4
  24. lionagi/operations/select/select.py +11 -30
  25. lionagi/operations/select/utils.py +13 -2
  26. lionagi/operations/translate/__init__.py +0 -0
  27. lionagi/operations/translate/translate.py +47 -0
  28. lionagi/operations/types.py +25 -3
  29. lionagi/operatives/action/function_calling.py +1 -1
  30. lionagi/operatives/action/manager.py +22 -26
  31. lionagi/operatives/action/tool.py +1 -1
  32. lionagi/operatives/strategies/__init__.py +3 -0
  33. lionagi/{operations → operatives}/strategies/params.py +18 -2
  34. lionagi/protocols/adapters/__init__.py +0 -0
  35. lionagi/protocols/adapters/adapter.py +95 -0
  36. lionagi/protocols/adapters/json_adapter.py +101 -0
  37. lionagi/protocols/adapters/pandas_/__init__.py +0 -0
  38. lionagi/protocols/adapters/pandas_/csv_adapter.py +50 -0
  39. lionagi/protocols/adapters/pandas_/excel_adapter.py +52 -0
  40. lionagi/protocols/adapters/pandas_/pd_dataframe_adapter.py +31 -0
  41. lionagi/protocols/adapters/pandas_/pd_series_adapter.py +17 -0
  42. lionagi/protocols/adapters/types.py +18 -0
  43. lionagi/protocols/generic/pile.py +22 -1
  44. lionagi/protocols/graph/node.py +17 -1
  45. lionagi/protocols/types.py +3 -3
  46. lionagi/service/__init__.py +1 -14
  47. lionagi/service/endpoints/base.py +1 -1
  48. lionagi/service/endpoints/rate_limited_processor.py +2 -1
  49. lionagi/service/manager.py +1 -1
  50. lionagi/service/types.py +18 -0
  51. lionagi/session/branch.py +1098 -929
  52. lionagi/version.py +1 -1
  53. {lionagi-0.6.0.dist-info → lionagi-0.7.0.dist-info}/METADATA +4 -4
  54. {lionagi-0.6.0.dist-info → lionagi-0.7.0.dist-info}/RECORD +66 -38
  55. lionagi/libs/compress/models.py +0 -66
  56. lionagi/libs/compress/utils.py +0 -69
  57. lionagi/operations/select/prompt.py +0 -5
  58. lionagi/protocols/_adapter.py +0 -224
  59. /lionagi/{libs/compress → operations/ReAct}/__init__.py +0 -0
  60. /lionagi/operations/{strategies → _act}/__init__.py +0 -0
  61. /lionagi/{operations → operatives}/strategies/base.py +0 -0
  62. /lionagi/{operations → operatives}/strategies/concurrent.py +0 -0
  63. /lionagi/{operations → operatives}/strategies/concurrent_chunk.py +0 -0
  64. /lionagi/{operations → operatives}/strategies/concurrent_sequential_chunk.py +0 -0
  65. /lionagi/{operations → operatives}/strategies/sequential.py +0 -0
  66. /lionagi/{operations → operatives}/strategies/sequential_chunk.py +0 -0
  67. /lionagi/{operations → operatives}/strategies/sequential_concurrent_chunk.py +0 -0
  68. /lionagi/{operations → operatives}/strategies/utils.py +0 -0
  69. {lionagi-0.6.0.dist-info → lionagi-0.7.0.dist-info}/WHEEL +0 -0
  70. {lionagi-0.6.0.dist-info → lionagi-0.7.0.dist-info}/licenses/LICENSE +0 -0
lionagi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.6.0"
1
+ __version__ = "0.7.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lionagi
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: An AGentic Intelligence Operating System.
5
5
  Author-email: HaiyangLi <quantocean.li@gmail.com>
6
6
  License: Apache License
@@ -217,13 +217,13 @@ Classifier: Programming Language :: Python :: 3 :: Only
217
217
  Classifier: Programming Language :: Python :: 3.11
218
218
  Classifier: Programming Language :: Python :: 3.12
219
219
  Classifier: Programming Language :: Python :: 3.13
220
- Requires-Python: >=3.11
220
+ Requires-Python: >=3.10
221
221
  Requires-Dist: aiocache>=0.12.0
222
222
  Requires-Dist: aiohttp>=3.11.0
223
223
  Requires-Dist: jinja2>=3.1.0
224
224
  Requires-Dist: litellm>=1.55.3
225
225
  Requires-Dist: pandas>=2.0.0
226
- Requires-Dist: pillow>=11.0.0
226
+ Requires-Dist: pillow>=10.0.0
227
227
  Requires-Dist: pydantic>=2.0.0
228
228
  Requires-Dist: python-dotenv>=1.0.1
229
229
  Description-Content-Type: text/markdown
@@ -232,7 +232,7 @@ Description-Content-Type: text/markdown
232
232
  ![PyPI - Downloads](https://img.shields.io/pypi/dm/lionagi?color=blue)
233
233
  ![Python Version](https://img.shields.io/badge/python-3.10%2B-blue)
234
234
 
235
- [Documentation](https://ocean-lion.com/Welcome) | [Discord](https://discord.gg/aqSJ2v46vu) | [PyPI](https://pypi.org/project/lionagi/) | [Roadmap](https://trello.com/b/3seomsrI/lionagi)
235
+ [Documentation](https://lion-agi.github.io/lionagi/) | [Discord](https://discord.gg/aqSJ2v46vu) | [PyPI](https://pypi.org/project/lionagi/) | [Roadmap](https://trello.com/b/3seomsrI/lionagi)
236
236
 
237
237
  # LION Framework
238
238
  ### Language InterOperable Network - The Future of Controlled AI Operations
@@ -1,14 +1,11 @@
1
- lionagi/__init__.py,sha256=l4FOohHV6hKyCsbrbUabbXbu-yHSGNO_0wmRSPT_QT4,488
1
+ lionagi/__init__.py,sha256=sBS47lQGuXNAdfSoVLW8szKbCfDWrfAceMMUVYNK3IU,541
2
2
  lionagi/_class_registry.py,sha256=dutMsw-FQNqVV5gGH-NEIv90uBkSr8fERJ_x3swbb-s,3112
3
3
  lionagi/_errors.py,sha256=wNKdnVQvE_CHEstK7htrrj334RA_vbGcIds-3pUiRkc,455
4
4
  lionagi/settings.py,sha256=k9zRJXv57TveyfHO3Vr9VGiKrSwlRUUVKt5zf6v9RU4,1627
5
5
  lionagi/utils.py,sha256=hBlGmi8Px_ng3v4_D_k8xNpW3X93u01930lkZIHUQ-Y,73019
6
- lionagi/version.py,sha256=cID1jLnC_vj48GgMN6Yb1FA3JsQ95zNmCHmRYE8TFhY,22
6
+ lionagi/version.py,sha256=RaANGbRu5e-vehwXI1-Qe2ggPPfs1TQaZj072JdbLk4,22
7
7
  lionagi/libs/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
8
8
  lionagi/libs/parse.py,sha256=tpEbmIRGuHhLCJlUlm6fjmqm_Z6XJLAXGNFHNuk422I,1011
9
- lionagi/libs/compress/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
10
- lionagi/libs/compress/models.py,sha256=MJ5hmRjzlWIyKbkFpkUXjgi8kvGXPUoIvgdVZXUnUZ8,1906
11
- lionagi/libs/compress/utils.py,sha256=QZQWB-lJiarqlr0fiRN6yUdOddGsqK89qvPWT2YsMM0,1802
12
9
  lionagi/libs/file/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
13
10
  lionagi/libs/file/chunk.py,sha256=YS1EZXQFnYlFLKMveLXHKWZGk43vtLjuYb8D663T4IA,8835
14
11
  lionagi/libs/file/file_ops.py,sha256=_h30SBV-Es4-X7c5iPoRE3oQFu_V7OIxWQVU7c5UQvw,3430
@@ -36,45 +33,57 @@ lionagi/libs/schema/extract_code_block.py,sha256=ZfOFh6psjYyS9nm7zJoMMUYBkFPh9-J
36
33
  lionagi/libs/schema/extract_docstring.py,sha256=VbxB4ZDsaZAMc0r8hphdvSsqXSyJ2w80zloAUirGFts,5729
37
34
  lionagi/libs/schema/function_to_schema.py,sha256=_wuuZOxohCDdJCPnUi8_YobJ47XRVI5HjrwnWO_3xeQ,3393
38
35
  lionagi/libs/schema/json_schema.py,sha256=Z45azAI_7lr5BWj-X6VQwUhuvuqXibciXgla8wi4gPY,7670
36
+ lionagi/libs/token_transform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
+ lionagi/libs/token_transform/llmlingua.py,sha256=DkeLUlrb7rGx3nZ04aADU9HXXu5mZTf_DBwT0xhzIv4,7
38
+ lionagi/libs/token_transform/perplexity.py,sha256=XX-RoqGbeVYSl7fG1T_hF3I2pCAJ0A1LSKkrUpqsbeI,14091
39
+ lionagi/libs/token_transform/synthlang.py,sha256=dD2JD0WCB0xLMF2PG8nJluJXEQ6VSTyqmTnmrFm9IgU,12709
39
40
  lionagi/libs/validate/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
40
41
  lionagi/libs/validate/common_field_validators.py,sha256=5pu3kH13dVy1Nq-AQcHx0bIPusOnhvvCwUmaBX5l8bw,4778
41
42
  lionagi/libs/validate/fuzzy_match_keys.py,sha256=S7kzJnh-aKDMFbecmtMjFHNk2h-xMJqtQygMnq839lY,6255
42
43
  lionagi/libs/validate/fuzzy_validate_mapping.py,sha256=SQqyxgrAgJ5zBKxIAnulWsZXb-PAzLBEF2NhV6G0x-E,4935
43
44
  lionagi/libs/validate/string_similarity.py,sha256=7x8D4LZCMNJGz2ZCeKmct7Nc4i8m_ORoHIeGvkeMZOA,8733
44
45
  lionagi/libs/validate/validate_boolean.py,sha256=h3d7Dn7asJokBozWaKxaV_3Y6vUWBc0-zfNJjTQ9Bo8,3614
45
- lionagi/operations/__init__.py,sha256=_TvmWRotAQILyE3JWls7uY1luV7GAwwddtVdKnvjgIk,280
46
- lionagi/operations/types.py,sha256=_1HkP-xiWxh7l5dmqCnC_H40Unx_Nj11O1n9a1_WD80,181
46
+ lionagi/operations/__init__.py,sha256=O7nV0tedpUe7_OlUWmCcduGPFtqtzWZcR_SIOnjLsro,134
47
+ lionagi/operations/types.py,sha256=LIa68xcyKLVafof-DSFwKtSkneuYPFqrtGyClohYI6o,704
47
48
  lionagi/operations/utils.py,sha256=Twy6L_UFt9JqJFRYuKKTKVZIXsePidNl5ipcYcCbesI,1220
49
+ lionagi/operations/ReAct/ReAct.py,sha256=NH8P2urJRk7WJrL7QbRB1J7PafQOb6Ef5b-k4w0JQbs,3945
50
+ lionagi/operations/ReAct/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
51
+ lionagi/operations/ReAct/utils.py,sha256=0OhZhoc8QsTsMFo2Jmys1mgpnMwHsldKuLVSbev9uZM,994
52
+ lionagi/operations/_act/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
53
+ lionagi/operations/_act/act.py,sha256=YTJzdDtp8JzwOx4SG8rafWSseUrHsOVDhmCoNnuOxs8,2213
48
54
  lionagi/operations/brainstorm/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
49
55
  lionagi/operations/brainstorm/brainstorm.py,sha256=88Cq2IBrUs5du9q_8rf_VmhLYBfGKJv4rCeDTcJ07_g,17196
50
56
  lionagi/operations/brainstorm/prompt.py,sha256=f-Eh6pO606dT2TrX9BFv_einRDpYwFi6Gep9Strd1cM,610
57
+ lionagi/operations/chat/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
58
+ lionagi/operations/chat/chat.py,sha256=ug3bFTByNVwa5Rlb1qWY1vf1cCMDpX8sX1tGR6ElYIs,5356
59
+ lionagi/operations/communicate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
+ lionagi/operations/communicate/communicate.py,sha256=ZOW-jrPXb8Tt2NCy53yYMmndNZxhY1vruebQB7_wV5E,5660
61
+ lionagi/operations/instruct/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
62
+ lionagi/operations/instruct/instruct.py,sha256=CYICzWvmgALtSPIetfF3csx6WDsCuiu4NRRPL56UA2g,795
63
+ lionagi/operations/interpret/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
64
+ lionagi/operations/interpret/interpret.py,sha256=3VrPe01RnZhsdtQlhG8xNno2jojOq1O9ZfJwyIH2FWk,1118
65
+ lionagi/operations/operate/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
66
+ lionagi/operations/operate/operate.py,sha256=4Z6rQmaylI_ZeNPIviz5fsDD-NFlmbcK5nqQ8z2Sasg,6670
67
+ lionagi/operations/parse/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
68
+ lionagi/operations/parse/parse.py,sha256=-MGdQTV8N0KQsj_ec08P0kd_55ubpOaH_v5VlSHse54,4575
51
69
  lionagi/operations/plan/__init__.py,sha256=AFkAmOJBTqPlYuqFRRn7rCvIw3CGh9XXH_22cNWbfig,156
52
- lionagi/operations/plan/plan.py,sha256=4DFBY6XSbTle96qCfx2QyN3ekTyZjrMar14eAl1zlAg,15327
70
+ lionagi/operations/plan/plan.py,sha256=Uxysob3evbjhXWS_wseO3Mb_A90p1wk3ralJ17rHFCk,15333
53
71
  lionagi/operations/plan/prompt.py,sha256=ig4JjJR5gV-lXPRVbiaJuL9qeoahM_afYvWphpY1lWA,993
54
- lionagi/operations/select/__init__.py,sha256=an28I5IbKj0waICk5SjYnz3WmkQLpIARO0yNUu9VWNE,162
55
- lionagi/operations/select/prompt.py,sha256=2OJQE8EKPj9nubP_drp6BYyF7J8RiDs1BEkv0D-HLn8,299
56
- lionagi/operations/select/select.py,sha256=NYHfrLUOLklVuvKCObHlmSj42R7ye8ftNS70vPPnOrQ,3151
57
- lionagi/operations/select/utils.py,sha256=hYOSGx7vMvjGHibcFOUuCfTXFO2IzzIUwQy82PQtluQ,3251
58
- lionagi/operations/strategies/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
59
- lionagi/operations/strategies/base.py,sha256=cfZXUZYPypW-hFZJj7HDtTPc-x99XB6dO_S5os1srTk,1820
60
- lionagi/operations/strategies/concurrent.py,sha256=bLLL90LYywkxGlMY8XXGsZ1GRZrtB_8lsfkqspLgQ6o,2721
61
- lionagi/operations/strategies/concurrent_chunk.py,sha256=9qwYoqO0LO1BMIyxU-tc_9ppBK0J94cnWs3e7wx7PR0,1678
62
- lionagi/operations/strategies/concurrent_sequential_chunk.py,sha256=5Zw9fO1YWSj81w6IjOdEPzHE-4TxIdui-ljjrAsbEEI,3658
63
- lionagi/operations/strategies/params.py,sha256=BMGclThbRYnUmmcFSh9JAng12dykBl_Ud_5VHLp18g0,4966
64
- lionagi/operations/strategies/sequential.py,sha256=nSMtYy10P4W8U2SoARfKCBDN6y8_WoubKjoORUnewjY,949
65
- lionagi/operations/strategies/sequential_chunk.py,sha256=bs_0zZJjJpYdmEEWx3mwh3it5ErQYfZr-ImahyKEy8Y,3161
66
- lionagi/operations/strategies/sequential_concurrent_chunk.py,sha256=GJurnTuu6U7FOPR9mZxkjoJMIiQbgvRGt5iZZtmB2mY,3559
67
- lionagi/operations/strategies/utils.py,sha256=plZg84Yqba5GAmNPvsiUjbAavdDmCfwZkKnK_c_aORw,1414
72
+ lionagi/operations/select/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
73
+ lionagi/operations/select/select.py,sha256=qCxgsqNSDQVmtINHTee2973UU6VuBuAsO7fdhQ0VYjQ,2492
74
+ lionagi/operations/select/utils.py,sha256=uFnpTTGg05D3nzB8h81caIhwZa5-m9xrd-GJmlnU41s,3713
75
+ lionagi/operations/translate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
+ lionagi/operations/translate/translate.py,sha256=6eBVoQRarGEJ8Tfcl6Z__PLHQTTIbM5MaPVYNeKHRIs,1397
68
77
  lionagi/operatives/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
69
78
  lionagi/operatives/manager.py,sha256=pFGKSOIkXayHfDHCMJJwZXBhx3O02UlYK5mZ_-53AVg,190
70
79
  lionagi/operatives/operative.py,sha256=WZeg1XHS8iuzs4I3-va9FS9tOWu0XZ7xnOVzHthvEUQ,6724
71
80
  lionagi/operatives/step.py,sha256=DevwisZc2q88ynUiiSu7VBEY2A_G4Q5iRLrVgVLHNJU,9843
72
81
  lionagi/operatives/types.py,sha256=8krpGIeJL2GkO580ePOuAZfGc7vUVPIanemoA77tbVY,1697
73
82
  lionagi/operatives/action/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
74
- lionagi/operatives/action/function_calling.py,sha256=d07l39EqIsLOvWUcxWo1UjWu8VDfbjhGKJVA_In8tjs,4594
75
- lionagi/operatives/action/manager.py,sha256=XFFl93xaeErX4lZz6060nscsG4OnYPz7eM4WoJ14n4g,7813
83
+ lionagi/operatives/action/function_calling.py,sha256=VHUq8qebCAAdaWcPJQCZNI-P6zC_P1kp9o-d7nhZf_0,4602
84
+ lionagi/operatives/action/manager.py,sha256=N0M4pUuxh51yelNzad1YuDcsNPgVmgLMD0JaWvNlIHI,7840
76
85
  lionagi/operatives/action/request_response_model.py,sha256=7X_ZkcgmQ0D77qyP8_39RdEAKASCjEPWH4ey83jIUKc,2326
77
- lionagi/operatives/action/tool.py,sha256=Wxmh5v0pH4qjYGXn7w-RCGh756ARhgGfq7mjcn2EIic,4267
86
+ lionagi/operatives/action/tool.py,sha256=fUwlzmi6kuuwHU6xA8Soo_bWOgD-I7TBLtJ-WJ1OBLk,4277
78
87
  lionagi/operatives/action/utils.py,sha256=vUe7Aysuzbg16rAfe2Ttp5QUz5_L6mMedBVAWzGAHwk,4330
79
88
  lionagi/operatives/forms/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
80
89
  lionagi/operatives/forms/base.py,sha256=ALPREgOkRcY2wtRG0JpTXztlohkRjyCiwoleQfGCpSg,7207
@@ -94,21 +103,39 @@ lionagi/operatives/models/model_params.py,sha256=yElYJ0el2CFykdVlBHhpVG77PO_q6Zq
94
103
  lionagi/operatives/models/note.py,sha256=8TS0Zi0eSo1fmVoqBMWB6ChSrXKb36ozAM70o7P4kTU,9495
95
104
  lionagi/operatives/models/operable_model.py,sha256=mnTIAXJHJecXjqKNZWSch5w6x3U3Fl_9mUK4RudnM64,15573
96
105
  lionagi/operatives/models/schema_model.py,sha256=-BeCwW_1Rle--w-f7MajbOYH7t_8SPWw0_qK0fpTsRg,666
106
+ lionagi/operatives/strategies/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
107
+ lionagi/operatives/strategies/base.py,sha256=cfZXUZYPypW-hFZJj7HDtTPc-x99XB6dO_S5os1srTk,1820
108
+ lionagi/operatives/strategies/concurrent.py,sha256=bLLL90LYywkxGlMY8XXGsZ1GRZrtB_8lsfkqspLgQ6o,2721
109
+ lionagi/operatives/strategies/concurrent_chunk.py,sha256=9qwYoqO0LO1BMIyxU-tc_9ppBK0J94cnWs3e7wx7PR0,1678
110
+ lionagi/operatives/strategies/concurrent_sequential_chunk.py,sha256=5Zw9fO1YWSj81w6IjOdEPzHE-4TxIdui-ljjrAsbEEI,3658
111
+ lionagi/operatives/strategies/params.py,sha256=XNCD8sQJCm7xk0yGFKSQ14FuUNV1f8wLfNNJg_NYsn8,5407
112
+ lionagi/operatives/strategies/sequential.py,sha256=nSMtYy10P4W8U2SoARfKCBDN6y8_WoubKjoORUnewjY,949
113
+ lionagi/operatives/strategies/sequential_chunk.py,sha256=bs_0zZJjJpYdmEEWx3mwh3it5ErQYfZr-ImahyKEy8Y,3161
114
+ lionagi/operatives/strategies/sequential_concurrent_chunk.py,sha256=GJurnTuu6U7FOPR9mZxkjoJMIiQbgvRGt5iZZtmB2mY,3559
115
+ lionagi/operatives/strategies/utils.py,sha256=plZg84Yqba5GAmNPvsiUjbAavdDmCfwZkKnK_c_aORw,1414
97
116
  lionagi/protocols/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
98
- lionagi/protocols/_adapter.py,sha256=UPz6LlEb1fAc53Cq8QJLpVngFlPqi2JnMUqqi2FxkPM,5875
99
117
  lionagi/protocols/_concepts.py,sha256=aIV3cIuKxRcEFdROemlFR6mMAwqiYv-rjkZQ4rHBfXo,1554
100
- lionagi/protocols/types.py,sha256=of761-J1RDZEZXIPxEXVz2PRg_KuajfMrjzhZGwk2o4,2057
118
+ lionagi/protocols/types.py,sha256=M-cWgRGl8vaU776MuX-QSQVmaI1rbXmzyW9tfPHzGYc,2065
119
+ lionagi/protocols/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
+ lionagi/protocols/adapters/adapter.py,sha256=CyAZ4IR6S4FSmKMk_3YzyE1Ny8TJjeYc4h1Z710WL6M,2417
121
+ lionagi/protocols/adapters/json_adapter.py,sha256=Jl0pyu2r-vZ5PVfqBzp3eAl9no9MQwg2ln5ty3UDI4s,2337
122
+ lionagi/protocols/adapters/types.py,sha256=qYCbxjWNLVIUOosC3N8oJHP8tDJ9kjsnaYuUh_h-70c,563
123
+ lionagi/protocols/adapters/pandas_/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
124
+ lionagi/protocols/adapters/pandas_/csv_adapter.py,sha256=iKBX1XXRh85O4595pvxKwxv5A-80OYBhzQoaAeF6MgI,1307
125
+ lionagi/protocols/adapters/pandas_/excel_adapter.py,sha256=XoPD16Kus6lPNUEsy8JZDi5JMlwSsB6VVOQU3QIOoIs,1356
126
+ lionagi/protocols/adapters/pandas_/pd_dataframe_adapter.py,sha256=3JQFTN7xTovPet98cOxx2mCq1O7OXZnXZEZv6m06dtc,908
127
+ lionagi/protocols/adapters/pandas_/pd_series_adapter.py,sha256=f5mj4HSL6G1R02RaRRxQ06bfxble19da8BtH3WD889M,434
101
128
  lionagi/protocols/generic/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
102
129
  lionagi/protocols/generic/element.py,sha256=Pi-YHinDDab7sIYNo4Caj-gJGBidcIAEN1Bpl1D100Q,14161
103
130
  lionagi/protocols/generic/event.py,sha256=SjR9N4Egr5_oqOBSKVsxQjsn6MlqNcwf48bee-qIT6Y,4879
104
131
  lionagi/protocols/generic/log.py,sha256=xi8dRKwxtxVYU8T_E4wYJE4lCQzkERgAUARcAN7ZngI,7441
105
- lionagi/protocols/generic/pile.py,sha256=TpPZVqlc09-mTdMuEUKfG8znqO9U7ahWi-wsP6tMP-s,30999
132
+ lionagi/protocols/generic/pile.py,sha256=kXzN9ZHmmR__tOItwvx9xcB9IDxJYYHIkHOtDX0wsFE,31509
106
133
  lionagi/protocols/generic/processor.py,sha256=4Gkie1DxE0U-uZAdNBTuTibUlyeEGm_OyVlMXilCEm8,10115
107
134
  lionagi/protocols/generic/progression.py,sha256=3PjIBlPoj7jahy75ERbo9vHKVNU7fFl4be5ETNzphJU,15160
108
135
  lionagi/protocols/graph/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
109
136
  lionagi/protocols/graph/edge.py,sha256=LOESNQc3aVNKXZrr5ZrRCK5biTWkyxGtTQ7GxJFyCx8,5221
110
137
  lionagi/protocols/graph/graph.py,sha256=bRlZot_6eN4K3CYxgFnfehnQHDGJTQ3OPqITaz8ETiU,10055
111
- lionagi/protocols/graph/node.py,sha256=s9TmFIXY2yL9Vc8nlzTfaM9ZXP8qboqcF5pvfgG0HA0,3435
138
+ lionagi/protocols/graph/node.py,sha256=5VStUHSV0Qjv6DtwJPCzod2stveixnsErJR09uLLYhc,3773
112
139
  lionagi/protocols/mail/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
113
140
  lionagi/protocols/mail/exchange.py,sha256=bT-JUU9CXDdUn6GlAjB1Pc4KD7J8Ncm7s-xbmFKI45g,4066
114
141
  lionagi/protocols/mail/mail.py,sha256=4O4R0ak7dFar80wjj1DK64SPgRhYAR7qKjv_tSDbkXA,625
@@ -131,14 +158,15 @@ lionagi/protocols/messages/templates/assistant_response.jinja2,sha256=oKOX4myBy7
131
158
  lionagi/protocols/messages/templates/instruction_message.jinja2,sha256=L-ptw5OHxdL1KVKVhLOn0KAFw6IEFI9QHZxiFuovzhk,1382
132
159
  lionagi/protocols/messages/templates/system_message.jinja2,sha256=JRKJ0aFpYfaXSFouKc_N4unZ35C3yZTOWhIrIdCB5qk,215
133
160
  lionagi/protocols/messages/templates/tool_schemas.jinja2,sha256=ozIaSDCRjIAhLyA8VM6S-YqS0w2NcctALSwx4LjDwII,126
134
- lionagi/service/__init__.py,sha256=1v6f3RxLaZmSRj3uCEahSg0plWsxV8l_UisLbUOXoAQ,308
161
+ lionagi/service/__init__.py,sha256=DMGXIqPsmut9H5GT0ZeSzQIzYzzPwI-2gLXydpbwiV8,21
135
162
  lionagi/service/imodel.py,sha256=-FudX8C_wmc7ByUv-pILrybtQd4E2gfE51C5l0IR0ho,10815
136
- lionagi/service/manager.py,sha256=qM_URzibfWvtqcunTJ0jwrAPR9X3R4XomSecKseAD_4,1429
163
+ lionagi/service/manager.py,sha256=MKSYBkg23s7YhZy5GEFdnpspEnhPVfFhpkpoJe20D7k,1435
164
+ lionagi/service/types.py,sha256=v9SAn5-GTmds4Mar13Or_VFrRHCinBK99dmeDUd-QNk,486
137
165
  lionagi/service/endpoints/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
138
- lionagi/service/endpoints/base.py,sha256=K6VM4wn4Lk59tzdbsC_Q263lmKMqJFJNbrJ0wKQrH1g,18267
166
+ lionagi/service/endpoints/base.py,sha256=RbBBQIbtNtkP1LT9U3ZrhL35SfmVIpaq-AGW8d538k4,18275
139
167
  lionagi/service/endpoints/chat_completion.py,sha256=9ltSQaKPH43WdEDW32_-f5x07I9hOU8g-T_PAG-nYsQ,2529
140
168
  lionagi/service/endpoints/match_endpoint.py,sha256=n7F9NoTXfUBL29HrDcFLF5AXYR8pcx_IumQ7BiJXC-w,1740
141
- lionagi/service/endpoints/rate_limited_processor.py,sha256=mBSf4d58Dss45NMam6r8nvwxjUKw6CjXcq7IpUqkDV8,4663
169
+ lionagi/service/endpoints/rate_limited_processor.py,sha256=GkWK9XR3XNwn6qKUif6HMeqMJtO1E2Hq_tqGYai_wp8,4681
142
170
  lionagi/service/endpoints/token_calculator.py,sha256=MflqImGUr_1jh465hB7cUAaIPICBkjirvre1fWGXLrA,6161
143
171
  lionagi/service/providers/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
144
172
  lionagi/service/providers/anthropic_/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
@@ -152,9 +180,9 @@ lionagi/service/providers/openrouter_/chat_completions.py,sha256=MRf4ZbMCgzNIL4g
152
180
  lionagi/service/providers/perplexity_/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
153
181
  lionagi/service/providers/perplexity_/chat_completions.py,sha256=SsDbrtXwQsR4Yu2VMU43KfeS86QWI8UTNhDth5lNWNs,1055
154
182
  lionagi/session/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
155
- lionagi/session/branch.py,sha256=-lu63-Eua1pgo9RVoiS54G4_JtmNC__ZEaegRtKFPro,47448
183
+ lionagi/session/branch.py,sha256=Fhuv_JM4glBw8BEiOksQmehHPAyxe4beQ2QBIJduypA,57727
156
184
  lionagi/session/session.py,sha256=A2PCG1BD1noMLtCJD3C_H7r-0GUQ_ru2szOhF1pOCtY,8976
157
- lionagi-0.6.0.dist-info/METADATA,sha256=THShEYoEI8tUGFhUjDZXSqF6esJrx86Alx2cCSu2-5M,22771
158
- lionagi-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
159
- lionagi-0.6.0.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
160
- lionagi-0.6.0.dist-info/RECORD,,
185
+ lionagi-0.7.0.dist-info/METADATA,sha256=GScf641-hvSkJb8TJTrZgPYDhFs012qBnJhfTItnGbo,22776
186
+ lionagi-0.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
187
+ lionagi-0.7.0.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
188
+ lionagi-0.7.0.dist-info/RECORD,,
@@ -1,66 +0,0 @@
1
- # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
- #
3
- # SPDX-License-Identifier: Apache-2.0
4
-
5
- import numpy as np
6
- from pydantic import BaseModel
7
-
8
- from lionagi.operatives.models.note import Note
9
- from lionagi.protocols.generic.log import Log
10
-
11
-
12
- class PerplexityTokenScore(BaseModel):
13
- token: str
14
- logprob: float
15
-
16
-
17
- class PerplexityScores(BaseModel):
18
-
19
- completion_response: BaseModel
20
- original_tokens: list[str]
21
- n_samples: int
22
-
23
- @property
24
- def logprobs(self) -> list[float]:
25
- return [i.logprob for i in self.perplexity_scores]
26
-
27
- @property
28
- def predicted_tokens(self) -> list[str]:
29
- return [i.token for i in self.perplexity_scores]
30
-
31
- @property
32
- def perplexity(self) -> float:
33
- return np.exp(np.mean(self.logprobs))
34
-
35
- @property
36
- def perplexity_scores(self) -> list[PerplexityTokenScore]:
37
- outs = []
38
- log_prob = self.completion_response.choices[0].logprobs
39
- n = Note.from_dict(log_prob)
40
- for j in range(len(n[["content"]])):
41
- p_ = ["content", j]
42
- p_token = p_ + ["token"]
43
- p_logprob = p_ + ["logprob"]
44
- p_score = PerplexityTokenScore(
45
- token=n[p_token], logprob=n[p_logprob]
46
- )
47
- outs.append(p_score)
48
- return outs
49
-
50
- @property
51
- def prompt_tokens(self) -> int:
52
- return self.completion_response.usage.prompt_tokens
53
-
54
- @property
55
- def completion_tokens(self) -> int:
56
- return self.completion_response.usage.completion_tokens
57
-
58
- def to_log(self) -> Log:
59
- dict_ = self.model_dump()
60
- info = dict_.pop("completion_response")
61
- dict_["perplexity"] = self.perplexity
62
- dict_["prompt_tokens"] = self.prompt_tokens
63
- dict_["completion_tokens"] = self.completion_tokens
64
- dict_["perplexity_scores"] = self.perplexity_scores
65
-
66
- return Log(content=dict_, info=info)
@@ -1,69 +0,0 @@
1
- # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
- #
3
- # SPDX-License-Identifier: Apache-2.0
4
-
5
- import asyncio
6
-
7
- from lionagi.service.imodel import iModel
8
-
9
- from .models import PerplexityScores
10
-
11
-
12
- async def compute_perplexity(
13
- imodel: iModel,
14
- initial_context: str = None,
15
- tokens: list[str] = None,
16
- system_msg: str = None,
17
- n_samples: int = 1, # number of samples used for the computation
18
- use_residue: bool = True, # whether to use residue for the last sample
19
- **kwargs,
20
- ) -> list[PerplexityScores]:
21
- tasks = []
22
- context = initial_context or ""
23
-
24
- n_samples = n_samples or len(tokens)
25
- sample_token_len, residue = divmod(len(tokens), n_samples)
26
- samples = []
27
-
28
- if n_samples == 1:
29
- samples = [tokens]
30
- else:
31
- samples = [
32
- tokens[: (i + 1) * sample_token_len] for i in range(n_samples)
33
- ]
34
-
35
- if use_residue and residue != 0:
36
- samples.append(tokens[-residue:])
37
-
38
- sampless = [context + " ".join(sample) for sample in samples]
39
-
40
- for sample in sampless:
41
- messages = (
42
- [{"role": "system", "content": system_msg}] if system_msg else []
43
- )
44
- messages.append(
45
- {"role": "user", "content": sample},
46
- )
47
- task = asyncio.create_task(
48
- imodel.invoke(
49
- messages=messages,
50
- logprobs=True,
51
- max_tokens=sample_token_len,
52
- **kwargs,
53
- )
54
- )
55
- tasks.append(task)
56
-
57
- results = await asyncio.gather(*tasks)
58
-
59
- outs = []
60
-
61
- for idx, item in enumerate(results):
62
- p = PerplexityScores(
63
- completion_response=item,
64
- original_tokens=samples[idx],
65
- n_samples=n_samples,
66
- )
67
- outs.append(p)
68
-
69
- return outs
@@ -1,5 +0,0 @@
1
- # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
- #
3
- # SPDX-License-Identifier: Apache-2.0
4
-
5
- PROMPT = "Please select up to {max_num_selections} items from the following list {choices}. Provide the selection(s) into appropriate field in format required, and no comments from you"
@@ -1,224 +0,0 @@
1
- # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
- #
3
- # SPDX-License-Identifier: Apache-2.0
4
-
5
- import json
6
- import logging
7
- from datetime import datetime
8
- from pathlib import Path
9
- from typing import Any, Protocol, TypeVar, runtime_checkable
10
-
11
- import pandas as pd
12
- from typing_extensions import get_protocol_members
13
-
14
- T = TypeVar("T")
15
-
16
-
17
- @runtime_checkable
18
- class Adapter(Protocol):
19
-
20
- obj_key: str
21
-
22
- @classmethod
23
- def from_obj(
24
- cls, subj_cls: type[T], obj: Any, /, **kwargs
25
- ) -> dict | list[dict]: ...
26
-
27
- @classmethod
28
- def to_obj(cls, subj: T, /, **kwargs) -> Any: ...
29
-
30
-
31
- adapter_members = get_protocol_members(Adapter) # duck typing
32
-
33
-
34
- class AdapterRegistry:
35
-
36
- _adapters: dict[str, Adapter] = {}
37
-
38
- @classmethod
39
- def list_adapters(cls) -> list[tuple[str | type, ...]]:
40
- return list(cls._adapters.keys())
41
-
42
- @classmethod
43
- def register(cls, adapter: type[Adapter]) -> None:
44
- for member in adapter_members:
45
- if not hasattr(adapter, member):
46
- _str = getattr(adapter, "obj_key", None) or repr(adapter)
47
- _str = _str[:50] if len(_str) > 50 else _str
48
- raise AttributeError(
49
- f"Adapter {_str} missing required methods."
50
- )
51
-
52
- if isinstance(adapter, type):
53
- cls._adapters[adapter.obj_key] = adapter()
54
- else:
55
- cls._adapters[adapter.obj_key] = adapter
56
-
57
- @classmethod
58
- def get(cls, obj_key: type | str) -> Adapter:
59
- try:
60
- return cls._adapters[obj_key]
61
- except Exception as e:
62
- logging.error(f"Error getting adapter for {obj_key}. Error: {e}")
63
-
64
- @classmethod
65
- def adapt_from(
66
- cls, subj_cls: type[T], obj: Any, obj_key: type | str, **kwargs
67
- ) -> dict | list[dict]:
68
- try:
69
- return cls.get(obj_key).from_obj(subj_cls, obj, **kwargs)
70
- except Exception as e:
71
- logging.error(f"Error adapting data from {obj_key}. Error: {e}")
72
- raise e
73
-
74
- @classmethod
75
- def adapt_to(cls, subj: T, obj_key: type | str, **kwargs) -> Any:
76
- try:
77
- return cls.get(obj_key).to_obj(subj, **kwargs)
78
- except Exception as e:
79
- logging.error(f"Error adapting data to {obj_key}. Error: {e}")
80
- raise e
81
-
82
-
83
- class JsonAdapter(Adapter):
84
-
85
- obj_key = "json"
86
-
87
- @classmethod
88
- def from_obj(cls, subj_cls: type[T], obj: str, /) -> dict:
89
- return json.loads(obj)
90
-
91
- @classmethod
92
- def to_obj(cls, subj: T) -> str:
93
- return json.dumps(subj.to_dict())
94
-
95
-
96
- class JsonFileAdapter(Adapter):
97
-
98
- obj_key = ".json"
99
-
100
- @classmethod
101
- def from_obj(cls, subj_cls: type[T], obj: str | Path, /) -> dict:
102
- with open(obj) as f:
103
- return json.load(f)
104
-
105
- @classmethod
106
- def to_obj(
107
- cls,
108
- subj: T,
109
- /,
110
- fp: str | Path,
111
- ) -> None:
112
- with open(fp, "w") as f:
113
- json.dump(subj.to_dict(), f)
114
- logging.info(f"Successfully saved data to {fp}")
115
-
116
-
117
- class PandasSeriesAdapter(Adapter):
118
-
119
- obj_key = "pd_series"
120
- alias = ("pandas_series", "pd.series", "pd_series")
121
-
122
- @classmethod
123
- def from_obj(cls, subj_cls: type[T], obj: pd.Series, /, **kwargs) -> dict:
124
- return obj.to_dict(**kwargs)
125
-
126
- @classmethod
127
- def to_obj(cls, subj: T, /, **kwargs) -> pd.Series:
128
- return pd.Series(subj.to_dict(), **kwargs)
129
-
130
-
131
- class PandasDataFrameAdapter(Adapter):
132
-
133
- obj_key = "pd_dataframe"
134
- alias = ("pandas_dataframe", "pd.DataFrame", "pd_dataframe")
135
-
136
- @classmethod
137
- def from_obj(
138
- cls, subj_cls: type[T], obj: pd.DataFrame, /, **kwargs
139
- ) -> list[dict]:
140
- """kwargs for pd.DataFrame.to_dict"""
141
- return obj.to_dict(orient="records", **kwargs)
142
-
143
- @classmethod
144
- def to_obj(cls, subj: list[T], /, **kwargs) -> pd.DataFrame:
145
- """kwargs for pd.DataFrame"""
146
- out_ = []
147
- for i in subj:
148
- _dict = i.to_dict()
149
- _dict["created_at"] = datetime.fromtimestamp(_dict["created_at"])
150
- out_.append(_dict)
151
- df = pd.DataFrame(out_, **kwargs)
152
- if "created_at" in df.columns:
153
- df["created_at"] = pd.to_datetime(df["created_at"])
154
- return df
155
-
156
-
157
- class CSVFileAdapter(Adapter):
158
-
159
- obj_key = ".csv"
160
- alias = (".csv", "csv_file", "csv")
161
-
162
- @classmethod
163
- def from_obj(
164
- cls, subj_cls: type[T], obj: str | Path, /, **kwargs
165
- ) -> list[dict]:
166
- """kwargs for pd.read_csv"""
167
- df = pd.read_csv(obj, **kwargs)
168
- return df.to_dict(orient="records")
169
-
170
- @classmethod
171
- def to_obj(
172
- cls,
173
- subj: list[T],
174
- /,
175
- fp: str | Path,
176
- **kwargs,
177
- ) -> None:
178
- """kwargs for pd.DataFrame.to_csv"""
179
- kwargs["index"] = False
180
- pd.DataFrame([i.to_dict() for i in subj]).to_csv(fp, **kwargs)
181
- logging.info(f"Successfully saved data to {fp}")
182
-
183
-
184
- class ExcelFileAdapter(Adapter):
185
-
186
- obj_key = ".xlsx"
187
- alias = (".xlsx", "excel_file", "excel", "xlsx", "xls", ".xls")
188
-
189
- @classmethod
190
- def from_obj(
191
- cls, subj_cls: type[T], obj: str | Path, /, **kwargs
192
- ) -> list[dict]:
193
- return pd.read_excel(obj, **kwargs).to_dict(orient="records")
194
-
195
- @classmethod
196
- def to_obj(cls, subj: list[T], /, fp: str | Path, **kwargs) -> None:
197
- kwargs["index"] = False
198
- pd.DataFrame([i.to_dict() for i in subj]).to_excel(fp, **kwargs)
199
- logging.info(f"Saved {subj.class_name()} to {fp}")
200
-
201
-
202
- NODE_ADAPTERS = [
203
- JsonAdapter,
204
- JsonFileAdapter,
205
- PandasSeriesAdapter,
206
- ]
207
-
208
-
209
- class NodeAdapterRegistry(AdapterRegistry):
210
- _adapters = {k.obj_key: k() for k in NODE_ADAPTERS}
211
-
212
-
213
- PILE_ADAPTERS = [
214
- JsonAdapter,
215
- JsonFileAdapter,
216
- PandasDataFrameAdapter,
217
- CSVFileAdapter,
218
- ExcelFileAdapter,
219
- ]
220
-
221
-
222
- class PileAdapterRegistry(AdapterRegistry):
223
-
224
- _adapters = {k.obj_key: k() for k in PILE_ADAPTERS}
File without changes
File without changes
File without changes
File without changes