letta-client 1.0.0a7__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 +280 -0
- letta_client/resources/agents/agents.py +12 -10
- letta_client/resources/agents/blocks.py +12 -10
- letta_client/resources/agents/files.py +13 -10
- letta_client/resources/agents/folders.py +13 -10
- letta_client/resources/agents/groups.py +14 -11
- letta_client/resources/agents/messages.py +13 -10
- letta_client/resources/agents/tools.py +19 -16
- letta_client/resources/archives.py +20 -10
- letta_client/resources/batches/batches.py +12 -10
- letta_client/resources/batches/messages.py +14 -11
- letta_client/resources/blocks/agents.py +14 -11
- letta_client/resources/blocks/blocks.py +12 -10
- letta_client/resources/folders/agents.py +13 -10
- letta_client/resources/folders/files.py +12 -9
- letta_client/resources/folders/folders.py +12 -10
- letta_client/resources/groups/groups.py +12 -10
- letta_client/resources/groups/messages.py +13 -10
- letta_client/resources/identities/agents.py +14 -11
- letta_client/resources/identities/blocks.py +14 -11
- letta_client/resources/identities/identities.py +12 -10
- letta_client/resources/runs/messages.py +14 -11
- letta_client/resources/runs/runs.py +13 -11
- letta_client/resources/runs/steps.py +14 -11
- letta_client/resources/steps/messages.py +14 -11
- letta_client/resources/steps/steps.py +13 -11
- letta_client/resources/tags.py +13 -10
- letta_client/resources/tools.py +12 -10
- letta_client/types/__init__.py +0 -10
- letta_client/types/agents/__init__.py +0 -4
- letta_client/types/agents/file_list_response.py +3 -14
- letta_client/types/agents/folder_list_response.py +3 -7
- letta_client/types/archive_list_params.py +3 -0
- letta_client/types/batches/__init__.py +0 -1
- letta_client/types/blocks/__init__.py +0 -1
- letta_client/types/folders/agent_list_response.py +1 -2
- letta_client/types/folders/file_list_response.py +4 -7
- letta_client/types/groups/__init__.py +0 -1
- letta_client/types/identities/__init__.py +0 -2
- letta_client/types/runs/__init__.py +0 -2
- letta_client/types/steps/message_list_response.py +3 -5
- letta_client/types/tag_list_response.py +1 -2
- {letta_client-1.0.0a7.dist-info → letta_client-1.0.0a9.dist-info}/METADATA +1 -1
- {letta_client-1.0.0a7.dist-info → letta_client-1.0.0a9.dist-info}/RECORD +47 -67
- letta_client/types/agent_list_response.py +0 -10
- letta_client/types/agents/block_list_response.py +0 -10
- letta_client/types/agents/group_list_response.py +0 -10
- letta_client/types/agents/message_list_response.py +0 -10
- letta_client/types/agents/tool_list_response.py +0 -10
- letta_client/types/archive_list_response.py +0 -10
- letta_client/types/batch_list_response.py +0 -10
- letta_client/types/batches/message_list_response.py +0 -12
- letta_client/types/block_list_response.py +0 -10
- letta_client/types/blocks/agent_list_response.py +0 -10
- letta_client/types/folder_list_response.py +0 -10
- letta_client/types/group_list_response.py +0 -10
- letta_client/types/groups/message_list_response.py +0 -10
- letta_client/types/identities/agent_list_response.py +0 -10
- letta_client/types/identities/block_list_response.py +0 -10
- letta_client/types/identity_list_response.py +0 -10
- letta_client/types/run_list_response.py +0 -10
- letta_client/types/runs/message_list_response.py +0 -10
- letta_client/types/runs/step_list_response.py +0 -10
- letta_client/types/step_list_response.py +0 -10
- letta_client/types/tool_list_response.py +0 -10
- {letta_client-1.0.0a7.dist-info → letta_client-1.0.0a9.dist-info}/WHEEL +0 -0
- {letta_client-1.0.0a7.dist-info → letta_client-1.0.0a9.dist-info}/licenses/LICENSE +0 -0
letta_client/_version.py
CHANGED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Any, List, Type, Generic, Mapping, TypeVar, Optional, cast
|
|
4
|
+
from typing_extensions import Protocol, override, runtime_checkable
|
|
5
|
+
|
|
6
|
+
from httpx import Response
|
|
7
|
+
|
|
8
|
+
from ._utils import is_mapping
|
|
9
|
+
from ._models import BaseModel
|
|
10
|
+
from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"SyncArrayPage",
|
|
14
|
+
"AsyncArrayPage",
|
|
15
|
+
"SyncObjectPage",
|
|
16
|
+
"AsyncObjectPage",
|
|
17
|
+
"SyncNextFilesPage",
|
|
18
|
+
"AsyncNextFilesPage",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
_BaseModelT = TypeVar("_BaseModelT", bound=BaseModel)
|
|
22
|
+
|
|
23
|
+
_T = TypeVar("_T")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@runtime_checkable
|
|
27
|
+
class ArrayPageItem(Protocol):
|
|
28
|
+
id: Optional[str]
|
|
29
|
+
|
|
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
|
+
|
|
41
|
+
class SyncArrayPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
|
|
42
|
+
items: List[_T]
|
|
43
|
+
|
|
44
|
+
@override
|
|
45
|
+
def _get_page_items(self) -> List[_T]:
|
|
46
|
+
items = self.items
|
|
47
|
+
if not items:
|
|
48
|
+
return []
|
|
49
|
+
return items
|
|
50
|
+
|
|
51
|
+
@override
|
|
52
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
|
53
|
+
is_forwards = not self._options.params.get("before", False)
|
|
54
|
+
|
|
55
|
+
items = self.items
|
|
56
|
+
if not items:
|
|
57
|
+
return None
|
|
58
|
+
|
|
59
|
+
if is_forwards:
|
|
60
|
+
item = cast(Any, items[-1])
|
|
61
|
+
if not isinstance(item, ArrayPageItem) or item.id is None:
|
|
62
|
+
# TODO emit warning log
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
return PageInfo(params={"after": item.id})
|
|
66
|
+
else:
|
|
67
|
+
item = cast(Any, self.items[0])
|
|
68
|
+
if not isinstance(item, ArrayPageItem) or item.id is None:
|
|
69
|
+
# TODO emit warning log
|
|
70
|
+
return None
|
|
71
|
+
|
|
72
|
+
return PageInfo(params={"before": item.id})
|
|
73
|
+
|
|
74
|
+
@classmethod
|
|
75
|
+
def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003
|
|
76
|
+
return cls.construct(
|
|
77
|
+
None,
|
|
78
|
+
**{
|
|
79
|
+
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
|
|
80
|
+
},
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class AsyncArrayPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
|
|
85
|
+
items: List[_T]
|
|
86
|
+
|
|
87
|
+
@override
|
|
88
|
+
def _get_page_items(self) -> List[_T]:
|
|
89
|
+
items = self.items
|
|
90
|
+
if not items:
|
|
91
|
+
return []
|
|
92
|
+
return items
|
|
93
|
+
|
|
94
|
+
@override
|
|
95
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
|
96
|
+
is_forwards = not self._options.params.get("before", False)
|
|
97
|
+
|
|
98
|
+
items = self.items
|
|
99
|
+
if not items:
|
|
100
|
+
return None
|
|
101
|
+
|
|
102
|
+
if is_forwards:
|
|
103
|
+
item = cast(Any, items[-1])
|
|
104
|
+
if not isinstance(item, ArrayPageItem) or item.id is None:
|
|
105
|
+
# TODO emit warning log
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
return PageInfo(params={"after": item.id})
|
|
109
|
+
else:
|
|
110
|
+
item = cast(Any, self.items[0])
|
|
111
|
+
if not isinstance(item, ArrayPageItem) or item.id is None:
|
|
112
|
+
# TODO emit warning log
|
|
113
|
+
return None
|
|
114
|
+
|
|
115
|
+
return PageInfo(params={"before": item.id})
|
|
116
|
+
|
|
117
|
+
@classmethod
|
|
118
|
+
def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003
|
|
119
|
+
return cls.construct(
|
|
120
|
+
None,
|
|
121
|
+
**{
|
|
122
|
+
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
|
|
123
|
+
},
|
|
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})
|
|
@@ -85,12 +85,12 @@ from ..._response import (
|
|
|
85
85
|
async_to_raw_response_wrapper,
|
|
86
86
|
async_to_streamed_response_wrapper,
|
|
87
87
|
)
|
|
88
|
-
from ...
|
|
88
|
+
from ...pagination import SyncArrayPage, AsyncArrayPage
|
|
89
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
89
90
|
from ...types.agent_type import AgentType
|
|
90
91
|
from ...types.agent_state import AgentState
|
|
91
92
|
from ...types.llm_config_param import LlmConfigParam
|
|
92
93
|
from ...types.create_block_param import CreateBlockParam
|
|
93
|
-
from ...types.agent_list_response import AgentListResponse
|
|
94
94
|
from ...types.agent_count_response import AgentCountResponse
|
|
95
95
|
from ...types.message_create_param import MessageCreateParam
|
|
96
96
|
from ...types.embedding_config_param import EmbeddingConfigParam
|
|
@@ -658,7 +658,7 @@ class AgentsResource(SyncAPIResource):
|
|
|
658
658
|
extra_query: Query | None = None,
|
|
659
659
|
extra_body: Body | None = None,
|
|
660
660
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
661
|
-
) ->
|
|
661
|
+
) -> SyncArrayPage[AgentState]:
|
|
662
662
|
"""
|
|
663
663
|
Get a list of all agents.
|
|
664
664
|
|
|
@@ -714,8 +714,9 @@ class AgentsResource(SyncAPIResource):
|
|
|
714
714
|
|
|
715
715
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
716
716
|
"""
|
|
717
|
-
return self.
|
|
717
|
+
return self._get_api_list(
|
|
718
718
|
"/v1/agents/",
|
|
719
|
+
page=SyncArrayPage[AgentState],
|
|
719
720
|
options=make_request_options(
|
|
720
721
|
extra_headers=extra_headers,
|
|
721
722
|
extra_query=extra_query,
|
|
@@ -745,7 +746,7 @@ class AgentsResource(SyncAPIResource):
|
|
|
745
746
|
agent_list_params.AgentListParams,
|
|
746
747
|
),
|
|
747
748
|
),
|
|
748
|
-
|
|
749
|
+
model=AgentState,
|
|
749
750
|
)
|
|
750
751
|
|
|
751
752
|
def delete(
|
|
@@ -1454,7 +1455,7 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1454
1455
|
cast_to=AgentState,
|
|
1455
1456
|
)
|
|
1456
1457
|
|
|
1457
|
-
|
|
1458
|
+
def list(
|
|
1458
1459
|
self,
|
|
1459
1460
|
*,
|
|
1460
1461
|
after: Optional[str] | Omit = omit,
|
|
@@ -1492,7 +1493,7 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1492
1493
|
extra_query: Query | None = None,
|
|
1493
1494
|
extra_body: Body | None = None,
|
|
1494
1495
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1495
|
-
) ->
|
|
1496
|
+
) -> AsyncPaginator[AgentState, AsyncArrayPage[AgentState]]:
|
|
1496
1497
|
"""
|
|
1497
1498
|
Get a list of all agents.
|
|
1498
1499
|
|
|
@@ -1548,14 +1549,15 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1548
1549
|
|
|
1549
1550
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
1550
1551
|
"""
|
|
1551
|
-
return
|
|
1552
|
+
return self._get_api_list(
|
|
1552
1553
|
"/v1/agents/",
|
|
1554
|
+
page=AsyncArrayPage[AgentState],
|
|
1553
1555
|
options=make_request_options(
|
|
1554
1556
|
extra_headers=extra_headers,
|
|
1555
1557
|
extra_query=extra_query,
|
|
1556
1558
|
extra_body=extra_body,
|
|
1557
1559
|
timeout=timeout,
|
|
1558
|
-
query=
|
|
1560
|
+
query=maybe_transform(
|
|
1559
1561
|
{
|
|
1560
1562
|
"after": after,
|
|
1561
1563
|
"ascending": ascending,
|
|
@@ -1579,7 +1581,7 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1579
1581
|
agent_list_params.AgentListParams,
|
|
1580
1582
|
),
|
|
1581
1583
|
),
|
|
1582
|
-
|
|
1584
|
+
model=AgentState,
|
|
1583
1585
|
)
|
|
1584
1586
|
|
|
1585
1587
|
async def delete(
|
|
@@ -17,11 +17,11 @@ 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 SyncArrayPage, AsyncArrayPage
|
|
21
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
21
22
|
from ...types.agents import block_list_params, block_update_params
|
|
22
23
|
from ...types.agent_state import AgentState
|
|
23
24
|
from ...types.agents.block import Block
|
|
24
|
-
from ...types.agents.block_list_response import BlockListResponse
|
|
25
25
|
|
|
26
26
|
__all__ = ["BlocksResource", "AsyncBlocksResource"]
|
|
27
27
|
|
|
@@ -198,7 +198,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
198
198
|
extra_query: Query | None = None,
|
|
199
199
|
extra_body: Body | None = None,
|
|
200
200
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
201
|
-
) ->
|
|
201
|
+
) -> SyncArrayPage[Block]:
|
|
202
202
|
"""
|
|
203
203
|
Retrieve the core memory blocks of a specific agent.
|
|
204
204
|
|
|
@@ -228,8 +228,9 @@ class BlocksResource(SyncAPIResource):
|
|
|
228
228
|
"""
|
|
229
229
|
if not agent_id:
|
|
230
230
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
231
|
-
return self.
|
|
231
|
+
return self._get_api_list(
|
|
232
232
|
f"/v1/agents/{agent_id}/core-memory/blocks",
|
|
233
|
+
page=SyncArrayPage[Block],
|
|
233
234
|
options=make_request_options(
|
|
234
235
|
extra_headers=extra_headers,
|
|
235
236
|
extra_query=extra_query,
|
|
@@ -246,7 +247,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
246
247
|
block_list_params.BlockListParams,
|
|
247
248
|
),
|
|
248
249
|
),
|
|
249
|
-
|
|
250
|
+
model=Block,
|
|
250
251
|
)
|
|
251
252
|
|
|
252
253
|
def attach(
|
|
@@ -487,7 +488,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
487
488
|
cast_to=Block,
|
|
488
489
|
)
|
|
489
490
|
|
|
490
|
-
|
|
491
|
+
def list(
|
|
491
492
|
self,
|
|
492
493
|
agent_id: str,
|
|
493
494
|
*,
|
|
@@ -502,7 +503,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
502
503
|
extra_query: Query | None = None,
|
|
503
504
|
extra_body: Body | None = None,
|
|
504
505
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
505
|
-
) ->
|
|
506
|
+
) -> AsyncPaginator[Block, AsyncArrayPage[Block]]:
|
|
506
507
|
"""
|
|
507
508
|
Retrieve the core memory blocks of a specific agent.
|
|
508
509
|
|
|
@@ -532,14 +533,15 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
532
533
|
"""
|
|
533
534
|
if not agent_id:
|
|
534
535
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
535
|
-
return
|
|
536
|
+
return self._get_api_list(
|
|
536
537
|
f"/v1/agents/{agent_id}/core-memory/blocks",
|
|
538
|
+
page=AsyncArrayPage[Block],
|
|
537
539
|
options=make_request_options(
|
|
538
540
|
extra_headers=extra_headers,
|
|
539
541
|
extra_query=extra_query,
|
|
540
542
|
extra_body=extra_body,
|
|
541
543
|
timeout=timeout,
|
|
542
|
-
query=
|
|
544
|
+
query=maybe_transform(
|
|
543
545
|
{
|
|
544
546
|
"after": after,
|
|
545
547
|
"before": before,
|
|
@@ -550,7 +552,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
550
552
|
block_list_params.BlockListParams,
|
|
551
553
|
),
|
|
552
554
|
),
|
|
553
|
-
|
|
555
|
+
model=Block,
|
|
554
556
|
)
|
|
555
557
|
|
|
556
558
|
async def attach(
|
|
@@ -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(
|
|
@@ -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 SyncArrayPage, AsyncArrayPage
|
|
21
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
21
22
|
from ...types.agents import folder_list_params
|
|
22
23
|
from ...types.agent_state import AgentState
|
|
23
24
|
from ...types.agents.folder_list_response import FolderListResponse
|
|
@@ -60,7 +61,7 @@ class FoldersResource(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
|
-
) -> FolderListResponse:
|
|
64
|
+
) -> SyncArrayPage[FolderListResponse]:
|
|
64
65
|
"""
|
|
65
66
|
Get the folders associated with an agent.
|
|
66
67
|
|
|
@@ -90,8 +91,9 @@ class FoldersResource(SyncAPIResource):
|
|
|
90
91
|
"""
|
|
91
92
|
if not agent_id:
|
|
92
93
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
93
|
-
return self.
|
|
94
|
+
return self._get_api_list(
|
|
94
95
|
f"/v1/agents/{agent_id}/folders",
|
|
96
|
+
page=SyncArrayPage[FolderListResponse],
|
|
95
97
|
options=make_request_options(
|
|
96
98
|
extra_headers=extra_headers,
|
|
97
99
|
extra_query=extra_query,
|
|
@@ -108,7 +110,7 @@ class FoldersResource(SyncAPIResource):
|
|
|
108
110
|
folder_list_params.FolderListParams,
|
|
109
111
|
),
|
|
110
112
|
),
|
|
111
|
-
|
|
113
|
+
model=FolderListResponse,
|
|
112
114
|
)
|
|
113
115
|
|
|
114
116
|
def attach(
|
|
@@ -212,7 +214,7 @@ class AsyncFoldersResource(AsyncAPIResource):
|
|
|
212
214
|
"""
|
|
213
215
|
return AsyncFoldersResourceWithStreamingResponse(self)
|
|
214
216
|
|
|
215
|
-
|
|
217
|
+
def list(
|
|
216
218
|
self,
|
|
217
219
|
agent_id: str,
|
|
218
220
|
*,
|
|
@@ -227,7 +229,7 @@ class AsyncFoldersResource(AsyncAPIResource):
|
|
|
227
229
|
extra_query: Query | None = None,
|
|
228
230
|
extra_body: Body | None = None,
|
|
229
231
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
230
|
-
) -> FolderListResponse:
|
|
232
|
+
) -> AsyncPaginator[FolderListResponse, AsyncArrayPage[FolderListResponse]]:
|
|
231
233
|
"""
|
|
232
234
|
Get the folders associated with an agent.
|
|
233
235
|
|
|
@@ -257,14 +259,15 @@ class AsyncFoldersResource(AsyncAPIResource):
|
|
|
257
259
|
"""
|
|
258
260
|
if not agent_id:
|
|
259
261
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
260
|
-
return
|
|
262
|
+
return self._get_api_list(
|
|
261
263
|
f"/v1/agents/{agent_id}/folders",
|
|
264
|
+
page=AsyncArrayPage[FolderListResponse],
|
|
262
265
|
options=make_request_options(
|
|
263
266
|
extra_headers=extra_headers,
|
|
264
267
|
extra_query=extra_query,
|
|
265
268
|
extra_body=extra_body,
|
|
266
269
|
timeout=timeout,
|
|
267
|
-
query=
|
|
270
|
+
query=maybe_transform(
|
|
268
271
|
{
|
|
269
272
|
"after": after,
|
|
270
273
|
"before": before,
|
|
@@ -275,7 +278,7 @@ class AsyncFoldersResource(AsyncAPIResource):
|
|
|
275
278
|
folder_list_params.FolderListParams,
|
|
276
279
|
),
|
|
277
280
|
),
|
|
278
|
-
|
|
281
|
+
model=FolderListResponse,
|
|
279
282
|
)
|
|
280
283
|
|
|
281
284
|
async def attach(
|