letta-client 0.1.123__py3-none-any.whl → 0.1.124__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 CHANGED
@@ -232,14 +232,12 @@ from . import (
232
232
  health,
233
233
  identities,
234
234
  jobs,
235
- messages,
236
235
  models,
237
236
  projects,
238
237
  providers,
239
238
  runs,
240
239
  sources,
241
240
  steps,
242
- tag,
243
241
  tags,
244
242
  templates,
245
243
  tools,
@@ -542,14 +540,12 @@ __all__ = [
542
540
  "health",
543
541
  "identities",
544
542
  "jobs",
545
- "messages",
546
543
  "models",
547
544
  "projects",
548
545
  "providers",
549
546
  "runs",
550
547
  "sources",
551
548
  "steps",
552
- "tag",
553
549
  "tags",
554
550
  "templates",
555
551
  "tools",
@@ -448,7 +448,7 @@ class AgentsClient:
448
448
  raise ApiError(status_code=_response.status_code, body=_response.text)
449
449
  raise ApiError(status_code=_response.status_code, body=_response_json)
450
450
 
451
- def export_agent_serialized(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> str:
451
+ def export(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> str:
452
452
  """
453
453
  Export the serialized JSON representation of an agent, formatted with indentation.
454
454
 
@@ -471,7 +471,7 @@ class AgentsClient:
471
471
  client = Letta(
472
472
  token="YOUR_TOKEN",
473
473
  )
474
- client.agents.export_agent_serialized(
474
+ client.agents.export(
475
475
  agent_id="agent_id",
476
476
  )
477
477
  """
@@ -504,43 +504,6 @@ 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 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
507
  def import_(
545
508
  self,
546
509
  *,
@@ -1414,9 +1377,7 @@ class AsyncAgentsClient:
1414
1377
  raise ApiError(status_code=_response.status_code, body=_response.text)
1415
1378
  raise ApiError(status_code=_response.status_code, body=_response_json)
1416
1379
 
1417
- async def export_agent_serialized(
1418
- self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
1419
- ) -> str:
1380
+ async def export(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> str:
1420
1381
  """
1421
1382
  Export the serialized JSON representation of an agent, formatted with indentation.
1422
1383
 
@@ -1444,7 +1405,7 @@ class AsyncAgentsClient:
1444
1405
 
1445
1406
 
1446
1407
  async def main() -> None:
1447
- await client.agents.export_agent_serialized(
1408
+ await client.agents.export(
1448
1409
  agent_id="agent_id",
1449
1410
  )
1450
1411
 
@@ -1480,51 +1441,6 @@ class AsyncAgentsClient:
1480
1441
  raise ApiError(status_code=_response.status_code, body=_response.text)
1481
1442
  raise ApiError(status_code=_response.status_code, body=_response_json)
1482
1443
 
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
1444
  async def import_(
1529
1445
  self,
1530
1446
  *,
@@ -17,14 +17,12 @@ from .health.client import HealthClient
17
17
  from .providers.client import ProvidersClient
18
18
  from .runs.client import RunsClient
19
19
  from .steps.client import StepsClient
20
- from .tag.client import TagClient
20
+ from .tags.client import TagsClient
21
21
  from .batches.client import BatchesClient
22
- from .messages.client import MessagesClient
23
22
  from .voice.client import VoiceClient
24
23
  from .templates.client import TemplatesClient
25
24
  from .client_side_access_tokens.client import ClientSideAccessTokensClient
26
25
  from .projects.client import ProjectsClient
27
- from .tags.client import TagsClient
28
26
  from .core.client_wrapper import AsyncClientWrapper
29
27
  from .tools.client import AsyncToolsClient
30
28
  from .sources.client import AsyncSourcesClient
@@ -39,14 +37,12 @@ from .health.client import AsyncHealthClient
39
37
  from .providers.client import AsyncProvidersClient
40
38
  from .runs.client import AsyncRunsClient
41
39
  from .steps.client import AsyncStepsClient
42
- from .tag.client import AsyncTagClient
40
+ from .tags.client import AsyncTagsClient
43
41
  from .batches.client import AsyncBatchesClient
44
- from .messages.client import AsyncMessagesClient
45
42
  from .voice.client import AsyncVoiceClient
46
43
  from .templates.client import AsyncTemplatesClient
47
44
  from .client_side_access_tokens.client import AsyncClientSideAccessTokensClient
48
45
  from .projects.client import AsyncProjectsClient
49
- from .tags.client import AsyncTagsClient
50
46
 
51
47
 
52
48
  class LettaBase:
@@ -120,14 +116,12 @@ class LettaBase:
120
116
  self.providers = ProvidersClient(client_wrapper=self._client_wrapper)
121
117
  self.runs = RunsClient(client_wrapper=self._client_wrapper)
122
118
  self.steps = StepsClient(client_wrapper=self._client_wrapper)
123
- self.tag = TagClient(client_wrapper=self._client_wrapper)
119
+ self.tags = TagsClient(client_wrapper=self._client_wrapper)
124
120
  self.batches = BatchesClient(client_wrapper=self._client_wrapper)
125
- self.messages = MessagesClient(client_wrapper=self._client_wrapper)
126
121
  self.voice = VoiceClient(client_wrapper=self._client_wrapper)
127
122
  self.templates = TemplatesClient(client_wrapper=self._client_wrapper)
128
123
  self.client_side_access_tokens = ClientSideAccessTokensClient(client_wrapper=self._client_wrapper)
129
124
  self.projects = ProjectsClient(client_wrapper=self._client_wrapper)
130
- self.tags = TagsClient(client_wrapper=self._client_wrapper)
131
125
 
132
126
 
133
127
  class AsyncLettaBase:
@@ -201,14 +195,12 @@ class AsyncLettaBase:
201
195
  self.providers = AsyncProvidersClient(client_wrapper=self._client_wrapper)
202
196
  self.runs = AsyncRunsClient(client_wrapper=self._client_wrapper)
203
197
  self.steps = AsyncStepsClient(client_wrapper=self._client_wrapper)
204
- self.tag = AsyncTagClient(client_wrapper=self._client_wrapper)
198
+ self.tags = AsyncTagsClient(client_wrapper=self._client_wrapper)
205
199
  self.batches = AsyncBatchesClient(client_wrapper=self._client_wrapper)
206
- self.messages = AsyncMessagesClient(client_wrapper=self._client_wrapper)
207
200
  self.voice = AsyncVoiceClient(client_wrapper=self._client_wrapper)
208
201
  self.templates = AsyncTemplatesClient(client_wrapper=self._client_wrapper)
209
202
  self.client_side_access_tokens = AsyncClientSideAccessTokensClient(client_wrapper=self._client_wrapper)
210
203
  self.projects = AsyncProjectsClient(client_wrapper=self._client_wrapper)
211
- self.tags = AsyncTagsClient(client_wrapper=self._client_wrapper)
212
204
 
213
205
 
214
206
  def _get_base_url(*, base_url: typing.Optional[str] = None, environment: LettaEnvironment) -> str:
@@ -221,8 +221,12 @@ class BatchesClient:
221
221
  raise ApiError(status_code=_response.status_code, body=_response.text)
222
222
  raise ApiError(status_code=_response.status_code, body=_response_json)
223
223
 
224
- def cancel(self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
224
+ def cancel(
225
+ self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None
226
+ ) -> typing.Optional[typing.Any]:
225
227
  """
228
+ Cancel a batch run.
229
+
226
230
  Parameters
227
231
  ----------
228
232
  batch_id : str
@@ -232,7 +236,8 @@ class BatchesClient:
232
236
 
233
237
  Returns
234
238
  -------
235
- None
239
+ typing.Optional[typing.Any]
240
+ Successful Response
236
241
 
237
242
  Examples
238
243
  --------
@@ -246,13 +251,29 @@ class BatchesClient:
246
251
  )
247
252
  """
248
253
  _response = self._client_wrapper.httpx_client.request(
249
- f"v1/messages/batches/{jsonable_encoder(batch_id)}",
254
+ f"v1/messages/batches/{jsonable_encoder(batch_id)}/cancel",
250
255
  method="PATCH",
251
256
  request_options=request_options,
252
257
  )
253
258
  try:
254
259
  if 200 <= _response.status_code < 300:
255
- return
260
+ return typing.cast(
261
+ typing.Optional[typing.Any],
262
+ construct_type(
263
+ type_=typing.Optional[typing.Any], # type: ignore
264
+ object_=_response.json(),
265
+ ),
266
+ )
267
+ if _response.status_code == 422:
268
+ raise UnprocessableEntityError(
269
+ typing.cast(
270
+ HttpValidationError,
271
+ construct_type(
272
+ type_=HttpValidationError, # type: ignore
273
+ object_=_response.json(),
274
+ ),
275
+ )
276
+ )
256
277
  _response_json = _response.json()
257
278
  except JSONDecodeError:
258
279
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -491,8 +512,12 @@ class AsyncBatchesClient:
491
512
  raise ApiError(status_code=_response.status_code, body=_response.text)
492
513
  raise ApiError(status_code=_response.status_code, body=_response_json)
493
514
 
494
- async def cancel(self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
515
+ async def cancel(
516
+ self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None
517
+ ) -> typing.Optional[typing.Any]:
495
518
  """
519
+ Cancel a batch run.
520
+
496
521
  Parameters
497
522
  ----------
498
523
  batch_id : str
@@ -502,7 +527,8 @@ class AsyncBatchesClient:
502
527
 
503
528
  Returns
504
529
  -------
505
- None
530
+ typing.Optional[typing.Any]
531
+ Successful Response
506
532
 
507
533
  Examples
508
534
  --------
@@ -524,13 +550,29 @@ class AsyncBatchesClient:
524
550
  asyncio.run(main())
525
551
  """
526
552
  _response = await self._client_wrapper.httpx_client.request(
527
- f"v1/messages/batches/{jsonable_encoder(batch_id)}",
553
+ f"v1/messages/batches/{jsonable_encoder(batch_id)}/cancel",
528
554
  method="PATCH",
529
555
  request_options=request_options,
530
556
  )
531
557
  try:
532
558
  if 200 <= _response.status_code < 300:
533
- return
559
+ return typing.cast(
560
+ typing.Optional[typing.Any],
561
+ construct_type(
562
+ type_=typing.Optional[typing.Any], # type: ignore
563
+ object_=_response.json(),
564
+ ),
565
+ )
566
+ if _response.status_code == 422:
567
+ raise UnprocessableEntityError(
568
+ typing.cast(
569
+ HttpValidationError,
570
+ construct_type(
571
+ type_=HttpValidationError, # type: ignore
572
+ object_=_response.json(),
573
+ ),
574
+ )
575
+ )
534
576
  _response_json = _response.json()
535
577
  except JSONDecodeError:
536
578
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -16,7 +16,7 @@ class BaseClientWrapper:
16
16
  headers: typing.Dict[str, str] = {
17
17
  "X-Fern-Language": "Python",
18
18
  "X-Fern-SDK-Name": "letta-client",
19
- "X-Fern-SDK-Version": "0.1.123",
19
+ "X-Fern-SDK-Version": "0.1.124",
20
20
  }
21
21
  if self.token is not None:
22
22
  headers["Authorization"] = f"Bearer {self.token}"
@@ -155,8 +155,8 @@ class ProvidersClient:
155
155
  raise ApiError(status_code=_response.status_code, body=_response.text)
156
156
  raise ApiError(status_code=_response.status_code, body=_response_json)
157
157
 
158
- def delete_provider(
159
- self, *, provider_id: str, request_options: typing.Optional[RequestOptions] = None
158
+ def delete(
159
+ self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
160
160
  ) -> typing.Optional[typing.Any]:
161
161
  """
162
162
  Delete an existing custom provider
@@ -164,7 +164,6 @@ class ProvidersClient:
164
164
  Parameters
165
165
  ----------
166
166
  provider_id : str
167
- The provider_id key to be deleted.
168
167
 
169
168
  request_options : typing.Optional[RequestOptions]
170
169
  Request-specific configuration.
@@ -181,16 +180,13 @@ class ProvidersClient:
181
180
  client = Letta(
182
181
  token="YOUR_TOKEN",
183
182
  )
184
- client.providers.delete_provider(
183
+ client.providers.delete(
185
184
  provider_id="provider_id",
186
185
  )
187
186
  """
188
187
  _response = self._client_wrapper.httpx_client.request(
189
- "v1/providers/",
188
+ f"v1/providers/{jsonable_encoder(provider_id)}",
190
189
  method="DELETE",
191
- params={
192
- "provider_id": provider_id,
193
- },
194
190
  request_options=request_options,
195
191
  )
196
192
  try:
@@ -217,16 +213,15 @@ class ProvidersClient:
217
213
  raise ApiError(status_code=_response.status_code, body=_response.text)
218
214
  raise ApiError(status_code=_response.status_code, body=_response_json)
219
215
 
220
- def modify_provider(
221
- self, *, id: str, api_key: str, request_options: typing.Optional[RequestOptions] = None
216
+ def modify(
217
+ self, provider_id: str, *, api_key: str, request_options: typing.Optional[RequestOptions] = None
222
218
  ) -> Provider:
223
219
  """
224
220
  Update an existing custom provider
225
221
 
226
222
  Parameters
227
223
  ----------
228
- id : str
229
- The id of the provider to update.
224
+ provider_id : str
230
225
 
231
226
  api_key : str
232
227
  API key used for requests to the provider.
@@ -246,16 +241,15 @@ class ProvidersClient:
246
241
  client = Letta(
247
242
  token="YOUR_TOKEN",
248
243
  )
249
- client.providers.modify_provider(
250
- id="id",
244
+ client.providers.modify(
245
+ provider_id="provider_id",
251
246
  api_key="api_key",
252
247
  )
253
248
  """
254
249
  _response = self._client_wrapper.httpx_client.request(
255
- "v1/providers/",
250
+ f"v1/providers/{jsonable_encoder(provider_id)}",
256
251
  method="PATCH",
257
252
  json={
258
- "id": id,
259
253
  "api_key": api_key,
260
254
  },
261
255
  headers={
@@ -288,80 +282,6 @@ class ProvidersClient:
288
282
  raise ApiError(status_code=_response.status_code, body=_response.text)
289
283
  raise ApiError(status_code=_response.status_code, body=_response_json)
290
284
 
291
- def delete(self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
292
- """
293
- Parameters
294
- ----------
295
- provider_id : str
296
-
297
- request_options : typing.Optional[RequestOptions]
298
- Request-specific configuration.
299
-
300
- Returns
301
- -------
302
- None
303
-
304
- Examples
305
- --------
306
- from letta_client import Letta
307
-
308
- client = Letta(
309
- token="YOUR_TOKEN",
310
- )
311
- client.providers.delete(
312
- provider_id="provider_id",
313
- )
314
- """
315
- _response = self._client_wrapper.httpx_client.request(
316
- f"v1/providers/{jsonable_encoder(provider_id)}",
317
- method="DELETE",
318
- request_options=request_options,
319
- )
320
- try:
321
- if 200 <= _response.status_code < 300:
322
- return
323
- _response_json = _response.json()
324
- except JSONDecodeError:
325
- raise ApiError(status_code=_response.status_code, body=_response.text)
326
- raise ApiError(status_code=_response.status_code, body=_response_json)
327
-
328
- def modify(self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
329
- """
330
- Parameters
331
- ----------
332
- provider_id : str
333
-
334
- request_options : typing.Optional[RequestOptions]
335
- Request-specific configuration.
336
-
337
- Returns
338
- -------
339
- None
340
-
341
- Examples
342
- --------
343
- from letta_client import Letta
344
-
345
- client = Letta(
346
- token="YOUR_TOKEN",
347
- )
348
- client.providers.modify(
349
- provider_id="provider_id",
350
- )
351
- """
352
- _response = self._client_wrapper.httpx_client.request(
353
- f"v1/providers/{jsonable_encoder(provider_id)}",
354
- method="PATCH",
355
- request_options=request_options,
356
- )
357
- try:
358
- if 200 <= _response.status_code < 300:
359
- return
360
- _response_json = _response.json()
361
- except JSONDecodeError:
362
- raise ApiError(status_code=_response.status_code, body=_response.text)
363
- raise ApiError(status_code=_response.status_code, body=_response_json)
364
-
365
285
 
366
286
  class AsyncProvidersClient:
367
287
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -520,8 +440,8 @@ class AsyncProvidersClient:
520
440
  raise ApiError(status_code=_response.status_code, body=_response.text)
521
441
  raise ApiError(status_code=_response.status_code, body=_response_json)
522
442
 
523
- async def delete_provider(
524
- self, *, provider_id: str, request_options: typing.Optional[RequestOptions] = None
443
+ async def delete(
444
+ self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
525
445
  ) -> typing.Optional[typing.Any]:
526
446
  """
527
447
  Delete an existing custom provider
@@ -529,7 +449,6 @@ class AsyncProvidersClient:
529
449
  Parameters
530
450
  ----------
531
451
  provider_id : str
532
- The provider_id key to be deleted.
533
452
 
534
453
  request_options : typing.Optional[RequestOptions]
535
454
  Request-specific configuration.
@@ -551,7 +470,7 @@ class AsyncProvidersClient:
551
470
 
552
471
 
553
472
  async def main() -> None:
554
- await client.providers.delete_provider(
473
+ await client.providers.delete(
555
474
  provider_id="provider_id",
556
475
  )
557
476
 
@@ -559,11 +478,8 @@ class AsyncProvidersClient:
559
478
  asyncio.run(main())
560
479
  """
561
480
  _response = await self._client_wrapper.httpx_client.request(
562
- "v1/providers/",
481
+ f"v1/providers/{jsonable_encoder(provider_id)}",
563
482
  method="DELETE",
564
- params={
565
- "provider_id": provider_id,
566
- },
567
483
  request_options=request_options,
568
484
  )
569
485
  try:
@@ -590,16 +506,15 @@ class AsyncProvidersClient:
590
506
  raise ApiError(status_code=_response.status_code, body=_response.text)
591
507
  raise ApiError(status_code=_response.status_code, body=_response_json)
592
508
 
593
- async def modify_provider(
594
- self, *, id: str, api_key: str, request_options: typing.Optional[RequestOptions] = None
509
+ async def modify(
510
+ self, provider_id: str, *, api_key: str, request_options: typing.Optional[RequestOptions] = None
595
511
  ) -> Provider:
596
512
  """
597
513
  Update an existing custom provider
598
514
 
599
515
  Parameters
600
516
  ----------
601
- id : str
602
- The id of the provider to update.
517
+ provider_id : str
603
518
 
604
519
  api_key : str
605
520
  API key used for requests to the provider.
@@ -624,8 +539,8 @@ class AsyncProvidersClient:
624
539
 
625
540
 
626
541
  async def main() -> None:
627
- await client.providers.modify_provider(
628
- id="id",
542
+ await client.providers.modify(
543
+ provider_id="provider_id",
629
544
  api_key="api_key",
630
545
  )
631
546
 
@@ -633,10 +548,9 @@ class AsyncProvidersClient:
633
548
  asyncio.run(main())
634
549
  """
635
550
  _response = await self._client_wrapper.httpx_client.request(
636
- "v1/providers/",
551
+ f"v1/providers/{jsonable_encoder(provider_id)}",
637
552
  method="PATCH",
638
553
  json={
639
- "id": id,
640
554
  "api_key": api_key,
641
555
  },
642
556
  headers={
@@ -668,93 +582,3 @@ class AsyncProvidersClient:
668
582
  except JSONDecodeError:
669
583
  raise ApiError(status_code=_response.status_code, body=_response.text)
670
584
  raise ApiError(status_code=_response.status_code, body=_response_json)
671
-
672
- async def delete(self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
673
- """
674
- Parameters
675
- ----------
676
- provider_id : str
677
-
678
- request_options : typing.Optional[RequestOptions]
679
- Request-specific configuration.
680
-
681
- Returns
682
- -------
683
- None
684
-
685
- Examples
686
- --------
687
- import asyncio
688
-
689
- from letta_client import AsyncLetta
690
-
691
- client = AsyncLetta(
692
- token="YOUR_TOKEN",
693
- )
694
-
695
-
696
- async def main() -> None:
697
- await client.providers.delete(
698
- provider_id="provider_id",
699
- )
700
-
701
-
702
- asyncio.run(main())
703
- """
704
- _response = await self._client_wrapper.httpx_client.request(
705
- f"v1/providers/{jsonable_encoder(provider_id)}",
706
- method="DELETE",
707
- request_options=request_options,
708
- )
709
- try:
710
- if 200 <= _response.status_code < 300:
711
- return
712
- _response_json = _response.json()
713
- except JSONDecodeError:
714
- raise ApiError(status_code=_response.status_code, body=_response.text)
715
- raise ApiError(status_code=_response.status_code, body=_response_json)
716
-
717
- async def modify(self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
718
- """
719
- Parameters
720
- ----------
721
- provider_id : str
722
-
723
- request_options : typing.Optional[RequestOptions]
724
- Request-specific configuration.
725
-
726
- Returns
727
- -------
728
- None
729
-
730
- Examples
731
- --------
732
- import asyncio
733
-
734
- from letta_client import AsyncLetta
735
-
736
- client = AsyncLetta(
737
- token="YOUR_TOKEN",
738
- )
739
-
740
-
741
- async def main() -> None:
742
- await client.providers.modify(
743
- provider_id="provider_id",
744
- )
745
-
746
-
747
- asyncio.run(main())
748
- """
749
- _response = await self._client_wrapper.httpx_client.request(
750
- f"v1/providers/{jsonable_encoder(provider_id)}",
751
- method="PATCH",
752
- request_options=request_options,
753
- )
754
- try:
755
- if 200 <= _response.status_code < 300:
756
- return
757
- _response_json = _response.json()
758
- except JSONDecodeError:
759
- raise ApiError(status_code=_response.status_code, body=_response.text)
760
- raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -26,7 +26,7 @@ class RunsClient:
26
26
  self.usage = UsageClient(client_wrapper=self._client_wrapper)
27
27
  self.steps = StepsClient(client_wrapper=self._client_wrapper)
28
28
 
29
- def list_runs(
29
+ def list(
30
30
  self,
31
31
  *,
32
32
  agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
@@ -55,7 +55,7 @@ class RunsClient:
55
55
  client = Letta(
56
56
  token="YOUR_TOKEN",
57
57
  )
58
- client.runs.list_runs()
58
+ client.runs.list()
59
59
  """
60
60
  _response = self._client_wrapper.httpx_client.request(
61
61
  "v1/runs/",
@@ -264,39 +264,6 @@ class RunsClient:
264
264
  raise ApiError(status_code=_response.status_code, body=_response.text)
265
265
  raise ApiError(status_code=_response.status_code, body=_response_json)
266
266
 
267
- def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
268
- """
269
- Parameters
270
- ----------
271
- request_options : typing.Optional[RequestOptions]
272
- Request-specific configuration.
273
-
274
- Returns
275
- -------
276
- None
277
-
278
- Examples
279
- --------
280
- from letta_client import Letta
281
-
282
- client = Letta(
283
- token="YOUR_TOKEN",
284
- )
285
- client.runs.list()
286
- """
287
- _response = self._client_wrapper.httpx_client.request(
288
- "v1/runs",
289
- method="GET",
290
- request_options=request_options,
291
- )
292
- try:
293
- if 200 <= _response.status_code < 300:
294
- return
295
- _response_json = _response.json()
296
- except JSONDecodeError:
297
- raise ApiError(status_code=_response.status_code, body=_response.text)
298
- raise ApiError(status_code=_response.status_code, body=_response_json)
299
-
300
267
 
301
268
  class AsyncRunsClient:
302
269
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -305,7 +272,7 @@ class AsyncRunsClient:
305
272
  self.usage = AsyncUsageClient(client_wrapper=self._client_wrapper)
306
273
  self.steps = AsyncStepsClient(client_wrapper=self._client_wrapper)
307
274
 
308
- async def list_runs(
275
+ async def list(
309
276
  self,
310
277
  *,
311
278
  agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
@@ -339,7 +306,7 @@ class AsyncRunsClient:
339
306
 
340
307
 
341
308
  async def main() -> None:
342
- await client.runs.list_runs()
309
+ await client.runs.list()
343
310
 
344
311
 
345
312
  asyncio.run(main())
@@ -574,44 +541,3 @@ class AsyncRunsClient:
574
541
  except JSONDecodeError:
575
542
  raise ApiError(status_code=_response.status_code, body=_response.text)
576
543
  raise ApiError(status_code=_response.status_code, body=_response_json)
577
-
578
- async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
579
- """
580
- Parameters
581
- ----------
582
- request_options : typing.Optional[RequestOptions]
583
- Request-specific configuration.
584
-
585
- Returns
586
- -------
587
- None
588
-
589
- Examples
590
- --------
591
- import asyncio
592
-
593
- from letta_client import AsyncLetta
594
-
595
- client = AsyncLetta(
596
- token="YOUR_TOKEN",
597
- )
598
-
599
-
600
- async def main() -> None:
601
- await client.runs.list()
602
-
603
-
604
- asyncio.run(main())
605
- """
606
- _response = await self._client_wrapper.httpx_client.request(
607
- "v1/runs",
608
- method="GET",
609
- request_options=request_options,
610
- )
611
- try:
612
- if 200 <= _response.status_code < 300:
613
- return
614
- _response_json = _response.json()
615
- except JSONDecodeError:
616
- raise ApiError(status_code=_response.status_code, body=_response.text)
617
- raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -3,6 +3,9 @@
3
3
  from ..core.client_wrapper import SyncClientWrapper
4
4
  import typing
5
5
  from ..core.request_options import RequestOptions
6
+ from ..core.unchecked_base_model import construct_type
7
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
8
+ from ..types.http_validation_error import HttpValidationError
6
9
  from json.decoder import JSONDecodeError
7
10
  from ..core.api_error import ApiError
8
11
  from ..core.client_wrapper import AsyncClientWrapper
@@ -12,16 +15,32 @@ class TagsClient:
12
15
  def __init__(self, *, client_wrapper: SyncClientWrapper):
13
16
  self._client_wrapper = client_wrapper
14
17
 
15
- def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
18
+ def list(
19
+ self,
20
+ *,
21
+ after: typing.Optional[str] = None,
22
+ limit: typing.Optional[int] = None,
23
+ query_text: typing.Optional[str] = None,
24
+ request_options: typing.Optional[RequestOptions] = None,
25
+ ) -> typing.List[str]:
16
26
  """
27
+ Get a list of all tags in the database
28
+
17
29
  Parameters
18
30
  ----------
31
+ after : typing.Optional[str]
32
+
33
+ limit : typing.Optional[int]
34
+
35
+ query_text : typing.Optional[str]
36
+
19
37
  request_options : typing.Optional[RequestOptions]
20
38
  Request-specific configuration.
21
39
 
22
40
  Returns
23
41
  -------
24
- None
42
+ typing.List[str]
43
+ Successful Response
25
44
 
26
45
  Examples
27
46
  --------
@@ -33,13 +52,34 @@ class TagsClient:
33
52
  client.tags.list()
34
53
  """
35
54
  _response = self._client_wrapper.httpx_client.request(
36
- "v1/tags",
55
+ "v1/tags/",
37
56
  method="GET",
57
+ params={
58
+ "after": after,
59
+ "limit": limit,
60
+ "query_text": query_text,
61
+ },
38
62
  request_options=request_options,
39
63
  )
40
64
  try:
41
65
  if 200 <= _response.status_code < 300:
42
- return
66
+ return typing.cast(
67
+ typing.List[str],
68
+ construct_type(
69
+ type_=typing.List[str], # type: ignore
70
+ object_=_response.json(),
71
+ ),
72
+ )
73
+ if _response.status_code == 422:
74
+ raise UnprocessableEntityError(
75
+ typing.cast(
76
+ HttpValidationError,
77
+ construct_type(
78
+ type_=HttpValidationError, # type: ignore
79
+ object_=_response.json(),
80
+ ),
81
+ )
82
+ )
43
83
  _response_json = _response.json()
44
84
  except JSONDecodeError:
45
85
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -50,16 +90,32 @@ class AsyncTagsClient:
50
90
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
51
91
  self._client_wrapper = client_wrapper
52
92
 
53
- async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
93
+ async def list(
94
+ self,
95
+ *,
96
+ after: typing.Optional[str] = None,
97
+ limit: typing.Optional[int] = None,
98
+ query_text: typing.Optional[str] = None,
99
+ request_options: typing.Optional[RequestOptions] = None,
100
+ ) -> typing.List[str]:
54
101
  """
102
+ Get a list of all tags in the database
103
+
55
104
  Parameters
56
105
  ----------
106
+ after : typing.Optional[str]
107
+
108
+ limit : typing.Optional[int]
109
+
110
+ query_text : typing.Optional[str]
111
+
57
112
  request_options : typing.Optional[RequestOptions]
58
113
  Request-specific configuration.
59
114
 
60
115
  Returns
61
116
  -------
62
- None
117
+ typing.List[str]
118
+ Successful Response
63
119
 
64
120
  Examples
65
121
  --------
@@ -79,13 +135,34 @@ class AsyncTagsClient:
79
135
  asyncio.run(main())
80
136
  """
81
137
  _response = await self._client_wrapper.httpx_client.request(
82
- "v1/tags",
138
+ "v1/tags/",
83
139
  method="GET",
140
+ params={
141
+ "after": after,
142
+ "limit": limit,
143
+ "query_text": query_text,
144
+ },
84
145
  request_options=request_options,
85
146
  )
86
147
  try:
87
148
  if 200 <= _response.status_code < 300:
88
- return
149
+ return typing.cast(
150
+ typing.List[str],
151
+ construct_type(
152
+ type_=typing.List[str], # type: ignore
153
+ object_=_response.json(),
154
+ ),
155
+ )
156
+ if _response.status_code == 422:
157
+ raise UnprocessableEntityError(
158
+ typing.cast(
159
+ HttpValidationError,
160
+ construct_type(
161
+ type_=HttpValidationError, # type: ignore
162
+ object_=_response.json(),
163
+ ),
164
+ )
165
+ )
89
166
  _response_json = _response.json()
90
167
  except JSONDecodeError:
91
168
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-client
3
- Version: 0.1.123
3
+ Version: 0.1.124
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Intended Audience :: Developers
@@ -1,8 +1,8 @@
1
- letta_client/__init__.py,sha256=lvu9kaLmwEgZejhWKH_p1YedkgY_v3bs0zBGvx8jTys,15853
1
+ letta_client/__init__.py,sha256=0nkhsixcQgMbB8vLVrSCltVYO5w6h8-kHDfegfVKOfE,15803
2
2
  letta_client/agents/__init__.py,sha256=jmwsc7V6N1kAuoZqwxfUg4k1i8XcvPm-rTjOaySurDo,1474
3
3
  letta_client/agents/blocks/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
4
4
  letta_client/agents/blocks/client.py,sha256=u5zvutxoH_DqfSLWhRtNSRBC9_ezQDx682cxkxDz3JA,23822
5
- letta_client/agents/client.py,sha256=ZHGF4-WOOMYVx3qZWUMRwwwApHxybpN9-uOYutlheh0,77017
5
+ letta_client/agents/client.py,sha256=7k8DsAg9vdPXgnYLInoMyDPP1M6iyDz6vtfCngitxYM,74629
6
6
  letta_client/agents/context/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
7
7
  letta_client/agents/context/client.py,sha256=GKKvoG4N_K8Biz9yDjeIHpFG0C8Cwc7tHmEX3pTL_9U,4815
8
8
  letta_client/agents/core_memory/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
@@ -40,9 +40,9 @@ letta_client/agents/types/agents_search_request_search_item_zero.py,sha256=tGjwn
40
40
  letta_client/agents/types/agents_search_response.py,sha256=AQJVKps-bjCx2ujqESzW1Iy9ZYFS17hH_UFIeBeK4S8,815
41
41
  letta_client/agents/types/create_agent_request_tool_rules_item.py,sha256=L3FNsFTG9kVmuPbQhbCKNg3H2E5bB2Rgp92gWmGd-LM,689
42
42
  letta_client/agents/types/update_agent_tool_rules_item.py,sha256=k9MmcVPsK-EGl8XlT3JQwdlBNLgpGw528jmi8fCFS7g,682
43
- letta_client/base_client.py,sha256=1g63Ef1TiBD-1XspUhf1TRYiLC5_AffAAjWHTgB4718,10229
43
+ letta_client/base_client.py,sha256=yhzh-KitRM5idpGSn16_rJ8d9RRviTnWdaZ_14ooHo4,9769
44
44
  letta_client/batches/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
45
- letta_client/batches/client.py,sha256=O6hZ7IZkCIJHxtm0oa7mYHDTV9iVQlsVtXzYm7ZkThQ,17184
45
+ letta_client/batches/client.py,sha256=AyfQpG9d856XS9BYHjxCIwu08ye03KQjuwA-jd-9kWQ,18774
46
46
  letta_client/blocks/__init__.py,sha256=c6SGOs9_YGdydYAzhe5TUiaXq52rpWT1mNMcke8qGTQ,108
47
47
  letta_client/blocks/agents/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
48
48
  letta_client/blocks/agents/client.py,sha256=-QywGs_ZfE5PbgzLYf2zzn9zAtpZmzGtHHZ5sXIYw0Y,4904
@@ -59,7 +59,7 @@ letta_client/client_side_access_tokens/types/client_side_access_tokens_create_re
59
59
  letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response_policy_data_item_access_item.py,sha256=R-H25IpNp9feSrW8Yj3h9O3UTMVvFniQJElogKxLuoE,254
60
60
  letta_client/core/__init__.py,sha256=OKbX2aCZXgHCDUsCouqv-OiX32xA6eFFCKIUH9M5Vzk,1591
61
61
  letta_client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
62
- letta_client/core/client_wrapper.py,sha256=Rsr7WNq-iOcD0pXaPZz1LSHZ9vzb60ZBba7qEu5oPOk,1998
62
+ letta_client/core/client_wrapper.py,sha256=pKl9qx6il-hWWRt2X4KgTqYGBQceED8H2YD_SV9n6Eo,1998
63
63
  letta_client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
64
64
  letta_client/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
65
65
  letta_client/core/http_client.py,sha256=Z77OIxIbL4OAB2IDqjRq_sYa5yNYAWfmdhdCSSvh6Y4,19552
@@ -98,8 +98,6 @@ letta_client/identities/properties/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV
98
98
  letta_client/identities/properties/client.py,sha256=Nv7jOi5O8TmeZ1g0-TqnqiJ0hLcHMe2ZIfqAkEDB2Bk,6053
99
99
  letta_client/jobs/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
100
100
  letta_client/jobs/client.py,sha256=z1Zq6dGs2xbf3EAFuD3-m-qbpbUeqpCBYqtIFKkGoMk,15622
101
- letta_client/messages/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
102
- letta_client/messages/client.py,sha256=WCY_8drM56WMMgtUysaryBvHkyavt1G3BG7zxYoeMAc,4774
103
101
  letta_client/models/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
104
102
  letta_client/models/client.py,sha256=aY9ipKT5Fj4b8dvjvmr_5htaNSJxGA84knTl6e1WZCs,3373
105
103
  letta_client/projects/__init__.py,sha256=Mg9xvTJ4N4xDkj521w3jvmCgrbW3CYx9LxG7kkdoyzs,211
@@ -108,10 +106,10 @@ letta_client/projects/types/__init__.py,sha256=1nE8QFsR2GukiQxkaRFQfBuk1u_yuO-em
108
106
  letta_client/projects/types/projects_list_response.py,sha256=LdWVSnP8fqrVTcRfkd73N4wIa5_VkxrAUS-GFftkqHo,858
109
107
  letta_client/projects/types/projects_list_response_projects_item.py,sha256=7mFQdVQCNqvl2zBzVWzClENfF9N35T1Wpv3lgYbbAz0,605
110
108
  letta_client/providers/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
111
- letta_client/providers/client.py,sha256=OOa-jIMvSR09nvS6j2ucjE71KzzzDBc0huKTG8bpTkU,22865
109
+ letta_client/providers/client.py,sha256=xMy-Riwjr63GiCqR552xJGx1QEFb1hCVVUaSw_Wcw-o,17921
112
110
  letta_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
113
111
  letta_client/runs/__init__.py,sha256=0Mn3wMqzm7ppXeiwu9zfY_KlyzBbWSM1wt_rsx0NmM0,144
114
- letta_client/runs/client.py,sha256=yaanUjtudqdN9tAwntgQm4Sx5FtKm2RBNhXsCff2_HY,19298
112
+ letta_client/runs/client.py,sha256=6A0i8-fWzRgK1U5P4jeKKav-cRSjaaN5ttMh66ihwe8,17234
115
113
  letta_client/runs/messages/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
116
114
  letta_client/runs/messages/client.py,sha256=1qAtPmu2RM5_Hz8lf3X-yvDquOlCT47pEmc7aWFRaTo,9013
117
115
  letta_client/runs/steps/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
@@ -126,10 +124,8 @@ letta_client/sources/passages/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1
126
124
  letta_client/sources/passages/client.py,sha256=n0QVtLC0W1X6_SjhiEGSl9oZexocnsLZYeYRAqV2BCk,4767
127
125
  letta_client/steps/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
128
126
  letta_client/steps/client.py,sha256=ZMc2yPjqa0JgsPSMY5QHatPRm0mZRjxrsNQwm7p_xSU,13314
129
- letta_client/tag/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
130
- letta_client/tag/client.py,sha256=TBAotdb0e2_x2pANF4dOE1qmWY3GIgb7nOhvN7iZ3_4,5183
131
127
  letta_client/tags/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
132
- letta_client/tags/client.py,sha256=znLdVKV9hx39n6-W8w8jITHuzwDhqlfeWjP9x3Ex7S4,2619
128
+ letta_client/tags/client.py,sha256=1xIPtMWJ6ssAhPEFgl5CyJHyvND9MHCLIbEzQWxntZ0,5167
133
129
  letta_client/templates/__init__.py,sha256=6kqaRnkWVngMoV08wPrkA6urr_lCnE6FRIVq4jj4z1M,313
134
130
  letta_client/templates/agents/__init__.py,sha256=1tdurb6H9iIIc-Lq68A1xpuidIej7LU1Lz9zCSO4seM,141
135
131
  letta_client/templates/agents/client.py,sha256=Eyd3Hutky11j1BiSKsfpykq2oMZ2aGNUIYivZAdm9ic,7083
@@ -371,6 +367,6 @@ letta_client/voice/__init__.py,sha256=7hX85553PiRMtIMM12a0DSoFzsglNiUziYR2ekS84Q
371
367
  letta_client/voice/client.py,sha256=STjswa5oOLoP59QwTJvQwi73kgn0UzKOaXc2CsTRI4k,6912
372
368
  letta_client/voice/types/__init__.py,sha256=FRc3iKRTONE4N8Lf1IqvnqWZ2kXdrFFvkL7PxVcR8Ew,212
373
369
  letta_client/voice/types/create_voice_chat_completions_request_body.py,sha256=ZLfKgNK1T6IAwLEvaBVFfy7jEAoPUXP28n-nfmHkklc,391
374
- letta_client-0.1.123.dist-info/METADATA,sha256=BJmQU91G7SfpyJ8JLp5E1hbPer0DPvZtQlmRay4YacY,5042
375
- letta_client-0.1.123.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
376
- letta_client-0.1.123.dist-info/RECORD,,
370
+ letta_client-0.1.124.dist-info/METADATA,sha256=Y5lHZyav2ndJNNti0ljf0vUBf7XQvRF7DQkaxdO7Vwk,5042
371
+ letta_client-0.1.124.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
372
+ letta_client-0.1.124.dist-info/RECORD,,
@@ -1,2 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
@@ -1,146 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from ..core.client_wrapper import SyncClientWrapper
4
- import typing
5
- from ..core.request_options import RequestOptions
6
- from ..core.jsonable_encoder import jsonable_encoder
7
- from ..core.unchecked_base_model import construct_type
8
- from ..errors.unprocessable_entity_error import UnprocessableEntityError
9
- from ..types.http_validation_error import HttpValidationError
10
- from json.decoder import JSONDecodeError
11
- from ..core.api_error import ApiError
12
- from ..core.client_wrapper import AsyncClientWrapper
13
-
14
-
15
- class MessagesClient:
16
- def __init__(self, *, client_wrapper: SyncClientWrapper):
17
- self._client_wrapper = client_wrapper
18
-
19
- def cancel_batch_run(
20
- self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None
21
- ) -> typing.Optional[typing.Any]:
22
- """
23
- Cancel a batch run.
24
-
25
- Parameters
26
- ----------
27
- batch_id : str
28
-
29
- request_options : typing.Optional[RequestOptions]
30
- Request-specific configuration.
31
-
32
- Returns
33
- -------
34
- typing.Optional[typing.Any]
35
- Successful Response
36
-
37
- Examples
38
- --------
39
- from letta_client import Letta
40
-
41
- client = Letta(
42
- token="YOUR_TOKEN",
43
- )
44
- client.messages.cancel_batch_run(
45
- batch_id="batch_id",
46
- )
47
- """
48
- _response = self._client_wrapper.httpx_client.request(
49
- f"v1/messages/batches/{jsonable_encoder(batch_id)}/cancel",
50
- method="PATCH",
51
- request_options=request_options,
52
- )
53
- try:
54
- if 200 <= _response.status_code < 300:
55
- return typing.cast(
56
- typing.Optional[typing.Any],
57
- construct_type(
58
- type_=typing.Optional[typing.Any], # type: ignore
59
- object_=_response.json(),
60
- ),
61
- )
62
- if _response.status_code == 422:
63
- raise UnprocessableEntityError(
64
- typing.cast(
65
- HttpValidationError,
66
- construct_type(
67
- type_=HttpValidationError, # type: ignore
68
- object_=_response.json(),
69
- ),
70
- )
71
- )
72
- _response_json = _response.json()
73
- except JSONDecodeError:
74
- raise ApiError(status_code=_response.status_code, body=_response.text)
75
- raise ApiError(status_code=_response.status_code, body=_response_json)
76
-
77
-
78
- class AsyncMessagesClient:
79
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
80
- self._client_wrapper = client_wrapper
81
-
82
- async def cancel_batch_run(
83
- self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None
84
- ) -> typing.Optional[typing.Any]:
85
- """
86
- Cancel a batch run.
87
-
88
- Parameters
89
- ----------
90
- batch_id : str
91
-
92
- request_options : typing.Optional[RequestOptions]
93
- Request-specific configuration.
94
-
95
- Returns
96
- -------
97
- typing.Optional[typing.Any]
98
- Successful Response
99
-
100
- Examples
101
- --------
102
- import asyncio
103
-
104
- from letta_client import AsyncLetta
105
-
106
- client = AsyncLetta(
107
- token="YOUR_TOKEN",
108
- )
109
-
110
-
111
- async def main() -> None:
112
- await client.messages.cancel_batch_run(
113
- batch_id="batch_id",
114
- )
115
-
116
-
117
- asyncio.run(main())
118
- """
119
- _response = await self._client_wrapper.httpx_client.request(
120
- f"v1/messages/batches/{jsonable_encoder(batch_id)}/cancel",
121
- method="PATCH",
122
- request_options=request_options,
123
- )
124
- try:
125
- if 200 <= _response.status_code < 300:
126
- return typing.cast(
127
- typing.Optional[typing.Any],
128
- construct_type(
129
- type_=typing.Optional[typing.Any], # type: ignore
130
- object_=_response.json(),
131
- ),
132
- )
133
- if _response.status_code == 422:
134
- raise UnprocessableEntityError(
135
- typing.cast(
136
- HttpValidationError,
137
- construct_type(
138
- type_=HttpValidationError, # type: ignore
139
- object_=_response.json(),
140
- ),
141
- )
142
- )
143
- _response_json = _response.json()
144
- except JSONDecodeError:
145
- raise ApiError(status_code=_response.status_code, body=_response.text)
146
- raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -1,2 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
@@ -1,169 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from ..core.client_wrapper import SyncClientWrapper
4
- import typing
5
- from ..core.request_options import RequestOptions
6
- from ..core.unchecked_base_model import construct_type
7
- from ..errors.unprocessable_entity_error import UnprocessableEntityError
8
- from ..types.http_validation_error import HttpValidationError
9
- from json.decoder import JSONDecodeError
10
- from ..core.api_error import ApiError
11
- from ..core.client_wrapper import AsyncClientWrapper
12
-
13
-
14
- class TagClient:
15
- def __init__(self, *, client_wrapper: SyncClientWrapper):
16
- self._client_wrapper = client_wrapper
17
-
18
- def list_tags(
19
- self,
20
- *,
21
- after: typing.Optional[str] = None,
22
- limit: typing.Optional[int] = None,
23
- query_text: typing.Optional[str] = None,
24
- request_options: typing.Optional[RequestOptions] = None,
25
- ) -> typing.List[str]:
26
- """
27
- Get a list of all tags in the database
28
-
29
- Parameters
30
- ----------
31
- after : typing.Optional[str]
32
-
33
- limit : typing.Optional[int]
34
-
35
- query_text : typing.Optional[str]
36
-
37
- request_options : typing.Optional[RequestOptions]
38
- Request-specific configuration.
39
-
40
- Returns
41
- -------
42
- typing.List[str]
43
- Successful Response
44
-
45
- Examples
46
- --------
47
- from letta_client import Letta
48
-
49
- client = Letta(
50
- token="YOUR_TOKEN",
51
- )
52
- client.tag.list_tags()
53
- """
54
- _response = self._client_wrapper.httpx_client.request(
55
- "v1/tags/",
56
- method="GET",
57
- params={
58
- "after": after,
59
- "limit": limit,
60
- "query_text": query_text,
61
- },
62
- request_options=request_options,
63
- )
64
- try:
65
- if 200 <= _response.status_code < 300:
66
- return typing.cast(
67
- typing.List[str],
68
- construct_type(
69
- type_=typing.List[str], # type: ignore
70
- object_=_response.json(),
71
- ),
72
- )
73
- if _response.status_code == 422:
74
- raise UnprocessableEntityError(
75
- typing.cast(
76
- HttpValidationError,
77
- construct_type(
78
- type_=HttpValidationError, # type: ignore
79
- object_=_response.json(),
80
- ),
81
- )
82
- )
83
- _response_json = _response.json()
84
- except JSONDecodeError:
85
- raise ApiError(status_code=_response.status_code, body=_response.text)
86
- raise ApiError(status_code=_response.status_code, body=_response_json)
87
-
88
-
89
- class AsyncTagClient:
90
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
91
- self._client_wrapper = client_wrapper
92
-
93
- async def list_tags(
94
- self,
95
- *,
96
- after: typing.Optional[str] = None,
97
- limit: typing.Optional[int] = None,
98
- query_text: typing.Optional[str] = None,
99
- request_options: typing.Optional[RequestOptions] = None,
100
- ) -> typing.List[str]:
101
- """
102
- Get a list of all tags in the database
103
-
104
- Parameters
105
- ----------
106
- after : typing.Optional[str]
107
-
108
- limit : typing.Optional[int]
109
-
110
- query_text : typing.Optional[str]
111
-
112
- request_options : typing.Optional[RequestOptions]
113
- Request-specific configuration.
114
-
115
- Returns
116
- -------
117
- typing.List[str]
118
- Successful Response
119
-
120
- Examples
121
- --------
122
- import asyncio
123
-
124
- from letta_client import AsyncLetta
125
-
126
- client = AsyncLetta(
127
- token="YOUR_TOKEN",
128
- )
129
-
130
-
131
- async def main() -> None:
132
- await client.tag.list_tags()
133
-
134
-
135
- asyncio.run(main())
136
- """
137
- _response = await self._client_wrapper.httpx_client.request(
138
- "v1/tags/",
139
- method="GET",
140
- params={
141
- "after": after,
142
- "limit": limit,
143
- "query_text": query_text,
144
- },
145
- request_options=request_options,
146
- )
147
- try:
148
- if 200 <= _response.status_code < 300:
149
- return typing.cast(
150
- typing.List[str],
151
- construct_type(
152
- type_=typing.List[str], # type: ignore
153
- object_=_response.json(),
154
- ),
155
- )
156
- if _response.status_code == 422:
157
- raise UnprocessableEntityError(
158
- typing.cast(
159
- HttpValidationError,
160
- construct_type(
161
- type_=HttpValidationError, # type: ignore
162
- object_=_response.json(),
163
- ),
164
- )
165
- )
166
- _response_json = _response.json()
167
- except JSONDecodeError:
168
- raise ApiError(status_code=_response.status_code, body=_response.text)
169
- raise ApiError(status_code=_response.status_code, body=_response_json)