lionagi 0.15.4__py3-none-any.whl → 0.15.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/adapters/_utils.py +26 -0
- lionagi/adapters/async_postgres_adapter.py +9 -9
- lionagi/adapters/postgres_model_adapter.py +10 -10
- lionagi/ln/_async_call.py +7 -5
- lionagi/ln/_models.py +65 -48
- lionagi/ln/concurrency/__init__.py +2 -0
- lionagi/operations/flow.py +13 -10
- lionagi/protocols/generic/pile.py +357 -211
- lionagi/protocols/generic/processor.py +1 -2
- lionagi/protocols/graph/node.py +24 -10
- lionagi/session/session.py +3 -1
- lionagi/utils.py +46 -1
- lionagi/version.py +1 -1
- {lionagi-0.15.4.dist-info → lionagi-0.15.6.dist-info}/METADATA +1 -1
- {lionagi-0.15.4.dist-info → lionagi-0.15.6.dist-info}/RECORD +17 -16
- {lionagi-0.15.4.dist-info → lionagi-0.15.6.dist-info}/WHEEL +0 -0
- {lionagi-0.15.4.dist-info → lionagi-0.15.6.dist-info}/licenses/LICENSE +0 -0
@@ -5,8 +5,7 @@
|
|
5
5
|
import asyncio
|
6
6
|
from typing import Any, ClassVar
|
7
7
|
|
8
|
-
from lionagi.
|
9
|
-
from lionagi.libs.concurrency import Semaphore, create_task_group
|
8
|
+
from lionagi.ln import ConcurrencyEvent, Semaphore, create_task_group
|
10
9
|
|
11
10
|
from .._concepts import Observer
|
12
11
|
from .element import ID
|
lionagi/protocols/graph/node.py
CHANGED
@@ -9,22 +9,13 @@ from typing import Any
|
|
9
9
|
|
10
10
|
from pydantic import field_validator
|
11
11
|
from pydapter import Adaptable, AsyncAdaptable
|
12
|
-
from pydapter.adapters import JsonAdapter, TomlAdapter
|
13
|
-
from pydapter.extras.pandas_ import SeriesAdapter
|
14
12
|
|
15
13
|
from lionagi._class_registry import LION_CLASS_REGISTRY
|
16
14
|
|
17
15
|
from .._concepts import Relational
|
18
16
|
from ..generic.element import Element
|
19
17
|
|
20
|
-
|
21
|
-
JsonAdapter,
|
22
|
-
SeriesAdapter,
|
23
|
-
TomlAdapter,
|
24
|
-
)
|
25
|
-
|
26
|
-
|
27
|
-
__all__ = ("Node",)
|
18
|
+
_ADAPATER_REGISTERED = False
|
28
19
|
|
29
20
|
|
30
21
|
class Node(Element, Relational, AsyncAdaptable, Adaptable):
|
@@ -113,4 +104,27 @@ class Node(Element, Relational, AsyncAdaptable, Adaptable):
|
|
113
104
|
return super().adapt_from(obj, obj_key=obj_key, many=many, **kwargs)
|
114
105
|
|
115
106
|
|
107
|
+
if not _ADAPATER_REGISTERED:
|
108
|
+
from pydapter.adapters import JsonAdapter, TomlAdapter
|
109
|
+
from pydapter.extras.pandas_ import SeriesAdapter
|
110
|
+
|
111
|
+
Node.register_adapter(JsonAdapter)
|
112
|
+
Node.register_adapter(TomlAdapter)
|
113
|
+
Node.register_adapter(SeriesAdapter)
|
114
|
+
|
115
|
+
from lionagi.adapters._utils import check_async_postgres_available
|
116
|
+
|
117
|
+
if check_async_postgres_available() is True:
|
118
|
+
from lionagi.adapters.async_postgres_adapter import (
|
119
|
+
LionAGIAsyncPostgresAdapter,
|
120
|
+
)
|
121
|
+
|
122
|
+
Node.register_async_adapter(LionAGIAsyncPostgresAdapter)
|
123
|
+
|
124
|
+
_ADAPATER_REGISTERED = True
|
125
|
+
|
126
|
+
Node = Node
|
127
|
+
|
128
|
+
__all__ = ("Node",)
|
129
|
+
|
116
130
|
# File: lionagi/protocols/graph/node.py
|
lionagi/session/session.py
CHANGED
@@ -387,6 +387,7 @@ class Session(Node, Communicatable, Relational):
|
|
387
387
|
max_concurrent: int = 5,
|
388
388
|
verbose: bool = False,
|
389
389
|
default_branch: Branch | ID.Ref | None = None,
|
390
|
+
alcall_params: Any = None,
|
390
391
|
) -> dict[str, Any]:
|
391
392
|
"""
|
392
393
|
Execute a graph-based workflow using multi-branch orchestration.
|
@@ -401,7 +402,7 @@ class Session(Node, Communicatable, Relational):
|
|
401
402
|
max_concurrent: Maximum concurrent operations (branches)
|
402
403
|
verbose: Enable verbose logging
|
403
404
|
default_branch: Branch to use as default (defaults to self.default_branch)
|
404
|
-
|
405
|
+
alcall_params: Parameters for async parallel call execution
|
405
406
|
|
406
407
|
Returns:
|
407
408
|
Execution results with completed operations and final context
|
@@ -421,6 +422,7 @@ class Session(Node, Communicatable, Relational):
|
|
421
422
|
parallel=parallel,
|
422
423
|
max_concurrent=max_concurrent,
|
423
424
|
verbose=verbose,
|
425
|
+
alcall_params=alcall_params,
|
424
426
|
)
|
425
427
|
|
426
428
|
|
lionagi/utils.py
CHANGED
@@ -14,6 +14,7 @@ import re
|
|
14
14
|
import shutil
|
15
15
|
import subprocess
|
16
16
|
import sys
|
17
|
+
import types
|
17
18
|
import uuid
|
18
19
|
from collections.abc import (
|
19
20
|
AsyncGenerator,
|
@@ -28,7 +29,15 @@ from enum import Enum as _Enum
|
|
28
29
|
from functools import partial
|
29
30
|
from inspect import isclass
|
30
31
|
from pathlib import Path
|
31
|
-
from typing import
|
32
|
+
from typing import (
|
33
|
+
Annotated,
|
34
|
+
Any,
|
35
|
+
Literal,
|
36
|
+
TypeVar,
|
37
|
+
Union,
|
38
|
+
get_args,
|
39
|
+
get_origin,
|
40
|
+
)
|
32
41
|
|
33
42
|
from pydantic import BaseModel
|
34
43
|
from pydantic_core import PydanticUndefinedType
|
@@ -88,6 +97,8 @@ __all__ = (
|
|
88
97
|
"StringEnum",
|
89
98
|
"Enum",
|
90
99
|
"hash_dict",
|
100
|
+
"is_union_type",
|
101
|
+
"union_members",
|
91
102
|
)
|
92
103
|
|
93
104
|
|
@@ -191,6 +202,40 @@ def is_same_dtype(
|
|
191
202
|
return (result, dtype) if return_dtype else result
|
192
203
|
|
193
204
|
|
205
|
+
def is_union_type(tp) -> bool:
|
206
|
+
"""True for typing.Union[...] and PEP 604 unions (A | B)."""
|
207
|
+
origin = get_origin(tp)
|
208
|
+
return origin is Union or origin is getattr(
|
209
|
+
types, "UnionType", object()
|
210
|
+
) # Py3.10+
|
211
|
+
|
212
|
+
|
213
|
+
NoneType = type(None)
|
214
|
+
_UnionType = getattr(types, "UnionType", None) # for A | B (PEP 604)
|
215
|
+
|
216
|
+
|
217
|
+
def _unwrap_annotated(tp):
|
218
|
+
while get_origin(tp) is Annotated:
|
219
|
+
tp = get_args(tp)[0]
|
220
|
+
return tp
|
221
|
+
|
222
|
+
|
223
|
+
def union_members(
|
224
|
+
tp, *, unwrap_annotated: bool = True, drop_none: bool = False
|
225
|
+
) -> tuple[type, ...]:
|
226
|
+
"""Return the member types of a Union (typing.Union or A|B). Empty tuple if not a Union."""
|
227
|
+
tp = _unwrap_annotated(tp) if unwrap_annotated else tp
|
228
|
+
origin = get_origin(tp)
|
229
|
+
if origin is not Union and origin is not _UnionType:
|
230
|
+
return ()
|
231
|
+
members = get_args(tp)
|
232
|
+
if unwrap_annotated:
|
233
|
+
members = tuple(_unwrap_annotated(m) for m in members)
|
234
|
+
if drop_none:
|
235
|
+
members = tuple(m for m in members if m is not NoneType)
|
236
|
+
return members
|
237
|
+
|
238
|
+
|
194
239
|
async def custom_error_handler(
|
195
240
|
error: Exception, error_map: dict[type, Callable[[Exception], None]]
|
196
241
|
) -> None:
|
lionagi/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.15.
|
1
|
+
__version__ = "0.15.6"
|
@@ -5,11 +5,12 @@ lionagi/_types.py,sha256=j8XwSGeGrYwfmSJ8o-80bsfoalLWJgQH41ZkVevc4wk,75
|
|
5
5
|
lionagi/config.py,sha256=W3JOC_TFad8hFkpTG8yv0-GNupa7x3wX4NAUfWpB59U,3763
|
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=LxsMXyXbj5DC64y7QTmg8XzjE6hogxaed5FHw2PyK_M,39811
|
9
|
+
lionagi/version.py,sha256=So0qfsz_A4mujJ9XBWY4PqtrU6DdTz1l5TygxPTJj1Y,23
|
10
10
|
lionagi/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
lionagi/adapters/
|
12
|
-
lionagi/adapters/
|
11
|
+
lionagi/adapters/_utils.py,sha256=n4DS27CZfC-0O_UFaYtlUdjiMx9IeYsGpP7MVaFO5ZA,885
|
12
|
+
lionagi/adapters/async_postgres_adapter.py,sha256=QKzEnzGR5_HNxxmnHhyuPELHv6yvQ-p7cfaX1bWRAQU,12722
|
13
|
+
lionagi/adapters/postgres_model_adapter.py,sha256=uwWrbnihtYsCIttHExmtAIZwyohFtKoxnHU1N1M2NvQ,4519
|
13
14
|
lionagi/fields/__init__.py,sha256=yrn9NDAM6_v73kK7aJeb-Pvqigeu8WASaV-My-6CDsc,939
|
14
15
|
lionagi/fields/action.py,sha256=OziEpbaUeEVo34KdtbzDxXJBgkf3QLxlcKIQAfHe4O0,5791
|
15
16
|
lionagi/fields/base.py,sha256=mvgqxLonCROszMjnG8QWt00l-MvIr_mnGvCtaH-SQ_k,3814
|
@@ -85,13 +86,13 @@ lionagi/libs/validate/to_num.py,sha256=ZRHDjpTCykPfDIZZa4rZKNaR_8ZHbPDFlw9rc02Dr
|
|
85
86
|
lionagi/libs/validate/validate_boolean.py,sha256=bjiX_WZ3Bg8XcqoWLzE1G9BpO0AisrlZUxrpye_mlGk,3614
|
86
87
|
lionagi/libs/validate/xml_parser.py,sha256=PHBYAre4hhthPpDP9Yrp3UYSWdANPx60F1qhxe0m4uw,7004
|
87
88
|
lionagi/ln/__init__.py,sha256=N2wBLrZWUTfLAXFU2b0VbbByAmbW5Xwl42eIu0RaYWg,906
|
88
|
-
lionagi/ln/_async_call.py,sha256=
|
89
|
+
lionagi/ln/_async_call.py,sha256=N8vpXPDyonVqfszVEgOTQS8M1MohYJH9vcf1xwuo4JU,9367
|
89
90
|
lionagi/ln/_hash.py,sha256=g20yJfuVhAsfsBOWlkO889DHte6cbUCl6vV5QMT8nUo,3499
|
90
91
|
lionagi/ln/_list_call.py,sha256=oDCyTzz7F7KVAMjekKftJp7qgIZ9Yo8BUNMHasKoJhU,3935
|
91
|
-
lionagi/ln/_models.py,sha256=
|
92
|
+
lionagi/ln/_models.py,sha256=fk01heknu7ZtBM-p9O3OnrdNeS9yzo04ZqRyQ87gZnk,4457
|
92
93
|
lionagi/ln/_to_list.py,sha256=DKjZAah6pm6frHls773yTMVK1I3OY7qxwLemOjRPr5A,5600
|
93
94
|
lionagi/ln/_types.py,sha256=usVaL2tGnYVQ2W12eUhJYiXY-m55b_5e0tUOFcuDtkc,3607
|
94
|
-
lionagi/ln/concurrency/__init__.py,sha256=
|
95
|
+
lionagi/ln/concurrency/__init__.py,sha256=Sv1LEvwN1hRESLtuYM5UltyJqx6DRsHvGmr8aof16cA,1286
|
95
96
|
lionagi/ln/concurrency/cancel.py,sha256=TYLxQ1D7mqhs8J4qJ_yTqP0j01zBe-Qed8-YnJlgKi0,4018
|
96
97
|
lionagi/ln/concurrency/errors.py,sha256=FhLgXGFSbKZYPNfXjdnkV-0ShPF_S34RBLyTO_Pk5C8,938
|
97
98
|
lionagi/ln/concurrency/patterns.py,sha256=dlC7nhIYE-D5VySNAPsd6PYYlORRAqNX50oKJRR1PO8,7796
|
@@ -109,7 +110,7 @@ lionagi/models/operable_model.py,sha256=Zm_Hxdauqyh0za3_TJLCZ3g6nR4F45Rrnc0ZM3d5
|
|
109
110
|
lionagi/models/schema_model.py,sha256=ghRIM8aBNaToAknwNlhQKpuKXcwzyCw5pDE31bVKxs0,667
|
110
111
|
lionagi/operations/__init__.py,sha256=L22n8rRls9oVdzHoDlznHFGiKJMNw3ZhbwVQbm1Fn6M,584
|
111
112
|
lionagi/operations/builder.py,sha256=TDUaNoMbFyK2yIVSlcVh1IREUfewsfNnKSle6__oq4M,22918
|
112
|
-
lionagi/operations/flow.py,sha256=
|
113
|
+
lionagi/operations/flow.py,sha256=JB0SnVZbqLJc9cRGHy_p7QKvTBcB63H9n1iDyhWJDRo,22202
|
113
114
|
lionagi/operations/manager.py,sha256=YZr3VjPAZVVFd_bIjF1aoQqzzKZHNA1kcqefNi5QFFM,683
|
114
115
|
lionagi/operations/node.py,sha256=qmjhv-8UzQMO5ocBlNWuv9nqQiLh5CV7AW_tno8jIUM,3183
|
115
116
|
lionagi/operations/types.py,sha256=fM8HphnbBifMzhoKKvdl3JxGCBHlEGPJEYkLWj9b7vE,704
|
@@ -158,13 +159,13 @@ lionagi/protocols/generic/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGv
|
|
158
159
|
lionagi/protocols/generic/element.py,sha256=Eaij2YpTWsGk28Tqjazmjmc_tOnalH7_iGFZrL6QJb4,14420
|
159
160
|
lionagi/protocols/generic/event.py,sha256=cAkj6hiStPPJNlaYpmIXEgnix3LVAYYyDDjoubuT0ks,6602
|
160
161
|
lionagi/protocols/generic/log.py,sha256=Y06zAQewkNlaIWjut_c6c45KY_LJfLHwzUaDGLULaas,8212
|
161
|
-
lionagi/protocols/generic/pile.py,sha256=
|
162
|
-
lionagi/protocols/generic/processor.py,sha256=
|
162
|
+
lionagi/protocols/generic/pile.py,sha256=vTBxA40mhhDhoifQm1qQkVF-VuPACVhOt90a4wRHZYk,35461
|
163
|
+
lionagi/protocols/generic/processor.py,sha256=GvHblXvOaZJ485L3bWcV3S4w9x0GYxWH-LkPXv00zMI,11700
|
163
164
|
lionagi/protocols/generic/progression.py,sha256=qlITq1qzV119iR5qR__fBAzV489S7d4t20E8uDRicEw,15189
|
164
165
|
lionagi/protocols/graph/__init__.py,sha256=UPu3OmUpjSgX2aBuBJUdG2fppGlfqAH96hU0qIMBMp0,253
|
165
166
|
lionagi/protocols/graph/edge.py,sha256=YxSGj4w_fG7khm-zpKduuK5fJzhJDx23JhU1dZp29d8,5241
|
166
167
|
lionagi/protocols/graph/graph.py,sha256=u7qoEPXh4Tpp-O6ciEGJkzzQyA7weJmE2spnWrEYZqs,10698
|
167
|
-
lionagi/protocols/graph/node.py,sha256=
|
168
|
+
lionagi/protocols/graph/node.py,sha256=vW4z08wyW4YXvBch3DMteO2gVOV4j3Qa8SRd-4cCL50,3912
|
168
169
|
lionagi/protocols/mail/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
169
170
|
lionagi/protocols/mail/exchange.py,sha256=P1PcrFylIBeiQa8kox9H1qyJ4kjhUlbLiTUT8rs1OXg,7041
|
170
171
|
lionagi/protocols/mail/mail.py,sha256=RB5CUft_4J85H9nM9g6aRXomTaqKwF5xVjJacPAhoa8,1356
|
@@ -227,14 +228,14 @@ lionagi/service/third_party/pplx_models.py,sha256=-EhyJgOWR6rzSv3zczUtk80X6c19p1
|
|
227
228
|
lionagi/session/__init__.py,sha256=kDypY6L3kGPnatAw7YNQAykgg-9MlIBnlhHExaXvt-c,202
|
228
229
|
lionagi/session/branch.py,sha256=79l014dCsyOdI4daBLOzyTTLnfYv89Bg7uf9qcg_Bwg,68449
|
229
230
|
lionagi/session/prompts.py,sha256=GPr0jibyAAqS3awDzGC8SoCL6aWJLLCCbXY0JUuxOC0,3170
|
230
|
-
lionagi/session/session.py,sha256=
|
231
|
+
lionagi/session/session.py,sha256=zwsBL9gB3iSbCxMvx3c0frg0PU-Dgg6QLZMn2_b9YiQ,13341
|
231
232
|
lionagi/tools/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
232
233
|
lionagi/tools/base.py,sha256=hEGnE4MD0CM4UqnF0xsDRKB0aM-pyrTFHl8utHhyJLU,1897
|
233
234
|
lionagi/tools/types.py,sha256=XtJLY0m-Yi_ZLWhm0KycayvqMCZd--HxfQ0x9vFUYDE,230
|
234
235
|
lionagi/tools/file/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
235
236
|
lionagi/tools/file/reader.py,sha256=jnSHVSQ66AHZXQrgRuGmlbwKT5JHYoo-1zv1hKgTEfc,9544
|
236
237
|
lionagi/tools/memory/tools.py,sha256=earYkKxSOz_iXkqVZYTEDfE3dwZYIWPXZrqQ1DYGz4I,15941
|
237
|
-
lionagi-0.15.
|
238
|
-
lionagi-0.15.
|
239
|
-
lionagi-0.15.
|
240
|
-
lionagi-0.15.
|
238
|
+
lionagi-0.15.6.dist-info/METADATA,sha256=ChrjXamF6ihAwtiYPo770q7s0eDt7zg4LInJATpP8Pw,22895
|
239
|
+
lionagi-0.15.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
240
|
+
lionagi-0.15.6.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
|
241
|
+
lionagi-0.15.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|