lionagi 0.16.1__py3-none-any.whl → 0.16.2__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.
- lionagi/libs/file/save.py +8 -1
- lionagi/ln/__init__.py +6 -0
- lionagi/ln/_json_dump.py +322 -49
- lionagi/models/note.py +8 -4
- lionagi/operations/brainstorm/brainstorm.py +10 -10
- lionagi/protocols/generic/element.py +5 -14
- lionagi/protocols/generic/log.py +2 -2
- lionagi/protocols/messages/message.py +8 -1
- lionagi/service/connections/endpoint.py +7 -0
- lionagi/service/connections/providers/claude_code_.py +6 -1
- lionagi/session/branch.py +1 -101
- lionagi/session/session.py +9 -14
- lionagi/utils.py +2 -1
- lionagi/version.py +1 -1
- {lionagi-0.16.1.dist-info → lionagi-0.16.2.dist-info}/METADATA +1 -2
- {lionagi-0.16.1.dist-info → lionagi-0.16.2.dist-info}/RECORD +18 -44
- lionagi/libs/file/params.py +0 -175
- lionagi/libs/token_transform/__init__.py +0 -0
- lionagi/libs/token_transform/base.py +0 -54
- lionagi/libs/token_transform/llmlingua.py +0 -1
- lionagi/libs/token_transform/perplexity.py +0 -450
- lionagi/libs/token_transform/symbolic_compress_context.py +0 -152
- lionagi/libs/token_transform/synthlang.py +0 -9
- lionagi/libs/token_transform/synthlang_/base.py +0 -128
- lionagi/libs/token_transform/synthlang_/resources/frameworks/abstract_algebra.toml +0 -11
- lionagi/libs/token_transform/synthlang_/resources/frameworks/category_theory.toml +0 -11
- lionagi/libs/token_transform/synthlang_/resources/frameworks/complex_analysis.toml +0 -11
- lionagi/libs/token_transform/synthlang_/resources/frameworks/framework_options.json +0 -52
- lionagi/libs/token_transform/synthlang_/resources/frameworks/group_theory.toml +0 -11
- lionagi/libs/token_transform/synthlang_/resources/frameworks/math_logic.toml +0 -11
- lionagi/libs/token_transform/synthlang_/resources/frameworks/reflective_patterns.toml +0 -11
- lionagi/libs/token_transform/synthlang_/resources/frameworks/set_theory.toml +0 -11
- lionagi/libs/token_transform/synthlang_/resources/frameworks/topology_fundamentals.toml +0 -11
- lionagi/libs/token_transform/synthlang_/resources/mapping/lion_emoji_mapping.toml +0 -61
- lionagi/libs/token_transform/synthlang_/resources/mapping/python_math_mapping.toml +0 -41
- lionagi/libs/token_transform/synthlang_/resources/mapping/rust_chinese_mapping.toml +0 -60
- lionagi/libs/token_transform/synthlang_/resources/utility/base_synthlang_system_prompt.toml +0 -11
- lionagi/libs/token_transform/synthlang_/translate_to_synthlang.py +0 -140
- lionagi/libs/token_transform/types.py +0 -15
- lionagi/operations/translate/__init__.py +0 -0
- lionagi/operations/translate/translate.py +0 -47
- lionagi/tools/memory/tools.py +0 -495
- {lionagi-0.16.1.dist-info → lionagi-0.16.2.dist-info}/WHEEL +0 -0
- {lionagi-0.16.1.dist-info → lionagi-0.16.2.dist-info}/licenses/LICENSE +0 -0
lionagi/session/branch.py
CHANGED
@@ -50,7 +50,7 @@ from lionagi.settings import Settings
|
|
50
50
|
from lionagi.tools.base import LionTool
|
51
51
|
from lionagi.utils import UNDEFINED
|
52
52
|
from lionagi.utils import alcall as alcall_legacy
|
53
|
-
from lionagi.utils import copy
|
53
|
+
from lionagi.utils import copy
|
54
54
|
|
55
55
|
from .prompts import LION_SYSTEM_MESSAGE
|
56
56
|
|
@@ -1307,68 +1307,6 @@ class Branch(Element, Communicatable, Relational):
|
|
1307
1307
|
)
|
1308
1308
|
return results
|
1309
1309
|
|
1310
|
-
async def translate(
|
1311
|
-
self,
|
1312
|
-
text: str,
|
1313
|
-
technique: Literal["SynthLang"] = "SynthLang",
|
1314
|
-
technique_kwargs: dict = None,
|
1315
|
-
compress: bool = False,
|
1316
|
-
chat_model: iModel = None,
|
1317
|
-
compress_model: iModel = None,
|
1318
|
-
compression_ratio: float = 0.2,
|
1319
|
-
compress_kwargs=None,
|
1320
|
-
verbose: bool = True,
|
1321
|
-
new_branch: bool = True,
|
1322
|
-
**kwargs,
|
1323
|
-
) -> str:
|
1324
|
-
"""
|
1325
|
-
An example "translate" operation that transforms text using a chosen technique
|
1326
|
-
(e.g., "SynthLang"). Optionally compresses text with a custom `compress_model`.
|
1327
|
-
|
1328
|
-
Args:
|
1329
|
-
text (str):
|
1330
|
-
The text to be translated or transformed.
|
1331
|
-
technique (Literal["SynthLang"]):
|
1332
|
-
The translation/transform technique (currently only "SynthLang").
|
1333
|
-
technique_kwargs (dict, optional):
|
1334
|
-
Additional parameters for the chosen technique.
|
1335
|
-
compress (bool):
|
1336
|
-
Whether to compress the resulting text further.
|
1337
|
-
chat_model (iModel, optional):
|
1338
|
-
A custom model for the translation step (defaults to self.chat_model).
|
1339
|
-
compress_model (iModel, optional):
|
1340
|
-
A separate model for compression (if `compress=True`).
|
1341
|
-
compression_ratio (float):
|
1342
|
-
Desired compression ratio if compressing text (0.0 - 1.0).
|
1343
|
-
compress_kwargs (dict, optional):
|
1344
|
-
Additional arguments for the compression step.
|
1345
|
-
verbose (bool):
|
1346
|
-
If True, prints debug/logging info.
|
1347
|
-
new_branch (bool):
|
1348
|
-
If True, performs the translation in a new branch context.
|
1349
|
-
**kwargs:
|
1350
|
-
Additional parameters passed through to the technique function.
|
1351
|
-
|
1352
|
-
Returns:
|
1353
|
-
str: The transformed (and optionally compressed) text.
|
1354
|
-
"""
|
1355
|
-
from lionagi.operations.translate.translate import translate
|
1356
|
-
|
1357
|
-
return await translate(
|
1358
|
-
branch=self,
|
1359
|
-
text=text,
|
1360
|
-
technique=technique,
|
1361
|
-
technique_kwargs=technique_kwargs,
|
1362
|
-
compress=compress,
|
1363
|
-
chat_model=chat_model,
|
1364
|
-
compress_model=compress_model,
|
1365
|
-
compression_ratio=compression_ratio,
|
1366
|
-
compress_kwargs=compress_kwargs,
|
1367
|
-
verbose=verbose,
|
1368
|
-
new_branch=new_branch,
|
1369
|
-
**kwargs,
|
1370
|
-
)
|
1371
|
-
|
1372
1310
|
async def select(
|
1373
1311
|
self,
|
1374
1312
|
instruct: Instruct | dict[str, Any],
|
@@ -1411,44 +1349,6 @@ class Branch(Element, Communicatable, Relational):
|
|
1411
1349
|
**kwargs,
|
1412
1350
|
)
|
1413
1351
|
|
1414
|
-
async def compress(
|
1415
|
-
self,
|
1416
|
-
text: str,
|
1417
|
-
system: str = None,
|
1418
|
-
compression_ratio: float = 0.2,
|
1419
|
-
n_samples: int = 5,
|
1420
|
-
max_tokens_per_sample=80,
|
1421
|
-
verbose=True,
|
1422
|
-
) -> str:
|
1423
|
-
"""
|
1424
|
-
Uses the `chat_model`'s built-in compression routine to shorten text.
|
1425
|
-
|
1426
|
-
Args:
|
1427
|
-
text (str):
|
1428
|
-
The text to compress.
|
1429
|
-
system (str, optional):
|
1430
|
-
System-level instructions, appended to the prompt.
|
1431
|
-
compression_ratio (float):
|
1432
|
-
Desired compression ratio (0.0-1.0).
|
1433
|
-
n_samples (int):
|
1434
|
-
How many compression attempts to combine or evaluate.
|
1435
|
-
max_tokens_per_sample (int):
|
1436
|
-
Max token count per sample chunk.
|
1437
|
-
verbose (bool):
|
1438
|
-
If True, logs or prints progress.
|
1439
|
-
|
1440
|
-
Returns:
|
1441
|
-
str: The compressed text.
|
1442
|
-
"""
|
1443
|
-
return await self.chat_model.compress_text(
|
1444
|
-
text=text,
|
1445
|
-
system=system,
|
1446
|
-
compression_ratio=compression_ratio,
|
1447
|
-
n_samples=n_samples,
|
1448
|
-
max_tokens_per_sample=max_tokens_per_sample,
|
1449
|
-
verbose=verbose,
|
1450
|
-
)
|
1451
|
-
|
1452
1352
|
async def interpret(
|
1453
1353
|
self,
|
1454
1354
|
text: str,
|
lionagi/session/session.py
CHANGED
@@ -79,7 +79,7 @@ class Session(Node, Communicatable, Relational):
|
|
79
79
|
|
80
80
|
def include_branches(self, branches: ID[Branch].ItemSeq):
|
81
81
|
def _take_in_branch(branch: Branch):
|
82
|
-
if not
|
82
|
+
if branch not in self.branches:
|
83
83
|
self.branches.include(branch)
|
84
84
|
self.mail_manager.add_sources(branch)
|
85
85
|
|
@@ -171,19 +171,14 @@ class Session(Node, Communicatable, Relational):
|
|
171
171
|
as_default_branch: bool = False,
|
172
172
|
**kwargs,
|
173
173
|
) -> Branch:
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
kwargs["tool_manager"] = tool_manager
|
183
|
-
kwargs["tools"] = tools
|
184
|
-
kwargs = {k: v for k, v in kwargs.items() if v is not None}
|
185
|
-
|
186
|
-
branch = Branch(**kwargs) # type: ignore
|
174
|
+
"""Create and include a new branch in the session."""
|
175
|
+
params = {
|
176
|
+
k: v
|
177
|
+
for k, v in locals().items()
|
178
|
+
if k not in ("self", "as_default_branch", "kwargs")
|
179
|
+
and v is not None
|
180
|
+
}
|
181
|
+
branch = Branch(**params, **kwargs) # type: ignore
|
187
182
|
self.include_branches(branch)
|
188
183
|
if as_default_branch:
|
189
184
|
self.default_branch = branch
|
lionagi/utils.py
CHANGED
@@ -35,7 +35,6 @@ from pydantic import BaseModel
|
|
35
35
|
from pydantic_core import PydanticUndefinedType
|
36
36
|
from typing_extensions import deprecated
|
37
37
|
|
38
|
-
from .libs.validate.xml_parser import xml_to_dict
|
39
38
|
from .ln import (
|
40
39
|
extract_json,
|
41
40
|
fuzzy_json,
|
@@ -746,6 +745,8 @@ def _str_to_dict(
|
|
746
745
|
"""
|
747
746
|
if not parser:
|
748
747
|
if str_type == "xml" and not parser:
|
748
|
+
from .libs.validate.xml_parser import xml_to_dict
|
749
|
+
|
749
750
|
parser = partial(
|
750
751
|
xml_to_dict, remove_root=remove_root, root_tag=root_tag
|
751
752
|
)
|
lionagi/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.16.
|
1
|
+
__version__ = "0.16.2"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: lionagi
|
3
|
-
Version: 0.16.
|
3
|
+
Version: 0.16.2
|
4
4
|
Summary: An Intelligence Operating System.
|
5
5
|
Author-email: HaiyangLi <quantocean.li@gmail.com>
|
6
6
|
License: Apache License
|
@@ -233,7 +233,6 @@ Requires-Dist: pydantic>=2.8.0
|
|
233
233
|
Requires-Dist: pydapter[pandas]>=1.1.1
|
234
234
|
Requires-Dist: python-dotenv>=1.1.0
|
235
235
|
Requires-Dist: tiktoken>=0.9.0
|
236
|
-
Requires-Dist: toml>=0.8.0
|
237
236
|
Provides-Extra: all
|
238
237
|
Requires-Dist: aiosqlite>=0.21.0; extra == 'all'
|
239
238
|
Requires-Dist: claude-code-sdk>=0.0.15; extra == 'all'
|
@@ -5,8 +5,8 @@ lionagi/_types.py,sha256=j8XwSGeGrYwfmSJ8o-80bsfoalLWJgQH41ZkVevc4wk,75
|
|
5
5
|
lionagi/config.py,sha256=D13nnjpgJKz_LlQrzaKKVefm4hqesz_dP9ROjWmGuLE,3811
|
6
6
|
lionagi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
lionagi/settings.py,sha256=HDuKCEJCpc4HudKodBnhoQUGuTGhRHdlIFhbtf3VBtY,1633
|
8
|
-
lionagi/utils.py,sha256=
|
9
|
-
lionagi/version.py,sha256=
|
8
|
+
lionagi/utils.py,sha256=DEE3ycbUvBDpJIliPfCY7B2HC-nnAcA4p7Xn5HPMTUM,27525
|
9
|
+
lionagi/version.py,sha256=EHpjUSkwlknz5LyeqzgJmyU4YsLCQqDv3RGeURQ4Phg,23
|
10
10
|
lionagi/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
lionagi/adapters/_utils.py,sha256=n4DS27CZfC-0O_UFaYtlUdjiMx9IeYsGpP7MVaFO5ZA,885
|
12
12
|
lionagi/adapters/async_postgres_adapter.py,sha256=StjdjzHVkYOC_xVfmaVBd0E34tdsUrbR3ENSpmZIfeI,3169
|
@@ -28,9 +28,8 @@ lionagi/libs/file/chunk.py,sha256=XeVMwM33JF0X1W6udz_nhlb3DCevA_EK6A50Hn_e5SY,93
|
|
28
28
|
lionagi/libs/file/concat.py,sha256=YSauXVBL3WWx5Mvpn208Cj7q9TLt_aq-0M9J1fm-ins,3864
|
29
29
|
lionagi/libs/file/concat_files.py,sha256=FoI983oWFzp9VfFDP7kmbRb3t1CPe5F5LCtsux0ASAs,3089
|
30
30
|
lionagi/libs/file/file_ops.py,sha256=HBiIh1EljIJ5VTIXuyvJM0ppSs0YYOPUWmgDMJT634U,3430
|
31
|
-
lionagi/libs/file/params.py,sha256=SZ5DkoffWfxWudOAYCfCxpL8UIm-1UjeyTtploo-Lqs,5824
|
32
31
|
lionagi/libs/file/process.py,sha256=XTfh1JDPancjFU0qr4-ONB2OXfKKkhQxL49sChYLl-0,8672
|
33
|
-
lionagi/libs/file/save.py,sha256=
|
32
|
+
lionagi/libs/file/save.py,sha256=jTiJMTOK3IiuCz1XbYZlzFmsqiy2q_Xz6subc4ZTJps,3063
|
34
33
|
lionagi/libs/nested/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
35
34
|
lionagi/libs/nested/flatten.py,sha256=sB4jxZRoaUbjak9RbIWVWNKz2hzkhQJPFffV_Ws1GA0,5479
|
36
35
|
lionagi/libs/nested/nfilter.py,sha256=kF7AWjLFHr22SOjRBSTx-7iRPaR7gs0FY5Y4XF2sWJ8,1768
|
@@ -48,28 +47,6 @@ lionagi/libs/schema/extract_docstring.py,sha256=uWyUevXS4JSN60tfouoBBAyE4_jyE-fz
|
|
48
47
|
lionagi/libs/schema/function_to_schema.py,sha256=XAB031WbYu3a7eFJyYjXVMAjmtWYSYr5kC_DYgjiuyM,5604
|
49
48
|
lionagi/libs/schema/json_schema.py,sha256=cuHcaMr748O9g6suNGmRx4tRXcidd5-c7AMGjTIZyHM,7670
|
50
49
|
lionagi/libs/schema/load_pydantic_model_from_schema.py,sha256=WIgJPmOu558az35CfOHvwyyTYQ5OBlk0hchvaEOADjQ,10109
|
51
|
-
lionagi/libs/token_transform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
52
|
-
lionagi/libs/token_transform/base.py,sha256=LBnaDgi4HNgaJJGwIzWcQjVMdu49i_93rRvOvMU22Rw,1545
|
53
|
-
lionagi/libs/token_transform/llmlingua.py,sha256=DkeLUlrb7rGx3nZ04aADU9HXXu5mZTf_DBwT0xhzIv4,7
|
54
|
-
lionagi/libs/token_transform/perplexity.py,sha256=m-n_ErNfFZ9fvM9TReBnfSmp-89PKM7bCmtAAszFnS0,14458
|
55
|
-
lionagi/libs/token_transform/symbolic_compress_context.py,sha256=hcYxvL0q2Lr8SIOPN09339TIQ8iROCwhBEUnwt9llXU,4636
|
56
|
-
lionagi/libs/token_transform/synthlang.py,sha256=W6e-_265UXqVosM9X0TLKW53rNHvWCKhsWbVAop49Ac,259
|
57
|
-
lionagi/libs/token_transform/types.py,sha256=4HgAfNDlJ_Hu18kLt59GHr_76eF3xLpNCTbOXlAYVlA,491
|
58
|
-
lionagi/libs/token_transform/synthlang_/base.py,sha256=djsR3Lc0UH1PYy2q4fpqL9tp-ZNKOYbmVTDP-_d1Poo,4107
|
59
|
-
lionagi/libs/token_transform/synthlang_/translate_to_synthlang.py,sha256=guA5v8CQRdAOsznsUSoK_x2JFzGbHE079AijDqqPPOw,4946
|
60
|
-
lionagi/libs/token_transform/synthlang_/resources/frameworks/abstract_algebra.toml,sha256=2TuOAo97g8mNhdPH96HP8vYZpnC8neiP-KlhVqbp1Us,970
|
61
|
-
lionagi/libs/token_transform/synthlang_/resources/frameworks/category_theory.toml,sha256=Stg9W3h8o7VkQ9tdAfSZmR3LctFqcH6OhOPdaw9BlIg,1064
|
62
|
-
lionagi/libs/token_transform/synthlang_/resources/frameworks/complex_analysis.toml,sha256=iE6FS7Cn5_uJRG5-StLuMM4XVAk95bxhbYWwlstw_tA,1044
|
63
|
-
lionagi/libs/token_transform/synthlang_/resources/frameworks/framework_options.json,sha256=phAkedPGrwgNGW8hgPyH6pKU47pvKEAnG7vheWFvOLc,1760
|
64
|
-
lionagi/libs/token_transform/synthlang_/resources/frameworks/group_theory.toml,sha256=iVlcS250YMosNRv3l8bz3BT9Tx1xCmiwhfNt4CjjRYc,713
|
65
|
-
lionagi/libs/token_transform/synthlang_/resources/frameworks/math_logic.toml,sha256=jeFOF8gjRhb4hYXpW7AxTX8uk9c6DvGulJK5Bowxhq4,1037
|
66
|
-
lionagi/libs/token_transform/synthlang_/resources/frameworks/reflective_patterns.toml,sha256=LxBIVLHNLfvVdXjLAzqivrYaHNix514DLNYsbA-VSQ4,5730
|
67
|
-
lionagi/libs/token_transform/synthlang_/resources/frameworks/set_theory.toml,sha256=SZpBvUySZ3_0pIrRko24a3KfbPHd55LyNwzFHyznjs4,1457
|
68
|
-
lionagi/libs/token_transform/synthlang_/resources/frameworks/topology_fundamentals.toml,sha256=nnhfbIJQ5pTGlX7lo1XzjyOevaZOHuusvBuhwWHzbLk,1008
|
69
|
-
lionagi/libs/token_transform/synthlang_/resources/mapping/lion_emoji_mapping.toml,sha256=THLrry9RTHMCMv-g6VCwrlaE4_9_fjXkABgyAyhokew,1323
|
70
|
-
lionagi/libs/token_transform/synthlang_/resources/mapping/python_math_mapping.toml,sha256=Q0MqTf9t5rWuKHLsKu9WS8NSBSb9FsGAAaG5EYQiGCA,964
|
71
|
-
lionagi/libs/token_transform/synthlang_/resources/mapping/rust_chinese_mapping.toml,sha256=o-7KACVDQYkpAGSFgsMCeIy_S93CilUP9w1ZKM0w62A,1217
|
72
|
-
lionagi/libs/token_transform/synthlang_/resources/utility/base_synthlang_system_prompt.toml,sha256=8xhY14WdDRF6GIToqzRPM7EjM6-uO6-hQ9Muei1A2Iw,3458
|
73
50
|
lionagi/libs/unstructured/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
74
51
|
lionagi/libs/unstructured/pdf_to_image.py,sha256=lJ2CVxOYh61-3-55nusHXMOGqtEyLXsXmDjZ9yjkM48,1394
|
75
52
|
lionagi/libs/unstructured/read_image_to_base64.py,sha256=EJXWBJxCTa9vHBIFPRqQj0jeFXyDv1cs2oPBrWt-waQ,897
|
@@ -81,10 +58,10 @@ lionagi/libs/validate/string_similarity.py,sha256=kuOQFNnI773bV8KKj_PUYxx8vLRdWa
|
|
81
58
|
lionagi/libs/validate/to_num.py,sha256=ZRHDjpTCykPfDIZZa4rZKNaR_8ZHbPDFlw9rc02DrII,11610
|
82
59
|
lionagi/libs/validate/validate_boolean.py,sha256=bjiX_WZ3Bg8XcqoWLzE1G9BpO0AisrlZUxrpye_mlGk,3614
|
83
60
|
lionagi/libs/validate/xml_parser.py,sha256=PHBYAre4hhthPpDP9Yrp3UYSWdANPx60F1qhxe0m4uw,7004
|
84
|
-
lionagi/ln/__init__.py,sha256=
|
61
|
+
lionagi/ln/__init__.py,sha256=1D21gwXiZ8rLr9dP7y85MupXkBULRKMO22e5x-iTKN4,1603
|
85
62
|
lionagi/ln/_async_call.py,sha256=mnqq5l-hNIBWrWh7X7CtmwPafg1kT-lnWWm3nJnbPoI,9384
|
86
63
|
lionagi/ln/_hash.py,sha256=WLwKsbJISE7KtOrpiE30AFtfwyOCSBjb1GslBlvj5ac,4529
|
87
|
-
lionagi/ln/_json_dump.py,sha256=
|
64
|
+
lionagi/ln/_json_dump.py,sha256=r3Hwsl94Z9b4Kr6PCT-AYXWZkEeFXuPwpbpLDPjooew,10550
|
88
65
|
lionagi/ln/_list_call.py,sha256=zvISmCeNAH7yjBcusQI1s17n556tILgePhRMdAM2plA,2831
|
89
66
|
lionagi/ln/_to_list.py,sha256=YOlrMplSpQhXDSTK4fkMF7Mhuw1wS0jGip5mS88Otro,6610
|
90
67
|
lionagi/ln/_utils.py,sha256=5Z_AsDxdtH5wNB-P4IiihhH0dYUcZMT-hTxFQBQPwL0,4303
|
@@ -109,7 +86,7 @@ lionagi/models/__init__.py,sha256=R7DEGWuhH-izP7eN6SOw24-I4Mr2IVPXF4gNysmF2zQ,45
|
|
109
86
|
lionagi/models/field_model.py,sha256=JdmCp2pmwoy5HuduF21ivqyvMaJ04CTXu6Un-AeSwLU,23652
|
110
87
|
lionagi/models/hashable_model.py,sha256=oOqR3OJCU9cJfWHiG0WaEw0GMqfE2WTt4cy7WsAsiRg,829
|
111
88
|
lionagi/models/model_params.py,sha256=zVU-PHp3skjK5ZVjpsPs1k_VJiS8X0hgct0xs6Z6W_Y,10955
|
112
|
-
lionagi/models/note.py,sha256=
|
89
|
+
lionagi/models/note.py,sha256=OsTxh5D931Pcd0uiIk4BadX45iBEW0Id0K8wM8QjXB8,12242
|
113
90
|
lionagi/models/operable_model.py,sha256=Zm_Hxdauqyh0za3_TJLCZ3g6nR4F45Rrnc0ZM3d54Gs,20111
|
114
91
|
lionagi/models/schema_model.py,sha256=ghRIM8aBNaToAknwNlhQKpuKXcwzyCw5pDE31bVKxs0,667
|
115
92
|
lionagi/operations/__init__.py,sha256=a1EqxC5jRgVM1z_srZsxXtTC2Q6iA79ofpcd7cyT3B8,632
|
@@ -125,7 +102,7 @@ lionagi/operations/ReAct/utils.py,sha256=qYh-zTRCHXyuNpSgBmooTG0TVp9Pdht0tONPwdv
|
|
125
102
|
lionagi/operations/_act/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
126
103
|
lionagi/operations/_act/act.py,sha256=LfN4UqTTHVvO1h9tqmDhVfVafVUOry4YGEivIZbmLqc,2810
|
127
104
|
lionagi/operations/brainstorm/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
128
|
-
lionagi/operations/brainstorm/brainstorm.py,sha256=
|
105
|
+
lionagi/operations/brainstorm/brainstorm.py,sha256=FBgw0YIx18fFms_6Oiz9kklKWrq-ncJeJV-d05MH_BI,18781
|
129
106
|
lionagi/operations/brainstorm/prompt.py,sha256=Dqi4NNeztdI4iutggRqjnOrG4a4E2JtwIAtRnjZ_ghQ,610
|
130
107
|
lionagi/operations/chat/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
131
108
|
lionagi/operations/chat/chat.py,sha256=F5ugFtMm4OdNCQhaKN-0ezIcfInR_za5I7WbBC9qfzQ,5493
|
@@ -145,8 +122,6 @@ lionagi/operations/plan/prompt.py,sha256=GUNZ8RpHIa89D-_y7GK--Spg0JADI3K13sjf_w3
|
|
145
122
|
lionagi/operations/select/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
146
123
|
lionagi/operations/select/select.py,sha256=2l16ySPiqp5vyAMYm0CNBpNRVB0zvS76QwNAyFQ7tB4,2491
|
147
124
|
lionagi/operations/select/utils.py,sha256=1S4Wo59hr0rbZG72EPnVExfx4G72sIeUh2vlqVtslqE,3711
|
148
|
-
lionagi/operations/translate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
149
|
-
lionagi/operations/translate/translate.py,sha256=6eBVoQRarGEJ8Tfcl6Z__PLHQTTIbM5MaPVYNeKHRIs,1397
|
150
125
|
lionagi/protocols/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
151
126
|
lionagi/protocols/_concepts.py,sha256=ZBN5OYpLMWLrl9uZqSg9GD4uwf60V4VHcxRnBTRWIRc,1555
|
152
127
|
lionagi/protocols/contracts.py,sha256=ii7luaPJsEKOb3J-rcaNysPDGU3nEzpgy_8g1z5_CCA,1398
|
@@ -162,9 +137,9 @@ lionagi/protocols/forms/flow.py,sha256=t9Ycvmb-stj0rCyvXXwd7WBcDtuCCTEKYst2aqFDV
|
|
162
137
|
lionagi/protocols/forms/form.py,sha256=B4903km_Ljz-OxYkb1ZT_cpHZSaAYYJpZMsffWlooo8,3062
|
163
138
|
lionagi/protocols/forms/report.py,sha256=SvJJjOSCTfVuqK7AKaY8ldQIGJeSK2zoyPWUV41ge2c,1609
|
164
139
|
lionagi/protocols/generic/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
165
|
-
lionagi/protocols/generic/element.py,sha256=
|
140
|
+
lionagi/protocols/generic/element.py,sha256=yD4SWNOGZsLTgxtz6TKtJfqkUvDmUH9wIH3Liw6QmmA,15839
|
166
141
|
lionagi/protocols/generic/event.py,sha256=n5EraAJ5bPiwegTdkxsILs7-vFJwmnXhB2om4xMQnK0,6529
|
167
|
-
lionagi/protocols/generic/log.py,sha256=
|
142
|
+
lionagi/protocols/generic/log.py,sha256=AnPr2RweSZcJdxOK0KGb1eyvAPZmME3hEm9HraUoftQ,8212
|
168
143
|
lionagi/protocols/generic/pile.py,sha256=mc10zh9RdqfozPEBOgRdkrTgIWUHBz8enAcQ-8pFhRQ,37046
|
169
144
|
lionagi/protocols/generic/processor.py,sha256=uiNIldAYPEujuboLFyrIJADMlhRghy3H86hYintj5D4,11705
|
170
145
|
lionagi/protocols/generic/progression.py,sha256=HCV_EnQCFvjg6D7eF4ygGrZNQPEOtu75zvW1sJbAVrM,15190
|
@@ -186,7 +161,7 @@ lionagi/protocols/messages/assistant_response.py,sha256=jrzRPVHHDnPw86Xp0IHnPy0t
|
|
186
161
|
lionagi/protocols/messages/base.py,sha256=Ng1Q8yIIIFauUv53LnwDeyOrM-cSCfsHM1GwkxChf2o,2317
|
187
162
|
lionagi/protocols/messages/instruction.py,sha256=Qpme1oSc406V3-F2iOyqC8TVT2GWVduZaoDfdGdBnDI,21127
|
188
163
|
lionagi/protocols/messages/manager.py,sha256=ABDiN-QULbfbSrHVlPe3kqBxr7e7sYoT49wHQMLiT6c,16897
|
189
|
-
lionagi/protocols/messages/message.py,sha256=
|
164
|
+
lionagi/protocols/messages/message.py,sha256=y8jSG5GQUjppvvMRDOWGlPNQn_I8MgATiU1AjsH2TKQ,7953
|
190
165
|
lionagi/protocols/messages/system.py,sha256=x0F1C57SFHaO2-Z9cy1QshYlxv8wjl7VppooaGKbMIg,4658
|
191
166
|
lionagi/protocols/messages/templates/README.md,sha256=Ch4JrKSjd85fLitAYO1OhZjNOGKHoEwaKQlcV16jiUI,1286
|
192
167
|
lionagi/protocols/messages/templates/action_request.jinja2,sha256=d6OmxHKyvvNDSK4bnBM3TGSUk_HeE_Q2EtLAQ0ZBEJg,120
|
@@ -207,13 +182,13 @@ lionagi/service/token_calculator.py,sha256=piTidArzUkIMCtOLC_HBLoZNYZcENQywgeKM3
|
|
207
182
|
lionagi/service/types.py,sha256=9zX08BhdmPE9FE1YTyvsy14hdDGRYzyyVBmoBURzQvI,1096
|
208
183
|
lionagi/service/connections/__init__.py,sha256=yHQZ7OJpCftd6CStYR8inbxjJydYdmv9kCvbUBhJ2zU,362
|
209
184
|
lionagi/service/connections/api_calling.py,sha256=fY-fzwSJvQKpUT27TF0MTfE5TxroYKkL4SHWYrmYznI,9958
|
210
|
-
lionagi/service/connections/endpoint.py,sha256=
|
185
|
+
lionagi/service/connections/endpoint.py,sha256=kpSWQzPWh4WdjlZRuTAmPmeg-Z9g2NFx4b_pJMkWJq0,15055
|
211
186
|
lionagi/service/connections/endpoint_config.py,sha256=6sA06uCzriT6p0kFxhDCFH8N6V6MVp8ytlOw5ctBhDI,5169
|
212
187
|
lionagi/service/connections/header_factory.py,sha256=IYeTQQk7r8FXcdhmW7orCxHjNO-Nb1EOXhgNK7CAp-I,1821
|
213
188
|
lionagi/service/connections/match_endpoint.py,sha256=Df5v3bprnJq5CqOzuK0KzwawOIfAsGZZM4CnE-sliu4,2850
|
214
189
|
lionagi/service/connections/providers/__init__.py,sha256=3lzOakDoBWmMaNnT2g-YwktPKa_Wme4lnPRSmOQfayY,105
|
215
190
|
lionagi/service/connections/providers/anthropic_.py,sha256=vok8mIyFiuV3K83tOjdYfruA6cv1h_57ML6RtpuW-bU,3157
|
216
|
-
lionagi/service/connections/providers/claude_code_.py,sha256=
|
191
|
+
lionagi/service/connections/providers/claude_code_.py,sha256=ltk41ZdMCf-QSxqUhbb_Un9VC7J0Ek6n20LFJDeoSyY,10589
|
217
192
|
lionagi/service/connections/providers/claude_code_cli.py,sha256=kqEOnCUOOh2O_3NGi6W7r-gdLsbW-Jcp11tm30VEv4Q,4455
|
218
193
|
lionagi/service/connections/providers/exa_.py,sha256=kuWD7yyYRqIa4ChSn0TsxFA5V5LwvFUD-w8TZ6mx4rk,1048
|
219
194
|
lionagi/service/connections/providers/nvidia_nim_.py,sha256=95vmo0DSONYBVHkR9SGJ5BiHNKFZNZBrjw4_7ShOXQA,3154
|
@@ -234,16 +209,15 @@ lionagi/service/third_party/exa_models.py,sha256=G_hnekcy-DillPLzMoDQ8ZisVAL8Mp7
|
|
234
209
|
lionagi/service/third_party/openai_model_names.py,sha256=C44tnqexgc4ZU2-3I_sn5d688hf3WWx-25xBd50bvas,5121
|
235
210
|
lionagi/service/third_party/pplx_models.py,sha256=-EhyJgOWR6rzSv3zczUtk80X6c19p18Dg9KC6l8BFRQ,6473
|
236
211
|
lionagi/session/__init__.py,sha256=kDypY6L3kGPnatAw7YNQAykgg-9MlIBnlhHExaXvt-c,202
|
237
|
-
lionagi/session/branch.py,sha256=
|
212
|
+
lionagi/session/branch.py,sha256=3AZMLLinpVGRd6e99I9AxYx03U2CBG68dgJRKe1NGDo,64808
|
238
213
|
lionagi/session/prompts.py,sha256=GPr0jibyAAqS3awDzGC8SoCL6aWJLLCCbXY0JUuxOC0,3170
|
239
|
-
lionagi/session/session.py,sha256=
|
214
|
+
lionagi/session/session.py,sha256=OZPLXmKP-WGBU_TW1gAp4sv5WsNqO0VphWCXfbQf5YE,13382
|
240
215
|
lionagi/tools/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
241
216
|
lionagi/tools/base.py,sha256=hEGnE4MD0CM4UqnF0xsDRKB0aM-pyrTFHl8utHhyJLU,1897
|
242
217
|
lionagi/tools/types.py,sha256=XtJLY0m-Yi_ZLWhm0KycayvqMCZd--HxfQ0x9vFUYDE,230
|
243
218
|
lionagi/tools/file/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
244
219
|
lionagi/tools/file/reader.py,sha256=2YKgU3VKo76zfL_buDAUQJoPLC56f6WJ4_mdJjlMDIM,9509
|
245
|
-
lionagi/
|
246
|
-
lionagi-0.16.
|
247
|
-
lionagi-0.16.
|
248
|
-
lionagi-0.16.
|
249
|
-
lionagi-0.16.1.dist-info/RECORD,,
|
220
|
+
lionagi-0.16.2.dist-info/METADATA,sha256=1_uQHVJzsHDEvYYVenSmEIz99JfbQaW6NVrCFTKn3QY,23086
|
221
|
+
lionagi-0.16.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
222
|
+
lionagi-0.16.2.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
|
223
|
+
lionagi-0.16.2.dist-info/RECORD,,
|
lionagi/libs/file/params.py
DELETED
@@ -1,175 +0,0 @@
|
|
1
|
-
# Copyright (c) 2023 - 2025, HaiyangLi <quantocean.li at gmail dot com>
|
2
|
-
#
|
3
|
-
# SPDX-License-Identifier: Apache-2.0
|
4
|
-
|
5
|
-
from collections.abc import Callable
|
6
|
-
from pathlib import Path
|
7
|
-
from typing import Any, Literal
|
8
|
-
|
9
|
-
from pydantic import BaseModel, Field
|
10
|
-
|
11
|
-
|
12
|
-
class ChunkContentParams(BaseModel):
|
13
|
-
"""Parameters for chunking text content into smaller pieces.
|
14
|
-
|
15
|
-
This model defines parameters used by the chunk_content function to split text
|
16
|
-
content into chunks, with support for both character-based and token-based chunking.
|
17
|
-
"""
|
18
|
-
|
19
|
-
content: str = Field(description="The text content to be chunked")
|
20
|
-
chunk_by: Literal["chars", "tokens"] = Field(
|
21
|
-
default="chars",
|
22
|
-
description="Method to use for chunking: 'chars' for character-based or 'tokens' for token-based",
|
23
|
-
)
|
24
|
-
tokenizer: Callable[[str], list[str]] | None = Field(
|
25
|
-
default=None,
|
26
|
-
description="Function to use for tokenization. Defaults to str.split if None",
|
27
|
-
)
|
28
|
-
chunk_size: int = Field(
|
29
|
-
default=1024, ge=1, description="Target size for each chunk"
|
30
|
-
)
|
31
|
-
overlap: float = Field(
|
32
|
-
default=0.0,
|
33
|
-
ge=0.0,
|
34
|
-
le=1.0,
|
35
|
-
description="Fraction of overlap between chunks (0.0 to 1.0)",
|
36
|
-
)
|
37
|
-
threshold: int = Field(
|
38
|
-
default=256,
|
39
|
-
ge=0,
|
40
|
-
description="Minimum size threshold for the last chunk",
|
41
|
-
)
|
42
|
-
metadata: dict[str, Any] = Field(
|
43
|
-
default_factory=dict,
|
44
|
-
description="Additional metadata to include with each chunk",
|
45
|
-
)
|
46
|
-
return_tokens: bool = Field(
|
47
|
-
default=False,
|
48
|
-
description="If True, return chunks as token lists; if False, return as joined strings",
|
49
|
-
)
|
50
|
-
|
51
|
-
|
52
|
-
class DirToFilesParams(BaseModel):
|
53
|
-
"""Parameters for processing directories and collecting file paths.
|
54
|
-
|
55
|
-
This model defines parameters used by the dir_to_files function to recursively
|
56
|
-
process directories and collect matching file paths.
|
57
|
-
"""
|
58
|
-
|
59
|
-
directory: Path | str = Field(
|
60
|
-
description="Directory to process recursively"
|
61
|
-
)
|
62
|
-
file_types: list[str] | None = Field(
|
63
|
-
default=None,
|
64
|
-
description="List of file extensions to include (e.g., ['.txt', '.pdf']). If None, includes all types",
|
65
|
-
)
|
66
|
-
max_workers: int | None = Field(
|
67
|
-
default=None,
|
68
|
-
description="Maximum number of worker threads for concurrent processing",
|
69
|
-
)
|
70
|
-
ignore_errors: bool = Field(
|
71
|
-
default=False,
|
72
|
-
description="If True, log warnings for errors instead of raising exceptions",
|
73
|
-
)
|
74
|
-
verbose: bool = Field(
|
75
|
-
default=False,
|
76
|
-
description="If True, print verbose output during processing",
|
77
|
-
)
|
78
|
-
|
79
|
-
|
80
|
-
class FileToChunksParams(BaseModel):
|
81
|
-
"""Parameters for splitting file content into chunks.
|
82
|
-
|
83
|
-
This model defines parameters used by the file_to_chunks function to read
|
84
|
-
and split file content into chunks with metadata.
|
85
|
-
"""
|
86
|
-
|
87
|
-
file_path: Path | str = Field(
|
88
|
-
description="Path to the file to be processed"
|
89
|
-
)
|
90
|
-
chunk_func: Callable[[str, int, float, int], list[str]] = Field(
|
91
|
-
description="Function to use for chunking the content"
|
92
|
-
)
|
93
|
-
chunk_size: int = Field(
|
94
|
-
default=1500, ge=1, description="Target size for each chunk"
|
95
|
-
)
|
96
|
-
overlap: float = Field(
|
97
|
-
default=0.1,
|
98
|
-
ge=0.0,
|
99
|
-
le=1.0,
|
100
|
-
description="Fraction of overlap between chunks (0.0 to 1.0)",
|
101
|
-
)
|
102
|
-
threshold: int = Field(
|
103
|
-
default=200,
|
104
|
-
ge=0,
|
105
|
-
description="Minimum size threshold for the last chunk",
|
106
|
-
)
|
107
|
-
encoding: str = Field(
|
108
|
-
default="utf-8",
|
109
|
-
description="File encoding to use when reading the file",
|
110
|
-
)
|
111
|
-
custom_metadata: dict[str, Any] | None = Field(
|
112
|
-
default=None,
|
113
|
-
description="Additional metadata to include with each chunk",
|
114
|
-
)
|
115
|
-
output_dir: Path | str | None = Field(
|
116
|
-
default=None,
|
117
|
-
description="Directory to save output chunks (if provided)",
|
118
|
-
)
|
119
|
-
verbose: bool = Field(
|
120
|
-
default=False,
|
121
|
-
description="If True, print verbose output during processing",
|
122
|
-
)
|
123
|
-
timestamp: bool = Field(
|
124
|
-
default=True,
|
125
|
-
description="If True, include timestamp in output filenames",
|
126
|
-
)
|
127
|
-
random_hash_digits: int = Field(
|
128
|
-
default=4,
|
129
|
-
ge=0,
|
130
|
-
description="Number of random hash digits to include in output filenames",
|
131
|
-
)
|
132
|
-
|
133
|
-
|
134
|
-
class SaveToFileParams(BaseModel):
|
135
|
-
"""Parameters for saving text content to a file.
|
136
|
-
|
137
|
-
This model defines parameters used by the save_to_file function to save
|
138
|
-
text content to a file with various options for naming and handling.
|
139
|
-
"""
|
140
|
-
|
141
|
-
text: str = Field(description="The text content to save to file")
|
142
|
-
directory: Path | str = Field(
|
143
|
-
description="Directory where the file will be saved"
|
144
|
-
)
|
145
|
-
filename: str = Field(description="Name of the file to create")
|
146
|
-
extension: str | None = Field(
|
147
|
-
default=None,
|
148
|
-
description="File extension (with or without leading dot)",
|
149
|
-
)
|
150
|
-
timestamp: bool = Field(
|
151
|
-
default=False, description="If True, append timestamp to filename"
|
152
|
-
)
|
153
|
-
dir_exist_ok: bool = Field(
|
154
|
-
default=True,
|
155
|
-
description="If True, creates directory if it doesn't exist",
|
156
|
-
)
|
157
|
-
file_exist_ok: bool = Field(
|
158
|
-
default=False, description="If True, allows overwriting existing files"
|
159
|
-
)
|
160
|
-
time_prefix: bool = Field(
|
161
|
-
default=False,
|
162
|
-
description="If True, prepend timestamp instead of append",
|
163
|
-
)
|
164
|
-
timestamp_format: str | None = Field(
|
165
|
-
default=None,
|
166
|
-
description="Custom format for timestamp (strftime format)",
|
167
|
-
)
|
168
|
-
random_hash_digits: int = Field(
|
169
|
-
default=0,
|
170
|
-
ge=0,
|
171
|
-
description="Number of random hash digits to append to filename",
|
172
|
-
)
|
173
|
-
verbose: bool = Field(
|
174
|
-
default=True, description="If True, logs the file path after saving"
|
175
|
-
)
|
File without changes
|
@@ -1,54 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
from enum import Enum
|
4
|
-
from pathlib import Path
|
5
|
-
|
6
|
-
from pydantic import Field
|
7
|
-
|
8
|
-
from lionagi.tools.base import Resource, ResourceCategory
|
9
|
-
|
10
|
-
here = Path(__file__).parent.resolve()
|
11
|
-
MAPPING_PATH = "synthlang_/resources/mapping"
|
12
|
-
|
13
|
-
|
14
|
-
class TokenMappingTemplate(str, Enum):
|
15
|
-
RUST_CHINESE = "rust_chinese"
|
16
|
-
LION_EMOJI = "lion_emoji"
|
17
|
-
PYTHON_MATH = "python_math"
|
18
|
-
|
19
|
-
@property
|
20
|
-
def fp(self) -> Path:
|
21
|
-
return here / MAPPING_PATH / f"{self.value}_mapping.toml"
|
22
|
-
|
23
|
-
|
24
|
-
class TokenMapping(Resource):
|
25
|
-
category: ResourceCategory = Field(
|
26
|
-
default=ResourceCategory.UTILITY, frozen=True
|
27
|
-
)
|
28
|
-
content: dict
|
29
|
-
|
30
|
-
@classmethod
|
31
|
-
def load_from_template(
|
32
|
-
cls, template: TokenMappingTemplate | str
|
33
|
-
) -> TokenMapping:
|
34
|
-
if isinstance(template, str):
|
35
|
-
template = template.lower().strip()
|
36
|
-
template = (
|
37
|
-
template.replace(".toml", "")
|
38
|
-
.replace(" ", "_")
|
39
|
-
.replace("-", "_")
|
40
|
-
.strip()
|
41
|
-
)
|
42
|
-
if template.endswith("_mapping"):
|
43
|
-
template = template[:-8]
|
44
|
-
if "/" in template:
|
45
|
-
template = template.split("/")[-1]
|
46
|
-
template = TokenMappingTemplate(template)
|
47
|
-
|
48
|
-
if isinstance(template, TokenMappingTemplate):
|
49
|
-
template = template.fp
|
50
|
-
return cls.adapt_from(template, ".toml", many=False)
|
51
|
-
|
52
|
-
raise ValueError(
|
53
|
-
f"Invalid template: {template}. Must be a TokenMappingTemplate or a valid path."
|
54
|
-
)
|
@@ -1 +0,0 @@
|
|
1
|
-
# TODO
|