letta-client 1.0.0a7__py3-none-any.whl → 1.0.0a8__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 +107 -0
- letta_client/resources/agents/agents.py +12 -10
- letta_client/resources/agents/blocks.py +12 -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 +13 -10
- letta_client/resources/batches/batches.py +12 -10
- 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 -9
- letta_client/types/agents/__init__.py +0 -4
- letta_client/types/agents/folder_list_response.py +3 -7
- 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.0a8.dist-info}/METADATA +1 -1
- {letta_client-1.0.0a7.dist-info → letta_client-1.0.0a8.dist-info}/RECORD +41 -59
- 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/batch_list_response.py +0 -10
- 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.0a8.dist-info}/WHEEL +0 -0
- {letta_client-1.0.0a7.dist-info → letta_client-1.0.0a8.dist-info}/licenses/LICENSE +0 -0
|
@@ -17,11 +17,12 @@ 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.groups import message_list_params, message_send_params, message_stream_params, message_update_params
|
|
22
23
|
from ...types.agents.message_type import MessageType
|
|
23
24
|
from ...types.agents.letta_response import LettaResponse
|
|
24
|
-
from ...types.
|
|
25
|
+
from ...types.agents.letta_message_union import LettaMessageUnion
|
|
25
26
|
from ...types.groups.message_update_response import MessageUpdateResponse
|
|
26
27
|
from ...types.agents.letta_user_message_content_union_param import LettaUserMessageContentUnionParam
|
|
27
28
|
from ...types.agents.letta_assistant_message_content_union_param import LettaAssistantMessageContentUnionParam
|
|
@@ -253,7 +254,7 @@ class MessagesResource(SyncAPIResource):
|
|
|
253
254
|
extra_query: Query | None = None,
|
|
254
255
|
extra_body: Body | None = None,
|
|
255
256
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
256
|
-
) ->
|
|
257
|
+
) -> SyncArrayPage[LettaMessageUnion]:
|
|
257
258
|
"""
|
|
258
259
|
Retrieve message history for an agent.
|
|
259
260
|
|
|
@@ -289,8 +290,9 @@ class MessagesResource(SyncAPIResource):
|
|
|
289
290
|
"""
|
|
290
291
|
if not group_id:
|
|
291
292
|
raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}")
|
|
292
|
-
return self.
|
|
293
|
+
return self._get_api_list(
|
|
293
294
|
f"/v1/groups/{group_id}/messages",
|
|
295
|
+
page=SyncArrayPage[LettaMessageUnion],
|
|
294
296
|
options=make_request_options(
|
|
295
297
|
extra_headers=extra_headers,
|
|
296
298
|
extra_query=extra_query,
|
|
@@ -310,7 +312,7 @@ class MessagesResource(SyncAPIResource):
|
|
|
310
312
|
message_list_params.MessageListParams,
|
|
311
313
|
),
|
|
312
314
|
),
|
|
313
|
-
|
|
315
|
+
model=cast(Any, LettaMessageUnion), # Union types cannot be passed in as arguments in the type system
|
|
314
316
|
)
|
|
315
317
|
|
|
316
318
|
def reset(
|
|
@@ -722,7 +724,7 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
722
724
|
),
|
|
723
725
|
)
|
|
724
726
|
|
|
725
|
-
|
|
727
|
+
def list(
|
|
726
728
|
self,
|
|
727
729
|
group_id: str,
|
|
728
730
|
*,
|
|
@@ -740,7 +742,7 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
740
742
|
extra_query: Query | None = None,
|
|
741
743
|
extra_body: Body | None = None,
|
|
742
744
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
743
|
-
) ->
|
|
745
|
+
) -> AsyncPaginator[LettaMessageUnion, AsyncArrayPage[LettaMessageUnion]]:
|
|
744
746
|
"""
|
|
745
747
|
Retrieve message history for an agent.
|
|
746
748
|
|
|
@@ -776,14 +778,15 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
776
778
|
"""
|
|
777
779
|
if not group_id:
|
|
778
780
|
raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}")
|
|
779
|
-
return
|
|
781
|
+
return self._get_api_list(
|
|
780
782
|
f"/v1/groups/{group_id}/messages",
|
|
783
|
+
page=AsyncArrayPage[LettaMessageUnion],
|
|
781
784
|
options=make_request_options(
|
|
782
785
|
extra_headers=extra_headers,
|
|
783
786
|
extra_query=extra_query,
|
|
784
787
|
extra_body=extra_body,
|
|
785
788
|
timeout=timeout,
|
|
786
|
-
query=
|
|
789
|
+
query=maybe_transform(
|
|
787
790
|
{
|
|
788
791
|
"after": after,
|
|
789
792
|
"assistant_message_tool_kwarg": assistant_message_tool_kwarg,
|
|
@@ -797,7 +800,7 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
797
800
|
message_list_params.MessageListParams,
|
|
798
801
|
),
|
|
799
802
|
),
|
|
800
|
-
|
|
803
|
+
model=cast(Any, LettaMessageUnion), # Union types cannot be passed in as arguments in the type system
|
|
801
804
|
)
|
|
802
805
|
|
|
803
806
|
async def reset(
|
|
@@ -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 ..._base_client import AsyncPaginator, make_request_options
|
|
21
22
|
from ...types.identities import agent_list_params
|
|
22
|
-
from ...types.
|
|
23
|
+
from ...types.agent_state import AgentState
|
|
23
24
|
|
|
24
25
|
__all__ = ["AgentsResource", "AsyncAgentsResource"]
|
|
25
26
|
|
|
@@ -71,7 +72,7 @@ class AgentsResource(SyncAPIResource):
|
|
|
71
72
|
extra_query: Query | None = None,
|
|
72
73
|
extra_body: Body | None = None,
|
|
73
74
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
74
|
-
) ->
|
|
75
|
+
) -> SyncArrayPage[AgentState]:
|
|
75
76
|
"""
|
|
76
77
|
Get all agents associated with the specified identity.
|
|
77
78
|
|
|
@@ -104,8 +105,9 @@ class AgentsResource(SyncAPIResource):
|
|
|
104
105
|
"""
|
|
105
106
|
if not identity_id:
|
|
106
107
|
raise ValueError(f"Expected a non-empty value for `identity_id` but received {identity_id!r}")
|
|
107
|
-
return self.
|
|
108
|
+
return self._get_api_list(
|
|
108
109
|
f"/v1/identities/{identity_id}/agents",
|
|
110
|
+
page=SyncArrayPage[AgentState],
|
|
109
111
|
options=make_request_options(
|
|
110
112
|
extra_headers=extra_headers,
|
|
111
113
|
extra_query=extra_query,
|
|
@@ -123,7 +125,7 @@ class AgentsResource(SyncAPIResource):
|
|
|
123
125
|
agent_list_params.AgentListParams,
|
|
124
126
|
),
|
|
125
127
|
),
|
|
126
|
-
|
|
128
|
+
model=AgentState,
|
|
127
129
|
)
|
|
128
130
|
|
|
129
131
|
|
|
@@ -147,7 +149,7 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
147
149
|
"""
|
|
148
150
|
return AsyncAgentsResourceWithStreamingResponse(self)
|
|
149
151
|
|
|
150
|
-
|
|
152
|
+
def list(
|
|
151
153
|
self,
|
|
152
154
|
identity_id: str,
|
|
153
155
|
*,
|
|
@@ -174,7 +176,7 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
174
176
|
extra_query: Query | None = None,
|
|
175
177
|
extra_body: Body | None = None,
|
|
176
178
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
177
|
-
) ->
|
|
179
|
+
) -> AsyncPaginator[AgentState, AsyncArrayPage[AgentState]]:
|
|
178
180
|
"""
|
|
179
181
|
Get all agents associated with the specified identity.
|
|
180
182
|
|
|
@@ -207,14 +209,15 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
207
209
|
"""
|
|
208
210
|
if not identity_id:
|
|
209
211
|
raise ValueError(f"Expected a non-empty value for `identity_id` but received {identity_id!r}")
|
|
210
|
-
return
|
|
212
|
+
return self._get_api_list(
|
|
211
213
|
f"/v1/identities/{identity_id}/agents",
|
|
214
|
+
page=AsyncArrayPage[AgentState],
|
|
212
215
|
options=make_request_options(
|
|
213
216
|
extra_headers=extra_headers,
|
|
214
217
|
extra_query=extra_query,
|
|
215
218
|
extra_body=extra_body,
|
|
216
219
|
timeout=timeout,
|
|
217
|
-
query=
|
|
220
|
+
query=maybe_transform(
|
|
218
221
|
{
|
|
219
222
|
"after": after,
|
|
220
223
|
"before": before,
|
|
@@ -226,7 +229,7 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
226
229
|
agent_list_params.AgentListParams,
|
|
227
230
|
),
|
|
228
231
|
),
|
|
229
|
-
|
|
232
|
+
model=AgentState,
|
|
230
233
|
)
|
|
231
234
|
|
|
232
235
|
|
|
@@ -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 ..._base_client import AsyncPaginator, make_request_options
|
|
21
22
|
from ...types.identities import block_list_params
|
|
22
|
-
from ...types.
|
|
23
|
+
from ...types.agents.block import Block
|
|
23
24
|
|
|
24
25
|
__all__ = ["BlocksResource", "AsyncBlocksResource"]
|
|
25
26
|
|
|
@@ -59,7 +60,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
59
60
|
extra_query: Query | None = None,
|
|
60
61
|
extra_body: Body | None = None,
|
|
61
62
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
62
|
-
) ->
|
|
63
|
+
) -> SyncArrayPage[Block]:
|
|
63
64
|
"""
|
|
64
65
|
Get all blocks associated with the specified identity.
|
|
65
66
|
|
|
@@ -89,8 +90,9 @@ class BlocksResource(SyncAPIResource):
|
|
|
89
90
|
"""
|
|
90
91
|
if not identity_id:
|
|
91
92
|
raise ValueError(f"Expected a non-empty value for `identity_id` but received {identity_id!r}")
|
|
92
|
-
return self.
|
|
93
|
+
return self._get_api_list(
|
|
93
94
|
f"/v1/identities/{identity_id}/blocks",
|
|
95
|
+
page=SyncArrayPage[Block],
|
|
94
96
|
options=make_request_options(
|
|
95
97
|
extra_headers=extra_headers,
|
|
96
98
|
extra_query=extra_query,
|
|
@@ -107,7 +109,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
107
109
|
block_list_params.BlockListParams,
|
|
108
110
|
),
|
|
109
111
|
),
|
|
110
|
-
|
|
112
|
+
model=Block,
|
|
111
113
|
)
|
|
112
114
|
|
|
113
115
|
|
|
@@ -131,7 +133,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
131
133
|
"""
|
|
132
134
|
return AsyncBlocksResourceWithStreamingResponse(self)
|
|
133
135
|
|
|
134
|
-
|
|
136
|
+
def list(
|
|
135
137
|
self,
|
|
136
138
|
identity_id: str,
|
|
137
139
|
*,
|
|
@@ -146,7 +148,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
146
148
|
extra_query: Query | None = None,
|
|
147
149
|
extra_body: Body | None = None,
|
|
148
150
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
149
|
-
) ->
|
|
151
|
+
) -> AsyncPaginator[Block, AsyncArrayPage[Block]]:
|
|
150
152
|
"""
|
|
151
153
|
Get all blocks associated with the specified identity.
|
|
152
154
|
|
|
@@ -176,14 +178,15 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
176
178
|
"""
|
|
177
179
|
if not identity_id:
|
|
178
180
|
raise ValueError(f"Expected a non-empty value for `identity_id` but received {identity_id!r}")
|
|
179
|
-
return
|
|
181
|
+
return self._get_api_list(
|
|
180
182
|
f"/v1/identities/{identity_id}/blocks",
|
|
183
|
+
page=AsyncArrayPage[Block],
|
|
181
184
|
options=make_request_options(
|
|
182
185
|
extra_headers=extra_headers,
|
|
183
186
|
extra_query=extra_query,
|
|
184
187
|
extra_body=extra_body,
|
|
185
188
|
timeout=timeout,
|
|
186
|
-
query=
|
|
189
|
+
query=maybe_transform(
|
|
187
190
|
{
|
|
188
191
|
"after": after,
|
|
189
192
|
"before": before,
|
|
@@ -194,7 +197,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
194
197
|
block_list_params.BlockListParams,
|
|
195
198
|
),
|
|
196
199
|
),
|
|
197
|
-
|
|
200
|
+
model=Block,
|
|
198
201
|
)
|
|
199
202
|
|
|
200
203
|
|
|
@@ -48,10 +48,10 @@ from ..._response import (
|
|
|
48
48
|
async_to_raw_response_wrapper,
|
|
49
49
|
async_to_streamed_response_wrapper,
|
|
50
50
|
)
|
|
51
|
-
from ...
|
|
51
|
+
from ...pagination import SyncArrayPage, AsyncArrayPage
|
|
52
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
52
53
|
from ...types.identity import Identity
|
|
53
54
|
from ...types.identity_type import IdentityType
|
|
54
|
-
from ...types.identity_list_response import IdentityListResponse
|
|
55
55
|
from ...types.identity_count_response import IdentityCountResponse
|
|
56
56
|
from ...types.identity_property_param import IdentityPropertyParam
|
|
57
57
|
|
|
@@ -274,7 +274,7 @@ class IdentitiesResource(SyncAPIResource):
|
|
|
274
274
|
extra_query: Query | None = None,
|
|
275
275
|
extra_body: Body | None = None,
|
|
276
276
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
277
|
-
) ->
|
|
277
|
+
) -> SyncArrayPage[Identity]:
|
|
278
278
|
"""
|
|
279
279
|
Get a list of all identities in the database
|
|
280
280
|
|
|
@@ -302,8 +302,9 @@ class IdentitiesResource(SyncAPIResource):
|
|
|
302
302
|
|
|
303
303
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
304
304
|
"""
|
|
305
|
-
return self.
|
|
305
|
+
return self._get_api_list(
|
|
306
306
|
"/v1/identities/",
|
|
307
|
+
page=SyncArrayPage[Identity],
|
|
307
308
|
options=make_request_options(
|
|
308
309
|
extra_headers=extra_headers,
|
|
309
310
|
extra_query=extra_query,
|
|
@@ -324,7 +325,7 @@ class IdentitiesResource(SyncAPIResource):
|
|
|
324
325
|
identity_list_params.IdentityListParams,
|
|
325
326
|
),
|
|
326
327
|
),
|
|
327
|
-
|
|
328
|
+
model=Identity,
|
|
328
329
|
)
|
|
329
330
|
|
|
330
331
|
def delete(
|
|
@@ -647,7 +648,7 @@ class AsyncIdentitiesResource(AsyncAPIResource):
|
|
|
647
648
|
cast_to=Identity,
|
|
648
649
|
)
|
|
649
650
|
|
|
650
|
-
|
|
651
|
+
def list(
|
|
651
652
|
self,
|
|
652
653
|
*,
|
|
653
654
|
after: Optional[str] | Omit = omit,
|
|
@@ -665,7 +666,7 @@ class AsyncIdentitiesResource(AsyncAPIResource):
|
|
|
665
666
|
extra_query: Query | None = None,
|
|
666
667
|
extra_body: Body | None = None,
|
|
667
668
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
668
|
-
) ->
|
|
669
|
+
) -> AsyncPaginator[Identity, AsyncArrayPage[Identity]]:
|
|
669
670
|
"""
|
|
670
671
|
Get a list of all identities in the database
|
|
671
672
|
|
|
@@ -693,14 +694,15 @@ class AsyncIdentitiesResource(AsyncAPIResource):
|
|
|
693
694
|
|
|
694
695
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
695
696
|
"""
|
|
696
|
-
return
|
|
697
|
+
return self._get_api_list(
|
|
697
698
|
"/v1/identities/",
|
|
699
|
+
page=AsyncArrayPage[Identity],
|
|
698
700
|
options=make_request_options(
|
|
699
701
|
extra_headers=extra_headers,
|
|
700
702
|
extra_query=extra_query,
|
|
701
703
|
extra_body=extra_body,
|
|
702
704
|
timeout=timeout,
|
|
703
|
-
query=
|
|
705
|
+
query=maybe_transform(
|
|
704
706
|
{
|
|
705
707
|
"after": after,
|
|
706
708
|
"before": before,
|
|
@@ -715,7 +717,7 @@ class AsyncIdentitiesResource(AsyncAPIResource):
|
|
|
715
717
|
identity_list_params.IdentityListParams,
|
|
716
718
|
),
|
|
717
719
|
),
|
|
718
|
-
|
|
720
|
+
model=Identity,
|
|
719
721
|
)
|
|
720
722
|
|
|
721
723
|
async def delete(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Optional
|
|
5
|
+
from typing import Any, Optional, cast
|
|
6
6
|
from typing_extensions import Literal
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
@@ -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 ...pagination import SyncArrayPage, AsyncArrayPage
|
|
20
21
|
from ...types.runs import message_list_params, message_stream_params
|
|
21
|
-
from ..._base_client import make_request_options
|
|
22
|
-
from ...types.
|
|
22
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
23
|
+
from ...types.agents.letta_message_union import LettaMessageUnion
|
|
23
24
|
|
|
24
25
|
__all__ = ["MessagesResource", "AsyncMessagesResource"]
|
|
25
26
|
|
|
@@ -59,7 +60,7 @@ class MessagesResource(SyncAPIResource):
|
|
|
59
60
|
extra_query: Query | None = None,
|
|
60
61
|
extra_body: Body | None = None,
|
|
61
62
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
62
|
-
) ->
|
|
63
|
+
) -> SyncArrayPage[LettaMessageUnion]:
|
|
63
64
|
"""
|
|
64
65
|
Get response messages associated with a run.
|
|
65
66
|
|
|
@@ -87,8 +88,9 @@ class MessagesResource(SyncAPIResource):
|
|
|
87
88
|
"""
|
|
88
89
|
if not run_id:
|
|
89
90
|
raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}")
|
|
90
|
-
return self.
|
|
91
|
+
return self._get_api_list(
|
|
91
92
|
f"/v1/runs/{run_id}/messages",
|
|
93
|
+
page=SyncArrayPage[LettaMessageUnion],
|
|
92
94
|
options=make_request_options(
|
|
93
95
|
extra_headers=extra_headers,
|
|
94
96
|
extra_query=extra_query,
|
|
@@ -105,7 +107,7 @@ class MessagesResource(SyncAPIResource):
|
|
|
105
107
|
message_list_params.MessageListParams,
|
|
106
108
|
),
|
|
107
109
|
),
|
|
108
|
-
|
|
110
|
+
model=cast(Any, LettaMessageUnion), # Union types cannot be passed in as arguments in the type system
|
|
109
111
|
)
|
|
110
112
|
|
|
111
113
|
def stream(
|
|
@@ -185,7 +187,7 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
185
187
|
"""
|
|
186
188
|
return AsyncMessagesResourceWithStreamingResponse(self)
|
|
187
189
|
|
|
188
|
-
|
|
190
|
+
def list(
|
|
189
191
|
self,
|
|
190
192
|
run_id: str,
|
|
191
193
|
*,
|
|
@@ -200,7 +202,7 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
200
202
|
extra_query: Query | None = None,
|
|
201
203
|
extra_body: Body | None = None,
|
|
202
204
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
203
|
-
) ->
|
|
205
|
+
) -> AsyncPaginator[LettaMessageUnion, AsyncArrayPage[LettaMessageUnion]]:
|
|
204
206
|
"""
|
|
205
207
|
Get response messages associated with a run.
|
|
206
208
|
|
|
@@ -228,14 +230,15 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
228
230
|
"""
|
|
229
231
|
if not run_id:
|
|
230
232
|
raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}")
|
|
231
|
-
return
|
|
233
|
+
return self._get_api_list(
|
|
232
234
|
f"/v1/runs/{run_id}/messages",
|
|
235
|
+
page=AsyncArrayPage[LettaMessageUnion],
|
|
233
236
|
options=make_request_options(
|
|
234
237
|
extra_headers=extra_headers,
|
|
235
238
|
extra_query=extra_query,
|
|
236
239
|
extra_body=extra_body,
|
|
237
240
|
timeout=timeout,
|
|
238
|
-
query=
|
|
241
|
+
query=maybe_transform(
|
|
239
242
|
{
|
|
240
243
|
"after": after,
|
|
241
244
|
"before": before,
|
|
@@ -246,7 +249,7 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
246
249
|
message_list_params.MessageListParams,
|
|
247
250
|
),
|
|
248
251
|
),
|
|
249
|
-
|
|
252
|
+
model=cast(Any, LettaMessageUnion), # Union types cannot be passed in as arguments in the type system
|
|
250
253
|
)
|
|
251
254
|
|
|
252
255
|
async def stream(
|
|
@@ -25,7 +25,7 @@ from .usage import (
|
|
|
25
25
|
)
|
|
26
26
|
from ...types import StopReasonType, run_list_params
|
|
27
27
|
from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
|
|
28
|
-
from ..._utils import maybe_transform
|
|
28
|
+
from ..._utils import maybe_transform
|
|
29
29
|
from .messages import (
|
|
30
30
|
MessagesResource,
|
|
31
31
|
AsyncMessagesResource,
|
|
@@ -42,10 +42,10 @@ from ..._response import (
|
|
|
42
42
|
async_to_raw_response_wrapper,
|
|
43
43
|
async_to_streamed_response_wrapper,
|
|
44
44
|
)
|
|
45
|
-
from ...
|
|
45
|
+
from ...pagination import SyncArrayPage, AsyncArrayPage
|
|
46
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
46
47
|
from ...types.agents.run import Run
|
|
47
48
|
from ...types.stop_reason_type import StopReasonType
|
|
48
|
-
from ...types.run_list_response import RunListResponse
|
|
49
49
|
|
|
50
50
|
__all__ = ["RunsResource", "AsyncRunsResource"]
|
|
51
51
|
|
|
@@ -136,7 +136,7 @@ class RunsResource(SyncAPIResource):
|
|
|
136
136
|
extra_query: Query | None = None,
|
|
137
137
|
extra_body: Body | None = None,
|
|
138
138
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
139
|
-
) ->
|
|
139
|
+
) -> SyncArrayPage[Run]:
|
|
140
140
|
"""
|
|
141
141
|
List all runs.
|
|
142
142
|
|
|
@@ -178,8 +178,9 @@ class RunsResource(SyncAPIResource):
|
|
|
178
178
|
|
|
179
179
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
180
180
|
"""
|
|
181
|
-
return self.
|
|
181
|
+
return self._get_api_list(
|
|
182
182
|
"/v1/runs/",
|
|
183
|
+
page=SyncArrayPage[Run],
|
|
183
184
|
options=make_request_options(
|
|
184
185
|
extra_headers=extra_headers,
|
|
185
186
|
extra_query=extra_query,
|
|
@@ -203,7 +204,7 @@ class RunsResource(SyncAPIResource):
|
|
|
203
204
|
run_list_params.RunListParams,
|
|
204
205
|
),
|
|
205
206
|
),
|
|
206
|
-
|
|
207
|
+
model=Run,
|
|
207
208
|
)
|
|
208
209
|
|
|
209
210
|
|
|
@@ -272,7 +273,7 @@ class AsyncRunsResource(AsyncAPIResource):
|
|
|
272
273
|
cast_to=Run,
|
|
273
274
|
)
|
|
274
275
|
|
|
275
|
-
|
|
276
|
+
def list(
|
|
276
277
|
self,
|
|
277
278
|
*,
|
|
278
279
|
active: bool | Omit = omit,
|
|
@@ -293,7 +294,7 @@ class AsyncRunsResource(AsyncAPIResource):
|
|
|
293
294
|
extra_query: Query | None = None,
|
|
294
295
|
extra_body: Body | None = None,
|
|
295
296
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
296
|
-
) ->
|
|
297
|
+
) -> AsyncPaginator[Run, AsyncArrayPage[Run]]:
|
|
297
298
|
"""
|
|
298
299
|
List all runs.
|
|
299
300
|
|
|
@@ -335,14 +336,15 @@ class AsyncRunsResource(AsyncAPIResource):
|
|
|
335
336
|
|
|
336
337
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
337
338
|
"""
|
|
338
|
-
return
|
|
339
|
+
return self._get_api_list(
|
|
339
340
|
"/v1/runs/",
|
|
341
|
+
page=AsyncArrayPage[Run],
|
|
340
342
|
options=make_request_options(
|
|
341
343
|
extra_headers=extra_headers,
|
|
342
344
|
extra_query=extra_query,
|
|
343
345
|
extra_body=extra_body,
|
|
344
346
|
timeout=timeout,
|
|
345
|
-
query=
|
|
347
|
+
query=maybe_transform(
|
|
346
348
|
{
|
|
347
349
|
"active": active,
|
|
348
350
|
"after": after,
|
|
@@ -360,7 +362,7 @@ class AsyncRunsResource(AsyncAPIResource):
|
|
|
360
362
|
run_list_params.RunListParams,
|
|
361
363
|
),
|
|
362
364
|
),
|
|
363
|
-
|
|
365
|
+
model=Run,
|
|
364
366
|
)
|
|
365
367
|
|
|
366
368
|
|
|
@@ -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 ...pagination import SyncArrayPage, AsyncArrayPage
|
|
20
21
|
from ...types.runs import step_list_params
|
|
21
|
-
from ...
|
|
22
|
-
from ...
|
|
22
|
+
from ...types.step import Step
|
|
23
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
23
24
|
|
|
24
25
|
__all__ = ["StepsResource", "AsyncStepsResource"]
|
|
25
26
|
|
|
@@ -59,7 +60,7 @@ class StepsResource(SyncAPIResource):
|
|
|
59
60
|
extra_query: Query | None = None,
|
|
60
61
|
extra_body: Body | None = None,
|
|
61
62
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
62
|
-
) ->
|
|
63
|
+
) -> SyncArrayPage[Step]:
|
|
63
64
|
"""
|
|
64
65
|
Get steps associated with a run with filtering options.
|
|
65
66
|
|
|
@@ -85,8 +86,9 @@ class StepsResource(SyncAPIResource):
|
|
|
85
86
|
"""
|
|
86
87
|
if not run_id:
|
|
87
88
|
raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}")
|
|
88
|
-
return self.
|
|
89
|
+
return self._get_api_list(
|
|
89
90
|
f"/v1/runs/{run_id}/steps",
|
|
91
|
+
page=SyncArrayPage[Step],
|
|
90
92
|
options=make_request_options(
|
|
91
93
|
extra_headers=extra_headers,
|
|
92
94
|
extra_query=extra_query,
|
|
@@ -103,7 +105,7 @@ class StepsResource(SyncAPIResource):
|
|
|
103
105
|
step_list_params.StepListParams,
|
|
104
106
|
),
|
|
105
107
|
),
|
|
106
|
-
|
|
108
|
+
model=Step,
|
|
107
109
|
)
|
|
108
110
|
|
|
109
111
|
|
|
@@ -127,7 +129,7 @@ class AsyncStepsResource(AsyncAPIResource):
|
|
|
127
129
|
"""
|
|
128
130
|
return AsyncStepsResourceWithStreamingResponse(self)
|
|
129
131
|
|
|
130
|
-
|
|
132
|
+
def list(
|
|
131
133
|
self,
|
|
132
134
|
run_id: str,
|
|
133
135
|
*,
|
|
@@ -142,7 +144,7 @@ class AsyncStepsResource(AsyncAPIResource):
|
|
|
142
144
|
extra_query: Query | None = None,
|
|
143
145
|
extra_body: Body | None = None,
|
|
144
146
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
145
|
-
) ->
|
|
147
|
+
) -> AsyncPaginator[Step, AsyncArrayPage[Step]]:
|
|
146
148
|
"""
|
|
147
149
|
Get steps associated with a run with filtering options.
|
|
148
150
|
|
|
@@ -168,14 +170,15 @@ class AsyncStepsResource(AsyncAPIResource):
|
|
|
168
170
|
"""
|
|
169
171
|
if not run_id:
|
|
170
172
|
raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}")
|
|
171
|
-
return
|
|
173
|
+
return self._get_api_list(
|
|
172
174
|
f"/v1/runs/{run_id}/steps",
|
|
175
|
+
page=AsyncArrayPage[Step],
|
|
173
176
|
options=make_request_options(
|
|
174
177
|
extra_headers=extra_headers,
|
|
175
178
|
extra_query=extra_query,
|
|
176
179
|
extra_body=extra_body,
|
|
177
180
|
timeout=timeout,
|
|
178
|
-
query=
|
|
181
|
+
query=maybe_transform(
|
|
179
182
|
{
|
|
180
183
|
"after": after,
|
|
181
184
|
"before": before,
|
|
@@ -186,7 +189,7 @@ class AsyncStepsResource(AsyncAPIResource):
|
|
|
186
189
|
step_list_params.StepListParams,
|
|
187
190
|
),
|
|
188
191
|
),
|
|
189
|
-
|
|
192
|
+
model=Step,
|
|
190
193
|
)
|
|
191
194
|
|
|
192
195
|
|