letta-client 0.1.54__py3-none-any.whl → 0.1.55__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.

@@ -26,6 +26,7 @@ from ..types.embedding_config import EmbeddingConfig
26
26
  from ..types.message_create import MessageCreate
27
27
  from ..core.serialization import convert_and_respect_annotation_metadata
28
28
  from ..core.jsonable_encoder import jsonable_encoder
29
+ from .. import core
29
30
  from .types.update_agent_tool_rules_item import UpdateAgentToolRulesItem
30
31
  import datetime as dt
31
32
  from ..types.passage import Passage
@@ -414,6 +415,136 @@ class AgentsClient:
414
415
  raise ApiError(status_code=_response.status_code, body=_response.text)
415
416
  raise ApiError(status_code=_response.status_code, body=_response_json)
416
417
 
418
+ def download_agent_serialized(
419
+ self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
420
+ ) -> typing.Optional[typing.Any]:
421
+ """
422
+ Download the serialized JSON representation of an agent.
423
+
424
+ Parameters
425
+ ----------
426
+ agent_id : str
427
+
428
+ request_options : typing.Optional[RequestOptions]
429
+ Request-specific configuration.
430
+
431
+ Returns
432
+ -------
433
+ typing.Optional[typing.Any]
434
+ Successful Response
435
+
436
+ Examples
437
+ --------
438
+ from letta_client import Letta
439
+
440
+ client = Letta(
441
+ token="YOUR_TOKEN",
442
+ )
443
+ client.agents.download_agent_serialized(
444
+ agent_id="agent_id",
445
+ )
446
+ """
447
+ _response = self._client_wrapper.httpx_client.request(
448
+ f"v1/agents/{jsonable_encoder(agent_id)}/download",
449
+ method="GET",
450
+ request_options=request_options,
451
+ )
452
+ try:
453
+ if 200 <= _response.status_code < 300:
454
+ return typing.cast(
455
+ typing.Optional[typing.Any],
456
+ construct_type(
457
+ type_=typing.Optional[typing.Any], # type: ignore
458
+ object_=_response.json(),
459
+ ),
460
+ )
461
+ if _response.status_code == 422:
462
+ raise UnprocessableEntityError(
463
+ typing.cast(
464
+ HttpValidationError,
465
+ construct_type(
466
+ type_=HttpValidationError, # type: ignore
467
+ object_=_response.json(),
468
+ ),
469
+ )
470
+ )
471
+ _response_json = _response.json()
472
+ except JSONDecodeError:
473
+ raise ApiError(status_code=_response.status_code, body=_response.text)
474
+ raise ApiError(status_code=_response.status_code, body=_response_json)
475
+
476
+ def upload_agent_serialized(
477
+ self,
478
+ *,
479
+ file: core.File,
480
+ mark_as_copy: typing.Optional[bool] = None,
481
+ request_options: typing.Optional[RequestOptions] = None,
482
+ ) -> AgentState:
483
+ """
484
+ Upload a serialized agent JSON file and recreate the agent in the system.
485
+
486
+ Parameters
487
+ ----------
488
+ file : core.File
489
+ See core.File for more documentation
490
+
491
+ mark_as_copy : typing.Optional[bool]
492
+ Whether to mark the uploaded agent as a copy
493
+
494
+ request_options : typing.Optional[RequestOptions]
495
+ Request-specific configuration.
496
+
497
+ Returns
498
+ -------
499
+ AgentState
500
+ Successful Response
501
+
502
+ Examples
503
+ --------
504
+ from letta_client import Letta
505
+
506
+ client = Letta(
507
+ token="YOUR_TOKEN",
508
+ )
509
+ client.agents.upload_agent_serialized()
510
+ """
511
+ _response = self._client_wrapper.httpx_client.request(
512
+ "v1/agents/upload",
513
+ method="POST",
514
+ params={
515
+ "mark_as_copy": mark_as_copy,
516
+ },
517
+ data={},
518
+ files={
519
+ "file": file,
520
+ },
521
+ request_options=request_options,
522
+ omit=OMIT,
523
+ )
524
+ try:
525
+ if 200 <= _response.status_code < 300:
526
+ return typing.cast(
527
+ AgentState,
528
+ construct_type(
529
+ type_=AgentState, # type: ignore
530
+ object_=_response.json(),
531
+ ),
532
+ )
533
+ if _response.status_code == 422:
534
+ raise UnprocessableEntityError(
535
+ typing.cast(
536
+ HttpValidationError,
537
+ construct_type(
538
+ type_=HttpValidationError, # type: ignore
539
+ object_=_response.json(),
540
+ ),
541
+ )
542
+ )
543
+ _response_json = _response.json()
544
+ except JSONDecodeError:
545
+ raise ApiError(status_code=_response.status_code, body=_response.text)
546
+ raise ApiError(status_code=_response.status_code, body=_response_json)
547
+
417
548
  def retrieve(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AgentState:
418
549
  """
419
550
  Get the state of the agent.
@@ -1359,6 +1490,152 @@ class AsyncAgentsClient:
1359
1490
  raise ApiError(status_code=_response.status_code, body=_response.text)
1360
1491
  raise ApiError(status_code=_response.status_code, body=_response_json)
1361
1492
 
1493
+ async def download_agent_serialized(
1494
+ self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
1495
+ ) -> typing.Optional[typing.Any]:
1496
+ """
1497
+ Download the serialized JSON representation of an agent.
1498
+
1499
+ Parameters
1500
+ ----------
1501
+ agent_id : str
1502
+
1503
+ request_options : typing.Optional[RequestOptions]
1504
+ Request-specific configuration.
1505
+
1506
+ Returns
1507
+ -------
1508
+ typing.Optional[typing.Any]
1509
+ Successful Response
1510
+
1511
+ Examples
1512
+ --------
1513
+ import asyncio
1514
+
1515
+ from letta_client import AsyncLetta
1516
+
1517
+ client = AsyncLetta(
1518
+ token="YOUR_TOKEN",
1519
+ )
1520
+
1521
+
1522
+ async def main() -> None:
1523
+ await client.agents.download_agent_serialized(
1524
+ agent_id="agent_id",
1525
+ )
1526
+
1527
+
1528
+ asyncio.run(main())
1529
+ """
1530
+ _response = await self._client_wrapper.httpx_client.request(
1531
+ f"v1/agents/{jsonable_encoder(agent_id)}/download",
1532
+ method="GET",
1533
+ request_options=request_options,
1534
+ )
1535
+ try:
1536
+ if 200 <= _response.status_code < 300:
1537
+ return typing.cast(
1538
+ typing.Optional[typing.Any],
1539
+ construct_type(
1540
+ type_=typing.Optional[typing.Any], # type: ignore
1541
+ object_=_response.json(),
1542
+ ),
1543
+ )
1544
+ if _response.status_code == 422:
1545
+ raise UnprocessableEntityError(
1546
+ typing.cast(
1547
+ HttpValidationError,
1548
+ construct_type(
1549
+ type_=HttpValidationError, # type: ignore
1550
+ object_=_response.json(),
1551
+ ),
1552
+ )
1553
+ )
1554
+ _response_json = _response.json()
1555
+ except JSONDecodeError:
1556
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1557
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1558
+
1559
+ async def upload_agent_serialized(
1560
+ self,
1561
+ *,
1562
+ file: core.File,
1563
+ mark_as_copy: typing.Optional[bool] = None,
1564
+ request_options: typing.Optional[RequestOptions] = None,
1565
+ ) -> AgentState:
1566
+ """
1567
+ Upload a serialized agent JSON file and recreate the agent in the system.
1568
+
1569
+ Parameters
1570
+ ----------
1571
+ file : core.File
1572
+ See core.File for more documentation
1573
+
1574
+ mark_as_copy : typing.Optional[bool]
1575
+ Whether to mark the uploaded agent as a copy
1576
+
1577
+ request_options : typing.Optional[RequestOptions]
1578
+ Request-specific configuration.
1579
+
1580
+ Returns
1581
+ -------
1582
+ AgentState
1583
+ Successful Response
1584
+
1585
+ Examples
1586
+ --------
1587
+ import asyncio
1588
+
1589
+ from letta_client import AsyncLetta
1590
+
1591
+ client = AsyncLetta(
1592
+ token="YOUR_TOKEN",
1593
+ )
1594
+
1595
+
1596
+ async def main() -> None:
1597
+ await client.agents.upload_agent_serialized()
1598
+
1599
+
1600
+ asyncio.run(main())
1601
+ """
1602
+ _response = await self._client_wrapper.httpx_client.request(
1603
+ "v1/agents/upload",
1604
+ method="POST",
1605
+ params={
1606
+ "mark_as_copy": mark_as_copy,
1607
+ },
1608
+ data={},
1609
+ files={
1610
+ "file": file,
1611
+ },
1612
+ request_options=request_options,
1613
+ omit=OMIT,
1614
+ )
1615
+ try:
1616
+ if 200 <= _response.status_code < 300:
1617
+ return typing.cast(
1618
+ AgentState,
1619
+ construct_type(
1620
+ type_=AgentState, # type: ignore
1621
+ object_=_response.json(),
1622
+ ),
1623
+ )
1624
+ if _response.status_code == 422:
1625
+ raise UnprocessableEntityError(
1626
+ typing.cast(
1627
+ HttpValidationError,
1628
+ construct_type(
1629
+ type_=HttpValidationError, # type: ignore
1630
+ object_=_response.json(),
1631
+ ),
1632
+ )
1633
+ )
1634
+ _response_json = _response.json()
1635
+ except JSONDecodeError:
1636
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1637
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1638
+
1362
1639
  async def retrieve(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AgentState:
1363
1640
  """
1364
1641
  Get the state of the agent.
@@ -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.54",
19
+ "X-Fern-SDK-Version": "0.1.55",
20
20
  }
