lionagi 0.6.1__py3-none-any.whl → 0.7.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. lionagi/libs/token_transform/__init__.py +0 -0
  2. lionagi/libs/token_transform/llmlingua.py +1 -0
  3. lionagi/libs/token_transform/perplexity.py +439 -0
  4. lionagi/libs/token_transform/synthlang.py +409 -0
  5. lionagi/operations/ReAct/ReAct.py +126 -0
  6. lionagi/operations/ReAct/utils.py +28 -0
  7. lionagi/operations/__init__.py +1 -9
  8. lionagi/operations/_act/act.py +73 -0
  9. lionagi/operations/chat/__init__.py +3 -0
  10. lionagi/operations/chat/chat.py +173 -0
  11. lionagi/operations/communicate/__init__.py +0 -0
  12. lionagi/operations/communicate/communicate.py +108 -0
  13. lionagi/operations/instruct/__init__.py +3 -0
  14. lionagi/operations/instruct/instruct.py +29 -0
  15. lionagi/operations/interpret/__init__.py +3 -0
  16. lionagi/operations/interpret/interpret.py +39 -0
  17. lionagi/operations/operate/__init__.py +3 -0
  18. lionagi/operations/operate/operate.py +194 -0
  19. lionagi/operations/parse/__init__.py +3 -0
  20. lionagi/operations/parse/parse.py +89 -0
  21. lionagi/operations/plan/plan.py +3 -3
  22. lionagi/operations/select/__init__.py +0 -4
  23. lionagi/operations/select/select.py +11 -30
  24. lionagi/operations/select/utils.py +13 -2
  25. lionagi/operations/translate/__init__.py +0 -0
  26. lionagi/operations/translate/translate.py +47 -0
  27. lionagi/operations/types.py +16 -0
  28. lionagi/operatives/action/manager.py +115 -93
  29. lionagi/operatives/action/request_response_model.py +31 -0
  30. lionagi/operatives/action/tool.py +50 -20
  31. lionagi/operatives/strategies/__init__.py +3 -0
  32. lionagi/protocols/_concepts.py +1 -1
  33. lionagi/protocols/adapters/adapter.py +25 -0
  34. lionagi/protocols/adapters/json_adapter.py +107 -27
  35. lionagi/protocols/adapters/pandas_/csv_adapter.py +55 -11
  36. lionagi/protocols/adapters/pandas_/excel_adapter.py +52 -10
  37. lionagi/protocols/adapters/pandas_/pd_dataframe_adapter.py +54 -4
  38. lionagi/protocols/adapters/pandas_/pd_series_adapter.py +40 -0
  39. lionagi/protocols/generic/element.py +1 -1
  40. lionagi/protocols/generic/pile.py +5 -8
  41. lionagi/protocols/graph/edge.py +1 -1
  42. lionagi/protocols/graph/graph.py +16 -8
  43. lionagi/protocols/graph/node.py +1 -1
  44. lionagi/protocols/mail/exchange.py +126 -15
  45. lionagi/protocols/mail/mail.py +33 -0
  46. lionagi/protocols/mail/mailbox.py +62 -0
  47. lionagi/protocols/mail/manager.py +97 -41
  48. lionagi/protocols/mail/package.py +57 -3
  49. lionagi/protocols/messages/action_request.py +77 -26
  50. lionagi/protocols/messages/action_response.py +55 -26
  51. lionagi/protocols/messages/assistant_response.py +50 -15
  52. lionagi/protocols/messages/base.py +36 -0
  53. lionagi/protocols/messages/instruction.py +175 -145
  54. lionagi/protocols/messages/manager.py +152 -56
  55. lionagi/protocols/messages/message.py +61 -25
  56. lionagi/protocols/messages/system.py +54 -19
  57. lionagi/service/imodel.py +24 -0
  58. lionagi/session/branch.py +1116 -939
  59. lionagi/utils.py +1 -0
  60. lionagi/version.py +1 -1
  61. {lionagi-0.6.1.dist-info → lionagi-0.7.1.dist-info}/METADATA +1 -1
  62. {lionagi-0.6.1.dist-info → lionagi-0.7.1.dist-info}/RECORD +75 -56
  63. lionagi/libs/compress/models.py +0 -66
  64. lionagi/libs/compress/utils.py +0 -69
  65. lionagi/operations/select/prompt.py +0 -5
  66. /lionagi/{libs/compress → operations/ReAct}/__init__.py +0 -0
  67. /lionagi/operations/{strategies → _act}/__init__.py +0 -0
  68. /lionagi/{operations → operatives}/strategies/base.py +0 -0
  69. /lionagi/{operations → operatives}/strategies/concurrent.py +0 -0
  70. /lionagi/{operations → operatives}/strategies/concurrent_chunk.py +0 -0
  71. /lionagi/{operations → operatives}/strategies/concurrent_sequential_chunk.py +0 -0
  72. /lionagi/{operations → operatives}/strategies/params.py +0 -0
  73. /lionagi/{operations → operatives}/strategies/sequential.py +0 -0
  74. /lionagi/{operations → operatives}/strategies/sequential_chunk.py +0 -0
  75. /lionagi/{operations → operatives}/strategies/sequential_concurrent_chunk.py +0 -0
  76. /lionagi/{operations → operatives}/strategies/utils.py +0 -0
  77. {lionagi-0.6.1.dist-info → lionagi-0.7.1.dist-info}/WHEEL +0 -0
  78. {lionagi-0.6.1.dist-info → lionagi-0.7.1.dist-info}/licenses/LICENSE +0 -0
