letta-client 0.1.121__py3-none-any.whl → 0.1.123__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.
Potentially problematic release.
This version of letta-client might be problematic. Click here for more details.
- letta_client/__init__.py +24 -23
- letta_client/agents/__init__.py +2 -1
- letta_client/agents/client.py +90 -581
- letta_client/agents/groups/client.py +167 -0
- letta_client/agents/messages/client.py +145 -0
- letta_client/agents/passages/client.py +289 -0
- letta_client/base_client.py +12 -0
- letta_client/batches/__init__.py +2 -0
- letta_client/{messages/batches → batches}/client.py +19 -19
- letta_client/blocks/__init__.py +3 -0
- letta_client/blocks/agents/__init__.py +2 -0
- letta_client/blocks/agents/client.py +149 -0
- letta_client/blocks/client.py +4 -127
- letta_client/client_side_access_tokens/__init__.py +12 -12
- letta_client/client_side_access_tokens/client.py +28 -32
- letta_client/client_side_access_tokens/types/__init__.py +15 -21
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_request_policy_item.py → client_side_access_tokens_create_request_policy_item.py} +4 -4
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_request_policy_item_access_item.py → client_side_access_tokens_create_request_policy_item_access_item.py} +1 -1
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_response.py → client_side_access_tokens_create_response.py} +3 -5
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_response_policy.py → client_side_access_tokens_create_response_policy.py} +4 -4
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_response_policy_data_item.py → client_side_access_tokens_create_response_policy_data_item.py} +4 -4
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_response_policy_data_item_access_item.py → client_side_access_tokens_create_response_policy_data_item_access_item.py} +1 -1
- letta_client/core/client_wrapper.py +1 -1
- letta_client/embeddings/__init__.py +2 -0
- letta_client/embeddings/client.py +108 -0
- letta_client/groups/client.py +0 -124
- letta_client/groups/messages/client.py +124 -0
- letta_client/identities/__init__.py +3 -0
- letta_client/identities/client.py +4 -154
- letta_client/identities/properties/__init__.py +2 -0
- letta_client/identities/properties/client.py +181 -0
- letta_client/messages/__init__.py +0 -3
- letta_client/messages/client.py +0 -4
- letta_client/models/client.py +4 -97
- letta_client/projects/__init__.py +2 -2
- letta_client/projects/client.py +13 -13
- letta_client/projects/types/__init__.py +3 -3
- letta_client/projects/types/{projects_list_projects_response.py → projects_list_response.py} +3 -3
- letta_client/projects/types/{projects_list_projects_response_projects_item.py → projects_list_response_projects_item.py} +1 -1
- letta_client/providers/client.py +173 -10
- letta_client/runs/__init__.py +3 -0
- letta_client/runs/client.py +34 -480
- letta_client/runs/messages/__init__.py +2 -0
- letta_client/runs/messages/client.py +234 -0
- letta_client/runs/steps/__init__.py +2 -0
- letta_client/runs/steps/client.py +217 -0
- letta_client/runs/usage/__init__.py +2 -0
- letta_client/runs/usage/client.py +145 -0
- letta_client/sources/client.py +6 -4
- letta_client/steps/client.py +78 -4
- letta_client/tags/__init__.py +2 -0
- letta_client/tags/client.py +92 -0
- letta_client/templates/__init__.py +4 -10
- letta_client/templates/agents/__init__.py +5 -0
- letta_client/templates/agents/client.py +208 -0
- letta_client/templates/agents/types/__init__.py +5 -0
- letta_client/templates/{types/templates_create_agents_response.py → agents/types/agents_create_response.py} +4 -4
- letta_client/templates/client.py +18 -203
- letta_client/templates/types/__init__.py +3 -8
- letta_client/templates/types/{templates_list_templates_response.py → templates_list_response.py} +3 -3
- letta_client/templates/types/{templates_list_templates_response_templates_item.py → templates_list_response_templates_item.py} +1 -1
- letta_client/tools/client.py +4 -4
- {letta_client-0.1.121.dist-info → letta_client-0.1.123.dist-info}/METADATA +1 -1
- {letta_client-0.1.121.dist-info → letta_client-0.1.123.dist-info}/RECORD +66 -47
- /letta_client/{messages/batches → agents/groups}/__init__.py +0 -0
- {letta_client-0.1.121.dist-info → letta_client-0.1.123.dist-info}/WHEEL +0 -0
|
@@ -405,6 +405,64 @@ class MessagesClient:
|
|
|
405
405
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
406
406
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
407
407
|
|
|
408
|
+
def reset(
|
|
409
|
+
self, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
410
|
+
) -> typing.Optional[typing.Any]:
|
|
411
|
+
"""
|
|
412
|
+
Delete the group messages for all agents that are part of the multi-agent group.
|
|
413
|
+
|
|
414
|
+
Parameters
|
|
415
|
+
----------
|
|
416
|
+
group_id : str
|
|
417
|
+
|
|
418
|
+
request_options : typing.Optional[RequestOptions]
|
|
419
|
+
Request-specific configuration.
|
|
420
|
+
|
|
421
|
+
Returns
|
|
422
|
+
-------
|
|
423
|
+
typing.Optional[typing.Any]
|
|
424
|
+
Successful Response
|
|
425
|
+
|
|
426
|
+
Examples
|
|
427
|
+
--------
|
|
428
|
+
from letta_client import Letta
|
|
429
|
+
|
|
430
|
+
client = Letta(
|
|
431
|
+
token="YOUR_TOKEN",
|
|
432
|
+
)
|
|
433
|
+
client.groups.messages.reset(
|
|
434
|
+
group_id="group_id",
|
|
435
|
+
)
|
|
436
|
+
"""
|
|
437
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
438
|
+
f"v1/groups/{jsonable_encoder(group_id)}/reset-messages",
|
|
439
|
+
method="PATCH",
|
|
440
|
+
request_options=request_options,
|
|
441
|
+
)
|
|
442
|
+
try:
|
|
443
|
+
if 200 <= _response.status_code < 300:
|
|
444
|
+
return typing.cast(
|
|
445
|
+
typing.Optional[typing.Any],
|
|
446
|
+
construct_type(
|
|
447
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
448
|
+
object_=_response.json(),
|
|
449
|
+
),
|
|
450
|
+
)
|
|
451
|
+
if _response.status_code == 422:
|
|
452
|
+
raise UnprocessableEntityError(
|
|
453
|
+
typing.cast(
|
|
454
|
+
HttpValidationError,
|
|
455
|
+
construct_type(
|
|
456
|
+
type_=HttpValidationError, # type: ignore
|
|
457
|
+
object_=_response.json(),
|
|
458
|
+
),
|
|
459
|
+
)
|
|
460
|
+
)
|
|
461
|
+
_response_json = _response.json()
|
|
462
|
+
except JSONDecodeError:
|
|
463
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
464
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
465
|
+
|
|
408
466
|
|
|
409
467
|
class AsyncMessagesClient:
|
|
410
468
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -818,3 +876,69 @@ class AsyncMessagesClient:
|
|
|
818
876
|
except JSONDecodeError:
|
|
819
877
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
820
878
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
879
|
+
|
|
880
|
+
async def reset(
|
|
881
|
+
self, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
882
|
+
) -> typing.Optional[typing.Any]:
|
|
883
|
+
"""
|
|
884
|
+
Delete the group messages for all agents that are part of the multi-agent group.
|
|
885
|
+
|
|
886
|
+
Parameters
|
|
887
|
+
----------
|
|
888
|
+
group_id : str
|
|
889
|
+
|
|
890
|
+
request_options : typing.Optional[RequestOptions]
|
|
891
|
+
Request-specific configuration.
|
|
892
|
+
|
|
893
|
+
Returns
|
|
894
|
+
-------
|
|
895
|
+
typing.Optional[typing.Any]
|
|
896
|
+
Successful Response
|
|
897
|
+
|
|
898
|
+
Examples
|
|
899
|
+
--------
|
|
900
|
+
import asyncio
|
|
901
|
+
|
|
902
|
+
from letta_client import AsyncLetta
|
|
903
|
+
|
|
904
|
+
client = AsyncLetta(
|
|
905
|
+
token="YOUR_TOKEN",
|
|
906
|
+
)
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
async def main() -> None:
|
|
910
|
+
await client.groups.messages.reset(
|
|
911
|
+
group_id="group_id",
|
|
912
|
+
)
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
asyncio.run(main())
|
|
916
|
+
"""
|
|
917
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
918
|
+
f"v1/groups/{jsonable_encoder(group_id)}/reset-messages",
|
|
919
|
+
method="PATCH",
|
|
920
|
+
request_options=request_options,
|
|
921
|
+
)
|
|
922
|
+
try:
|
|
923
|
+
if 200 <= _response.status_code < 300:
|
|
924
|
+
return typing.cast(
|
|
925
|
+
typing.Optional[typing.Any],
|
|
926
|
+
construct_type(
|
|
927
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
928
|
+
object_=_response.json(),
|
|
929
|
+
),
|
|
930
|
+
)
|
|
931
|
+
if _response.status_code == 422:
|
|
932
|
+
raise UnprocessableEntityError(
|
|
933
|
+
typing.cast(
|
|
934
|
+
HttpValidationError,
|
|
935
|
+
construct_type(
|
|
936
|
+
type_=HttpValidationError, # type: ignore
|
|
937
|
+
object_=_response.json(),
|
|
938
|
+
),
|
|
939
|
+
)
|
|
940
|
+
)
|
|
941
|
+
_response_json = _response.json()
|
|
942
|
+
except JSONDecodeError:
|
|
943
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
944
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
4
|
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from .properties.client import PropertiesClient
|
|
5
6
|
from ..types.identity_type import IdentityType
|
|
6
7
|
from ..core.request_options import RequestOptions
|
|
7
8
|
from ..types.identity import Identity
|
|
@@ -14,6 +15,7 @@ from ..types.identity_property import IdentityProperty
|
|
|
14
15
|
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
15
16
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
16
17
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
18
|
+
from .properties.client import AsyncPropertiesClient
|
|
17
19
|
|
|
18
20
|
# this is used as the default value for optional parameters
|
|
19
21
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -22,6 +24,7 @@ OMIT = typing.cast(typing.Any, ...)
|
|
|
22
24
|
class IdentitiesClient:
|
|
23
25
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
24
26
|
self._client_wrapper = client_wrapper
|
|
27
|
+
self.properties = PropertiesClient(client_wrapper=self._client_wrapper)
|
|
25
28
|
|
|
26
29
|
def list(
|
|
27
30
|
self,
|
|
@@ -528,83 +531,11 @@ class IdentitiesClient:
|
|
|
528
531
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
529
532
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
530
533
|
|
|
531
|
-
def upsert_identity_properties(
|
|
532
|
-
self,
|
|
533
|
-
identity_id: str,
|
|
534
|
-
*,
|
|
535
|
-
request: typing.Sequence[IdentityProperty],
|
|
536
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
537
|
-
) -> typing.Optional[typing.Any]:
|
|
538
|
-
"""
|
|
539
|
-
Parameters
|
|
540
|
-
----------
|
|
541
|
-
identity_id : str
|
|
542
|
-
|
|
543
|
-
request : typing.Sequence[IdentityProperty]
|
|
544
|
-
|
|
545
|
-
request_options : typing.Optional[RequestOptions]
|
|
546
|
-
Request-specific configuration.
|
|
547
|
-
|
|
548
|
-
Returns
|
|
549
|
-
-------
|
|
550
|
-
typing.Optional[typing.Any]
|
|
551
|
-
Successful Response
|
|
552
|
-
|
|
553
|
-
Examples
|
|
554
|
-
--------
|
|
555
|
-
from letta_client import IdentityProperty, Letta
|
|
556
|
-
|
|
557
|
-
client = Letta(
|
|
558
|
-
token="YOUR_TOKEN",
|
|
559
|
-
)
|
|
560
|
-
client.identities.upsert_identity_properties(
|
|
561
|
-
identity_id="identity_id",
|
|
562
|
-
request=[
|
|
563
|
-
IdentityProperty(
|
|
564
|
-
key="key",
|
|
565
|
-
value="value",
|
|
566
|
-
type="string",
|
|
567
|
-
)
|
|
568
|
-
],
|
|
569
|
-
)
|
|
570
|
-
"""
|
|
571
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
572
|
-
f"v1/identities/{jsonable_encoder(identity_id)}/properties",
|
|
573
|
-
method="PUT",
|
|
574
|
-
json=convert_and_respect_annotation_metadata(
|
|
575
|
-
object_=request, annotation=typing.Sequence[IdentityProperty], direction="write"
|
|
576
|
-
),
|
|
577
|
-
request_options=request_options,
|
|
578
|
-
omit=OMIT,
|
|
579
|
-
)
|
|
580
|
-
try:
|
|
581
|
-
if 200 <= _response.status_code < 300:
|
|
582
|
-
return typing.cast(
|
|
583
|
-
typing.Optional[typing.Any],
|
|
584
|
-
construct_type(
|
|
585
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
586
|
-
object_=_response.json(),
|
|
587
|
-
),
|
|
588
|
-
)
|
|
589
|
-
if _response.status_code == 422:
|
|
590
|
-
raise UnprocessableEntityError(
|
|
591
|
-
typing.cast(
|
|
592
|
-
HttpValidationError,
|
|
593
|
-
construct_type(
|
|
594
|
-
type_=HttpValidationError, # type: ignore
|
|
595
|
-
object_=_response.json(),
|
|
596
|
-
),
|
|
597
|
-
)
|
|
598
|
-
)
|
|
599
|
-
_response_json = _response.json()
|
|
600
|
-
except JSONDecodeError:
|
|
601
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
602
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
603
|
-
|
|
604
534
|
|
|
605
535
|
class AsyncIdentitiesClient:
|
|
606
536
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
607
537
|
self._client_wrapper = client_wrapper
|
|
538
|
+
self.properties = AsyncPropertiesClient(client_wrapper=self._client_wrapper)
|
|
608
539
|
|
|
609
540
|
async def list(
|
|
610
541
|
self,
|
|
@@ -1158,84 +1089,3 @@ class AsyncIdentitiesClient:
|
|
|
1158
1089
|
except JSONDecodeError:
|
|
1159
1090
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1160
1091
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1161
|
-
|
|
1162
|
-
async def upsert_identity_properties(
|
|
1163
|
-
self,
|
|
1164
|
-
identity_id: str,
|
|
1165
|
-
*,
|
|
1166
|
-
request: typing.Sequence[IdentityProperty],
|
|
1167
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1168
|
-
) -> typing.Optional[typing.Any]:
|
|
1169
|
-
"""
|
|
1170
|
-
Parameters
|
|
1171
|
-
----------
|
|
1172
|
-
identity_id : str
|
|
1173
|
-
|
|
1174
|
-
request : typing.Sequence[IdentityProperty]
|
|
1175
|
-
|
|
1176
|
-
request_options : typing.Optional[RequestOptions]
|
|
1177
|
-
Request-specific configuration.
|
|
1178
|
-
|
|
1179
|
-
Returns
|
|
1180
|
-
-------
|
|
1181
|
-
typing.Optional[typing.Any]
|
|
1182
|
-
Successful Response
|
|
1183
|
-
|
|
1184
|
-
Examples
|
|
1185
|
-
--------
|
|
1186
|
-
import asyncio
|
|
1187
|
-
|
|
1188
|
-
from letta_client import AsyncLetta, IdentityProperty
|
|
1189
|
-
|
|
1190
|
-
client = AsyncLetta(
|
|
1191
|
-
token="YOUR_TOKEN",
|
|
1192
|
-
)
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
async def main() -> None:
|
|
1196
|
-
await client.identities.upsert_identity_properties(
|
|
1197
|
-
identity_id="identity_id",
|
|
1198
|
-
request=[
|
|
1199
|
-
IdentityProperty(
|
|
1200
|
-
key="key",
|
|
1201
|
-
value="value",
|
|
1202
|
-
type="string",
|
|
1203
|
-
)
|
|
1204
|
-
],
|
|
1205
|
-
)
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
asyncio.run(main())
|
|
1209
|
-
"""
|
|
1210
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
1211
|
-
f"v1/identities/{jsonable_encoder(identity_id)}/properties",
|
|
1212
|
-
method="PUT",
|
|
1213
|
-
json=convert_and_respect_annotation_metadata(
|
|
1214
|
-
object_=request, annotation=typing.Sequence[IdentityProperty], direction="write"
|
|
1215
|
-
),
|
|
1216
|
-
request_options=request_options,
|
|
1217
|
-
omit=OMIT,
|
|
1218
|
-
)
|
|
1219
|
-
try:
|
|
1220
|
-
if 200 <= _response.status_code < 300:
|
|
1221
|
-
return typing.cast(
|
|
1222
|
-
typing.Optional[typing.Any],
|
|
1223
|
-
construct_type(
|
|
1224
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
1225
|
-
object_=_response.json(),
|
|
1226
|
-
),
|
|
1227
|
-
)
|
|
1228
|
-
if _response.status_code == 422:
|
|
1229
|
-
raise UnprocessableEntityError(
|
|
1230
|
-
typing.cast(
|
|
1231
|
-
HttpValidationError,
|
|
1232
|
-
construct_type(
|
|
1233
|
-
type_=HttpValidationError, # type: ignore
|
|
1234
|
-
object_=_response.json(),
|
|
1235
|
-
),
|
|
1236
|
-
)
|
|
1237
|
-
)
|
|
1238
|
-
_response_json = _response.json()
|
|
1239
|
-
except JSONDecodeError:
|
|
1240
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1241
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ...core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from ...types.identity_property import IdentityProperty
|
|
6
|
+
from ...core.request_options import RequestOptions
|
|
7
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
8
|
+
from ...core.serialization import convert_and_respect_annotation_metadata
|
|
9
|
+
from ...core.unchecked_base_model import construct_type
|
|
10
|
+
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
11
|
+
from ...types.http_validation_error import HttpValidationError
|
|
12
|
+
from json.decoder import JSONDecodeError
|
|
13
|
+
from ...core.api_error import ApiError
|
|
14
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
15
|
+
|
|
16
|
+
# this is used as the default value for optional parameters
|
|
17
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class PropertiesClient:
|
|
21
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
22
|
+
self._client_wrapper = client_wrapper
|
|
23
|
+
|
|
24
|
+
def upsert(
|
|
25
|
+
self,
|
|
26
|
+
identity_id: str,
|
|
27
|
+
*,
|
|
28
|
+
request: typing.Sequence[IdentityProperty],
|
|
29
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
30
|
+
) -> typing.Optional[typing.Any]:
|
|
31
|
+
"""
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
identity_id : str
|
|
35
|
+
|
|
36
|
+
request : typing.Sequence[IdentityProperty]
|
|
37
|
+
|
|
38
|
+
request_options : typing.Optional[RequestOptions]
|
|
39
|
+
Request-specific configuration.
|
|
40
|
+
|
|
41
|
+
Returns
|
|
42
|
+
-------
|
|
43
|
+
typing.Optional[typing.Any]
|
|
44
|
+
Successful Response
|
|
45
|
+
|
|
46
|
+
Examples
|
|
47
|
+
--------
|
|
48
|
+
from letta_client import IdentityProperty, Letta
|
|
49
|
+
|
|
50
|
+
client = Letta(
|
|
51
|
+
token="YOUR_TOKEN",
|
|
52
|
+
)
|
|
53
|
+
client.identities.properties.upsert(
|
|
54
|
+
identity_id="identity_id",
|
|
55
|
+
request=[
|
|
56
|
+
IdentityProperty(
|
|
57
|
+
key="key",
|
|
58
|
+
value="value",
|
|
59
|
+
type="string",
|
|
60
|
+
)
|
|
61
|
+
],
|
|
62
|
+
)
|
|
63
|
+
"""
|
|
64
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
65
|
+
f"v1/identities/{jsonable_encoder(identity_id)}/properties",
|
|
66
|
+
method="PUT",
|
|
67
|
+
json=convert_and_respect_annotation_metadata(
|
|
68
|
+
object_=request, annotation=typing.Sequence[IdentityProperty], direction="write"
|
|
69
|
+
),
|
|
70
|
+
request_options=request_options,
|
|
71
|
+
omit=OMIT,
|
|
72
|
+
)
|
|
73
|
+
try:
|
|
74
|
+
if 200 <= _response.status_code < 300:
|
|
75
|
+
return typing.cast(
|
|
76
|
+
typing.Optional[typing.Any],
|
|
77
|
+
construct_type(
|
|
78
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
79
|
+
object_=_response.json(),
|
|
80
|
+
),
|
|
81
|
+
)
|
|
82
|
+
if _response.status_code == 422:
|
|
83
|
+
raise UnprocessableEntityError(
|
|
84
|
+
typing.cast(
|
|
85
|
+
HttpValidationError,
|
|
86
|
+
construct_type(
|
|
87
|
+
type_=HttpValidationError, # type: ignore
|
|
88
|
+
object_=_response.json(),
|
|
89
|
+
),
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
_response_json = _response.json()
|
|
93
|
+
except JSONDecodeError:
|
|
94
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
95
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class AsyncPropertiesClient:
|
|
99
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
100
|
+
self._client_wrapper = client_wrapper
|
|
101
|
+
|
|
102
|
+
async def upsert(
|
|
103
|
+
self,
|
|
104
|
+
identity_id: str,
|
|
105
|
+
*,
|
|
106
|
+
request: typing.Sequence[IdentityProperty],
|
|
107
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
108
|
+
) -> typing.Optional[typing.Any]:
|
|
109
|
+
"""
|
|
110
|
+
Parameters
|
|
111
|
+
----------
|
|
112
|
+
identity_id : str
|
|
113
|
+
|
|
114
|
+
request : typing.Sequence[IdentityProperty]
|
|
115
|
+
|
|
116
|
+
request_options : typing.Optional[RequestOptions]
|
|
117
|
+
Request-specific configuration.
|
|
118
|
+
|
|
119
|
+
Returns
|
|
120
|
+
-------
|
|
121
|
+
typing.Optional[typing.Any]
|
|
122
|
+
Successful Response
|
|
123
|
+
|
|
124
|
+
Examples
|
|
125
|
+
--------
|
|
126
|
+
import asyncio
|
|
127
|
+
|
|
128
|
+
from letta_client import AsyncLetta, IdentityProperty
|
|
129
|
+
|
|
130
|
+
client = AsyncLetta(
|
|
131
|
+
token="YOUR_TOKEN",
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
async def main() -> None:
|
|
136
|
+
await client.identities.properties.upsert(
|
|
137
|
+
identity_id="identity_id",
|
|
138
|
+
request=[
|
|
139
|
+
IdentityProperty(
|
|
140
|
+
key="key",
|
|
141
|
+
value="value",
|
|
142
|
+
type="string",
|
|
143
|
+
)
|
|
144
|
+
],
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
asyncio.run(main())
|
|
149
|
+
"""
|
|
150
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
151
|
+
f"v1/identities/{jsonable_encoder(identity_id)}/properties",
|
|
152
|
+
method="PUT",
|
|
153
|
+
json=convert_and_respect_annotation_metadata(
|
|
154
|
+
object_=request, annotation=typing.Sequence[IdentityProperty], direction="write"
|
|
155
|
+
),
|
|
156
|
+
request_options=request_options,
|
|
157
|
+
omit=OMIT,
|
|
158
|
+
)
|
|
159
|
+
try:
|
|
160
|
+
if 200 <= _response.status_code < 300:
|
|
161
|
+
return typing.cast(
|
|
162
|
+
typing.Optional[typing.Any],
|
|
163
|
+
construct_type(
|
|
164
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
165
|
+
object_=_response.json(),
|
|
166
|
+
),
|
|
167
|
+
)
|
|
168
|
+
if _response.status_code == 422:
|
|
169
|
+
raise UnprocessableEntityError(
|
|
170
|
+
typing.cast(
|
|
171
|
+
HttpValidationError,
|
|
172
|
+
construct_type(
|
|
173
|
+
type_=HttpValidationError, # type: ignore
|
|
174
|
+
object_=_response.json(),
|
|
175
|
+
),
|
|
176
|
+
)
|
|
177
|
+
)
|
|
178
|
+
_response_json = _response.json()
|
|
179
|
+
except JSONDecodeError:
|
|
180
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
181
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
letta_client/messages/client.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from ..core.client_wrapper import SyncClientWrapper
|
|
4
|
-
from .batches.client import BatchesClient
|
|
5
4
|
import typing
|
|
6
5
|
from ..core.request_options import RequestOptions
|
|
7
6
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
@@ -11,13 +10,11 @@ from ..types.http_validation_error import HttpValidationError
|
|
|
11
10
|
from json.decoder import JSONDecodeError
|
|
12
11
|
from ..core.api_error import ApiError
|
|
13
12
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
14
|
-
from .batches.client import AsyncBatchesClient
|
|
15
13
|
|
|
16
14
|
|
|
17
15
|
class MessagesClient:
|
|
18
16
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
17
|
self._client_wrapper = client_wrapper
|
|
20
|
-
self.batches = BatchesClient(client_wrapper=self._client_wrapper)
|
|
21
18
|
|
|
22
19
|
def cancel_batch_run(
|
|
23
20
|
self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
@@ -81,7 +78,6 @@ class MessagesClient:
|
|
|
81
78
|
class AsyncMessagesClient:
|
|
82
79
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
83
80
|
self._client_wrapper = client_wrapper
|
|
84
|
-
self.batches = AsyncBatchesClient(client_wrapper=self._client_wrapper)
|
|
85
81
|
|
|
86
82
|
async def cancel_batch_run(
|
|
87
83
|
self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
letta_client/models/client.py
CHANGED
|
@@ -7,7 +7,6 @@ from ..types.llm_config import LlmConfig
|
|
|
7
7
|
from ..core.unchecked_base_model import construct_type
|
|
8
8
|
from json.decoder import JSONDecodeError
|
|
9
9
|
from ..core.api_error import ApiError
|
|
10
|
-
from ..types.embedding_config import EmbeddingConfig
|
|
11
10
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
12
11
|
|
|
13
12
|
|
|
@@ -15,7 +14,7 @@ class ModelsClient:
|
|
|
15
14
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
16
15
|
self._client_wrapper = client_wrapper
|
|
17
16
|
|
|
18
|
-
def
|
|
17
|
+
def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[LlmConfig]:
|
|
19
18
|
"""
|
|
20
19
|
Parameters
|
|
21
20
|
----------
|
|
@@ -34,7 +33,7 @@ class ModelsClient:
|
|
|
34
33
|
client = Letta(
|
|
35
34
|
token="YOUR_TOKEN",
|
|
36
35
|
)
|
|
37
|
-
client.models.
|
|
36
|
+
client.models.list()
|
|
38
37
|
"""
|
|
39
38
|
_response = self._client_wrapper.httpx_client.request(
|
|
40
39
|
"v1/models/",
|
|
@@ -55,54 +54,12 @@ class ModelsClient:
|
|
|
55
54
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
56
55
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
57
56
|
|
|
58
|
-
def list_embedding_models(
|
|
59
|
-
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
60
|
-
) -> typing.List[EmbeddingConfig]:
|
|
61
|
-
"""
|
|
62
|
-
Parameters
|
|
63
|
-
----------
|
|
64
|
-
request_options : typing.Optional[RequestOptions]
|
|
65
|
-
Request-specific configuration.
|
|
66
|
-
|
|
67
|
-
Returns
|
|
68
|
-
-------
|
|
69
|
-
typing.List[EmbeddingConfig]
|
|
70
|
-
Successful Response
|
|
71
|
-
|
|
72
|
-
Examples
|
|
73
|
-
--------
|
|
74
|
-
from letta_client import Letta
|
|
75
|
-
|
|
76
|
-
client = Letta(
|
|
77
|
-
token="YOUR_TOKEN",
|
|
78
|
-
)
|
|
79
|
-
client.models.list_embedding_models()
|
|
80
|
-
"""
|
|
81
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
82
|
-
"v1/models/embedding",
|
|
83
|
-
method="GET",
|
|
84
|
-
request_options=request_options,
|
|
85
|
-
)
|
|
86
|
-
try:
|
|
87
|
-
if 200 <= _response.status_code < 300:
|
|
88
|
-
return typing.cast(
|
|
89
|
-
typing.List[EmbeddingConfig],
|
|
90
|
-
construct_type(
|
|
91
|
-
type_=typing.List[EmbeddingConfig], # type: ignore
|
|
92
|
-
object_=_response.json(),
|
|
93
|
-
),
|
|
94
|
-
)
|
|
95
|
-
_response_json = _response.json()
|
|
96
|
-
except JSONDecodeError:
|
|
97
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
98
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
99
|
-
|
|
100
57
|
|
|
101
58
|
class AsyncModelsClient:
|
|
102
59
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
103
60
|
self._client_wrapper = client_wrapper
|
|
104
61
|
|
|
105
|
-
async def
|
|
62
|
+
async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[LlmConfig]:
|
|
106
63
|
"""
|
|
107
64
|
Parameters
|
|
108
65
|
----------
|
|
@@ -126,7 +83,7 @@ class AsyncModelsClient:
|
|
|
126
83
|
|
|
127
84
|
|
|
128
85
|
async def main() -> None:
|
|
129
|
-
await client.models.
|
|
86
|
+
await client.models.list()
|
|
130
87
|
|
|
131
88
|
|
|
132
89
|
asyncio.run(main())
|
|
@@ -149,53 +106,3 @@ class AsyncModelsClient:
|
|
|
149
106
|
except JSONDecodeError:
|
|
150
107
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
151
108
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
152
|
-
|
|
153
|
-
async def list_embedding_models(
|
|
154
|
-
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
155
|
-
) -> typing.List[EmbeddingConfig]:
|
|
156
|
-
"""
|
|
157
|
-
Parameters
|
|
158
|
-
----------
|
|
159
|
-
request_options : typing.Optional[RequestOptions]
|
|
160
|
-
Request-specific configuration.
|
|
161
|
-
|
|
162
|
-
Returns
|
|
163
|
-
-------
|
|
164
|
-
typing.List[EmbeddingConfig]
|
|
165
|
-
Successful Response
|
|
166
|
-
|
|
167
|
-
Examples
|
|
168
|
-
--------
|
|
169
|
-
import asyncio
|
|
170
|
-
|
|
171
|
-
from letta_client import AsyncLetta
|
|
172
|
-
|
|
173
|
-
client = AsyncLetta(
|
|
174
|
-
token="YOUR_TOKEN",
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
async def main() -> None:
|
|
179
|
-
await client.models.list_embedding_models()
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
asyncio.run(main())
|
|
183
|
-
"""
|
|
184
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
185
|
-
"v1/models/embedding",
|
|
186
|
-
method="GET",
|
|
187
|
-
request_options=request_options,
|
|
188
|
-
)
|
|
189
|
-
try:
|
|
190
|
-
if 200 <= _response.status_code < 300:
|
|
191
|
-
return typing.cast(
|
|
192
|
-
typing.List[EmbeddingConfig],
|
|
193
|
-
construct_type(
|
|
194
|
-
type_=typing.List[EmbeddingConfig], # type: ignore
|
|
195
|
-
object_=_response.json(),
|
|
196
|
-
),
|
|
197
|
-
)
|
|
198
|
-
_response_json = _response.json()
|
|
199
|
-
except JSONDecodeError:
|
|
200
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
201
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|