letta-client 1.0.0a8__py3-none-any.whl → 1.0.0a9__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/_version.py +1 -1
- letta_client/pagination.py +174 -1
- letta_client/resources/agents/files.py +13 -10
- letta_client/resources/agents/tools.py +6 -6
- letta_client/resources/archives.py +20 -10
- letta_client/resources/batches/messages.py +14 -11
- letta_client/types/__init__.py +0 -1
- letta_client/types/agents/file_list_response.py +3 -14
- letta_client/types/archive_list_params.py +3 -0
- letta_client/types/batches/__init__.py +0 -1
- {letta_client-1.0.0a8.dist-info → letta_client-1.0.0a9.dist-info}/METADATA +1 -1
- {letta_client-1.0.0a8.dist-info → letta_client-1.0.0a9.dist-info}/RECORD +14 -16
- letta_client/types/archive_list_response.py +0 -10
- letta_client/types/batches/message_list_response.py +0 -12
- {letta_client-1.0.0a8.dist-info → letta_client-1.0.0a9.dist-info}/WHEEL +0 -0
- {letta_client-1.0.0a8.dist-info → letta_client-1.0.0a9.dist-info}/licenses/LICENSE +0 -0
letta_client/_version.py
CHANGED
letta_client/pagination.py
CHANGED
|
@@ -9,7 +9,14 @@ from ._utils import is_mapping
|
|
|
9
9
|
from ._models import BaseModel
|
|
10
10
|
from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage
|
|
11
11
|
|
|
12
|
-
__all__ = [
|
|
12
|
+
__all__ = [
|
|
13
|
+
"SyncArrayPage",
|
|
14
|
+
"AsyncArrayPage",
|
|
15
|
+
"SyncObjectPage",
|
|
16
|
+
"AsyncObjectPage",
|
|
17
|
+
"SyncNextFilesPage",
|
|
18
|
+
"AsyncNextFilesPage",
|
|
19
|
+
]
|
|
13
20
|
|
|
14
21
|
_BaseModelT = TypeVar("_BaseModelT", bound=BaseModel)
|
|
15
22
|
|
|
@@ -21,6 +28,16 @@ class ArrayPageItem(Protocol):
|
|
|
21
28
|
id: Optional[str]
|
|
22
29
|
|
|
23
30
|
|
|
31
|
+
@runtime_checkable
|
|
32
|
+
class ObjectPageItem(Protocol):
|
|
33
|
+
id: Optional[str]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@runtime_checkable
|
|
37
|
+
class NextFilesPageItem(Protocol):
|
|
38
|
+
next_cursor: Optional[str]
|
|
39
|
+
|
|
40
|
+
|
|
24
41
|
class SyncArrayPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
|
|
25
42
|
items: List[_T]
|
|
26
43
|
|
|
@@ -105,3 +122,159 @@ class AsyncArrayPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
|
|
|
105
122
|
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
|
|
106
123
|
},
|
|
107
124
|
)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class SyncObjectPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
|
|
128
|
+
messages: List[_T]
|
|
129
|
+
|
|
130
|
+
@override
|
|
131
|
+
def _get_page_items(self) -> List[_T]:
|
|
132
|
+
messages = self.messages
|
|
133
|
+
if not messages:
|
|
134
|
+
return []
|
|
135
|
+
return messages
|
|
136
|
+
|
|
137
|
+
@override
|
|
138
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
|
139
|
+
is_forwards = not self._options.params.get("before", False)
|
|
140
|
+
|
|
141
|
+
messages = self.messages
|
|
142
|
+
if not messages:
|
|
143
|
+
return None
|
|
144
|
+
|
|
145
|
+
if is_forwards:
|
|
146
|
+
item = cast(Any, messages[-1])
|
|
147
|
+
if not isinstance(item, ObjectPageItem) or item.id is None:
|
|
148
|
+
# TODO emit warning log
|
|
149
|
+
return None
|
|
150
|
+
|
|
151
|
+
return PageInfo(params={"after": item.id})
|
|
152
|
+
else:
|
|
153
|
+
item = cast(Any, self.messages[0])
|
|
154
|
+
if not isinstance(item, ObjectPageItem) or item.id is None:
|
|
155
|
+
# TODO emit warning log
|
|
156
|
+
return None
|
|
157
|
+
|
|
158
|
+
return PageInfo(params={"before": item.id})
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class AsyncObjectPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
|
|
162
|
+
messages: List[_T]
|
|
163
|
+
|
|
164
|
+
@override
|
|
165
|
+
def _get_page_items(self) -> List[_T]:
|
|
166
|
+
messages = self.messages
|
|
167
|
+
if not messages:
|
|
168
|
+
return []
|
|
169
|
+
return messages
|
|
170
|
+
|
|
171
|
+
@override
|
|
172
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
|
173
|
+
is_forwards = not self._options.params.get("before", False)
|
|
174
|
+
|
|
175
|
+
messages = self.messages
|
|
176
|
+
if not messages:
|
|
177
|
+
return None
|
|
178
|
+
|
|
179
|
+
if is_forwards:
|
|
180
|
+
item = cast(Any, messages[-1])
|
|
181
|
+
if not isinstance(item, ObjectPageItem) or item.id is None:
|
|
182
|
+
# TODO emit warning log
|
|
183
|
+
return None
|
|
184
|
+
|
|
185
|
+
return PageInfo(params={"after": item.id})
|
|
186
|
+
else:
|
|
187
|
+
item = cast(Any, self.messages[0])
|
|
188
|
+
if not isinstance(item, ObjectPageItem) or item.id is None:
|
|
189
|
+
# TODO emit warning log
|
|
190
|
+
return None
|
|
191
|
+
|
|
192
|
+
return PageInfo(params={"before": item.id})
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
class SyncNextFilesPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
|
|
196
|
+
files: List[_T]
|
|
197
|
+
next_cursor: Optional[str] = None
|
|
198
|
+
has_more: Optional[bool] = None
|
|
199
|
+
|
|
200
|
+
@override
|
|
201
|
+
def _get_page_items(self) -> List[_T]:
|
|
202
|
+
files = self.files
|
|
203
|
+
if not files:
|
|
204
|
+
return []
|
|
205
|
+
return files
|
|
206
|
+
|
|
207
|
+
@override
|
|
208
|
+
def has_next_page(self) -> bool:
|
|
209
|
+
has_more = self.has_more
|
|
210
|
+
if has_more is not None and has_more is False:
|
|
211
|
+
return False
|
|
212
|
+
|
|
213
|
+
return super().has_next_page()
|
|
214
|
+
|
|
215
|
+
@override
|
|
216
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
|
217
|
+
is_forwards = not self._options.params.get("before", False)
|
|
218
|
+
|
|
219
|
+
files = self.files
|
|
220
|
+
if not files:
|
|
221
|
+
return None
|
|
222
|
+
|
|
223
|
+
if is_forwards:
|
|
224
|
+
item = cast(Any, files[-1])
|
|
225
|
+
if not isinstance(item, NextFilesPageItem) or item.next_cursor is None:
|
|
226
|
+
# TODO emit warning log
|
|
227
|
+
return None
|
|
228
|
+
|
|
229
|
+
return PageInfo(params={"after": item.next_cursor})
|
|
230
|
+
else:
|
|
231
|
+
item = cast(Any, self.files[0])
|
|
232
|
+
if not isinstance(item, NextFilesPageItem) or item.next_cursor is None:
|
|
233
|
+
# TODO emit warning log
|
|
234
|
+
return None
|
|
235
|
+
|
|
236
|
+
return PageInfo(params={"before": item.next_cursor})
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
class AsyncNextFilesPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
|
|
240
|
+
files: List[_T]
|
|
241
|
+
next_cursor: Optional[str] = None
|
|
242
|
+
has_more: Optional[bool] = None
|
|
243
|
+
|
|
244
|
+
@override
|
|
245
|
+
def _get_page_items(self) -> List[_T]:
|
|
246
|
+
files = self.files
|
|
247
|
+
if not files:
|
|
248
|
+
return []
|
|
249
|
+
return files
|
|
250
|
+
|
|
251
|
+
@override
|
|
252
|
+
def has_next_page(self) -> bool:
|
|
253
|
+
has_more = self.has_more
|
|
254
|
+
if has_more is not None and has_more is False:
|
|
255
|
+
return False
|
|
256
|
+
|
|
257
|
+
return super().has_next_page()
|
|
258
|
+
|
|
259
|
+
@override
|
|
260
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
|
261
|
+
is_forwards = not self._options.params.get("before", False)
|
|
262
|
+
|
|
263
|
+
files = self.files
|
|
264
|
+
if not files:
|
|
265
|
+
return None
|
|
266
|
+
|
|
267
|
+
if is_forwards:
|
|
268
|
+
item = cast(Any, files[-1])
|
|
269
|
+
if not isinstance(item, NextFilesPageItem) or item.next_cursor is None:
|
|
270
|
+
# TODO emit warning log
|
|
271
|
+
return None
|
|
272
|
+
|
|
273
|
+
return PageInfo(params={"after": item.next_cursor})
|
|
274
|
+
else:
|
|
275
|
+
item = cast(Any, self.files[0])
|
|
276
|
+
if not isinstance(item, NextFilesPageItem) or item.next_cursor is None:
|
|
277
|
+
# TODO emit warning log
|
|
278
|
+
return None
|
|
279
|
+
|
|
280
|
+
return PageInfo(params={"before": item.next_cursor})
|
|
@@ -8,7 +8,7 @@ from typing_extensions import Literal
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
10
|
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
11
|
-
from ..._utils import maybe_transform
|
|
11
|
+
from ..._utils import maybe_transform
|
|
12
12
|
from ..._compat import cached_property
|
|
13
13
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
14
14
|
from ..._response import (
|
|
@@ -17,7 +17,8 @@ from ..._response import (
|
|
|
17
17
|
async_to_raw_response_wrapper,
|
|
18
18
|
async_to_streamed_response_wrapper,
|
|
19
19
|
)
|
|
20
|
-
from ...
|
|
20
|
+
from ...pagination import SyncNextFilesPage, AsyncNextFilesPage
|
|
21
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
21
22
|
from ...types.agents import file_list_params
|
|
22
23
|
from ...types.agents.file_list_response import FileListResponse
|
|
23
24
|
from ...types.agents.file_open_response import FileOpenResponse
|
|
@@ -63,7 +64,7 @@ class FilesResource(SyncAPIResource):
|
|
|
63
64
|
extra_query: Query | None = None,
|
|
64
65
|
extra_body: Body | None = None,
|
|
65
66
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
66
|
-
) -> FileListResponse:
|
|
67
|
+
) -> SyncNextFilesPage[FileListResponse]:
|
|
67
68
|
"""
|
|
68
69
|
Get the files attached to an agent with their open/closed status.
|
|
69
70
|
|
|
@@ -97,8 +98,9 @@ class FilesResource(SyncAPIResource):
|
|
|
97
98
|
"""
|
|
98
99
|
if not agent_id:
|
|
99
100
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
100
|
-
return self.
|
|
101
|
+
return self._get_api_list(
|
|
101
102
|
f"/v1/agents/{agent_id}/files",
|
|
103
|
+
page=SyncNextFilesPage[FileListResponse],
|
|
102
104
|
options=make_request_options(
|
|
103
105
|
extra_headers=extra_headers,
|
|
104
106
|
extra_query=extra_query,
|
|
@@ -117,7 +119,7 @@ class FilesResource(SyncAPIResource):
|
|
|
117
119
|
file_list_params.FileListParams,
|
|
118
120
|
),
|
|
119
121
|
),
|
|
120
|
-
|
|
122
|
+
model=FileListResponse,
|
|
121
123
|
)
|
|
122
124
|
|
|
123
125
|
def close(
|
|
@@ -266,7 +268,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
266
268
|
"""
|
|
267
269
|
return AsyncFilesResourceWithStreamingResponse(self)
|
|
268
270
|
|
|
269
|
-
|
|
271
|
+
def list(
|
|
270
272
|
self,
|
|
271
273
|
agent_id: str,
|
|
272
274
|
*,
|
|
@@ -283,7 +285,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
283
285
|
extra_query: Query | None = None,
|
|
284
286
|
extra_body: Body | None = None,
|
|
285
287
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
286
|
-
) -> FileListResponse:
|
|
288
|
+
) -> AsyncPaginator[FileListResponse, AsyncNextFilesPage[FileListResponse]]:
|
|
287
289
|
"""
|
|
288
290
|
Get the files attached to an agent with their open/closed status.
|
|
289
291
|
|
|
@@ -317,14 +319,15 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
317
319
|
"""
|
|
318
320
|
if not agent_id:
|
|
319
321
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
320
|
-
return
|
|
322
|
+
return self._get_api_list(
|
|
321
323
|
f"/v1/agents/{agent_id}/files",
|
|
324
|
+
page=AsyncNextFilesPage[FileListResponse],
|
|
322
325
|
options=make_request_options(
|
|
323
326
|
extra_headers=extra_headers,
|
|
324
327
|
extra_query=extra_query,
|
|
325
328
|
extra_body=extra_body,
|
|
326
329
|
timeout=timeout,
|
|
327
|
-
query=
|
|
330
|
+
query=maybe_transform(
|
|
328
331
|
{
|
|
329
332
|
"after": after,
|
|
330
333
|
"before": before,
|
|
@@ -337,7 +340,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
337
340
|
file_list_params.FileListParams,
|
|
338
341
|
),
|
|
339
342
|
),
|
|
340
|
-
|
|
343
|
+
model=FileListResponse,
|
|
341
344
|
)
|
|
342
345
|
|
|
343
346
|
async def close(
|
|
@@ -124,7 +124,7 @@ class ToolsResource(SyncAPIResource):
|
|
|
124
124
|
extra_query: Query | None = None,
|
|
125
125
|
extra_body: Body | None = None,
|
|
126
126
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
127
|
-
) -> AgentState:
|
|
127
|
+
) -> Optional[AgentState]:
|
|
128
128
|
"""
|
|
129
129
|
Attach a tool to an agent.
|
|
130
130
|
|
|
@@ -164,7 +164,7 @@ class ToolsResource(SyncAPIResource):
|
|
|
164
164
|
extra_query: Query | None = None,
|
|
165
165
|
extra_body: Body | None = None,
|
|
166
166
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
167
|
-
) -> AgentState:
|
|
167
|
+
) -> Optional[AgentState]:
|
|
168
168
|
"""
|
|
169
169
|
Detach a tool from an agent.
|
|
170
170
|
|
|
@@ -206,7 +206,7 @@ class ToolsResource(SyncAPIResource):
|
|
|
206
206
|
extra_query: Query | None = None,
|
|
207
207
|
extra_body: Body | None = None,
|
|
208
208
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
209
|
-
) -> AgentState:
|
|
209
|
+
) -> Optional[AgentState]:
|
|
210
210
|
"""
|
|
211
211
|
Modify the approval requirement for a tool attached to an agent.
|
|
212
212
|
|
|
@@ -349,7 +349,7 @@ class AsyncToolsResource(AsyncAPIResource):
|
|
|
349
349
|
extra_query: Query | None = None,
|
|
350
350
|
extra_body: Body | None = None,
|
|
351
351
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
352
|
-
) -> AgentState:
|
|
352
|
+
) -> Optional[AgentState]:
|
|
353
353
|
"""
|
|
354
354
|
Attach a tool to an agent.
|
|
355
355
|
|
|
@@ -389,7 +389,7 @@ class AsyncToolsResource(AsyncAPIResource):
|
|
|
389
389
|
extra_query: Query | None = None,
|
|
390
390
|
extra_body: Body | None = None,
|
|
391
391
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
392
|
-
) -> AgentState:
|
|
392
|
+
) -> Optional[AgentState]:
|
|
393
393
|
"""
|
|
394
394
|
Detach a tool from an agent.
|
|
395
395
|
|
|
@@ -431,7 +431,7 @@ class AsyncToolsResource(AsyncAPIResource):
|
|
|
431
431
|
extra_query: Query | None = None,
|
|
432
432
|
extra_body: Body | None = None,
|
|
433
433
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
434
|
-
) -> AgentState:
|
|
434
|
+
) -> Optional[AgentState]:
|
|
435
435
|
"""
|
|
436
436
|
Modify the approval requirement for a tool attached to an agent.
|
|
437
437
|
|
|
@@ -18,9 +18,9 @@ from .._response import (
|
|
|
18
18
|
async_to_raw_response_wrapper,
|
|
19
19
|
async_to_streamed_response_wrapper,
|
|
20
20
|
)
|
|
21
|
-
from ..
|
|
21
|
+
from ..pagination import SyncArrayPage, AsyncArrayPage
|
|
22
|
+
from .._base_client import AsyncPaginator, make_request_options
|
|
22
23
|
from ..types.archive import Archive
|
|
23
|
-
from ..types.archive_list_response import ArchiveListResponse
|
|
24
24
|
from ..types.embedding_config_param import EmbeddingConfigParam
|
|
25
25
|
|
|
26
26
|
__all__ = ["ArchivesResource", "AsyncArchivesResource"]
|
|
@@ -177,13 +177,14 @@ class ArchivesResource(SyncAPIResource):
|
|
|
177
177
|
limit: Optional[int] | Omit = omit,
|
|
178
178
|
name: Optional[str] | Omit = omit,
|
|
179
179
|
order: Literal["asc", "desc"] | Omit = omit,
|
|
180
|
+
order_by: Literal["created_at"] | Omit = omit,
|
|
180
181
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
181
182
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
182
183
|
extra_headers: Headers | None = None,
|
|
183
184
|
extra_query: Query | None = None,
|
|
184
185
|
extra_body: Body | None = None,
|
|
185
186
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
186
|
-
) ->
|
|
187
|
+
) -> SyncArrayPage[Archive]:
|
|
187
188
|
"""
|
|
188
189
|
Get a list of all archives for the current organization with optional filters
|
|
189
190
|
and pagination.
|
|
@@ -204,6 +205,8 @@ class ArchivesResource(SyncAPIResource):
|
|
|
204
205
|
order: Sort order for archives by creation time. 'asc' for oldest first, 'desc' for
|
|
205
206
|
newest first
|
|
206
207
|
|
|
208
|
+
order_by: Field to sort by
|
|
209
|
+
|
|
207
210
|
extra_headers: Send extra headers
|
|
208
211
|
|
|
209
212
|
extra_query: Add additional query parameters to the request
|
|
@@ -212,8 +215,9 @@ class ArchivesResource(SyncAPIResource):
|
|
|
212
215
|
|
|
213
216
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
214
217
|
"""
|
|
215
|
-
return self.
|
|
218
|
+
return self._get_api_list(
|
|
216
219
|
"/v1/archives/",
|
|
220
|
+
page=SyncArrayPage[Archive],
|
|
217
221
|
options=make_request_options(
|
|
218
222
|
extra_headers=extra_headers,
|
|
219
223
|
extra_query=extra_query,
|
|
@@ -227,11 +231,12 @@ class ArchivesResource(SyncAPIResource):
|
|
|
227
231
|
"limit": limit,
|
|
228
232
|
"name": name,
|
|
229
233
|
"order": order,
|
|
234
|
+
"order_by": order_by,
|
|
230
235
|
},
|
|
231
236
|
archive_list_params.ArchiveListParams,
|
|
232
237
|
),
|
|
233
238
|
),
|
|
234
|
-
|
|
239
|
+
model=Archive,
|
|
235
240
|
)
|
|
236
241
|
|
|
237
242
|
def delete(
|
|
@@ -412,7 +417,7 @@ class AsyncArchivesResource(AsyncAPIResource):
|
|
|
412
417
|
cast_to=Archive,
|
|
413
418
|
)
|
|
414
419
|
|
|
415
|
-
|
|
420
|
+
def list(
|
|
416
421
|
self,
|
|
417
422
|
*,
|
|
418
423
|
after: Optional[str] | Omit = omit,
|
|
@@ -421,13 +426,14 @@ class AsyncArchivesResource(AsyncAPIResource):
|
|
|
421
426
|
limit: Optional[int] | Omit = omit,
|
|
422
427
|
name: Optional[str] | Omit = omit,
|
|
423
428
|
order: Literal["asc", "desc"] | Omit = omit,
|
|
429
|
+
order_by: Literal["created_at"] | Omit = omit,
|
|
424
430
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
425
431
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
426
432
|
extra_headers: Headers | None = None,
|
|
427
433
|
extra_query: Query | None = None,
|
|
428
434
|
extra_body: Body | None = None,
|
|
429
435
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
430
|
-
) ->
|
|
436
|
+
) -> AsyncPaginator[Archive, AsyncArrayPage[Archive]]:
|
|
431
437
|
"""
|
|
432
438
|
Get a list of all archives for the current organization with optional filters
|
|
433
439
|
and pagination.
|
|
@@ -448,6 +454,8 @@ class AsyncArchivesResource(AsyncAPIResource):
|
|
|
448
454
|
order: Sort order for archives by creation time. 'asc' for oldest first, 'desc' for
|
|
449
455
|
newest first
|
|
450
456
|
|
|
457
|
+
order_by: Field to sort by
|
|
458
|
+
|
|
451
459
|
extra_headers: Send extra headers
|
|
452
460
|
|
|
453
461
|
extra_query: Add additional query parameters to the request
|
|
@@ -456,14 +464,15 @@ class AsyncArchivesResource(AsyncAPIResource):
|
|
|
456
464
|
|
|
457
465
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
458
466
|
"""
|
|
459
|
-
return
|
|
467
|
+
return self._get_api_list(
|
|
460
468
|
"/v1/archives/",
|
|
469
|
+
page=AsyncArrayPage[Archive],
|
|
461
470
|
options=make_request_options(
|
|
462
471
|
extra_headers=extra_headers,
|
|
463
472
|
extra_query=extra_query,
|
|
464
473
|
extra_body=extra_body,
|
|
465
474
|
timeout=timeout,
|
|
466
|
-
query=
|
|
475
|
+
query=maybe_transform(
|
|
467
476
|
{
|
|
468
477
|
"after": after,
|
|
469
478
|
"agent_id": agent_id,
|
|
@@ -471,11 +480,12 @@ class AsyncArchivesResource(AsyncAPIResource):
|
|
|
471
480
|
"limit": limit,
|
|
472
481
|
"name": name,
|
|
473
482
|
"order": order,
|
|
483
|
+
"order_by": order_by,
|
|
474
484
|
},
|
|
475
485
|
archive_list_params.ArchiveListParams,
|
|
476
486
|
),
|
|
477
487
|
),
|
|
478
|
-
|
|
488
|
+
model=Archive,
|
|
479
489
|
)
|
|
480
490
|
|
|
481
491
|
async def delete(
|
|
@@ -8,7 +8,7 @@ from typing_extensions import Literal
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
10
|
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
11
|
-
from ..._utils import maybe_transform
|
|
11
|
+
from ..._utils import maybe_transform
|
|
12
12
|
from ..._compat import cached_property
|
|
13
13
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
14
14
|
from ..._response import (
|
|
@@ -17,9 +17,10 @@ from ..._response import (
|
|
|
17
17
|
async_to_raw_response_wrapper,
|
|
18
18
|
async_to_streamed_response_wrapper,
|
|
19
19
|
)
|
|
20
|
-
from ...
|
|
20
|
+
from ...pagination import SyncObjectPage, AsyncObjectPage
|
|
21
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
21
22
|
from ...types.batches import message_list_params
|
|
22
|
-
from ...types.
|
|
23
|
+
from ...types.agents.message import Message
|
|
23
24
|
|
|
24
25
|
__all__ = ["MessagesResource", "AsyncMessagesResource"]
|
|
25
26
|
|
|
@@ -60,7 +61,7 @@ class MessagesResource(SyncAPIResource):
|
|
|
60
61
|
extra_query: Query | None = None,
|
|
61
62
|
extra_body: Body | None = None,
|
|
62
63
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
63
|
-
) ->
|
|
64
|
+
) -> SyncObjectPage[Message]:
|
|
64
65
|
"""
|
|
65
66
|
Get response messages for a specific batch job.
|
|
66
67
|
|
|
@@ -90,8 +91,9 @@ class MessagesResource(SyncAPIResource):
|
|
|
90
91
|
"""
|
|
91
92
|
if not batch_id:
|
|
92
93
|
raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}")
|
|
93
|
-
return self.
|
|
94
|
+
return self._get_api_list(
|
|
94
95
|
f"/v1/messages/batches/{batch_id}/messages",
|
|
96
|
+
page=SyncObjectPage[Message],
|
|
95
97
|
options=make_request_options(
|
|
96
98
|
extra_headers=extra_headers,
|
|
97
99
|
extra_query=extra_query,
|
|
@@ -109,7 +111,7 @@ class MessagesResource(SyncAPIResource):
|
|
|
109
111
|
message_list_params.MessageListParams,
|
|
110
112
|
),
|
|
111
113
|
),
|
|
112
|
-
|
|
114
|
+
model=Message,
|
|
113
115
|
)
|
|
114
116
|
|
|
115
117
|
|
|
@@ -133,7 +135,7 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
133
135
|
"""
|
|
134
136
|
return AsyncMessagesResourceWithStreamingResponse(self)
|
|
135
137
|
|
|
136
|
-
|
|
138
|
+
def list(
|
|
137
139
|
self,
|
|
138
140
|
batch_id: str,
|
|
139
141
|
*,
|
|
@@ -149,7 +151,7 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
149
151
|
extra_query: Query | None = None,
|
|
150
152
|
extra_body: Body | None = None,
|
|
151
153
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
152
|
-
) ->
|
|
154
|
+
) -> AsyncPaginator[Message, AsyncObjectPage[Message]]:
|
|
153
155
|
"""
|
|
154
156
|
Get response messages for a specific batch job.
|
|
155
157
|
|
|
@@ -179,14 +181,15 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
179
181
|
"""
|
|
180
182
|
if not batch_id:
|
|
181
183
|
raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}")
|
|
182
|
-
return
|
|
184
|
+
return self._get_api_list(
|
|
183
185
|
f"/v1/messages/batches/{batch_id}/messages",
|
|
186
|
+
page=AsyncObjectPage[Message],
|
|
184
187
|
options=make_request_options(
|
|
185
188
|
extra_headers=extra_headers,
|
|
186
189
|
extra_query=extra_query,
|
|
187
190
|
extra_body=extra_body,
|
|
188
191
|
timeout=timeout,
|
|
189
|
-
query=
|
|
192
|
+
query=maybe_transform(
|
|
190
193
|
{
|
|
191
194
|
"after": after,
|
|
192
195
|
"agent_id": agent_id,
|
|
@@ -198,7 +201,7 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
198
201
|
message_list_params.MessageListParams,
|
|
199
202
|
),
|
|
200
203
|
),
|
|
201
|
-
|
|
204
|
+
model=Message,
|
|
202
205
|
)
|
|
203
206
|
|
|
204
207
|
|
letta_client/types/__init__.py
CHANGED
|
@@ -69,7 +69,6 @@ from .message_create_param import MessageCreateParam as MessageCreateParam
|
|
|
69
69
|
from .text_response_format import TextResponseFormat as TextResponseFormat
|
|
70
70
|
from .agent_retrieve_params import AgentRetrieveParams as AgentRetrieveParams
|
|
71
71
|
from .archive_create_params import ArchiveCreateParams as ArchiveCreateParams
|
|
72
|
-
from .archive_list_response import ArchiveListResponse as ArchiveListResponse
|
|
73
72
|
from .archive_update_params import ArchiveUpdateParams as ArchiveUpdateParams
|
|
74
73
|
from .child_tool_rule_param import ChildToolRuleParam as ChildToolRuleParam
|
|
75
74
|
from .conditional_tool_rule import ConditionalToolRule as ConditionalToolRule
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Optional
|
|
4
4
|
from datetime import datetime
|
|
5
5
|
|
|
6
6
|
from ..._models import BaseModel
|
|
7
7
|
|
|
8
|
-
__all__ = ["FileListResponse"
|
|
8
|
+
__all__ = ["FileListResponse"]
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class
|
|
11
|
+
class FileListResponse(BaseModel):
|
|
12
12
|
id: str
|
|
13
13
|
"""Unique identifier of the file-agent relationship"""
|
|
14
14
|
|
|
@@ -38,14 +38,3 @@ class File(BaseModel):
|
|
|
38
38
|
|
|
39
39
|
visible_content: Optional[str] = None
|
|
40
40
|
"""Portion of the file visible to the agent if open"""
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
class FileListResponse(BaseModel):
|
|
44
|
-
files: List[File]
|
|
45
|
-
"""List of file attachments for the agent"""
|
|
46
|
-
|
|
47
|
-
has_more: bool
|
|
48
|
-
"""Whether more results exist after this page"""
|
|
49
|
-
|
|
50
|
-
next_cursor: Optional[str] = None
|
|
51
|
-
"""Cursor for fetching the next page (file-agent relationship ID)"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: letta-client
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0a9
|
|
4
4
|
Summary: The official Python library for the letta API
|
|
5
5
|
Project-URL: Homepage, https://github.com/letta-ai/letta-python
|
|
6
6
|
Project-URL: Repository, https://github.com/letta-ai/letta-python
|
|
@@ -11,8 +11,8 @@ letta_client/_resource.py,sha256=usdu71d9SVBhsKu3-JpcwE4ZYyIZJTEIFhNNUR2i-qI,109
|
|
|
11
11
|
letta_client/_response.py,sha256=BKfNWi9r9l3FTwBirPt64_mnVss9gK8OYZkHb0MLL1A,28840
|
|
12
12
|
letta_client/_streaming.py,sha256=yvRY-2Co3LGJP-i-BadgepvNxhhfMeIsXX2Rk6tcEg0,10096
|
|
13
13
|
letta_client/_types.py,sha256=dz_siM5FFPTKJs3m9q2ocNjY26xAZ98zPp7sQlsSm0U,7242
|
|
14
|
-
letta_client/_version.py,sha256=
|
|
15
|
-
letta_client/pagination.py,sha256=
|
|
14
|
+
letta_client/_version.py,sha256=w0wgnwXobhLb0WRNKTXedV_TCJoUZ4CdqyExHJH8OfE,172
|
|
15
|
+
letta_client/pagination.py,sha256=lQ8asLHRqlok2V6OLrTR6TVgvvqFxvYm5IFJSNYFXxE,7967
|
|
16
16
|
letta_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
letta_client/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
|
|
18
18
|
letta_client/_utils/_compat.py,sha256=D8gtAvjJQrDWt9upS0XaG9Rr5l1QhiAx_I_1utT_tt0,1195
|
|
@@ -28,20 +28,20 @@ letta_client/_utils/_typing.py,sha256=N_5PPuFNsaygbtA_npZd98SVN1LQQvFTKL6bkWPBZG
|
|
|
28
28
|
letta_client/_utils/_utils.py,sha256=0dDqauUbVZEXV0NVl7Bwu904Wwo5eyFCZpQThhFNhyA,12253
|
|
29
29
|
letta_client/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
30
30
|
letta_client/resources/__init__.py,sha256=t8-E03q5uhhzb8iMeqZrbjSJaMFHz0hw9g-EwLV6AeY,6017
|
|
31
|
-
letta_client/resources/archives.py,sha256=
|
|
31
|
+
letta_client/resources/archives.py,sha256=xTYlARK5w7drhG2Kck5kMRkrOKeioQnjNo6Z2_RIrsY,22574
|
|
32
32
|
letta_client/resources/tags.py,sha256=76SSFdJJBHLGuEL3ejulFwMxLLNTgiD2HuOqaxLx03Y,8635
|
|
33
33
|
letta_client/resources/tools.py,sha256=8ExhSsul9XUkJArL9KS_zjRLFhjz7fC05cHCyAYqJTs,47609
|
|
34
34
|
letta_client/resources/agents/__init__.py,sha256=kMBB1oA9e0oxT91T6Ck4AT-BKIBFQPKTENALxMNHN3g,3265
|
|
35
35
|
letta_client/resources/agents/agents.py,sha256=5tkQqcxeRNeZSbk1cvrdMOk65m2jKFob76ZgbsTHyPQ,82228
|
|
36
36
|
letta_client/resources/agents/blocks.py,sha256=5espAqEEvE9NmBUjw8WLV1EMfAvaWs-DDQutrdbebFc,27420
|
|
37
|
-
letta_client/resources/agents/files.py,sha256=
|
|
37
|
+
letta_client/resources/agents/files.py,sha256=zUFsoI7d0OlFKJ3QhdJ2HwkGUfVnQ8U3DuzNvOgQ2R4,20905
|
|
38
38
|
letta_client/resources/agents/folders.py,sha256=N-2MUJIF0Ybr3tIRpgZVpEYbo5FsafH9T-LxDjAXrSY,15938
|
|
39
39
|
letta_client/resources/agents/groups.py,sha256=Mre1J9LdVE78mW2R-xxtd66FY8_aFK-rRMglE7zP0Hg,8865
|
|
40
40
|
letta_client/resources/agents/messages.py,sha256=pCPaCEn50YeJ0Zd8yeGI8C7I0qnOIWAL786fnUWGlA8,62096
|
|
41
|
-
letta_client/resources/agents/tools.py,sha256=
|
|
41
|
+
letta_client/resources/agents/tools.py,sha256=YLa0R1dAGRTrxMR_Aq3CTmb-28JJ5_JdpyOl1IhwFT0,20899
|
|
42
42
|
letta_client/resources/batches/__init__.py,sha256=zix5YRFFCfQpPx3_vc1R2MbjLKYKJB5Ex-F_mYeVrpc,1041
|
|
43
43
|
letta_client/resources/batches/batches.py,sha256=AnqFT5VGlJ7Bga8kTQUlTwe6gC7kUKf3Q5wqtN1in7A,19959
|
|
44
|
-
letta_client/resources/batches/messages.py,sha256=
|
|
44
|
+
letta_client/resources/batches/messages.py,sha256=3pifEcIFS0VYHvjaMgSJ0k8PWH5ZYD1XNNX13Y4M-D8,8885
|
|
45
45
|
letta_client/resources/blocks/__init__.py,sha256=bdVcjGQZ2G8IPxXUtEIHRfJA0gopCS-rQGrxxjZY8L8,1002
|
|
46
46
|
letta_client/resources/blocks/agents.py,sha256=nbmtwjZafr2ktTjybTUjIVL_BWiJfgBsQ9cwPHNgp1Y,10817
|
|
47
47
|
letta_client/resources/blocks/blocks.py,sha256=hfnfr5eegQ766Ly0IKBbYkZleUAVC77qg3JVYL_Uu0c,37036
|
|
@@ -74,7 +74,7 @@ letta_client/resources/steps/trace.py,sha256=Q11XSAoMKkEnePvm4eIUZ-UZeMu6QxmQedg
|
|
|
74
74
|
letta_client/resources/templates/__init__.py,sha256=4wWq5EBTkiBFzEIzLMP5rkzQ94peMZkl1roLp8iPK_g,1041
|
|
75
75
|
letta_client/resources/templates/agents.py,sha256=vc757D2B5BKTz8DoSTepQx1aChV4GFgXArM2cHfXG7s,9351
|
|
76
76
|
letta_client/resources/templates/templates.py,sha256=ATGrBCFSA06XpjR5rbWtXAT4vq66DwnDia5_XcM8z7Q,3695
|
|
77
|
-
letta_client/types/__init__.py,sha256=
|
|
77
|
+
letta_client/types/__init__.py,sha256=wkPJg-_byCF2KkVuD7RcfNr5S-SvdjdTD7oospPt3qE,7889
|
|
78
78
|
letta_client/types/agent_count_response.py,sha256=SdUd1SYP0pwONLc_7_bESZm1mwsgrNP93JiWq47bKdo,198
|
|
79
79
|
letta_client/types/agent_create_params.py,sha256=lpof9sC0HEX-Rnfw9-WB6Mwg1dpIBlsVMnE51TfCV2U,7343
|
|
80
80
|
letta_client/types/agent_environment_variable.py,sha256=CDCeL5bHPsx9A_3SE3dPB5x8ceT2JB8FlQRwd1lVlbY,1144
|
|
@@ -89,8 +89,7 @@ letta_client/types/agent_type.py,sha256=s3xTJnio45wTIYkWNJotfD2X57Ad-26kQvIEAPtf
|
|
|
89
89
|
letta_client/types/agent_update_params.py,sha256=EkL2lhim0u8CgBHwN8aMLmlHeaEB4g6_EAActFbtEF0,5641
|
|
90
90
|
letta_client/types/archive.py,sha256=KeykpT5HHZ6ofTXHYVSzgYkGgI9SzdkOAm-59pCNLUU,1207
|
|
91
91
|
letta_client/types/archive_create_params.py,sha256=jgfx7deSjphAjcv6RV9uVAdbg7jEQpRP1CS1axP6hBA,507
|
|
92
|
-
letta_client/types/archive_list_params.py,sha256=
|
|
93
|
-
letta_client/types/archive_list_response.py,sha256=xCPMJfPJInYUEHgQ9x7cpkofanDZJs3rdemGWWwgdd0,264
|
|
92
|
+
letta_client/types/archive_list_params.py,sha256=UapyvrrCC6WtuCEgDvWGNzYAlF8a38YD2qYP0ANMeNY,1032
|
|
94
93
|
letta_client/types/archive_update_params.py,sha256=d9TShnWLYQzm-NyhHVgcz2r8uXC4eRJXbfqFzIEwg9M,335
|
|
95
94
|
letta_client/types/batch_create_params.py,sha256=L_eoTMfpaApo7kL85FjFMlRR87TXh29yZIoImfE0Igg,2428
|
|
96
95
|
letta_client/types/batch_job.py,sha256=7WqF20P-PN66xtlPV7KKRk45lPa0qEAiiq3jgBCaPp4,2024
|
|
@@ -192,7 +191,7 @@ letta_client/types/agents/block_list_params.py,sha256=Z8EahHM0Q4qrEjxiLdmwOJT4Zj
|
|
|
192
191
|
letta_client/types/agents/block_update_params.py,sha256=Re774KcydMNgPxBiOj_1Cs8Cw_He8lH25pvO-Mc_EAY,1470
|
|
193
192
|
letta_client/types/agents/file_close_all_response.py,sha256=yq3AN8M749mivM6T7WS6iNKCrBRANafXXHsB3NuQRsc,232
|
|
194
193
|
letta_client/types/agents/file_list_params.py,sha256=ltjR-n7z_ZiOCO_nNPmSyH7DQUxdUB_jEuSXnnLWMmE,1067
|
|
195
|
-
letta_client/types/agents/file_list_response.py,sha256=
|
|
194
|
+
letta_client/types/agents/file_list_response.py,sha256=SILYgNMYWxdWsY6Nn1oxec5b12B2Eu6-yDTVB9RFRN0,1041
|
|
196
195
|
letta_client/types/agents/file_open_response.py,sha256=QnOUmArtPRRFAlSqfCzcQX_Mj9J7_YfSSCdjOdA7dhk,224
|
|
197
196
|
letta_client/types/agents/folder_list_params.py,sha256=ch6sBSUu88lyAm7RWAaHjVKOJ5gmH4sJh_d6q6RZ46E,871
|
|
198
197
|
letta_client/types/agents/folder_list_response.py,sha256=q0MtO1aVgPOuYlE9JIAO73lGLwI97p7hslGM9GCzLtU,1357
|
|
@@ -247,9 +246,8 @@ letta_client/types/agents/update_reasoning_message_param.py,sha256=JQmAXEY3URi4P
|
|
|
247
246
|
letta_client/types/agents/update_system_message_param.py,sha256=Ca_Tk6U3Nr-GAZOnm7LWRsMGfKNL_5LpxW-xolMtGPs,474
|
|
248
247
|
letta_client/types/agents/update_user_message_param.py,sha256=edqu5unlWgmKobbkU4aw_amYDCzOk7fTQuBLcbPGCvw,640
|
|
249
248
|
letta_client/types/agents/user_message.py,sha256=xm9gDlwhHJbgxmYNMrHFCsvRw9puOXCiVEAq5jnW_N0,911
|
|
250
|
-
letta_client/types/batches/__init__.py,sha256=
|
|
249
|
+
letta_client/types/batches/__init__.py,sha256=nmKlohYbZmr7Pzv1qCDMSDbthcH6ySPFIgvXpHZtxK8,195
|
|
251
250
|
letta_client/types/batches/message_list_params.py,sha256=KSeV1xGtZuJs_heEVRI5JdWcXrlPPBlDxieaZUXQdTA,948
|
|
252
|
-
letta_client/types/batches/message_list_response.py,sha256=U-6QL14UaJ2R-sGVhtVNLbYYUmf1aEi6p3gSWF00jsM,285
|
|
253
251
|
letta_client/types/blocks/__init__.py,sha256=hiSa_DsUrxaUdZf6f03IP9pqSbKVcadjiYcctRlUIU0,189
|
|
254
252
|
letta_client/types/blocks/agent_list_params.py,sha256=LEpVKnFur-EAvFYdIiAmv30AxyxFuPzgHiqlPuleCFs,1675
|
|
255
253
|
letta_client/types/folders/__init__.py,sha256=FrCq1pjDJwHup7YQJ5hp3YMff5sCRVP_kpzRo-V32HY,537
|
|
@@ -283,7 +281,7 @@ letta_client/types/steps/message_list_response.py,sha256=KOOB_tmBTiMjXRPtuZocvn_
|
|
|
283
281
|
letta_client/types/steps/metric_retrieve_response.py,sha256=2rqlYkeGpwu4JYBPg9PszUKbT63x4AEDfo8wAJSdoew,1385
|
|
284
282
|
letta_client/types/templates/__init__.py,sha256=eRs8IaeLPk-OtK1SeqFlKxHQ1_thE0sgK2BZ2ioSyUw,195
|
|
285
283
|
letta_client/types/templates/agent_create_params.py,sha256=kvmC7ldFkNdx7kf6r_CK3O88BATWZjKW3kdzc475rFk,1406
|
|
286
|
-
letta_client-1.0.
|
|
287
|
-
letta_client-1.0.
|
|
288
|
-
letta_client-1.0.
|
|
289
|
-
letta_client-1.0.
|
|
284
|
+
letta_client-1.0.0a9.dist-info/METADATA,sha256=zN21t_5I0anYjfz9zL8c319y6nzEZwyUVPUpQNncVwA,15981
|
|
285
|
+
letta_client-1.0.0a9.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
286
|
+
letta_client-1.0.0a9.dist-info/licenses/LICENSE,sha256=BzGFjaxYQ82_SHPlYaZdGvoP71_alR_yRWyWASLnPe0,11335
|
|
287
|
+
letta_client-1.0.0a9.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
from typing import List
|
|
4
|
-
from typing_extensions import TypeAlias
|
|
5
|
-
|
|
6
|
-
from .archive import Archive
|
|
7
|
-
|
|
8
|
-
__all__ = ["ArchiveListResponse"]
|
|
9
|
-
|
|
10
|
-
ArchiveListResponse: TypeAlias = List[Archive]
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
from typing import List
|
|
4
|
-
|
|
5
|
-
from ..._models import BaseModel
|
|
6
|
-
from ..agents.message import Message
|
|
7
|
-
|
|
8
|
-
__all__ = ["MessageListResponse"]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class MessageListResponse(BaseModel):
|
|
12
|
-
messages: List[Message]
|
|
File without changes
|
|
File without changes
|