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

Files changed (46) hide show
  1. letta_client/agents/blocks/client.py +10 -0
  2. letta_client/agents/client.py +26 -14
  3. letta_client/agents/context/client.py +2 -0
  4. letta_client/agents/core_memory/client.py +2 -0
  5. letta_client/agents/groups/client.py +2 -0
  6. letta_client/agents/memory_variables/client.py +2 -0
  7. letta_client/agents/messages/client.py +12 -0
  8. letta_client/agents/passages/client.py +8 -0
  9. letta_client/agents/sources/client.py +6 -0
  10. letta_client/agents/templates/client.py +6 -0
  11. letta_client/agents/tools/client.py +6 -0
  12. letta_client/base_client.py +8 -0
  13. letta_client/batches/client.py +8 -0
  14. letta_client/blocks/agents/client.py +2 -0
  15. letta_client/blocks/client.py +12 -0
  16. letta_client/client_side_access_tokens/client.py +4 -0
  17. letta_client/core/client_wrapper.py +16 -4
  18. letta_client/embedding_models/client.py +2 -0
  19. letta_client/groups/client.py +12 -16
  20. letta_client/groups/messages/client.py +10 -0
  21. letta_client/health/client.py +2 -0
  22. letta_client/identities/client.py +14 -16
  23. letta_client/identities/properties/client.py +2 -0
  24. letta_client/jobs/client.py +8 -0
  25. letta_client/messages/client.py +2 -0
  26. letta_client/models/client.py +2 -0
  27. letta_client/projects/client.py +2 -0
  28. letta_client/providers/client.py +10 -0
  29. letta_client/runs/client.py +8 -0
  30. letta_client/runs/messages/client.py +2 -0
  31. letta_client/runs/steps/client.py +2 -0
  32. letta_client/runs/usage/client.py +2 -0
  33. letta_client/sources/client.py +16 -0
  34. letta_client/sources/files/client.py +6 -0
  35. letta_client/sources/passages/client.py +2 -0
  36. letta_client/steps/client.py +4 -143
  37. letta_client/steps/feedback/client.py +77 -10
  38. letta_client/tags/client.py +2 -0
  39. letta_client/telemetry/client.py +2 -0
  40. letta_client/templates/agents/client.py +2 -0
  41. letta_client/templates/client.py +2 -0
  42. letta_client/tools/client.py +38 -0
  43. letta_client/voice/client.py +2 -0
  44. {letta_client-0.1.181.dist-info → letta_client-0.1.183.dist-info}/METADATA +4 -1
  45. {letta_client-0.1.181.dist-info → letta_client-0.1.183.dist-info}/RECORD +46 -46
  46. {letta_client-0.1.181.dist-info → letta_client-0.1.183.dist-info}/WHEEL +0 -0
@@ -12,7 +12,6 @@ from ..types.http_validation_error import HttpValidationError
12
12
  from json.decoder import JSONDecodeError
13
13
  from ..core.api_error import ApiError
14
14
  from ..core.jsonable_encoder import jsonable_encoder
15
- from ..types.feedback_type import FeedbackType
16
15
  from ..core.client_wrapper import AsyncClientWrapper
17
16
  from .feedback.client import AsyncFeedbackClient
18
17
 
@@ -94,6 +93,7 @@ class StepsClient:
94
93
  from letta_client import Letta
95
94
 
96
95
  client = Letta(
96
+ project="YOUR_PROJECT",
97
97
  token="YOUR_TOKEN",
98
98
  )
99
99
  client.steps.list()
@@ -162,6 +162,7 @@ class StepsClient:
162
162
  from letta_client import Letta
163
163
 
164
164
  client = Letta(
165
+ project="YOUR_PROJECT",
165
166
  token="YOUR_TOKEN",
166
167
  )
