letta-client 0.1.267__py3-none-any.whl → 0.1.269__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.269.dist-info}/METADATA +1 -1
- {letta_client-0.1.267.dist-info → letta_client-0.1.269.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.269.dist-info}/WHEEL +0 -0
letta_client/templates/client.py
CHANGED
|
@@ -6,7 +6,17 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
7
|
from .agents.client import AgentsClient, AsyncAgentsClient
|
|
8
8
|
from .raw_client import AsyncRawTemplatesClient, RawTemplatesClient
|
|
9
|
+
from .types.templates_create_template_response import TemplatesCreateTemplateResponse
|
|
10
|
+
from .types.templates_delete_template_response import TemplatesDeleteTemplateResponse
|
|
11
|
+
from .types.templates_fork_template_response import TemplatesForkTemplateResponse
|
|
12
|
+
from .types.templates_get_template_snapshot_response import TemplatesGetTemplateSnapshotResponse
|
|
9
13
|
from .types.templates_list_response import TemplatesListResponse
|
|
14
|
+
from .types.templates_list_template_versions_response import TemplatesListTemplateVersionsResponse
|
|
15
|
+
from .types.templates_rename_template_response import TemplatesRenameTemplateResponse
|
|
16
|
+
from .types.templates_save_template_version_response import TemplatesSaveTemplateVersionResponse
|
|
17
|
+
|
|
18
|
+
# this is used as the default value for optional parameters
|
|
19
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
10
20
|
|
|
11
21
|
|
|
12
22
|
class TemplatesClient:
|
|
@@ -30,7 +40,10 @@ class TemplatesClient:
|
|
|
30
40
|
*,
|
|
31
41
|
offset: typing.Optional[str] = None,
|
|
32
42
|
limit: typing.Optional[str] = None,
|
|
43
|
+
template_id: typing.Optional[str] = None,
|
|
33
44
|
name: typing.Optional[str] = None,
|
|
45
|
+
search: typing.Optional[str] = None,
|
|
46
|
+
project_slug: typing.Optional[str] = None,
|
|
34
47
|
project_id: typing.Optional[str] = None,
|
|
35
48
|
request_options: typing.Optional[RequestOptions] = None,
|
|
36
49
|
) -> TemplatesListResponse:
|
|
@@ -43,8 +56,14 @@ class TemplatesClient:
|
|
|
43
56
|
|
|
44
57
|
limit : typing.Optional[str]
|
|
45
58
|
|
|
59
|
+
template_id : typing.Optional[str]
|
|
60
|
+
|
|
46
61
|
name : typing.Optional[str]
|
|
47
62
|
|
|
63
|
+
search : typing.Optional[str]
|
|
64
|
+
|
|
65
|
+
project_slug : typing.Optional[str]
|
|
66
|
+
|
|
48
67
|
project_id : typing.Optional[str]
|
|
49
68
|
|
|
50
69
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -66,7 +85,349 @@ class TemplatesClient:
|
|
|
66
85
|
client.templates.list()
|
|
67
86
|
"""
|
|
68
87
|
_response = self._raw_client.list(
|
|
69
|
-
offset=offset,
|
|
88
|
+
offset=offset,
|
|
89
|
+
limit=limit,
|
|
90
|
+
template_id=template_id,
|
|
91
|
+
name=name,
|
|
92
|
+
search=search,
|
|
93
|
+
project_slug=project_slug,
|
|
94
|
+
project_id=project_id,
|
|
95
|
+
request_options=request_options,
|
|
96
|
+
)
|
|
97
|
+
return _response.data
|
|
98
|
+
|
|
99
|
+
def savetemplateversion(
|
|
100
|
+
self,
|
|
101
|
+
project: str,
|
|
102
|
+
template_name: str,
|
|
103
|
+
*,
|
|
104
|
+
preserve_environment_variables_on_migration: typing.Optional[bool] = OMIT,
|
|
105
|
+
preserve_core_memories_on_migration: typing.Optional[bool] = OMIT,
|
|
106
|
+
migrate_agents: typing.Optional[bool] = OMIT,
|
|
107
|
+
message: typing.Optional[str] = OMIT,
|
|
108
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
109
|
+
) -> TemplatesSaveTemplateVersionResponse:
|
|
110
|
+
"""
|
|
111
|
+
Saves the current version of the template as a new version
|
|
112
|
+
|
|
113
|
+
Parameters
|
|
114
|
+
----------
|
|
115
|
+
project : str
|
|
116
|
+
The project slug
|
|
117
|
+
|
|
118
|
+
template_name : str
|
|
119
|
+
The template version, formatted as {template-name}, any version appended will be ignored
|
|
120
|
+
|
|
121
|
+
preserve_environment_variables_on_migration : typing.Optional[bool]
|
|
122
|
+
If true, the environment variables will be preserved in the template version when migrating agents
|
|
123
|
+
|
|
124
|
+
preserve_core_memories_on_migration : typing.Optional[bool]
|
|
125
|
+
If true, the core memories will be preserved in the template version when migrating agents
|
|
126
|
+
|
|
127
|
+
migrate_agents : typing.Optional[bool]
|
|
128
|
+
If true, existing agents attached to this template will be migrated to the new template version
|
|
129
|
+
|
|
130
|
+
message : typing.Optional[str]
|
|
131
|
+
A message to describe the changes made in this template version
|
|
132
|
+
|
|
133
|
+
request_options : typing.Optional[RequestOptions]
|
|
134
|
+
Request-specific configuration.
|
|
135
|
+
|
|
136
|
+
Returns
|
|
137
|
+
-------
|
|
138
|
+
TemplatesSaveTemplateVersionResponse
|
|
139
|
+
200
|
|
140
|
+
|
|
141
|
+
Examples
|
|
142
|
+
--------
|
|
143
|
+
from letta_client import Letta
|
|
144
|
+
|
|
145
|
+
client = Letta(
|
|
146
|
+
project="YOUR_PROJECT",
|
|
147
|
+
token="YOUR_TOKEN",
|
|
148
|
+
)
|
|
149
|
+
client.templates.savetemplateversion(
|
|
150
|
+
project="project",
|
|
151
|
+
template_name="template_name",
|
|
152
|
+
)
|
|
153
|
+
"""
|
|
154
|
+
_response = self._raw_client.savetemplateversion(
|
|
155
|
+
project,
|
|
156
|
+
template_name,
|
|
157
|
+
preserve_environment_variables_on_migration=preserve_environment_variables_on_migration,
|
|
158
|
+
preserve_core_memories_on_migration=preserve_core_memories_on_migration,
|
|
159
|
+
migrate_agents=migrate_agents,
|
|
160
|
+
message=message,
|
|
161
|
+
request_options=request_options,
|
|
162
|
+
)
|
|
163
|
+
return _response.data
|
|
164
|
+
|
|
165
|
+
def deletetemplate(
|
|
166
|
+
self, project: str, template_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
167
|
+
) -> TemplatesDeleteTemplateResponse:
|
|
168
|
+
"""
|
|
169
|
+
Deletes all versions of a template with the specified name
|
|
170
|
+
|
|
171
|
+
Parameters
|
|
172
|
+
----------
|
|
173
|
+
project : str
|
|
174
|
+
The project slug
|
|
175
|
+
|
|
176
|
+
template_name : str
|
|
177
|
+
The template name (without version)
|
|
178
|
+
|
|
179
|
+
request_options : typing.Optional[RequestOptions]
|
|
180
|
+
Request-specific configuration.
|
|
181
|
+
|
|
182
|
+
Returns
|
|
183
|
+
-------
|
|
184
|
+
TemplatesDeleteTemplateResponse
|
|
185
|
+
200
|
|
186
|
+
|
|
187
|
+
Examples
|
|
188
|
+
--------
|
|
189
|
+
from letta_client import Letta
|
|
190
|
+
|
|
191
|
+
client = Letta(
|
|
192
|
+
project="YOUR_PROJECT",
|
|
193
|
+
token="YOUR_TOKEN",
|
|
194
|
+
)
|
|
195
|
+
client.templates.deletetemplate(
|
|
196
|
+
project="project",
|
|
197
|
+
template_name="template_name",
|
|
198
|
+
)
|
|
199
|
+
"""
|
|
200
|
+
_response = self._raw_client.deletetemplate(project, template_name, request_options=request_options)
|
|
201
|
+
return _response.data
|
|
202
|
+
|
|
203
|
+
def gettemplatesnapshot(
|
|
204
|
+
self, project: str, template_version: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
205
|
+
) -> TemplatesGetTemplateSnapshotResponse:
|
|
206
|
+
"""
|
|
207
|
+
Get a snapshot of the template version, this will return the template state at a specific version
|
|
208
|
+
|
|
209
|
+
Parameters
|
|
210
|
+
----------
|
|
211
|
+
project : str
|
|
212
|
+
The project slug
|
|
213
|
+
|
|
214
|
+
template_version : str
|
|
215
|
+
The template version, formatted as {template-name}:{version-number} or {template-name}:latest
|
|
216
|
+
|
|
217
|
+
request_options : typing.Optional[RequestOptions]
|
|
218
|
+
Request-specific configuration.
|
|
219
|
+
|
|
220
|
+
Returns
|
|
221
|
+
-------
|
|
222
|
+
TemplatesGetTemplateSnapshotResponse
|
|
223
|
+
200
|
|
224
|
+
|
|
225
|
+
Examples
|
|
226
|
+
--------
|
|
227
|
+
from letta_client import Letta
|
|
228
|
+
|
|
229
|
+
client = Letta(
|
|
230
|
+
project="YOUR_PROJECT",
|
|
231
|
+
token="YOUR_TOKEN",
|
|
232
|
+
)
|
|
233
|
+
client.templates.gettemplatesnapshot(
|
|
234
|
+
project="project",
|
|
235
|
+
template_version="template_version",
|
|
236
|
+
)
|
|
237
|
+
"""
|
|
238
|
+
_response = self._raw_client.gettemplatesnapshot(project, template_version, request_options=request_options)
|
|
239
|
+
return _response.data
|
|
240
|
+
|
|
241
|
+
def forktemplate(
|
|
242
|
+
self,
|
|
243
|
+
project: str,
|
|
244
|
+
template_version: str,
|
|
245
|
+
*,
|
|
246
|
+
name: typing.Optional[str] = OMIT,
|
|
247
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
248
|
+
) -> TemplatesForkTemplateResponse:
|
|
249
|
+
"""
|
|
250
|
+
Forks a template version into a new template
|
|
251
|
+
|
|
252
|
+
Parameters
|
|
253
|
+
----------
|
|
254
|
+
project : str
|
|
255
|
+
The project slug
|
|
256
|
+
|
|
257
|
+
template_version : str
|
|
258
|
+
The template version, formatted as {template-name}:{version-number} or {template-name}:latest
|
|
259
|
+
|
|
260
|
+
name : typing.Optional[str]
|
|
261
|
+
Optional custom name for the forked template. If not provided, a random name will be generated.
|
|
262
|
+
|
|
263
|
+
request_options : typing.Optional[RequestOptions]
|
|
264
|
+
Request-specific configuration.
|
|
265
|
+
|
|
266
|
+
Returns
|
|
267
|
+
-------
|
|
268
|
+
TemplatesForkTemplateResponse
|
|
269
|
+
200
|
|
270
|
+
|
|
271
|
+
Examples
|
|
272
|
+
--------
|
|
273
|
+
from letta_client import Letta
|
|
274
|
+
|
|
275
|
+
client = Letta(
|
|
276
|
+
project="YOUR_PROJECT",
|
|
277
|
+
token="YOUR_TOKEN",
|
|
278
|
+
)
|
|
279
|
+
client.templates.forktemplate(
|
|
280
|
+
project="project",
|
|
281
|
+
template_version="template_version",
|
|
282
|
+
)
|
|
283
|
+
"""
|
|
284
|
+
_response = self._raw_client.forktemplate(project, template_version, name=name, request_options=request_options)
|
|
285
|
+
return _response.data
|
|
286
|
+
|
|
287
|
+
def createtemplate(
|
|
288
|
+
self,
|
|
289
|
+
project: str,
|
|
290
|
+
*,
|
|
291
|
+
agent_id: str,
|
|
292
|
+
name: typing.Optional[str] = OMIT,
|
|
293
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
294
|
+
) -> TemplatesCreateTemplateResponse:
|
|
295
|
+
"""
|
|
296
|
+
Creates a new template from an existing agent
|
|
297
|
+
|
|
298
|
+
Parameters
|
|
299
|
+
----------
|
|
300
|
+
project : str
|
|
301
|
+
The project slug
|
|
302
|
+
|
|
303
|
+
agent_id : str
|
|
304
|
+
The ID of the agent to use as a template, can be from any project
|
|
305
|
+
|
|
306
|
+
name : typing.Optional[str]
|
|
307
|
+
Optional custom name for the template. If not provided, a random name will be generated.
|
|
308
|
+
|
|
309
|
+
request_options : typing.Optional[RequestOptions]
|
|
310
|
+
Request-specific configuration.
|
|
311
|
+
|
|
312
|
+
Returns
|
|
313
|
+
-------
|
|
314
|
+
TemplatesCreateTemplateResponse
|
|
315
|
+
201
|
|
316
|
+
|
|
317
|
+
Examples
|
|
318
|
+
--------
|
|
319
|
+
from letta_client import Letta
|
|
320
|
+
|
|
321
|
+
client = Letta(
|
|
322
|
+
project="YOUR_PROJECT",
|
|
323
|
+
token="YOUR_TOKEN",
|
|
324
|
+
)
|
|
325
|
+
client.templates.createtemplate(
|
|
326
|
+
project="project",
|
|
327
|
+
agent_id="agent_id",
|
|
328
|
+
)
|
|
329
|
+
"""
|
|
330
|
+
_response = self._raw_client.createtemplate(
|
|
331
|
+
project, agent_id=agent_id, name=name, request_options=request_options
|
|
332
|
+
)
|
|
333
|
+
return _response.data
|
|
334
|
+
|
|
335
|
+
def renametemplate(
|
|
336
|
+
self,
|
|
337
|
+
project: str,
|
|
338
|
+
template_name: str,
|
|
339
|
+
*,
|
|
340
|
+
new_name: str,
|
|
341
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
342
|
+
) -> TemplatesRenameTemplateResponse:
|
|
343
|
+
"""
|
|
344
|
+
Renames all versions of a template with the specified name. Versions are automatically stripped from the current template name if accidentally included.
|
|
345
|
+
|
|
346
|
+
Parameters
|
|
347
|
+
----------
|
|
348
|
+
project : str
|
|
349
|
+
The project slug
|
|
350
|
+
|
|
351
|
+
template_name : str
|
|
352
|
+
The current template name (version will be automatically stripped if included)
|
|
353
|
+
|
|
354
|
+
new_name : str
|
|
355
|
+
The new name for the template
|
|
356
|
+
|
|
357
|
+
request_options : typing.Optional[RequestOptions]
|
|
358
|
+
Request-specific configuration.
|
|
359
|
+
|
|
360
|
+
Returns
|
|
361
|
+
-------
|
|
362
|
+
TemplatesRenameTemplateResponse
|
|
363
|
+
200
|
|
364
|
+
|
|
365
|
+
Examples
|
|
366
|
+
--------
|
|
367
|
+
from letta_client import Letta
|
|
368
|
+
|
|
369
|
+
client = Letta(
|
|
370
|
+
project="YOUR_PROJECT",
|
|
371
|
+
token="YOUR_TOKEN",
|
|
372
|
+
)
|
|
373
|
+
client.templates.renametemplate(
|
|
374
|
+
project="project",
|
|
375
|
+
template_name="template_name",
|
|
376
|
+
new_name="new_name",
|
|
377
|
+
)
|
|
378
|
+
"""
|
|
379
|
+
_response = self._raw_client.renametemplate(
|
|
380
|
+
project, template_name, new_name=new_name, request_options=request_options
|
|
381
|
+
)
|
|
382
|
+
return _response.data
|
|
383
|
+
|
|
384
|
+
def listtemplateversions(
|
|
385
|
+
self,
|
|
386
|
+
project_slug: str,
|
|
387
|
+
name: str,
|
|
388
|
+
*,
|
|
389
|
+
offset: typing.Optional[str] = None,
|
|
390
|
+
limit: typing.Optional[str] = None,
|
|
391
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
392
|
+
) -> TemplatesListTemplateVersionsResponse:
|
|
393
|
+
"""
|
|
394
|
+
List all versions of a specific template
|
|
395
|
+
|
|
396
|
+
Parameters
|
|
397
|
+
----------
|
|
398
|
+
project_slug : str
|
|
399
|
+
The project slug
|
|
400
|
+
|
|
401
|
+
name : str
|
|
402
|
+
The template name (without version)
|
|
403
|
+
|
|
404
|
+
offset : typing.Optional[str]
|
|
405
|
+
|
|
406
|
+
limit : typing.Optional[str]
|
|
407
|
+
|
|
408
|
+
request_options : typing.Optional[RequestOptions]
|
|
409
|
+
Request-specific configuration.
|
|
410
|
+
|
|
411
|
+
Returns
|
|
412
|
+
-------
|
|
413
|
+
TemplatesListTemplateVersionsResponse
|
|
414
|
+
200
|
|
415
|
+
|
|
416
|
+
Examples
|
|
417
|
+
--------
|
|
418
|
+
from letta_client import Letta
|
|
419
|
+
|
|
420
|
+
client = Letta(
|
|
421
|
+
project="YOUR_PROJECT",
|
|
422
|
+
token="YOUR_TOKEN",
|
|
423
|
+
)
|
|
424
|
+
client.templates.listtemplateversions(
|
|
425
|
+
project_slug="project_slug",
|
|
426
|
+
name="name",
|
|
427
|
+
)
|
|
428
|
+
"""
|
|
429
|
+
_response = self._raw_client.listtemplateversions(
|
|
430
|
+
project_slug, name, offset=offset, limit=limit, request_options=request_options
|
|
70
431
|
)
|
|
71
432
|
return _response.data
|
|
72
433
|
|
|
@@ -92,7 +453,10 @@ class AsyncTemplatesClient:
|
|
|
92
453
|
*,
|
|
93
454
|
offset: typing.Optional[str] = None,
|
|
94
455
|
limit: typing.Optional[str] = None,
|
|
456
|
+
template_id: typing.Optional[str] = None,
|
|
95
457
|
name: typing.Optional[str] = None,
|
|
458
|
+
search: typing.Optional[str] = None,
|
|
459
|
+
project_slug: typing.Optional[str] = None,
|
|
96
460
|
project_id: typing.Optional[str] = None,
|
|
97
461
|
request_options: typing.Optional[RequestOptions] = None,
|
|
98
462
|
) -> TemplatesListResponse:
|
|
@@ -105,8 +469,14 @@ class AsyncTemplatesClient:
|
|
|
105
469
|
|
|
106
470
|
limit : typing.Optional[str]
|
|
107
471
|
|
|
472
|
+
template_id : typing.Optional[str]
|
|
473
|
+
|
|
108
474
|
name : typing.Optional[str]
|
|
109
475
|
|
|
476
|
+
search : typing.Optional[str]
|
|
477
|
+
|
|
478
|
+
project_slug : typing.Optional[str]
|
|
479
|
+
|
|
110
480
|
project_id : typing.Optional[str]
|
|
111
481
|
|
|
112
482
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -136,6 +506,408 @@ class AsyncTemplatesClient:
|
|
|
136
506
|
asyncio.run(main())
|
|
137
507
|
"""
|
|
138
508
|
_response = await self._raw_client.list(
|
|
139
|
-
offset=offset,
|
|
509
|
+
offset=offset,
|
|
510
|
+
limit=limit,
|
|
511
|
+
template_id=template_id,
|
|
512
|
+
name=name,
|
|
513
|
+
search=search,
|
|
514
|
+
project_slug=project_slug,
|
|
515
|
+
project_id=project_id,
|
|
516
|
+
request_options=request_options,
|
|
517
|
+
)
|
|
518
|
+
return _response.data
|
|
519
|
+
|
|
520
|
+
async def savetemplateversion(
|
|
521
|
+
self,
|
|
522
|
+
project: str,
|
|
523
|
+
template_name: str,
|
|
524
|
+
*,
|
|
525
|
+
preserve_environment_variables_on_migration: typing.Optional[bool] = OMIT,
|
|
526
|
+
preserve_core_memories_on_migration: typing.Optional[bool] = OMIT,
|
|
527
|
+
migrate_agents: typing.Optional[bool] = OMIT,
|
|
528
|
+
message: typing.Optional[str] = OMIT,
|
|
529
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
530
|
+
) -> TemplatesSaveTemplateVersionResponse:
|
|
531
|
+
"""
|
|
532
|
+
Saves the current version of the template as a new version
|
|
533
|
+
|
|
534
|
+
Parameters
|
|
535
|
+
----------
|
|
536
|
+
project : str
|
|
537
|
+
The project slug
|
|
538
|
+
|
|
539
|
+
template_name : str
|
|
540
|
+
The template version, formatted as {template-name}, any version appended will be ignored
|
|
541
|
+
|
|
542
|
+
preserve_environment_variables_on_migration : typing.Optional[bool]
|
|
543
|
+
If true, the environment variables will be preserved in the template version when migrating agents
|
|
544
|
+
|
|
545
|
+
preserve_core_memories_on_migration : typing.Optional[bool]
|
|
546
|
+
If true, the core memories will be preserved in the template version when migrating agents
|
|
547
|
+
|
|
548
|
+
migrate_agents : typing.Optional[bool]
|
|
549
|
+
If true, existing agents attached to this template will be migrated to the new template version
|
|
550
|
+
|
|
551
|
+
message : typing.Optional[str]
|
|
552
|
+
A message to describe the changes made in this template version
|
|
553
|
+
|
|
554
|
+
request_options : typing.Optional[RequestOptions]
|
|
555
|
+
Request-specific configuration.
|
|
556
|
+
|
|
557
|
+
Returns
|
|
558
|
+
-------
|
|
559
|
+
TemplatesSaveTemplateVersionResponse
|
|
560
|
+
200
|
|
561
|
+
|
|
562
|
+
Examples
|
|
563
|
+
--------
|
|
564
|
+
import asyncio
|
|
565
|
+
|
|
566
|
+
from letta_client import AsyncLetta
|
|
567
|
+
|
|
568
|
+
client = AsyncLetta(
|
|
569
|
+
project="YOUR_PROJECT",
|
|
570
|
+
token="YOUR_TOKEN",
|
|
571
|
+
)
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
async def main() -> None:
|
|
575
|
+
await client.templates.savetemplateversion(
|
|
576
|
+
project="project",
|
|
577
|
+
template_name="template_name",
|
|
578
|
+
)
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
asyncio.run(main())
|
|
582
|
+
"""
|
|
583
|
+
_response = await self._raw_client.savetemplateversion(
|
|
584
|
+
project,
|
|
585
|
+
template_name,
|
|
586
|
+
preserve_environment_variables_on_migration=preserve_environment_variables_on_migration,
|
|
587
|
+
preserve_core_memories_on_migration=preserve_core_memories_on_migration,
|
|
588
|
+
migrate_agents=migrate_agents,
|
|
589
|
+
message=message,
|
|
590
|
+
request_options=request_options,
|
|
591
|
+
)
|
|
592
|
+
return _response.data
|
|
593
|
+
|
|
594
|
+
async def deletetemplate(
|
|
595
|
+
self, project: str, template_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
596
|
+
) -> TemplatesDeleteTemplateResponse:
|
|
597
|
+
"""
|
|
598
|
+
Deletes all versions of a template with the specified name
|
|
599
|
+
|
|
600
|
+
Parameters
|
|
601
|
+
----------
|
|
602
|
+
project : str
|
|
603
|
+
The project slug
|
|
604
|
+
|
|
605
|
+
template_name : str
|
|
606
|
+
The template name (without version)
|
|
607
|
+
|
|
608
|
+
request_options : typing.Optional[RequestOptions]
|
|
609
|
+
Request-specific configuration.
|
|
610
|
+
|
|
611
|
+
Returns
|
|
612
|
+
-------
|
|
613
|
+
TemplatesDeleteTemplateResponse
|
|
614
|
+
200
|
|
615
|
+
|
|
616
|
+
Examples
|
|
617
|
+
--------
|
|
618
|
+
import asyncio
|
|
619
|
+
|
|
620
|
+
from letta_client import AsyncLetta
|
|
621
|
+
|
|
622
|
+
client = AsyncLetta(
|
|
623
|
+
project="YOUR_PROJECT",
|
|
624
|
+
token="YOUR_TOKEN",
|
|
625
|
+
)
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
async def main() -> None:
|
|
629
|
+
await client.templates.deletetemplate(
|
|
630
|
+
project="project",
|
|
631
|
+
template_name="template_name",
|
|
632
|
+
)
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
asyncio.run(main())
|
|
636
|
+
"""
|
|
637
|
+
_response = await self._raw_client.deletetemplate(project, template_name, request_options=request_options)
|
|
638
|
+
return _response.data
|
|
639
|
+
|
|
640
|
+
async def gettemplatesnapshot(
|
|
641
|
+
self, project: str, template_version: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
642
|
+
) -> TemplatesGetTemplateSnapshotResponse:
|
|
643
|
+
"""
|
|
644
|
+
Get a snapshot of the template version, this will return the template state at a specific version
|
|
645
|
+
|
|
646
|
+
Parameters
|
|
647
|
+
----------
|
|
648
|
+
project : str
|
|
649
|
+
The project slug
|
|
650
|
+
|
|
651
|
+
template_version : str
|
|
652
|
+
The template version, formatted as {template-name}:{version-number} or {template-name}:latest
|
|
653
|
+
|
|
654
|
+
request_options : typing.Optional[RequestOptions]
|
|
655
|
+
Request-specific configuration.
|
|
656
|
+
|
|
657
|
+
Returns
|
|
658
|
+
-------
|
|
659
|
+
TemplatesGetTemplateSnapshotResponse
|
|
660
|
+
200
|
|
661
|
+
|
|
662
|
+
Examples
|
|
663
|
+
--------
|
|
664
|
+
import asyncio
|
|
665
|
+
|
|
666
|
+
from letta_client import AsyncLetta
|
|
667
|
+
|
|
668
|
+
client = AsyncLetta(
|
|
669
|
+
project="YOUR_PROJECT",
|
|
670
|
+
token="YOUR_TOKEN",
|
|
671
|
+
)
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
async def main() -> None:
|
|
675
|
+
await client.templates.gettemplatesnapshot(
|
|
676
|
+
project="project",
|
|
677
|
+
template_version="template_version",
|
|
678
|
+
)
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
asyncio.run(main())
|
|
682
|
+
"""
|
|
683
|
+
_response = await self._raw_client.gettemplatesnapshot(
|
|
684
|
+
project, template_version, request_options=request_options
|
|
685
|
+
)
|
|
686
|
+
return _response.data
|
|
687
|
+
|
|
688
|
+
async def forktemplate(
|
|
689
|
+
self,
|
|
690
|
+
project: str,
|
|
691
|
+
template_version: str,
|
|
692
|
+
*,
|
|
693
|
+
name: typing.Optional[str] = OMIT,
|
|
694
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
695
|
+
) -> TemplatesForkTemplateResponse:
|
|
696
|
+
"""
|
|
697
|
+
Forks a template version into a new template
|
|
698
|
+
|
|
699
|
+
Parameters
|
|
700
|
+
----------
|
|
701
|
+
project : str
|
|
702
|
+
The project slug
|
|
703
|
+
|
|
704
|
+
template_version : str
|
|
705
|
+
The template version, formatted as {template-name}:{version-number} or {template-name}:latest
|
|
706
|
+
|
|
707
|
+
name : typing.Optional[str]
|
|
708
|
+
Optional custom name for the forked template. If not provided, a random name will be generated.
|
|
709
|
+
|
|
710
|
+
request_options : typing.Optional[RequestOptions]
|
|
711
|
+
Request-specific configuration.
|
|
712
|
+
|
|
713
|
+
Returns
|
|
714
|
+
-------
|
|
715
|
+
TemplatesForkTemplateResponse
|
|
716
|
+
200
|
|
717
|
+
|
|
718
|
+
Examples
|
|
719
|
+
--------
|
|
720
|
+
import asyncio
|
|
721
|
+
|
|
722
|
+
from letta_client import AsyncLetta
|
|
723
|
+
|
|
724
|
+
client = AsyncLetta(
|
|
725
|
+
project="YOUR_PROJECT",
|
|
726
|
+
token="YOUR_TOKEN",
|
|
727
|
+
)
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
async def main() -> None:
|
|
731
|
+
await client.templates.forktemplate(
|
|
732
|
+
project="project",
|
|
733
|
+
template_version="template_version",
|
|
734
|
+
)
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
asyncio.run(main())
|
|
738
|
+
"""
|
|
739
|
+
_response = await self._raw_client.forktemplate(
|
|
740
|
+
project, template_version, name=name, request_options=request_options
|
|
741
|
+
)
|
|
742
|
+
return _response.data
|
|
743
|
+
|
|
744
|
+
async def createtemplate(
|
|
745
|
+
self,
|
|
746
|
+
project: str,
|
|
747
|
+
*,
|
|
748
|
+
agent_id: str,
|
|
749
|
+
name: typing.Optional[str] = OMIT,
|
|
750
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
751
|
+
) -> TemplatesCreateTemplateResponse:
|
|
752
|
+
"""
|
|
753
|
+
Creates a new template from an existing agent
|
|
754
|
+
|
|
755
|
+
Parameters
|
|
756
|
+
----------
|
|
757
|
+
project : str
|
|
758
|
+
The project slug
|
|
759
|
+
|
|
760
|
+
agent_id : str
|
|
761
|
+
The ID of the agent to use as a template, can be from any project
|
|
762
|
+
|
|
763
|
+
name : typing.Optional[str]
|
|
764
|
+
Optional custom name for the template. If not provided, a random name will be generated.
|
|
765
|
+
|
|
766
|
+
request_options : typing.Optional[RequestOptions]
|
|
767
|
+
Request-specific configuration.
|
|
768
|
+
|
|
769
|
+
Returns
|
|
770
|
+
-------
|
|
771
|
+
TemplatesCreateTemplateResponse
|
|
772
|
+
201
|
|
773
|
+
|
|
774
|
+
Examples
|
|
775
|
+
--------
|
|
776
|
+
import asyncio
|
|
777
|
+
|
|
778
|
+
from letta_client import AsyncLetta
|
|
779
|
+
|
|
780
|
+
client = AsyncLetta(
|
|
781
|
+
project="YOUR_PROJECT",
|
|
782
|
+
token="YOUR_TOKEN",
|
|
783
|
+
)
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
async def main() -> None:
|
|
787
|
+
await client.templates.createtemplate(
|
|
788
|
+
project="project",
|
|
789
|
+
agent_id="agent_id",
|
|
790
|
+
)
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
asyncio.run(main())
|
|
794
|
+
"""
|
|
795
|
+
_response = await self._raw_client.createtemplate(
|
|
796
|
+
project, agent_id=agent_id, name=name, request_options=request_options
|
|
797
|
+
)
|
|
798
|
+
return _response.data
|
|
799
|
+
|
|
800
|
+
async def renametemplate(
|
|
801
|
+
self,
|
|
802
|
+
project: str,
|
|
803
|
+
template_name: str,
|
|
804
|
+
*,
|
|
805
|
+
new_name: str,
|
|
806
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
807
|
+
) -> TemplatesRenameTemplateResponse:
|
|
808
|
+
"""
|
|
809
|
+
Renames all versions of a template with the specified name. Versions are automatically stripped from the current template name if accidentally included.
|
|
810
|
+
|
|
811
|
+
Parameters
|
|
812
|
+
----------
|
|
813
|
+
project : str
|
|
814
|
+
The project slug
|
|
815
|
+
|
|
816
|
+
template_name : str
|
|
817
|
+
The current template name (version will be automatically stripped if included)
|
|
818
|
+
|
|
819
|
+
new_name : str
|
|
820
|
+
The new name for the template
|
|
821
|
+
|
|
822
|
+
request_options : typing.Optional[RequestOptions]
|
|
823
|
+
Request-specific configuration.
|
|
824
|
+
|
|
825
|
+
Returns
|
|
826
|
+
-------
|
|
827
|
+
TemplatesRenameTemplateResponse
|
|
828
|
+
200
|
|
829
|
+
|
|
830
|
+
Examples
|
|
831
|
+
--------
|
|
832
|
+
import asyncio
|
|
833
|
+
|
|
834
|
+
from letta_client import AsyncLetta
|
|
835
|
+
|
|
836
|
+
client = AsyncLetta(
|
|
837
|
+
project="YOUR_PROJECT",
|
|
838
|
+
token="YOUR_TOKEN",
|
|
839
|
+
)
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
async def main() -> None:
|
|
843
|
+
await client.templates.renametemplate(
|
|
844
|
+
project="project",
|
|
845
|
+
template_name="template_name",
|
|
846
|
+
new_name="new_name",
|
|
847
|
+
)
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
asyncio.run(main())
|
|
851
|
+
"""
|
|
852
|
+
_response = await self._raw_client.renametemplate(
|
|
853
|
+
project, template_name, new_name=new_name, request_options=request_options
|
|
854
|
+
)
|
|
855
|
+
return _response.data
|
|
856
|
+
|
|
857
|
+
async def listtemplateversions(
|
|
858
|
+
self,
|
|
859
|
+
project_slug: str,
|
|
860
|
+
name: str,
|
|
861
|
+
*,
|
|
862
|
+
offset: typing.Optional[str] = None,
|
|
863
|
+
limit: typing.Optional[str] = None,
|
|
864
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
865
|
+
) -> TemplatesListTemplateVersionsResponse:
|
|
866
|
+
"""
|
|
867
|
+
List all versions of a specific template
|
|
868
|
+
|
|
869
|
+
Parameters
|
|
870
|
+
----------
|
|
871
|
+
project_slug : str
|
|
872
|
+
The project slug
|
|
873
|
+
|
|
874
|
+
name : str
|
|
875
|
+
The template name (without version)
|
|
876
|
+
|
|
877
|
+
offset : typing.Optional[str]
|
|
878
|
+
|
|
879
|
+
limit : typing.Optional[str]
|
|
880
|
+
|
|
881
|
+
request_options : typing.Optional[RequestOptions]
|
|
882
|
+
Request-specific configuration.
|
|
883
|
+
|
|
884
|
+
Returns
|
|
885
|
+
-------
|
|
886
|
+
TemplatesListTemplateVersionsResponse
|
|
887
|
+
200
|
|
888
|
+
|
|
889
|
+
Examples
|
|
890
|
+
--------
|
|
891
|
+
import asyncio
|
|
892
|
+
|
|
893
|
+
from letta_client import AsyncLetta
|
|
894
|
+
|
|
895
|
+
client = AsyncLetta(
|
|
896
|
+
project="YOUR_PROJECT",
|
|
897
|
+
token="YOUR_TOKEN",
|
|
898
|
+
)
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
async def main() -> None:
|
|
902
|
+
await client.templates.listtemplateversions(
|
|
903
|
+
project_slug="project_slug",
|
|
904
|
+
name="name",
|
|
905
|
+
)
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
asyncio.run(main())
|
|
909
|
+
"""
|
|
910
|
+
_response = await self._raw_client.listtemplateversions(
|
|
911
|
+
project_slug, name, offset=offset, limit=limit, request_options=request_options
|
|
140
912
|
)
|
|
141
913
|
return _response.data
|