21
21
  if self.token is not None:
22
22
  headers["Authorization"] = f"Bearer {self.token}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-client
3
- Version: 0.1.54
3
+ Version: 0.1.55
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Intended Audience :: Developers
@@ -2,7 +2,7 @@ letta_client/__init__.py,sha256=gE-ZEiBn_82WiGeafvXwxQh49hjm0E16DPA5jB6s7L4,5652
2
2
  letta_client/agents/__init__.py,sha256=dsO71a7KQVSsJkkd31kf6RwxZOeJzjhvJZRQBS7Mlws,22384
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=YUFtT3ZBHyvUcK-IbAchSbYRJprGB9aR2eedNdI6r3g,73961
5
+ letta_client/agents/client.py,sha256=rMgrx7nZH0KR-T1ye5yQIDRVpWWAbFX4ZQVN90zv0S0,82633
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
@@ -209,7 +209,7 @@ letta_client/blocks/client.py,sha256=AeQQ-IdYhV-zqLTt3PTrJOtJ6XtBZcXNC108Y5EogVU
209
209
  letta_client/client.py,sha256=xdSrD4IkWokZHujowd1r7zESBoVgKGNvo6RqgZ3f0Fg,12808
210
210
  letta_client/core/__init__.py,sha256=OKbX2aCZXgHCDUsCouqv-OiX32xA6eFFCKIUH9M5Vzk,1591
