letta-client 0.1.120__py3-none-any.whl → 0.1.122__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 +7 -6
- letta_client/agents/__init__.py +2 -1
- letta_client/agents/client.py +90 -581
- letta_client/agents/groups/client.py +167 -0
- letta_client/agents/messages/client.py +145 -0
- letta_client/agents/passages/client.py +289 -0
- letta_client/base_client.py +12 -0
- letta_client/batches/__init__.py +2 -0
- letta_client/{messages/batches → batches}/client.py +19 -19
- letta_client/blocks/__init__.py +3 -0
- letta_client/blocks/agents/__init__.py +2 -0
- letta_client/blocks/agents/client.py +149 -0
- letta_client/blocks/client.py +4 -127
- letta_client/core/client_wrapper.py +1 -1
- letta_client/embeddings/__init__.py +2 -0
- letta_client/embeddings/client.py +108 -0
- letta_client/groups/client.py +0 -124
- letta_client/groups/messages/client.py +124 -0
- letta_client/identities/__init__.py +3 -0
- letta_client/identities/client.py +4 -154
- letta_client/identities/properties/__init__.py +2 -0
- letta_client/identities/properties/client.py +181 -0
- letta_client/messages/__init__.py +0 -3
- letta_client/messages/client.py +0 -4
- letta_client/models/client.py +4 -97
- letta_client/providers/client.py +173 -10
- letta_client/runs/__init__.py +3 -0
- letta_client/runs/client.py +34 -480
- letta_client/runs/messages/__init__.py +2 -0
- letta_client/runs/messages/client.py +234 -0
- letta_client/runs/steps/__init__.py +2 -0
- letta_client/runs/steps/client.py +217 -0
- letta_client/runs/usage/__init__.py +2 -0
- letta_client/runs/usage/client.py +145 -0
- letta_client/sources/client.py +6 -4
- letta_client/steps/client.py +78 -4
- letta_client/tags/__init__.py +2 -0
- letta_client/tags/client.py +92 -0
- letta_client/templates/__init__.py +5 -6
- letta_client/templates/agents/__init__.py +5 -0
- letta_client/templates/agents/client.py +208 -0
- letta_client/templates/agents/types/__init__.py +5 -0
- letta_client/templates/{types/templates_create_agents_response.py → agents/types/agents_create_response.py} +4 -4
- letta_client/templates/client.py +6 -191
- letta_client/templates/types/__init__.py +1 -6
- letta_client/tools/client.py +4 -4
- {letta_client-0.1.120.dist-info → letta_client-0.1.122.dist-info}/METADATA +1 -1
- {letta_client-0.1.120.dist-info → letta_client-0.1.122.dist-info}/RECORD +50 -31
- /letta_client/{messages/batches → agents/groups}/__init__.py +0 -0
- {letta_client-0.1.120.dist-info → letta_client-0.1.122.dist-info}/WHEEL +0 -0
letta_client/models/client.py
CHANGED
|
@@ -7,7 +7,6 @@ from ..types.llm_config import LlmConfig
|
|
|
7
7
|
from ..core.unchecked_base_model import construct_type
|
|
8
8
|
from json.decoder import JSONDecodeError
|
|
9
9
|
from ..core.api_error import ApiError
|
|
10
|
-
from ..types.embedding_config import EmbeddingConfig
|
|
11
10
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
12
11
|
|
|
13
12
|
|
|
@@ -15,7 +14,7 @@ class ModelsClient:
|
|
|
15
14
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
16
15
|
self._client_wrapper = client_wrapper
|
|
17
16
|
|
|
18
|
-
def
|
|
17
|
+
def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[LlmConfig]:
|
|
19
18
|
"""
|
|
20
19
|
Parameters
|
|
21
20
|
----------
|
|
@@ -34,7 +33,7 @@ class ModelsClient:
|
|
|
34
33
|
client = Letta(
|
|
35
34
|
token="YOUR_TOKEN",
|
|
36
35
|
)
|
|
37
|
-
client.models.
|
|
36
|
+
client.models.list()
|
|
38
37
|
"""
|
|
39
38
|
_response = self._client_wrapper.httpx_client.request(
|
|
40
39
|
"v1/models/",
|
|
@@ -55,54 +54,12 @@ class ModelsClient:
|
|
|
55
54
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
56
55
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
57
56
|
|
|
58
|
-
def list_embedding_models(
|
|
59
|
-
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
60
|
-
) -> typing.List[EmbeddingConfig]:
|
|
61
|
-
"""
|
|
62
|
-
Parameters
|
|
63
|
-
----------
|
|
64
|
-
request_options : typing.Optional[RequestOptions]
|
|
65
|
-
Request-specific configuration.
|
|
66
|
-
|
|
67
|
-
Returns
|
|
68
|
-
-------
|
|
69
|
-
typing.List[EmbeddingConfig]
|
|
70
|
-
Successful Response
|
|
71
|
-
|
|
72
|
-
Examples
|
|
73
|
-
--------
|
|
74
|
-
from letta_client import Letta
|
|
75
|
-
|
|
76
|
-
client = Letta(
|
|
77
|
-
token="YOUR_TOKEN",
|
|
78
|
-
)
|
|
79
|
-
client.models.list_embedding_models()
|
|
80
|
-
"""
|
|
81
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
82
|
-
"v1/models/embedding",
|
|
83
|
-
method="GET",
|
|
84
|
-
request_options=request_options,
|
|
85
|
-
)
|
|
86
|
-
try:
|
|
87
|
-
if 200 <= _response.status_code < 300:
|
|
88
|
-
return typing.cast(
|
|
89
|
-
typing.List[EmbeddingConfig],
|
|
90
|
-
construct_type(
|
|
91
|
-
type_=typing.List[EmbeddingConfig], # type: ignore
|
|
92
|
-
object_=_response.json(),
|
|
93
|
-
),
|
|
94
|
-
)
|
|
95
|
-
_response_json = _response.json()
|
|
96
|
-
except JSONDecodeError:
|
|
97
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
98
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
99
|
-
|
|
100
57
|
|
|
101
58
|
class AsyncModelsClient:
|
|
102
59
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
103
60
|
self._client_wrapper = client_wrapper
|
|
104
61
|
|
|
105
|
-
async def
|
|
62
|
+
async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[LlmConfig]:
|
|
106
63
|
"""
|
|
107
64
|
Parameters
|
|
108
65
|
----------
|
|
@@ -126,7 +83,7 @@ class AsyncModelsClient:
|
|
|
126
83
|
|
|
127
84
|
|
|
128
85
|
async def main() -> None:
|
|
129
|
-
await client.models.
|
|
86
|
+
await client.models.list()
|
|
130
87
|
|
|
131
88
|
|
|
132
89
|
asyncio.run(main())
|
|
@@ -149,53 +106,3 @@ class AsyncModelsClient:
|
|
|
149
106
|
except JSONDecodeError:
|
|
150
107
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
151
108
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
152
|
-
|
|
153
|
-
async def list_embedding_models(
|
|
154
|
-
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
155
|
-
) -> typing.List[EmbeddingConfig]:
|
|
156
|
-
"""
|
|
157
|
-
Parameters
|
|
158
|
-
----------
|
|
159
|
-
request_options : typing.Optional[RequestOptions]
|
|
160
|
-
Request-specific configuration.
|
|
161
|
-
|
|
162
|
-
Returns
|
|
163
|
-
-------
|
|
164
|
-
typing.List[EmbeddingConfig]
|
|
165
|
-
Successful Response
|
|
166
|
-
|
|
167
|
-
Examples
|
|
168
|
-
--------
|
|
169
|
-
import asyncio
|
|
170
|
-
|
|
171
|
-
from letta_client import AsyncLetta
|
|
172
|
-
|
|
173
|
-
client = AsyncLetta(
|
|
174
|
-
token="YOUR_TOKEN",
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
async def main() -> None:
|
|
179
|
-
await client.models.list_embedding_models()
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
asyncio.run(main())
|
|
183
|
-
"""
|
|
184
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
185
|
-
"v1/models/embedding",
|
|
186
|
-
method="GET",
|
|
187
|
-
request_options=request_options,
|
|
188
|
-
)
|
|
189
|
-
try:
|
|
190
|
-
if 200 <= _response.status_code < 300:
|
|
191
|
-
return typing.cast(
|
|
192
|
-
typing.List[EmbeddingConfig],
|
|
193
|
-
construct_type(
|
|
194
|
-
type_=typing.List[EmbeddingConfig], # type: ignore
|
|
195
|
-
object_=_response.json(),
|
|
196
|
-
),
|
|
197
|
-
)
|
|
198
|
-
_response_json = _response.json()
|
|
199
|
-
except JSONDecodeError:
|
|
200
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
201
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
letta_client/providers/client.py
CHANGED
|
@@ -9,6 +9,7 @@ from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
|
9
9
|
from ..types.http_validation_error import HttpValidationError
|
|
10
10
|
from json.decoder import JSONDecodeError
|
|
11
11
|
from ..core.api_error import ApiError
|
|
12
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
12
13
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
13
14
|
|
|
14
15
|
# this is used as the default value for optional parameters
|
|
@@ -19,7 +20,7 @@ class ProvidersClient:
|
|
|
19
20
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
20
21
|
self._client_wrapper = client_wrapper
|
|
21
22
|
|
|
22
|
-
def
|
|
23
|
+
def list(
|
|
23
24
|
self,
|
|
24
25
|
*,
|
|
25
26
|
after: typing.Optional[str] = None,
|
|
@@ -50,7 +51,7 @@ class ProvidersClient:
|
|
|
50
51
|
client = Letta(
|
|
51
52
|
token="YOUR_TOKEN",
|
|
52
53
|
)
|
|
53
|
-
client.providers.
|
|
54
|
+
client.providers.list()
|
|
54
55
|
"""
|
|
55
56
|
_response = self._client_wrapper.httpx_client.request(
|
|
56
57
|
"v1/providers/",
|
|
@@ -85,9 +86,7 @@ class ProvidersClient:
|
|
|
85
86
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
86
87
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
87
88
|
|
|
88
|
-
def
|
|
89
|
-
self, *, name: str, api_key: str, request_options: typing.Optional[RequestOptions] = None
|
|
90
|
-
) -> Provider:
|
|
89
|
+
def create(self, *, name: str, api_key: str, request_options: typing.Optional[RequestOptions] = None) -> Provider:
|
|
91
90
|
"""
|
|
92
91
|
Create a new custom provider
|
|
93
92
|
|
|
@@ -114,7 +113,7 @@ class ProvidersClient:
|
|
|
114
113
|
client = Letta(
|
|
115
114
|
token="YOUR_TOKEN",
|
|
116
115
|
)
|
|
117
|
-
client.providers.
|
|
116
|
+
client.providers.create(
|
|
118
117
|
name="name",
|
|
119
118
|
api_key="api_key",
|
|
120
119
|
)
|
|
@@ -289,12 +288,86 @@ class ProvidersClient:
|
|
|
289
288
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
290
289
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
291
290
|
|
|
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
|
+
|
|
292
365
|
|
|
293
366
|
class AsyncProvidersClient:
|
|
294
367
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
295
368
|
self._client_wrapper = client_wrapper
|
|
296
369
|
|
|
297
|
-
async def
|
|
370
|
+
async def list(
|
|
298
371
|
self,
|
|
299
372
|
*,
|
|
300
373
|
after: typing.Optional[str] = None,
|
|
@@ -330,7 +403,7 @@ class AsyncProvidersClient:
|
|
|
330
403
|
|
|
331
404
|
|
|
332
405
|
async def main() -> None:
|
|
333
|
-
await client.providers.
|
|
406
|
+
await client.providers.list()
|
|
334
407
|
|
|
335
408
|
|
|
336
409
|
asyncio.run(main())
|
|
@@ -368,7 +441,7 @@ class AsyncProvidersClient:
|
|
|
368
441
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
369
442
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
370
443
|
|
|
371
|
-
async def
|
|
444
|
+
async def create(
|
|
372
445
|
self, *, name: str, api_key: str, request_options: typing.Optional[RequestOptions] = None
|
|
373
446
|
) -> Provider:
|
|
374
447
|
"""
|
|
@@ -402,7 +475,7 @@ class AsyncProvidersClient:
|
|
|
402
475
|
|
|
403
476
|
|
|
404
477
|
async def main() -> None:
|
|
405
|
-
await client.providers.
|
|
478
|
+
await client.providers.create(
|
|
406
479
|
name="name",
|
|
407
480
|
api_key="api_key",
|
|
408
481
|
)
|
|
@@ -595,3 +668,93 @@ class AsyncProvidersClient:
|
|
|
595
668
|
except JSONDecodeError:
|
|
596
669
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
597
670
|
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)
|