letta-client 0.1.172__py3-none-any.whl → 0.1.174__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.

@@ -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.172",
19
+ "X-Fern-SDK-Version": "0.1.174",
20
20
  }
21
21
  if self.token is not None:
22
22
  headers["Authorization"] = f"Bearer {self.token}"
@@ -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)
@@ -4,14 +4,13 @@ import typing
4
4
  from ...core.client_wrapper import SyncClientWrapper
5
5
  from ... import core
6
6
  from ...core.request_options import RequestOptions
7
- from ...types.job import Job
7
+ from ...types.file_metadata import FileMetadata
8
8
  from ...core.jsonable_encoder import jsonable_encoder
9
9
  from ...core.unchecked_base_model import construct_type
10
10
  from ...errors.unprocessable_entity_error import UnprocessableEntityError
11
11
  from ...types.http_validation_error import HttpValidationError
12
12
  from json.decoder import JSONDecodeError
13
13
  from ...core.api_error import ApiError
14
- from ...types.file_metadata import FileMetadata
15
14
  from ...core.client_wrapper import AsyncClientWrapper
16
15
 
17
16
  # this is used as the default value for optional parameters
@@ -24,7 +23,7 @@ class FilesClient:
24
23
 
25
24
  def upload(
26
25
  self, source_id: str, *, file: core.File, request_options: typing.Optional[RequestOptions] = None
27
- ) -> Job:
26
+ ) -> FileMetadata:
28
27
  """
29
28
  Upload a file to a data source.
30
29
 
@@ -40,7 +39,7 @@ class FilesClient:
40
39
 
41
40
  Returns
42
41
  -------
43
- Job
42
+ FileMetadata
44
43
  Successful Response
45
44
 
46
45
  Examples
@@ -67,9 +66,9 @@ class FilesClient:
67
66
  try:
68
67
  if 200 <= _response.status_code < 300:
69
68
  return typing.cast(
70
- Job,
69
+ FileMetadata,
71
70
  construct_type(
72
- type_=Job, # type: ignore
71
+ type_=FileMetadata, # type: ignore
73
72
  object_=_response.json(),
74
73
  ),
75
74
  )
@@ -225,7 +224,7 @@ class AsyncFilesClient:
225
224
 
226
225
  async def upload(
227
226
  self, source_id: str, *, file: core.File, request_options: typing.Optional[RequestOptions] = None
228
- ) -> Job:
227
+ ) -> FileMetadata:
229
228
  """
230
229
  Upload a file to a data source.
231
230
 
@@ -241,7 +240,7 @@ class AsyncFilesClient:
241
240
 
242
241
  Returns
243
242
  -------
244
- Job
243
+ FileMetadata
245
244
  Successful Response
246
245
 
247
246
  Examples
@@ -276,9 +275,9 @@ class AsyncFilesClient:
276
275
  try:
277
276
  if 200 <= _response.status_code < 300:
278
277
  return typing.cast(
279
- Job,
278
+ FileMetadata,
280
279
  construct_type(
281
- type_=Job, # type: ignore
280
+ type_=FileMetadata, # type: ignore
282
281
  object_=_response.json(),
283
282
  ),
284
283
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-client
3
- Version: 0.1.172
3
+ Version: 0.1.174
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Intended Audience :: Developers
@@ -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=QCotwnQoej9UBVKU-9phSsoRmaf31koLS6GaS7T6SW0,1998
66
+ letta_client/core/client_wrapper.py,sha256=a_C-q6XTZ0ZUUAr03ZwIO9KWRxpSe4RmrPuDKZjLylY,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,9 +124,9 @@ 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=SRxv2SLREAW2eV_vjEYiMKEM5ViSVk_9dEIz75kOElA,33355
127
+ letta_client/sources/client.py,sha256=WSnXfqj1yymd0cVmpU2znB8o8f_Jxlm8DY85LNsE3NI,38020
128
128
  letta_client/sources/files/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
129
- letta_client/sources/files/client.py,sha256=yW3zEZSh94vpH8mfTRnbx5nu0ql0JWtMbXOtbkIPFpw,13699
129
+ letta_client/sources/files/client.py,sha256=VwOnQEZpY0j2LqRAPO1EbtfykAYbBwPHcI7DC19L91w,13742
130
130
  letta_client/sources/passages/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
131
131
  letta_client/sources/passages/client.py,sha256=XxpITU_fq9MKiSd8Qu720Dprnxp5wlDEf6yjXaEfwSQ,5969
132
132
  letta_client/steps/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
@@ -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.172.dist-info/METADATA,sha256=ZilvTr0DjuRT7kKXgk8icowU4po-524TSzUkWbxX0ds,5093
409
- letta_client-0.1.172.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
410
- letta_client-0.1.172.dist-info/RECORD,,
408
+ letta_client-0.1.174.dist-info/METADATA,sha256=mklVjfyyI2Fl6cPcKGL560igIKEYC0B_bQhod5LHRX8,5093
409
+ letta_client-0.1.174.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
410
+ letta_client-0.1.174.dist-info/RECORD,,