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