letta-client 0.1.171__py3-none-any.whl → 0.1.173__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/core/client_wrapper.py +1 -1
- letta_client/sources/client.py +153 -0
- letta_client/types/message_schema.py +2 -2
- {letta_client-0.1.171.dist-info → letta_client-0.1.173.dist-info}/METADATA +1 -1
- {letta_client-0.1.171.dist-info → letta_client-0.1.173.dist-info}/RECORD +6 -6
- {letta_client-0.1.171.dist-info → letta_client-0.1.173.dist-info}/WHEEL +0 -0
|
@@ -16,7 +16,7 @@ class BaseClientWrapper:
|
|
|
16
16
|
headers: typing.Dict[str, str] = {
|
|
17
17
|
"X-Fern-Language": "Python",
|
|
18
18
|
"X-Fern-SDK-Name": "letta-client",
|
|
19
|
-
"X-Fern-SDK-Version": "0.1.
|
|
19
|
+
"X-Fern-SDK-Version": "0.1.173",
|
|
20
20
|
}
|
|
21
21
|
if self.token is not None:
|
|
22
22
|
headers["Authorization"] = f"Bearer {self.token}"
|
letta_client/sources/client.py
CHANGED
|
@@ -14,6 +14,7 @@ from ..types.source import Source
|
|
|
14
14
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
15
15
|
from ..types.embedding_config import EmbeddingConfig
|
|
16
16
|
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
17
|
+
from ..types.file_metadata import FileMetadata
|
|
17
18
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
18
19
|
from .files.client import AsyncFilesClient
|
|
19
20
|
from .passages.client import AsyncPassagesClient
|
|
@@ -497,6 +498,78 @@ class SourcesClient:
|
|
|
497
498
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
498
499
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
499
500
|
|
|
501
|
+
def get_file_metadata(
|
|
502
|
+
self,
|
|
503
|
+
source_id: str,
|
|
504
|
+
file_id: str,
|
|
505
|
+
*,
|
|
506
|
+
include_content: typing.Optional[bool] = None,
|
|
507
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
508
|
+
) -> FileMetadata:
|
|
509
|
+
"""
|
|
510
|
+
Retrieve metadata for a specific file by its ID.
|
|
511
|
+
|
|
512
|
+
Parameters
|
|
513
|
+
----------
|
|
514
|
+
source_id : str
|
|
515
|
+
|
|
516
|
+
file_id : str
|
|
517
|
+
|
|
518
|
+
include_content : typing.Optional[bool]
|
|
519
|
+
Whether to include full file content
|
|
520
|
+
|
|
521
|
+
request_options : typing.Optional[RequestOptions]
|
|
522
|
+
Request-specific configuration.
|
|
523
|
+
|
|
524
|
+
Returns
|
|
525
|
+
-------
|
|
526
|
+
FileMetadata
|
|
527
|
+
Successful Response
|
|
528
|
+
|
|
529
|
+
Examples
|
|
530
|
+
--------
|
|
531
|
+
from letta_client import Letta
|
|
532
|
+
|
|
533
|
+
client = Letta(
|
|
534
|
+
token="YOUR_TOKEN",
|
|
535
|
+
)
|
|
536
|
+
client.sources.get_file_metadata(
|
|
537
|
+
source_id="source_id",
|
|
538
|
+
file_id="file_id",
|
|
539
|
+
)
|
|
540
|
+
"""
|
|
541
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
542
|
+
f"v1/sources/{jsonable_encoder(source_id)}/files/{jsonable_encoder(file_id)}",
|
|
543
|
+
method="GET",
|
|
544
|
+
params={
|
|
545
|
+
"include_content": include_content,
|
|
546
|
+
},
|
|
547
|
+
request_options=request_options,
|
|
548
|
+
)
|
|
549
|
+
try:
|
|
550
|
+
if 200 <= _response.status_code < 300:
|
|
551
|
+
return typing.cast(
|
|
552
|
+
FileMetadata,
|
|
553
|
+
construct_type(
|
|
554
|
+
type_=FileMetadata, # type: ignore
|
|
555
|
+
object_=_response.json(),
|
|
556
|
+
),
|
|
557
|
+
)
|
|
558
|
+
if _response.status_code == 422:
|
|
559
|
+
raise UnprocessableEntityError(
|
|
560
|
+
typing.cast(
|
|
561
|
+
HttpValidationError,
|
|
562
|
+
construct_type(
|
|
563
|
+
type_=HttpValidationError, # type: ignore
|
|
564
|
+
object_=_response.json(),
|
|
565
|
+
),
|
|
566
|
+
)
|
|
567
|
+
)
|
|
568
|
+
_response_json = _response.json()
|
|
569
|
+
except JSONDecodeError:
|
|
570
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
571
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
572
|
+
|
|
500
573
|
|
|
501
574
|
class AsyncSourcesClient:
|
|
502
575
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -1030,3 +1103,83 @@ class AsyncSourcesClient:
|
|
|
1030
1103
|
except JSONDecodeError:
|
|
1031
1104
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1032
1105
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1106
|
+
|
|
1107
|
+
async def get_file_metadata(
|
|
1108
|
+
self,
|
|
1109
|
+
source_id: str,
|
|
1110
|
+
file_id: str,
|
|
1111
|
+
*,
|
|
1112
|
+
include_content: typing.Optional[bool] = None,
|
|
1113
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1114
|
+
) -> FileMetadata:
|
|
1115
|
+
"""
|
|
1116
|
+
Retrieve metadata for a specific file by its ID.
|
|
1117
|
+
|
|
1118
|
+
Parameters
|
|
1119
|
+
----------
|
|
1120
|
+
source_id : str
|
|
1121
|
+
|
|
1122
|
+
file_id : str
|
|
1123
|
+
|
|
1124
|
+
include_content : typing.Optional[bool]
|
|
1125
|
+
Whether to include full file content
|
|
1126
|
+
|
|
1127
|
+
request_options : typing.Optional[RequestOptions]
|
|
1128
|
+
Request-specific configuration.
|
|
1129
|
+
|
|
1130
|
+
Returns
|
|
1131
|
+
-------
|
|
1132
|
+
FileMetadata
|
|
1133
|
+
Successful Response
|
|
1134
|
+
|
|
1135
|
+
Examples
|
|
1136
|
+
--------
|
|
1137
|
+
import asyncio
|
|
1138
|
+
|
|
1139
|
+
from letta_client import AsyncLetta
|
|
1140
|
+
|
|
1141
|
+
client = AsyncLetta(
|
|
1142
|
+
token="YOUR_TOKEN",
|
|
1143
|
+
)
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
async def main() -> None:
|
|
1147
|
+
await client.sources.get_file_metadata(
|
|
1148
|
+
source_id="source_id",
|
|
1149
|
+
file_id="file_id",
|
|
1150
|
+
)
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
asyncio.run(main())
|
|
1154
|
+
"""
|
|
1155
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1156
|
+
f"v1/sources/{jsonable_encoder(source_id)}/files/{jsonable_encoder(file_id)}",
|
|
1157
|
+
method="GET",
|
|
1158
|
+
params={
|
|
1159
|
+
"include_content": include_content,
|
|
1160
|
+
},
|
|
1161
|
+
request_options=request_options,
|
|
1162
|
+
)
|
|
1163
|
+
try:
|
|
1164
|
+
if 200 <= _response.status_code < 300:
|
|
1165
|
+
return typing.cast(
|
|
1166
|
+
FileMetadata,
|
|
1167
|
+
construct_type(
|
|
1168
|
+
type_=FileMetadata, # type: ignore
|
|
1169
|
+
object_=_response.json(),
|
|
1170
|
+
),
|
|
1171
|
+
)
|
|
1172
|
+
if _response.status_code == 422:
|
|
1173
|
+
raise UnprocessableEntityError(
|
|
1174
|
+
typing.cast(
|
|
1175
|
+
HttpValidationError,
|
|
1176
|
+
construct_type(
|
|
1177
|
+
type_=HttpValidationError, # type: ignore
|
|
1178
|
+
object_=_response.json(),
|
|
1179
|
+
),
|
|
1180
|
+
)
|
|
1181
|
+
)
|
|
1182
|
+
_response_json = _response.json()
|
|
1183
|
+
except JSONDecodeError:
|
|
1184
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1185
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
4
|
import typing
|
|
5
|
-
from .
|
|
5
|
+
from .letta_message_content_union import LettaMessageContentUnion
|
|
6
6
|
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
7
|
import pydantic
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ class MessageSchema(UncheckedBaseModel):
|
|
|
13
13
|
model: typing.Optional[str] = None
|
|
14
14
|
name: typing.Optional[str] = None
|
|
15
15
|
role: str
|
|
16
|
-
content: typing.List[
|
|
16
|
+
content: typing.List[LettaMessageContentUnion]
|
|
17
17
|
tool_call_id: typing.Optional[str] = None
|
|
18
18
|
tool_calls: typing.List[typing.Optional[typing.Any]]
|
|
19
19
|
tool_returns: typing.List[typing.Optional[typing.Any]]
|
|
@@ -63,7 +63,7 @@ letta_client/client_side_access_tokens/types/client_side_access_tokens_create_re
|
|
|
63
63
|
letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response_policy_data_item_access_item.py,sha256=R-H25IpNp9feSrW8Yj3h9O3UTMVvFniQJElogKxLuoE,254
|
|
64
64
|
letta_client/core/__init__.py,sha256=OKbX2aCZXgHCDUsCouqv-OiX32xA6eFFCKIUH9M5Vzk,1591
|
|
65
65
|
letta_client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
|
66
|
-
letta_client/core/client_wrapper.py,sha256=
|
|
66
|
+
letta_client/core/client_wrapper.py,sha256=0k1DsK1VtoGiFCWL2Og-_VHGGoHdDS_WXqmfidcqSB8,1998
|
|
67
67
|
letta_client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
|
68
68
|
letta_client/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
|
|
69
69
|
letta_client/core/http_client.py,sha256=Z77OIxIbL4OAB2IDqjRq_sYa5yNYAWfmdhdCSSvh6Y4,19552
|
|
@@ -124,7 +124,7 @@ letta_client/runs/steps/client.py,sha256=f916x0x6FH7_WzBSl6uw03l-j-QMzr7HzOMNsvC
|
|
|
124
124
|
letta_client/runs/usage/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
125
125
|
letta_client/runs/usage/client.py,sha256=ea7e0R-Lv3VtbkJ-JC4RgYSr4TI2OjD31XeNLiDmUUg,4666
|
|
126
126
|
letta_client/sources/__init__.py,sha256=kswgCv4UdkSVk1Y4tsMM1HadOwvhh_Fr96VTSMV4Umc,128
|
|
127
|
-
letta_client/sources/client.py,sha256=
|
|
127
|
+
letta_client/sources/client.py,sha256=WSnXfqj1yymd0cVmpU2znB8o8f_Jxlm8DY85LNsE3NI,38020
|
|
128
128
|
letta_client/sources/files/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
129
129
|
letta_client/sources/files/client.py,sha256=yW3zEZSh94vpH8mfTRnbx5nu0ql0JWtMbXOtbkIPFpw,13699
|
|
130
130
|
letta_client/sources/passages/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
@@ -303,7 +303,7 @@ letta_client/types/message_create.py,sha256=jgtA2pi59E7Pv37oyGO51wjZyRtfxVpgENXa
|
|
|
303
303
|
letta_client/types/message_create_content.py,sha256=KL3XAVKVrdsh4DZwdxKofUyehS-vnOT_VJNVzZDpE20,226
|
|
304
304
|
letta_client/types/message_create_role.py,sha256=PWbew2WtK-36P4d3Nuvq4QNLDAPntsGpasS_WzivyXg,172
|
|
305
305
|
letta_client/types/message_role.py,sha256=HKatrA1jt02oTObExloTY3rW8Urzn37kBTg0Z6MbwkQ,186
|
|
306
|
-
letta_client/types/message_schema.py,sha256=
|
|
306
|
+
letta_client/types/message_schema.py,sha256=NmKkV3auKKQpXGoQkhfSUDAm6WLQ6Q4RGCtFLJqe48g,996
|
|
307
307
|
letta_client/types/message_type.py,sha256=cEx51Mpt5B4g1QI0QzG81IYS-9lHmTTj_HokHOkJU0M,357
|
|
308
308
|
letta_client/types/not_found_error_body.py,sha256=_1esSlUdkBx6CRs6aAIJrxzh3VZKEG0xzeLbxebBuy0,615
|
|
309
309
|
letta_client/types/not_found_error_body_message.py,sha256=Kc9xrVghgDATdPAGpTPnzyKe6ds5q8Vr6zcBU5lLcH4,309
|
|
@@ -405,6 +405,6 @@ letta_client/types/web_search_options_user_location_approximate.py,sha256=Ywk01J
|
|
|
405
405
|
letta_client/version.py,sha256=bttKLbIhO3UonCYQlqs600zzbQgfhCCMjeXR9WRzid4,79
|
|
406
406
|
letta_client/voice/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
407
407
|
letta_client/voice/client.py,sha256=EX79F2D5bieXNP8g1ZPw8xwAzqE1A3hshCHUSlTV1kw,5739
|
|
408
|
-
letta_client-0.1.
|
|
409
|
-
letta_client-0.1.
|
|
410
|
-
letta_client-0.1.
|
|
408
|
+
letta_client-0.1.173.dist-info/METADATA,sha256=9qegC4YkOW6of6GZKVHF-9JbeOgfhhppV6jgDBhpLs8,5093
|
|
409
|
+
letta_client-0.1.173.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
|
410
|
+
letta_client-0.1.173.dist-info/RECORD,,
|
|
File without changes
|