letta-client 1.0.0a9__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/resources/agents/agents.py +396 -396
- letta_client/resources/agents/blocks.py +200 -190
- letta_client/resources/agents/messages.py +367 -367
- letta_client/resources/archives.py +101 -101
- 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 -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 +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/{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_update_params.py → archive_modify_params.py} +2 -2
- 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.0a9.dist-info → letta_client-1.0.0a10.dist-info}/METADATA +1 -1
- {letta_client-1.0.0a9.dist-info → letta_client-1.0.0a10.dist-info}/RECORD +45 -37
- {letta_client-1.0.0a9.dist-info → letta_client-1.0.0a10.dist-info}/WHEEL +0 -0
- {letta_client-1.0.0a9.dist-info → letta_client-1.0.0a10.dist-info}/licenses/LICENSE +0 -0
|
@@ -15,7 +15,7 @@ from .agents import (
|
|
|
15
15
|
AgentsResourceWithStreamingResponse,
|
|
16
16
|
AsyncAgentsResourceWithStreamingResponse,
|
|
17
17
|
)
|
|
18
|
-
from ...types import block_list_params, block_create_params,
|
|
18
|
+
from ...types import block_list_params, block_create_params, block_modify_params
|
|
19
19
|
from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
|
|
20
20
|
from ..._utils import maybe_transform, async_maybe_transform
|
|
21
21
|
from ..._compat import cached_property
|
|
@@ -28,8 +28,11 @@ from ..._response import (
|
|
|
28
28
|
)
|
|
29
29
|
from ...pagination import SyncArrayPage, AsyncArrayPage
|
|
30
30
|
from ..._base_client import AsyncPaginator, make_request_options
|
|
31
|
-
from ...types.
|
|
31
|
+
from ...types.block_list_response import BlockListResponse
|
|
32
32
|
from ...types.block_count_response import BlockCountResponse
|
|
33
|
+
from ...types.block_create_response import BlockCreateResponse
|
|
34
|
+
from ...types.block_modify_response import BlockModifyResponse
|
|
35
|
+
from ...types.block_retrieve_response import BlockRetrieveResponse
|
|
33
36
|
|
|
34
37
|
__all__ = ["BlocksResource", "AsyncBlocksResource"]
|
|
35
38
|
|
|
@@ -71,17 +74,18 @@ class BlocksResource(SyncAPIResource):
|
|
|
71
74
|
is_template: bool | Omit = omit,
|
|
72
75
|
limit: int | Omit = omit,
|
|
73
76
|
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
74
|
-
name: Optional[str] | Omit = omit,
|
|
75
77
|
preserve_on_migration: Optional[bool] | Omit = omit,
|
|
76
78
|
project_id: Optional[str] | Omit = omit,
|
|
77
79
|
read_only: bool | Omit = omit,
|
|
80
|
+
template_id: Optional[str] | Omit = omit,
|
|
81
|
+
template_name: Optional[str] | Omit = omit,
|
|
78
82
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
79
83
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
80
84
|
extra_headers: Headers | None = None,
|
|
81
85
|
extra_query: Query | None = None,
|
|
82
86
|
extra_body: Body | None = None,
|
|
83
87
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
84
|
-
) ->
|
|
88
|
+
) -> BlockCreateResponse:
|
|
85
89
|
"""
|
|
86
90
|
Create Block
|
|
87
91
|
|
|
@@ -104,14 +108,16 @@ class BlocksResource(SyncAPIResource):
|
|
|
104
108
|
|
|
105
109
|
metadata: Metadata of the block.
|
|
106
110
|
|
|
107
|
-
name: The id of the template.
|
|
108
|
-
|
|
109
111
|
preserve_on_migration: Preserve the block on template migration.
|
|
110
112
|
|
|
111
113
|
project_id: The associated project id.
|
|
112
114
|
|
|
113
115
|
read_only: Whether the agent has read-only access to the block.
|
|
114
116
|
|
|
117
|
+
template_id: The id of the template.
|
|
118
|
+
|
|
119
|
+
template_name: Name of the block if it is a template.
|
|
120
|
+
|
|
115
121
|
extra_headers: Send extra headers
|
|
116
122
|
|
|
117
123
|
extra_query: Add additional query parameters to the request
|
|
@@ -134,17 +140,18 @@ class BlocksResource(SyncAPIResource):
|
|
|
134
140
|
"is_template": is_template,
|
|
135
141
|
"limit": limit,
|
|
136
142
|
"metadata": metadata,
|
|
137
|
-
"name": name,
|
|
138
143
|
"preserve_on_migration": preserve_on_migration,
|
|
139
144
|
"project_id": project_id,
|
|
140
145
|
"read_only": read_only,
|
|
146
|
+
"template_id": template_id,
|
|
147
|
+
"template_name": template_name,
|
|
141
148
|
},
|
|
142
149
|
block_create_params.BlockCreateParams,
|
|
143
150
|
),
|
|
144
151
|
options=make_request_options(
|
|
145
152
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
146
153
|
),
|
|
147
|
-
cast_to=
|
|
154
|
+
cast_to=BlockCreateResponse,
|
|
148
155
|
)
|
|
149
156
|
|
|
150
157
|
def retrieve(
|
|
@@ -157,7 +164,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
157
164
|
extra_query: Query | None = None,
|
|
158
165
|
extra_body: Body | None = None,
|
|
159
166
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
160
|
-
) ->
|
|
167
|
+
) -> BlockRetrieveResponse:
|
|
161
168
|
"""
|
|
162
169
|
Retrieve Block
|
|
163
170
|
|
|
@@ -179,103 +186,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
179
186
|
options=make_request_options(
|
|
180
187
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
181
188
|
),
|
|
182
|
-
cast_to=
|
|
183
|
-
)
|
|
184
|
-
|
|
185
|
-
def update(
|
|
186
|
-
self,
|
|
187
|
-
block_id: str,
|
|
188
|
-
*,
|
|
189
|
-
base_template_id: Optional[str] | Omit = omit,
|
|
190
|
-
deployment_id: Optional[str] | Omit = omit,
|
|
191
|
-
description: Optional[str] | Omit = omit,
|
|
192
|
-
entity_id: Optional[str] | Omit = omit,
|
|
193
|
-
hidden: Optional[bool] | Omit = omit,
|
|
194
|
-
is_template: bool | Omit = omit,
|
|
195
|
-
label: Optional[str] | Omit = omit,
|
|
196
|
-
limit: Optional[int] | Omit = omit,
|
|
197
|
-
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
198
|
-
name: Optional[str] | Omit = omit,
|
|
199
|
-
preserve_on_migration: Optional[bool] | Omit = omit,
|
|
200
|
-
project_id: Optional[str] | Omit = omit,
|
|
201
|
-
read_only: bool | Omit = omit,
|
|
202
|
-
value: Optional[str] | Omit = omit,
|
|
203
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
204
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
205
|
-
extra_headers: Headers | None = None,
|
|
206
|
-
extra_query: Query | None = None,
|
|
207
|
-
extra_body: Body | None = None,
|
|
208
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
209
|
-
) -> Block:
|
|
210
|
-
"""
|
|
211
|
-
Modify Block
|
|
212
|
-
|
|
213
|
-
Args:
|
|
214
|
-
block_id: The ID of the block in the format 'block-<uuid4>'
|
|
215
|
-
|
|
216
|
-
base_template_id: The base template id of the block.
|
|
217
|
-
|
|
218
|
-
deployment_id: The id of the deployment.
|
|
219
|
-
|
|
220
|
-
description: Description of the block.
|
|
221
|
-
|
|
222
|
-
entity_id: The id of the entity within the template.
|
|
223
|
-
|
|
224
|
-
hidden: If set to True, the block will be hidden.
|
|
225
|
-
|
|
226
|
-
is_template: Whether the block is a template (e.g. saved human/persona options).
|
|
227
|
-
|
|
228
|
-
label: Label of the block (e.g. 'human', 'persona') in the context window.
|
|
229
|
-
|
|
230
|
-
limit: Character limit of the block.
|
|
231
|
-
|
|
232
|
-
metadata: Metadata of the block.
|
|
233
|
-
|
|
234
|
-
name: The id of the template.
|
|
235
|
-
|
|
236
|
-
preserve_on_migration: Preserve the block on template migration.
|
|
237
|
-
|
|
238
|
-
project_id: The associated project id.
|
|
239
|
-
|
|
240
|
-
read_only: Whether the agent has read-only access to the block.
|
|
241
|
-
|
|
242
|
-
value: Value of the block.
|
|
243
|
-
|
|
244
|
-
extra_headers: Send extra headers
|
|
245
|
-
|
|
246
|
-
extra_query: Add additional query parameters to the request
|
|
247
|
-
|
|
248
|
-
extra_body: Add additional JSON properties to the request
|
|
249
|
-
|
|
250
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
251
|
-
"""
|
|
252
|
-
if not block_id:
|
|
253
|
-
raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}")
|
|
254
|
-
return self._patch(
|
|
255
|
-
f"/v1/blocks/{block_id}",
|
|
256
|
-
body=maybe_transform(
|
|
257
|
-
{
|
|
258
|
-
"base_template_id": base_template_id,
|
|
259
|
-
"deployment_id": deployment_id,
|
|
260
|
-
"description": description,
|
|
261
|
-
"entity_id": entity_id,
|
|
262
|
-
"hidden": hidden,
|
|
263
|
-
"is_template": is_template,
|
|
264
|
-
"label": label,
|
|
265
|
-
"limit": limit,
|
|
266
|
-
"metadata": metadata,
|
|
267
|
-
"name": name,
|
|
268
|
-
"preserve_on_migration": preserve_on_migration,
|
|
269
|
-
"project_id": project_id,
|
|
270
|
-
"read_only": read_only,
|
|
271
|
-
"value": value,
|
|
272
|
-
},
|
|
273
|
-
block_update_params.BlockUpdateParams,
|
|
274
|
-
),
|
|
275
|
-
options=make_request_options(
|
|
276
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
277
|
-
),
|
|
278
|
-
cast_to=Block,
|
|
189
|
+
cast_to=BlockRetrieveResponse,
|
|
279
190
|
)
|
|
280
191
|
|
|
281
192
|
def list(
|
|
@@ -304,7 +215,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
304
215
|
extra_query: Query | None = None,
|
|
305
216
|
extra_body: Body | None = None,
|
|
306
217
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
307
|
-
) -> SyncArrayPage[
|
|
218
|
+
) -> SyncArrayPage[BlockListResponse]:
|
|
308
219
|
"""List Blocks
|
|
309
220
|
|
|
310
221
|
Args:
|
|
@@ -362,7 +273,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
362
273
|
"""
|
|
363
274
|
return self._get_api_list(
|
|
364
275
|
"/v1/blocks/",
|
|
365
|
-
page=SyncArrayPage[
|
|
276
|
+
page=SyncArrayPage[BlockListResponse],
|
|
366
277
|
options=make_request_options(
|
|
367
278
|
extra_headers=extra_headers,
|
|
368
279
|
extra_query=extra_query,
|
|
@@ -391,7 +302,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
391
302
|
block_list_params.BlockListParams,
|
|
392
303
|
),
|
|
393
304
|
),
|
|
394
|
-
model=
|
|
305
|
+
model=BlockListResponse,
|
|
395
306
|
)
|
|
396
307
|
|
|
397
308
|
def delete(
|
|
@@ -448,62 +359,37 @@ class BlocksResource(SyncAPIResource):
|
|
|
448
359
|
cast_to=int,
|
|
449
360
|
)
|
|
450
361
|
|
|
451
|
-
|
|
452
|
-
class AsyncBlocksResource(AsyncAPIResource):
|
|
453
|
-
@cached_property
|
|
454
|
-
def agents(self) -> AsyncAgentsResource:
|
|
455
|
-
return AsyncAgentsResource(self._client)
|
|
456
|
-
|
|
457
|
-
@cached_property
|
|
458
|
-
def with_raw_response(self) -> AsyncBlocksResourceWithRawResponse:
|
|
459
|
-
"""
|
|
460
|
-
This property can be used as a prefix for any HTTP method call to return
|
|
461
|
-
the raw response object instead of the parsed content.
|
|
462
|
-
|
|
463
|
-
For more information, see https://www.github.com/letta-ai/letta-python#accessing-raw-response-data-eg-headers
|
|
464
|
-
"""
|
|
465
|
-
return AsyncBlocksResourceWithRawResponse(self)
|
|
466
|
-
|
|
467
|
-
@cached_property
|
|
468
|
-
def with_streaming_response(self) -> AsyncBlocksResourceWithStreamingResponse:
|
|
469
|
-
"""
|
|
470
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
471
|
-
|
|
472
|
-
For more information, see https://www.github.com/letta-ai/letta-python#with_streaming_response
|
|
473
|
-
"""
|
|
474
|
-
return AsyncBlocksResourceWithStreamingResponse(self)
|
|
475
|
-
|
|
476
|
-
async def create(
|
|
362
|
+
def modify(
|
|
477
363
|
self,
|
|
364
|
+
block_id: str,
|
|
478
365
|
*,
|
|
479
|
-
label: str,
|
|
480
|
-
value: str,
|
|
481
366
|
base_template_id: Optional[str] | Omit = omit,
|
|
482
367
|
deployment_id: Optional[str] | Omit = omit,
|
|
483
368
|
description: Optional[str] | Omit = omit,
|
|
484
369
|
entity_id: Optional[str] | Omit = omit,
|
|
485
370
|
hidden: Optional[bool] | Omit = omit,
|
|
486
371
|
is_template: bool | Omit = omit,
|
|
487
|
-
|
|
372
|
+
label: Optional[str] | Omit = omit,
|
|
373
|
+
limit: Optional[int] | Omit = omit,
|
|
488
374
|
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
489
|
-
name: Optional[str] | Omit = omit,
|
|
490
375
|
preserve_on_migration: Optional[bool] | Omit = omit,
|
|
491
376
|
project_id: Optional[str] | Omit = omit,
|
|
492
377
|
read_only: bool | Omit = omit,
|
|
378
|
+
template_id: Optional[str] | Omit = omit,
|
|
379
|
+
template_name: Optional[str] | Omit = omit,
|
|
380
|
+
value: Optional[str] | Omit = omit,
|
|
493
381
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
494
382
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
495
383
|
extra_headers: Headers | None = None,
|
|
496
384
|
extra_query: Query | None = None,
|
|
497
385
|
extra_body: Body | None = None,
|
|
498
386
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
499
|
-
) ->
|
|
387
|
+
) -> BlockModifyResponse:
|
|
500
388
|
"""
|
|
501
|
-
|
|
389
|
+
Modify Block
|
|
502
390
|
|
|
503
391
|
Args:
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
value: Value of the block.
|
|
392
|
+
block_id: The ID of the block in the format 'block-<uuid4>'
|
|
507
393
|
|
|
508
394
|
base_template_id: The base template id of the block.
|
|
509
395
|
|
|
@@ -515,18 +401,26 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
515
401
|
|
|
516
402
|
hidden: If set to True, the block will be hidden.
|
|
517
403
|
|
|
404
|
+
is_template: Whether the block is a template (e.g. saved human/persona options).
|
|
405
|
+
|
|
406
|
+
label: Label of the block (e.g. 'human', 'persona') in the context window.
|
|
407
|
+
|
|
518
408
|
limit: Character limit of the block.
|
|
519
409
|
|
|
520
410
|
metadata: Metadata of the block.
|
|
521
411
|
|
|
522
|
-
name: The id of the template.
|
|
523
|
-
|
|
524
412
|
preserve_on_migration: Preserve the block on template migration.
|
|
525
413
|
|
|
526
414
|
project_id: The associated project id.
|
|
527
415
|
|
|
528
416
|
read_only: Whether the agent has read-only access to the block.
|
|
529
417
|
|
|
418
|
+
template_id: The id of the template.
|
|
419
|
+
|
|
420
|
+
template_name: Name of the block if it is a template.
|
|
421
|
+
|
|
422
|
+
value: Value of the block.
|
|
423
|
+
|
|
530
424
|
extra_headers: Send extra headers
|
|
531
425
|
|
|
532
426
|
extra_query: Add additional query parameters to the request
|
|
@@ -535,98 +429,93 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
535
429
|
|
|
536
430
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
537
431
|
"""
|
|
538
|
-
|
|
539
|
-
"
|
|
540
|
-
|
|
432
|
+
if not block_id:
|
|
433
|
+
raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}")
|
|
434
|
+
return self._patch(
|
|
435
|
+
f"/v1/blocks/{block_id}",
|
|
436
|
+
body=maybe_transform(
|
|
541
437
|
{
|
|
542
|
-
"label": label,
|
|
543
|
-
"value": value,
|
|
544
438
|
"base_template_id": base_template_id,
|
|
545
439
|
"deployment_id": deployment_id,
|
|
546
440
|
"description": description,
|
|
547
441
|
"entity_id": entity_id,
|
|
548
442
|
"hidden": hidden,
|
|
549
443
|
"is_template": is_template,
|
|
444
|
+
"label": label,
|
|
550
445
|
"limit": limit,
|
|
551
446
|
"metadata": metadata,
|
|
552
|
-
"name": name,
|
|
553
447
|
"preserve_on_migration": preserve_on_migration,
|
|
554
448
|
"project_id": project_id,
|
|
555
449
|
"read_only": read_only,
|
|
450
|
+
"template_id": template_id,
|
|
451
|
+
"template_name": template_name,
|
|
452
|
+
"value": value,
|
|
556
453
|
},
|
|
557
|
-
|
|
454
|
+
block_modify_params.BlockModifyParams,
|
|
558
455
|
),
|
|
559
456
|
options=make_request_options(
|
|
560
457
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
561
458
|
),
|
|
562
|
-
cast_to=
|
|
459
|
+
cast_to=BlockModifyResponse,
|
|
563
460
|
)
|
|
564
461
|
|
|
565
|
-
async def retrieve(
|
|
566
|
-
self,
|
|
567
|
-
block_id: str,
|
|
568
|
-
*,
|
|
569
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
570
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
571
|
-
extra_headers: Headers | None = None,
|
|
572
|
-
extra_query: Query | None = None,
|
|
573
|
-
extra_body: Body | None = None,
|
|
574
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
575
|
-
) -> Block:
|
|
576
|
-
"""
|
|
577
|
-
Retrieve Block
|
|
578
462
|
|
|
579
|
-
|
|
580
|
-
|
|
463
|
+
class AsyncBlocksResource(AsyncAPIResource):
|
|
464
|
+
@cached_property
|
|
465
|
+
def agents(self) -> AsyncAgentsResource:
|
|
466
|
+
return AsyncAgentsResource(self._client)
|
|
581
467
|
|
|
582
|
-
|
|
468
|
+
@cached_property
|
|
469
|
+
def with_raw_response(self) -> AsyncBlocksResourceWithRawResponse:
|
|
470
|
+
"""
|
|
471
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
472
|
+
the raw response object instead of the parsed content.
|
|
583
473
|
|
|
584
|
-
|
|
474
|
+
For more information, see https://www.github.com/letta-ai/letta-python#accessing-raw-response-data-eg-headers
|
|
475
|
+
"""
|
|
476
|
+
return AsyncBlocksResourceWithRawResponse(self)
|
|
585
477
|
|
|
586
|
-
|
|
478
|
+
@cached_property
|
|
479
|
+
def with_streaming_response(self) -> AsyncBlocksResourceWithStreamingResponse:
|
|
480
|
+
"""
|
|
481
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
587
482
|
|
|
588
|
-
|
|
483
|
+
For more information, see https://www.github.com/letta-ai/letta-python#with_streaming_response
|
|
589
484
|
"""
|
|
590
|
-
|
|
591
|
-
raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}")
|
|
592
|
-
return await self._get(
|
|
593
|
-
f"/v1/blocks/{block_id}",
|
|
594
|
-
options=make_request_options(
|
|
595
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
596
|
-
),
|
|
597
|
-
cast_to=Block,
|
|
598
|
-
)
|
|
485
|
+
return AsyncBlocksResourceWithStreamingResponse(self)
|
|
599
486
|
|
|
600
|
-
async def
|
|
487
|
+
async def create(
|
|
601
488
|
self,
|
|
602
|
-
block_id: str,
|
|
603
489
|
*,
|
|
490
|
+
label: str,
|
|
491
|
+
value: str,
|
|
604
492
|
base_template_id: Optional[str] | Omit = omit,
|
|
605
493
|
deployment_id: Optional[str] | Omit = omit,
|
|
606
494
|
description: Optional[str] | Omit = omit,
|
|
607
495
|
entity_id: Optional[str] | Omit = omit,
|
|
608
496
|
hidden: Optional[bool] | Omit = omit,
|
|
609
497
|
is_template: bool | Omit = omit,
|
|
610
|
-
|
|
611
|
-
limit: Optional[int] | Omit = omit,
|
|
498
|
+
limit: int | Omit = omit,
|
|
612
499
|
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
613
|
-
name: Optional[str] | Omit = omit,
|
|
614
500
|
preserve_on_migration: Optional[bool] | Omit = omit,
|
|
615
501
|
project_id: Optional[str] | Omit = omit,
|
|
616
502
|
read_only: bool | Omit = omit,
|
|
617
|
-
|
|
503
|
+
template_id: Optional[str] | Omit = omit,
|
|
504
|
+
template_name: Optional[str] | Omit = omit,
|
|
618
505
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
619
506
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
620
507
|
extra_headers: Headers | None = None,
|
|
621
508
|
extra_query: Query | None = None,
|
|
622
509
|
extra_body: Body | None = None,
|
|
623
510
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
624
|
-
) ->
|
|
511
|
+
) -> BlockCreateResponse:
|
|
625
512
|
"""
|
|
626
|
-
|
|
513
|
+
Create Block
|
|
627
514
|
|
|
628
515
|
Args:
|
|
629
|
-
|
|
516
|
+
label: Label of the block.
|
|
517
|
+
|
|
518
|
+
value: Value of the block.
|
|
630
519
|
|
|
631
520
|
base_template_id: The base template id of the block.
|
|
632
521
|
|
|
@@ -638,23 +527,19 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
638
527
|
|
|
639
528
|
hidden: If set to True, the block will be hidden.
|
|
640
529
|
|
|
641
|
-
is_template: Whether the block is a template (e.g. saved human/persona options).
|
|
642
|
-
|
|
643
|
-
label: Label of the block (e.g. 'human', 'persona') in the context window.
|
|
644
|
-
|
|
645
530
|
limit: Character limit of the block.
|
|
646
531
|
|
|
647
532
|
metadata: Metadata of the block.
|
|
648
533
|
|
|
649
|
-
name: The id of the template.
|
|
650
|
-
|
|
651
534
|
preserve_on_migration: Preserve the block on template migration.
|
|
652
535
|
|
|
653
536
|
project_id: The associated project id.
|
|
654
537
|
|
|
655
538
|
read_only: Whether the agent has read-only access to the block.
|
|
656
539
|
|
|
657
|
-
|
|
540
|
+
template_id: The id of the template.
|
|
541
|
+
|
|
542
|
+
template_name: Name of the block if it is a template.
|
|
658
543
|
|
|
659
544
|
extra_headers: Send extra headers
|
|
660
545
|
|
|
@@ -664,33 +549,67 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
664
549
|
|
|
665
550
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
666
551
|
"""
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
return await self._patch(
|
|
670
|
-
f"/v1/blocks/{block_id}",
|
|
552
|
+
return await self._post(
|
|
553
|
+
"/v1/blocks/",
|
|
671
554
|
body=await async_maybe_transform(
|
|
672
555
|
{
|
|
556
|
+
"label": label,
|
|
557
|
+
"value": value,
|
|
673
558
|
"base_template_id": base_template_id,
|
|
674
559
|
"deployment_id": deployment_id,
|
|
675
560
|
"description": description,
|
|
676
561
|
"entity_id": entity_id,
|
|
677
562
|
"hidden": hidden,
|
|
678
563
|
"is_template": is_template,
|
|
679
|
-
"label": label,
|
|
680
564
|
"limit": limit,
|
|
681
565
|
"metadata": metadata,
|
|
682
|
-
"name": name,
|
|
683
566
|
"preserve_on_migration": preserve_on_migration,
|
|
684
567
|
"project_id": project_id,
|
|
685
568
|
"read_only": read_only,
|
|
686
|
-
"
|
|
569
|
+
"template_id": template_id,
|
|
570
|
+
"template_name": template_name,
|
|
687
571
|
},
|
|
688
|
-
|
|
572
|
+
block_create_params.BlockCreateParams,
|
|
689
573
|
),
|
|
690
574
|
options=make_request_options(
|
|
691
575
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
692
576
|
),
|
|
693
|
-
cast_to=
|
|
577
|
+
cast_to=BlockCreateResponse,
|
|
578
|
+
)
|
|
579
|
+
|
|
580
|
+
async def retrieve(
|
|
581
|
+
self,
|
|
582
|
+
block_id: str,
|
|
583
|
+
*,
|
|
584
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
585
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
586
|
+
extra_headers: Headers | None = None,
|
|
587
|
+
extra_query: Query | None = None,
|
|
588
|
+
extra_body: Body | None = None,
|
|
589
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
590
|
+
) -> BlockRetrieveResponse:
|
|
591
|
+
"""
|
|
592
|
+
Retrieve Block
|
|
593
|
+
|
|
594
|
+
Args:
|
|
595
|
+
block_id: The ID of the block in the format 'block-<uuid4>'
|
|
596
|
+
|
|
597
|
+
extra_headers: Send extra headers
|
|
598
|
+
|
|
599
|
+
extra_query: Add additional query parameters to the request
|
|
600
|
+
|
|
601
|
+
extra_body: Add additional JSON properties to the request
|
|
602
|
+
|
|
603
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
604
|
+
"""
|
|
605
|
+
if not block_id:
|
|
606
|
+
raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}")
|
|
607
|
+
return await self._get(
|
|
608
|
+
f"/v1/blocks/{block_id}",
|
|
609
|
+
options=make_request_options(
|
|
610
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
611
|
+
),
|
|
612
|
+
cast_to=BlockRetrieveResponse,
|
|
694
613
|
)
|
|
695
614
|
|
|
696
615
|
def list(
|
|
@@ -719,7 +638,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
719
638
|
extra_query: Query | None = None,
|
|
720
639
|
extra_body: Body | None = None,
|
|
721
640
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
722
|
-
) -> AsyncPaginator[
|
|
641
|
+
) -> AsyncPaginator[BlockListResponse, AsyncArrayPage[BlockListResponse]]:
|
|
723
642
|
"""List Blocks
|
|
724
643
|
|
|
725
644
|
Args:
|
|
@@ -777,7 +696,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
777
696
|
"""
|
|
778
697
|
return self._get_api_list(
|
|
779
698
|
"/v1/blocks/",
|
|
780
|
-
page=AsyncArrayPage[
|
|
699
|
+
page=AsyncArrayPage[BlockListResponse],
|
|
781
700
|
options=make_request_options(
|
|
782
701
|
extra_headers=extra_headers,
|
|
783
702
|
extra_query=extra_query,
|
|
@@ -806,7 +725,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
806
725
|
block_list_params.BlockListParams,
|
|
807
726
|
),
|
|
808
727
|
),
|
|
809
|
-
model=
|
|
728
|
+
model=BlockListResponse,
|
|
810
729
|
)
|
|
811
730
|
|
|
812
731
|
async def delete(
|
|
@@ -863,6 +782,106 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
863
782
|
cast_to=int,
|
|
864
783
|
)
|
|
865
784
|
|
|
785
|
+
async def modify(
|
|
786
|
+
self,
|
|
787
|
+
block_id: str,
|
|
788
|
+
*,
|
|
789
|
+
base_template_id: Optional[str] | Omit = omit,
|
|
790
|
+
deployment_id: Optional[str] | Omit = omit,
|
|
791
|
+
description: Optional[str] | Omit = omit,
|
|
792
|
+
entity_id: Optional[str] | Omit = omit,
|
|
793
|
+
hidden: Optional[bool] | Omit = omit,
|
|
794
|
+
is_template: bool | Omit = omit,
|
|
795
|
+
label: Optional[str] | Omit = omit,
|
|
796
|
+
limit: Optional[int] | Omit = omit,
|
|
797
|
+
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
798
|
+
preserve_on_migration: Optional[bool] | Omit = omit,
|
|
799
|
+
project_id: Optional[str] | Omit = omit,
|
|
800
|
+
read_only: bool | Omit = omit,
|
|
801
|
+
template_id: Optional[str] | Omit = omit,
|
|
802
|
+
template_name: Optional[str] | Omit = omit,
|
|
803
|
+
value: Optional[str] | Omit = omit,
|
|
804
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
805
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
806
|
+
extra_headers: Headers | None = None,
|
|
807
|
+
extra_query: Query | None = None,
|
|
808
|
+
extra_body: Body | None = None,
|
|
809
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
810
|
+
) -> BlockModifyResponse:
|
|
811
|
+
"""
|
|
812
|
+
Modify Block
|
|
813
|
+
|
|
814
|
+
Args:
|
|
815
|
+
block_id: The ID of the block in the format 'block-<uuid4>'
|
|
816
|
+
|
|
817
|
+
base_template_id: The base template id of the block.
|
|
818
|
+
|
|
819
|
+
deployment_id: The id of the deployment.
|
|
820
|
+
|
|
821
|
+
description: Description of the block.
|
|
822
|
+
|
|
823
|
+
entity_id: The id of the entity within the template.
|
|
824
|
+
|
|
825
|
+
hidden: If set to True, the block will be hidden.
|
|
826
|
+
|
|
827
|
+
is_template: Whether the block is a template (e.g. saved human/persona options).
|
|
828
|
+
|
|
829
|
+
label: Label of the block (e.g. 'human', 'persona') in the context window.
|
|
830
|
+
|
|
831
|
+
limit: Character limit of the block.
|
|
832
|
+
|
|
833
|
+
metadata: Metadata of the block.
|
|
834
|
+
|
|
835
|
+
preserve_on_migration: Preserve the block on template migration.
|
|
836
|
+
|
|
837
|
+
project_id: The associated project id.
|
|
838
|
+
|
|
839
|
+
read_only: Whether the agent has read-only access to the block.
|
|
840
|
+
|
|
841
|
+
template_id: The id of the template.
|
|
842
|
+
|
|
843
|
+
template_name: Name of the block if it is a template.
|
|
844
|
+
|
|
845
|
+
value: Value of the block.
|
|
846
|
+
|
|
847
|
+
extra_headers: Send extra headers
|
|
848
|
+
|
|
849
|
+
extra_query: Add additional query parameters to the request
|
|
850
|
+
|
|
851
|
+
extra_body: Add additional JSON properties to the request
|
|
852
|
+
|
|
853
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
854
|
+
"""
|
|
855
|
+
if not block_id:
|
|
856
|
+
raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}")
|
|
857
|
+
return await self._patch(
|
|
858
|
+
f"/v1/blocks/{block_id}",
|
|
859
|
+
body=await async_maybe_transform(
|
|
860
|
+
{
|
|
861
|
+
"base_template_id": base_template_id,
|
|
862
|
+
"deployment_id": deployment_id,
|
|
863
|
+
"description": description,
|
|
864
|
+
"entity_id": entity_id,
|
|
865
|
+
"hidden": hidden,
|
|
866
|
+
"is_template": is_template,
|
|
867
|
+
"label": label,
|
|
868
|
+
"limit": limit,
|
|
869
|
+
"metadata": metadata,
|
|
870
|
+
"preserve_on_migration": preserve_on_migration,
|
|
871
|
+
"project_id": project_id,
|
|
872
|
+
"read_only": read_only,
|
|
873
|
+
"template_id": template_id,
|
|
874
|
+
"template_name": template_name,
|
|
875
|
+
"value": value,
|
|
876
|
+
},
|
|
877
|
+
block_modify_params.BlockModifyParams,
|
|
878
|
+
),
|
|
879
|
+
options=make_request_options(
|
|
880
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
881
|
+
),
|
|
882
|
+
cast_to=BlockModifyResponse,
|
|
883
|
+
)
|
|
884
|
+
|
|
866
885
|
|
|
867
886
|
class BlocksResourceWithRawResponse:
|
|
868
887
|
def __init__(self, blocks: BlocksResource) -> None:
|
|
@@ -874,9 +893,6 @@ class BlocksResourceWithRawResponse:
|
|
|
874
893
|
self.retrieve = to_raw_response_wrapper(
|
|
875
894
|
blocks.retrieve,
|
|
876
895
|
)
|
|
877
|
-
self.update = to_raw_response_wrapper(
|
|
878
|
-
blocks.update,
|
|
879
|
-
)
|
|
880
896
|
self.list = to_raw_response_wrapper(
|
|
881
897
|
blocks.list,
|
|
882
898
|
)
|
|
@@ -886,6 +902,9 @@ class BlocksResourceWithRawResponse:
|
|
|
886
902
|
self.count = to_raw_response_wrapper(
|
|
887
903
|
blocks.count,
|
|
888
904
|
)
|
|
905
|
+
self.modify = to_raw_response_wrapper(
|
|
906
|
+
blocks.modify,
|
|
907
|
+
)
|
|
889
908
|
|
|
890
909
|
@cached_property
|
|
891
910
|
def agents(self) -> AgentsResourceWithRawResponse:
|
|
@@ -902,9 +921,6 @@ class AsyncBlocksResourceWithRawResponse:
|
|
|
902
921
|
self.retrieve = async_to_raw_response_wrapper(
|
|
903
922
|
blocks.retrieve,
|
|
904
923
|
)
|
|
905
|
-
self.update = async_to_raw_response_wrapper(
|
|
906
|
-
blocks.update,
|
|
907
|
-
)
|
|
908
924
|
self.list = async_to_raw_response_wrapper(
|
|
909
925
|
blocks.list,
|
|
910
926
|
)
|
|
@@ -914,6 +930,9 @@ class AsyncBlocksResourceWithRawResponse:
|
|
|
914
930
|
self.count = async_to_raw_response_wrapper(
|
|
915
931
|
blocks.count,
|
|
916
932
|
)
|
|
933
|
+
self.modify = async_to_raw_response_wrapper(
|
|
934
|
+
blocks.modify,
|
|
935
|
+
)
|
|
917
936
|
|
|
918
937
|
@cached_property
|
|
919
938
|
def agents(self) -> AsyncAgentsResourceWithRawResponse:
|
|
@@ -930,9 +949,6 @@ class BlocksResourceWithStreamingResponse:
|
|
|
930
949
|
self.retrieve = to_streamed_response_wrapper(
|
|
931
950
|
blocks.retrieve,
|
|
932
951
|
)
|
|
933
|
-
self.update = to_streamed_response_wrapper(
|
|
934
|
-
blocks.update,
|
|
935
|
-
)
|
|
936
952
|
self.list = to_streamed_response_wrapper(
|
|
937
953
|
blocks.list,
|
|
938
954
|
)
|
|
@@ -942,6 +958,9 @@ class BlocksResourceWithStreamingResponse:
|
|
|
942
958
|
self.count = to_streamed_response_wrapper(
|
|
943
959
|
blocks.count,
|
|
944
960
|
)
|
|
961
|
+
self.modify = to_streamed_response_wrapper(
|
|
962
|
+
blocks.modify,
|
|
963
|
+
)
|
|
945
964
|
|
|
946
965
|
@cached_property
|
|
947
966
|
def agents(self) -> AgentsResourceWithStreamingResponse:
|
|
@@ -958,9 +977,6 @@ class AsyncBlocksResourceWithStreamingResponse:
|
|
|
958
977
|
self.retrieve = async_to_streamed_response_wrapper(
|
|
959
978
|
blocks.retrieve,
|
|
960
979
|
)
|
|
961
|
-
self.update = async_to_streamed_response_wrapper(
|
|
962
|
-
blocks.update,
|
|
963
|
-
)
|
|
964
980
|
self.list = async_to_streamed_response_wrapper(
|
|
965
981
|
blocks.list,
|
|
966
982
|
)
|
|
@@ -970,6 +986,9 @@ class AsyncBlocksResourceWithStreamingResponse:
|
|
|
970
986
|
self.count = async_to_streamed_response_wrapper(
|
|
971
987
|
blocks.count,
|
|
972
988
|
)
|
|
989
|
+
self.modify = async_to_streamed_response_wrapper(
|
|
990
|
+
blocks.modify,
|
|
991
|
+
)
|
|
973
992
|
|
|
974
993
|
@cached_property
|
|
975
994
|
def agents(self) -> AsyncAgentsResourceWithStreamingResponse:
|