letta-client 0.1.267__py3-none-any.whl → 0.1.268__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 +57 -14
- letta_client/agents/__init__.py +1 -3
- letta_client/agents/templates/__init__.py +2 -2
- letta_client/agents/templates/client.py +52 -134
- letta_client/agents/templates/raw_client.py +50 -300
- letta_client/agents/templates/types/__init__.py +1 -3
- letta_client/core/client_wrapper.py +2 -2
- letta_client/errors/__init__.py +1 -9
- letta_client/templates/__init__.py +56 -1
- letta_client/templates/client.py +774 -2
- letta_client/templates/raw_client.py +1016 -21
- letta_client/templates/types/__init__.py +84 -1
- letta_client/templates/types/templates_create_template_response.py +37 -0
- letta_client/{types/internal_server_error_body.py → templates/types/templates_delete_template_response.py} +4 -4
- letta_client/templates/types/templates_fork_template_response.py +37 -0
- letta_client/templates/types/templates_get_template_snapshot_response.py +28 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item.py +56 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_memory_variables.py +24 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_memory_variables_data_item.py +24 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_properties.py +25 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item.py +39 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item_child_output_mapping.py +25 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item_five.py +22 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item_four.py +22 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item_max_count_limit.py +23 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item_one.py +22 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item_seven.py +23 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item_two.py +22 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item_zero.py +23 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_variables.py +24 -0
- letta_client/{agents/templates/types/templates_create_response.py → templates/types/templates_get_template_snapshot_response_agents_item_tool_variables_data_item.py} +7 -6
- letta_client/templates/types/templates_get_template_snapshot_response_blocks_item.py +29 -0
- letta_client/templates/types/templates_get_template_snapshot_response_configuration.py +34 -0
- letta_client/templates/types/templates_get_template_snapshot_response_type.py +8 -0
- letta_client/templates/types/templates_list_response_templates_item.py +11 -1
- letta_client/templates/types/templates_list_template_versions_response.py +23 -0
- letta_client/templates/types/templates_list_template_versions_response_versions_item.py +38 -0
- letta_client/templates/types/templates_rename_template_response.py +20 -0
- letta_client/templates/types/templates_save_template_version_response.py +37 -0
- letta_client/types/__init__.py +0 -4
- letta_client/types/conflict_error_body.py +1 -3
- letta_client/types/not_found_error_body.py +1 -1
- {letta_client-0.1.267.dist-info → letta_client-0.1.268.dist-info}/METADATA +1 -1
- {letta_client-0.1.267.dist-info → letta_client-0.1.268.dist-info}/RECORD +45 -24
- letta_client/agents/templates/types/templates_create_version_request_return_agent_state.py +0 -5
- letta_client/errors/internal_server_error.py +0 -10
- letta_client/types/not_found_error_body_message.py +0 -11
- {letta_client-0.1.267.dist-info → letta_client-0.1.268.dist-info}/WHEEL +0 -0
|
@@ -9,12 +9,6 @@ from ...core.http_response import AsyncHttpResponse, HttpResponse
|
|
|
9
9
|
from ...core.jsonable_encoder import jsonable_encoder
|
|
10
10
|
from ...core.request_options import RequestOptions
|
|
11
11
|
from ...core.unchecked_base_model import construct_type
|
|
12
|
-
from ...errors.conflict_error import ConflictError
|
|
13
|
-
from ...errors.internal_server_error import InternalServerError
|
|
14
|
-
from ...errors.not_found_error import NotFoundError
|
|
15
|
-
from ...types.conflict_error_body import ConflictErrorBody
|
|
16
|
-
from .types.templates_create_response import TemplatesCreateResponse
|
|
17
|
-
from .types.templates_create_version_request_return_agent_state import TemplatesCreateVersionRequestReturnAgentState
|
|
18
12
|
from .types.templates_migrate_response import TemplatesMigrateResponse
|
|
19
13
|
|
|
20
14
|
# this is used as the default value for optional parameters
|
|
@@ -25,96 +19,12 @@ class RawTemplatesClient:
|
|
|
25
19
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
26
20
|
self._client_wrapper = client_wrapper
|
|
27
21
|
|
|
28
|
-
def create_version(
|
|
29
|
-
self,
|
|
30
|
-
agent_id: str,
|
|
31
|
-
*,
|
|
32
|
-
return_agent_state: typing.Optional[TemplatesCreateVersionRequestReturnAgentState] = None,
|
|
33
|
-
migrate_deployed_agents: typing.Optional[bool] = OMIT,
|
|
34
|
-
message: typing.Optional[str] = OMIT,
|
|
35
|
-
preserve_tool_variables: typing.Optional[bool] = OMIT,
|
|
36
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
37
|
-
) -> HttpResponse[None]:
|
|
38
|
-
"""
|
|
39
|
-
<Note>This endpoint is only available on Letta Cloud.</Note>
|
|
40
|
-
|
|
41
|
-
Creates a new version of the template version of the agent.
|
|
42
|
-
|
|
43
|
-
Parameters
|
|
44
|
-
----------
|
|
45
|
-
agent_id : str
|
|
46
|
-
The agent ID of the agent to migrate, if this agent is not a template, it will create a agent template from the agent provided as well
|
|
47
|
-
|
|
48
|
-
return_agent_state : typing.Optional[TemplatesCreateVersionRequestReturnAgentState]
|
|
49
|
-
|
|
50
|
-
migrate_deployed_agents : typing.Optional[bool]
|
|
51
|
-
|
|
52
|
-
message : typing.Optional[str]
|
|
53
|
-
|
|
54
|
-
preserve_tool_variables : typing.Optional[bool]
|
|
55
|
-
If true, preserves the existing agent's tool environment variables when migrating deployed agents
|
|
56
|
-
|
|
57
|
-
request_options : typing.Optional[RequestOptions]
|
|
58
|
-
Request-specific configuration.
|
|
59
|
-
|
|
60
|
-
Returns
|
|
61
|
-
-------
|
|
62
|
-
HttpResponse[None]
|
|
63
|
-
"""
|
|
64
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
65
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/version-template",
|
|
66
|
-
method="POST",
|
|
67
|
-
params={
|
|
68
|
-
"returnAgentState": return_agent_state,
|
|
69
|
-
},
|
|
70
|
-
json={
|
|
71
|
-
"migrate_deployed_agents": migrate_deployed_agents,
|
|
72
|
-
"message": message,
|
|
73
|
-
"preserve_tool_variables": preserve_tool_variables,
|
|
74
|
-
},
|
|
75
|
-
headers={
|
|
76
|
-
"content-type": "application/json",
|
|
77
|
-
},
|
|
78
|
-
request_options=request_options,
|
|
79
|
-
omit=OMIT,
|
|
80
|
-
)
|
|
81
|
-
try:
|
|
82
|
-
if 200 <= _response.status_code < 300:
|
|
83
|
-
return HttpResponse(response=_response, data=None)
|
|
84
|
-
if _response.status_code == 404:
|
|
85
|
-
raise NotFoundError(
|
|
86
|
-
headers=dict(_response.headers),
|
|
87
|
-
body=typing.cast(
|
|
88
|
-
typing.Optional[typing.Any],
|
|
89
|
-
construct_type(
|
|
90
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
91
|
-
object_=_response.json(),
|
|
92
|
-
),
|
|
93
|
-
),
|
|
94
|
-
)
|
|
95
|
-
if _response.status_code == 500:
|
|
96
|
-
raise InternalServerError(
|
|
97
|
-
headers=dict(_response.headers),
|
|
98
|
-
body=typing.cast(
|
|
99
|
-
typing.Optional[typing.Any],
|
|
100
|
-
construct_type(
|
|
101
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
102
|
-
object_=_response.json(),
|
|
103
|
-
),
|
|
104
|
-
),
|
|
105
|
-
)
|
|
106
|
-
_response_json = _response.json()
|
|
107
|
-
except JSONDecodeError:
|
|
108
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
109
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
110
|
-
|
|
111
22
|
def migrate(
|
|
112
23
|
self,
|
|
113
24
|
agent_id: str,
|
|
114
25
|
*,
|
|
115
26
|
to_template: str,
|
|
116
27
|
preserve_core_memories: bool,
|
|
117
|
-
variables: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
118
28
|
preserve_tool_variables: typing.Optional[bool] = OMIT,
|
|
119
29
|
request_options: typing.Optional[RequestOptions] = None,
|
|
120
30
|
) -> HttpResponse[TemplatesMigrateResponse]:
|
|
@@ -131,9 +41,6 @@ class RawTemplatesClient:
|
|
|
131
41
|
|
|
132
42
|
preserve_core_memories : bool
|
|
133
43
|
|
|
134
|
-
variables : typing.Optional[typing.Dict[str, str]]
|
|
135
|
-
If you chose to not preserve core memories, you should provide the new variables for the core memories
|
|
136
|
-
|
|
137
44
|
preserve_tool_variables : typing.Optional[bool]
|
|
138
45
|
If true, preserves the existing agent's tool environment variables instead of using the template's variables
|
|
139
46
|
|
|
@@ -150,7 +57,6 @@ class RawTemplatesClient:
|
|
|
150
57
|
method="POST",
|
|
151
58
|
json={
|
|
152
59
|
"to_template": to_template,
|
|
153
|
-
"variables": variables,
|
|
154
60
|
"preserve_core_memories": preserve_core_memories,
|
|
155
61
|
"preserve_tool_variables": preserve_tool_variables,
|
|
156
62
|
},
|
|
@@ -170,51 +76,12 @@ class RawTemplatesClient:
|
|
|
170
76
|
),
|
|
171
77
|
)
|
|
172
78
|
return HttpResponse(response=_response, data=_data)
|
|
173
|
-
if _response.status_code == 404:
|
|
174
|
-
raise NotFoundError(
|
|
175
|
-
headers=dict(_response.headers),
|
|
176
|
-
body=typing.cast(
|
|
177
|
-
typing.Optional[typing.Any],
|
|
178
|
-
construct_type(
|
|
179
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
180
|
-
object_=_response.json(),
|
|
181
|
-
),
|
|
182
|
-
),
|
|
183
|
-
)
|
|
184
|
-
if _response.status_code == 409:
|
|
185
|
-
raise ConflictError(
|
|
186
|
-
headers=dict(_response.headers),
|
|
187
|
-
body=typing.cast(
|
|
188
|
-
ConflictErrorBody,
|
|
189
|
-
construct_type(
|
|
190
|
-
type_=ConflictErrorBody, # type: ignore
|
|
191
|
-
object_=_response.json(),
|
|
192
|
-
),
|
|
193
|
-
),
|
|
194
|
-
)
|
|
195
|
-
if _response.status_code == 500:
|
|
196
|
-
raise InternalServerError(
|
|
197
|
-
headers=dict(_response.headers),
|
|
198
|
-
body=typing.cast(
|
|
199
|
-
typing.Optional[typing.Any],
|
|
200
|
-
construct_type(
|
|
201
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
202
|
-
object_=_response.json(),
|
|
203
|
-
),
|
|
204
|
-
),
|
|
205
|
-
)
|
|
206
79
|
_response_json = _response.json()
|
|
207
80
|
except JSONDecodeError:
|
|
208
81
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
209
82
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
210
83
|
|
|
211
|
-
def create(
|
|
212
|
-
self,
|
|
213
|
-
agent_id: str,
|
|
214
|
-
*,
|
|
215
|
-
project: typing.Optional[str] = OMIT,
|
|
216
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
217
|
-
) -> HttpResponse[TemplatesCreateResponse]:
|
|
84
|
+
def create(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
|
|
218
85
|
"""
|
|
219
86
|
<Note>This endpoint is only available on Letta Cloud.</Note>
|
|
220
87
|
|
|
@@ -224,69 +91,29 @@ class RawTemplatesClient:
|
|
|
224
91
|
----------
|
|
225
92
|
agent_id : str
|
|
226
93
|
|
|
227
|
-
project : typing.Optional[str]
|
|
228
|
-
|
|
229
94
|
request_options : typing.Optional[RequestOptions]
|
|
230
95
|
Request-specific configuration.
|
|
231
96
|
|
|
232
97
|
Returns
|
|
233
98
|
-------
|
|
234
|
-
HttpResponse[
|
|
235
|
-
201
|
|
99
|
+
HttpResponse[None]
|
|
236
100
|
"""
|
|
237
101
|
_response = self._client_wrapper.httpx_client.request(
|
|
238
102
|
f"v1/agents/{jsonable_encoder(agent_id)}/template",
|
|
239
103
|
method="POST",
|
|
240
|
-
json={
|
|
241
|
-
"project": project,
|
|
242
|
-
},
|
|
243
|
-
headers={
|
|
244
|
-
"content-type": "application/json",
|
|
245
|
-
},
|
|
246
104
|
request_options=request_options,
|
|
247
|
-
omit=OMIT,
|
|
248
105
|
)
|
|
249
106
|
try:
|
|
250
107
|
if 200 <= _response.status_code < 300:
|
|
251
|
-
|
|
252
|
-
TemplatesCreateResponse,
|
|
253
|
-
construct_type(
|
|
254
|
-
type_=TemplatesCreateResponse, # type: ignore
|
|
255
|
-
object_=_response.json(),
|
|
256
|
-
),
|
|
257
|
-
)
|
|
258
|
-
return HttpResponse(response=_response, data=_data)
|
|
259
|
-
if _response.status_code == 500:
|
|
260
|
-
raise InternalServerError(
|
|
261
|
-
headers=dict(_response.headers),
|
|
262
|
-
body=typing.cast(
|
|
263
|
-
typing.Optional[typing.Any],
|
|
264
|
-
construct_type(
|
|
265
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
266
|
-
object_=_response.json(),
|
|
267
|
-
),
|
|
268
|
-
),
|
|
269
|
-
)
|
|
108
|
+
return HttpResponse(response=_response, data=None)
|
|
270
109
|
_response_json = _response.json()
|
|
271
110
|
except JSONDecodeError:
|
|
272
111
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
273
112
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
274
113
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
self._client_wrapper = client_wrapper
|
|
279
|
-
|
|
280
|
-
async def create_version(
|
|
281
|
-
self,
|
|
282
|
-
agent_id: str,
|
|
283
|
-
*,
|
|
284
|
-
return_agent_state: typing.Optional[TemplatesCreateVersionRequestReturnAgentState] = None,
|
|
285
|
-
migrate_deployed_agents: typing.Optional[bool] = OMIT,
|
|
286
|
-
message: typing.Optional[str] = OMIT,
|
|
287
|
-
preserve_tool_variables: typing.Optional[bool] = OMIT,
|
|
288
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
289
|
-
) -> AsyncHttpResponse[None]:
|
|
114
|
+
def create_version(
|
|
115
|
+
self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
116
|
+
) -> HttpResponse[None]:
|
|
290
117
|
"""
|
|
291
118
|
<Note>This endpoint is only available on Letta Cloud.</Note>
|
|
292
119
|
|
|
@@ -295,78 +122,38 @@ class AsyncRawTemplatesClient:
|
|
|
295
122
|
Parameters
|
|
296
123
|
----------
|
|
297
124
|
agent_id : str
|
|
298
|
-
The agent ID of the agent to migrate, if this agent is not a template, it will create a agent template from the agent provided as well
|
|
299
|
-
|
|
300
|
-
return_agent_state : typing.Optional[TemplatesCreateVersionRequestReturnAgentState]
|
|
301
|
-
|
|
302
|
-
migrate_deployed_agents : typing.Optional[bool]
|
|
303
|
-
|
|
304
|
-
message : typing.Optional[str]
|
|
305
|
-
|
|
306
|
-
preserve_tool_variables : typing.Optional[bool]
|
|
307
|
-
If true, preserves the existing agent's tool environment variables when migrating deployed agents
|
|
308
125
|
|
|
309
126
|
request_options : typing.Optional[RequestOptions]
|
|
310
127
|
Request-specific configuration.
|
|
311
128
|
|
|
312
129
|
Returns
|
|
313
130
|
-------
|
|
314
|
-
|
|
131
|
+
HttpResponse[None]
|
|
315
132
|
"""
|
|
316
|
-
_response =
|
|
133
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
317
134
|
f"v1/agents/{jsonable_encoder(agent_id)}/version-template",
|
|
318
135
|
method="POST",
|
|
319
|
-
params={
|
|
320
|
-
"returnAgentState": return_agent_state,
|
|
321
|
-
},
|
|
322
|
-
json={
|
|
323
|
-
"migrate_deployed_agents": migrate_deployed_agents,
|
|
324
|
-
"message": message,
|
|
325
|
-
"preserve_tool_variables": preserve_tool_variables,
|
|
326
|
-
},
|
|
327
|
-
headers={
|
|
328
|
-
"content-type": "application/json",
|
|
329
|
-
},
|
|
330
136
|
request_options=request_options,
|
|
331
|
-
omit=OMIT,
|
|
332
137
|
)
|
|
333
138
|
try:
|
|
334
139
|
if 200 <= _response.status_code < 300:
|
|
335
|
-
return
|
|
336
|
-
if _response.status_code == 404:
|
|
337
|
-
raise NotFoundError(
|
|
338
|
-
headers=dict(_response.headers),
|
|
339
|
-
body=typing.cast(
|
|
340
|
-
typing.Optional[typing.Any],
|
|
341
|
-
construct_type(
|
|
342
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
343
|
-
object_=_response.json(),
|
|
344
|
-
),
|
|
345
|
-
),
|
|
346
|
-
)
|
|
347
|
-
if _response.status_code == 500:
|
|
348
|
-
raise InternalServerError(
|
|
349
|
-
headers=dict(_response.headers),
|
|
350
|
-
body=typing.cast(
|
|
351
|
-
typing.Optional[typing.Any],
|
|
352
|
-
construct_type(
|
|
353
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
354
|
-
object_=_response.json(),
|
|
355
|
-
),
|
|
356
|
-
),
|
|
357
|
-
)
|
|
140
|
+
return HttpResponse(response=_response, data=None)
|
|
358
141
|
_response_json = _response.json()
|
|
359
142
|
except JSONDecodeError:
|
|
360
143
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
361
144
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
362
145
|
|
|
146
|
+
|
|
147
|
+
class AsyncRawTemplatesClient:
|
|
148
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
149
|
+
self._client_wrapper = client_wrapper
|
|
150
|
+
|
|
363
151
|
async def migrate(
|
|
364
152
|
self,
|
|
365
153
|
agent_id: str,
|
|
366
154
|
*,
|
|
367
155
|
to_template: str,
|
|
368
156
|
preserve_core_memories: bool,
|
|
369
|
-
variables: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
370
157
|
preserve_tool_variables: typing.Optional[bool] = OMIT,
|
|
371
158
|
request_options: typing.Optional[RequestOptions] = None,
|
|
372
159
|
) -> AsyncHttpResponse[TemplatesMigrateResponse]:
|
|
@@ -383,9 +170,6 @@ class AsyncRawTemplatesClient:
|
|
|
383
170
|
|
|
384
171
|
preserve_core_memories : bool
|
|
385
172
|
|
|
386
|
-
variables : typing.Optional[typing.Dict[str, str]]
|
|
387
|
-
If you chose to not preserve core memories, you should provide the new variables for the core memories
|
|
388
|
-
|
|
389
173
|
preserve_tool_variables : typing.Optional[bool]
|
|
390
174
|
If true, preserves the existing agent's tool environment variables instead of using the template's variables
|
|
391
175
|
|
|
@@ -402,7 +186,6 @@ class AsyncRawTemplatesClient:
|
|
|
402
186
|
method="POST",
|
|
403
187
|
json={
|
|
404
188
|
"to_template": to_template,
|
|
405
|
-
"variables": variables,
|
|
406
189
|
"preserve_core_memories": preserve_core_memories,
|
|
407
190
|
"preserve_tool_variables": preserve_tool_variables,
|
|
408
191
|
},
|
|
@@ -422,51 +205,14 @@ class AsyncRawTemplatesClient:
|
|
|
422
205
|
),
|
|
423
206
|
)
|
|
424
207
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
425
|
-
if _response.status_code == 404:
|
|
426
|
-
raise NotFoundError(
|
|
427
|
-
headers=dict(_response.headers),
|
|
428
|
-
body=typing.cast(
|
|
429
|
-
typing.Optional[typing.Any],
|
|
430
|
-
construct_type(
|
|
431
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
432
|
-
object_=_response.json(),
|
|
433
|
-
),
|
|
434
|
-
),
|
|
435
|
-
)
|
|
436
|
-
if _response.status_code == 409:
|
|
437
|
-
raise ConflictError(
|
|
438
|
-
headers=dict(_response.headers),
|
|
439
|
-
body=typing.cast(
|
|
440
|
-
ConflictErrorBody,
|
|
441
|
-
construct_type(
|
|
442
|
-
type_=ConflictErrorBody, # type: ignore
|
|
443
|
-
object_=_response.json(),
|
|
444
|
-
),
|
|
445
|
-
),
|
|
446
|
-
)
|
|
447
|
-
if _response.status_code == 500:
|
|
448
|
-
raise InternalServerError(
|
|
449
|
-
headers=dict(_response.headers),
|
|
450
|
-
body=typing.cast(
|
|
451
|
-
typing.Optional[typing.Any],
|
|
452
|
-
construct_type(
|
|
453
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
454
|
-
object_=_response.json(),
|
|
455
|
-
),
|
|
456
|
-
),
|
|
457
|
-
)
|
|
458
208
|
_response_json = _response.json()
|
|
459
209
|
except JSONDecodeError:
|
|
460
210
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
461
211
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
462
212
|
|
|
463
213
|
async def create(
|
|
464
|
-
self,
|
|
465
|
-
|
|
466
|
-
*,
|
|
467
|
-
project: typing.Optional[str] = OMIT,
|
|
468
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
469
|
-
) -> AsyncHttpResponse[TemplatesCreateResponse]:
|
|
214
|
+
self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
215
|
+
) -> AsyncHttpResponse[None]:
|
|
470
216
|
"""
|
|
471
217
|
<Note>This endpoint is only available on Letta Cloud.</Note>
|
|
472
218
|
|
|
@@ -476,49 +222,53 @@ class AsyncRawTemplatesClient:
|
|
|
476
222
|
----------
|
|
477
223
|
agent_id : str
|
|
478
224
|
|
|
479
|
-
project : typing.Optional[str]
|
|
480
|
-
|
|
481
225
|
request_options : typing.Optional[RequestOptions]
|
|
482
226
|
Request-specific configuration.
|
|
483
227
|
|
|
484
228
|
Returns
|
|
485
229
|
-------
|
|
486
|
-
AsyncHttpResponse[
|
|
487
|
-
201
|
|
230
|
+
AsyncHttpResponse[None]
|
|
488
231
|
"""
|
|
489
232
|
_response = await self._client_wrapper.httpx_client.request(
|
|
490
233
|
f"v1/agents/{jsonable_encoder(agent_id)}/template",
|
|
491
234
|
method="POST",
|
|
492
|
-
json={
|
|
493
|
-
"project": project,
|
|
494
|
-
},
|
|
495
|
-
headers={
|
|
496
|
-
"content-type": "application/json",
|
|
497
|
-
},
|
|
498
235
|
request_options=request_options,
|
|
499
|
-
omit=OMIT,
|
|
500
236
|
)
|
|
501
237
|
try:
|
|
502
238
|
if 200 <= _response.status_code < 300:
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
239
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
240
|
+
_response_json = _response.json()
|
|
241
|
+
except JSONDecodeError:
|
|
242
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
243
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
244
|
+
|
|
245
|
+
async def create_version(
|
|
246
|
+
self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
247
|
+
) -> AsyncHttpResponse[None]:
|
|
248
|
+
"""
|
|
249
|
+
<Note>This endpoint is only available on Letta Cloud.</Note>
|
|
250
|
+
|
|
251
|
+
Creates a new version of the template version of the agent.
|
|
252
|
+
|
|
253
|
+
Parameters
|
|
254
|
+
----------
|
|
255
|
+
agent_id : str
|
|
256
|
+
|
|
257
|
+
request_options : typing.Optional[RequestOptions]
|
|
258
|
+
Request-specific configuration.
|
|
259
|
+
|
|
260
|
+
Returns
|
|
261
|
+
-------
|
|
262
|
+
AsyncHttpResponse[None]
|
|
263
|
+
"""
|
|
264
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
265
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/version-template",
|
|
266
|
+
method="POST",
|
|
267
|
+
request_options=request_options,
|
|
268
|
+
)
|
|
269
|
+
try:
|
|
270
|
+
if 200 <= _response.status_code < 300:
|
|
271
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
522
272
|
_response_json = _response.json()
|
|
523
273
|
except JSONDecodeError:
|
|
524
274
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
# isort: skip_file
|
|
4
4
|
|
|
5
|
-
from .templates_create_response import TemplatesCreateResponse
|
|
6
|
-
from .templates_create_version_request_return_agent_state import TemplatesCreateVersionRequestReturnAgentState
|
|
7
5
|
from .templates_migrate_response import TemplatesMigrateResponse
|
|
8
6
|
|
|
9
|
-
__all__ = ["
|
|
7
|
+
__all__ = ["TemplatesMigrateResponse"]
|
|
@@ -24,10 +24,10 @@ class BaseClientWrapper:
|
|
|
24
24
|
|
|
25
25
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
26
26
|
headers: typing.Dict[str, str] = {
|
|
27
|
-
"User-Agent": "letta-client/0.1.
|
|
27
|
+
"User-Agent": "letta-client/0.1.268",
|
|
28
28
|
"X-Fern-Language": "Python",
|
|
29
29
|
"X-Fern-SDK-Name": "letta-client",
|
|
30
|
-
"X-Fern-SDK-Version": "0.1.
|
|
30
|
+
"X-Fern-SDK-Version": "0.1.268",
|
|
31
31
|
**(self.get_custom_headers() or {}),
|
|
32
32
|
}
|
|
33
33
|
if self._project is not None:
|
letta_client/errors/__init__.py
CHANGED
|
@@ -4,16 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
from .bad_request_error import BadRequestError
|
|
6
6
|
from .conflict_error import ConflictError
|
|
7
|
-
from .internal_server_error import InternalServerError
|
|
8
7
|
from .not_found_error import NotFoundError
|
|
9
8
|
from .payment_required_error import PaymentRequiredError
|
|
10
9
|
from .unprocessable_entity_error import UnprocessableEntityError
|
|
11
10
|
|
|
12
|
-
__all__ = [
|
|
13
|
-
"BadRequestError",
|
|
14
|
-
"ConflictError",
|
|
15
|
-
"InternalServerError",
|
|
16
|
-
"NotFoundError",
|
|
17
|
-
"PaymentRequiredError",
|
|
18
|
-
"UnprocessableEntityError",
|
|
19
|
-
]
|
|
11
|
+
__all__ = ["BadRequestError", "ConflictError", "NotFoundError", "PaymentRequiredError", "UnprocessableEntityError"]
|
|
@@ -2,7 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
# isort: skip_file
|
|
4
4
|
|
|
5
|
-
from .types import
|
|
5
|
+
from .types import (
|
|
6
|
+
TemplatesCreateTemplateResponse,
|
|
7
|
+
TemplatesDeleteTemplateResponse,
|
|
8
|
+
TemplatesForkTemplateResponse,
|
|
9
|
+
TemplatesGetTemplateSnapshotResponse,
|
|
10
|
+
TemplatesGetTemplateSnapshotResponseAgentsItem,
|
|
11
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemMemoryVariables,
|
|
12
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemMemoryVariablesDataItem,
|
|
13
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemProperties,
|
|
14
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItem,
|
|
15
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemChildOutputMapping,
|
|
16
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemFive,
|
|
17
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemFour,
|
|
18
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemMaxCountLimit,
|
|
19
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemOne,
|
|
20
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemSeven,
|
|
21
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemTwo,
|
|
22
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemZero,
|
|
23
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemToolVariables,
|
|
24
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemToolVariablesDataItem,
|
|
25
|
+
TemplatesGetTemplateSnapshotResponseBlocksItem,
|
|
26
|
+
TemplatesGetTemplateSnapshotResponseConfiguration,
|
|
27
|
+
TemplatesGetTemplateSnapshotResponseType,
|
|
28
|
+
TemplatesListResponse,
|
|
29
|
+
TemplatesListResponseTemplatesItem,
|
|
30
|
+
TemplatesListTemplateVersionsResponse,
|
|
31
|
+
TemplatesListTemplateVersionsResponseVersionsItem,
|
|
32
|
+
TemplatesRenameTemplateResponse,
|
|
33
|
+
TemplatesSaveTemplateVersionResponse,
|
|
34
|
+
)
|
|
6
35
|
from . import agents
|
|
7
36
|
from .agents import (
|
|
8
37
|
AgentsCreateRequestInitialMessageSequenceItem,
|
|
@@ -14,7 +43,33 @@ __all__ = [
|
|
|
14
43
|
"AgentsCreateRequestInitialMessageSequenceItem",
|
|
15
44
|
"AgentsCreateRequestInitialMessageSequenceItemRole",
|
|
16
45
|
"AgentsCreateResponse",
|
|
46
|
+
"TemplatesCreateTemplateResponse",
|
|
47
|
+
"TemplatesDeleteTemplateResponse",
|
|
48
|
+
"TemplatesForkTemplateResponse",
|
|
49
|
+
"TemplatesGetTemplateSnapshotResponse",
|
|
50
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItem",
|
|
51
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemMemoryVariables",
|
|
52
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemMemoryVariablesDataItem",
|
|
53
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemProperties",
|
|
54
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItem",
|
|
55
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemChildOutputMapping",
|
|
56
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemFive",
|
|
57
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemFour",
|
|
58
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemMaxCountLimit",
|
|
59
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemOne",
|
|
60
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemSeven",
|
|
61
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemTwo",
|
|
62
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemZero",
|
|
63
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemToolVariables",
|
|
64
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemToolVariablesDataItem",
|
|
65
|
+
"TemplatesGetTemplateSnapshotResponseBlocksItem",
|
|
66
|
+
"TemplatesGetTemplateSnapshotResponseConfiguration",
|
|
67
|
+
"TemplatesGetTemplateSnapshotResponseType",
|
|
17
68
|
"TemplatesListResponse",
|
|
18
69
|
"TemplatesListResponseTemplatesItem",
|
|
70
|
+
"TemplatesListTemplateVersionsResponse",
|
|
71
|
+
"TemplatesListTemplateVersionsResponseVersionsItem",
|
|
72
|
+
"TemplatesRenameTemplateResponse",
|
|
73
|
+
"TemplatesSaveTemplateVersionResponse",
|
|
19
74
|
"agents",
|
|
20
75
|
]
|