letta-client 0.1.210__py3-none-any.whl → 0.1.211__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.
- letta_client/agents/client.py +278 -0
- letta_client/core/client_wrapper.py +1 -1
- {letta_client-0.1.210.dist-info → letta_client-0.1.211.dist-info}/METADATA +1 -1
- {letta_client-0.1.210.dist-info → letta_client-0.1.211.dist-info}/RECORD +5 -5
- {letta_client-0.1.210.dist-info → letta_client-0.1.211.dist-info}/WHEEL +0 -0
letta_client/agents/client.py
CHANGED
|
@@ -1081,6 +1081,137 @@ class AgentsClient:
|
|
|
1081
1081
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1082
1082
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1083
1083
|
|
|
1084
|
+
def open_file(
|
|
1085
|
+
self, agent_id: str, file_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1086
|
+
) -> typing.List[str]:
|
|
1087
|
+
"""
|
|
1088
|
+
Opens a specific file for a given agent.
|
|
1089
|
+
|
|
1090
|
+
This endpoint marks a specific file as open in the agent's file state.
|
|
1091
|
+
The file will be included in the agent's working memory view.
|
|
1092
|
+
Returns a list of file names that were closed due to LRU eviction.
|
|
1093
|
+
|
|
1094
|
+
Parameters
|
|
1095
|
+
----------
|
|
1096
|
+
agent_id : str
|
|
1097
|
+
|
|
1098
|
+
file_id : str
|
|
1099
|
+
|
|
1100
|
+
request_options : typing.Optional[RequestOptions]
|
|
1101
|
+
Request-specific configuration.
|
|
1102
|
+
|
|
1103
|
+
Returns
|
|
1104
|
+
-------
|
|
1105
|
+
typing.List[str]
|
|
1106
|
+
Successful Response
|
|
1107
|
+
|
|
1108
|
+
Examples
|
|
1109
|
+
--------
|
|
1110
|
+
from letta_client import Letta
|
|
1111
|
+
|
|
1112
|
+
client = Letta(
|
|
1113
|
+
project="YOUR_PROJECT",
|
|
1114
|
+
token="YOUR_TOKEN",
|
|
1115
|
+
)
|
|
1116
|
+
client.agents.open_file(
|
|
1117
|
+
agent_id="agent_id",
|
|
1118
|
+
file_id="file_id",
|
|
1119
|
+
)
|
|
1120
|
+
"""
|
|
1121
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1122
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/files/{jsonable_encoder(file_id)}/open",
|
|
1123
|
+
method="PATCH",
|
|
1124
|
+
request_options=request_options,
|
|
1125
|
+
)
|
|
1126
|
+
try:
|
|
1127
|
+
if 200 <= _response.status_code < 300:
|
|
1128
|
+
return typing.cast(
|
|
1129
|
+
typing.List[str],
|
|
1130
|
+
construct_type(
|
|
1131
|
+
type_=typing.List[str], # type: ignore
|
|
1132
|
+
object_=_response.json(),
|
|
1133
|
+
),
|
|
1134
|
+
)
|
|
1135
|
+
if _response.status_code == 422:
|
|
1136
|
+
raise UnprocessableEntityError(
|
|
1137
|
+
typing.cast(
|
|
1138
|
+
HttpValidationError,
|
|
1139
|
+
construct_type(
|
|
1140
|
+
type_=HttpValidationError, # type: ignore
|
|
1141
|
+
object_=_response.json(),
|
|
1142
|
+
),
|
|
1143
|
+
)
|
|
1144
|
+
)
|
|
1145
|
+
_response_json = _response.json()
|
|
1146
|
+
except JSONDecodeError:
|
|
1147
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1148
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1149
|
+
|
|
1150
|
+
def close_file(
|
|
1151
|
+
self, agent_id: str, file_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1152
|
+
) -> typing.Optional[typing.Any]:
|
|
1153
|
+
"""
|
|
1154
|
+
Closes a specific file for a given agent.
|
|
1155
|
+
|
|
1156
|
+
This endpoint marks a specific file as closed in the agent's file state.
|
|
1157
|
+
The file will be removed from the agent's working memory view.
|
|
1158
|
+
|
|
1159
|
+
Parameters
|
|
1160
|
+
----------
|
|
1161
|
+
agent_id : str
|
|
1162
|
+
|
|
1163
|
+
file_id : str
|
|
1164
|
+
|
|
1165
|
+
request_options : typing.Optional[RequestOptions]
|
|
1166
|
+
Request-specific configuration.
|
|
1167
|
+
|
|
1168
|
+
Returns
|
|
1169
|
+
-------
|
|
1170
|
+
typing.Optional[typing.Any]
|
|
1171
|
+
Successful Response
|
|
1172
|
+
|
|
1173
|
+
Examples
|
|
1174
|
+
--------
|
|
1175
|
+
from letta_client import Letta
|
|
1176
|
+
|
|
1177
|
+
client = Letta(
|
|
1178
|
+
project="YOUR_PROJECT",
|
|
1179
|
+
token="YOUR_TOKEN",
|
|
1180
|
+
)
|
|
1181
|
+
client.agents.close_file(
|
|
1182
|
+
agent_id="agent_id",
|
|
1183
|
+
file_id="file_id",
|
|
1184
|
+
)
|
|
1185
|
+
"""
|
|
1186
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1187
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/files/{jsonable_encoder(file_id)}/close",
|
|
1188
|
+
method="PATCH",
|
|
1189
|
+
request_options=request_options,
|
|
1190
|
+
)
|
|
1191
|
+
try:
|
|
1192
|
+
if 200 <= _response.status_code < 300:
|
|
1193
|
+
return typing.cast(
|
|
1194
|
+
typing.Optional[typing.Any],
|
|
1195
|
+
construct_type(
|
|
1196
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1197
|
+
object_=_response.json(),
|
|
1198
|
+
),
|
|
1199
|
+
)
|
|
1200
|
+
if _response.status_code == 422:
|
|
1201
|
+
raise UnprocessableEntityError(
|
|
1202
|
+
typing.cast(
|
|
1203
|
+
HttpValidationError,
|
|
1204
|
+
construct_type(
|
|
1205
|
+
type_=HttpValidationError, # type: ignore
|
|
1206
|
+
object_=_response.json(),
|
|
1207
|
+
),
|
|
1208
|
+
)
|
|
1209
|
+
)
|
|
1210
|
+
_response_json = _response.json()
|
|
1211
|
+
except JSONDecodeError:
|
|
1212
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1213
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1214
|
+
|
|
1084
1215
|
def summarize_agent_conversation(
|
|
1085
1216
|
self, agent_id: str, *, max_message_length: int, request_options: typing.Optional[RequestOptions] = None
|
|
1086
1217
|
) -> AgentState:
|
|
@@ -2338,6 +2469,153 @@ class AsyncAgentsClient:
|
|
|
2338
2469
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2339
2470
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2340
2471
|
|
|
2472
|
+
async def open_file(
|
|
2473
|
+
self, agent_id: str, file_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2474
|
+
) -> typing.List[str]:
|
|
2475
|
+
"""
|
|
2476
|
+
Opens a specific file for a given agent.
|
|
2477
|
+
|
|
2478
|
+
This endpoint marks a specific file as open in the agent's file state.
|
|
2479
|
+
The file will be included in the agent's working memory view.
|
|
2480
|
+
Returns a list of file names that were closed due to LRU eviction.
|
|
2481
|
+
|
|
2482
|
+
Parameters
|
|
2483
|
+
----------
|
|
2484
|
+
agent_id : str
|
|
2485
|
+
|
|
2486
|
+
file_id : str
|
|
2487
|
+
|
|
2488
|
+
request_options : typing.Optional[RequestOptions]
|
|
2489
|
+
Request-specific configuration.
|
|
2490
|
+
|
|
2491
|
+
Returns
|
|
2492
|
+
-------
|
|
2493
|
+
typing.List[str]
|
|
2494
|
+
Successful Response
|
|
2495
|
+
|
|
2496
|
+
Examples
|
|
2497
|
+
--------
|
|
2498
|
+
import asyncio
|
|
2499
|
+
|
|
2500
|
+
from letta_client import AsyncLetta
|
|
2501
|
+
|
|
2502
|
+
client = AsyncLetta(
|
|
2503
|
+
project="YOUR_PROJECT",
|
|
2504
|
+
token="YOUR_TOKEN",
|
|
2505
|
+
)
|
|
2506
|
+
|
|
2507
|
+
|
|
2508
|
+
async def main() -> None:
|
|
2509
|
+
await client.agents.open_file(
|
|
2510
|
+
agent_id="agent_id",
|
|
2511
|
+
file_id="file_id",
|
|
2512
|
+
)
|
|
2513
|
+
|
|
2514
|
+
|
|
2515
|
+
asyncio.run(main())
|
|
2516
|
+
"""
|
|
2517
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2518
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/files/{jsonable_encoder(file_id)}/open",
|
|
2519
|
+
method="PATCH",
|
|
2520
|
+
request_options=request_options,
|
|
2521
|
+
)
|
|
2522
|
+
try:
|
|
2523
|
+
if 200 <= _response.status_code < 300:
|
|
2524
|
+
return typing.cast(
|
|
2525
|
+
typing.List[str],
|
|
2526
|
+
construct_type(
|
|
2527
|
+
type_=typing.List[str], # type: ignore
|
|
2528
|
+
object_=_response.json(),
|
|
2529
|
+
),
|
|
2530
|
+
)
|
|
2531
|
+
if _response.status_code == 422:
|
|
2532
|
+
raise UnprocessableEntityError(
|
|
2533
|
+
typing.cast(
|
|
2534
|
+
HttpValidationError,
|
|
2535
|
+
construct_type(
|
|
2536
|
+
type_=HttpValidationError, # type: ignore
|
|
2537
|
+
object_=_response.json(),
|
|
2538
|
+
),
|
|
2539
|
+
)
|
|
2540
|
+
)
|
|
2541
|
+
_response_json = _response.json()
|
|
2542
|
+
except JSONDecodeError:
|
|
2543
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2544
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2545
|
+
|
|
2546
|
+
async def close_file(
|
|
2547
|
+
self, agent_id: str, file_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2548
|
+
) -> typing.Optional[typing.Any]:
|
|
2549
|
+
"""
|
|
2550
|
+
Closes a specific file for a given agent.
|
|
2551
|
+
|
|
2552
|
+
This endpoint marks a specific file as closed in the agent's file state.
|
|
2553
|
+
The file will be removed from the agent's working memory view.
|
|
2554
|
+
|
|
2555
|
+
Parameters
|
|
2556
|
+
----------
|
|
2557
|
+
agent_id : str
|
|
2558
|
+
|
|
2559
|
+
file_id : str
|
|
2560
|
+
|
|
2561
|
+
request_options : typing.Optional[RequestOptions]
|
|
2562
|
+
Request-specific configuration.
|
|
2563
|
+
|
|
2564
|
+
Returns
|
|
2565
|
+
-------
|
|
2566
|
+
typing.Optional[typing.Any]
|
|
2567
|
+
Successful Response
|
|
2568
|
+
|
|
2569
|
+
Examples
|
|
2570
|
+
--------
|
|
2571
|
+
import asyncio
|
|
2572
|
+
|
|
2573
|
+
from letta_client import AsyncLetta
|
|
2574
|
+
|
|
2575
|
+
client = AsyncLetta(
|
|
2576
|
+
project="YOUR_PROJECT",
|
|
2577
|
+
token="YOUR_TOKEN",
|
|
2578
|
+
)
|
|
2579
|
+
|
|
2580
|
+
|
|
2581
|
+
async def main() -> None:
|
|
2582
|
+
await client.agents.close_file(
|
|
2583
|
+
agent_id="agent_id",
|
|
2584
|
+
file_id="file_id",
|
|
2585
|
+
)
|
|
2586
|
+
|
|
2587
|
+
|
|
2588
|
+
asyncio.run(main())
|
|
2589
|
+
"""
|
|
2590
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2591
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/files/{jsonable_encoder(file_id)}/close",
|
|
2592
|
+
method="PATCH",
|
|
2593
|
+
request_options=request_options,
|
|
2594
|
+
)
|
|
2595
|
+
try:
|
|
2596
|
+
if 200 <= _response.status_code < 300:
|
|
2597
|
+
return typing.cast(
|
|
2598
|
+
typing.Optional[typing.Any],
|
|
2599
|
+
construct_type(
|
|
2600
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2601
|
+
object_=_response.json(),
|
|
2602
|
+
),
|
|
2603
|
+
)
|
|
2604
|
+
if _response.status_code == 422:
|
|
2605
|
+
raise UnprocessableEntityError(
|
|
2606
|
+
typing.cast(
|
|
2607
|
+
HttpValidationError,
|
|
2608
|
+
construct_type(
|
|
2609
|
+
type_=HttpValidationError, # type: ignore
|
|
2610
|
+
object_=_response.json(),
|
|
2611
|
+
),
|
|
2612
|
+
)
|
|
2613
|
+
)
|
|
2614
|
+
_response_json = _response.json()
|
|
2615
|
+
except JSONDecodeError:
|
|
2616
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2617
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2618
|
+
|
|
2341
2619
|
async def summarize_agent_conversation(
|
|
2342
2620
|
self, agent_id: str, *, max_message_length: int, request_options: typing.Optional[RequestOptions] = None
|
|
2343
2621
|
) -> AgentState:
|
|
@@ -24,7 +24,7 @@ class BaseClientWrapper:
|
|
|
24
24
|
headers: typing.Dict[str, str] = {
|
|
25
25
|
"X-Fern-Language": "Python",
|
|
26
26
|
"X-Fern-SDK-Name": "letta-client",
|
|
27
|
-
"X-Fern-SDK-Version": "0.1.
|
|
27
|
+
"X-Fern-SDK-Version": "0.1.211",
|
|
28
28
|
}
|
|
29
29
|
if self._project is not None:
|
|
30
30
|
headers["X-Project"] = self._project
|
|
@@ -2,7 +2,7 @@ letta_client/__init__.py,sha256=DpCoPhi5qy7K-MmczqULa30OTff96XkneWc4tYISq_8,1916
|
|
|
2
2
|
letta_client/agents/__init__.py,sha256=i9PmBueIWESDLqmpzWt1oZVgZNr1rNkO6j0pl5sgvGo,2049
|
|
3
3
|
letta_client/agents/blocks/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
4
4
|
letta_client/agents/blocks/client.py,sha256=4UGPYxfGwNN3ZW-SkIdfVZK6cvCcumVAw0_AM8OmoBY,25046
|
|
5
|
-
letta_client/agents/client.py,sha256=
|
|
5
|
+
letta_client/agents/client.py,sha256=kldj19HcO2hBnK63JAjjOgvXiFtLPqDJHtLiGH2Jez8,105561
|
|
6
6
|
letta_client/agents/context/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
7
7
|
letta_client/agents/context/client.py,sha256=O1gxStQyfzXi4MblatWalLTWM425gS_fndW3W_es08U,4887
|
|
8
8
|
letta_client/agents/core_memory/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
@@ -71,7 +71,7 @@ letta_client/client_side_access_tokens/types/client_side_access_tokens_list_clie
|
|
|
71
71
|
letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response_tokens_item_policy_data_item_access_item.py,sha256=kNHfEWFl7u71Pu8NPqutod0a2NXfvq8il05Hqm0iBB4,284
|
|
72
72
|
letta_client/core/__init__.py,sha256=OKbX2aCZXgHCDUsCouqv-OiX32xA6eFFCKIUH9M5Vzk,1591
|
|
73
73
|
letta_client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
|
74
|
-
letta_client/core/client_wrapper.py,sha256=
|
|
74
|
+
letta_client/core/client_wrapper.py,sha256=SIn7ocTMfx1OCdi4IwH89ObYyjgnLVblqu4aN2WVYIU,2336
|
|
75
75
|
letta_client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
|
76
76
|
letta_client/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
|
|
77
77
|
letta_client/core/http_client.py,sha256=Z77OIxIbL4OAB2IDqjRq_sYa5yNYAWfmdhdCSSvh6Y4,19552
|
|
@@ -428,6 +428,6 @@ letta_client/types/web_search_options_user_location_approximate.py,sha256=Ywk01J
|
|
|
428
428
|
letta_client/version.py,sha256=bttKLbIhO3UonCYQlqs600zzbQgfhCCMjeXR9WRzid4,79
|
|
429
429
|
letta_client/voice/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
430
430
|
letta_client/voice/client.py,sha256=47iQYCuW_qpKI4hM3pYVxn3hw7kgQj3emU1_oRpkRMA,5811
|
|
431
|
-
letta_client-0.1.
|
|
432
|
-
letta_client-0.1.
|
|
433
|
-
letta_client-0.1.
|
|
431
|
+
letta_client-0.1.211.dist-info/METADATA,sha256=Z3nu0XWyw56Jbt9gxpL73nTA_lJkv_40QP9FhFuqzWE,5177
|
|
432
|
+
letta_client-0.1.211.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
|
433
|
+
letta_client-0.1.211.dist-info/RECORD,,
|
|
File without changes
|