letta-client 0.1.324__py3-none-any.whl → 1.0.0a1__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 +80 -36
- letta_client/agents/messages/client.py +2 -4
- letta_client/agents/messages/raw_client.py +2 -4
- letta_client/core/client_wrapper.py +2 -2
- letta_client/runs/client.py +2 -2
- letta_client/runs/raw_client.py +2 -2
- letta_client/templates/__init__.py +76 -36
- letta_client/templates/client.py +135 -0
- letta_client/templates/raw_client.py +203 -0
- letta_client/templates/types/__init__.py +152 -72
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_item_zero.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_args.py} +11 -8
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_one_prompt_template.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_args_args.py} +4 -5
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_args_args_item.py +7 -0
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_zero_prompt_template.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_args_prompt_template.py} +4 -4
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_one_prompt_template_item.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_args_prompt_template_item.py} +1 -1
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_zero_type.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_args_type.py} +1 -1
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_zero.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_child_arg_nodes.py} +13 -7
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_child_arg_nodes_child_arg_nodes.py +16 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_child_arg_nodes_child_arg_nodes_item.py +12 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_child_arg_nodes_child_arg_nodes_item_args.py +17 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_child_arg_nodes_child_arg_nodes_item_args_item.py +7 -0
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_item_one.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_child_arg_nodes_child_arg_nodes_item_item.py} +8 -10
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_child_arg_nodes_child_arg_nodes_item_item_args.py +17 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_child_arg_nodes_child_arg_nodes_item_item_args_item.py +7 -0
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_item_zero_prompt_template.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_child_arg_nodes_prompt_template.py} +4 -4
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_item_zero_prompt_template_item.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_child_arg_nodes_prompt_template_item.py} +1 -1
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_item_zero_type.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_child_arg_nodes_type.py} +1 -1
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item.py +8 -8
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_one.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_item_args.py} +11 -7
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item_args_args.py +13 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item_args_args_item.py +7 -0
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_item_one_prompt_template.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_item_args_prompt_template.py} +4 -4
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_item_one_prompt_template_item.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_item_args_prompt_template_item.py} +1 -1
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_item_one_type.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_item_args_type.py} +1 -1
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item_child_arg_nodes.py +37 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item_child_arg_nodes_child_arg_nodes.py +18 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item_child_arg_nodes_child_arg_nodes_item.py +12 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item_child_arg_nodes_child_arg_nodes_item_args.py +17 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item_child_arg_nodes_child_arg_nodes_item_args_item.py +7 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item_child_arg_nodes_child_arg_nodes_item_item.py +28 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item_child_arg_nodes_child_arg_nodes_item_item_args.py +17 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item_child_arg_nodes_child_arg_nodes_item_item_args_item.py +7 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item_child_arg_nodes_prompt_template.py +18 -0
- letta_client/templates/types/{templates_create_agents_from_template_response_agents_item_tool_rules_item_zero_prompt_template_item.py → templates_create_agents_from_template_response_agents_item_tool_rules_item_item_child_arg_nodes_prompt_template_item.py} +1 -1
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_item_child_arg_nodes_type.py +7 -0
- letta_client/templates/types/templates_create_template_request_agent_file.py +5 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item.py +8 -8
- letta_client/templates/types/{templates_get_template_snapshot_response_agents_item_tool_rules_item_one.py → templates_get_template_snapshot_response_agents_item_tool_rules_item_args.py} +2 -1
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item_child_arg_nodes.py +29 -0
- letta_client/templates/types/{templates_get_template_snapshot_response_agents_item_tool_rules_item_zero.py → templates_get_template_snapshot_response_agents_item_tool_rules_item_child_arg_nodes_child_arg_nodes_item.py} +3 -5
- letta_client/templates/types/templates_update_current_template_from_agent_file_response.py +21 -0
- letta_client/types/__init__.py +4 -0
- letta_client/types/child_tool_rule.py +6 -0
- letta_client/types/init_tool_rule.py +5 -0
- letta_client/types/message.py +5 -0
- letta_client/types/run.py +28 -41
- letta_client/types/run_status.py +5 -0
- letta_client/types/step.py +2 -2
- letta_client/types/step_metrics.py +2 -2
- letta_client/types/tool_call_node.py +35 -0
- {letta_client-0.1.324.dist-info → letta_client-1.0.0a1.dist-info}/METADATA +1 -1
- {letta_client-0.1.324.dist-info → letta_client-1.0.0a1.dist-info}/RECORD +63 -41
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_rules_item_one_type.py +0 -5
- {letta_client-0.1.324.dist-info → letta_client-1.0.0a1.dist-info}/WHEEL +0 -0
letta_client/templates/client.py
CHANGED
|
@@ -22,6 +22,9 @@ from .types.templates_migrate_deployment_response import TemplatesMigrateDeploym
|
|
|
22
22
|
from .types.templates_rename_template_response import TemplatesRenameTemplateResponse
|
|
23
23
|
from .types.templates_save_template_version_response import TemplatesSaveTemplateVersionResponse
|
|
24
24
|
from .types.templates_set_current_template_from_snapshot_response import TemplatesSetCurrentTemplateFromSnapshotResponse
|
|
25
|
+
from .types.templates_update_current_template_from_agent_file_response import (
|
|
26
|
+
TemplatesUpdateCurrentTemplateFromAgentFileResponse,
|
|
27
|
+
)
|
|
25
28
|
from .types.templates_update_template_description_response import TemplatesUpdateTemplateDescriptionResponse
|
|
26
29
|
|
|
27
30
|
# this is used as the default value for optional parameters
|
|
@@ -699,6 +702,68 @@ class TemplatesClient:
|
|
|
699
702
|
)
|
|
700
703
|
return _response.data
|
|
701
704
|
|
|
705
|
+
def updatecurrenttemplatefromagentfile(
|
|
706
|
+
self,
|
|
707
|
+
project_id: str,
|
|
708
|
+
template_name: str,
|
|
709
|
+
*,
|
|
710
|
+
agent_file_json: typing.Dict[str, typing.Optional[typing.Any]],
|
|
711
|
+
update_existing_tools: typing.Optional[bool] = OMIT,
|
|
712
|
+
save_existing_changes: typing.Optional[bool] = OMIT,
|
|
713
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
714
|
+
) -> TemplatesUpdateCurrentTemplateFromAgentFileResponse:
|
|
715
|
+
"""
|
|
716
|
+
Updates the current working version of a template from an agent file
|
|
717
|
+
|
|
718
|
+
Parameters
|
|
719
|
+
----------
|
|
720
|
+
project_id : str
|
|
721
|
+
The project id
|
|
722
|
+
|
|
723
|
+
template_name : str
|
|
724
|
+
The template name (without version)
|
|
725
|
+
|
|
726
|
+
agent_file_json : typing.Dict[str, typing.Optional[typing.Any]]
|
|
727
|
+
The agent file to update the current template version from
|
|
728
|
+
|
|
729
|
+
update_existing_tools : typing.Optional[bool]
|
|
730
|
+
If true, update existing custom tools source_code and json_schema (source_type cannot be changed)
|
|
731
|
+
|
|
732
|
+
save_existing_changes : typing.Optional[bool]
|
|
733
|
+
If true, Letta will automatically save any changes as a version before updating the template
|
|
734
|
+
|
|
735
|
+
request_options : typing.Optional[RequestOptions]
|
|
736
|
+
Request-specific configuration.
|
|
737
|
+
|
|
738
|
+
Returns
|
|
739
|
+
-------
|
|
740
|
+
TemplatesUpdateCurrentTemplateFromAgentFileResponse
|
|
741
|
+
200
|
|
742
|
+
|
|
743
|
+
Examples
|
|
744
|
+
--------
|
|
745
|
+
from letta_client import Letta
|
|
746
|
+
|
|
747
|
+
client = Letta(
|
|
748
|
+
project="YOUR_PROJECT",
|
|
749
|
+
token="YOUR_TOKEN",
|
|
750
|
+
)
|
|
751
|
+
client.templates.updatecurrenttemplatefromagentfile(
|
|
752
|
+
project_id="project_id",
|
|
753
|
+
template_name="template_name",
|
|
754
|
+
agent_file_json={"key": "value"},
|
|
755
|
+
)
|
|
756
|
+
"""
|
|
757
|
+
_response = self._raw_client.updatecurrenttemplatefromagentfile(
|
|
758
|
+
project_id,
|
|
759
|
+
template_name,
|
|
760
|
+
agent_file_json=agent_file_json,
|
|
761
|
+
update_existing_tools=update_existing_tools,
|
|
762
|
+
save_existing_changes=save_existing_changes,
|
|
763
|
+
request_options=request_options,
|
|
764
|
+
)
|
|
765
|
+
return _response.data
|
|
766
|
+
|
|
702
767
|
|
|
703
768
|
class AsyncTemplatesClient:
|
|
704
769
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -1468,3 +1533,73 @@ class AsyncTemplatesClient:
|
|
|
1468
1533
|
request_options=request_options,
|
|
1469
1534
|
)
|
|
1470
1535
|
return _response.data
|
|
1536
|
+
|
|
1537
|
+
async def updatecurrenttemplatefromagentfile(
|
|
1538
|
+
self,
|
|
1539
|
+
project_id: str,
|
|
1540
|
+
template_name: str,
|
|
1541
|
+
*,
|
|
1542
|
+
agent_file_json: typing.Dict[str, typing.Optional[typing.Any]],
|
|
1543
|
+
update_existing_tools: typing.Optional[bool] = OMIT,
|
|
1544
|
+
save_existing_changes: typing.Optional[bool] = OMIT,
|
|
1545
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1546
|
+
) -> TemplatesUpdateCurrentTemplateFromAgentFileResponse:
|
|
1547
|
+
"""
|
|
1548
|
+
Updates the current working version of a template from an agent file
|
|
1549
|
+
|
|
1550
|
+
Parameters
|
|
1551
|
+
----------
|
|
1552
|
+
project_id : str
|
|
1553
|
+
The project id
|
|
1554
|
+
|
|
1555
|
+
template_name : str
|
|
1556
|
+
The template name (without version)
|
|
1557
|
+
|
|
1558
|
+
agent_file_json : typing.Dict[str, typing.Optional[typing.Any]]
|
|
1559
|
+
The agent file to update the current template version from
|
|
1560
|
+
|
|
1561
|
+
update_existing_tools : typing.Optional[bool]
|
|
1562
|
+
If true, update existing custom tools source_code and json_schema (source_type cannot be changed)
|
|
1563
|
+
|
|
1564
|
+
save_existing_changes : typing.Optional[bool]
|
|
1565
|
+
If true, Letta will automatically save any changes as a version before updating the template
|
|
1566
|
+
|
|
1567
|
+
request_options : typing.Optional[RequestOptions]
|
|
1568
|
+
Request-specific configuration.
|
|
1569
|
+
|
|
1570
|
+
Returns
|
|
1571
|
+
-------
|
|
1572
|
+
TemplatesUpdateCurrentTemplateFromAgentFileResponse
|
|
1573
|
+
200
|
|
1574
|
+
|
|
1575
|
+
Examples
|
|
1576
|
+
--------
|
|
1577
|
+
import asyncio
|
|
1578
|
+
|
|
1579
|
+
from letta_client import AsyncLetta
|
|
1580
|
+
|
|
1581
|
+
client = AsyncLetta(
|
|
1582
|
+
project="YOUR_PROJECT",
|
|
1583
|
+
token="YOUR_TOKEN",
|
|
1584
|
+
)
|
|
1585
|
+
|
|
1586
|
+
|
|
1587
|
+
async def main() -> None:
|
|
1588
|
+
await client.templates.updatecurrenttemplatefromagentfile(
|
|
1589
|
+
project_id="project_id",
|
|
1590
|
+
template_name="template_name",
|
|
1591
|
+
agent_file_json={"key": "value"},
|
|
1592
|
+
)
|
|
1593
|
+
|
|
1594
|
+
|
|
1595
|
+
asyncio.run(main())
|
|
1596
|
+
"""
|
|
1597
|
+
_response = await self._raw_client.updatecurrenttemplatefromagentfile(
|
|
1598
|
+
project_id,
|
|
1599
|
+
template_name,
|
|
1600
|
+
agent_file_json=agent_file_json,
|
|
1601
|
+
update_existing_tools=update_existing_tools,
|
|
1602
|
+
save_existing_changes=save_existing_changes,
|
|
1603
|
+
request_options=request_options,
|
|
1604
|
+
)
|
|
1605
|
+
return _response.data
|
|
@@ -33,6 +33,9 @@ from .types.templates_migrate_deployment_response import TemplatesMigrateDeploym
|
|
|
33
33
|
from .types.templates_rename_template_response import TemplatesRenameTemplateResponse
|
|
34
34
|
from .types.templates_save_template_version_response import TemplatesSaveTemplateVersionResponse
|
|
35
35
|
from .types.templates_set_current_template_from_snapshot_response import TemplatesSetCurrentTemplateFromSnapshotResponse
|
|
36
|
+
from .types.templates_update_current_template_from_agent_file_response import (
|
|
37
|
+
TemplatesUpdateCurrentTemplateFromAgentFileResponse,
|
|
38
|
+
)
|
|
36
39
|
from .types.templates_update_template_description_response import TemplatesUpdateTemplateDescriptionResponse
|
|
37
40
|
|
|
38
41
|
# this is used as the default value for optional parameters
|
|
@@ -970,6 +973,106 @@ class RawTemplatesClient:
|
|
|
970
973
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
971
974
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
972
975
|
|
|
976
|
+
def updatecurrenttemplatefromagentfile(
|
|
977
|
+
self,
|
|
978
|
+
project_id: str,
|
|
979
|
+
template_name: str,
|
|
980
|
+
*,
|
|
981
|
+
agent_file_json: typing.Dict[str, typing.Optional[typing.Any]],
|
|
982
|
+
update_existing_tools: typing.Optional[bool] = OMIT,
|
|
983
|
+
save_existing_changes: typing.Optional[bool] = OMIT,
|
|
984
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
985
|
+
) -> HttpResponse[TemplatesUpdateCurrentTemplateFromAgentFileResponse]:
|
|
986
|
+
"""
|
|
987
|
+
Updates the current working version of a template from an agent file
|
|
988
|
+
|
|
989
|
+
Parameters
|
|
990
|
+
----------
|
|
991
|
+
project_id : str
|
|
992
|
+
The project id
|
|
993
|
+
|
|
994
|
+
template_name : str
|
|
995
|
+
The template name (without version)
|
|
996
|
+
|
|
997
|
+
agent_file_json : typing.Dict[str, typing.Optional[typing.Any]]
|
|
998
|
+
The agent file to update the current template version from
|
|
999
|
+
|
|
1000
|
+
update_existing_tools : typing.Optional[bool]
|
|
1001
|
+
If true, update existing custom tools source_code and json_schema (source_type cannot be changed)
|
|
1002
|
+
|
|
1003
|
+
save_existing_changes : typing.Optional[bool]
|
|
1004
|
+
If true, Letta will automatically save any changes as a version before updating the template
|
|
1005
|
+
|
|
1006
|
+
request_options : typing.Optional[RequestOptions]
|
|
1007
|
+
Request-specific configuration.
|
|
1008
|
+
|
|
1009
|
+
Returns
|
|
1010
|
+
-------
|
|
1011
|
+
HttpResponse[TemplatesUpdateCurrentTemplateFromAgentFileResponse]
|
|
1012
|
+
200
|
|
1013
|
+
"""
|
|
1014
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1015
|
+
f"v1/templates/{jsonable_encoder(project_id)}/{jsonable_encoder(template_name)}/agent-file",
|
|
1016
|
+
method="PUT",
|
|
1017
|
+
json={
|
|
1018
|
+
"agent_file_json": agent_file_json,
|
|
1019
|
+
"update_existing_tools": update_existing_tools,
|
|
1020
|
+
"save_existing_changes": save_existing_changes,
|
|
1021
|
+
},
|
|
1022
|
+
headers={
|
|
1023
|
+
"content-type": "application/json",
|
|
1024
|
+
},
|
|
1025
|
+
request_options=request_options,
|
|
1026
|
+
omit=OMIT,
|
|
1027
|
+
)
|
|
1028
|
+
try:
|
|
1029
|
+
if 200 <= _response.status_code < 300:
|
|
1030
|
+
_data = typing.cast(
|
|
1031
|
+
TemplatesUpdateCurrentTemplateFromAgentFileResponse,
|
|
1032
|
+
construct_type(
|
|
1033
|
+
type_=TemplatesUpdateCurrentTemplateFromAgentFileResponse, # type: ignore
|
|
1034
|
+
object_=_response.json(),
|
|
1035
|
+
),
|
|
1036
|
+
)
|
|
1037
|
+
return HttpResponse(response=_response, data=_data)
|
|
1038
|
+
if _response.status_code == 400:
|
|
1039
|
+
raise BadRequestError(
|
|
1040
|
+
headers=dict(_response.headers),
|
|
1041
|
+
body=typing.cast(
|
|
1042
|
+
typing.Optional[typing.Any],
|
|
1043
|
+
construct_type(
|
|
1044
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1045
|
+
object_=_response.json(),
|
|
1046
|
+
),
|
|
1047
|
+
),
|
|
1048
|
+
)
|
|
1049
|
+
if _response.status_code == 404:
|
|
1050
|
+
raise NotFoundError(
|
|
1051
|
+
headers=dict(_response.headers),
|
|
1052
|
+
body=typing.cast(
|
|
1053
|
+
typing.Optional[typing.Any],
|
|
1054
|
+
construct_type(
|
|
1055
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1056
|
+
object_=_response.json(),
|
|
1057
|
+
),
|
|
1058
|
+
),
|
|
1059
|
+
)
|
|
1060
|
+
if _response.status_code == 500:
|
|
1061
|
+
raise InternalServerError(
|
|
1062
|
+
headers=dict(_response.headers),
|
|
1063
|
+
body=typing.cast(
|
|
1064
|
+
typing.Optional[typing.Any],
|
|
1065
|
+
construct_type(
|
|
1066
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1067
|
+
object_=_response.json(),
|
|
1068
|
+
),
|
|
1069
|
+
),
|
|
1070
|
+
)
|
|
1071
|
+
_response_json = _response.json()
|
|
1072
|
+
except JSONDecodeError:
|
|
1073
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1074
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1075
|
+
|
|
973
1076
|
|
|
974
1077
|
class AsyncRawTemplatesClient:
|
|
975
1078
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -1901,3 +2004,103 @@ class AsyncRawTemplatesClient:
|
|
|
1901
2004
|
except JSONDecodeError:
|
|
1902
2005
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1903
2006
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2007
|
+
|
|
2008
|
+
async def updatecurrenttemplatefromagentfile(
|
|
2009
|
+
self,
|
|
2010
|
+
project_id: str,
|
|
2011
|
+
template_name: str,
|
|
2012
|
+
*,
|
|
2013
|
+
agent_file_json: typing.Dict[str, typing.Optional[typing.Any]],
|
|
2014
|
+
update_existing_tools: typing.Optional[bool] = OMIT,
|
|
2015
|
+
save_existing_changes: typing.Optional[bool] = OMIT,
|
|
2016
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2017
|
+
) -> AsyncHttpResponse[TemplatesUpdateCurrentTemplateFromAgentFileResponse]:
|
|
2018
|
+
"""
|
|
2019
|
+
Updates the current working version of a template from an agent file
|
|
2020
|
+
|
|
2021
|
+
Parameters
|
|
2022
|
+
----------
|
|
2023
|
+
project_id : str
|
|
2024
|
+
The project id
|
|
2025
|
+
|
|
2026
|
+
template_name : str
|
|
2027
|
+
The template name (without version)
|
|
2028
|
+
|
|
2029
|
+
agent_file_json : typing.Dict[str, typing.Optional[typing.Any]]
|
|
2030
|
+
The agent file to update the current template version from
|
|
2031
|
+
|
|
2032
|
+
update_existing_tools : typing.Optional[bool]
|
|
2033
|
+
If true, update existing custom tools source_code and json_schema (source_type cannot be changed)
|
|
2034
|
+
|
|
2035
|
+
save_existing_changes : typing.Optional[bool]
|
|
2036
|
+
If true, Letta will automatically save any changes as a version before updating the template
|
|
2037
|
+
|
|
2038
|
+
request_options : typing.Optional[RequestOptions]
|
|
2039
|
+
Request-specific configuration.
|
|
2040
|
+
|
|
2041
|
+
Returns
|
|
2042
|
+
-------
|
|
2043
|
+
AsyncHttpResponse[TemplatesUpdateCurrentTemplateFromAgentFileResponse]
|
|
2044
|
+
200
|
|
2045
|
+
"""
|
|
2046
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2047
|
+
f"v1/templates/{jsonable_encoder(project_id)}/{jsonable_encoder(template_name)}/agent-file",
|
|
2048
|
+
method="PUT",
|
|
2049
|
+
json={
|
|
2050
|
+
"agent_file_json": agent_file_json,
|
|
2051
|
+
"update_existing_tools": update_existing_tools,
|
|
2052
|
+
"save_existing_changes": save_existing_changes,
|
|
2053
|
+
},
|
|
2054
|
+
headers={
|
|
2055
|
+
"content-type": "application/json",
|
|
2056
|
+
},
|
|
2057
|
+
request_options=request_options,
|
|
2058
|
+
omit=OMIT,
|
|
2059
|
+
)
|
|
2060
|
+
try:
|
|
2061
|
+
if 200 <= _response.status_code < 300:
|
|
2062
|
+
_data = typing.cast(
|
|
2063
|
+
TemplatesUpdateCurrentTemplateFromAgentFileResponse,
|
|
2064
|
+
construct_type(
|
|
2065
|
+
type_=TemplatesUpdateCurrentTemplateFromAgentFileResponse, # type: ignore
|
|
2066
|
+
object_=_response.json(),
|
|
2067
|
+
),
|
|
2068
|
+
)
|
|
2069
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2070
|
+
if _response.status_code == 400:
|
|
2071
|
+
raise BadRequestError(
|
|
2072
|
+
headers=dict(_response.headers),
|
|
2073
|
+
body=typing.cast(
|
|
2074
|
+
typing.Optional[typing.Any],
|
|
2075
|
+
construct_type(
|
|
2076
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2077
|
+
object_=_response.json(),
|
|
2078
|
+
),
|
|
2079
|
+
),
|
|
2080
|
+
)
|
|
2081
|
+
if _response.status_code == 404:
|
|
2082
|
+
raise NotFoundError(
|
|
2083
|
+
headers=dict(_response.headers),
|
|
2084
|
+
body=typing.cast(
|
|
2085
|
+
typing.Optional[typing.Any],
|
|
2086
|
+
construct_type(
|
|
2087
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2088
|
+
object_=_response.json(),
|
|
2089
|
+
),
|
|
2090
|
+
),
|
|
2091
|
+
)
|
|
2092
|
+
if _response.status_code == 500:
|
|
2093
|
+
raise InternalServerError(
|
|
2094
|
+
headers=dict(_response.headers),
|
|
2095
|
+
body=typing.cast(
|
|
2096
|
+
typing.Optional[typing.Any],
|
|
2097
|
+
construct_type(
|
|
2098
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2099
|
+
object_=_response.json(),
|
|
2100
|
+
),
|
|
2101
|
+
),
|
|
2102
|
+
)
|
|
2103
|
+
_response_json = _response.json()
|
|
2104
|
+
except JSONDecodeError:
|
|
2105
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2106
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|