letta-client 1.0.0a9__py3-none-any.whl → 1.0.0a11__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/_client.py +5 -1
- letta_client/_streaming.py +40 -2
- letta_client/_version.py +1 -1
- letta_client/resources/agents/agents.py +396 -396
- letta_client/resources/agents/blocks.py +198 -190
- letta_client/resources/agents/files.py +10 -13
- letta_client/resources/agents/folders.py +10 -13
- letta_client/resources/agents/messages.py +380 -370
- letta_client/resources/agents/tools.py +10 -13
- letta_client/resources/archives.py +111 -113
- letta_client/resources/batches/batches.py +10 -12
- letta_client/resources/batches/messages.py +11 -14
- letta_client/resources/blocks/blocks.py +238 -222
- letta_client/resources/folders/agents.py +10 -13
- letta_client/resources/folders/files.py +9 -12
- letta_client/resources/folders/folders.py +143 -145
- 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 +151 -153
- letta_client/resources/runs/runs.py +11 -13
- letta_client/resources/tags.py +10 -13
- letta_client/resources/tools.py +802 -204
- letta_client/types/__init__.py +14 -7
- 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 +5 -3
- letta_client/types/agents/block.py +6 -3
- letta_client/types/agents/{block_update_params.py → block_modify_params.py} +8 -5
- letta_client/types/agents/file_list_response.py +14 -3
- letta_client/types/agents/folder_list_response.py +7 -3
- letta_client/types/agents/letta_streaming_response.py +70 -0
- 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/agents/tool_list_response.py +10 -0
- letta_client/types/archive_list_response.py +10 -0
- letta_client/types/{archive_update_params.py → archive_modify_params.py} +2 -2
- letta_client/types/batch_list_response.py +10 -0
- letta_client/types/batches/__init__.py +1 -0
- letta_client/types/batches/message_list_response.py +12 -0
- letta_client/types/block_create_params.py +6 -3
- letta_client/types/{block_update_params.py → block_modify_params.py} +8 -5
- letta_client/types/block_response.py +63 -0
- letta_client/types/create_block_param.py +6 -3
- letta_client/types/folder_list_response.py +10 -0
- letta_client/types/{folder_update_params.py → folder_modify_params.py} +2 -2
- letta_client/types/folders/agent_list_response.py +2 -1
- letta_client/types/folders/file_list_response.py +7 -4
- 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/identity_list_response.py +10 -0
- letta_client/types/{identity_update_params.py → identity_modify_params.py} +2 -2
- letta_client/types/run_list_response.py +10 -0
- letta_client/types/tag_list_response.py +2 -1
- letta_client/types/tool.py +106 -2
- letta_client/types/tool_list_response.py +10 -0
- letta_client/types/{tool_update_params.py → tool_modify_params.py} +2 -2
- {letta_client-1.0.0a9.dist-info → letta_client-1.0.0a11.dist-info}/METADATA +1 -1
- {letta_client-1.0.0a9.dist-info → letta_client-1.0.0a11.dist-info}/RECORD +63 -53
- {letta_client-1.0.0a9.dist-info → letta_client-1.0.0a11.dist-info}/WHEEL +0 -0
- {letta_client-1.0.0a9.dist-info → letta_client-1.0.0a11.dist-info}/licenses/LICENSE +0 -0
|
@@ -19,9 +19,9 @@ 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.
|
|
24
|
+
from ...types.block_response import BlockResponse
|
|
25
25
|
|
|
26
26
|
__all__ = ["BlocksResource", "AsyncBlocksResource"]
|
|
27
27
|
|
|
@@ -57,7 +57,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
57
57
|
extra_query: Query | None = None,
|
|
58
58
|
extra_body: Body | None = None,
|
|
59
59
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
60
|
-
) ->
|
|
60
|
+
) -> BlockResponse:
|
|
61
61
|
"""
|
|
62
62
|
Retrieve a core memory block from an agent.
|
|
63
63
|
|
|
@@ -81,106 +81,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
81
81
|
options=make_request_options(
|
|
82
82
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
83
83
|
),
|
|
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,
|
|
84
|
+
cast_to=BlockResponse,
|
|
184
85
|
)
|
|
185
86
|
|
|
186
87
|
def list(
|
|
@@ -198,7 +99,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
198
99
|
extra_query: Query | None = None,
|
|
199
100
|
extra_body: Body | None = None,
|
|
200
101
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
201
|
-
) -> SyncArrayPage[
|
|
102
|
+
) -> SyncArrayPage[BlockResponse]:
|
|
202
103
|
"""
|
|
203
104
|
Retrieve the core memory blocks of a specific agent.
|
|
204
105
|
|
|
@@ -230,7 +131,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
230
131
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
231
132
|
return self._get_api_list(
|
|
232
133
|
f"/v1/agents/{agent_id}/core-memory/blocks",
|
|
233
|
-
page=SyncArrayPage[
|
|
134
|
+
page=SyncArrayPage[BlockResponse],
|
|
234
135
|
options=make_request_options(
|
|
235
136
|
extra_headers=extra_headers,
|
|
236
137
|
extra_query=extra_query,
|
|
@@ -247,7 +148,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
247
148
|
block_list_params.BlockListParams,
|
|
248
149
|
),
|
|
249
150
|
),
|
|
250
|
-
model=
|
|
151
|
+
model=BlockResponse,
|
|
251
152
|
)
|
|
252
153
|
|
|
253
154
|
def attach(
|
|
@@ -330,66 +231,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
330
231
|
cast_to=AgentState,
|
|
331
232
|
)
|
|
332
233
|
|
|
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(
|
|
234
|
+
def modify(
|
|
393
235
|
self,
|
|
394
236
|
block_label: str,
|
|
395
237
|
*,
|
|
@@ -403,10 +245,11 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
403
245
|
label: Optional[str] | Omit = omit,
|
|
404
246
|
limit: Optional[int] | Omit = omit,
|
|
405
247
|
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
406
|
-
name: Optional[str] | Omit = omit,
|
|
407
248
|
preserve_on_migration: Optional[bool] | Omit = omit,
|
|
408
249
|
project_id: Optional[str] | Omit = omit,
|
|
409
250
|
read_only: bool | Omit = omit,
|
|
251
|
+
template_id: Optional[str] | Omit = omit,
|
|
252
|
+
template_name: Optional[str] | Omit = omit,
|
|
410
253
|
value: Optional[str] | Omit = omit,
|
|
411
254
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
412
255
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -414,7 +257,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
414
257
|
extra_query: Query | None = None,
|
|
415
258
|
extra_body: Body | None = None,
|
|
416
259
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
417
|
-
) ->
|
|
260
|
+
) -> BlockResponse:
|
|
418
261
|
"""
|
|
419
262
|
Updates a core memory block of an agent.
|
|
420
263
|
|
|
@@ -439,14 +282,16 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
439
282
|
|
|
440
283
|
metadata: Metadata of the block.
|
|
441
284
|
|
|
442
|
-
name: The id of the template.
|
|
443
|
-
|
|
444
285
|
preserve_on_migration: Preserve the block on template migration.
|
|
445
286
|
|
|
446
287
|
project_id: The associated project id.
|
|
447
288
|
|
|
448
289
|
read_only: Whether the agent has read-only access to the block.
|
|
449
290
|
|
|
291
|
+
template_id: The id of the template.
|
|
292
|
+
|
|
293
|
+
template_name: Name of the block if it is a template.
|
|
294
|
+
|
|
450
295
|
value: Value of the block.
|
|
451
296
|
|
|
452
297
|
extra_headers: Send extra headers
|
|
@@ -461,9 +306,9 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
461
306
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
462
307
|
if not block_label:
|
|
463
308
|
raise ValueError(f"Expected a non-empty value for `block_label` but received {block_label!r}")
|
|
464
|
-
return
|
|
309
|
+
return self._patch(
|
|
465
310
|
f"/v1/agents/{agent_id}/core-memory/blocks/{block_label}",
|
|
466
|
-
body=
|
|
311
|
+
body=maybe_transform(
|
|
467
312
|
{
|
|
468
313
|
"base_template_id": base_template_id,
|
|
469
314
|
"deployment_id": deployment_id,
|
|
@@ -474,18 +319,78 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
474
319
|
"label": label,
|
|
475
320
|
"limit": limit,
|
|
476
321
|
"metadata": metadata,
|
|
477
|
-
"name": name,
|
|
478
322
|
"preserve_on_migration": preserve_on_migration,
|
|
479
323
|
"project_id": project_id,
|
|
480
324
|
"read_only": read_only,
|
|
325
|
+
"template_id": template_id,
|
|
326
|
+
"template_name": template_name,
|
|
481
327
|
"value": value,
|
|
482
328
|
},
|
|
483
|
-
|
|
329
|
+
block_modify_params.BlockModifyParams,
|
|
330
|
+
),
|
|
331
|
+
options=make_request_options(
|
|
332
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
484
333
|
),
|
|
334
|
+
cast_to=BlockResponse,
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
class AsyncBlocksResource(AsyncAPIResource):
|
|
339
|
+
@cached_property
|
|
340
|
+
def with_raw_response(self) -> AsyncBlocksResourceWithRawResponse:
|
|
341
|
+
"""
|
|
342
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
343
|
+
the raw response object instead of the parsed content.
|
|
344
|
+
|
|
345
|
+
For more information, see https://www.github.com/letta-ai/letta-python#accessing-raw-response-data-eg-headers
|
|
346
|
+
"""
|
|
347
|
+
return AsyncBlocksResourceWithRawResponse(self)
|
|
348
|
+
|
|
349
|
+
@cached_property
|
|
350
|
+
def with_streaming_response(self) -> AsyncBlocksResourceWithStreamingResponse:
|
|
351
|
+
"""
|
|
352
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
353
|
+
|
|
354
|
+
For more information, see https://www.github.com/letta-ai/letta-python#with_streaming_response
|
|
355
|
+
"""
|
|
356
|
+
return AsyncBlocksResourceWithStreamingResponse(self)
|
|
357
|
+
|
|
358
|
+
async def retrieve(
|
|
359
|
+
self,
|
|
360
|
+
block_label: str,
|
|
361
|
+
*,
|
|
362
|
+
agent_id: str,
|
|
363
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
364
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
365
|
+
extra_headers: Headers | None = None,
|
|
366
|
+
extra_query: Query | None = None,
|
|
367
|
+
extra_body: Body | None = None,
|
|
368
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
369
|
+
) -> BlockResponse:
|
|
370
|
+
"""
|
|
371
|
+
Retrieve a core memory block from an agent.
|
|
372
|
+
|
|
373
|
+
Args:
|
|
374
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
375
|
+
|
|
376
|
+
extra_headers: Send extra headers
|
|
377
|
+
|
|
378
|
+
extra_query: Add additional query parameters to the request
|
|
379
|
+
|
|
380
|
+
extra_body: Add additional JSON properties to the request
|
|
381
|
+
|
|
382
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
383
|
+
"""
|
|
384
|
+
if not agent_id:
|
|
385
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
386
|
+
if not block_label:
|
|
387
|
+
raise ValueError(f"Expected a non-empty value for `block_label` but received {block_label!r}")
|
|
388
|
+
return await self._get(
|
|
389
|
+
f"/v1/agents/{agent_id}/core-memory/blocks/{block_label}",
|
|
485
390
|
options=make_request_options(
|
|
486
391
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
487
392
|
),
|
|
488
|
-
cast_to=
|
|
393
|
+
cast_to=BlockResponse,
|
|
489
394
|
)
|
|
490
395
|
|
|
491
396
|
def list(
|
|
@@ -503,7 +408,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
503
408
|
extra_query: Query | None = None,
|
|
504
409
|
extra_body: Body | None = None,
|
|
505
410
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
506
|
-
) -> AsyncPaginator[
|
|
411
|
+
) -> AsyncPaginator[BlockResponse, AsyncArrayPage[BlockResponse]]:
|
|
507
412
|
"""
|
|
508
413
|
Retrieve the core memory blocks of a specific agent.
|
|
509
414
|
|
|
@@ -535,7 +440,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
535
440
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
536
441
|
return self._get_api_list(
|
|
537
442
|
f"/v1/agents/{agent_id}/core-memory/blocks",
|
|
538
|
-
page=AsyncArrayPage[
|
|
443
|
+
page=AsyncArrayPage[BlockResponse],
|
|
539
444
|
options=make_request_options(
|
|
540
445
|
extra_headers=extra_headers,
|
|
541
446
|
extra_query=extra_query,
|
|
@@ -552,7 +457,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
552
457
|
block_list_params.BlockListParams,
|
|
553
458
|
),
|
|
554
459
|
),
|
|
555
|
-
model=
|
|
460
|
+
model=BlockResponse,
|
|
556
461
|
)
|
|
557
462
|
|
|
558
463
|
async def attach(
|
|
@@ -635,6 +540,109 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
635
540
|
cast_to=AgentState,
|
|
636
541
|
)
|
|
637
542
|
|
|
543
|
+
async def modify(
|
|
544
|
+
self,
|
|
545
|
+
block_label: str,
|
|
546
|
+
*,
|
|
547
|
+
agent_id: str,
|
|
548
|
+
base_template_id: Optional[str] | Omit = omit,
|
|
549
|
+
deployment_id: Optional[str] | Omit = omit,
|
|
550
|
+
description: Optional[str] | Omit = omit,
|
|
551
|
+
entity_id: Optional[str] | Omit = omit,
|
|
552
|
+
hidden: Optional[bool] | Omit = omit,
|
|
553
|
+
is_template: bool | Omit = omit,
|
|
554
|
+
label: Optional[str] | Omit = omit,
|
|
555
|
+
limit: Optional[int] | Omit = omit,
|
|
556
|
+
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
557
|
+
preserve_on_migration: Optional[bool] | Omit = omit,
|
|
558
|
+
project_id: Optional[str] | Omit = omit,
|
|
559
|
+
read_only: bool | Omit = omit,
|
|
560
|
+
template_id: Optional[str] | Omit = omit,
|
|
561
|
+
template_name: Optional[str] | Omit = omit,
|
|
562
|
+
value: Optional[str] | Omit = omit,
|
|
563
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
564
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
565
|
+
extra_headers: Headers | None = None,
|
|
566
|
+
extra_query: Query | None = None,
|
|
567
|
+
extra_body: Body | None = None,
|
|
568
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
569
|
+
) -> BlockResponse:
|
|
570
|
+
"""
|
|
571
|
+
Updates a core memory block of an agent.
|
|
572
|
+
|
|
573
|
+
Args:
|
|
574
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
575
|
+
|
|
576
|
+
base_template_id: The base template id of the block.
|
|
577
|
+
|
|
578
|
+
deployment_id: The id of the deployment.
|
|
579
|
+
|
|
580
|
+
description: Description of the block.
|
|
581
|
+
|
|
582
|
+
entity_id: The id of the entity within the template.
|
|
583
|
+
|
|
584
|
+
hidden: If set to True, the block will be hidden.
|
|
585
|
+
|
|
586
|
+
is_template: Whether the block is a template (e.g. saved human/persona options).
|
|
587
|
+
|
|
588
|
+
label: Label of the block (e.g. 'human', 'persona') in the context window.
|
|
589
|
+
|
|
590
|
+
limit: Character limit of the block.
|
|
591
|
+
|
|
592
|
+
metadata: Metadata of the block.
|
|
593
|
+
|
|
594
|
+
preserve_on_migration: Preserve the block on template migration.
|
|
595
|
+
|
|
596
|
+
project_id: The associated project id.
|
|
597
|
+
|
|
598
|
+
read_only: Whether the agent has read-only access to the block.
|
|
599
|
+
|
|
600
|
+
template_id: The id of the template.
|
|
601
|
+
|
|
602
|
+
template_name: Name of the block if it is a template.
|
|
603
|
+
|
|
604
|
+
value: Value of the block.
|
|
605
|
+
|
|
606
|
+
extra_headers: Send extra headers
|
|
607
|
+
|
|
608
|
+
extra_query: Add additional query parameters to the request
|
|
609
|
+
|
|
610
|
+
extra_body: Add additional JSON properties to the request
|
|
611
|
+
|
|
612
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
613
|
+
"""
|
|
614
|
+
if not agent_id:
|
|
615
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
616
|
+
if not block_label:
|
|
617
|
+
raise ValueError(f"Expected a non-empty value for `block_label` but received {block_label!r}")
|
|
618
|
+
return await self._patch(
|
|
619
|
+
f"/v1/agents/{agent_id}/core-memory/blocks/{block_label}",
|
|
620
|
+
body=await async_maybe_transform(
|
|
621
|
+
{
|
|
622
|
+
"base_template_id": base_template_id,
|
|
623
|
+
"deployment_id": deployment_id,
|
|
624
|
+
"description": description,
|
|
625
|
+
"entity_id": entity_id,
|
|
626
|
+
"hidden": hidden,
|
|
627
|
+
"is_template": is_template,
|
|
628
|
+
"label": label,
|
|
629
|
+
"limit": limit,
|
|
630
|
+
"metadata": metadata,
|
|
631
|
+
"preserve_on_migration": preserve_on_migration,
|
|
632
|
+
"project_id": project_id,
|
|
633
|
+
"read_only": read_only,
|
|
634
|
+
"template_id": template_id,
|
|
635
|
+
"template_name": template_name,
|
|
636
|
+
"value": value,
|
|
637
|
+
},
|
|
638
|
+
block_modify_params.BlockModifyParams,
|
|
639
|
+
),
|
|
640
|
+
options=make_request_options(
|
|
641
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
642
|
+
),
|
|
643
|
+
cast_to=BlockResponse,
|
|
644
|
+
)
|
|
645
|
+
|
|
638
646
|
|
|
639
647
|
class BlocksResourceWithRawResponse:
|
|
640
648
|
def __init__(self, blocks: BlocksResource) -> None:
|
|
@@ -643,9 +651,6 @@ class BlocksResourceWithRawResponse:
|
|
|
643
651
|
self.retrieve = to_raw_response_wrapper(
|
|
644
652
|
blocks.retrieve,
|
|
645
653
|
)
|
|
646
|
-
self.update = to_raw_response_wrapper(
|
|
647
|
-
blocks.update,
|
|
648
|
-
)
|
|
649
654
|
self.list = to_raw_response_wrapper(
|
|
650
655
|
blocks.list,
|
|
651
656
|
)
|
|
@@ -655,6 +660,9 @@ class BlocksResourceWithRawResponse:
|
|
|
655
660
|
self.detach = to_raw_response_wrapper(
|
|
656
661
|
blocks.detach,
|
|
657
662
|
)
|
|
663
|
+
self.modify = to_raw_response_wrapper(
|
|
664
|
+
blocks.modify,
|
|
665
|
+
)
|
|
658
666
|
|
|
659
667
|
|
|
660
668
|
class AsyncBlocksResourceWithRawResponse:
|
|
@@ -664,9 +672,6 @@ class AsyncBlocksResourceWithRawResponse:
|
|
|
664
672
|
self.retrieve = async_to_raw_response_wrapper(
|
|
665
673
|
blocks.retrieve,
|
|
666
674
|
)
|
|
667
|
-
self.update = async_to_raw_response_wrapper(
|
|
668
|
-
blocks.update,
|
|
669
|
-
)
|
|
670
675
|
self.list = async_to_raw_response_wrapper(
|
|
671
676
|
blocks.list,
|
|
672
677
|
)
|
|
@@ -676,6 +681,9 @@ class AsyncBlocksResourceWithRawResponse:
|
|
|
676
681
|
self.detach = async_to_raw_response_wrapper(
|
|
677
682
|
blocks.detach,
|
|
678
683
|
)
|
|
684
|
+
self.modify = async_to_raw_response_wrapper(
|
|
685
|
+
blocks.modify,
|
|
686
|
+
)
|
|
679
687
|
|
|
680
688
|
|
|
681
689
|
class BlocksResourceWithStreamingResponse:
|
|
@@ -685,9 +693,6 @@ class BlocksResourceWithStreamingResponse:
|
|
|
685
693
|
self.retrieve = to_streamed_response_wrapper(
|
|
686
694
|
blocks.retrieve,
|
|
687
695
|
)
|
|
688
|
-
self.update = to_streamed_response_wrapper(
|
|
689
|
-
blocks.update,
|
|
690
|
-
)
|
|
691
696
|
self.list = to_streamed_response_wrapper(
|
|
692
697
|
blocks.list,
|
|
693
698
|
)
|
|
@@ -697,6 +702,9 @@ class BlocksResourceWithStreamingResponse:
|
|
|
697
702
|
self.detach = to_streamed_response_wrapper(
|
|
698
703
|
blocks.detach,
|
|
699
704
|
)
|
|
705
|
+
self.modify = to_streamed_response_wrapper(
|
|
706
|
+
blocks.modify,
|
|
707
|
+
)
|
|
700
708
|
|
|
701
709
|
|
|
702
710
|
class AsyncBlocksResourceWithStreamingResponse:
|
|
@@ -706,9 +714,6 @@ class AsyncBlocksResourceWithStreamingResponse:
|
|
|
706
714
|
self.retrieve = async_to_streamed_response_wrapper(
|
|
707
715
|
blocks.retrieve,
|
|
708
716
|
)
|
|
709
|
-
self.update = async_to_streamed_response_wrapper(
|
|
710
|
-
blocks.update,
|
|
711
|
-
)
|
|
712
717
|
self.list = async_to_streamed_response_wrapper(
|
|
713
718
|
blocks.list,
|
|
714
719
|
)
|
|
@@ -718,3 +723,6 @@ class AsyncBlocksResourceWithStreamingResponse:
|
|
|
718
723
|
self.detach = async_to_streamed_response_wrapper(
|
|
719
724
|
blocks.detach,
|
|
720
725
|
)
|
|
726
|
+
self.modify = async_to_streamed_response_wrapper(
|
|
727
|
+
blocks.modify,
|
|
728
|
+
)
|
|
@@ -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, async_maybe_transform
|
|
12
12
|
from ..._compat import cached_property
|
|
13
13
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
14
14
|
from ..._response import (
|
|
@@ -17,8 +17,7 @@ from ..._response import (
|
|
|
17
17
|
async_to_raw_response_wrapper,
|
|
18
18
|
async_to_streamed_response_wrapper,
|
|
19
19
|
)
|
|
20
|
-
from ...
|
|
21
|
-
from ..._base_client import AsyncPaginator, make_request_options
|
|
20
|
+
from ..._base_client import make_request_options
|
|
22
21
|
from ...types.agents import file_list_params
|
|
23
22
|
from ...types.agents.file_list_response import FileListResponse
|
|
24
23
|
from ...types.agents.file_open_response import FileOpenResponse
|
|
@@ -64,7 +63,7 @@ class FilesResource(SyncAPIResource):
|
|
|
64
63
|
extra_query: Query | None = None,
|
|
65
64
|
extra_body: Body | None = None,
|
|
66
65
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
67
|
-
) ->
|
|
66
|
+
) -> FileListResponse:
|
|
68
67
|
"""
|
|
69
68
|
Get the files attached to an agent with their open/closed status.
|
|
70
69
|
|
|
@@ -98,9 +97,8 @@ class FilesResource(SyncAPIResource):
|
|
|
98
97
|
"""
|
|
99
98
|
if not agent_id:
|
|
100
99
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
101
|
-
return self.
|
|
100
|
+
return self._get(
|
|
102
101
|
f"/v1/agents/{agent_id}/files",
|
|
103
|
-
page=SyncNextFilesPage[FileListResponse],
|
|
104
102
|
options=make_request_options(
|
|
105
103
|
extra_headers=extra_headers,
|
|
106
104
|
extra_query=extra_query,
|
|
@@ -119,7 +117,7 @@ class FilesResource(SyncAPIResource):
|
|
|
119
117
|
file_list_params.FileListParams,
|
|
120
118
|
),
|
|
121
119
|
),
|
|
122
|
-
|
|
120
|
+
cast_to=FileListResponse,
|
|
123
121
|
)
|
|
124
122
|
|
|
125
123
|
def close(
|
|
@@ -268,7 +266,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
268
266
|
"""
|
|
269
267
|
return AsyncFilesResourceWithStreamingResponse(self)
|
|
270
268
|
|
|
271
|
-
def list(
|
|
269
|
+
async def list(
|
|
272
270
|
self,
|
|
273
271
|
agent_id: str,
|
|
274
272
|
*,
|
|
@@ -285,7 +283,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
285
283
|
extra_query: Query | None = None,
|
|
286
284
|
extra_body: Body | None = None,
|
|
287
285
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
288
|
-
) ->
|
|
286
|
+
) -> FileListResponse:
|
|
289
287
|
"""
|
|
290
288
|
Get the files attached to an agent with their open/closed status.
|
|
291
289
|
|
|
@@ -319,15 +317,14 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
319
317
|
"""
|
|
320
318
|
if not agent_id:
|
|
321
319
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
322
|
-
return self.
|
|
320
|
+
return await self._get(
|
|
323
321
|
f"/v1/agents/{agent_id}/files",
|
|
324
|
-
page=AsyncNextFilesPage[FileListResponse],
|
|
325
322
|
options=make_request_options(
|
|
326
323
|
extra_headers=extra_headers,
|
|
327
324
|
extra_query=extra_query,
|
|
328
325
|
extra_body=extra_body,
|
|
329
326
|
timeout=timeout,
|
|
330
|
-
query=
|
|
327
|
+
query=await async_maybe_transform(
|
|
331
328
|
{
|
|
332
329
|
"after": after,
|
|
333
330
|
"before": before,
|
|
@@ -340,7 +337,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
340
337
|
file_list_params.FileListParams,
|
|
341
338
|
),
|
|
342
339
|
),
|
|
343
|
-
|
|
340
|
+
cast_to=FileListResponse,
|
|
344
341
|
)
|
|
345
342
|
|
|
346
343
|
async def close(
|