lionagi/utils.py CHANGED
@@ -701,6 +701,7 @@ async def alcall(
701
701
  flatten (bool): Flatten the final result if True.
702
702
  dropna (bool): Remove None values from the final result if True.
703
703
  unique_output (bool): Deduplicate the output if True.
704
+ flatten_tuple_set (bool): Tuples and sets will be flattened if True.
704
705
  **kwargs: Additional arguments passed to func.
705
706
 
706
707
  Returns:
lionagi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.6.1"
1
+ __version__ = "0.7.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lionagi
3
- Version: 0.6.1
3
+ Version: 0.7.1
4
4
  Summary: An AGentic Intelligence Operating System.
5
5
  Author-email: HaiyangLi <quantocean.li@gmail.com>
6
6
  License: Apache License
@@ -2,13 +2,10 @@ 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
- lionagi/utils.py,sha256=hBlGmi8Px_ng3v4_D_k8xNpW3X93u01930lkZIHUQ-Y,73019
6
- lionagi/version.py,sha256=baAcEjLSYFIeNZF51tOMmA_zAMhN8HvKael-UU-Ruec,22
5
+ lionagi/utils.py,sha256=nwbr9mDOmmLmf5wq4sTZieCbu74GwHcXYrNjFV4-4LQ,73096
6
+ lionagi/version.py,sha256=2KJZDSMOG7KS82AxYOrZ4ZihYxX0wjfUjDsIZh3L024,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,35 +33,47 @@ 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=_TvmWRotAQILyE3JWls7uY1luV7GAwwddtVdKnvjgIk,280
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=ICQROuVqYhUMUyzXao7oTewp8YZsdk-jI9Bn5eJpWpA,3955
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=1PzBpzgATcAdBog0EUxtj5_uJGixNV93D4PYR12w_ec,2962
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=EtgXTeOezEPR03HSUVz8PGK-xf8p2nXoUMUhFkAntK0,1081
65
+ lionagi/operations/operate/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
66
+ lionagi/operations/operate/operate.py,sha256=jgVV9CjtnVLmR5ZdDmunicS5Pp9dT3hV5kMEBuk16iI,6614
67
+ lionagi/operations/parse/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
68
+ lionagi/operations/parse/parse.py,sha256=LpF6LVAvCVoE8n63BkhSxXSHYgSx7CNkN7yXUwaNpQo,3003
51
69
  lionagi/operations/plan/__init__.py,sha256=AFkAmOJBTqPlYuqFRRn7rCvIw3CGh9XXH_22cNWbfig,156
52
- lionagi/operations/plan/plan.py,sha256=Uxysob3evbjhXWS_wseO3Mb_A90p1wk3ralJ17rHFCk,15333
70
+ lionagi/operations/plan/plan.py,sha256=wcvQFFh9bF1pa754OpILrCPnMuMOO6suPrhrgRiZHXM,15317
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=B_XZcdmW9mmVGFZGnfCn89TxZvAMlS27YcD9RQ96f40,3166
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=XNCD8sQJCm7xk0yGFKSQ14FuUNV1f8wLfNNJg_NYsn8,5407
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
@@ -72,9 +81,9 @@ lionagi/operatives/step.py,sha256=DevwisZc2q88ynUiiSu7VBEY2A_G4Q5iRLrVgVLHNJU,98
72
81
  lionagi/operatives/types.py,sha256=8krpGIeJL2GkO580ePOuAZfGc7vUVPIanemoA77tbVY,1697
73
82
  lionagi/operatives/action/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
74
83
  lionagi/operatives/action/function_calling.py,sha256=VHUq8qebCAAdaWcPJQCZNI-P6zC_P1kp9o-d7nhZf_0,4602
75
- lionagi/operatives/action/manager.py,sha256=H50L9fv6kpQ87vW4nEIfP1JHZ5gX4fQs0uPDeRpEYEw,7929
76
- lionagi/operatives/action/request_response_model.py,sha256=7X_ZkcgmQ0D77qyP8_39RdEAKASCjEPWH4ey83jIUKc,2326
77
- lionagi/operatives/action/tool.py,sha256=fUwlzmi6kuuwHU6xA8Soo_bWOgD-I7TBLtJ-WJ1OBLk,4277
84
+ lionagi/operatives/action/manager.py,sha256=FXfWhQMSFE5qJNZPpgdz4ePvthLafZfnmak2PImCrsc,8824
85
+ lionagi/operatives/action/request_response_model.py,sha256=mCyKub_WoEttJ_mqLhGoOoPVBQHOhr7sswy_jN6-620,3378
86
+ lionagi/operatives/action/tool.py,sha256=Fl47hS_RXWlkQYLBeRSLQ0iwtb7TaTrfTA0sPCzyi4k,5188
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,44 +103,54 @@ 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/_concepts.py,sha256=aIV3cIuKxRcEFdROemlFR6mMAwqiYv-rjkZQ4rHBfXo,1554
117
+ lionagi/protocols/_concepts.py,sha256=2vHkG_Zbh4y3YAOqgJw0HXa2HS0VogjjvV3o1oXG7HM,1555
99
118
  lionagi/protocols/types.py,sha256=M-cWgRGl8vaU776MuX-QSQVmaI1rbXmzyW9tfPHzGYc,2065
100
119
  lionagi/protocols/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
101
- lionagi/protocols/adapters/adapter.py,sha256=CyAZ4IR6S4FSmKMk_3YzyE1Ny8TJjeYc4h1Z710WL6M,2417
102
- lionagi/protocols/adapters/json_adapter.py,sha256=Jl0pyu2r-vZ5PVfqBzp3eAl9no9MQwg2ln5ty3UDI4s,2337
120
+ lionagi/protocols/adapters/adapter.py,sha256=yXe21fmut9e9vtbxrQ6CWYIW2liy1sO0lItoclzYodU,3357
121
+ lionagi/protocols/adapters/json_adapter.py,sha256=EJj0Jev46ZhU3ZMnlYwyzN2rLxjLCVrMDpHkEuggBvk,4561
103
122
  lionagi/protocols/adapters/types.py,sha256=qYCbxjWNLVIUOosC3N8oJHP8tDJ9kjsnaYuUh_h-70c,563
104
123
  lionagi/protocols/adapters/pandas_/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
105
- lionagi/protocols/adapters/pandas_/csv_adapter.py,sha256=iKBX1XXRh85O4595pvxKwxv5A-80OYBhzQoaAeF6MgI,1307
106
- lionagi/protocols/adapters/pandas_/excel_adapter.py,sha256=XoPD16Kus6lPNUEsy8JZDi5JMlwSsB6VVOQU3QIOoIs,1356
107
- lionagi/protocols/adapters/pandas_/pd_dataframe_adapter.py,sha256=3JQFTN7xTovPet98cOxx2mCq1O7OXZnXZEZv6m06dtc,908
108
- lionagi/protocols/adapters/pandas_/pd_series_adapter.py,sha256=f5mj4HSL6G1R02RaRRxQ06bfxble19da8BtH3WD889M,434
124
+ lionagi/protocols/adapters/pandas_/csv_adapter.py,sha256=HWie6Jlt8nR-EVJC_zmCFilaWszLNuk7EWUp8Xvr-H8,2358
125
+ lionagi/protocols/adapters/pandas_/excel_adapter.py,sha256=ZqRT2xF93NLKNyMp16ePNzwUN3ntNkUy1dO3nbsrfak,2287
126
+ lionagi/protocols/adapters/pandas_/pd_dataframe_adapter.py,sha256=ULGZVhK5aaOuTrmFq4x5SiuDScYetyYYUHeL8Hh13Eg,2279
127
+ lionagi/protocols/adapters/pandas_/pd_series_adapter.py,sha256=TX3cqFtgEip8JqVqkjdJYOu4PQGpW1yYU6POhvz8Jeg,1388
109
128
  lionagi/protocols/generic/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
110
- lionagi/protocols/generic/element.py,sha256=Pi-YHinDDab7sIYNo4Caj-gJGBidcIAEN1Bpl1D100Q,14161
129
+ lionagi/protocols/generic/element.py,sha256=6RPUqs3FOdSC65QOwnfBD9yKVsWnmb878kmfas0m928,14169
111
130
  lionagi/protocols/generic/event.py,sha256=SjR9N4Egr5_oqOBSKVsxQjsn6MlqNcwf48bee-qIT6Y,4879
112
131
  lionagi/protocols/generic/log.py,sha256=xi8dRKwxtxVYU8T_E4wYJE4lCQzkERgAUARcAN7ZngI,7441
113
- lionagi/protocols/generic/pile.py,sha256=kXzN9ZHmmR__tOItwvx9xcB9IDxJYYHIkHOtDX0wsFE,31509
132
+ lionagi/protocols/generic/pile.py,sha256=SsdxIfDaIM1j6S6LuRPCTIJ86bZVeqlKkL_D1TGEQUQ,31446
114
133
  lionagi/protocols/generic/processor.py,sha256=4Gkie1DxE0U-uZAdNBTuTibUlyeEGm_OyVlMXilCEm8,10115
115
134
  lionagi/protocols/generic/progression.py,sha256=3PjIBlPoj7jahy75ERbo9vHKVNU7fFl4be5ETNzphJU,15160
116
135
  lionagi/protocols/graph/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
117
- lionagi/protocols/graph/edge.py,sha256=LOESNQc3aVNKXZrr5ZrRCK5biTWkyxGtTQ7GxJFyCx8,5221
118
- lionagi/protocols/graph/graph.py,sha256=bRlZot_6eN4K3CYxgFnfehnQHDGJTQ3OPqITaz8ETiU,10055
119
- lionagi/protocols/graph/node.py,sha256=5VStUHSV0Qjv6DtwJPCzod2stveixnsErJR09uLLYhc,3773
136
+ lionagi/protocols/graph/edge.py,sha256=cEbhqapsdJqHx5VhPwXwOkahfC7E7XZNbRqGixt_EFc,5229
137
+ lionagi/protocols/graph/graph.py,sha256=H1kcI2XRY2nIWIx1HLQSQr9ozx0fa6dLHsjT-vgjNv8,10208
138
+ lionagi/protocols/graph/node.py,sha256=DjsMB8CCbPesM45_3PAPPELbIl5Arlty-LDamYW09UI,3781
120
139
  lionagi/protocols/mail/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
121
- lionagi/protocols/mail/exchange.py,sha256=bT-JUU9CXDdUn6GlAjB1Pc4KD7J8Ncm7s-xbmFKI45g,4066
122
- lionagi/protocols/mail/mail.py,sha256=4O4R0ak7dFar80wjj1DK64SPgRhYAR7qKjv_tSDbkXA,625
123
- lionagi/protocols/mail/mailbox.py,sha256=lOHi74714hTd22nH9WxXcWD1DmIohj_H4NZsxbe6LD4,1297
124
- lionagi/protocols/mail/manager.py,sha256=hQ63lZIdmx4L0t2ofhnRHjobA-Bi0uuCNyd0yhwldhE,5617
125
- lionagi/protocols/mail/package.py,sha256=qjLzvSyZ3R4AQg2nUcF5j8h-3ggWS22prxYtSPPP0PI,1409
140
+ lionagi/protocols/mail/exchange.py,sha256=fKoaviOGoDGo2-kSg2_mOfRym6ZFtnIo_BTYlre39ZU,7258
141
+ lionagi/protocols/mail/mail.py,sha256=VzmbXzYKT-jtTdWglJRXEnRs6c0DIrxl-rz-6qKhyKo,1511
142
+ lionagi/protocols/mail/mailbox.py,sha256=U31owBkfO9fPo248xEIpYr-sU7akjEvEWKMhhQsra0o,2873
143
+ lionagi/protocols/mail/manager.py,sha256=tEjm8dj_6M8jyAgA1H9KjtFb_kjH1q8t0Bp_wi--txY,7105
144
+ lionagi/protocols/mail/package.py,sha256=j5L2V6xQR9rdnuNnlQZx2iXNSYmV9i6U5rhaR4AxoZg,2838
126
145
  lionagi/protocols/messages/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
127
- lionagi/protocols/messages/action_request.py,sha256=PpuB1UQ_b0Y1V5K8fQLX7-X4ULyb9RYOxUIyLpk7UGg,5010
128
- lionagi/protocols/messages/action_response.py,sha256=24p8ZBSYuckvYlySGoR2U7Au6ZYKtDVEI8owv5fqzDg,3818
129
- lionagi/protocols/messages/assistant_response.py,sha256=yg0FHttHuVMX1DIAAHpXSVDWmFh2W6sSqH1E8H8Nuro,4992
130
- lionagi/protocols/messages/base.py,sha256=6eAACK_b7pvjCcEswxm9FHqMXNOBx6r8cnIP_jUDBtQ,1567
131
- lionagi/protocols/messages/instruction.py,sha256=gz5d0yMURN_TaGwtvKFyg4miOEg8TZPAF7rC1ts57kM,18138
132
- lionagi/protocols/messages/manager.py,sha256=TFbgnkeBvsFaWXR01o8PsJ4SGzlOa6dnDOWJunVp8Lo,13762
133
- lionagi/protocols/messages/message.py,sha256=mhQwFBxaNE71KUWvU5tkLxAqaLwTHH3DvWbjLXrTf9A,6686
134
- lionagi/protocols/messages/system.py,sha256=kPmUMGIarOBlbD6f-QCS-ol4OfFI6HOo1nRBQGJy-Wo,3393
146
+ lionagi/protocols/messages/action_request.py,sha256=Nsh6Nm6M1BvBOw3TzI5DvSuwH5ldjHLczmxF8G3dWBM,7081
147
+ lionagi/protocols/messages/action_response.py,sha256=v5ykwspVEBXYxgFCIgmhdvk8lR3ycxxQdbjwdVLK_w8,5401
148
+ lionagi/protocols/messages/assistant_response.py,sha256=rWQsvElcUdF9KHkDLTNg_o-uzNl5DTcK066lszvCI0k,6412
149
+ lionagi/protocols/messages/base.py,sha256=YcOtj-okN5ldbviPsulIDBAFaGRvqpmt7DTfgLYjpwA,2482
150
+ lionagi/protocols/messages/instruction.py,sha256=I5FNvygcilHmfEv6nWdAsg6yAwB0BqXdXbFdfAIYExE,19574
151
+ lionagi/protocols/messages/manager.py,sha256=QpOIbQ6zVaBzhh7KkMvXdujB05vJK4waSaos14WwG_Q,17370
152
+ lionagi/protocols/messages/message.py,sha256=ulTjKK4FSWTLFRbMbg8V8cEveKu_fhFnOaAyuVWCXbo,7864
153
+ lionagi/protocols/messages/system.py,sha256=pagv9ClmKAEY81mJ0OQFwzK0znJ1dDTMT8aJ8iAX17I,4799
135
154
  lionagi/protocols/messages/templates/README.md,sha256=Ch4JrKSjd85fLitAYO1OhZjNOGKHoEwaKQlcV16jiUI,1286
136
155
  lionagi/protocols/messages/templates/action_request.jinja2,sha256=d6OmxHKyvvNDSK4bnBM3TGSUk_HeE_Q2EtLAQ0ZBEJg,120
137
156
  lionagi/protocols/messages/templates/action_response.jinja2,sha256=Mg0UxmXlIvtP_KPB0GcJxE1TP6lml9BwdPkW1PZxkg8,142
@@ -140,7 +159,7 @@ lionagi/protocols/messages/templates/instruction_message.jinja2,sha256=L-ptw5OHx
140
159
  lionagi/protocols/messages/templates/system_message.jinja2,sha256=JRKJ0aFpYfaXSFouKc_N4unZ35C3yZTOWhIrIdCB5qk,215
141
160
  lionagi/protocols/messages/templates/tool_schemas.jinja2,sha256=ozIaSDCRjIAhLyA8VM6S-YqS0w2NcctALSwx4LjDwII,126
142
161
  lionagi/service/__init__.py,sha256=DMGXIqPsmut9H5GT0ZeSzQIzYzzPwI-2gLXydpbwiV8,21
143
- lionagi/service/imodel.py,sha256=-FudX8C_wmc7ByUv-pILrybtQd4E2gfE51C5l0IR0ho,10815
162
+ lionagi/service/imodel.py,sha256=MaiBcKM00vH0tq0nD_C7jV6S7OyV71a4YwVDrDfPMrA,11539
144
163
  lionagi/service/manager.py,sha256=MKSYBkg23s7YhZy5GEFdnpspEnhPVfFhpkpoJe20D7k,1435
145
164
  lionagi/service/types.py,sha256=v9SAn5-GTmds4Mar13Or_VFrRHCinBK99dmeDUd-QNk,486
146
165
  lionagi/service/endpoints/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
@@ -161,9 +180,9 @@ lionagi/service/providers/openrouter_/chat_completions.py,sha256=MRf4ZbMCgzNIL4g
161
180
  lionagi/service/providers/perplexity_/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
162
181
  lionagi/service/providers/perplexity_/chat_completions.py,sha256=SsDbrtXwQsR4Yu2VMU43KfeS86QWI8UTNhDth5lNWNs,1055
163
182
  lionagi/session/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
164
- lionagi/session/branch.py,sha256=-lu63-Eua1pgo9RVoiS54G4_JtmNC__ZEaegRtKFPro,47448
183
+ lionagi/session/branch.py,sha256=ogCp8ybyrm1bspmtovcvrzUmBh8Nu_Q5RBBu2uYAl6U,58678
165
184
  lionagi/session/session.py,sha256=A2PCG1BD1noMLtCJD3C_H7r-0GUQ_ru2szOhF1pOCtY,8976
166
- lionagi-0.6.1.dist-info/METADATA,sha256=_KZh-djuuzJ-mwnUvpVUJ7TGmw_ghQnj0_QvqG8nkFY,22776
167
- lionagi-0.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
168
- lionagi-0.6.1.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
169
- lionagi-0.6.1.dist-info/RECORD,,
185
+ lionagi-0.7.1.dist-info/METADATA,sha256=fUR_5--oNQ4nxNsjRh9tc6Yh6TYxCsRFa6lmlgsQMNw,22776
186
+ lionagi-0.7.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
187
+ lionagi-0.7.1.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
188
+ lionagi-0.7.1.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"
File without changes
File without changes
File without changes
File without changes
File without changes