letta-client 1.0.0a8__py3-none-any.whl → 1.0.0a10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of letta-client might be problematic. Click here for more details.
- letta_client/_version.py +1 -1
- letta_client/pagination.py +174 -1
- letta_client/resources/agents/agents.py +396 -396
- letta_client/resources/agents/blocks.py +200 -190
- letta_client/resources/agents/files.py +13 -10
- letta_client/resources/agents/messages.py +367 -367
- letta_client/resources/agents/tools.py +6 -6
- letta_client/resources/archives.py +121 -111
- letta_client/resources/batches/messages.py +14 -11
- letta_client/resources/blocks/blocks.py +241 -222
- letta_client/resources/folders/folders.py +133 -133
- letta_client/resources/groups/groups.py +141 -141
- letta_client/resources/groups/messages.py +198 -198
- letta_client/resources/identities/blocks.py +7 -7
- letta_client/resources/identities/identities.py +141 -141
- letta_client/resources/tools.py +794 -194
- letta_client/types/__init__.py +11 -8
- letta_client/types/{agent_update_params.py → agent_modify_params.py} +2 -2
- letta_client/types/agent_state.py +6 -3
- letta_client/types/agents/__init__.py +6 -3
- letta_client/types/agents/block.py +6 -3
- letta_client/types/agents/block_list_response.py +63 -0
- letta_client/types/agents/{block_update_params.py → block_modify_params.py} +8 -5
- letta_client/types/agents/block_modify_response.py +63 -0
- letta_client/types/agents/block_retrieve_response.py +63 -0
- letta_client/types/agents/file_list_response.py +3 -14
- letta_client/types/agents/{message_update_params.py → message_modify_params.py} +2 -2
- letta_client/types/agents/{message_update_response.py → message_modify_response.py} +2 -2
- letta_client/types/archive_list_params.py +3 -0
- letta_client/types/{archive_update_params.py → archive_modify_params.py} +2 -2
- letta_client/types/batches/__init__.py +0 -1
- letta_client/types/block_create_params.py +6 -3
- letta_client/types/block_create_response.py +63 -0
- letta_client/types/block_list_response.py +63 -0
- letta_client/types/{block_update_params.py → block_modify_params.py} +8 -5
- letta_client/types/block_modify_response.py +63 -0
- letta_client/types/block_retrieve_response.py +63 -0
- letta_client/types/create_block_param.py +6 -3
- letta_client/types/{folder_update_params.py → folder_modify_params.py} +2 -2
- letta_client/types/{group_update_params.py → group_modify_params.py} +2 -2
- letta_client/types/groups/__init__.py +2 -2
- letta_client/types/groups/{message_update_params.py → message_modify_params.py} +2 -2
- letta_client/types/groups/{message_update_response.py → message_modify_response.py} +2 -2
- letta_client/types/identities/__init__.py +1 -0
- letta_client/types/identities/block_list_response.py +63 -0
- letta_client/types/{identity_update_params.py → identity_modify_params.py} +2 -2
- letta_client/types/tool.py +106 -2
- letta_client/types/{tool_update_params.py → tool_modify_params.py} +2 -2
- {letta_client-1.0.0a8.dist-info → letta_client-1.0.0a10.dist-info}/METADATA +1 -1
- {letta_client-1.0.0a8.dist-info → letta_client-1.0.0a10.dist-info}/RECORD +52 -46
- letta_client/types/archive_list_response.py +0 -10
- letta_client/types/batches/message_list_response.py +0 -12
- {letta_client-1.0.0a8.dist-info → letta_client-1.0.0a10.dist-info}/WHEEL +0 -0
- {letta_client-1.0.0a8.dist-info → letta_client-1.0.0a10.dist-info}/licenses/LICENSE +0 -0
|
@@ -19,9 +19,11 @@ from ..._response import (
|
|
|
19
19
|
)
|
|
20
20
|
from ...pagination import SyncArrayPage, AsyncArrayPage
|
|
21
21
|
from ..._base_client import AsyncPaginator, make_request_options
|
|
22
|
-
from ...types.agents import block_list_params,
|
|
22
|
+
from ...types.agents import block_list_params, block_modify_params
|
|
23
23
|
from ...types.agent_state import AgentState
|
|
24
|
-
from ...types.agents.
|
|
24
|
+
from ...types.agents.block_list_response import BlockListResponse
|
|
25
|
+
from ...types.agents.block_modify_response import BlockModifyResponse
|
|
26
|
+
from ...types.agents.block_retrieve_response import BlockRetrieveResponse
|
|
25
27
|
|
|
26
28
|
__all__ = ["BlocksResource", "AsyncBlocksResource"]
|
|
27
29
|
|
|
@@ -57,7 +59,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
57
59
|
extra_query: Query | None = None,
|
|
58
60
|
extra_body: Body | None = None,
|
|
59
61
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
60
|
-
) ->
|
|
62
|
+
) -> BlockRetrieveResponse:
|
|
61
63
|
"""
|
|
62
64
|
Retrieve a core memory block from an agent.
|
|
63
65
|
|
|
@@ -81,106 +83,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
81
83
|
options=make_request_options(
|
|
82
84
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
83
85
|
),
|
|
84
|
-
cast_to=
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
def update(
|
|
88
|
-
self,
|
|
89
|
-
block_label: str,
|
|
90
|
-
*,
|
|
91
|
-
agent_id: str,
|
|
92
|
-
base_template_id: Optional[str] | Omit = omit,
|
|
93
|
-
deployment_id: Optional[str] | Omit = omit,
|
|
94
|
-
description: Optional[str] | Omit = omit,
|
|
95
|
-
entity_id: Optional[str] | Omit = omit,
|
|
96
|
-
hidden: Optional[bool] | Omit = omit,
|
|
97
|
-
is_template: bool | Omit = omit,
|
|
98
|
-
label: Optional[str] | Omit = omit,
|
|
99
|
-
limit: Optional[int] | Omit = omit,
|
|
100
|
-
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
101
|
-
name: Optional[str] | Omit = omit,
|
|
102
|
-
preserve_on_migration: Optional[bool] | Omit = omit,
|
|
103
|
-
project_id: Optional[str] | Omit = omit,
|
|
104
|
-
read_only: bool | Omit = omit,
|
|
105
|
-
value: Optional[str] | Omit = omit,
|
|
106
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
107
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
108
|
-
extra_headers: Headers | None = None,
|
|
109
|
-
extra_query: Query | None = None,
|
|
110
|
-
extra_body: Body | None = None,
|
|
111
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
112
|
-
) -> Block:
|
|
113
|
-
"""
|
|
114
|
-
Updates a core memory block of an agent.
|
|
115
|
-
|
|
116
|
-
Args:
|
|
117
|
-
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
118
|
-
|
|
119
|
-
base_template_id: The base template id of the block.
|
|
120
|
-
|
|
121
|
-
deployment_id: The id of the deployment.
|
|
122
|
-
|
|
123
|
-
description: Description of the block.
|
|
124
|
-
|
|
125
|
-
entity_id: The id of the entity within the template.
|
|
126
|
-
|
|
127
|
-
hidden: If set to True, the block will be hidden.
|
|
128
|
-
|
|
129
|
-
is_template: Whether the block is a template (e.g. saved human/persona options).
|
|
130
|
-
|
|
131
|
-
label: Label of the block (e.g. 'human', 'persona') in the context window.
|
|
132
|
-
|
|
133
|
-
limit: Character limit of the block.
|
|
134
|
-
|
|
135
|
-
metadata: Metadata of the block.
|
|
136
|
-
|
|
137
|
-
name: The id of the template.
|
|
138
|
-
|
|
139
|
-
preserve_on_migration: Preserve the block on template migration.
|
|
140
|
-
|
|
141
|
-
project_id: The associated project id.
|
|
142
|
-
|
|
143
|
-
read_only: Whether the agent has read-only access to the block.
|
|
144
|
-
|
|
145
|
-
value: Value of the block.
|
|
146
|
-
|
|
147
|
-
extra_headers: Send extra headers
|
|
148
|
-
|
|
149
|
-
extra_query: Add additional query parameters to the request
|
|
150
|
-
|
|
151
|
-
extra_body: Add additional JSON properties to the request
|
|
152
|
-
|
|
153
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
154
|
-
"""
|
|
155
|
-
if not agent_id:
|
|
156
|
-
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
157
|
-
if not block_label:
|
|
158
|
-
raise ValueError(f"Expected a non-empty value for `block_label` but received {block_label!r}")
|
|
159
|
-
return self._patch(
|
|
160
|
-
f"/v1/agents/{agent_id}/core-memory/blocks/{block_label}",
|
|
161
|
-
body=maybe_transform(
|
|
162
|
-
{
|
|
163
|
-
"base_template_id": base_template_id,
|
|
164
|
-
"deployment_id": deployment_id,
|
|
165
|
-
"description": description,
|
|
166
|
-
"entity_id": entity_id,
|
|
167
|
-
"hidden": hidden,
|
|
168
|
-
"is_template": is_template,
|
|
169
|
-
"label": label,
|
|
170
|
-
"limit": limit,
|
|
171
|
-
"metadata": metadata,
|
|
172
|
-
"name": name,
|
|
173
|
-
"preserve_on_migration": preserve_on_migration,
|
|
174
|
-
"project_id": project_id,
|
|
175
|
-
"read_only": read_only,
|
|
176
|
-
"value": value,
|
|
177
|
-
},
|
|
178
|
-
block_update_params.BlockUpdateParams,
|
|
179
|
-
),
|
|
180
|
-
options=make_request_options(
|
|
181
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
182
|
-
),
|
|
183
|
-
cast_to=Block,
|
|
86
|
+
cast_to=BlockRetrieveResponse,
|
|
184
87
|
)
|
|
185
88
|
|
|
186
89
|
def list(
|
|
@@ -198,7 +101,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
198
101
|
extra_query: Query | None = None,
|
|
199
102
|
extra_body: Body | None = None,
|
|
200
103
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
201
|
-
) -> SyncArrayPage[
|
|
104
|
+
) -> SyncArrayPage[BlockListResponse]:
|
|
202
105
|
"""
|
|
203
106
|
Retrieve the core memory blocks of a specific agent.
|
|
204
107
|
|
|
@@ -230,7 +133,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
230
133
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
231
134
|
return self._get_api_list(
|
|
232
135
|
f"/v1/agents/{agent_id}/core-memory/blocks",
|
|
233
|
-
page=SyncArrayPage[
|
|
136
|
+
page=SyncArrayPage[BlockListResponse],
|
|
234
137
|
options=make_request_options(
|
|
235
138
|
extra_headers=extra_headers,
|
|
236
139
|
extra_query=extra_query,
|
|
@@ -247,7 +150,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
247
150
|
block_list_params.BlockListParams,
|
|
248
151
|
),
|
|
249
152
|
),
|
|
250
|
-
model=
|
|
153
|
+
model=BlockListResponse,
|
|
251
154
|
)
|
|
252
155
|
|
|
253
156
|
def attach(
|
|
@@ -330,66 +233,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
330
233
|
cast_to=AgentState,
|
|
331
234
|
)
|
|
332
235
|
|
|
333
|
-
|
|
334
|
-
class AsyncBlocksResource(AsyncAPIResource):
|
|
335
|
-
@cached_property
|
|
336
|
-
def with_raw_response(self) -> AsyncBlocksResourceWithRawResponse:
|
|
337
|
-
"""
|
|
338
|
-
This property can be used as a prefix for any HTTP method call to return
|
|
339
|
-
the raw response object instead of the parsed content.
|
|
340
|
-
|
|
341
|
-
For more information, see https://www.github.com/letta-ai/letta-python#accessing-raw-response-data-eg-headers
|
|
342
|
-
"""
|
|
343
|
-
return AsyncBlocksResourceWithRawResponse(self)
|
|
344
|
-
|
|
345
|
-
@cached_property
|
|
346
|
-
def with_streaming_response(self) -> AsyncBlocksResourceWithStreamingResponse:
|
|
347
|
-
"""
|
|
348
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
349
|
-
|
|
350
|
-
For more information, see https://www.github.com/letta-ai/letta-python#with_streaming_response
|
|
351
|
-
"""
|
|
352
|
-
return AsyncBlocksResourceWithStreamingResponse(self)
|
|
353
|
-
|
|
354
|
-
async def retrieve(
|
|
355
|
-
self,
|
|
356
|
-
block_label: str,
|
|
357
|
-
*,
|
|
358
|
-
agent_id: str,
|
|
359
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
360
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
361
|
-
extra_headers: Headers | None = None,
|
|
362
|
-
extra_query: Query | None = None,
|
|
363
|
-
extra_body: Body | None = None,
|
|
364
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
365
|
-
) -> Block:
|
|
366
|
-
"""
|
|
367
|
-
Retrieve a core memory block from an agent.
|
|
368
|
-
|
|
369
|
-
Args:
|
|
370
|
-
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
371
|
-
|
|
372
|
-
extra_headers: Send extra headers
|
|
373
|
-
|
|
374
|
-
extra_query: Add additional query parameters to the request
|
|
375
|
-
|
|
376
|
-
extra_body: Add additional JSON properties to the request
|
|
377
|
-
|
|
378
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
379
|
-
"""
|
|
380
|
-
if not agent_id:
|
|
381
|
-
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
382
|
-
if not block_label:
|
|
383
|
-
raise ValueError(f"Expected a non-empty value for `block_label` but received {block_label!r}")
|
|
384
|
-
return await self._get(
|
|
385
|
-
f"/v1/agents/{agent_id}/core-memory/blocks/{block_label}",
|
|
386
|
-
options=make_request_options(
|
|
387
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
388
|
-
),
|
|
389
|
-
cast_to=Block,
|
|
390
|
-
)
|
|
391
|
-
|
|
392
|
-
async def update(
|
|
236
|
+
def modify(
|
|
393
237
|
self,
|
|
394
238
|
block_label: str,
|
|
395
239
|
*,
|
|
@@ -403,10 +247,11 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
403
247
|
label: Optional[str] | Omit = omit,
|
|
404
248
|
limit: Optional[int] | Omit = omit,
|
|
405
249
|
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
406
|
-
name: Optional[str] | Omit = omit,
|
|
407
250
|
preserve_on_migration: Optional[bool] | Omit = omit,
|
|
408
251
|
project_id: Optional[str] | Omit = omit,
|
|
409
252
|
read_only: bool | Omit = omit,
|
|
253
|
+
template_id: Optional[str] | Omit = omit,
|
|
254
|
+
template_name: Optional[str] | Omit = omit,
|
|
410
255
|
value: Optional[str] | Omit = omit,
|
|
411
256
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
412
257
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -414,7 +259,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
414
259
|
extra_query: Query | None = None,
|
|
415
260
|
extra_body: Body | None = None,
|
|
416
261
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
417
|
-
) ->
|
|
262
|
+
) -> BlockModifyResponse:
|
|
418
263
|
"""
|
|
419
264
|
Updates a core memory block of an agent.
|
|
420
265
|
|
|
@@ -439,14 +284,16 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
439
284
|
|
|
440
285
|
metadata: Metadata of the block.
|
|
441
286
|
|
|
442
|
-
name: The id of the template.
|
|
443
|
-
|
|
444
287
|
preserve_on_migration: Preserve the block on template migration.
|
|
445
288
|
|
|
446
289
|
project_id: The associated project id.
|
|
447
290
|
|
|
448
291
|
read_only: Whether the agent has read-only access to the block.
|
|
449
292
|
|
|
293
|
+
template_id: The id of the template.
|
|
294
|
+
|
|
295
|
+
template_name: Name of the block if it is a template.
|
|
296
|
+
|
|
450
297
|
value: Value of the block.
|
|
451
298
|
|
|
452
299
|
extra_headers: Send extra headers
|
|
@@ -461,9 +308,9 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
461
308
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
462
309
|
if not block_label:
|
|
463
310
|
raise ValueError(f"Expected a non-empty value for `block_label` but received {block_label!r}")
|
|
464
|
-
return
|
|
311
|
+
return self._patch(
|
|
465
312
|
f"/v1/agents/{agent_id}/core-memory/blocks/{block_label}",
|
|
466
|
-
body=
|
|
313
|
+
body=maybe_transform(
|
|
467
314
|
{
|
|
468
315
|
"base_template_id": base_template_id,
|
|
469
316
|
"deployment_id": deployment_id,
|
|
@@ -474,18 +321,78 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
474
321
|
"label": label,
|
|
475
322
|
"limit": limit,
|
|
476
323
|
"metadata": metadata,
|
|
477
|
-
"name": name,
|
|
478
324
|
"preserve_on_migration": preserve_on_migration,
|
|
479
325
|
"project_id": project_id,
|
|
480
326
|
"read_only": read_only,
|
|
327
|
+
"template_id": template_id,
|
|
328
|
+
"template_name": template_name,
|
|
481
329
|
"value": value,
|
|
482
330
|
},
|
|
483
|
-
|
|
331
|
+
block_modify_params.BlockModifyParams,
|
|
332
|
+
),
|
|
333
|
+
options=make_request_options(
|
|
334
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
484
335
|
),
|
|
336
|
+
cast_to=BlockModifyResponse,
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
class AsyncBlocksResource(AsyncAPIResource):
|
|
341
|
+
@cached_property
|
|
342
|
+
def with_raw_response(self) -> AsyncBlocksResourceWithRawResponse:
|
|
343
|
+
"""
|
|
344
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
345
|
+
the raw response object instead of the parsed content.
|
|
346
|
+
|
|
347
|
+
For more information, see https://www.github.com/letta-ai/letta-python#accessing-raw-response-data-eg-headers
|
|
348
|
+
"""
|
|
349
|
+
return AsyncBlocksResourceWithRawResponse(self)
|
|
350
|
+
|
|
351
|
+
@cached_property
|
|
352
|
+
def with_streaming_response(self) -> AsyncBlocksResourceWithStreamingResponse:
|
|
353
|
+
"""
|
|
354
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
355
|
+
|
|
356
|
+
For more information, see https://www.github.com/letta-ai/letta-python#with_streaming_response
|
|
357
|
+
"""
|
|
358
|
+
return AsyncBlocksResourceWithStreamingResponse(self)
|
|
359
|
+
|
|
360
|
+
async def retrieve(
|
|
361
|
+
self,
|
|
362
|
+
block_label: str,
|
|
363
|
+
*,
|
|
364
|
+
agent_id: str,
|
|
365
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
366
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
367
|
+
extra_headers: Headers | None = None,
|
|
368
|
+
extra_query: Query | None = None,
|
|
369
|
+
extra_body: Body | None = None,
|
|
370
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
371
|
+
) -> BlockRetrieveResponse:
|
|
372
|
+
"""
|
|
373
|
+
Retrieve a core memory block from an agent.
|
|
374
|
+
|
|
375
|
+
Args:
|
|
376
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
377
|
+
|
|
378
|
+
extra_headers: Send extra headers
|
|
379
|
+
|
|
380
|
+
extra_query: Add additional query parameters to the request
|
|
381
|
+
|
|
382
|
+
extra_body: Add additional JSON properties to the request
|
|
383
|
+
|
|
384
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
385
|
+
"""
|
|
386
|
+
if not agent_id:
|
|
387
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
388
|
+
if not block_label:
|
|
389
|
+
raise ValueError(f"Expected a non-empty value for `block_label` but received {block_label!r}")
|
|
390
|
+
return await self._get(
|
|
391
|
+
f"/v1/agents/{agent_id}/core-memory/blocks/{block_label}",
|
|
485
392
|
options=make_request_options(
|
|
486
393
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
487
394
|
),
|
|
488
|
-
cast_to=
|
|
395
|
+
cast_to=BlockRetrieveResponse,
|
|
489
396
|
)
|
|
490
397
|
|
|
491
398
|
def list(
|
|
@@ -503,7 +410,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
503
410
|
extra_query: Query | None = None,
|
|
504
411
|
extra_body: Body | None = None,
|
|
505
412
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
506
|
-
) -> AsyncPaginator[
|
|
413
|
+
) -> AsyncPaginator[BlockListResponse, AsyncArrayPage[BlockListResponse]]:
|
|
507
414
|
"""
|
|
508
415
|
Retrieve the core memory blocks of a specific agent.
|
|
509
416
|
|
|
@@ -535,7 +442,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
535
442
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
536
443
|
return self._get_api_list(
|
|
537
444
|
f"/v1/agents/{agent_id}/core-memory/blocks",
|
|
538
|
-
page=AsyncArrayPage[
|
|
445
|
+
page=AsyncArrayPage[BlockListResponse],
|
|
539
446
|
options=make_request_options(
|
|
540
447
|
extra_headers=extra_headers,
|
|
541
448
|
extra_query=extra_query,
|
|
@@ -552,7 +459,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
552
459
|
block_list_params.BlockListParams,
|
|
553
460
|
),
|
|
554
461
|
),
|
|
555
|
-
model=
|
|
462
|
+
model=BlockListResponse,
|
|
556
463
|
)
|
|
557
464
|
|
|
558
465
|
async def attach(
|
|
@@ -635,6 +542,109 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
635
542
|
cast_to=AgentState,
|
|
636
543
|
)
|
|
637
544
|
|
|
545
|
+
async def modify(
|
|
546
|
+
self,
|
|
547
|
+
block_label: str,
|
|
548
|
+
*,
|
|
549
|
+
agent_id: str,
|
|
550
|
+
base_template_id: Optional[str] | Omit = omit,
|
|
551
|
+
deployment_id: Optional[str] | Omit = omit,
|
|
552
|
+
description: Optional[str] | Omit = omit,
|
|
553
|
+
entity_id: Optional[str] | Omit = omit,
|
|
554
|
+
hidden: Optional[bool] | Omit = omit,
|
|
555
|
+
is_template: bool | Omit = omit,
|
|
556
|
+
label: Optional[str] | Omit = omit,
|
|
557
|
+
limit: Optional[int] | Omit = omit,
|
|
558
|
+
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
559
|
+
preserve_on_migration: Optional[bool] | Omit = omit,
|
|
560
|
+
project_id: Optional[str] | Omit = omit,
|
|
561
|
+
read_only: bool | Omit = omit,
|
|
562
|
+
template_id: Optional[str] | Omit = omit,
|
|
563
|
+
template_name: Optional[str] | Omit = omit,
|
|
564
|
+
value: Optional[str] | Omit = omit,
|
|
565
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
566
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
567
|
+
extra_headers: Headers | None = None,
|
|
568
|
+
extra_query: Query | None = None,
|
|
569
|
+
extra_body: Body | None = None,
|
|
570
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
571
|
+
) -> BlockModifyResponse:
|
|
572
|
+
"""
|
|
573
|
+
Updates a core memory block of an agent.
|
|
574
|
+
|
|
575
|
+
Args:
|
|
576
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
577
|
+
|
|
578
|
+
base_template_id: The base template id of the block.
|
|
579
|
+
|
|
580
|
+
deployment_id: The id of the deployment.
|
|
581
|
+
|
|
582
|
+
description: Description of the block.
|
|
583
|
+
|
|
584
|
+
entity_id: The id of the entity within the template.
|
|
585
|
+
|
|
586
|
+
hidden: If set to True, the block will be hidden.
|
|
587
|
+
|
|
588
|
+
is_template: Whether the block is a template (e.g. saved human/persona options).
|
|
589
|
+
|
|
590
|
+
label: Label of the block (e.g. 'human', 'persona') in the context window.
|
|
591
|
+
|
|
592
|
+
limit: Character limit of the block.
|
|
593
|
+
|
|
594
|
+
metadata: Metadata of the block.
|
|
595
|
+
|
|
596
|
+
preserve_on_migration: Preserve the block on template migration.
|
|
597
|
+
|
|
598
|
+
project_id: The associated project id.
|
|
599
|
+
|
|
600
|
+
read_only: Whether the agent has read-only access to the block.
|
|
601
|
+
|
|
602
|
+
template_id: The id of the template.
|
|
603
|
+
|
|
604
|
+
template_name: Name of the block if it is a template.
|
|
605
|
+
|
|
606
|
+
value: Value of the block.
|
|
607
|
+
|
|
608
|
+
extra_headers: Send extra headers
|
|
609
|
+
|
|
610
|
+
extra_query: Add additional query parameters to the request
|
|
611
|
+
|
|
612
|
+
extra_body: Add additional JSON properties to the request
|
|
613
|
+
|
|
614
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
615
|
+
"""
|
|
616
|
+
if not agent_id:
|
|
617
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
618
|
+
if not block_label:
|
|
619
|
+
raise ValueError(f"Expected a non-empty value for `block_label` but received {block_label!r}")
|
|
620
|
+
return await self._patch(
|
|
621
|
+
f"/v1/agents/{agent_id}/core-memory/blocks/{block_label}",
|
|
622
|
+
body=await async_maybe_transform(
|
|
623
|
+
{
|
|
624
|
+
"base_template_id": base_template_id,
|
|
625
|
+
"deployment_id": deployment_id,
|
|
626
|
+
"description": description,
|
|
627
|
+
"entity_id": entity_id,
|
|
628
|
+
"hidden": hidden,
|
|
629
|
+
"is_template": is_template,
|
|
630
|
+
"label": label,
|
|
631
|
+
"limit": limit,
|
|
632
|
+
"metadata": metadata,
|
|
633
|
+
"preserve_on_migration": preserve_on_migration,
|
|
634
|
+
"project_id": project_id,
|
|
635
|
+
"read_only": read_only,
|
|
636
|
+
"template_id": template_id,
|
|
637
|
+
"template_name": template_name,
|
|
638
|
+
"value": value,
|
|
639
|
+
},
|
|
640
|
+
block_modify_params.BlockModifyParams,
|
|
641
|
+
),
|
|
642
|
+
options=make_request_options(
|
|
643
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
644
|
+
),
|
|
645
|
+
cast_to=BlockModifyResponse,
|
|
646
|
+
)
|
|
647
|
+
|
|
638
648
|
|
|
639
649
|
class BlocksResourceWithRawResponse:
|
|
640
650
|
def __init__(self, blocks: BlocksResource) -> None:
|
|
@@ -643,9 +653,6 @@ class BlocksResourceWithRawResponse:
|
|
|
643
653
|
self.retrieve = to_raw_response_wrapper(
|
|
644
654
|
blocks.retrieve,
|
|
645
655
|
)
|
|
646
|
-
self.update = to_raw_response_wrapper(
|
|
647
|
-
blocks.update,
|
|
648
|
-
)
|
|
649
656
|
self.list = to_raw_response_wrapper(
|
|
650
657
|
blocks.list,
|
|
651
658
|
)
|
|
@@ -655,6 +662,9 @@ class BlocksResourceWithRawResponse:
|
|
|
655
662
|
self.detach = to_raw_response_wrapper(
|
|
656
663
|
blocks.detach,
|
|
657
664
|
)
|
|
665
|
+
self.modify = to_raw_response_wrapper(
|
|
666
|
+
blocks.modify,
|
|
667
|
+
)
|
|
658
668
|
|
|
659
669
|
|
|
660
670
|
class AsyncBlocksResourceWithRawResponse:
|
|
@@ -664,9 +674,6 @@ class AsyncBlocksResourceWithRawResponse:
|
|
|
664
674
|
self.retrieve = async_to_raw_response_wrapper(
|
|
665
675
|
blocks.retrieve,
|
|
666
676
|
)
|
|
667
|
-
self.update = async_to_raw_response_wrapper(
|
|
668
|
-
blocks.update,
|
|
669
|
-
)
|
|
670
677
|
self.list = async_to_raw_response_wrapper(
|
|
671
678
|
blocks.list,
|
|
672
679
|
)
|
|
@@ -676,6 +683,9 @@ class AsyncBlocksResourceWithRawResponse:
|
|
|
676
683
|
self.detach = async_to_raw_response_wrapper(
|
|
677
684
|
blocks.detach,
|
|
678
685
|
)
|
|
686
|
+
self.modify = async_to_raw_response_wrapper(
|
|
687
|
+
blocks.modify,
|
|
688
|
+
)
|
|
679
689
|
|
|
680
690
|
|
|
681
691
|
class BlocksResourceWithStreamingResponse:
|
|
@@ -685,9 +695,6 @@ class BlocksResourceWithStreamingResponse:
|
|
|
685
695
|
self.retrieve = to_streamed_response_wrapper(
|
|
686
696
|
blocks.retrieve,
|
|
687
697
|
)
|
|
688
|
-
self.update = to_streamed_response_wrapper(
|
|
689
|
-
blocks.update,
|
|
690
|
-
)
|
|
691
698
|
self.list = to_streamed_response_wrapper(
|
|
692
699
|
blocks.list,
|
|
693
700
|
)
|
|
@@ -697,6 +704,9 @@ class BlocksResourceWithStreamingResponse:
|
|
|
697
704
|
self.detach = to_streamed_response_wrapper(
|
|
698
705
|
blocks.detach,
|
|
699
706
|
)
|
|
707
|
+
self.modify = to_streamed_response_wrapper(
|
|
708
|
+
blocks.modify,
|
|
709
|
+
)
|
|
700
710
|
|
|
701
711
|
|
|
702
712
|
class AsyncBlocksResourceWithStreamingResponse:
|
|
@@ -706,9 +716,6 @@ class AsyncBlocksResourceWithStreamingResponse:
|
|
|
706
716
|
self.retrieve = async_to_streamed_response_wrapper(
|
|
707
717
|
blocks.retrieve,
|
|
708
718
|
)
|
|
709
|
-
self.update = async_to_streamed_response_wrapper(
|
|
710
|
-
blocks.update,
|
|
711
|
-
)
|
|
712
719
|
self.list = async_to_streamed_response_wrapper(
|
|
713
720
|
blocks.list,
|
|
714
721
|
)
|
|
@@ -718,3 +725,6 @@ class AsyncBlocksResourceWithStreamingResponse:
|
|
|
718
725
|
self.detach = async_to_streamed_response_wrapper(
|
|
719
726
|
blocks.detach,
|
|
720
727
|
)
|
|
728
|
+
self.modify = async_to_streamed_response_wrapper(
|
|
729
|
+
blocks.modify,
|
|
730
|
+
)
|
|
@@ -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(
|