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

@@ -3,14 +3,13 @@
3
3
  import typing
4
4
  from ...core.client_wrapper import SyncClientWrapper
5
5
  from ...core.request_options import RequestOptions
6
- from ...types.letta_schemas_message_message import LettaSchemasMessageMessage
6
+ from ...types.memory import Memory
7
7
  from ...core.jsonable_encoder import jsonable_encoder
8
8
  from ...core.unchecked_base_model import construct_type
9
9
  from ...errors.unprocessable_entity_error import UnprocessableEntityError
10
10
  from ...types.http_validation_error import HttpValidationError
11
11
  from json.decoder import JSONDecodeError
12
12
  from ...core.api_error import ApiError
13
- from ...types.memory import Memory
14
13
  from ...types.block import Block
15
14
  from ...core.client_wrapper import AsyncClientWrapper
16
15
 
@@ -22,64 +21,6 @@ class CoreMemoryClient:
22
21
  def __init__(self, *, client_wrapper: SyncClientWrapper):
23
22
  self._client_wrapper = client_wrapper
24
23
 
25
- def list_in_context(
26
- self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
27
- ) -> typing.List[LettaSchemasMessageMessage]:
28
- """
29
- Retrieve the messages in the context of a specific agent.
30
-
31
- Parameters
32
- ----------
33
- agent_id : str
34
-
35
- request_options : typing.Optional[RequestOptions]
36
- Request-specific configuration.
37
-
38
- Returns
39
- -------
40
- typing.List[LettaSchemasMessageMessage]
41
- Successful Response
42
-
43
- Examples
44
- --------
45
- from letta_client import Letta
46
-
47
- client = Letta(
48
- token="YOUR_TOKEN",
49
- )
50
- client.agents.core_memory.list_in_context(
51
- agent_id="agent_id",
52
- )
53
- """
54
- _response = self._client_wrapper.httpx_client.request(
55
- f"v1/agents/{jsonable_encoder(agent_id)}/memory/messages",
56
- method="GET",
57
- request_options=request_options,
58
- )
59
- try:
60
- if 200 <= _response.status_code < 300:
61
- return typing.cast(
62
- typing.List[LettaSchemasMessageMessage],
63
- construct_type(
64
- type_=typing.List[LettaSchemasMessageMessage], # type: ignore
65
- object_=_response.json(),
66
- ),
67
- )
68
- if _response.status_code == 422:
69
- raise UnprocessableEntityError(
70
- typing.cast(
71
- HttpValidationError,
72
- construct_type(
73
- type_=HttpValidationError, # type: ignore
74
- object_=_response.json(),
75
- ),
76
- )
77
- )
78
- _response_json = _response.json()
79
- except JSONDecodeError:
80
- raise ApiError(status_code=_response.status_code, body=_response.text)
81
- raise ApiError(status_code=_response.status_code, body=_response_json)
82
-
83
24
  def get(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Memory:
84
25
  """
85
26
  Retrieve the memory state of a specific agent.
@@ -109,7 +50,7 @@ class CoreMemoryClient:
109
50
  )
110
51
  """
111
52
  _response = self._client_wrapper.httpx_client.request(
112
- f"v1/agents/{jsonable_encoder(agent_id)}/memory",
53
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory",
113
54
  method="GET",
114
55
  request_options=request_options,
115
56
  )
@@ -170,7 +111,7 @@ class CoreMemoryClient:
170
111
  )
171
112
  """
172
113
  _response = self._client_wrapper.httpx_client.request(
173
- f"v1/agents/{jsonable_encoder(agent_id)}/memory/block/{jsonable_encoder(block_label)}",
114
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory/blocks/{jsonable_encoder(block_label)}",
174
115
  method="GET",
175
116
  request_options=request_options,
176
117
  )
@@ -231,7 +172,7 @@ class CoreMemoryClient:
231
172
  )
232
173
  """
233
174
  _response = self._client_wrapper.httpx_client.request(
234
- f"v1/agents/{jsonable_encoder(agent_id)}/memory/block/{jsonable_encoder(block_label)}",
175
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory/blocks/{jsonable_encoder(block_label)}",
235
176
  method="DELETE",
236
177
  request_options=request_options,
237
178
  )
