lionagi 0.14.5__py3-none-any.whl → 0.14.6__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/fields/instruct.py +3 -17
- lionagi/libs/concurrency/cancel.py +1 -1
- lionagi/operations/builder.py +9 -0
- lionagi/operations/flow.py +163 -60
- lionagi/protocols/generic/pile.py +34 -15
- lionagi/service/connections/providers/_claude_code/__init__.py +3 -0
- lionagi/service/connections/providers/_claude_code/models.py +235 -0
- lionagi/service/connections/providers/_claude_code/stream_cli.py +350 -0
- lionagi/service/connections/providers/claude_code_.py +13 -223
- lionagi/service/connections/providers/claude_code_cli.py +38 -343
- lionagi/session/branch.py +6 -46
- lionagi/session/session.py +26 -8
- lionagi/version.py +1 -1
- {lionagi-0.14.5.dist-info → lionagi-0.14.6.dist-info}/METADATA +1 -1
- {lionagi-0.14.5.dist-info → lionagi-0.14.6.dist-info}/RECORD +17 -14
- {lionagi-0.14.5.dist-info → lionagi-0.14.6.dist-info}/WHEEL +0 -0
- {lionagi-0.14.5.dist-info → lionagi-0.14.6.dist-info}/licenses/LICENSE +0 -0
lionagi/session/branch.py
CHANGED
@@ -917,9 +917,7 @@ class Branch(Element, Communicatable, Relational):
|
|
917
917
|
actions: bool = False,
|
918
918
|
reason: bool = False,
|
919
919
|
action_kwargs: dict = None,
|
920
|
-
action_strategy: Literal[
|
921
|
-
"sequential", "concurrent", "batch"
|
922
|
-
] = "concurrent",
|
920
|
+
action_strategy: Literal["sequential", "concurrent"] = "concurrent",
|
923
921
|
verbose_action: bool = False,
|
924
922
|
field_models: list[FieldModel] = None,
|
925
923
|
exclude_fields: list | dict | None = None,
|
@@ -987,7 +985,7 @@ class Branch(Element, Communicatable, Relational):
|
|
987
985
|
If `True`, signals that the LLM should provide chain-of-thought or reasoning (where applicable).
|
988
986
|
action_kwargs (dict | None, optional):
|
989
987
|
Additional parameters for the `branch.act()` call if tools are invoked.
|
990
|
-
action_strategy (Literal["sequential","concurrent"
|
988
|
+
action_strategy (Literal["sequential","concurrent"], optional):
|
991
989
|
The strategy for invoking tools (default: "concurrent").
|
992
990
|
verbose_action (bool, optional):
|
993
991
|
If `True`, logs detailed information about tool invocation.
|
@@ -1174,9 +1172,8 @@ class Branch(Element, Communicatable, Relational):
|
|
1174
1172
|
self,
|
1175
1173
|
action_request: list | ActionRequest | BaseModel | dict,
|
1176
1174
|
*,
|
1177
|
-
strategy: Literal["concurrent", "sequential"
|
1175
|
+
strategy: Literal["concurrent", "sequential"] = "concurrent",
|
1178
1176
|
verbose_action: bool = False,
|
1179
|
-
batch_size: int = None,
|
1180
1177
|
suppress_errors: bool = True,
|
1181
1178
|
sanitize_input: bool = False,
|
1182
1179
|
unique_input: bool = False,
|
@@ -1223,7 +1220,7 @@ class Branch(Element, Communicatable, Relational):
|
|
1223
1220
|
retry_timeout (float|None):
|
1224
1221
|
Overall timeout for all attempts (None = no limit).
|
1225
1222
|
max_concurrent (int|None):
|
1226
|
-
Maximum concurrent tasks
|
1223
|
+
Maximum concurrent tasks.
|
1227
1224
|
throttle_period (float|None):
|
1228
1225
|
Minimum spacing (in seconds) between requests.
|
1229
1226
|
flatten (bool):
|
@@ -1239,11 +1236,6 @@ class Branch(Element, Communicatable, Relational):
|
|
1239
1236
|
Any:
|
1240
1237
|
The result or results from the invoked tool(s).
|
1241
1238
|
"""
|
1242
|
-
if batch_size and not strategy == "batch":
|
1243
|
-
raise ValueError(
|
1244
|
-
"Batch size is only applicable for 'batch' strategy."
|
1245
|
-
)
|
1246
|
-
|
1247
1239
|
match strategy:
|
1248
1240
|
case "concurrent":
|
1249
1241
|
return await self._concurrent_act(
|
@@ -1271,27 +1263,8 @@ class Branch(Element, Communicatable, Relational):
|
|
1271
1263
|
verbose_action=verbose_action,
|
1272
1264
|
suppress_errors=suppress_errors,
|
1273
1265
|
)
|
1274
|
-
case
|
1275
|
-
|
1276
|
-
action_request,
|
1277
|
-
verbose_action=verbose_action,
|
1278
|
-
batch_size=batch_size or 1,
|
1279
|
-
max_concurrent=max_concurrent,
|
1280
|
-
suppress_errors=suppress_errors,
|
1281
|
-
sanitize_input=sanitize_input,
|
1282
|
-
unique_input=unique_input,
|
1283
|
-
num_retries=num_retries,
|
1284
|
-
initial_delay=initial_delay,
|
1285
|
-
retry_delay=retry_delay,
|
1286
|
-
backoff_factor=backoff_factor,
|
1287
|
-
retry_default=retry_default,
|
1288
|
-
retry_timeout=retry_timeout,
|
1289
|
-
throttle_period=throttle_period,
|
1290
|
-
flatten=flatten,
|
1291
|
-
dropna=dropna,
|
1292
|
-
unique_output=unique_output,
|
1293
|
-
flatten_tuple_set=flatten_tuple_set,
|
1294
|
-
)
|
1266
|
+
case _:
|
1267
|
+
raise
|
1295
1268
|
|
1296
1269
|
async def _concurrent_act(
|
1297
1270
|
self,
|
@@ -1322,19 +1295,6 @@ class Branch(Element, Communicatable, Relational):
|
|
1322
1295
|
)
|
1323
1296
|
return results
|
1324
1297
|
|
1325
|
-
async def _batch_act(
|
1326
|
-
self,
|
1327
|
-
action_request: list[ActionRequest | BaseModel | dict],
|
1328
|
-
batch_size: int = None,
|
1329
|
-
**kwargs,
|
1330
|
-
) -> list:
|
1331
|
-
result = []
|
1332
|
-
async for i in bcall(
|
1333
|
-
action_request, self._act, batch_size=batch_size, **kwargs
|
1334
|
-
):
|
1335
|
-
result.extend(i)
|
1336
|
-
return result
|
1337
|
-
|
1338
1298
|
async def translate(
|
1339
1299
|
self,
|
1340
1300
|
text: str,
|
lionagi/session/session.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
+
import contextlib
|
5
6
|
from collections.abc import Callable
|
6
7
|
from typing import Any
|
7
8
|
|
@@ -46,7 +47,7 @@ class Session(Node, Communicatable, Relational):
|
|
46
47
|
mail_manager (MailManager | None): Manages mail operations.
|
47
48
|
"""
|
48
49
|
|
49
|
-
branches: Pile[
|
50
|
+
branches: Pile[Branch] = Field(
|
50
51
|
default_factory=lambda: Pile(item_type={Branch}, strict_type=False)
|
51
52
|
)
|
52
53
|
default_branch: Any = Field(default=None, exclude=True)
|
@@ -57,21 +58,38 @@ class Session(Node, Communicatable, Relational):
|
|
57
58
|
name: str = Field(default="Session")
|
58
59
|
|
59
60
|
@model_validator(mode="after")
|
60
|
-
def
|
61
|
+
def _add_mail_sources(self) -> Self:
|
61
62
|
if self.default_branch is None:
|
62
|
-
from .branch import Branch
|
63
|
-
|
64
63
|
self.default_branch = Branch()
|
65
|
-
return self
|
66
|
-
|
67
|
-
@model_validator(mode="after")
|
68
|
-
def _add_mail_sources(self) -> Self:
|
69
64
|
if self.default_branch not in self.branches:
|
70
65
|
self.branches.include(self.default_branch)
|
71
66
|
if self.branches:
|
72
67
|
self.mail_manager.add_sources(self.branches)
|
73
68
|
return self
|
74
69
|
|
70
|
+
def _lookup_branch_by_name(self, name: str) -> Branch | None:
|
71
|
+
for branch in self.branches:
|
72
|
+
if branch.name == name:
|
73
|
+
return branch
|
74
|
+
return None
|
75
|
+
|
76
|
+
def get_branch(
|
77
|
+
self, branch: ID.Ref | str, default: Any = ..., /
|
78
|
+
) -> Branch:
|
79
|
+
"""Get a branch by its ID or name."""
|
80
|
+
|
81
|
+
with contextlib.suppress(ItemNotFoundError, ValueError):
|
82
|
+
id = ID.get_id(branch)
|
83
|
+
return self.branches[id]
|
84
|
+
|
85
|
+
if isinstance(branch, str):
|
86
|
+
if b := self._lookup_branch_by_name(branch):
|
87
|
+
return b
|
88
|
+
|
89
|
+
if default is ...:
|
90
|
+
raise ItemNotFoundError(f"Branch '{branch}' not found.")
|
91
|
+
return default
|
92
|
+
|
75
93
|
def new_branch(
|
76
94
|
self,
|
77
95
|
system: System | JsonValue = None,
|
lionagi/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.14.
|
1
|
+
__version__ = "0.14.6"
|
@@ -6,7 +6,7 @@ lionagi/config.py,sha256=Dxs5FA9UCv1YX5H54qOJcPsDrIF9wFokWEPZ212eH-k,3715
|
|
6
6
|
lionagi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
lionagi/settings.py,sha256=HDuKCEJCpc4HudKodBnhoQUGuTGhRHdlIFhbtf3VBtY,1633
|
8
8
|
lionagi/utils.py,sha256=n2aUMSnLLgy7HWFlfzDV1OqMDbatLNX0QYc7jIjXwQA,75023
|
9
|
-
lionagi/version.py,sha256=
|
9
|
+
lionagi/version.py,sha256=8YscPb5efWnULR4pGFhtuY0RRhqCGPpeGi69mc5MYv4,23
|
10
10
|
lionagi/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
lionagi/adapters/async_postgres_adapter.py,sha256=Kf2YCzwRqKpEHY3GQCXEiMl201CCIkDvXcvddwZNkkE,12723
|
12
12
|
lionagi/adapters/postgres_model_adapter.py,sha256=e_wfJNyihbpLCXuAs_W9tbLoMXAXbAXtkQDaHfqWz3o,4555
|
@@ -15,13 +15,13 @@ lionagi/fields/action.py,sha256=OziEpbaUeEVo34KdtbzDxXJBgkf3QLxlcKIQAfHe4O0,5791
|
|
15
15
|
lionagi/fields/base.py,sha256=mvgqxLonCROszMjnG8QWt00l-MvIr_mnGvCtaH-SQ_k,3814
|
16
16
|
lionagi/fields/code.py,sha256=TFym51obzaSfCmeRoHZJyBtjfDI4tvl9F-1sjFc9rMw,7713
|
17
17
|
lionagi/fields/file.py,sha256=DhQ_HE0RvTNzkvBGQHRgbMYSokDkzE8GEu814i6jw5Q,7297
|
18
|
-
lionagi/fields/instruct.py,sha256=
|
18
|
+
lionagi/fields/instruct.py,sha256=cpAfKAhQek3Tu6nja5l04zpoBlTZSn10SxEPD7YFahA,4367
|
19
19
|
lionagi/fields/reason.py,sha256=eTGI9jDaaZJInUjCR9lEpYvw2_1UUF-xzCVCFP3-JRI,1437
|
20
20
|
lionagi/fields/research.py,sha256=eEPKocx8eQy2E9FExRWVIo6MK_xvmwBAoRZciBY3RG0,1421
|
21
21
|
lionagi/libs/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
22
22
|
lionagi/libs/parse.py,sha256=JRS3bql0InHJqATnAatl-hQv4N--XXw4P77JHhTFnrc,1011
|
23
23
|
lionagi/libs/concurrency/__init__.py,sha256=huQR4vk3l7mGyoYiGtsjF06xP_5fo9vgKqgB9Naq6PE,1185
|
24
|
-
lionagi/libs/concurrency/cancel.py,sha256=
|
24
|
+
lionagi/libs/concurrency/cancel.py,sha256=TYLxQ1D7mqhs8J4qJ_yTqP0j01zBe-Qed8-YnJlgKi0,4018
|
25
25
|
lionagi/libs/concurrency/errors.py,sha256=FhLgXGFSbKZYPNfXjdnkV-0ShPF_S34RBLyTO_Pk5C8,938
|
26
26
|
lionagi/libs/concurrency/patterns.py,sha256=dlC7nhIYE-D5VySNAPsd6PYYlORRAqNX50oKJRR1PO8,7796
|
27
27
|
lionagi/libs/concurrency/primitives.py,sha256=fgml37nggaEGuvAJHQY6-rpSuAuei56YVSjTlIieM2o,8996
|
@@ -93,8 +93,8 @@ lionagi/models/note.py,sha256=okWJL4mGqt0bUVxHRyqsfJr7tEh6wwgYhF1CegxudIA,12202
|
|
93
93
|
lionagi/models/operable_model.py,sha256=fXbcpBjO-SoaeF8fn-F1_KIcYw9_L73VIUM1BDg5hj4,19905
|
94
94
|
lionagi/models/schema_model.py,sha256=ghRIM8aBNaToAknwNlhQKpuKXcwzyCw5pDE31bVKxs0,667
|
95
95
|
lionagi/operations/__init__.py,sha256=L22n8rRls9oVdzHoDlznHFGiKJMNw3ZhbwVQbm1Fn6M,584
|
96
|
-
lionagi/operations/builder.py,sha256=
|
97
|
-
lionagi/operations/flow.py,sha256=
|
96
|
+
lionagi/operations/builder.py,sha256=_fIW5OqPTTond1VUapMMtEwsWmIuTAKy34K24uuK6EQ,22790
|
97
|
+
lionagi/operations/flow.py,sha256=0HFLJCYRo6YKXNVCLeZT9oVuEyRhMxsOXs0grYl3ySU,17568
|
98
98
|
lionagi/operations/manager.py,sha256=7KD6NMWqYJHCPI2LumDRwGinF8WYKFjrr3bsNUi9xzI,564
|
99
99
|
lionagi/operations/node.py,sha256=X_uHT_zmDKllfTjuhOHslC55j3Bv3NxVZO3bsimcedE,3100
|
100
100
|
lionagi/operations/types.py,sha256=fM8HphnbBifMzhoKKvdl3JxGCBHlEGPJEYkLWj9b7vE,704
|
@@ -143,7 +143,7 @@ lionagi/protocols/generic/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGv
|
|
143
143
|
lionagi/protocols/generic/element.py,sha256=Eaij2YpTWsGk28Tqjazmjmc_tOnalH7_iGFZrL6QJb4,14420
|
144
144
|
lionagi/protocols/generic/event.py,sha256=InjBd2K9aSYxgai1c20d4jaJOkEx5VGFfb7iZbiMiNA,5200
|
145
145
|
lionagi/protocols/generic/log.py,sha256=vepclOaY3fdR1QgFDj9usOffsx9T-9PbgwXjTvm6twQ,7441
|
146
|
-
lionagi/protocols/generic/pile.py,sha256
|
146
|
+
lionagi/protocols/generic/pile.py,sha256=k5fzq0qRPYiP-3NnB-ai499y6bbOqkCR4N4QPvD45ZU,30418
|
147
147
|
lionagi/protocols/generic/processor.py,sha256=c_a7HB9WAaCY-HoI19YyStef8WOXcDj9UeiQb5bz_TM,11759
|
148
148
|
lionagi/protocols/generic/progression.py,sha256=qlITq1qzV119iR5qR__fBAzV489S7d4t20E8uDRicEw,15189
|
149
149
|
lionagi/protocols/graph/__init__.py,sha256=UPu3OmUpjSgX2aBuBJUdG2fppGlfqAH96hU0qIMBMp0,253
|
@@ -190,12 +190,15 @@ lionagi/service/connections/header_factory.py,sha256=22sG4ian3MiNklF6SdQqkEYgtWK
|
|
190
190
|
lionagi/service/connections/match_endpoint.py,sha256=K3I4vU6GH6utlEArlyDFUmNdnp94CEPxqKrehAx29J4,2410
|
191
191
|
lionagi/service/connections/providers/__init__.py,sha256=3lzOakDoBWmMaNnT2g-YwktPKa_Wme4lnPRSmOQfayY,105
|
192
192
|
lionagi/service/connections/providers/anthropic_.py,sha256=SUPnw2UqjY5wuHXLHas6snMTzhQ-UuixvPYbkVnXn34,3083
|
193
|
-
lionagi/service/connections/providers/claude_code_.py,sha256=
|
194
|
-
lionagi/service/connections/providers/claude_code_cli.py,sha256=
|
193
|
+
lionagi/service/connections/providers/claude_code_.py,sha256=YX1Ue7bF4Fi4NpkSgKx1uZ6XzF-x0I0Vks0PmMGk4lk,10683
|
194
|
+
lionagi/service/connections/providers/claude_code_cli.py,sha256=7zW8pyxpaG9fsP4UUfGevGoekv4gdAKZED06qFjr7gY,3353
|
195
195
|
lionagi/service/connections/providers/exa_.py,sha256=GGWaD9jd5gKM257OfUaIBBKIqR1NrNcBE67p_7JbK7g,938
|
196
196
|
lionagi/service/connections/providers/oai_.py,sha256=FmQMEmOY7H7dZd4og-_cdd1Unzy4lkIzMsTtEsm-yVE,4782
|
197
197
|
lionagi/service/connections/providers/ollama_.py,sha256=jdx6dGeChwVk5TFfFRbpnrpKzj8YQZw6D5iWJ6zYmfk,4096
|
198
198
|
lionagi/service/connections/providers/perplexity_.py,sha256=9MH9YmMy9Jg7JDMJHQxxMYHyjJ4NP0OlN7sCuhla85I,917
|
199
|
+
lionagi/service/connections/providers/_claude_code/__init__.py,sha256=3lzOakDoBWmMaNnT2g-YwktPKa_Wme4lnPRSmOQfayY,105
|
200
|
+
lionagi/service/connections/providers/_claude_code/models.py,sha256=NfKvD9ccjSFHn0iqcI5KnNbMLbqw1dnXqHn2a5y9vds,8032
|
201
|
+
lionagi/service/connections/providers/_claude_code/stream_cli.py,sha256=lNXln8_o-vRAgZMPGF0j_7j-GS6mDA3CJsdkCiHYSmM,12265
|
199
202
|
lionagi/service/third_party/README.md,sha256=qFjWnI8rmLivIyr6Tc-hRZh-rQwntROp76af4MBNJJc,2214
|
200
203
|
lionagi/service/third_party/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
201
204
|
lionagi/service/third_party/anthropic_models.py,sha256=oqSPSlcayYG-fS5BLiLeTtkrpaxgkPhEK_YgneumrOo,4004
|
@@ -203,16 +206,16 @@ lionagi/service/third_party/exa_models.py,sha256=G_hnekcy-DillPLzMoDQ8ZisVAL8Mp7
|
|
203
206
|
lionagi/service/third_party/openai_models.py,sha256=sF-fQ726CnaDBgLY_r2NdPqc3GicPKhZjh5F8IfjBO0,501904
|
204
207
|
lionagi/service/third_party/pplx_models.py,sha256=Nkm1ftESBa_NwP9ITBUNqLmAZ3Jh92aL732g_i6T8LQ,5947
|
205
208
|
lionagi/session/__init__.py,sha256=kDypY6L3kGPnatAw7YNQAykgg-9MlIBnlhHExaXvt-c,202
|
206
|
-
lionagi/session/branch.py,sha256=
|
209
|
+
lionagi/session/branch.py,sha256=5hM-YSp45KNYyXhiEk8LRta84ZJdwzaJaPXJORMbRms,67979
|
207
210
|
lionagi/session/prompts.py,sha256=GPr0jibyAAqS3awDzGC8SoCL6aWJLLCCbXY0JUuxOC0,3170
|
208
|
-
lionagi/session/session.py,sha256=
|
211
|
+
lionagi/session/session.py,sha256=Gc31wPLFdBOMRs3zEs11KVShvDtLUAqqhbhMoySptqo,11379
|
209
212
|
lionagi/tools/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
210
213
|
lionagi/tools/base.py,sha256=cld32pyjaTUdyiqZ8hNyJjWKAhcJ8RQNhgImI7R8b-E,1940
|
211
214
|
lionagi/tools/types.py,sha256=XtJLY0m-Yi_ZLWhm0KycayvqMCZd--HxfQ0x9vFUYDE,230
|
212
215
|
lionagi/tools/file/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
213
216
|
lionagi/tools/file/reader.py,sha256=0TdnfVGVCKuM58MmGM-NyVjhU9BFoitkNYEepdc0z_Y,9529
|
214
217
|
lionagi/tools/memory/tools.py,sha256=zTGBenVsF8Wuh303kWntmQSGlAFKonHNdh5ePuQ26KE,15948
|
215
|
-
lionagi-0.14.
|
216
|
-
lionagi-0.14.
|
217
|
-
lionagi-0.14.
|
218
|
-
lionagi-0.14.
|
218
|
+
lionagi-0.14.6.dist-info/METADATA,sha256=uUjYz80ekrDdAq2blmqNu-K2AR0geC4oykPbMC61cbw,21236
|
219
|
+
lionagi-0.14.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
220
|
+
lionagi-0.14.6.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
|
221
|
+
lionagi-0.14.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|