letta-client 0.1.17__py3-none-any.whl → 0.1.21__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 +44 -116
- letta_client/agents/__init__.py +18 -42
- letta_client/agents/archival_memory/client.py +6 -6
- letta_client/agents/client.py +28 -18
- letta_client/agents/context/client.py +6 -4
- letta_client/agents/core_memory/client.py +152 -227
- letta_client/agents/memory_variables/__init__.py +2 -2
- letta_client/agents/memory_variables/client.py +15 -15
- 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 +39 -40
- letta_client/agents/messages/types/__init__.py +3 -21
- letta_client/agents/messages/types/letta_streaming_response.py +16 -139
- letta_client/agents/messages/types/message_update_content.py +6 -0
- 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 +45 -166
- 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 +10 -10
- letta_client/runs/client.py +44 -30
- letta_client/sources/client.py +12 -288
- letta_client/sources/files/client.py +6 -6
- letta_client/tag/client.py +6 -6
- letta_client/tools/client.py +69 -75
- letta_client/types/__init__.py +31 -99
- letta_client/types/agent_state.py +3 -7
- letta_client/types/{letta_schemas_openai_chat_completion_response_tool_call.py → assistant_message.py} +6 -4
- letta_client/types/assistant_message_content.py +6 -0
- letta_client/types/block.py +2 -6
- letta_client/types/block_update.py +1 -5
- letta_client/types/{assistant_message_output.py → chat_completion_message_tool_call.py} +5 -5
- 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/llm_config.py +6 -0
- letta_client/types/{letta_schemas_message_message.py → message.py} +7 -8
- letta_client/types/message_create.py +3 -2
- letta_client/types/message_create_content.py +6 -0
- 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} +6 -4
- letta_client/types/system_message_content.py +6 -0
- letta_client/types/{create_assistant_file_request.py → text_content.py} +5 -4
- 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} +6 -4
- letta_client/types/user_message_content.py +6 -0
- {letta_client-0.1.17.dist-info → letta_client-0.1.21.dist-info}/METADATA +2 -2
- {letta_client-0.1.17.dist-info → letta_client-0.1.21.dist-info}/RECORD +74 -99
- 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_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.21.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
|
@@ -10,6 +10,7 @@ from ..types.http_validation_error import HttpValidationError
|
|
|
10
10
|
from json.decoder import JSONDecodeError
|
|
11
11
|
from ..core.api_error import ApiError
|
|
12
12
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
13
|
+
from ..types.agent_state import AgentState
|
|
13
14
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
14
15
|
|
|
15
16
|
# this is used as the default value for optional parameters
|
|
@@ -156,7 +157,7 @@ class BlocksClient:
|
|
|
156
157
|
"is_template": is_template,
|
|
157
158
|
"label": label,
|
|
158
159
|
"description": description,
|
|
159
|
-
"
|
|
160
|
+
"metadata": metadata,
|
|
160
161
|
},
|
|
161
162
|
request_options=request_options,
|
|
162
163
|
omit=OMIT,
|
|
@@ -185,7 +186,7 @@ class BlocksClient:
|
|
|
185
186
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
186
187
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
187
188
|
|
|
188
|
-
def
|
|
189
|
+
def retrieve(self, block_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Block:
|
|
189
190
|
"""
|
|
190
191
|
Parameters
|
|
191
192
|
----------
|
|
@@ -206,7 +207,7 @@ class BlocksClient:
|
|
|
206
207
|
client = Letta(
|
|
207
208
|
token="YOUR_TOKEN",
|
|
208
209
|
)
|
|
209
|
-
client.blocks.
|
|
210
|
+
client.blocks.retrieve(
|
|
210
211
|
block_id="block_id",
|
|
211
212
|
)
|
|
212
213
|
"""
|
|
@@ -293,7 +294,7 @@ class BlocksClient:
|
|
|
293
294
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
294
295
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
295
296
|
|
|
296
|
-
def
|
|
297
|
+
def modify(
|
|
297
298
|
self,
|
|
298
299
|
block_id: str,
|
|
299
300
|
*,
|
|
@@ -347,7 +348,7 @@ class BlocksClient:
|
|
|
347
348
|
client = Letta(
|
|
348
349
|
token="YOUR_TOKEN",
|
|
349
350
|
)
|
|
350
|
-
client.blocks.
|
|
351
|
+
client.blocks.modify(
|
|
351
352
|
block_id="block_id",
|
|
352
353
|
)
|
|
353
354
|
"""
|
|
@@ -361,7 +362,7 @@ class BlocksClient:
|
|
|
361
362
|
"is_template": is_template,
|
|
362
363
|
"label": label,
|
|
363
364
|
"description": description,
|
|
364
|
-
"
|
|
365
|
+
"metadata": metadata,
|
|
365
366
|
},
|
|
366
367
|
request_options=request_options,
|
|
367
368
|
omit=OMIT,
|
|
@@ -390,25 +391,24 @@ class BlocksClient:
|
|
|
390
391
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
391
392
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
392
393
|
|
|
393
|
-
def
|
|
394
|
-
self, block_id: str, *,
|
|
395
|
-
) ->
|
|
394
|
+
def list_agents_for_block(
|
|
395
|
+
self, block_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
396
|
+
) -> typing.List[AgentState]:
|
|
396
397
|
"""
|
|
397
|
-
|
|
398
|
+
Retrieves all agents associated with the specified block.
|
|
399
|
+
Raises a 404 if the block does not exist.
|
|
398
400
|
|
|
399
401
|
Parameters
|
|
400
402
|
----------
|
|
401
403
|
block_id : str
|
|
402
404
|
|
|
403
|
-
agent_id : str
|
|
404
|
-
The unique identifier of the agent to attach the source to.
|
|
405
|
-
|
|
406
405
|
request_options : typing.Optional[RequestOptions]
|
|
407
406
|
Request-specific configuration.
|
|
408
407
|
|
|
409
408
|
Returns
|
|
410
409
|
-------
|
|
411
|
-
|
|
410
|
+
typing.List[AgentState]
|
|
411
|
+
Successful Response
|
|
412
412
|
|
|
413
413
|
Examples
|
|
414
414
|
--------
|
|
@@ -417,80 +417,24 @@ class BlocksClient:
|
|
|
417
417
|
client = Letta(
|
|
418
418
|
token="YOUR_TOKEN",
|
|
419
419
|
)
|
|
420
|
-
client.blocks.
|
|
420
|
+
client.blocks.list_agents_for_block(
|
|
421
421
|
block_id="block_id",
|
|
422
|
-
agent_id="agent_id",
|
|
423
422
|
)
|
|
424
423
|
"""
|
|
425
424
|
_response = self._client_wrapper.httpx_client.request(
|
|
426
|
-
f"v1/blocks/{jsonable_encoder(block_id)}/
|
|
427
|
-
method="
|
|
428
|
-
params={
|
|
429
|
-
"agent_id": agent_id,
|
|
430
|
-
},
|
|
425
|
+
f"v1/blocks/{jsonable_encoder(block_id)}/agents",
|
|
426
|
+
method="GET",
|
|
431
427
|
request_options=request_options,
|
|
432
428
|
)
|
|
433
429
|
try:
|
|
434
430
|
if 200 <= _response.status_code < 300:
|
|
435
|
-
return
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
type_=HttpValidationError, # type: ignore
|
|
442
|
-
object_=_response.json(),
|
|
443
|
-
),
|
|
444
|
-
)
|
|
431
|
+
return typing.cast(
|
|
432
|
+
typing.List[AgentState],
|
|
433
|
+
construct_type(
|
|
434
|
+
type_=typing.List[AgentState], # type: ignore
|
|
435
|
+
object_=_response.json(),
|
|
436
|
+
),
|
|
445
437
|
)
|
|
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
438
|
if _response.status_code == 422:
|
|
495
439
|
raise UnprocessableEntityError(
|
|
496
440
|
typing.cast(
|
|
@@ -663,7 +607,7 @@ class AsyncBlocksClient:
|
|
|
663
607
|
"is_template": is_template,
|
|
664
608
|
"label": label,
|
|
665
609
|
"description": description,
|
|
666
|
-
"
|
|
610
|
+
"metadata": metadata,
|
|
667
611
|
},
|
|
668
612
|
request_options=request_options,
|
|
669
613
|
omit=OMIT,
|
|
@@ -692,7 +636,7 @@ class AsyncBlocksClient:
|
|
|
692
636
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
693
637
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
694
638
|
|
|
695
|
-
async def
|
|
639
|
+
async def retrieve(self, block_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Block:
|
|
696
640
|
"""
|
|
697
641
|
Parameters
|
|
698
642
|
----------
|
|
@@ -718,7 +662,7 @@ class AsyncBlocksClient:
|
|
|
718
662
|
|
|
719
663
|
|
|
720
664
|
async def main() -> None:
|
|
721
|
-
await client.blocks.
|
|
665
|
+
await client.blocks.retrieve(
|
|
722
666
|
block_id="block_id",
|
|
723
667
|
)
|
|
724
668
|
|
|
@@ -816,7 +760,7 @@ class AsyncBlocksClient:
|
|
|
816
760
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
817
761
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
818
762
|
|
|
819
|
-
async def
|
|
763
|
+
async def modify(
|
|
820
764
|
self,
|
|
821
765
|
block_id: str,
|
|
822
766
|
*,
|
|
@@ -875,7 +819,7 @@ class AsyncBlocksClient:
|
|
|
875
819
|
|
|
876
820
|
|
|
877
821
|
async def main() -> None:
|
|
878
|
-
await client.blocks.
|
|
822
|
+
await client.blocks.modify(
|
|
879
823
|
block_id="block_id",
|
|
880
824
|
)
|
|
881
825
|
|
|
@@ -892,7 +836,7 @@ class AsyncBlocksClient:
|
|
|
892
836
|
"is_template": is_template,
|
|
893
837
|
"label": label,
|
|
894
838
|
"description": description,
|
|
895
|
-
"
|
|
839
|
+
"metadata": metadata,
|
|
896
840
|
},
|
|
897
841
|
request_options=request_options,
|
|
898
842
|
omit=OMIT,
|
|
@@ -921,25 +865,24 @@ class AsyncBlocksClient:
|
|
|
921
865
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
922
866
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
923
867
|
|
|
924
|
-
async def
|
|
925
|
-
self, block_id: str, *,
|
|
926
|
-
) ->
|
|
868
|
+
async def list_agents_for_block(
|
|
869
|
+
self, block_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
870
|
+
) -> typing.List[AgentState]:
|
|
927
871
|
"""
|
|
928
|
-
|
|
872
|
+
Retrieves all agents associated with the specified block.
|
|
873
|
+
Raises a 404 if the block does not exist.
|
|
929
874
|
|
|
930
875
|
Parameters
|
|
931
876
|
----------
|
|
932
877
|
block_id : str
|
|
933
878
|
|
|
934
|
-
agent_id : str
|
|
935
|
-
The unique identifier of the agent to attach the source to.
|
|
936
|
-
|
|
937
879
|
request_options : typing.Optional[RequestOptions]
|
|
938
880
|
Request-specific configuration.
|
|
939
881
|
|
|
940
882
|
Returns
|
|
941
883
|
-------
|
|
942
|
-
|
|
884
|
+
typing.List[AgentState]
|
|
885
|
+
Successful Response
|
|
943
886
|
|
|
944
887
|
Examples
|
|
945
888
|
--------
|
|
@@ -953,91 +896,27 @@ class AsyncBlocksClient:
|
|
|
953
896
|
|
|
954
897
|
|
|
955
898
|
async def main() -> None:
|
|
956
|
-
await client.blocks.
|
|
899
|
+
await client.blocks.list_agents_for_block(
|
|
957
900
|
block_id="block_id",
|
|
958
|
-
agent_id="agent_id",
|
|
959
901
|
)
|
|
960
902
|
|
|
961
903
|
|
|
962
904
|
asyncio.run(main())
|
|
963
905
|
"""
|
|
964
906
|
_response = await self._client_wrapper.httpx_client.request(
|
|
965
|
-
f"v1/blocks/{jsonable_encoder(block_id)}/
|
|
966
|
-
method="
|
|
967
|
-
params={
|
|
968
|
-
"agent_id": agent_id,
|
|
969
|
-
},
|
|
907
|
+
f"v1/blocks/{jsonable_encoder(block_id)}/agents",
|
|
908
|
+
method="GET",
|
|
970
909
|
request_options=request_options,
|
|
971
910
|
)
|
|
972
911
|
try:
|
|
973
912
|
if 200 <= _response.status_code < 300:
|
|
974
|
-
return
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
type_=HttpValidationError, # type: ignore
|
|
981
|
-
object_=_response.json(),
|
|
982
|
-
),
|
|
983
|
-
)
|
|
913
|
+
return typing.cast(
|
|
914
|
+
typing.List[AgentState],
|
|
915
|
+
construct_type(
|
|
916
|
+
type_=typing.List[AgentState], # type: ignore
|
|
917
|
+
object_=_response.json(),
|
|
918
|
+
),
|
|
984
919
|
)
|
|
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
920
|
if _response.status_code == 422:
|
|
1042
921
|
raise UnprocessableEntityError(
|
|
1043
922
|
typing.cast(
|
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.21",
|
|
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
|
@@ -22,7 +22,7 @@ class ProvidersClient:
|
|
|
22
22
|
def list_providers(
|
|
23
23
|
self,
|
|
24
24
|
*,
|
|
25
|
-
|
|
25
|
+
after: typing.Optional[str] = None,
|
|
26
26
|
limit: typing.Optional[int] = None,
|
|
27
27
|
request_options: typing.Optional[RequestOptions] = None,
|
|
28
28
|
) -> typing.List[Provider]:
|
|
@@ -31,7 +31,7 @@ class ProvidersClient:
|
|
|
31
31
|
|
|
32
32
|
Parameters
|
|
33
33
|
----------
|
|
34
|
-
|
|
34
|
+
after : typing.Optional[str]
|
|
35
35
|
|
|
36
36
|
limit : typing.Optional[int]
|
|
37
37
|
|
|
@@ -56,7 +56,7 @@ class ProvidersClient:
|
|
|
56
56
|
"v1/providers/",
|
|
57
57
|
method="GET",
|
|
58
58
|
params={
|
|
59
|
-
"
|
|
59
|
+
"after": after,
|
|
60
60
|
"limit": limit,
|
|
61
61
|
},
|
|
62
62
|
request_options=request_options,
|
|
@@ -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
|
)
|
|
@@ -297,7 +297,7 @@ class AsyncProvidersClient:
|
|
|
297
297
|
async def list_providers(
|
|
298
298
|
self,
|
|
299
299
|
*,
|
|
300
|
-
|
|
300
|
+
after: typing.Optional[str] = None,
|
|
301
301
|
limit: typing.Optional[int] = None,
|
|
302
302
|
request_options: typing.Optional[RequestOptions] = None,
|
|
303
303
|
) -> typing.List[Provider]:
|
|
@@ -306,7 +306,7 @@ class AsyncProvidersClient:
|
|
|
306
306
|
|
|
307
307
|
Parameters
|
|
308
308
|
----------
|
|
309
|
-
|
|
309
|
+
after : typing.Optional[str]
|
|
310
310
|
|
|
311
311
|
limit : typing.Optional[int]
|
|
312
312
|
|
|
@@ -339,7 +339,7 @@ class AsyncProvidersClient:
|
|
|
339
339
|
"v1/providers/",
|
|
340
340
|
method="GET",
|
|
341
341
|
params={
|
|
342
|
-
"
|
|
342
|
+
"after": after,
|
|
343
343
|
"limit": limit,
|
|
344
344
|
},
|
|
345
345
|
request_options=request_options,
|
|
@@ -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
|
)
|