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

@@ -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)
@@ -7,6 +7,7 @@ from .agent_environment_variable import AgentEnvironmentVariable
7
7
  from .agent_schema import AgentSchema
8
8
  from .agent_schema_tool_rules_item import AgentSchemaToolRulesItem
9
9
  from .agent_state import AgentState
10
+ from .agent_state_response_format import AgentStateResponseFormat
10
11
  from .agent_state_tool_rules_item import AgentStateToolRulesItem
11
12
  from .agent_type import AgentType
12
13
  from .app_auth_scheme import AppAuthScheme
@@ -113,7 +114,9 @@ from .internal_server_error_body import InternalServerErrorBody
113
114
  from .job import Job
114
115
  from .job_status import JobStatus
115
116
  from .job_type import JobType
117
+ from .json_object_response_format import JsonObjectResponseFormat
116
118
  from .json_schema import JsonSchema
119
+ from .json_schema_response_format import JsonSchemaResponseFormat
117
120
  from .letta_batch_request import LettaBatchRequest
118
121
  from .letta_message_content_union import LettaMessageContentUnion
119
122
  from .letta_message_union import LettaMessageUnion
@@ -189,6 +192,7 @@ from .system_message import SystemMessage
189
192
  from .tag_schema import TagSchema
190
193
  from .terminal_tool_rule import TerminalToolRule
191
194
  from .text_content import TextContent
195
+ from .text_response_format import TextResponseFormat
192
196
  from .tool import Tool
193
197
  from .tool_call import ToolCall
194
198
  from .tool_call_content import ToolCallContent
@@ -232,6 +236,7 @@ __all__ = [
232
236
  "AgentSchema",
233
237
  "AgentSchemaToolRulesItem",
234
238
  "AgentState",
239
+ "AgentStateResponseFormat",
235
240
  "AgentStateToolRulesItem",
236
241
  "AgentType",
237
242
  "AppAuthScheme",
@@ -338,7 +343,9 @@ __all__ = [
338
343
  "Job",
339
344
  "JobStatus",
340
345
  "JobType",
346
+ "JsonObjectResponseFormat",
341
347
  "JsonSchema",
348
+ "JsonSchemaResponseFormat",
342
349
  "LettaBatchRequest",
343
350
  "LettaMessageContentUnion",
344
351
  "LettaMessageUnion",
@@ -410,6 +417,7 @@ __all__ = [
410
417
  "TagSchema",
411
418
  "TerminalToolRule",
412
419
  "TextContent",
420
+ "TextResponseFormat",
413
421
  "Tool",
414
422
  "ToolCall",
415
423
  "ToolCallContent",
@@ -8,6 +8,7 @@ from .agent_state_tool_rules_item import AgentStateToolRulesItem
8
8
  from .agent_type import AgentType
9
9
  from .llm_config import LlmConfig
10
10
  from .embedding_config import EmbeddingConfig
11
+ from .agent_state_response_format import AgentStateResponseFormat
11
12
  from .memory import Memory
12
13
  from .tool import Tool
13
14
  from .source import Source
@@ -92,6 +93,11 @@ class AgentState(UncheckedBaseModel):
92
93
  The embedding configuration used by the agent.
93
94
  """
94
95
 
96
+ response_format: typing.Optional[AgentStateResponseFormat] = pydantic.Field(default=None)
97
+ """
98
+ The response format used by the agent when returning from `send_message`.
99
+ """
100
+
95
101
  description: typing.Optional[str] = pydantic.Field(default=None)
96
102
  """
97
103
  The description of the agent.
@@ -0,0 +1,8 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from .json_object_response_format import JsonObjectResponseFormat
5
+ from .json_schema_response_format import JsonSchemaResponseFormat
6
+ from .text_response_format import TextResponseFormat
7
+
8
+ AgentStateResponseFormat = typing.Union[JsonObjectResponseFormat, JsonSchemaResponseFormat, TextResponseFormat]