letta-client 0.1.17__py3-none-any.whl → 0.1.19__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.
- letta_client/__init__.py +34 -116
- letta_client/agents/__init__.py +17 -42
- letta_client/agents/archival_memory/client.py +19 -212
- letta_client/agents/client.py +1633 -336
- letta_client/agents/context/client.py +6 -4
- letta_client/agents/core_memory/client.py +97 -499
- letta_client/agents/memory_variables/__init__.py +2 -2
- letta_client/agents/memory_variables/client.py +13 -13
- letta_client/agents/memory_variables/types/__init__.py +2 -2
- letta_client/agents/memory_variables/types/{memory_variables_get_response.py → memory_variables_list_response.py} +1 -1
- letta_client/agents/messages/__init__.py +2 -22
- letta_client/agents/messages/client.py +20 -26
- letta_client/agents/messages/types/__init__.py +2 -21
- letta_client/agents/messages/types/letta_streaming_response.py +16 -139
- letta_client/agents/messages/types/messages_list_response.py +2 -2
- letta_client/agents/sources/client.py +266 -5
- letta_client/agents/tools/client.py +25 -27
- letta_client/agents/types/__init__.py +15 -25
- letta_client/agents/types/agents_search_request_search_item.py +10 -78
- letta_client/agents/types/{agents_search_request_search_item_order_by.py → agents_search_request_search_item_direction.py} +7 -6
- letta_client/agents/types/agents_search_request_search_item_direction_direction.py +5 -0
- letta_client/agents/types/agents_search_request_search_item_direction_value.py +5 -0
- letta_client/agents/types/{agents_search_request_search_item_name.py → agents_search_request_search_item_one.py} +5 -4
- letta_client/agents/types/agents_search_request_search_item_one_operator.py +5 -0
- letta_client/agents/types/{agents_search_request_search_item_tags.py → agents_search_request_search_item_two.py} +2 -1
- letta_client/agents/types/{agents_search_request_search_item_version.py → agents_search_request_search_item_zero.py} +3 -2
- letta_client/blocks/client.py +12 -260
- letta_client/client.py +3 -3
- letta_client/core/client_wrapper.py +1 -1
- letta_client/jobs/client.py +4 -4
- letta_client/providers/client.py +4 -4
- letta_client/runs/client.py +14 -12
- letta_client/sources/client.py +12 -288
- letta_client/tools/client.py +63 -69
- letta_client/types/__init__.py +21 -99
- letta_client/types/agent_state.py +3 -7
- letta_client/types/{assistant_message_output.py → assistant_message.py} +3 -2
- letta_client/types/block.py +2 -6
- letta_client/types/block_update.py +1 -5
- letta_client/types/{create_assistant_file_request.py → chat_completion_message_tool_call.py} +7 -7
- letta_client/types/context_window_overview.py +4 -6
- letta_client/types/create_block.py +1 -5
- letta_client/types/{function_call_output.py → function.py} +1 -1
- letta_client/types/{function_schema.py → function_definition.py} +2 -1
- letta_client/types/{function_call_input.py → function_tool.py} +5 -3
- letta_client/types/job.py +1 -5
- letta_client/types/letta_message_union.py +9 -121
- letta_client/types/letta_usage_statistics.py +1 -0
- letta_client/types/{letta_schemas_message_message.py → message.py} +4 -6
- letta_client/types/passage.py +1 -5
- letta_client/types/reasoning_message.py +2 -1
- letta_client/types/run.py +1 -5
- letta_client/types/source.py +2 -6
- letta_client/types/{system_message_output.py → system_message.py} +3 -2
- letta_client/types/{letta_schemas_tool_tool.py → tool.py} +1 -1
- letta_client/types/{letta_schemas_letta_message_tool_call.py → tool_call.py} +1 -1
- letta_client/types/tool_call_message.py +2 -1
- letta_client/types/tool_call_message_tool_call.py +2 -2
- letta_client/types/tool_return_message.py +2 -1
- letta_client/types/tool_type.py +2 -1
- letta_client/types/{user_message_output.py → user_message.py} +3 -2
- {letta_client-0.1.17.dist-info → letta_client-0.1.19.dist-info}/METADATA +1 -1
- {letta_client-0.1.17.dist-info → letta_client-0.1.19.dist-info}/RECORD +64 -95
- letta_client/agents/types/agents_search_request_search_item_name_operator.py +0 -5
- letta_client/agents/types/agents_search_request_search_item_order_by_direction.py +0 -5
- letta_client/agents/types/agents_search_request_search_item_order_by_value.py +0 -5
- letta_client/types/assistant_file.py +0 -33
- letta_client/types/assistant_message_input.py +0 -23
- letta_client/types/chat_completion_request.py +0 -49
- letta_client/types/chat_completion_request_function_call.py +0 -6
- letta_client/types/chat_completion_request_messages_item.py +0 -11
- letta_client/types/chat_completion_request_stop.py +0 -5
- letta_client/types/chat_completion_request_tool_choice.py +0 -8
- letta_client/types/chat_completion_response.py +0 -32
- letta_client/types/choice.py +0 -25
- letta_client/types/create_assistant_request.py +0 -57
- letta_client/types/delete_assistant_file_response.py +0 -28
- letta_client/types/delete_assistant_response.py +0 -28
- letta_client/types/letta_schemas_openai_chat_completion_request_tool.py +0 -21
- letta_client/types/letta_schemas_openai_chat_completion_request_tool_call.py +0 -24
- letta_client/types/letta_schemas_openai_chat_completion_request_tool_call_function.py +0 -20
- letta_client/types/letta_schemas_openai_chat_completion_response_message.py +0 -24
- letta_client/types/letta_schemas_openai_chat_completion_response_tool_call.py +0 -22
- letta_client/types/letta_schemas_openai_chat_completions_tool_call_function.py +0 -27
- letta_client/types/letta_schemas_openai_chat_completions_tool_call_input.py +0 -29
- letta_client/types/letta_schemas_openai_chat_completions_tool_call_output.py +0 -29
- letta_client/types/log_prob_token.py +0 -21
- letta_client/types/message_content_log_prob.py +0 -23
- letta_client/types/open_ai_assistant.py +0 -67
- letta_client/types/response_format.py +0 -19
- letta_client/types/system_message_input.py +0 -21
- letta_client/types/tool_call_function_output.py +0 -27
- letta_client/types/tool_function_choice.py +0 -21
- letta_client/types/tool_input.py +0 -21
- letta_client/types/tool_message.py +0 -21
- letta_client/types/user_message_input.py +0 -22
- letta_client/types/user_message_input_content.py +0 -5
- {letta_client-0.1.17.dist-info → letta_client-0.1.19.dist-info}/WHEEL +0 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from ...core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
-
from .agents_search_request_search_item_name_operator import AgentsSearchRequestSearchItemNameOperator
|
|
5
|
-
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
4
|
import typing
|
|
5
|
+
from .agents_search_request_search_item_one_operator import AgentsSearchRequestSearchItemOneOperator
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
7
|
import pydantic
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class
|
|
11
|
-
|
|
10
|
+
class AgentsSearchRequestSearchItemOne(UncheckedBaseModel):
|
|
11
|
+
field: typing.Literal["name"] = "name"
|
|
12
|
+
operator: AgentsSearchRequestSearchItemOneOperator
|
|
12
13
|
value: str
|
|
13
14
|
|
|
14
15
|
if IS_PYDANTIC_V2:
|
|
@@ -6,7 +6,8 @@ from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
|
6
6
|
import pydantic
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class AgentsSearchRequestSearchItemTwo(UncheckedBaseModel):
|
|
10
|
+
field: typing.Literal["tags"] = "tags"
|
|
10
11
|
operator: typing.Literal["contains"] = "contains"
|
|
11
12
|
value: typing.List[str]
|
|
12
13
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from ...core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
-
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
5
4
|
import typing
|
|
5
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
6
|
import pydantic
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class AgentsSearchRequestSearchItemZero(UncheckedBaseModel):
|
|
10
|
+
field: typing.Literal["version"] = "version"
|
|
10
11
|
value: str
|
|
11
12
|
|
|
12
13
|
if IS_PYDANTIC_V2:
|
letta_client/blocks/client.py
CHANGED
|
@@ -156,7 +156,7 @@ class BlocksClient:
|
|
|
156
156
|
"is_template": is_template,
|
|
157
157
|
"label": label,
|
|
158
158
|
"description": description,
|
|
159
|
-
"
|
|
159
|
+
"metadata": metadata,
|
|
160
160
|
},
|
|
161
161
|
request_options=request_options,
|
|
162
162
|
omit=OMIT,
|
|
@@ -185,7 +185,7 @@ class BlocksClient:
|
|
|
185
185
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
186
186
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
187
187
|
|
|
188
|
-
def
|
|
188
|
+
def retrieve(self, block_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Block:
|
|
189
189
|
"""
|
|
190
190
|
Parameters
|
|
191
191
|
----------
|
|
@@ -206,7 +206,7 @@ class BlocksClient:
|
|
|
206
206
|
client = Letta(
|
|
207
207
|
token="YOUR_TOKEN",
|
|
208
208
|
)
|
|
209
|
-
client.blocks.
|
|
209
|
+
client.blocks.retrieve(
|
|
210
210
|
block_id="block_id",
|
|
211
211
|
)
|
|
212
212
|
"""
|
|
@@ -293,7 +293,7 @@ class BlocksClient:
|
|
|
293
293
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
294
294
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
295
295
|
|
|
296
|
-
def
|
|
296
|
+
def modify(
|
|
297
297
|
self,
|
|
298
298
|
block_id: str,
|
|
299
299
|
*,
|
|
@@ -347,7 +347,7 @@ class BlocksClient:
|
|
|
347
347
|
client = Letta(
|
|
348
348
|
token="YOUR_TOKEN",
|
|
349
349
|
)
|
|
350
|
-
client.blocks.
|
|
350
|
+
client.blocks.modify(
|
|
351
351
|
block_id="block_id",
|
|
352
352
|
)
|
|
353
353
|
"""
|
|
@@ -361,7 +361,7 @@ class BlocksClient:
|
|
|
361
361
|
"is_template": is_template,
|
|
362
362
|
"label": label,
|
|
363
363
|
"description": description,
|
|
364
|
-
"
|
|
364
|
+
"metadata": metadata,
|
|
365
365
|
},
|
|
366
366
|
request_options=request_options,
|
|
367
367
|
omit=OMIT,
|
|
@@ -390,122 +390,6 @@ class BlocksClient:
|
|
|
390
390
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
391
391
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
392
392
|
|
|
393
|
-
def link_agent_memory_block(
|
|
394
|
-
self, block_id: str, *, agent_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
395
|
-
) -> None:
|
|
396
|
-
"""
|
|
397
|
-
Link a memory block to an agent.
|
|
398
|
-
|
|
399
|
-
Parameters
|
|
400
|
-
----------
|
|
401
|
-
block_id : str
|
|
402
|
-
|
|
403
|
-
agent_id : str
|
|
404
|
-
The unique identifier of the agent to attach the source to.
|
|
405
|
-
|
|
406
|
-
request_options : typing.Optional[RequestOptions]
|
|
407
|
-
Request-specific configuration.
|
|
408
|
-
|
|
409
|
-
Returns
|
|
410
|
-
-------
|
|
411
|
-
None
|
|
412
|
-
|
|
413
|
-
Examples
|
|
414
|
-
--------
|
|
415
|
-
from letta_client import Letta
|
|
416
|
-
|
|
417
|
-
client = Letta(
|
|
418
|
-
token="YOUR_TOKEN",
|
|
419
|
-
)
|
|
420
|
-
client.blocks.link_agent_memory_block(
|
|
421
|
-
block_id="block_id",
|
|
422
|
-
agent_id="agent_id",
|
|
423
|
-
)
|
|
424
|
-
"""
|
|
425
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
426
|
-
f"v1/blocks/{jsonable_encoder(block_id)}/attach",
|
|
427
|
-
method="PATCH",
|
|
428
|
-
params={
|
|
429
|
-
"agent_id": agent_id,
|
|
430
|
-
},
|
|
431
|
-
request_options=request_options,
|
|
432
|
-
)
|
|
433
|
-
try:
|
|
434
|
-
if 200 <= _response.status_code < 300:
|
|
435
|
-
return
|
|
436
|
-
if _response.status_code == 422:
|
|
437
|
-
raise UnprocessableEntityError(
|
|
438
|
-
typing.cast(
|
|
439
|
-
HttpValidationError,
|
|
440
|
-
construct_type(
|
|
441
|
-
type_=HttpValidationError, # type: ignore
|
|
442
|
-
object_=_response.json(),
|
|
443
|
-
),
|
|
444
|
-
)
|
|
445
|
-
)
|
|
446
|
-
_response_json = _response.json()
|
|
447
|
-
except JSONDecodeError:
|
|
448
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
449
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
450
|
-
|
|
451
|
-
def unlink_agent_memory_block(
|
|
452
|
-
self, block_id: str, *, agent_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
453
|
-
) -> None:
|
|
454
|
-
"""
|
|
455
|
-
Unlink a memory block from an agent
|
|
456
|
-
|
|
457
|
-
Parameters
|
|
458
|
-
----------
|
|
459
|
-
block_id : str
|
|
460
|
-
|
|
461
|
-
agent_id : str
|
|
462
|
-
The unique identifier of the agent to attach the source to.
|
|
463
|
-
|
|
464
|
-
request_options : typing.Optional[RequestOptions]
|
|
465
|
-
Request-specific configuration.
|
|
466
|
-
|
|
467
|
-
Returns
|
|
468
|
-
-------
|
|
469
|
-
None
|
|
470
|
-
|
|
471
|
-
Examples
|
|
472
|
-
--------
|
|
473
|
-
from letta_client import Letta
|
|
474
|
-
|
|
475
|
-
client = Letta(
|
|
476
|
-
token="YOUR_TOKEN",
|
|
477
|
-
)
|
|
478
|
-
client.blocks.unlink_agent_memory_block(
|
|
479
|
-
block_id="block_id",
|
|
480
|
-
agent_id="agent_id",
|
|
481
|
-
)
|
|
482
|
-
"""
|
|
483
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
484
|
-
f"v1/blocks/{jsonable_encoder(block_id)}/detach",
|
|
485
|
-
method="PATCH",
|
|
486
|
-
params={
|
|
487
|
-
"agent_id": agent_id,
|
|
488
|
-
},
|
|
489
|
-
request_options=request_options,
|
|
490
|
-
)
|
|
491
|
-
try:
|
|
492
|
-
if 200 <= _response.status_code < 300:
|
|
493
|
-
return
|
|
494
|
-
if _response.status_code == 422:
|
|
495
|
-
raise UnprocessableEntityError(
|
|
496
|
-
typing.cast(
|
|
497
|
-
HttpValidationError,
|
|
498
|
-
construct_type(
|
|
499
|
-
type_=HttpValidationError, # type: ignore
|
|
500
|
-
object_=_response.json(),
|
|
501
|
-
),
|
|
502
|
-
)
|
|
503
|
-
)
|
|
504
|
-
_response_json = _response.json()
|
|
505
|
-
except JSONDecodeError:
|
|
506
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
507
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
508
|
-
|
|
509
393
|
|
|
510
394
|
class AsyncBlocksClient:
|
|
511
395
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -663,7 +547,7 @@ class AsyncBlocksClient:
|
|
|
663
547
|
"is_template": is_template,
|
|
664
548
|
"label": label,
|
|
665
549
|
"description": description,
|
|
666
|
-
"
|
|
550
|
+
"metadata": metadata,
|
|
667
551
|
},
|
|
668
552
|
request_options=request_options,
|
|
669
553
|
omit=OMIT,
|
|
@@ -692,7 +576,7 @@ class AsyncBlocksClient:
|
|
|
692
576
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
693
577
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
694
578
|
|
|
695
|
-
async def
|
|
579
|
+
async def retrieve(self, block_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Block:
|
|
696
580
|
"""
|
|
697
581
|
Parameters
|
|
698
582
|
----------
|
|
@@ -718,7 +602,7 @@ class AsyncBlocksClient:
|
|
|
718
602
|
|
|
719
603
|
|
|
720
604
|
async def main() -> None:
|
|
721
|
-
await client.blocks.
|
|
605
|
+
await client.blocks.retrieve(
|
|
722
606
|
block_id="block_id",
|
|
723
607
|
)
|
|
724
608
|
|
|
@@ -816,7 +700,7 @@ class AsyncBlocksClient:
|
|
|
816
700
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
817
701
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
818
702
|
|
|
819
|
-
async def
|
|
703
|
+
async def modify(
|
|
820
704
|
self,
|
|
821
705
|
block_id: str,
|
|
822
706
|
*,
|
|
@@ -875,7 +759,7 @@ class AsyncBlocksClient:
|
|
|
875
759
|
|
|
876
760
|
|
|
877
761
|
async def main() -> None:
|
|
878
|
-
await client.blocks.
|
|
762
|
+
await client.blocks.modify(
|
|
879
763
|
block_id="block_id",
|
|
880
764
|
)
|
|
881
765
|
|
|
@@ -892,7 +776,7 @@ class AsyncBlocksClient:
|
|
|
892
776
|
"is_template": is_template,
|
|
893
777
|
"label": label,
|
|
894
778
|
"description": description,
|
|
895
|
-
"
|
|
779
|
+
"metadata": metadata,
|
|
896
780
|
},
|
|
897
781
|
request_options=request_options,
|
|
898
782
|
omit=OMIT,
|
|
@@ -920,135 +804,3 @@ class AsyncBlocksClient:
|
|
|
920
804
|
except JSONDecodeError:
|
|
921
805
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
922
806
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
923
|
-
|
|
924
|
-
async def link_agent_memory_block(
|
|
925
|
-
self, block_id: str, *, agent_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
926
|
-
) -> None:
|
|
927
|
-
"""
|
|
928
|
-
Link a memory block to an agent.
|
|
929
|
-
|
|
930
|
-
Parameters
|
|
931
|
-
----------
|
|
932
|
-
block_id : str
|
|
933
|
-
|
|
934
|
-
agent_id : str
|
|
935
|
-
The unique identifier of the agent to attach the source to.
|
|
936
|
-
|
|
937
|
-
request_options : typing.Optional[RequestOptions]
|
|
938
|
-
Request-specific configuration.
|
|
939
|
-
|
|
940
|
-
Returns
|
|
941
|
-
-------
|
|
942
|
-
None
|
|
943
|
-
|
|
944
|
-
Examples
|
|
945
|
-
--------
|
|
946
|
-
import asyncio
|
|
947
|
-
|
|
948
|
-
from letta_client import AsyncLetta
|
|
949
|
-
|
|
950
|
-
client = AsyncLetta(
|
|
951
|
-
token="YOUR_TOKEN",
|
|
952
|
-
)
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
async def main() -> None:
|
|
956
|
-
await client.blocks.link_agent_memory_block(
|
|
957
|
-
block_id="block_id",
|
|
958
|
-
agent_id="agent_id",
|
|
959
|
-
)
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
asyncio.run(main())
|
|
963
|
-
"""
|
|
964
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
965
|
-
f"v1/blocks/{jsonable_encoder(block_id)}/attach",
|
|
966
|
-
method="PATCH",
|
|
967
|
-
params={
|
|
968
|
-
"agent_id": agent_id,
|
|
969
|
-
},
|
|
970
|
-
request_options=request_options,
|
|
971
|
-
)
|
|
972
|
-
try:
|
|
973
|
-
if 200 <= _response.status_code < 300:
|
|
974
|
-
return
|
|
975
|
-
if _response.status_code == 422:
|
|
976
|
-
raise UnprocessableEntityError(
|
|
977
|
-
typing.cast(
|
|
978
|
-
HttpValidationError,
|
|
979
|
-
construct_type(
|
|
980
|
-
type_=HttpValidationError, # type: ignore
|
|
981
|
-
object_=_response.json(),
|
|
982
|
-
),
|
|
983
|
-
)
|
|
984
|
-
)
|
|
985
|
-
_response_json = _response.json()
|
|
986
|
-
except JSONDecodeError:
|
|
987
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
988
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
989
|
-
|
|
990
|
-
async def unlink_agent_memory_block(
|
|
991
|
-
self, block_id: str, *, agent_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
992
|
-
) -> None:
|
|
993
|
-
"""
|
|
994
|
-
Unlink a memory block from an agent
|
|
995
|
-
|
|
996
|
-
Parameters
|
|
997
|
-
----------
|
|
998
|
-
block_id : str
|
|
999
|
-
|
|
1000
|
-
agent_id : str
|
|
1001
|
-
The unique identifier of the agent to attach the source to.
|
|
1002
|
-
|
|
1003
|
-
request_options : typing.Optional[RequestOptions]
|
|
1004
|
-
Request-specific configuration.
|
|
1005
|
-
|
|
1006
|
-
Returns
|
|
1007
|
-
-------
|
|
1008
|
-
None
|
|
1009
|
-
|
|
1010
|
-
Examples
|
|
1011
|
-
--------
|
|
1012
|
-
import asyncio
|
|
1013
|
-
|
|
1014
|
-
from letta_client import AsyncLetta
|
|
1015
|
-
|
|
1016
|
-
client = AsyncLetta(
|
|
1017
|
-
token="YOUR_TOKEN",
|
|
1018
|
-
)
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
async def main() -> None:
|
|
1022
|
-
await client.blocks.unlink_agent_memory_block(
|
|
1023
|
-
block_id="block_id",
|
|
1024
|
-
agent_id="agent_id",
|
|
1025
|
-
)
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
asyncio.run(main())
|
|
1029
|
-
"""
|
|
1030
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
1031
|
-
f"v1/blocks/{jsonable_encoder(block_id)}/detach",
|
|
1032
|
-
method="PATCH",
|
|
1033
|
-
params={
|
|
1034
|
-
"agent_id": agent_id,
|
|
1035
|
-
},
|
|
1036
|
-
request_options=request_options,
|
|
1037
|
-
)
|
|
1038
|
-
try:
|
|
1039
|
-
if 200 <= _response.status_code < 300:
|
|
1040
|
-
return
|
|
1041
|
-
if _response.status_code == 422:
|
|
1042
|
-
raise UnprocessableEntityError(
|
|
1043
|
-
typing.cast(
|
|
1044
|
-
HttpValidationError,
|
|
1045
|
-
construct_type(
|
|
1046
|
-
type_=HttpValidationError, # type: ignore
|
|
1047
|
-
object_=_response.json(),
|
|
1048
|
-
),
|
|
1049
|
-
)
|
|
1050
|
-
)
|
|
1051
|
-
_response_json = _response.json()
|
|
1052
|
-
except JSONDecodeError:
|
|
1053
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1054
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
letta_client/client.py
CHANGED
|
@@ -5,7 +5,7 @@ from textwrap import dedent
|
|
|
5
5
|
from .base_client import AsyncLettaBase, LettaBase
|
|
6
6
|
from .core.request_options import RequestOptions
|
|
7
7
|
from .tools.client import ToolsClient as ToolsClientBase
|
|
8
|
-
from .types.
|
|
8
|
+
from .types.tool import Tool
|
|
9
9
|
|
|
10
10
|
# this is used as the default value for optional parameters
|
|
11
11
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -40,7 +40,7 @@ class ToolsClient(ToolsClientBase):
|
|
|
40
40
|
] = OMIT,
|
|
41
41
|
return_char_limit: typing.Optional[int] = OMIT,
|
|
42
42
|
request_options: typing.Optional[RequestOptions] = None,
|
|
43
|
-
) ->
|
|
43
|
+
) -> Tool:
|
|
44
44
|
source_code = dedent(inspect.getsource(func))
|
|
45
45
|
return self.create(
|
|
46
46
|
source_code=source_code,
|
|
@@ -66,7 +66,7 @@ class ToolsClient(ToolsClientBase):
|
|
|
66
66
|
] = OMIT,
|
|
67
67
|
return_char_limit: typing.Optional[int] = OMIT,
|
|
68
68
|
request_options: typing.Optional[RequestOptions] = None,
|
|
69
|
-
) ->
|
|
69
|
+
) -> Tool:
|
|
70
70
|
source_code = dedent(inspect.getsource(func))
|
|
71
71
|
return self.upsert(
|
|
72
72
|
source_code=source_code,
|
|
@@ -16,7 +16,7 @@ class BaseClientWrapper:
|
|
|
16
16
|
headers: typing.Dict[str, str] = {
|
|
17
17
|
"X-Fern-Language": "Python",
|
|
18
18
|
"X-Fern-SDK-Name": "letta-client",
|
|
19
|
-
"X-Fern-SDK-Version": "0.1.
|
|
19
|
+
"X-Fern-SDK-Version": "0.1.19",
|
|
20
20
|
}
|
|
21
21
|
if self.token is not None:
|
|
22
22
|
headers["Authorization"] = f"Bearer {self.token}"
|
letta_client/jobs/client.py
CHANGED
|
@@ -129,7 +129,7 @@ class JobsClient:
|
|
|
129
129
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
130
130
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
131
131
|
|
|
132
|
-
def
|
|
132
|
+
def retrieve(self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Job:
|
|
133
133
|
"""
|
|
134
134
|
Get the status of a job.
|
|
135
135
|
|
|
@@ -152,7 +152,7 @@ class JobsClient:
|
|
|
152
152
|
client = Letta(
|
|
153
153
|
token="YOUR_TOKEN",
|
|
154
154
|
)
|
|
155
|
-
client.jobs.
|
|
155
|
+
client.jobs.retrieve(
|
|
156
156
|
job_id="job_id",
|
|
157
157
|
)
|
|
158
158
|
"""
|
|
@@ -374,7 +374,7 @@ class AsyncJobsClient:
|
|
|
374
374
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
375
375
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
376
376
|
|
|
377
|
-
async def
|
|
377
|
+
async def retrieve(self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Job:
|
|
378
378
|
"""
|
|
379
379
|
Get the status of a job.
|
|
380
380
|
|
|
@@ -402,7 +402,7 @@ class AsyncJobsClient:
|
|
|
402
402
|
|
|
403
403
|
|
|
404
404
|
async def main() -> None:
|
|
405
|
-
await client.jobs.
|
|
405
|
+
await client.jobs.retrieve(
|
|
406
406
|
job_id="job_id",
|
|
407
407
|
)
|
|
408
408
|
|
letta_client/providers/client.py
CHANGED
|
@@ -218,7 +218,7 @@ class ProvidersClient:
|
|
|
218
218
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
219
219
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
220
220
|
|
|
221
|
-
def
|
|
221
|
+
def modify_provider(
|
|
222
222
|
self, *, id: str, api_key: str, request_options: typing.Optional[RequestOptions] = None
|
|
223
223
|
) -> Provider:
|
|
224
224
|
"""
|
|
@@ -247,7 +247,7 @@ class ProvidersClient:
|
|
|
247
247
|
client = Letta(
|
|
248
248
|
token="YOUR_TOKEN",
|
|
249
249
|
)
|
|
250
|
-
client.providers.
|
|
250
|
+
client.providers.modify_provider(
|
|
251
251
|
id="id",
|
|
252
252
|
api_key="api_key",
|
|
253
253
|
)
|
|
@@ -517,7 +517,7 @@ class AsyncProvidersClient:
|
|
|
517
517
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
518
518
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
519
519
|
|
|
520
|
-
async def
|
|
520
|
+
async def modify_provider(
|
|
521
521
|
self, *, id: str, api_key: str, request_options: typing.Optional[RequestOptions] = None
|
|
522
522
|
) -> Provider:
|
|
523
523
|
"""
|
|
@@ -551,7 +551,7 @@ class AsyncProvidersClient:
|
|
|
551
551
|
|
|
552
552
|
|
|
553
553
|
async def main() -> None:
|
|
554
|
-
await client.providers.
|
|
554
|
+
await client.providers.modify_provider(
|
|
555
555
|
id="id",
|
|
556
556
|
api_key="api_key",
|
|
557
557
|
)
|
letta_client/runs/client.py
CHANGED
|
@@ -124,7 +124,7 @@ class RunsClient:
|
|
|
124
124
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
125
125
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
126
126
|
|
|
127
|
-
def
|
|
127
|
+
def retrieve_run(self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Run:
|
|
128
128
|
"""
|
|
129
129
|
Get the status of a run.
|
|
130
130
|
|
|
@@ -147,7 +147,7 @@ class RunsClient:
|
|
|
147
147
|
client = Letta(
|
|
148
148
|
token="YOUR_TOKEN",
|
|
149
149
|
)
|
|
150
|
-
client.runs.
|
|
150
|
+
client.runs.retrieve_run(
|
|
151
151
|
run_id="run_id",
|
|
152
152
|
)
|
|
153
153
|
"""
|
|
@@ -236,7 +236,7 @@ class RunsClient:
|
|
|
236
236
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
237
237
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
238
238
|
|
|
239
|
-
def
|
|
239
|
+
def list_run_messages(
|
|
240
240
|
self,
|
|
241
241
|
run_id: str,
|
|
242
242
|
*,
|
|
@@ -292,7 +292,7 @@ class RunsClient:
|
|
|
292
292
|
client = Letta(
|
|
293
293
|
token="YOUR_TOKEN",
|
|
294
294
|
)
|
|
295
|
-
client.runs.
|
|
295
|
+
client.runs.list_run_messages(
|
|
296
296
|
run_id="run_id",
|
|
297
297
|
)
|
|
298
298
|
"""
|
|
@@ -331,7 +331,9 @@ class RunsClient:
|
|
|
331
331
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
332
332
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
333
333
|
|
|
334
|
-
def
|
|
334
|
+
def retrieve_run_usage(
|
|
335
|
+
self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
336
|
+
) -> UsageStatistics:
|
|
335
337
|
"""
|
|
336
338
|
Get usage statistics for a run.
|
|
337
339
|
|
|
@@ -354,7 +356,7 @@ class RunsClient:
|
|
|
354
356
|
client = Letta(
|
|
355
357
|
token="YOUR_TOKEN",
|
|
356
358
|
)
|
|
357
|
-
client.runs.
|
|
359
|
+
client.runs.retrieve_run_usage(
|
|
358
360
|
run_id="run_id",
|
|
359
361
|
)
|
|
360
362
|
"""
|
|
@@ -512,7 +514,7 @@ class AsyncRunsClient:
|
|
|
512
514
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
513
515
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
514
516
|
|
|
515
|
-
async def
|
|
517
|
+
async def retrieve_run(self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Run:
|
|
516
518
|
"""
|
|
517
519
|
Get the status of a run.
|
|
518
520
|
|
|
@@ -540,7 +542,7 @@ class AsyncRunsClient:
|
|
|
540
542
|
|
|
541
543
|
|
|
542
544
|
async def main() -> None:
|
|
543
|
-
await client.runs.
|
|
545
|
+
await client.runs.retrieve_run(
|
|
544
546
|
run_id="run_id",
|
|
545
547
|
)
|
|
546
548
|
|
|
@@ -640,7 +642,7 @@ class AsyncRunsClient:
|
|
|
640
642
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
641
643
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
642
644
|
|
|
643
|
-
async def
|
|
645
|
+
async def list_run_messages(
|
|
644
646
|
self,
|
|
645
647
|
run_id: str,
|
|
646
648
|
*,
|
|
@@ -701,7 +703,7 @@ class AsyncRunsClient:
|
|
|
701
703
|
|
|
702
704
|
|
|
703
705
|
async def main() -> None:
|
|
704
|
-
await client.runs.
|
|
706
|
+
await client.runs.list_run_messages(
|
|
705
707
|
run_id="run_id",
|
|
706
708
|
)
|
|
707
709
|
|
|
@@ -743,7 +745,7 @@ class AsyncRunsClient:
|
|
|
743
745
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
744
746
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
745
747
|
|
|
746
|
-
async def
|
|
748
|
+
async def retrieve_run_usage(
|
|
747
749
|
self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
748
750
|
) -> UsageStatistics:
|
|
749
751
|
"""
|
|
@@ -773,7 +775,7 @@ class AsyncRunsClient:
|
|
|
773
775
|
|
|
774
776
|
|
|
775
777
|
async def main() -> None:
|
|
776
|
-
await client.runs.
|
|
778
|
+
await client.runs.retrieve_run_usage(
|
|
777
779
|
run_id="run_id",
|
|
778
780
|
)
|
|
779
781
|
|