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
|
@@ -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 SyncArrayPage, AsyncArrayPage
|
|
21
|
+
from ...types.group import Group
|
|
22
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
21
23
|
from ...types.agents import group_list_params
|
|
22
|
-
from ...types.agents.group_list_response import GroupListResponse
|
|
23
24
|
|
|
24
25
|
__all__ = ["GroupsResource", "AsyncGroupsResource"]
|
|
25
26
|
|
|
@@ -60,7 +61,7 @@ class GroupsResource(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
|
+
) -> SyncArrayPage[Group]:
|
|
64
65
|
"""
|
|
65
66
|
Lists the groups for an agent.
|
|
66
67
|
|
|
@@ -92,8 +93,9 @@ class GroupsResource(SyncAPIResource):
|
|
|
92
93
|
"""
|
|
93
94
|
if not agent_id:
|
|
94
95
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
95
|
-
return self.
|
|
96
|
+
return self._get_api_list(
|
|
96
97
|
f"/v1/agents/{agent_id}/groups",
|
|
98
|
+
page=SyncArrayPage[Group],
|
|
97
99
|
options=make_request_options(
|
|
98
100
|
extra_headers=extra_headers,
|
|
99
101
|
extra_query=extra_query,
|
|
@@ -111,7 +113,7 @@ class GroupsResource(SyncAPIResource):
|
|
|
111
113
|
group_list_params.GroupListParams,
|
|
112
114
|
),
|
|
113
115
|
),
|
|
114
|
-
|
|
116
|
+
model=Group,
|
|
115
117
|
)
|
|
116
118
|
|
|
117
119
|
|
|
@@ -135,7 +137,7 @@ class AsyncGroupsResource(AsyncAPIResource):
|
|
|
135
137
|
"""
|
|
136
138
|
return AsyncGroupsResourceWithStreamingResponse(self)
|
|
137
139
|
|
|
138
|
-
|
|
140
|
+
def list(
|
|
139
141
|
self,
|
|
140
142
|
agent_id: str,
|
|
141
143
|
*,
|
|
@@ -151,7 +153,7 @@ class AsyncGroupsResource(AsyncAPIResource):
|
|
|
151
153
|
extra_query: Query | None = None,
|
|
152
154
|
extra_body: Body | None = None,
|
|
153
155
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
154
|
-
) ->
|
|
156
|
+
) -> AsyncPaginator[Group, AsyncArrayPage[Group]]:
|
|
155
157
|
"""
|
|
156
158
|
Lists the groups for an agent.
|
|
157
159
|
|
|
@@ -183,14 +185,15 @@ class AsyncGroupsResource(AsyncAPIResource):
|
|
|
183
185
|
"""
|
|
184
186
|
if not agent_id:
|
|
185
187
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
186
|
-
return
|
|
188
|
+
return self._get_api_list(
|
|
187
189
|
f"/v1/agents/{agent_id}/groups",
|
|
190
|
+
page=AsyncArrayPage[Group],
|
|
188
191
|
options=make_request_options(
|
|
189
192
|
extra_headers=extra_headers,
|
|
190
193
|
extra_query=extra_query,
|
|
191
194
|
extra_body=extra_body,
|
|
192
195
|
timeout=timeout,
|
|
193
|
-
query=
|
|
196
|
+
query=maybe_transform(
|
|
194
197
|
{
|
|
195
198
|
"after": after,
|
|
196
199
|
"before": before,
|
|
@@ -202,7 +205,7 @@ class AsyncGroupsResource(AsyncAPIResource):
|
|
|
202
205
|
group_list_params.GroupListParams,
|
|
203
206
|
),
|
|
204
207
|
),
|
|
205
|
-
|
|
208
|
+
model=Group,
|
|
206
209
|
)
|
|
207
210
|
|
|
208
211
|
|
|
@@ -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 (
|
|
22
23
|
message_list_params,
|
|
23
24
|
message_send_params,
|
|
@@ -31,7 +32,7 @@ from ...types.agents.run import Run
|
|
|
31
32
|
from ...types.agent_state import AgentState
|
|
32
33
|
from ...types.agents.message_type import MessageType
|
|
33
34
|
from ...types.agents.letta_response import LettaResponse
|
|
34
|
-
from ...types.agents.
|
|
35
|
+
from ...types.agents.letta_message_union import LettaMessageUnion
|
|
35
36
|
from ...types.agents.message_cancel_response import MessageCancelResponse
|
|
36
37
|
from ...types.agents.message_update_response import MessageUpdateResponse
|
|
37
38
|
from ...types.agents.letta_user_message_content_union_param import LettaUserMessageContentUnionParam
|
|
@@ -266,7 +267,7 @@ class MessagesResource(SyncAPIResource):
|
|
|
266
267
|
extra_query: Query | None = None,
|
|
267
268
|
extra_body: Body | None = None,
|
|
268
269
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
269
|
-
) ->
|
|
270
|
+
) -> SyncArrayPage[LettaMessageUnion]:
|
|
270
271
|
"""
|
|
271
272
|
Retrieve message history for an agent.
|
|
272
273
|
|
|
@@ -307,8 +308,9 @@ class MessagesResource(SyncAPIResource):
|
|
|
307
308
|
"""
|
|
308
309
|
if not agent_id:
|
|
309
310
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
310
|
-
return self.
|
|
311
|
+
return self._get_api_list(
|
|
311
312
|
f"/v1/agents/{agent_id}/messages",
|
|
313
|
+
page=SyncArrayPage[LettaMessageUnion],
|
|
312
314
|
options=make_request_options(
|
|
313
315
|
extra_headers=extra_headers,
|
|
314
316
|
extra_query=extra_query,
|
|
@@ -330,7 +332,7 @@ class MessagesResource(SyncAPIResource):
|
|
|
330
332
|
message_list_params.MessageListParams,
|
|
331
333
|
),
|
|
332
334
|
),
|
|
333
|
-
|
|
335
|
+
model=cast(Any, LettaMessageUnion), # Union types cannot be passed in as arguments in the type system
|
|
334
336
|
)
|
|
335
337
|
|
|
336
338
|
def cancel(
|
|
@@ -908,7 +910,7 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
908
910
|
),
|
|
909
911
|
)
|
|
910
912
|
|
|
911
|
-
|
|
913
|
+
def list(
|
|
912
914
|
self,
|
|
913
915
|
agent_id: str,
|
|
914
916
|
*,
|
|
@@ -928,7 +930,7 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
928
930
|
extra_query: Query | None = None,
|
|
929
931
|
extra_body: Body | None = None,
|
|
930
932
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
931
|
-
) ->
|
|
933
|
+
) -> AsyncPaginator[LettaMessageUnion, AsyncArrayPage[LettaMessageUnion]]:
|
|
932
934
|
"""
|
|
933
935
|
Retrieve message history for an agent.
|
|
934
936
|
|
|
@@ -969,14 +971,15 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
969
971
|
"""
|
|
970
972
|
if not agent_id:
|
|
971
973
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
972
|
-
return
|
|
974
|
+
return self._get_api_list(
|
|
973
975
|
f"/v1/agents/{agent_id}/messages",
|
|
976
|
+
page=AsyncArrayPage[LettaMessageUnion],
|
|
974
977
|
options=make_request_options(
|
|
975
978
|
extra_headers=extra_headers,
|
|
976
979
|
extra_query=extra_query,
|
|
977
980
|
extra_body=extra_body,
|
|
978
981
|
timeout=timeout,
|
|
979
|
-
query=
|
|
982
|
+
query=maybe_transform(
|
|
980
983
|
{
|
|
981
984
|
"after": after,
|
|
982
985
|
"assistant_message_tool_kwarg": assistant_message_tool_kwarg,
|
|
@@ -992,7 +995,7 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
992
995
|
message_list_params.MessageListParams,
|
|
993
996
|
),
|
|
994
997
|
),
|
|
995
|
-
|
|
998
|
+
model=cast(Any, LettaMessageUnion), # Union types cannot be passed in as arguments in the type system
|
|
996
999
|
)
|
|
997
1000
|
|
|
998
1001
|
async def cancel(
|
|
@@ -17,10 +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 ...types.tool import Tool
|
|
22
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
21
23
|
from ...types.agents import tool_list_params, tool_update_approval_params
|
|
22
24
|
from ...types.agent_state import AgentState
|
|
23
|
-
from ...types.agents.tool_list_response import ToolListResponse
|
|
24
25
|
|
|
25
26
|
__all__ = ["ToolsResource", "AsyncToolsResource"]
|
|
26
27
|
|
|
@@ -60,7 +61,7 @@ class ToolsResource(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
|
+
) -> SyncArrayPage[Tool]:
|
|
64
65
|
"""
|
|
65
66
|
Get tools from an existing agent.
|
|
66
67
|
|
|
@@ -90,8 +91,9 @@ class ToolsResource(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}/tools",
|
|
96
|
+
page=SyncArrayPage[Tool],
|
|
95
97
|
options=make_request_options(
|
|
96
98
|
extra_headers=extra_headers,
|
|
97
99
|
extra_query=extra_query,
|
|
@@ -108,7 +110,7 @@ class ToolsResource(SyncAPIResource):
|
|
|
108
110
|
tool_list_params.ToolListParams,
|
|
109
111
|
),
|
|
110
112
|
),
|
|
111
|
-
|
|
113
|
+
model=Tool,
|
|
112
114
|
)
|
|
113
115
|
|
|
114
116
|
def attach(
|
|
@@ -122,7 +124,7 @@ class ToolsResource(SyncAPIResource):
|
|
|
122
124
|
extra_query: Query | None = None,
|
|
123
125
|
extra_body: Body | None = None,
|
|
124
126
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
125
|
-
) -> AgentState:
|
|
127
|
+
) -> Optional[AgentState]:
|
|
126
128
|
"""
|
|
127
129
|
Attach a tool to an agent.
|
|
128
130
|
|
|
@@ -162,7 +164,7 @@ class ToolsResource(SyncAPIResource):
|
|
|
162
164
|
extra_query: Query | None = None,
|
|
163
165
|
extra_body: Body | None = None,
|
|
164
166
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
165
|
-
) -> AgentState:
|
|
167
|
+
) -> Optional[AgentState]:
|
|
166
168
|
"""
|
|
167
169
|
Detach a tool from an agent.
|
|
168
170
|
|
|
@@ -204,7 +206,7 @@ class ToolsResource(SyncAPIResource):
|
|
|
204
206
|
extra_query: Query | None = None,
|
|
205
207
|
extra_body: Body | None = None,
|
|
206
208
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
207
|
-
) -> AgentState:
|
|
209
|
+
) -> Optional[AgentState]:
|
|
208
210
|
"""
|
|
209
211
|
Modify the approval requirement for a tool attached to an agent.
|
|
210
212
|
|
|
@@ -269,7 +271,7 @@ class AsyncToolsResource(AsyncAPIResource):
|
|
|
269
271
|
"""
|
|
270
272
|
return AsyncToolsResourceWithStreamingResponse(self)
|
|
271
273
|
|
|
272
|
-
|
|
274
|
+
def list(
|
|
273
275
|
self,
|
|
274
276
|
agent_id: str,
|
|
275
277
|
*,
|
|
@@ -284,7 +286,7 @@ class AsyncToolsResource(AsyncAPIResource):
|
|
|
284
286
|
extra_query: Query | None = None,
|
|
285
287
|
extra_body: Body | None = None,
|
|
286
288
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
287
|
-
) ->
|
|
289
|
+
) -> AsyncPaginator[Tool, AsyncArrayPage[Tool]]:
|
|
288
290
|
"""
|
|
289
291
|
Get tools from an existing agent.
|
|
290
292
|
|
|
@@ -314,14 +316,15 @@ class AsyncToolsResource(AsyncAPIResource):
|
|
|
314
316
|
"""
|
|
315
317
|
if not agent_id:
|
|
316
318
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
317
|
-
return
|
|
319
|
+
return self._get_api_list(
|
|
318
320
|
f"/v1/agents/{agent_id}/tools",
|
|
321
|
+
page=AsyncArrayPage[Tool],
|
|
319
322
|
options=make_request_options(
|
|
320
323
|
extra_headers=extra_headers,
|
|
321
324
|
extra_query=extra_query,
|
|
322
325
|
extra_body=extra_body,
|
|
323
326
|
timeout=timeout,
|
|
324
|
-
query=
|
|
327
|
+
query=maybe_transform(
|
|
325
328
|
{
|
|
326
329
|
"after": after,
|
|
327
330
|
"before": before,
|
|
@@ -332,7 +335,7 @@ class AsyncToolsResource(AsyncAPIResource):
|
|
|
332
335
|
tool_list_params.ToolListParams,
|
|
333
336
|
),
|
|
334
337
|
),
|
|
335
|
-
|
|
338
|
+
model=Tool,
|
|
336
339
|
)
|
|
337
340
|
|
|
338
341
|
async def attach(
|
|
@@ -346,7 +349,7 @@ class AsyncToolsResource(AsyncAPIResource):
|
|
|
346
349
|
extra_query: Query | None = None,
|
|
347
350
|
extra_body: Body | None = None,
|
|
348
351
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
349
|
-
) -> AgentState:
|
|
352
|
+
) -> Optional[AgentState]:
|
|
350
353
|
"""
|
|
351
354
|
Attach a tool to an agent.
|
|
352
355
|
|
|
@@ -386,7 +389,7 @@ class AsyncToolsResource(AsyncAPIResource):
|
|
|
386
389
|
extra_query: Query | None = None,
|
|
387
390
|
extra_body: Body | None = None,
|
|
388
391
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
389
|
-
) -> AgentState:
|
|
392
|
+
) -> Optional[AgentState]:
|
|
390
393
|
"""
|
|
391
394
|
Detach a tool from an agent.
|
|
392
395
|
|
|
@@ -428,7 +431,7 @@ class AsyncToolsResource(AsyncAPIResource):
|
|
|
428
431
|
extra_query: Query | None = None,
|
|
429
432
|
extra_body: Body | None = None,
|
|
430
433
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
431
|
-
) -> AgentState:
|
|
434
|
+
) -> Optional[AgentState]:
|
|
432
435
|
"""
|
|
433
436
|
Modify the approval requirement for a tool attached to an agent.
|
|
434
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(
|
|
@@ -26,9 +26,9 @@ from ..._response import (
|
|
|
26
26
|
async_to_raw_response_wrapper,
|
|
27
27
|
async_to_streamed_response_wrapper,
|
|
28
28
|
)
|
|
29
|
-
from ...
|
|
29
|
+
from ...pagination import SyncArrayPage, AsyncArrayPage
|
|
30
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
30
31
|
from ...types.batch_job import BatchJob
|
|
31
|
-
from ...types.batch_list_response import BatchListResponse
|
|
32
32
|
|
|
33
33
|
__all__ = ["BatchesResource", "AsyncBatchesResource"]
|
|
34
34
|
|
|
@@ -155,7 +155,7 @@ class BatchesResource(SyncAPIResource):
|
|
|
155
155
|
extra_query: Query | None = None,
|
|
156
156
|
extra_body: Body | None = None,
|
|
157
157
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
158
|
-
) ->
|
|
158
|
+
) -> SyncArrayPage[BatchJob]:
|
|
159
159
|
"""List all batch runs.
|
|
160
160
|
|
|
161
161
|
Args:
|
|
@@ -182,8 +182,9 @@ class BatchesResource(SyncAPIResource):
|
|
|
182
182
|
|
|
183
183
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
184
184
|
"""
|
|
185
|
-
return self.
|
|
185
|
+
return self._get_api_list(
|
|
186
186
|
"/v1/messages/batches",
|
|
187
|
+
page=SyncArrayPage[BatchJob],
|
|
187
188
|
options=make_request_options(
|
|
188
189
|
extra_headers=extra_headers,
|
|
189
190
|
extra_query=extra_query,
|
|
@@ -200,7 +201,7 @@ class BatchesResource(SyncAPIResource):
|
|
|
200
201
|
batch_list_params.BatchListParams,
|
|
201
202
|
),
|
|
202
203
|
),
|
|
203
|
-
|
|
204
|
+
model=BatchJob,
|
|
204
205
|
)
|
|
205
206
|
|
|
206
207
|
def cancel(
|
|
@@ -345,7 +346,7 @@ class AsyncBatchesResource(AsyncAPIResource):
|
|
|
345
346
|
cast_to=BatchJob,
|
|
346
347
|
)
|
|
347
348
|
|
|
348
|
-
|
|
349
|
+
def list(
|
|
349
350
|
self,
|
|
350
351
|
*,
|
|
351
352
|
after: Optional[str] | Omit = omit,
|
|
@@ -359,7 +360,7 @@ class AsyncBatchesResource(AsyncAPIResource):
|
|
|
359
360
|
extra_query: Query | None = None,
|
|
360
361
|
extra_body: Body | None = None,
|
|
361
362
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
362
|
-
) ->
|
|
363
|
+
) -> AsyncPaginator[BatchJob, AsyncArrayPage[BatchJob]]:
|
|
363
364
|
"""List all batch runs.
|
|
364
365
|
|
|
365
366
|
Args:
|
|
@@ -386,14 +387,15 @@ class AsyncBatchesResource(AsyncAPIResource):
|
|
|
386
387
|
|
|
387
388
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
388
389
|
"""
|
|
389
|
-
return
|
|
390
|
+
return self._get_api_list(
|
|
390
391
|
"/v1/messages/batches",
|
|
392
|
+
page=AsyncArrayPage[BatchJob],
|
|
391
393
|
options=make_request_options(
|
|
392
394
|
extra_headers=extra_headers,
|
|
393
395
|
extra_query=extra_query,
|
|
394
396
|
extra_body=extra_body,
|
|
395
397
|
timeout=timeout,
|
|
396
|
-
query=
|
|
398
|
+
query=maybe_transform(
|
|
397
399
|
{
|
|
398
400
|
"after": after,
|
|
399
401
|
"before": before,
|
|
@@ -404,7 +406,7 @@ class AsyncBatchesResource(AsyncAPIResource):
|
|
|
404
406
|
batch_list_params.BatchListParams,
|
|
405
407
|
),
|
|
406
408
|
),
|
|
407
|
-
|
|
409
|
+
model=BatchJob,
|
|
408
410
|
)
|
|
409
411
|
|
|
410
412
|
async def cancel(
|
|
@@ -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
|
|