letta-client 0.1.121__py3-none-any.whl → 0.1.123__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/__init__.py +24 -23
- letta_client/agents/__init__.py +2 -1
- letta_client/agents/client.py +90 -581
- letta_client/agents/groups/client.py +167 -0
- letta_client/agents/messages/client.py +145 -0
- letta_client/agents/passages/client.py +289 -0
- letta_client/base_client.py +12 -0
- letta_client/batches/__init__.py +2 -0
- letta_client/{messages/batches → batches}/client.py +19 -19
- letta_client/blocks/__init__.py +3 -0
- letta_client/blocks/agents/__init__.py +2 -0
- letta_client/blocks/agents/client.py +149 -0
- letta_client/blocks/client.py +4 -127
- letta_client/client_side_access_tokens/__init__.py +12 -12
- letta_client/client_side_access_tokens/client.py +28 -32
- letta_client/client_side_access_tokens/types/__init__.py +15 -21
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_request_policy_item.py → client_side_access_tokens_create_request_policy_item.py} +4 -4
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_request_policy_item_access_item.py → client_side_access_tokens_create_request_policy_item_access_item.py} +1 -1
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_response.py → client_side_access_tokens_create_response.py} +3 -5
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_response_policy.py → client_side_access_tokens_create_response_policy.py} +4 -4
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_response_policy_data_item.py → client_side_access_tokens_create_response_policy_data_item.py} +4 -4
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_response_policy_data_item_access_item.py → client_side_access_tokens_create_response_policy_data_item_access_item.py} +1 -1
- letta_client/core/client_wrapper.py +1 -1
- letta_client/embeddings/__init__.py +2 -0
- letta_client/embeddings/client.py +108 -0
- letta_client/groups/client.py +0 -124
- letta_client/groups/messages/client.py +124 -0
- letta_client/identities/__init__.py +3 -0
- letta_client/identities/client.py +4 -154
- letta_client/identities/properties/__init__.py +2 -0
- letta_client/identities/properties/client.py +181 -0
- letta_client/messages/__init__.py +0 -3
- letta_client/messages/client.py +0 -4
- letta_client/models/client.py +4 -97
- letta_client/projects/__init__.py +2 -2
- letta_client/projects/client.py +13 -13
- letta_client/projects/types/__init__.py +3 -3
- letta_client/projects/types/{projects_list_projects_response.py → projects_list_response.py} +3 -3
- letta_client/projects/types/{projects_list_projects_response_projects_item.py → projects_list_response_projects_item.py} +1 -1
- letta_client/providers/client.py +173 -10
- letta_client/runs/__init__.py +3 -0
- letta_client/runs/client.py +34 -480
- letta_client/runs/messages/__init__.py +2 -0
- letta_client/runs/messages/client.py +234 -0
- letta_client/runs/steps/__init__.py +2 -0
- letta_client/runs/steps/client.py +217 -0
- letta_client/runs/usage/__init__.py +2 -0
- letta_client/runs/usage/client.py +145 -0
- letta_client/sources/client.py +6 -4
- letta_client/steps/client.py +78 -4
- letta_client/tags/__init__.py +2 -0
- letta_client/tags/client.py +92 -0
- letta_client/templates/__init__.py +4 -10
- letta_client/templates/agents/__init__.py +5 -0
- letta_client/templates/agents/client.py +208 -0
- letta_client/templates/agents/types/__init__.py +5 -0
- letta_client/templates/{types/templates_create_agents_response.py → agents/types/agents_create_response.py} +4 -4
- letta_client/templates/client.py +18 -203
- letta_client/templates/types/__init__.py +3 -8
- letta_client/templates/types/{templates_list_templates_response.py → templates_list_response.py} +3 -3
- letta_client/templates/types/{templates_list_templates_response_templates_item.py → templates_list_response_templates_item.py} +1 -1
- letta_client/tools/client.py +4 -4
- {letta_client-0.1.121.dist-info → letta_client-0.1.123.dist-info}/METADATA +1 -1
- {letta_client-0.1.121.dist-info → letta_client-0.1.123.dist-info}/RECORD +66 -47
- /letta_client/{messages/batches → agents/groups}/__init__.py +0 -0
- {letta_client-0.1.121.dist-info → letta_client-0.1.123.dist-info}/WHEEL +0 -0
letta_client/agents/client.py
CHANGED
|
@@ -9,6 +9,7 @@ from .core_memory.client import CoreMemoryClient
|
|
|
9
9
|
from .blocks.client import BlocksClient
|
|
10
10
|
from .passages.client import PassagesClient
|
|
11
11
|
from .messages.client import MessagesClient
|
|
12
|
+
from .groups.client import GroupsClient
|
|
12
13
|
from .templates.client import TemplatesClient
|
|
13
14
|
from .memory_variables.client import MemoryVariablesClient
|
|
14
15
|
from ..core.request_options import RequestOptions
|
|
@@ -28,9 +29,6 @@ from ..core.serialization import convert_and_respect_annotation_metadata
|
|
|
28
29
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
29
30
|
from .. import core
|
|
30
31
|
from .types.update_agent_tool_rules_item import UpdateAgentToolRulesItem
|
|
31
|
-
import datetime as dt
|
|
32
|
-
from ..types.passage import Passage
|
|
33
|
-
from ..types.group import Group
|
|
34
32
|
from .types.agents_search_request_search_item import AgentsSearchRequestSearchItem
|
|
35
33
|
from .types.agents_search_response import AgentsSearchResponse
|
|
36
34
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
@@ -41,6 +39,7 @@ from .core_memory.client import AsyncCoreMemoryClient
|
|
|
41
39
|
from .blocks.client import AsyncBlocksClient
|
|
42
40
|
from .passages.client import AsyncPassagesClient
|
|
43
41
|
from .messages.client import AsyncMessagesClient
|
|
42
|
+
from .groups.client import AsyncGroupsClient
|
|
44
43
|
from .templates.client import AsyncTemplatesClient
|
|
45
44
|
from .memory_variables.client import AsyncMemoryVariablesClient
|
|
46
45
|
|
|
@@ -58,6 +57,7 @@ class AgentsClient:
|
|
|
58
57
|
self.blocks = BlocksClient(client_wrapper=self._client_wrapper)
|
|
59
58
|
self.passages = PassagesClient(client_wrapper=self._client_wrapper)
|
|
60
59
|
self.messages = MessagesClient(client_wrapper=self._client_wrapper)
|
|
60
|
+
self.groups = GroupsClient(client_wrapper=self._client_wrapper)
|
|
61
61
|
self.templates = TemplatesClient(client_wrapper=self._client_wrapper)
|
|
62
62
|
self.memory_variables = MemoryVariablesClient(client_wrapper=self._client_wrapper)
|
|
63
63
|
|
|
@@ -504,7 +504,44 @@ class AgentsClient:
|
|
|
504
504
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
505
505
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
506
506
|
|
|
507
|
-
def
|
|
507
|
+
def export(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
508
|
+
"""
|
|
509
|
+
Parameters
|
|
510
|
+
----------
|
|
511
|
+
agent_id : str
|
|
512
|
+
|
|
513
|
+
request_options : typing.Optional[RequestOptions]
|
|
514
|
+
Request-specific configuration.
|
|
515
|
+
|
|
516
|
+
Returns
|
|
517
|
+
-------
|
|
518
|
+
None
|
|
519
|
+
|
|
520
|
+
Examples
|
|
521
|
+
--------
|
|
522
|
+
from letta_client import Letta
|
|
523
|
+
|
|
524
|
+
client = Letta(
|
|
525
|
+
token="YOUR_TOKEN",
|
|
526
|
+
)
|
|
527
|
+
client.agents.export(
|
|
528
|
+
agent_id="agent_id",
|
|
529
|
+
)
|
|
530
|
+
"""
|
|
531
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
532
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/export",
|
|
533
|
+
method="POST",
|
|
534
|
+
request_options=request_options,
|
|
535
|
+
)
|
|
536
|
+
try:
|
|
537
|
+
if 200 <= _response.status_code < 300:
|
|
538
|
+
return
|
|
539
|
+
_response_json = _response.json()
|
|
540
|
+
except JSONDecodeError:
|
|
541
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
542
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
543
|
+
|
|
544
|
+
def import_(
|
|
508
545
|
self,
|
|
509
546
|
*,
|
|
510
547
|
file: core.File,
|
|
@@ -549,7 +586,7 @@ class AgentsClient:
|
|
|
549
586
|
client = Letta(
|
|
550
587
|
token="YOUR_TOKEN",
|
|
551
588
|
)
|
|
552
|
-
client.agents.
|
|
589
|
+
client.agents.import_()
|
|
553
590
|
"""
|
|
554
591
|
_response = self._client_wrapper.httpx_client.request(
|
|
555
592
|
"v1/agents/import",
|
|
@@ -883,281 +920,6 @@ class AgentsClient:
|
|
|
883
920
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
884
921
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
885
922
|
|
|
886
|
-
def modify_passage(
|
|
887
|
-
self,
|
|
888
|
-
agent_id: str,
|
|
889
|
-
memory_id: str,
|
|
890
|
-
*,
|
|
891
|
-
id: str,
|
|
892
|
-
created_by_id: typing.Optional[str] = OMIT,
|
|
893
|
-
last_updated_by_id: typing.Optional[str] = OMIT,
|
|
894
|
-
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
895
|
-
updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
896
|
-
is_deleted: typing.Optional[bool] = OMIT,
|
|
897
|
-
passage_update_agent_id: typing.Optional[str] = OMIT,
|
|
898
|
-
source_id: typing.Optional[str] = OMIT,
|
|
899
|
-
file_id: typing.Optional[str] = OMIT,
|
|
900
|
-
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
901
|
-
text: typing.Optional[str] = OMIT,
|
|
902
|
-
embedding: typing.Optional[typing.Sequence[float]] = OMIT,
|
|
903
|
-
embedding_config: typing.Optional[EmbeddingConfig] = OMIT,
|
|
904
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
905
|
-
) -> typing.List[Passage]:
|
|
906
|
-
"""
|
|
907
|
-
Modify a memory in the agent's archival memory store.
|
|
908
|
-
|
|
909
|
-
Parameters
|
|
910
|
-
----------
|
|
911
|
-
agent_id : str
|
|
912
|
-
|
|
913
|
-
memory_id : str
|
|
914
|
-
|
|
915
|
-
id : str
|
|
916
|
-
The unique identifier of the passage.
|
|
917
|
-
|
|
918
|
-
created_by_id : typing.Optional[str]
|
|
919
|
-
The id of the user that made this object.
|
|
920
|
-
|
|
921
|
-
last_updated_by_id : typing.Optional[str]
|
|
922
|
-
The id of the user that made this object.
|
|
923
|
-
|
|
924
|
-
created_at : typing.Optional[dt.datetime]
|
|
925
|
-
The timestamp when the object was created.
|
|
926
|
-
|
|
927
|
-
updated_at : typing.Optional[dt.datetime]
|
|
928
|
-
The timestamp when the object was last updated.
|
|
929
|
-
|
|
930
|
-
is_deleted : typing.Optional[bool]
|
|
931
|
-
Whether this passage is deleted or not.
|
|
932
|
-
|
|
933
|
-
passage_update_agent_id : typing.Optional[str]
|
|
934
|
-
The unique identifier of the agent associated with the passage.
|
|
935
|
-
|
|
936
|
-
source_id : typing.Optional[str]
|
|
937
|
-
The data source of the passage.
|
|
938
|
-
|
|
939
|
-
file_id : typing.Optional[str]
|
|
940
|
-
The unique identifier of the file associated with the passage.
|
|
941
|
-
|
|
942
|
-
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
943
|
-
The metadata of the passage.
|
|
944
|
-
|
|
945
|
-
text : typing.Optional[str]
|
|
946
|
-
The text of the passage.
|
|
947
|
-
|
|
948
|
-
embedding : typing.Optional[typing.Sequence[float]]
|
|
949
|
-
The embedding of the passage.
|
|
950
|
-
|
|
951
|
-
embedding_config : typing.Optional[EmbeddingConfig]
|
|
952
|
-
The embedding configuration used by the passage.
|
|
953
|
-
|
|
954
|
-
request_options : typing.Optional[RequestOptions]
|
|
955
|
-
Request-specific configuration.
|
|
956
|
-
|
|
957
|
-
Returns
|
|
958
|
-
-------
|
|
959
|
-
typing.List[Passage]
|
|
960
|
-
Successful Response
|
|
961
|
-
|
|
962
|
-
Examples
|
|
963
|
-
--------
|
|
964
|
-
from letta_client import Letta
|
|
965
|
-
|
|
966
|
-
client = Letta(
|
|
967
|
-
token="YOUR_TOKEN",
|
|
968
|
-
)
|
|
969
|
-
client.agents.modify_passage(
|
|
970
|
-
agent_id="agent_id",
|
|
971
|
-
memory_id="memory_id",
|
|
972
|
-
id="id",
|
|
973
|
-
)
|
|
974
|
-
"""
|
|
975
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
976
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/archival-memory/{jsonable_encoder(memory_id)}",
|
|
977
|
-
method="PATCH",
|
|
978
|
-
json={
|
|
979
|
-
"created_by_id": created_by_id,
|
|
980
|
-
"last_updated_by_id": last_updated_by_id,
|
|
981
|
-
"created_at": created_at,
|
|
982
|
-
"updated_at": updated_at,
|
|
983
|
-
"is_deleted": is_deleted,
|
|
984
|
-
"agent_id": passage_update_agent_id,
|
|
985
|
-
"source_id": source_id,
|
|
986
|
-
"file_id": file_id,
|
|
987
|
-
"metadata_": metadata,
|
|
988
|
-
"text": text,
|
|
989
|
-
"embedding": embedding,
|
|
990
|
-
"embedding_config": convert_and_respect_annotation_metadata(
|
|
991
|
-
object_=embedding_config, annotation=EmbeddingConfig, direction="write"
|
|
992
|
-
),
|
|
993
|
-
"id": id,
|
|
994
|
-
},
|
|
995
|
-
headers={
|
|
996
|
-
"content-type": "application/json",
|
|
997
|
-
},
|
|
998
|
-
request_options=request_options,
|
|
999
|
-
omit=OMIT,
|
|
1000
|
-
)
|
|
1001
|
-
try:
|
|
1002
|
-
if 200 <= _response.status_code < 300:
|
|
1003
|
-
return typing.cast(
|
|
1004
|
-
typing.List[Passage],
|
|
1005
|
-
construct_type(
|
|
1006
|
-
type_=typing.List[Passage], # type: ignore
|
|
1007
|
-
object_=_response.json(),
|
|
1008
|
-
),
|
|
1009
|
-
)
|
|
1010
|
-
if _response.status_code == 422:
|
|
1011
|
-
raise UnprocessableEntityError(
|
|
1012
|
-
typing.cast(
|
|
1013
|
-
HttpValidationError,
|
|
1014
|
-
construct_type(
|
|
1015
|
-
type_=HttpValidationError, # type: ignore
|
|
1016
|
-
object_=_response.json(),
|
|
1017
|
-
),
|
|
1018
|
-
)
|
|
1019
|
-
)
|
|
1020
|
-
_response_json = _response.json()
|
|
1021
|
-
except JSONDecodeError:
|
|
1022
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1023
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1024
|
-
|
|
1025
|
-
def reset_messages(
|
|
1026
|
-
self,
|
|
1027
|
-
agent_id: str,
|
|
1028
|
-
*,
|
|
1029
|
-
add_default_initial_messages: typing.Optional[bool] = None,
|
|
1030
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1031
|
-
) -> AgentState:
|
|
1032
|
-
"""
|
|
1033
|
-
Resets the messages for an agent
|
|
1034
|
-
|
|
1035
|
-
Parameters
|
|
1036
|
-
----------
|
|
1037
|
-
agent_id : str
|
|
1038
|
-
|
|
1039
|
-
add_default_initial_messages : typing.Optional[bool]
|
|
1040
|
-
If true, adds the default initial messages after resetting.
|
|
1041
|
-
|
|
1042
|
-
request_options : typing.Optional[RequestOptions]
|
|
1043
|
-
Request-specific configuration.
|
|
1044
|
-
|
|
1045
|
-
Returns
|
|
1046
|
-
-------
|
|
1047
|
-
AgentState
|
|
1048
|
-
Successful Response
|
|
1049
|
-
|
|
1050
|
-
Examples
|
|
1051
|
-
--------
|
|
1052
|
-
from letta_client import Letta
|
|
1053
|
-
|
|
1054
|
-
client = Letta(
|
|
1055
|
-
token="YOUR_TOKEN",
|
|
1056
|
-
)
|
|
1057
|
-
client.agents.reset_messages(
|
|
1058
|
-
agent_id="agent_id",
|
|
1059
|
-
)
|
|
1060
|
-
"""
|
|
1061
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
1062
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/reset-messages",
|
|
1063
|
-
method="PATCH",
|
|
1064
|
-
params={
|
|
1065
|
-
"add_default_initial_messages": add_default_initial_messages,
|
|
1066
|
-
},
|
|
1067
|
-
request_options=request_options,
|
|
1068
|
-
)
|
|
1069
|
-
try:
|
|
1070
|
-
if 200 <= _response.status_code < 300:
|
|
1071
|
-
return typing.cast(
|
|
1072
|
-
AgentState,
|
|
1073
|
-
construct_type(
|
|
1074
|
-
type_=AgentState, # type: ignore
|
|
1075
|
-
object_=_response.json(),
|
|
1076
|
-
),
|
|
1077
|
-
)
|
|
1078
|
-
if _response.status_code == 422:
|
|
1079
|
-
raise UnprocessableEntityError(
|
|
1080
|
-
typing.cast(
|
|
1081
|
-
HttpValidationError,
|
|
1082
|
-
construct_type(
|
|
1083
|
-
type_=HttpValidationError, # type: ignore
|
|
1084
|
-
object_=_response.json(),
|
|
1085
|
-
),
|
|
1086
|
-
)
|
|
1087
|
-
)
|
|
1088
|
-
_response_json = _response.json()
|
|
1089
|
-
except JSONDecodeError:
|
|
1090
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1091
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1092
|
-
|
|
1093
|
-
def list_agent_groups(
|
|
1094
|
-
self,
|
|
1095
|
-
agent_id: str,
|
|
1096
|
-
*,
|
|
1097
|
-
manager_type: typing.Optional[str] = None,
|
|
1098
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1099
|
-
) -> typing.List[Group]:
|
|
1100
|
-
"""
|
|
1101
|
-
Lists the groups for an agent
|
|
1102
|
-
|
|
1103
|
-
Parameters
|
|
1104
|
-
----------
|
|
1105
|
-
agent_id : str
|
|
1106
|
-
|
|
1107
|
-
manager_type : typing.Optional[str]
|
|
1108
|
-
Manager type to filter groups by
|
|
1109
|
-
|
|
1110
|
-
request_options : typing.Optional[RequestOptions]
|
|
1111
|
-
Request-specific configuration.
|
|
1112
|
-
|
|
1113
|
-
Returns
|
|
1114
|
-
-------
|
|
1115
|
-
typing.List[Group]
|
|
1116
|
-
Successful Response
|
|
1117
|
-
|
|
1118
|
-
Examples
|
|
1119
|
-
--------
|
|
1120
|
-
from letta_client import Letta
|
|
1121
|
-
|
|
1122
|
-
client = Letta(
|
|
1123
|
-
token="YOUR_TOKEN",
|
|
1124
|
-
)
|
|
1125
|
-
client.agents.list_agent_groups(
|
|
1126
|
-
agent_id="agent_id",
|
|
1127
|
-
)
|
|
1128
|
-
"""
|
|
1129
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
1130
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/groups",
|
|
1131
|
-
method="GET",
|
|
1132
|
-
params={
|
|
1133
|
-
"manager_type": manager_type,
|
|
1134
|
-
},
|
|
1135
|
-
request_options=request_options,
|
|
1136
|
-
)
|
|
1137
|
-
try:
|
|
1138
|
-
if 200 <= _response.status_code < 300:
|
|
1139
|
-
return typing.cast(
|
|
1140
|
-
typing.List[Group],
|
|
1141
|
-
construct_type(
|
|
1142
|
-
type_=typing.List[Group], # type: ignore
|
|
1143
|
-
object_=_response.json(),
|
|
1144
|
-
),
|
|
1145
|
-
)
|
|
1146
|
-
if _response.status_code == 422:
|
|
1147
|
-
raise UnprocessableEntityError(
|
|
1148
|
-
typing.cast(
|
|
1149
|
-
HttpValidationError,
|
|
1150
|
-
construct_type(
|
|
1151
|
-
type_=HttpValidationError, # type: ignore
|
|
1152
|
-
object_=_response.json(),
|
|
1153
|
-
),
|
|
1154
|
-
)
|
|
1155
|
-
)
|
|
1156
|
-
_response_json = _response.json()
|
|
1157
|
-
except JSONDecodeError:
|
|
1158
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1159
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1160
|
-
|
|
1161
923
|
def search(
|
|
1162
924
|
self,
|
|
1163
925
|
*,
|
|
@@ -1245,6 +1007,7 @@ class AsyncAgentsClient:
|
|
|
1245
1007
|
self.blocks = AsyncBlocksClient(client_wrapper=self._client_wrapper)
|
|
1246
1008
|
self.passages = AsyncPassagesClient(client_wrapper=self._client_wrapper)
|
|
1247
1009
|
self.messages = AsyncMessagesClient(client_wrapper=self._client_wrapper)
|
|
1010
|
+
self.groups = AsyncGroupsClient(client_wrapper=self._client_wrapper)
|
|
1248
1011
|
self.templates = AsyncTemplatesClient(client_wrapper=self._client_wrapper)
|
|
1249
1012
|
self.memory_variables = AsyncMemoryVariablesClient(client_wrapper=self._client_wrapper)
|
|
1250
1013
|
|
|
@@ -1717,7 +1480,52 @@ class AsyncAgentsClient:
|
|
|
1717
1480
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1718
1481
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1719
1482
|
|
|
1720
|
-
async def
|
|
1483
|
+
async def export(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
1484
|
+
"""
|
|
1485
|
+
Parameters
|
|
1486
|
+
----------
|
|
1487
|
+
agent_id : str
|
|
1488
|
+
|
|
1489
|
+
request_options : typing.Optional[RequestOptions]
|
|
1490
|
+
Request-specific configuration.
|
|
1491
|
+
|
|
1492
|
+
Returns
|
|
1493
|
+
-------
|
|
1494
|
+
None
|
|
1495
|
+
|
|
1496
|
+
Examples
|
|
1497
|
+
--------
|
|
1498
|
+
import asyncio
|
|
1499
|
+
|
|
1500
|
+
from letta_client import AsyncLetta
|
|
1501
|
+
|
|
1502
|
+
client = AsyncLetta(
|
|
1503
|
+
token="YOUR_TOKEN",
|
|
1504
|
+
)
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
async def main() -> None:
|
|
1508
|
+
await client.agents.export(
|
|
1509
|
+
agent_id="agent_id",
|
|
1510
|
+
)
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
asyncio.run(main())
|
|
1514
|
+
"""
|
|
1515
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1516
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/export",
|
|
1517
|
+
method="POST",
|
|
1518
|
+
request_options=request_options,
|
|
1519
|
+
)
|
|
1520
|
+
try:
|
|
1521
|
+
if 200 <= _response.status_code < 300:
|
|
1522
|
+
return
|
|
1523
|
+
_response_json = _response.json()
|
|
1524
|
+
except JSONDecodeError:
|
|
1525
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1526
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1527
|
+
|
|
1528
|
+
async def import_(
|
|
1721
1529
|
self,
|
|
1722
1530
|
*,
|
|
1723
1531
|
file: core.File,
|
|
@@ -1767,7 +1575,7 @@ class AsyncAgentsClient:
|
|
|
1767
1575
|
|
|
1768
1576
|
|
|
1769
1577
|
async def main() -> None:
|
|
1770
|
-
await client.agents.
|
|
1578
|
+
await client.agents.import_()
|
|
1771
1579
|
|
|
1772
1580
|
|
|
1773
1581
|
asyncio.run(main())
|
|
@@ -2128,305 +1936,6 @@ class AsyncAgentsClient:
|
|
|
2128
1936
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2129
1937
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2130
1938
|
|
|
2131
|
-
async def modify_passage(
|
|
2132
|
-
self,
|
|
2133
|
-
agent_id: str,
|
|
2134
|
-
memory_id: str,
|
|
2135
|
-
*,
|
|
2136
|
-
id: str,
|
|
2137
|
-
created_by_id: typing.Optional[str] = OMIT,
|
|
2138
|
-
last_updated_by_id: typing.Optional[str] = OMIT,
|
|
2139
|
-
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
2140
|
-
updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
2141
|
-
is_deleted: typing.Optional[bool] = OMIT,
|
|
2142
|
-
passage_update_agent_id: typing.Optional[str] = OMIT,
|
|
2143
|
-
source_id: typing.Optional[str] = OMIT,
|
|
2144
|
-
file_id: typing.Optional[str] = OMIT,
|
|
2145
|
-
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
2146
|
-
text: typing.Optional[str] = OMIT,
|
|
2147
|
-
embedding: typing.Optional[typing.Sequence[float]] = OMIT,
|
|
2148
|
-
embedding_config: typing.Optional[EmbeddingConfig] = OMIT,
|
|
2149
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
2150
|
-
) -> typing.List[Passage]:
|
|
2151
|
-
"""
|
|
2152
|
-
Modify a memory in the agent's archival memory store.
|
|
2153
|
-
|
|
2154
|
-
Parameters
|
|
2155
|
-
----------
|
|
2156
|
-
agent_id : str
|
|
2157
|
-
|
|
2158
|
-
memory_id : str
|
|
2159
|
-
|
|
2160
|
-
id : str
|
|
2161
|
-
The unique identifier of the passage.
|
|
2162
|
-
|
|
2163
|
-
created_by_id : typing.Optional[str]
|
|
2164
|
-
The id of the user that made this object.
|
|
2165
|
-
|
|
2166
|
-
last_updated_by_id : typing.Optional[str]
|
|
2167
|
-
The id of the user that made this object.
|
|
2168
|
-
|
|
2169
|
-
created_at : typing.Optional[dt.datetime]
|
|
2170
|
-
The timestamp when the object was created.
|
|
2171
|
-
|
|
2172
|
-
updated_at : typing.Optional[dt.datetime]
|
|
2173
|
-
The timestamp when the object was last updated.
|
|
2174
|
-
|
|
2175
|
-
is_deleted : typing.Optional[bool]
|
|
2176
|
-
Whether this passage is deleted or not.
|
|
2177
|
-
|
|
2178
|
-
passage_update_agent_id : typing.Optional[str]
|
|
2179
|
-
The unique identifier of the agent associated with the passage.
|
|
2180
|
-
|
|
2181
|
-
source_id : typing.Optional[str]
|
|
2182
|
-
The data source of the passage.
|
|
2183
|
-
|
|
2184
|
-
file_id : typing.Optional[str]
|
|
2185
|
-
The unique identifier of the file associated with the passage.
|
|
2186
|
-
|
|
2187
|
-
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
2188
|
-
The metadata of the passage.
|
|
2189
|
-
|
|
2190
|
-
text : typing.Optional[str]
|
|
2191
|
-
The text of the passage.
|
|
2192
|
-
|
|
2193
|
-
embedding : typing.Optional[typing.Sequence[float]]
|
|
2194
|
-
The embedding of the passage.
|
|
2195
|
-
|
|
2196
|
-
embedding_config : typing.Optional[EmbeddingConfig]
|
|
2197
|
-
The embedding configuration used by the passage.
|
|
2198
|
-
|
|
2199
|
-
request_options : typing.Optional[RequestOptions]
|
|
2200
|
-
Request-specific configuration.
|
|
2201
|
-
|
|
2202
|
-
Returns
|
|
2203
|
-
-------
|
|
2204
|
-
typing.List[Passage]
|
|
2205
|
-
Successful Response
|
|
2206
|
-
|
|
2207
|
-
Examples
|
|
2208
|
-
--------
|
|
2209
|
-
import asyncio
|
|
2210
|
-
|
|
2211
|
-
from letta_client import AsyncLetta
|
|
2212
|
-
|
|
2213
|
-
client = AsyncLetta(
|
|
2214
|
-
token="YOUR_TOKEN",
|
|
2215
|
-
)
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
async def main() -> None:
|
|
2219
|
-
await client.agents.modify_passage(
|
|
2220
|
-
agent_id="agent_id",
|
|
2221
|
-
memory_id="memory_id",
|
|
2222
|
-
id="id",
|
|
2223
|
-
)
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
asyncio.run(main())
|
|
2227
|
-
"""
|
|
2228
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
2229
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/archival-memory/{jsonable_encoder(memory_id)}",
|
|
2230
|
-
method="PATCH",
|
|
2231
|
-
json={
|
|
2232
|
-
"created_by_id": created_by_id,
|
|
2233
|
-
"last_updated_by_id": last_updated_by_id,
|
|
2234
|
-
"created_at": created_at,
|
|
2235
|
-
"updated_at": updated_at,
|
|
2236
|
-
"is_deleted": is_deleted,
|
|
2237
|
-
"agent_id": passage_update_agent_id,
|
|
2238
|
-
"source_id": source_id,
|
|
2239
|
-
"file_id": file_id,
|
|
2240
|
-
"metadata_": metadata,
|
|
2241
|
-
"text": text,
|
|
2242
|
-
"embedding": embedding,
|
|
2243
|
-
"embedding_config": convert_and_respect_annotation_metadata(
|
|
2244
|
-
object_=embedding_config, annotation=EmbeddingConfig, direction="write"
|
|
2245
|
-
),
|
|
2246
|
-
"id": id,
|
|
2247
|
-
},
|
|
2248
|
-
headers={
|
|
2249
|
-
"content-type": "application/json",
|
|
2250
|
-
},
|
|
2251
|
-
request_options=request_options,
|
|
2252
|
-
omit=OMIT,
|
|
2253
|
-
)
|
|
2254
|
-
try:
|
|
2255
|
-
if 200 <= _response.status_code < 300:
|
|
2256
|
-
return typing.cast(
|
|
2257
|
-
typing.List[Passage],
|
|
2258
|
-
construct_type(
|
|
2259
|
-
type_=typing.List[Passage], # type: ignore
|
|
2260
|
-
object_=_response.json(),
|
|
2261
|
-
),
|
|
2262
|
-
)
|
|
2263
|
-
if _response.status_code == 422:
|
|
2264
|
-
raise UnprocessableEntityError(
|
|
2265
|
-
typing.cast(
|
|
2266
|
-
HttpValidationError,
|
|
2267
|
-
construct_type(
|
|
2268
|
-
type_=HttpValidationError, # type: ignore
|
|
2269
|
-
object_=_response.json(),
|
|
2270
|
-
),
|
|
2271
|
-
)
|
|
2272
|
-
)
|
|
2273
|
-
_response_json = _response.json()
|
|
2274
|
-
except JSONDecodeError:
|
|
2275
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2276
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2277
|
-
|
|
2278
|
-
async def reset_messages(
|
|
2279
|
-
self,
|
|
2280
|
-
agent_id: str,
|
|
2281
|
-
*,
|
|
2282
|
-
add_default_initial_messages: typing.Optional[bool] = None,
|
|
2283
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
2284
|
-
) -> AgentState:
|
|
2285
|
-
"""
|
|
2286
|
-
Resets the messages for an agent
|
|
2287
|
-
|
|
2288
|
-
Parameters
|
|
2289
|
-
----------
|
|
2290
|
-
agent_id : str
|
|
2291
|
-
|
|
2292
|
-
add_default_initial_messages : typing.Optional[bool]
|
|
2293
|
-
If true, adds the default initial messages after resetting.
|
|
2294
|
-
|
|
2295
|
-
request_options : typing.Optional[RequestOptions]
|
|
2296
|
-
Request-specific configuration.
|
|
2297
|
-
|
|
2298
|
-
Returns
|
|
2299
|
-
-------
|
|
2300
|
-
AgentState
|
|
2301
|
-
Successful Response
|
|
2302
|
-
|
|
2303
|
-
Examples
|
|
2304
|
-
--------
|
|
2305
|
-
import asyncio
|
|
2306
|
-
|
|
2307
|
-
from letta_client import AsyncLetta
|
|
2308
|
-
|
|
2309
|
-
client = AsyncLetta(
|
|
2310
|
-
token="YOUR_TOKEN",
|
|
2311
|
-
)
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
async def main() -> None:
|
|
2315
|
-
await client.agents.reset_messages(
|
|
2316
|
-
agent_id="agent_id",
|
|
2317
|
-
)
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
asyncio.run(main())
|
|
2321
|
-
"""
|
|
2322
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
2323
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/reset-messages",
|
|
2324
|
-
method="PATCH",
|
|
2325
|
-
params={
|
|
2326
|
-
"add_default_initial_messages": add_default_initial_messages,
|
|
2327
|
-
},
|
|
2328
|
-
request_options=request_options,
|
|
2329
|
-
)
|
|
2330
|
-
try:
|
|
2331
|
-
if 200 <= _response.status_code < 300:
|
|
2332
|
-
return typing.cast(
|
|
2333
|
-
AgentState,
|
|
2334
|
-
construct_type(
|
|
2335
|
-
type_=AgentState, # type: ignore
|
|
2336
|
-
object_=_response.json(),
|
|
2337
|
-
),
|
|
2338
|
-
)
|
|
2339
|
-
if _response.status_code == 422:
|
|
2340
|
-
raise UnprocessableEntityError(
|
|
2341
|
-
typing.cast(
|
|
2342
|
-
HttpValidationError,
|
|
2343
|
-
construct_type(
|
|
2344
|
-
type_=HttpValidationError, # type: ignore
|
|
2345
|
-
object_=_response.json(),
|
|
2346
|
-
),
|
|
2347
|
-
)
|
|
2348
|
-
)
|
|
2349
|
-
_response_json = _response.json()
|
|
2350
|
-
except JSONDecodeError:
|
|
2351
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2352
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2353
|
-
|
|
2354
|
-
async def list_agent_groups(
|
|
2355
|
-
self,
|
|
2356
|
-
agent_id: str,
|
|
2357
|
-
*,
|
|
2358
|
-
manager_type: typing.Optional[str] = None,
|
|
2359
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
2360
|
-
) -> typing.List[Group]:
|
|
2361
|
-
"""
|
|
2362
|
-
Lists the groups for an agent
|
|
2363
|
-
|
|
2364
|
-
Parameters
|
|
2365
|
-
----------
|
|
2366
|
-
agent_id : str
|
|
2367
|
-
|
|
2368
|
-
manager_type : typing.Optional[str]
|
|
2369
|
-
Manager type to filter groups by
|
|
2370
|
-
|
|
2371
|
-
request_options : typing.Optional[RequestOptions]
|
|
2372
|
-
Request-specific configuration.
|
|
2373
|
-
|
|
2374
|
-
Returns
|
|
2375
|
-
-------
|
|
2376
|
-
typing.List[Group]
|
|
2377
|
-
Successful Response
|
|
2378
|
-
|
|
2379
|
-
Examples
|
|
2380
|
-
--------
|
|
2381
|
-
import asyncio
|
|
2382
|
-
|
|
2383
|
-
from letta_client import AsyncLetta
|
|
2384
|
-
|
|
2385
|
-
client = AsyncLetta(
|
|
2386
|
-
token="YOUR_TOKEN",
|
|
2387
|
-
)
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
async def main() -> None:
|
|
2391
|
-
await client.agents.list_agent_groups(
|
|
2392
|
-
agent_id="agent_id",
|
|
2393
|
-
)
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
asyncio.run(main())
|
|
2397
|
-
"""
|
|
2398
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
2399
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/groups",
|
|
2400
|
-
method="GET",
|
|
2401
|
-
params={
|
|
2402
|
-
"manager_type": manager_type,
|
|
2403
|
-
},
|
|
2404
|
-
request_options=request_options,
|
|
2405
|
-
)
|
|
2406
|
-
try:
|
|
2407
|
-
if 200 <= _response.status_code < 300:
|
|
2408
|
-
return typing.cast(
|
|
2409
|
-
typing.List[Group],
|
|
2410
|
-
construct_type(
|
|
2411
|
-
type_=typing.List[Group], # type: ignore
|
|
2412
|
-
object_=_response.json(),
|
|
2413
|
-
),
|
|
2414
|
-
)
|
|
2415
|
-
if _response.status_code == 422:
|
|
2416
|
-
raise UnprocessableEntityError(
|
|
2417
|
-
typing.cast(
|
|
2418
|
-
HttpValidationError,
|
|
2419
|
-
construct_type(
|
|
2420
|
-
type_=HttpValidationError, # type: ignore
|
|
2421
|
-
object_=_response.json(),
|
|
2422
|
-
),
|
|
2423
|
-
)
|
|
2424
|
-
)
|
|
2425
|
-
_response_json = _response.json()
|
|
2426
|
-
except JSONDecodeError:
|
|
2427
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2428
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2429
|
-
|
|
2430
1939
|
async def search(
|
|
2431
1940
|
self,
|
|
2432
1941
|
*,
|