167
168
  client.steps.retrieve(
@@ -197,73 +198,6 @@ class StepsClient:
197
198
  raise ApiError(status_code=_response.status_code, body=_response.text)
198
199
  raise ApiError(status_code=_response.status_code, body=_response_json)
199
200
 
200
- def add_feedback(
201
- self,
202
- step_id: str,
203
- *,
204
- feedback: typing.Optional[FeedbackType] = None,
205
- request_options: typing.Optional[RequestOptions] = None,
206
- ) -> Step:
207
- """
208
- Add feedback to a step.
209
-
210
- Parameters
211
- ----------
212
- step_id : str
213
-
214
- feedback : typing.Optional[FeedbackType]
215
-
216
- request_options : typing.Optional[RequestOptions]
217
- Request-specific configuration.
218
-
219
- Returns
220
- -------
221
- Step
222
- Successful Response
223
-
224
- Examples
225
- --------
226
- from letta_client import Letta
227
-
228
- client = Letta(
229
- token="YOUR_TOKEN",
230
- )
231
- client.steps.add_feedback(
232
- step_id="step_id",
233
- )
234
- """
235
- _response = self._client_wrapper.httpx_client.request(
236
- f"v1/steps/{jsonable_encoder(step_id)}/feedback",
237
- method="PATCH",
238
- params={
239
- "feedback": feedback,
240
- },
241
- request_options=request_options,
242
- )
243
- try:
244
- if 200 <= _response.status_code < 300:
245
- return typing.cast(
246
- Step,
247
- construct_type(
248
- type_=Step, # type: ignore
249
- object_=_response.json(),
250
- ),
251
- )
252
- if _response.status_code == 422:
253
- raise UnprocessableEntityError(
254
- typing.cast(
255
- HttpValidationError,
256
- construct_type(
257
- type_=HttpValidationError, # type: ignore
258
- object_=_response.json(),
259
- ),
260
- )
261
- )
262
- _response_json = _response.json()
263
- except JSONDecodeError:
264
- raise ApiError(status_code=_response.status_code, body=_response.text)
265
- raise ApiError(status_code=_response.status_code, body=_response_json)
266
-
267
201
 
268
202
  class AsyncStepsClient:
269
203
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -344,6 +278,7 @@ class AsyncStepsClient:
344
278
  from letta_client import AsyncLetta
345
279
 
346
280
  client = AsyncLetta(
281
+ project="YOUR_PROJECT",
347
282
  token="YOUR_TOKEN",
348
283
  )
349
284
 
@@ -420,6 +355,7 @@ class AsyncStepsClient:
420
355
  from letta_client import AsyncLetta
421
356
 
422
357
  client = AsyncLetta(
358
+ project="YOUR_PROJECT",
423
359
  token="YOUR_TOKEN",
424
360
  )
425
361
 
@@ -460,78 +396,3 @@ class AsyncStepsClient:
460
396
  except JSONDecodeError:
461
397
  raise ApiError(status_code=_response.status_code, body=_response.text)
462
398
  raise ApiError(status_code=_response.status_code, body=_response_json)
463
-
464
- async def add_feedback(
465
- self,
466
- step_id: str,
467
- *,
468
- feedback: typing.Optional[FeedbackType] = None,
469
- request_options: typing.Optional[RequestOptions] = None,
470
- ) -> Step:
471
- """
472
- Add feedback to a step.
473
-
474
- Parameters
475
- ----------
476
- step_id : str
477
-
478
- feedback : typing.Optional[FeedbackType]
479
-
480
- request_options : typing.Optional[RequestOptions]
481
- Request-specific configuration.
482
-
483
- Returns
484
- -------
485
- Step
486
- Successful Response
487
-
488
- Examples
489
- --------
490
- import asyncio
491
-
492
- from letta_client import AsyncLetta
493
-
494
- client = AsyncLetta(
495
- token="YOUR_TOKEN",
496
- )
497
-
498
-
499
- async def main() -> None:
500
- await client.steps.add_feedback(
501
- step_id="step_id",
502
- )
503
-
504
-
505
- asyncio.run(main())
506
- """
507
- _response = await self._client_wrapper.httpx_client.request(
508
- f"v1/steps/{jsonable_encoder(step_id)}/feedback",
509
- method="PATCH",
510
- params={
511
- "feedback": feedback,
512
- },
513
- request_options=request_options,
514
- )
515
- try:
516
- if 200 <= _response.status_code < 300:
517
- return typing.cast(
518
- Step,
519
- construct_type(
520
- type_=Step, # type: ignore
521
- object_=_response.json(),
522
- ),
523
- )
524
- if _response.status_code == 422:
525
- raise UnprocessableEntityError(
526
- typing.cast(
527
- HttpValidationError,
528
- construct_type(
529
- type_=HttpValidationError, # type: ignore
530
- object_=_response.json(),
531
- ),
532
- )
533
- )
534
- _response_json = _response.json()
535
- except JSONDecodeError:
536
- raise ApiError(status_code=_response.status_code, body=_response.text)
537
- raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -2,8 +2,13 @@
2
2
 
3
3
  from ...core.client_wrapper import SyncClientWrapper
4
4
  import typing
5
+ from ...types.feedback_type import FeedbackType
5
6
  from ...core.request_options import RequestOptions
7
+ from ...types.step import Step
6
8
  from ...core.jsonable_encoder import jsonable_encoder
9
+ from ...core.unchecked_base_model import construct_type
10
+ from ...errors.unprocessable_entity_error import UnprocessableEntityError
11
+ from ...types.http_validation_error import HttpValidationError
7
12
  from json.decoder import JSONDecodeError
8
13
  from ...core.api_error import ApiError
9
14
  from ...core.client_wrapper import AsyncClientWrapper
@@ -13,38 +18,69 @@ class FeedbackClient:
13
18
  def __init__(self, *, client_wrapper: SyncClientWrapper):
14
19
  self._client_wrapper = client_wrapper
15
20
 
16
- def add(self, step_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
21
+ def create(
22
+ self,
23
+ step_id: str,
24
+ *,
25
+ feedback: typing.Optional[FeedbackType] = None,
26
+ request_options: typing.Optional[RequestOptions] = None,
27
+ ) -> Step:
17
28
  """
29
+ Add feedback to a step.
30
+
18
31
  Parameters
19
32
  ----------
20
33
  step_id : str
21
34
 
35
+ feedback : typing.Optional[FeedbackType]
36
+
22
37
  request_options : typing.Optional[RequestOptions]
23
38
  Request-specific configuration.
24
39
 
25
40
  Returns
26
41
  -------
27
- None
42
+ Step
43
+ Successful Response
28
44
 
29
45
  Examples
30
46
  --------
31
47
  from letta_client import Letta
32
48
 
33
49
  client = Letta(
50
+ project="YOUR_PROJECT",
34
51
  token="YOUR_TOKEN",
35
52
  )
36
- client.steps.feedback.add(
53
+ client.steps.feedback.create(
37
54
  step_id="step_id",
38
55
  )
39
56
  """
40
57
  _response = self._client_wrapper.httpx_client.request(
41
58
  f"v1/steps/{jsonable_encoder(step_id)}/feedback",
42
- method="POST",
59
+ method="PATCH",
60
+ params={
61
+ "feedback": feedback,
62
+ },
43
63
  request_options=request_options,
44
64
  )
45
65
  try:
46
66
  if 200 <= _response.status_code < 300:
47
- return
67
+ return typing.cast(
68
+ Step,
69
+ construct_type(
70
+ type_=Step, # type: ignore
71
+ object_=_response.json(),
72
+ ),
73
+ )
74
+ if _response.status_code == 422:
75
+ raise UnprocessableEntityError(
76
+ typing.cast(
77
+ HttpValidationError,
78
+ construct_type(
79
+ type_=HttpValidationError, # type: ignore
80
+ object_=_response.json(),
81
+ ),
82
+ )
83
+ )
48
84
  _response_json = _response.json()
49
85
  except JSONDecodeError:
50
86
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -55,18 +91,29 @@ class AsyncFeedbackClient:
55
91
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
56
92
  self._client_wrapper = client_wrapper
57
93
 
58
- async def add(self, step_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
94
+ async def create(
95
+ self,
96
+ step_id: str,
97
+ *,
98
+ feedback: typing.Optional[FeedbackType] = None,
99
+ request_options: typing.Optional[RequestOptions] = None,
100
+ ) -> Step:
59
101
  """
102
+ Add feedback to a step.
103
+
60
104
  Parameters
61
105
  ----------
62
106
  step_id : str
63
107
 
108
+ feedback : typing.Optional[FeedbackType]
109
+
64
110
  request_options : typing.Optional[RequestOptions]
65
111
  Request-specific configuration.
66
112
 
67
113
  Returns
68
114
  -------
69
- None
115
+ Step
116
+ Successful Response
70
117
 
71
118
  Examples
72
119
  --------
@@ -75,12 +122,13 @@ class AsyncFeedbackClient:
75
122
  from letta_client import AsyncLetta
76
123
 
77
124
  client = AsyncLetta(
125
+ project="YOUR_PROJECT",
78
126
  token="YOUR_TOKEN",
79
127
  )
80
128
 
81
129
 
82
130
  async def main() -> None:
83
- await client.steps.feedback.add(
131
+ await client.steps.feedback.create(
84
132
  step_id="step_id",
85
133
  )
86
134
 
@@ -89,12 +137,31 @@ class AsyncFeedbackClient:
89
137
  """
90
138
  _response = await self._client_wrapper.httpx_client.request(
91
139
  f"v1/steps/{jsonable_encoder(step_id)}/feedback",
92
- method="POST",
140
+ method="PATCH",
141
+ params={
142
+ "feedback": feedback,
143
+ },
93
144
  request_options=request_options,
94
145
  )
95
146
  try:
96
147
  if 200 <= _response.status_code < 300:
97
- return
148
+ return typing.cast(
149
+ Step,
150
+ construct_type(
151
+ type_=Step, # type: ignore
152
+ object_=_response.json(),
153
+ ),
154
+ )
155
+ if _response.status_code == 422:
156
+ raise UnprocessableEntityError(
157
+ typing.cast(
158
+ HttpValidationError,
159
+ construct_type(
160
+ type_=HttpValidationError, # type: ignore
161
+ object_=_response.json(),
162
+ ),
163
+ )
164
+ )
98
165
  _response_json = _response.json()
99
166
  except JSONDecodeError:
100
167
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -47,6 +47,7 @@ class TagsClient:
47
47
  from letta_client import Letta
48
48
 
49
49
  client = Letta(
50
+ project="YOUR_PROJECT",
50
51
  token="YOUR_TOKEN",
51
52
  )
52
53
  client.tags.list()
@@ -124,6 +125,7 @@ class AsyncTagsClient:
124
125
  from letta_client import AsyncLetta
125
126
 
126
127
  client = AsyncLetta(
128
+ project="YOUR_PROJECT",
127
129
  token="YOUR_TOKEN",
128
130
  )
129
131
 
@@ -38,6 +38,7 @@ class TelemetryClient:
38
38
  from letta_client import Letta
39
39
 
40
40
  client = Letta(
41
+ project="YOUR_PROJECT",
41
42
  token="YOUR_TOKEN",
42
43
  )
43
44
  client.telemetry.retrieve_provider_trace(
@@ -101,6 +102,7 @@ class AsyncTelemetryClient:
101
102
  from letta_client import AsyncLetta
102
103
 
103
104
  client = AsyncLetta(
105
+ project="YOUR_PROJECT",
104
106
  token="YOUR_TOKEN",
105
107
  )
106
108
 
@@ -71,6 +71,7 @@ class AgentsClient:
71
71
  from letta_client import Letta
72
72
 
73
73
  client = Letta(
74
+ project="YOUR_PROJECT",
74
75
  token="YOUR_TOKEN",
75
76
  )
76
77
  client.templates.agents.create(
@@ -176,6 +177,7 @@ class AsyncAgentsClient:
176
177
  from letta_client import AsyncLetta
177
178
 
178
179
  client = AsyncLetta(
180
+ project="YOUR_PROJECT",
179
181
  token="YOUR_TOKEN",
180
182
  )
181
183
 
@@ -52,6 +52,7 @@ class TemplatesClient:
52
52
  from letta_client import Letta
53
53
 
54
54
  client = Letta(
55
+ project="YOUR_PROJECT",
55
56
  token="YOUR_TOKEN",
56
57
  )
57
58
  client.templates.list()
@@ -124,6 +125,7 @@ class AsyncTemplatesClient:
124
125
  from letta_client import AsyncLetta
125
126
 
126
127
  client = AsyncLetta(
128
+ project="YOUR_PROJECT",
127
129
  token="YOUR_TOKEN",
128
130
  )
129
131