@@ -324,7 +265,7 @@ class CoreMemoryClient:
324
265
  )
325
266
  """
326
267
  _response = self._client_wrapper.httpx_client.request(
327
- f"v1/agents/{jsonable_encoder(agent_id)}/memory/block/{jsonable_encoder(block_label)}",
268
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory/blocks/{jsonable_encoder(block_label)}",
328
269
  method="PATCH",
329
270
  json={
330
271
  "value": value,
@@ -362,9 +303,7 @@ class CoreMemoryClient:
362
303
  raise ApiError(status_code=_response.status_code, body=_response.text)
363
304
  raise ApiError(status_code=_response.status_code, body=_response_json)
364
305
 
365
- def get_blocks(
366
- self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
367
- ) -> typing.List[Block]:
306
+ def list(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Block]:
368
307
  """
369
308
  Retrieve the memory blocks of a specific agent.
370
309
 
@@ -387,12 +326,12 @@ class CoreMemoryClient:
387
326
  client = Letta(
388
327
  token="YOUR_TOKEN",
389
328
  )
390
- client.agents.core_memory.get_blocks(
329
+ client.agents.core_memory.list(
391
330
  agent_id="agent_id",
392
331
  )
393
332
  """
394
333
  _response = self._client_wrapper.httpx_client.request(
395
- f"v1/agents/{jsonable_encoder(agent_id)}/memory/block",
334
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory/blocks",
396
335
  method="GET",
397
336
  request_options=request_options,
398
337
  )
@@ -482,7 +421,7 @@ class CoreMemoryClient:
482
421
  )
483
422
  """
484
423
  _response = self._client_wrapper.httpx_client.request(
485
- f"v1/agents/{jsonable_encoder(agent_id)}/memory/block",
424
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory/blocks",
486
425
  method="POST",
487
426
  json={
488
427
  "value": value,
@@ -525,72 +464,6 @@ class AsyncCoreMemoryClient:
525
464
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
526
465
  self._client_wrapper = client_wrapper
527
466
 
528
- async def list_in_context(
529
- self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
530
- ) -> typing.List[LettaSchemasMessageMessage]:
531
- """
532
- Retrieve the messages in the context of a specific agent.
533
-
534
- Parameters
535
- ----------
536
- agent_id : str
537
-
538
- request_options : typing.Optional[RequestOptions]
539
- Request-specific configuration.
540
-
541
- Returns
542
- -------
543
- typing.List[LettaSchemasMessageMessage]
544
- Successful Response
545
-
546
- Examples
547
- --------
548
- import asyncio
549
-
550
- from letta_client import AsyncLetta
551
-
552
- client = AsyncLetta(
553
- token="YOUR_TOKEN",
554
- )
555
-
556
-
557
- async def main() -> None:
558
- await client.agents.core_memory.list_in_context(
559
- agent_id="agent_id",
560
- )
561
-
562
-
563
- asyncio.run(main())
564
- """
565
- _response = await self._client_wrapper.httpx_client.request(
566
- f"v1/agents/{jsonable_encoder(agent_id)}/memory/messages",
567
- method="GET",
568
- request_options=request_options,
569
- )
570
- try:
571
- if 200 <= _response.status_code < 300:
572
- return typing.cast(
573
- typing.List[LettaSchemasMessageMessage],
574
- construct_type(
575
- type_=typing.List[LettaSchemasMessageMessage], # type: ignore
576
- object_=_response.json(),
577
- ),
578
- )
579
- if _response.status_code == 422:
580
- raise UnprocessableEntityError(
581
- typing.cast(
582
- HttpValidationError,
583
- construct_type(
584
- type_=HttpValidationError, # type: ignore
585
- object_=_response.json(),
586
- ),
587
- )
588
- )
589
- _response_json = _response.json()
590
- except JSONDecodeError:
591
- raise ApiError(status_code=_response.status_code, body=_response.text)
592
- raise ApiError(status_code=_response.status_code, body=_response_json)
593
-
594
467
  async def get(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Memory:
595
468
  """
596
469
  Retrieve the memory state of a specific agent.
@@ -628,7 +501,7 @@ class AsyncCoreMemoryClient:
628
501
  asyncio.run(main())
629
502
  """
630
503
  _response = await self._client_wrapper.httpx_client.request(
631
- f"v1/agents/{jsonable_encoder(agent_id)}/memory",
504
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory",
632
505
  method="GET",
633
506
  request_options=request_options,
634
507
  )
@@ -697,7 +570,7 @@ class AsyncCoreMemoryClient:
697
570
  asyncio.run(main())
698
571
  """
699
572
  _response = await self._client_wrapper.httpx_client.request(
700
- f"v1/agents/{jsonable_encoder(agent_id)}/memory/block/{jsonable_encoder(block_label)}",
573
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory/blocks/{jsonable_encoder(block_label)}",
701
574
  method="GET",
702
575
  request_options=request_options,
703
576
  )
@@ -766,7 +639,7 @@ class AsyncCoreMemoryClient:
766
639
  asyncio.run(main())
767
640
  """
768
641
  _response = await self._client_wrapper.httpx_client.request(
769
- f"v1/agents/{jsonable_encoder(agent_id)}/memory/block/{jsonable_encoder(block_label)}",
642
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory/blocks/{jsonable_encoder(block_label)}",
770
643
  method="DELETE",
771
644
  request_options=request_options,
772
645
  )
@@ -867,7 +740,7 @@ class AsyncCoreMemoryClient:
867
740
  asyncio.run(main())
868
741
  """
869
742
  _response = await self._client_wrapper.httpx_client.request(
870
- f"v1/agents/{jsonable_encoder(agent_id)}/memory/block/{jsonable_encoder(block_label)}",
743
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory/blocks/{jsonable_encoder(block_label)}",
871
744
  method="PATCH",
872
745
  json={
873
746
  "value": value,
@@ -905,7 +778,7 @@ class AsyncCoreMemoryClient:
905
778
  raise ApiError(status_code=_response.status_code, body=_response.text)
906
779
  raise ApiError(status_code=_response.status_code, body=_response_json)
907
780
 
908
- async def get_blocks(
781
+ async def list(
909
782
  self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
910
783
  ) -> typing.List[Block]:
911
784
  """
@@ -935,7 +808,7 @@ class AsyncCoreMemoryClient:
935
808
 
936
809
 
937
810
  async def main() -> None:
938
- await client.agents.core_memory.get_blocks(
811
+ await client.agents.core_memory.list(
939
812
  agent_id="agent_id",
940
813
  )
941
814
 
@@ -943,7 +816,7 @@ class AsyncCoreMemoryClient:
943
816
  asyncio.run(main())
944
817
  """
945
818
  _response = await self._client_wrapper.httpx_client.request(
946
- f"v1/agents/{jsonable_encoder(agent_id)}/memory/block",
819
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory/blocks",
947
820
  method="GET",
948
821
  request_options=request_options,
949
822
  )
@@ -1041,7 +914,7 @@ class AsyncCoreMemoryClient:
1041
914
  asyncio.run(main())
1042
915
  """
1043
916
  _response = await self._client_wrapper.httpx_client.request(
1044
- f"v1/agents/{jsonable_encoder(agent_id)}/memory/block",
917
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory/blocks",
1045
918
  method="POST",
1046
919
  json={
1047
920
  "value": value,
@@ -48,7 +48,7 @@ class MemoryVariablesClient:
48
48
  )
49
49
  """
50
50
  _response = self._client_wrapper.httpx_client.request(
51
- f"v1/agents/{jsonable_encoder(agent_id)}/variables",
51
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory/variables",
52
52
  method="GET",
53
53
  request_options=request_options,
54
54
  )
@@ -121,7 +121,7 @@ class AsyncMemoryVariablesClient:
121
121
  asyncio.run(main())
122
122
  """
123
123
  _response = await self._client_wrapper.httpx_client.request(
124
- f"v1/agents/{jsonable_encoder(agent_id)}/variables",
124
+ f"v1/agents/{jsonable_encoder(agent_id)}/core_memory/variables",
125
125
  method="GET",
126
126
  request_options=request_options,
127
127
  )
@@ -121,7 +121,7 @@ class MessagesClient:
121
121
  raise ApiError(status_code=_response.status_code, body=_response.text)
122
122
  raise ApiError(status_code=_response.status_code, body=_response_json)
123
123
 
124
- def send(
124
+ def create(
125
125
  self,
126
126
  agent_id: str,
127
127
  *,
@@ -158,7 +158,7 @@ class MessagesClient:
158
158
  client = Letta(
159
159
  token="YOUR_TOKEN",
160
160
  )
161
- client.agents.messages.send(
161
+ client.agents.messages.create(
162
162
  agent_id="agent_id",
163
163
  messages=[
164
164
  MessageCreate(
@@ -306,7 +306,7 @@ class MessagesClient:
306
306
  raise ApiError(status_code=_response.status_code, body=_response.text)
307
307
  raise ApiError(status_code=_response.status_code, body=_response_json)
308
308
 
309
- def stream(
309
+ def create_stream(
310
310
  self,
311
311
  agent_id: str,
312
312
  *,
@@ -348,7 +348,7 @@ class MessagesClient:
348
348
  client = Letta(
349
349
  token="YOUR_TOKEN",
350
350
  )
351
- response = client.agents.messages.stream(
351
+ response = client.agents.messages.create_stream(
352
352
  agent_id="agent_id",
353
353
  messages=[
354
354
  MessageCreate(
@@ -409,7 +409,7 @@ class MessagesClient:
409
409
  raise ApiError(status_code=_response.status_code, body=_response.text)
410
410
  raise ApiError(status_code=_response.status_code, body=_response_json)
411
411
 
412
- def send_async(
412
+ def create_async(
413
413
  self,
414
414
  agent_id: str,
415
415
  *,
@@ -446,7 +446,7 @@ class MessagesClient:
446
446
  client = Letta(
447
447
  token="YOUR_TOKEN",
448
448
  )
449
- client.agents.messages.send_async(
449
+ client.agents.messages.create_async(
450
450
  agent_id="agent_id",
451
451
  messages=[
452
452
  MessageCreate(
@@ -595,7 +595,7 @@ class AsyncMessagesClient:
595
595
  raise ApiError(status_code=_response.status_code, body=_response.text)
596
596
  raise ApiError(status_code=_response.status_code, body=_response_json)
597
597
 
598
- async def send(
598
+ async def create(
599
599
  self,
600
600
  agent_id: str,
601
601
  *,
@@ -637,7 +637,7 @@ class AsyncMessagesClient:
637
637
 
638
638
 
639
639
  async def main() -> None:
640
- await client.agents.messages.send(
640
+ await client.agents.messages.create(
641
641
  agent_id="agent_id",
642
642
  messages=[
643
643
  MessageCreate(
@@ -796,7 +796,7 @@ class AsyncMessagesClient:
796
796
  raise ApiError(status_code=_response.status_code, body=_response.text)
797
797
  raise ApiError(status_code=_response.status_code, body=_response_json)
798
798
 
799
- async def stream(
799
+ async def create_stream(
800
800
  self,
801
801
  agent_id: str,
802
802
  *,
@@ -843,7 +843,7 @@ class AsyncMessagesClient:
843
843
 
844
844
 
845
845
  async def main() -> None:
846
- response = await client.agents.messages.stream(
846
+ response = await client.agents.messages.create_stream(
847
847
  agent_id="agent_id",
848
848
  messages=[
849
849
  MessageCreate(
@@ -907,7 +907,7 @@ class AsyncMessagesClient:
907
907
  raise ApiError(status_code=_response.status_code, body=_response.text)
908
908
  raise ApiError(status_code=_response.status_code, body=_response_json)
909
909
 
910
- async def send_async(
910
+ async def create_async(
911
911
  self,
912
912
  agent_id: str,
913
913
  *,
@@ -949,7 +949,7 @@ class AsyncMessagesClient:
949
949
 
950
950
 
951
951
  async def main() -> None:
952
- await client.agents.messages.send_async(
952
+ await client.agents.messages.create_async(
953
953
  agent_id="agent_id",
954
954
  messages=[
955
955
  MessageCreate(
@@ -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.16",
19
+ "X-Fern-SDK-Version": "0.1.17",
20
20
  }
21
21
  if self.token is not None:
22
22
  headers["Authorization"] = f"Bearer {self.token}"