211
211
  letta_client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
212
- letta_client/core/client_wrapper.py,sha256=jIg6jkb0yX5-JmMNEd_l26MVdszs6wxY2UDbBauoiZM,1997
212
+ letta_client/core/client_wrapper.py,sha256=bCQa8ib0wvPkNfoMS5vVB9DVMabROs5bjmtio3h5swI,1997
213
213
  letta_client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
214
214
  letta_client/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
215
215
  letta_client/core/http_client.py,sha256=siUQ6UV0ARZALlxubqWSSAAPC9B4VW8y6MGlHStfaeo,19552
@@ -590,6 +590,6 @@ letta_client/voice/__init__.py,sha256=ZrZEuXIukVGhsfM-i0dIFfqjeSOBMPeEgDva7Vvnip
590
590
  letta_client/voice/client.py,sha256=j3feSlNzeTVFXE7RUKEHGeMl_w0TJFBRUI3pXpLpUEI,6148
591
591
  letta_client/voice/types/__init__.py,sha256=hBLJcrom99DkDxxsVRU2ni8kPx6SsCy8gtAJvNOz26w,199
592
592
  letta_client/voice/types/create_voice_chat_completions_request.py,sha256=K4__83rXRCshfdobyAmH-5fUDJQ_PeSQetTUeC4Abk0,381
593
- letta_client-0.1.54.dist-info/METADATA,sha256=bW_vwYxfAnY-_zb45lt9yg3s6H2EPpIUYK77NsOpqxo,4942
594
- letta_client-0.1.54.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
595
- letta_client-0.1.54.dist-info/RECORD,,
593
+ letta_client-0.1.55.dist-info/METADATA,sha256=zOTxA6hciGwFiAy5G9uIaqsMm5QZaPA4rVsm12p_Go8,4942
594
+ letta_client-0.1.55.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
595
+ letta_client-0.1.55.dist-info/RECORD,,