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
letta_client/_version.py
CHANGED
|
@@ -0,0 +1,107 @@
|
|
|
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__ = ["SyncArrayPage", "AsyncArrayPage"]
|
|
13
|
+
|
|
14
|
+
_BaseModelT = TypeVar("_BaseModelT", bound=BaseModel)
|
|
15
|
+
|
|
16
|
+
_T = TypeVar("_T")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@runtime_checkable
|
|
20
|
+
class ArrayPageItem(Protocol):
|
|
21
|
+
id: Optional[str]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class SyncArrayPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
|
|
25
|
+
items: List[_T]
|
|
26
|
+
|
|
27
|
+
@override
|
|
28
|
+
def _get_page_items(self) -> List[_T]:
|
|
29
|
+
items = self.items
|
|
30
|
+
if not items:
|
|
31
|
+
return []
|
|
32
|
+
return items
|
|
33
|
+
|
|
34
|
+
@override
|
|
35
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
|
36
|
+
is_forwards = not self._options.params.get("before", False)
|
|
37
|
+
|
|
38
|
+
items = self.items
|
|
39
|
+
if not items:
|
|
40
|
+
return None
|
|
41
|
+
|
|
42
|
+
if is_forwards:
|
|
43
|
+
item = cast(Any, items[-1])
|
|
44
|
+
if not isinstance(item, ArrayPageItem) or item.id is None:
|
|
45
|
+
# TODO emit warning log
|
|
46
|
+
return None
|
|
47
|
+
|
|
48
|
+
return PageInfo(params={"after": item.id})
|
|
49
|
+
else:
|
|
50
|
+
item = cast(Any, self.items[0])
|
|
51
|
+
if not isinstance(item, ArrayPageItem) or item.id is None:
|
|
52
|
+
# TODO emit warning log
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
return PageInfo(params={"before": item.id})
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003
|
|
59
|
+
return cls.construct(
|
|
60
|
+
None,
|
|
61
|
+
**{
|
|
62
|
+
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
|
|
63
|
+
},
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class AsyncArrayPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
|
|
68
|
+
items: List[_T]
|
|
69
|
+
|
|
70
|
+
@override
|
|
71
|
+
def _get_page_items(self) -> List[_T]:
|
|
72
|
+
items = self.items
|
|
73
|
+
if not items:
|
|
74
|
+
return []
|
|
75
|
+
return items
|
|
76
|
+
|
|
77
|
+
@override
|
|
78
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
|
79
|
+
is_forwards = not self._options.params.get("before", False)
|
|
80
|
+
|
|
81
|
+
items = self.items
|
|
82
|
+
if not items:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
if is_forwards:
|
|
86
|
+
item = cast(Any, items[-1])
|
|
87
|
+
if not isinstance(item, ArrayPageItem) or item.id is None:
|
|
88
|
+
# TODO emit warning log
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
return PageInfo(params={"after": item.id})
|
|
92
|
+
else:
|
|
93
|
+
item = cast(Any, self.items[0])
|
|
94
|
+
if not isinstance(item, ArrayPageItem) or item.id is None:
|
|
95
|
+
# TODO emit warning log
|
|
96
|
+
return None
|
|
97
|
+
|
|
98
|
+
return PageInfo(params={"before": item.id})
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003
|
|
102
|
+
return cls.construct(
|
|
103
|
+
None,
|
|
104
|
+
**{
|
|
105
|
+
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
|
|
106
|
+
},
|
|
107
|
+
)
|
|
@@ -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 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(
|
|
@@ -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(
|
|
@@ -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(
|