lionagi 0.17.9__py3-none-any.whl → 0.17.10__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/reason.py +2 -0
- lionagi/ln/types.py +45 -0
- lionagi/models/field_model.py +393 -286
- lionagi/models/hashable_model.py +96 -14
- lionagi/models/model_params.py +271 -269
- lionagi/models/operable_model.py +8 -8
- lionagi/protocols/generic/pile.py +7 -4
- lionagi/protocols/operatives/operative.py +29 -6
- lionagi/service/third_party/anthropic_models.py +2 -3
- lionagi/version.py +1 -1
- {lionagi-0.17.9.dist-info → lionagi-0.17.10.dist-info}/METADATA +2 -2
- {lionagi-0.17.9.dist-info → lionagi-0.17.10.dist-info}/RECORD +14 -14
- {lionagi-0.17.9.dist-info → lionagi-0.17.10.dist-info}/WHEEL +0 -0
- {lionagi-0.17.9.dist-info → lionagi-0.17.10.dist-info}/licenses/LICENSE +0 -0
@@ -16,10 +16,9 @@ from collections.abc import (
|
|
16
16
|
)
|
17
17
|
from functools import wraps
|
18
18
|
from pathlib import Path
|
19
|
-
from typing import Any, ClassVar, Generic, Literal, TypeVar
|
19
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Generic, Literal, TypeVar
|
20
20
|
|
21
21
|
from pydantic import Field, field_serializer
|
22
|
-
from pydantic.fields import FieldInfo
|
23
22
|
from pydapter import Adaptable, AsyncAdaptable
|
24
23
|
from typing_extensions import Self, deprecated, override
|
25
24
|
|
@@ -37,6 +36,10 @@ from .._concepts import Observable
|
|
37
36
|
from .element import ID, Collective, E, Element, IDType, validate_order
|
38
37
|
from .progression import Progression
|
39
38
|
|
39
|
+
if TYPE_CHECKING:
|
40
|
+
from pydantic.fields import FieldInfo
|
41
|
+
|
42
|
+
|
40
43
|
D = TypeVar("D")
|
41
44
|
T = TypeVar("T", bound=E)
|
42
45
|
|
@@ -219,13 +222,13 @@ class Pile(Element, Collective[T], Generic[T], Adaptable, AsyncAdaptable):
|
|
219
222
|
"strict_type",
|
220
223
|
}
|
221
224
|
|
222
|
-
def __pydantic_extra__(self) -> dict[str, FieldInfo]:
|
225
|
+
def __pydantic_extra__(self) -> dict[str, "FieldInfo"]:
|
223
226
|
return {
|
224
227
|
"_lock": Field(default_factory=threading.Lock),
|
225
228
|
"_async": Field(default_factory=ConcurrencyLock),
|
226
229
|
}
|
227
230
|
|
228
|
-
def __pydantic_private__(self) -> dict[str, FieldInfo]:
|
231
|
+
def __pydantic_private__(self) -> dict[str, "FieldInfo"]:
|
229
232
|
return self.__pydantic_extra__()
|
230
233
|
|
231
234
|
@classmethod
|
@@ -79,7 +79,13 @@ class Operative:
|
|
79
79
|
"""Initialize from ModelParams for backward compatibility."""
|
80
80
|
# Add field models to the request operable
|
81
81
|
if params.field_models:
|
82
|
-
|
82
|
+
# Coerce to list if single FieldModel instance
|
83
|
+
field_models_list = (
|
84
|
+
[params.field_models]
|
85
|
+
if isinstance(params.field_models, FieldModel)
|
86
|
+
else params.field_models
|
87
|
+
)
|
88
|
+
for field_model in field_models_list:
|
83
89
|
self._request_operable.add_field(
|
84
90
|
field_model.name,
|
85
91
|
field_model=field_model,
|
@@ -103,8 +109,16 @@ class Operative:
|
|
103
109
|
use_fields = set(self._request_operable.all_fields.keys()) - set(
|
104
110
|
exclude_fields
|
105
111
|
)
|
112
|
+
|
113
|
+
# Determine model name - prefer explicit name, then base_type name, then default
|
114
|
+
model_name = "RequestModel"
|
115
|
+
if not params._is_sentinel(params.name):
|
116
|
+
model_name = params.name
|
117
|
+
elif not params._is_sentinel(params.base_type):
|
118
|
+
model_name = params.base_type.__name__
|
119
|
+
|
106
120
|
self.request_type = self._request_operable.new_model(
|
107
|
-
name=
|
121
|
+
name=model_name,
|
108
122
|
use_fields=use_fields,
|
109
123
|
base_type=params.base_type,
|
110
124
|
frozen=params.frozen,
|
@@ -112,9 +126,12 @@ class Operative:
|
|
112
126
|
doc=params.doc,
|
113
127
|
)
|
114
128
|
|
115
|
-
# Update name if not set
|
116
|
-
if not self.name
|
117
|
-
|
129
|
+
# Update name if not set - prefer explicit name, then base_type name
|
130
|
+
if not self.name:
|
131
|
+
if not params._is_sentinel(params.name):
|
132
|
+
self.name = params.name
|
133
|
+
elif not params._is_sentinel(params.base_type):
|
134
|
+
self.name = params.base_type.__name__
|
118
135
|
|
119
136
|
def model_dump(self) -> dict[str, Any]:
|
120
137
|
"""Convert to dictionary for backward compatibility.
|
@@ -285,7 +302,13 @@ class Operative:
|
|
285
302
|
|
286
303
|
# Add field models (skip if already exists from inheritance)
|
287
304
|
if field_models:
|
288
|
-
|
305
|
+
# Coerce to list if single FieldModel instance
|
306
|
+
field_models_list = (
|
307
|
+
[field_models]
|
308
|
+
if isinstance(field_models, FieldModel)
|
309
|
+
else field_models
|
310
|
+
)
|
311
|
+
for field_model in field_models_list:
|
289
312
|
if field_model.name not in self._response_operable.all_fields:
|
290
313
|
self._response_operable.add_field(
|
291
314
|
field_model.name,
|
@@ -8,7 +8,7 @@ from __future__ import annotations
|
|
8
8
|
|
9
9
|
from typing import Literal, Union
|
10
10
|
|
11
|
-
from pydantic import BaseModel, Field, field_validator
|
11
|
+
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
12
12
|
|
13
13
|
|
14
14
|
class TextContentBlock(BaseModel):
|
@@ -83,8 +83,7 @@ class CreateMessageRequest(BaseModel):
|
|
83
83
|
tools: list[ToolDefinition] | None = None
|
84
84
|
tool_choice: ToolChoice | dict | None = None
|
85
85
|
|
86
|
-
|
87
|
-
extra = "forbid"
|
86
|
+
model_config = ConfigDict(extra="forbid")
|
88
87
|
|
89
88
|
|
90
89
|
class Usage(BaseModel):
|
lionagi/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.17.
|
1
|
+
__version__ = "0.17.10"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: lionagi
|
3
|
-
Version: 0.17.
|
3
|
+
Version: 0.17.10
|
4
4
|
Summary: An Intelligence Operating System.
|
5
5
|
Author-email: HaiyangLi <quantocean.li@gmail.com>
|
6
6
|
License: Apache License
|
@@ -482,7 +482,7 @@ async def handle_instruct(instruct):
|
|
482
482
|
return await sub_branch.operate(instruct=instruct)
|
483
483
|
|
484
484
|
# run in parallel across all instruct models
|
485
|
-
from lionagi.
|
485
|
+
from lionagi.ln import alcall
|
486
486
|
responses = await alcall(response3.instruct_models, handle_instruct)
|
487
487
|
|
488
488
|
# now hand these reports back to the orchestrator
|
@@ -5,7 +5,7 @@ lionagi/_types.py,sha256=nGtsaSee7FaIZvym3PH8NPaN5PN8QscTgcZfpMNaMEo,1296
|
|
5
5
|
lionagi/config.py,sha256=yGnzj5D14B2TBhqVeyp1uccvAK6mk4hm0QA8dAEJUeQ,4776
|
6
6
|
lionagi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
lionagi/utils.py,sha256=yRHKN_v9xRnUa-nYg1lTpCCK2wNDg4pCpicUEIyFwKg,7084
|
8
|
-
lionagi/version.py,sha256=
|
8
|
+
lionagi/version.py,sha256=LPLN8jbXXRu-sv77Km_sC2qYTkvGot_mR3oWebuWn6Q,24
|
9
9
|
lionagi/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
lionagi/adapters/_utils.py,sha256=sniMG1LDDkwJNzUF2K32jv7rA6Y1QcohgyNclYsptzI,453
|
11
11
|
lionagi/adapters/async_postgres_adapter.py,sha256=2XlxYNPow78dFHIQs8W1oJ2zkVD5Udn3aynMBF9Nf3k,3498
|
@@ -15,7 +15,7 @@ lionagi/fields/base.py,sha256=mvgqxLonCROszMjnG8QWt00l-MvIr_mnGvCtaH-SQ_k,3814
|
|
15
15
|
lionagi/fields/code.py,sha256=TFym51obzaSfCmeRoHZJyBtjfDI4tvl9F-1sjFc9rMw,7713
|
16
16
|
lionagi/fields/file.py,sha256=DhQ_HE0RvTNzkvBGQHRgbMYSokDkzE8GEu814i6jw5Q,7297
|
17
17
|
lionagi/fields/instruct.py,sha256=2koYdY7XyJh5lrd7tD_BA9bqCbmpsdTDaASEv_dX4i8,4334
|
18
|
-
lionagi/fields/reason.py,sha256=
|
18
|
+
lionagi/fields/reason.py,sha256=CHfHgCqZYLInAXc49OggsL-z3Q-ktHxOnhebhLZZ7ds,1490
|
19
19
|
lionagi/fields/research.py,sha256=eEPKocx8eQy2E9FExRWVIo6MK_xvmwBAoRZciBY3RG0,1421
|
20
20
|
lionagi/libs/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
21
21
|
lionagi/libs/file/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
@@ -39,7 +39,7 @@ lionagi/ln/_json_dump.py,sha256=zOeoOE3JbaGAzL-lfAdMqdgaXWYXFliqcgXsZ_pxonI,1034
|
|
39
39
|
lionagi/ln/_list_call.py,sha256=zvISmCeNAH7yjBcusQI1s17n556tILgePhRMdAM2plA,2831
|
40
40
|
lionagi/ln/_to_list.py,sha256=V9hC3dpyMhRJwuuyOCU_wJygzEB6sJVZ0fmIRtM6uTg,6993
|
41
41
|
lionagi/ln/_utils.py,sha256=5Z_AsDxdtH5wNB-P4IiihhH0dYUcZMT-hTxFQBQPwL0,4303
|
42
|
-
lionagi/ln/types.py,sha256=
|
42
|
+
lionagi/ln/types.py,sha256=UhLiM6NPytX6zvZyH8v7TRwnXMJSJ5m_pSPv4q0P1TY,10241
|
43
43
|
lionagi/ln/concurrency/__init__.py,sha256=xt_GLZ1Zb-nC-RnrNt8jOBWb_uf1md__B1R5cplMShg,1190
|
44
44
|
lionagi/ln/concurrency/_compat.py,sha256=itxdRzl95PLEBQvNY0zTriF39kymaNRpKncT8QsOomA,2065
|
45
45
|
lionagi/ln/concurrency/cancel.py,sha256=8JlWy_EVto4Fls1yQLBteCbpn4zP6ydnqIa_EL5kxZc,3313
|
@@ -57,10 +57,10 @@ lionagi/ln/fuzzy/_fuzzy_validate.py,sha256=XuafNXflTerQrQYV0S6MrQHR3_6DuYBv6BAYT
|
|
57
57
|
lionagi/ln/fuzzy/_string_similarity.py,sha256=D_pblW4ecDJNlsC7P3bV_54XgcXSvCLs7ZOb8hngT-Q,8796
|
58
58
|
lionagi/ln/fuzzy/_to_dict.py,sha256=Crz4sDIIcTZS3idxynWK7U4EdHvZooPDJIsOH3t6xgQ,12068
|
59
59
|
lionagi/models/__init__.py,sha256=b7A4AaVGq4pZvYyTG8N_yvtRzwWJ8MxE9Y6mDZb8U0k,422
|
60
|
-
lionagi/models/field_model.py,sha256=
|
61
|
-
lionagi/models/hashable_model.py,sha256=
|
62
|
-
lionagi/models/model_params.py,sha256=
|
63
|
-
lionagi/models/operable_model.py,sha256=
|
60
|
+
lionagi/models/field_model.py,sha256=srWS-cgHVMSiwt_TXZZ-5r2ZqKr7Y9mpGDbOg8iDXaE,29184
|
61
|
+
lionagi/models/hashable_model.py,sha256=E_gIMcvffwxbWgeApEqlG04fWHsEdqF7NaT0jw8hAaQ,3240
|
62
|
+
lionagi/models/model_params.py,sha256=YCvhbx4SqI4E91gtTpv3EkqSRd60kHK593S5lm_rt7s,12114
|
63
|
+
lionagi/models/operable_model.py,sha256=8xg5IIW5A7xAAK8Bw4kt4frvAxoSBNVrZ8ltcKHHvXU,20179
|
64
64
|
lionagi/models/schema_model.py,sha256=ghRIM8aBNaToAknwNlhQKpuKXcwzyCw5pDE31bVKxs0,667
|
65
65
|
lionagi/operations/__init__.py,sha256=DU9sIhtw1vPBVllZ1Fbum8GE3qC9yfyQtt6_8vyv_cA,444
|
66
66
|
lionagi/operations/_visualize_graph.py,sha256=F0KadgRthP-6-R-FPgvlwiiaiWH3ueO-rjSd1bzRUbE,8594
|
@@ -114,7 +114,7 @@ lionagi/protocols/generic/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGv
|
|
114
114
|
lionagi/protocols/generic/element.py,sha256=w0pxw_SvDaHOgEFecQgEFg9bcGg2abTDN1v2TOe-eAQ,15717
|
115
115
|
lionagi/protocols/generic/event.py,sha256=nAhGo1-6wYprB-o5I0XkqYz0F-3xb_cqfF79G1lygPI,6550
|
116
116
|
lionagi/protocols/generic/log.py,sha256=AnPr2RweSZcJdxOK0KGb1eyvAPZmME3hEm9HraUoftQ,8212
|
117
|
-
lionagi/protocols/generic/pile.py,sha256=
|
117
|
+
lionagi/protocols/generic/pile.py,sha256=2VhcT6ynpnBr4vmIrDkFei3Zs3i6s2tjfvN-8OikxWw,37133
|
118
118
|
lionagi/protocols/generic/processor.py,sha256=uiNIldAYPEujuboLFyrIJADMlhRghy3H86hYintj5D4,11705
|
119
119
|
lionagi/protocols/generic/progression.py,sha256=HCV_EnQCFvjg6D7eF4ygGrZNQPEOtu75zvW1sJbAVrM,15190
|
120
120
|
lionagi/protocols/graph/__init__.py,sha256=UPu3OmUpjSgX2aBuBJUdG2fppGlfqAH96hU0qIMBMp0,253
|
@@ -144,7 +144,7 @@ lionagi/protocols/messages/templates/instruction_message.jinja2,sha256=L-ptw5OHx
|
|
144
144
|
lionagi/protocols/messages/templates/system_message.jinja2,sha256=JRKJ0aFpYfaXSFouKc_N4unZ35C3yZTOWhIrIdCB5qk,215
|
145
145
|
lionagi/protocols/messages/templates/tool_schemas.jinja2,sha256=ozIaSDCRjIAhLyA8VM6S-YqS0w2NcctALSwx4LjDwII,126
|
146
146
|
lionagi/protocols/operatives/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
147
|
-
lionagi/protocols/operatives/operative.py,sha256=
|
147
|
+
lionagi/protocols/operatives/operative.py,sha256=AzNrvoF7DzXGRPwUkZc6YWJCW1aTIU_c8tMYvfTn1h0,14372
|
148
148
|
lionagi/protocols/operatives/step.py,sha256=uF92QO2KZiY3YR1cxhrbD844VFidOKfmeQn2Fv637iY,9280
|
149
149
|
lionagi/service/__init__.py,sha256=MYcfEFFLSdRS4blwYdx883T8Px2bn81JAeqSIPW9SFs,2545
|
150
150
|
lionagi/service/broadcaster.py,sha256=XvaUaBb6awcq-DJGVNJnnAIZUrrtOPnhWcgVgZTnGq8,1941
|
@@ -179,7 +179,7 @@ lionagi/service/hooks/hook_registry.py,sha256=V25UwTVoOixL1CKfRAyR0__fggCvF5pBK5
|
|
179
179
|
lionagi/service/hooks/hooked_event.py,sha256=D_1HtWCH3CriNlmsksi5lerXuF_LV2lbktcEdhZqXw0,4339
|
180
180
|
lionagi/service/third_party/README.md,sha256=qFjWnI8rmLivIyr6Tc-hRZh-rQwntROp76af4MBNJJc,2214
|
181
181
|
lionagi/service/third_party/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
182
|
-
lionagi/service/third_party/anthropic_models.py,sha256=
|
182
|
+
lionagi/service/third_party/anthropic_models.py,sha256=7_aLNbbTJjXc9-ifoloNBu7SXnugwvf3JZNVhbrnWQI,4019
|
183
183
|
lionagi/service/third_party/claude_code.py,sha256=C3EKtEEqN3zto42pJhd7hhqJQt1gtShSDDeTzphUUss,23844
|
184
184
|
lionagi/service/third_party/exa_models.py,sha256=G_hnekcy-DillPLzMoDQ8ZisVAL8Mp7iMAK4xqAT_3w,5470
|
185
185
|
lionagi/service/third_party/openai_model_names.py,sha256=C44tnqexgc4ZU2-3I_sn5d688hf3WWx-25xBd50bvas,5121
|
@@ -193,7 +193,7 @@ lionagi/tools/base.py,sha256=hEGnE4MD0CM4UqnF0xsDRKB0aM-pyrTFHl8utHhyJLU,1897
|
|
193
193
|
lionagi/tools/types.py,sha256=XtJLY0m-Yi_ZLWhm0KycayvqMCZd--HxfQ0x9vFUYDE,230
|
194
194
|
lionagi/tools/file/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
|
195
195
|
lionagi/tools/file/reader.py,sha256=Q9x1UP7YmBqN53e1kUN68OmIs-D1m9EM9VVbWfM35js,9658
|
196
|
-
lionagi-0.17.
|
197
|
-
lionagi-0.17.
|
198
|
-
lionagi-0.17.
|
199
|
-
lionagi-0.17.
|
196
|
+
lionagi-0.17.10.dist-info/METADATA,sha256=v4UrC6DpMbIeLD1JceBigraPq07C3kvOpFr5iKRPJYw,23446
|
197
|
+
lionagi-0.17.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
198
|
+
lionagi-0.17.10.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
|
199
|
+
lionagi-0.17.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|