letta-client 0.1.121__py3-none-any.whl → 0.1.123__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 +24 -23
- 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/client_side_access_tokens/__init__.py +12 -12
- letta_client/client_side_access_tokens/client.py +28 -32
- letta_client/client_side_access_tokens/types/__init__.py +15 -21
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_request_policy_item.py → client_side_access_tokens_create_request_policy_item.py} +4 -4
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_request_policy_item_access_item.py → client_side_access_tokens_create_request_policy_item_access_item.py} +1 -1
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_response.py → client_side_access_tokens_create_response.py} +3 -5
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_response_policy.py → client_side_access_tokens_create_response_policy.py} +4 -4
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_response_policy_data_item.py → client_side_access_tokens_create_response_policy_data_item.py} +4 -4
- letta_client/client_side_access_tokens/types/{client_side_access_tokens_create_client_side_access_token_response_policy_data_item_access_item.py → client_side_access_tokens_create_response_policy_data_item_access_item.py} +1 -1
- 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/projects/__init__.py +2 -2
- letta_client/projects/client.py +13 -13
- letta_client/projects/types/__init__.py +3 -3
- letta_client/projects/types/{projects_list_projects_response.py → projects_list_response.py} +3 -3
- letta_client/projects/types/{projects_list_projects_response_projects_item.py → projects_list_response_projects_item.py} +1 -1
- 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 +4 -10
- 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 +18 -203
- letta_client/templates/types/__init__.py +3 -8
- letta_client/templates/types/{templates_list_templates_response.py → templates_list_response.py} +3 -3
- letta_client/templates/types/{templates_list_templates_response_templates_item.py → templates_list_response_templates_item.py} +1 -1
- letta_client/tools/client.py +4 -4
- {letta_client-0.1.121.dist-info → letta_client-0.1.123.dist-info}/METADATA +1 -1
- {letta_client-0.1.121.dist-info → letta_client-0.1.123.dist-info}/RECORD +66 -47
- /letta_client/{messages/batches → agents/groups}/__init__.py +0 -0
- {letta_client-0.1.121.dist-info → letta_client-0.1.123.dist-info}/WHEEL +0 -0
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
4
|
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
-
from .types.
|
|
6
|
-
ClientSideAccessTokensCreateClientSideAccessTokenRequestPolicyItem,
|
|
7
|
-
)
|
|
5
|
+
from .types.client_side_access_tokens_create_request_policy_item import ClientSideAccessTokensCreateRequestPolicyItem
|
|
8
6
|
from ..core.request_options import RequestOptions
|
|
9
|
-
from .types.
|
|
10
|
-
ClientSideAccessTokensCreateClientSideAccessTokenResponse,
|
|
11
|
-
)
|
|
7
|
+
from .types.client_side_access_tokens_create_response import ClientSideAccessTokensCreateResponse
|
|
12
8
|
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
13
9
|
from ..core.unchecked_base_model import construct_type
|
|
14
10
|
from ..errors.bad_request_error import BadRequestError
|
|
@@ -25,20 +21,20 @@ class ClientSideAccessTokensClient:
|
|
|
25
21
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
26
22
|
self._client_wrapper = client_wrapper
|
|
27
23
|
|
|
28
|
-
def
|
|
24
|
+
def create(
|
|
29
25
|
self,
|
|
30
26
|
*,
|
|
31
|
-
policy: typing.Sequence[
|
|
27
|
+
policy: typing.Sequence[ClientSideAccessTokensCreateRequestPolicyItem],
|
|
32
28
|
hostname: str,
|
|
33
29
|
expires_at: typing.Optional[str] = OMIT,
|
|
34
30
|
request_options: typing.Optional[RequestOptions] = None,
|
|
35
|
-
) ->
|
|
31
|
+
) -> ClientSideAccessTokensCreateResponse:
|
|
36
32
|
"""
|
|
37
33
|
Create a new client side access token with the specified configuration.
|
|
38
34
|
|
|
39
35
|
Parameters
|
|
40
36
|
----------
|
|
41
|
-
policy : typing.Sequence[
|
|
37
|
+
policy : typing.Sequence[ClientSideAccessTokensCreateRequestPolicyItem]
|
|
42
38
|
|
|
43
39
|
hostname : str
|
|
44
40
|
The hostname of the client side application. Please specify the full URL including the protocol (http or https).
|
|
@@ -51,22 +47,22 @@ class ClientSideAccessTokensClient:
|
|
|
51
47
|
|
|
52
48
|
Returns
|
|
53
49
|
-------
|
|
54
|
-
|
|
50
|
+
ClientSideAccessTokensCreateResponse
|
|
55
51
|
201
|
|
56
52
|
|
|
57
53
|
Examples
|
|
58
54
|
--------
|
|
59
55
|
from letta_client import Letta
|
|
60
56
|
from letta_client.client_side_access_tokens import (
|
|
61
|
-
|
|
57
|
+
ClientSideAccessTokensCreateRequestPolicyItem,
|
|
62
58
|
)
|
|
63
59
|
|
|
64
60
|
client = Letta(
|
|
65
61
|
token="YOUR_TOKEN",
|
|
66
62
|
)
|
|
67
|
-
client.client_side_access_tokens.
|
|
63
|
+
client.client_side_access_tokens.create(
|
|
68
64
|
policy=[
|
|
69
|
-
|
|
65
|
+
ClientSideAccessTokensCreateRequestPolicyItem(
|
|
70
66
|
id="id",
|
|
71
67
|
access=["read_messages"],
|
|
72
68
|
)
|
|
@@ -80,7 +76,7 @@ class ClientSideAccessTokensClient:
|
|
|
80
76
|
json={
|
|
81
77
|
"policy": convert_and_respect_annotation_metadata(
|
|
82
78
|
object_=policy,
|
|
83
|
-
annotation=typing.Sequence[
|
|
79
|
+
annotation=typing.Sequence[ClientSideAccessTokensCreateRequestPolicyItem],
|
|
84
80
|
direction="write",
|
|
85
81
|
),
|
|
86
82
|
"hostname": hostname,
|
|
@@ -95,9 +91,9 @@ class ClientSideAccessTokensClient:
|
|
|
95
91
|
try:
|
|
96
92
|
if 200 <= _response.status_code < 300:
|
|
97
93
|
return typing.cast(
|
|
98
|
-
|
|
94
|
+
ClientSideAccessTokensCreateResponse,
|
|
99
95
|
construct_type(
|
|
100
|
-
type_=
|
|
96
|
+
type_=ClientSideAccessTokensCreateResponse, # type: ignore
|
|
101
97
|
object_=_response.json(),
|
|
102
98
|
),
|
|
103
99
|
)
|
|
@@ -116,7 +112,7 @@ class ClientSideAccessTokensClient:
|
|
|
116
112
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
117
113
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
118
114
|
|
|
119
|
-
def
|
|
115
|
+
def delete(
|
|
120
116
|
self,
|
|
121
117
|
token: str,
|
|
122
118
|
*,
|
|
@@ -148,7 +144,7 @@ class ClientSideAccessTokensClient:
|
|
|
148
144
|
client = Letta(
|
|
149
145
|
token="YOUR_TOKEN",
|
|
150
146
|
)
|
|
151
|
-
client.client_side_access_tokens.
|
|
147
|
+
client.client_side_access_tokens.delete(
|
|
152
148
|
token="token",
|
|
153
149
|
request={"key": "value"},
|
|
154
150
|
)
|
|
@@ -189,20 +185,20 @@ class AsyncClientSideAccessTokensClient:
|
|
|
189
185
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
190
186
|
self._client_wrapper = client_wrapper
|
|
191
187
|
|
|
192
|
-
async def
|
|
188
|
+
async def create(
|
|
193
189
|
self,
|
|
194
190
|
*,
|
|
195
|
-
policy: typing.Sequence[
|
|
191
|
+
policy: typing.Sequence[ClientSideAccessTokensCreateRequestPolicyItem],
|
|
196
192
|
hostname: str,
|
|
197
193
|
expires_at: typing.Optional[str] = OMIT,
|
|
198
194
|
request_options: typing.Optional[RequestOptions] = None,
|
|
199
|
-
) ->
|
|
195
|
+
) -> ClientSideAccessTokensCreateResponse:
|
|
200
196
|
"""
|
|
201
197
|
Create a new client side access token with the specified configuration.
|
|
202
198
|
|
|
203
199
|
Parameters
|
|
204
200
|
----------
|
|
205
|
-
policy : typing.Sequence[
|
|
201
|
+
policy : typing.Sequence[ClientSideAccessTokensCreateRequestPolicyItem]
|
|
206
202
|
|
|
207
203
|
hostname : str
|
|
208
204
|
The hostname of the client side application. Please specify the full URL including the protocol (http or https).
|
|
@@ -215,7 +211,7 @@ class AsyncClientSideAccessTokensClient:
|
|
|
215
211
|
|
|
216
212
|
Returns
|
|
217
213
|
-------
|
|
218
|
-
|
|
214
|
+
ClientSideAccessTokensCreateResponse
|
|
219
215
|
201
|
|
220
216
|
|
|
221
217
|
Examples
|
|
@@ -224,7 +220,7 @@ class AsyncClientSideAccessTokensClient:
|
|
|
224
220
|
|
|
225
221
|
from letta_client import AsyncLetta
|
|
226
222
|
from letta_client.client_side_access_tokens import (
|
|
227
|
-
|
|
223
|
+
ClientSideAccessTokensCreateRequestPolicyItem,
|
|
228
224
|
)
|
|
229
225
|
|
|
230
226
|
client = AsyncLetta(
|
|
@@ -233,9 +229,9 @@ class AsyncClientSideAccessTokensClient:
|
|
|
233
229
|
|
|
234
230
|
|
|
235
231
|
async def main() -> None:
|
|
236
|
-
await client.client_side_access_tokens.
|
|
232
|
+
await client.client_side_access_tokens.create(
|
|
237
233
|
policy=[
|
|
238
|
-
|
|
234
|
+
ClientSideAccessTokensCreateRequestPolicyItem(
|
|
239
235
|
id="id",
|
|
240
236
|
access=["read_messages"],
|
|
241
237
|
)
|
|
@@ -252,7 +248,7 @@ class AsyncClientSideAccessTokensClient:
|
|
|
252
248
|
json={
|
|
253
249
|
"policy": convert_and_respect_annotation_metadata(
|
|
254
250
|
object_=policy,
|
|
255
|
-
annotation=typing.Sequence[
|
|
251
|
+
annotation=typing.Sequence[ClientSideAccessTokensCreateRequestPolicyItem],
|
|
256
252
|
direction="write",
|
|
257
253
|
),
|
|
258
254
|
"hostname": hostname,
|
|
@@ -267,9 +263,9 @@ class AsyncClientSideAccessTokensClient:
|
|
|
267
263
|
try:
|
|
268
264
|
if 200 <= _response.status_code < 300:
|
|
269
265
|
return typing.cast(
|
|
270
|
-
|
|
266
|
+
ClientSideAccessTokensCreateResponse,
|
|
271
267
|
construct_type(
|
|
272
|
-
type_=
|
|
268
|
+
type_=ClientSideAccessTokensCreateResponse, # type: ignore
|
|
273
269
|
object_=_response.json(),
|
|
274
270
|
),
|
|
275
271
|
)
|
|
@@ -288,7 +284,7 @@ class AsyncClientSideAccessTokensClient:
|
|
|
288
284
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
289
285
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
290
286
|
|
|
291
|
-
async def
|
|
287
|
+
async def delete(
|
|
292
288
|
self,
|
|
293
289
|
token: str,
|
|
294
290
|
*,
|
|
@@ -325,7 +321,7 @@ class AsyncClientSideAccessTokensClient:
|
|
|
325
321
|
|
|
326
322
|
|
|
327
323
|
async def main() -> None:
|
|
328
|
-
await client.client_side_access_tokens.
|
|
324
|
+
await client.client_side_access_tokens.delete(
|
|
329
325
|
token="token",
|
|
330
326
|
request={"key": "value"},
|
|
331
327
|
)
|
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from .
|
|
4
|
-
|
|
3
|
+
from .client_side_access_tokens_create_request_policy_item import ClientSideAccessTokensCreateRequestPolicyItem
|
|
4
|
+
from .client_side_access_tokens_create_request_policy_item_access_item import (
|
|
5
|
+
ClientSideAccessTokensCreateRequestPolicyItemAccessItem,
|
|
5
6
|
)
|
|
6
|
-
from .
|
|
7
|
-
|
|
7
|
+
from .client_side_access_tokens_create_response import ClientSideAccessTokensCreateResponse
|
|
8
|
+
from .client_side_access_tokens_create_response_policy import ClientSideAccessTokensCreateResponsePolicy
|
|
9
|
+
from .client_side_access_tokens_create_response_policy_data_item import (
|
|
10
|
+
ClientSideAccessTokensCreateResponsePolicyDataItem,
|
|
8
11
|
)
|
|
9
|
-
from .
|
|
10
|
-
|
|
11
|
-
)
|
|
12
|
-
from .client_side_access_tokens_create_client_side_access_token_response_policy import (
|
|
13
|
-
ClientSideAccessTokensCreateClientSideAccessTokenResponsePolicy,
|
|
14
|
-
)
|
|
15
|
-
from .client_side_access_tokens_create_client_side_access_token_response_policy_data_item import (
|
|
16
|
-
ClientSideAccessTokensCreateClientSideAccessTokenResponsePolicyDataItem,
|
|
17
|
-
)
|
|
18
|
-
from .client_side_access_tokens_create_client_side_access_token_response_policy_data_item_access_item import (
|
|
19
|
-
ClientSideAccessTokensCreateClientSideAccessTokenResponsePolicyDataItemAccessItem,
|
|
12
|
+
from .client_side_access_tokens_create_response_policy_data_item_access_item import (
|
|
13
|
+
ClientSideAccessTokensCreateResponsePolicyDataItemAccessItem,
|
|
20
14
|
)
|
|
21
15
|
|
|
22
16
|
__all__ = [
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
17
|
+
"ClientSideAccessTokensCreateRequestPolicyItem",
|
|
18
|
+
"ClientSideAccessTokensCreateRequestPolicyItemAccessItem",
|
|
19
|
+
"ClientSideAccessTokensCreateResponse",
|
|
20
|
+
"ClientSideAccessTokensCreateResponsePolicy",
|
|
21
|
+
"ClientSideAccessTokensCreateResponsePolicyDataItem",
|
|
22
|
+
"ClientSideAccessTokensCreateResponsePolicyDataItemAccessItem",
|
|
29
23
|
]
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
from ...core.unchecked_base_model import UncheckedBaseModel
|
|
4
4
|
import typing
|
|
5
|
-
from .
|
|
6
|
-
|
|
5
|
+
from .client_side_access_tokens_create_request_policy_item_access_item import (
|
|
6
|
+
ClientSideAccessTokensCreateRequestPolicyItemAccessItem,
|
|
7
7
|
)
|
|
8
8
|
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
9
9
|
import pydantic
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
class
|
|
12
|
+
class ClientSideAccessTokensCreateRequestPolicyItem(UncheckedBaseModel):
|
|
13
13
|
type: typing.Literal["agent"] = "agent"
|
|
14
14
|
id: str
|
|
15
|
-
access: typing.List[
|
|
15
|
+
access: typing.List[ClientSideAccessTokensCreateRequestPolicyItemAccessItem]
|
|
16
16
|
|
|
17
17
|
if IS_PYDANTIC_V2:
|
|
18
18
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
ClientSideAccessTokensCreateRequestPolicyItemAccessItem = typing.Union[
|
|
6
6
|
typing.Literal["read_messages", "write_messages", "read_agent", "write_agent"], typing.Any
|
|
7
7
|
]
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from ...core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
-
from .
|
|
5
|
-
ClientSideAccessTokensCreateClientSideAccessTokenResponsePolicy,
|
|
6
|
-
)
|
|
4
|
+
from .client_side_access_tokens_create_response_policy import ClientSideAccessTokensCreateResponsePolicy
|
|
7
5
|
import typing_extensions
|
|
8
6
|
from ...core.serialization import FieldMetadata
|
|
9
7
|
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
@@ -11,8 +9,8 @@ import typing
|
|
|
11
9
|
import pydantic
|
|
12
10
|
|
|
13
11
|
|
|
14
|
-
class
|
|
15
|
-
policy:
|
|
12
|
+
class ClientSideAccessTokensCreateResponse(UncheckedBaseModel):
|
|
13
|
+
policy: ClientSideAccessTokensCreateResponsePolicy
|
|
16
14
|
token: str
|
|
17
15
|
hostname: str
|
|
18
16
|
expires_at: typing_extensions.Annotated[str, FieldMetadata(alias="expiresAt")]
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
from ...core.unchecked_base_model import UncheckedBaseModel
|
|
4
4
|
import typing
|
|
5
|
-
from .
|
|
6
|
-
|
|
5
|
+
from .client_side_access_tokens_create_response_policy_data_item import (
|
|
6
|
+
ClientSideAccessTokensCreateResponsePolicyDataItem,
|
|
7
7
|
)
|
|
8
8
|
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
9
9
|
import pydantic
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
class
|
|
12
|
+
class ClientSideAccessTokensCreateResponsePolicy(UncheckedBaseModel):
|
|
13
13
|
version: typing.Literal["1"] = "1"
|
|
14
|
-
data: typing.List[
|
|
14
|
+
data: typing.List[ClientSideAccessTokensCreateResponsePolicyDataItem]
|
|
15
15
|
|
|
16
16
|
if IS_PYDANTIC_V2:
|
|
17
17
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
from ...core.unchecked_base_model import UncheckedBaseModel
|
|
4
4
|
import typing
|
|
5
|
-
from .
|
|
6
|
-
|
|
5
|
+
from .client_side_access_tokens_create_response_policy_data_item_access_item import (
|
|
6
|
+
ClientSideAccessTokensCreateResponsePolicyDataItemAccessItem,
|
|
7
7
|
)
|
|
8
8
|
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
9
9
|
import pydantic
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
class
|
|
12
|
+
class ClientSideAccessTokensCreateResponsePolicyDataItem(UncheckedBaseModel):
|
|
13
13
|
type: typing.Literal["agent"] = "agent"
|
|
14
14
|
id: str
|
|
15
|
-
access: typing.List[
|
|
15
|
+
access: typing.List[ClientSideAccessTokensCreateResponsePolicyDataItemAccessItem]
|
|
16
16
|
|
|
17
17
|
if IS_PYDANTIC_V2:
|
|
18
18
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
ClientSideAccessTokensCreateResponsePolicyDataItemAccessItem = typing.Union[
|
|
6
6
|
typing.Literal["read_messages", "write_messages", "read_agent", "write_agent"], typing.Any
|
|
7
7
|
]
|
|
@@ -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.
|
|
19
|
+
"X-Fern-SDK-Version": "0.1.123",
|
|
20
20
|
}
|
|
21
21
|
if self.token is not None:
|
|
22
22
|
headers["Authorization"] = f"Bearer {self.token}"
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
4
|
+
import typing
|
|
5
|
+
from ..core.request_options import RequestOptions
|
|
6
|
+
from ..types.embedding_config import EmbeddingConfig
|
|
7
|
+
from ..core.unchecked_base_model import construct_type
|
|
8
|
+
from json.decoder import JSONDecodeError
|
|
9
|
+
from ..core.api_error import ApiError
|
|
10
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class EmbeddingsClient:
|
|
14
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
15
|
+
self._client_wrapper = client_wrapper
|
|
16
|
+
|
|
17
|
+
def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[EmbeddingConfig]:
|
|
18
|
+
"""
|
|
19
|
+
Parameters
|
|
20
|
+
----------
|
|
21
|
+
request_options : typing.Optional[RequestOptions]
|
|
22
|
+
Request-specific configuration.
|
|
23
|
+
|
|
24
|
+
Returns
|
|
25
|
+
-------
|
|
26
|
+
typing.List[EmbeddingConfig]
|
|
27
|
+
Successful Response
|
|
28
|
+
|
|
29
|
+
Examples
|
|
30
|
+
--------
|
|
31
|
+
from letta_client import Letta
|
|
32
|
+
|
|
33
|
+
client = Letta(
|
|
34
|
+
token="YOUR_TOKEN",
|
|
35
|
+
)
|
|
36
|
+
client.embeddings.list()
|
|
37
|
+
"""
|
|
38
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
39
|
+
"v1/models/embedding",
|
|
40
|
+
method="GET",
|
|
41
|
+
request_options=request_options,
|
|
42
|
+
)
|
|
43
|
+
try:
|
|
44
|
+
if 200 <= _response.status_code < 300:
|
|
45
|
+
return typing.cast(
|
|
46
|
+
typing.List[EmbeddingConfig],
|
|
47
|
+
construct_type(
|
|
48
|
+
type_=typing.List[EmbeddingConfig], # type: ignore
|
|
49
|
+
object_=_response.json(),
|
|
50
|
+
),
|
|
51
|
+
)
|
|
52
|
+
_response_json = _response.json()
|
|
53
|
+
except JSONDecodeError:
|
|
54
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
55
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class AsyncEmbeddingsClient:
|
|
59
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
60
|
+
self._client_wrapper = client_wrapper
|
|
61
|
+
|
|
62
|
+
async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[EmbeddingConfig]:
|
|
63
|
+
"""
|
|
64
|
+
Parameters
|
|
65
|
+
----------
|
|
66
|
+
request_options : typing.Optional[RequestOptions]
|
|
67
|
+
Request-specific configuration.
|
|
68
|
+
|
|
69
|
+
Returns
|
|
70
|
+
-------
|
|
71
|
+
typing.List[EmbeddingConfig]
|
|
72
|
+
Successful Response
|
|
73
|
+
|
|
74
|
+
Examples
|
|
75
|
+
--------
|
|
76
|
+
import asyncio
|
|
77
|
+
|
|
78
|
+
from letta_client import AsyncLetta
|
|
79
|
+
|
|
80
|
+
client = AsyncLetta(
|
|
81
|
+
token="YOUR_TOKEN",
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
async def main() -> None:
|
|
86
|
+
await client.embeddings.list()
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
asyncio.run(main())
|
|
90
|
+
"""
|
|
91
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
92
|
+
"v1/models/embedding",
|
|
93
|
+
method="GET",
|
|
94
|
+
request_options=request_options,
|
|
95
|
+
)
|
|
96
|
+
try:
|
|
97
|
+
if 200 <= _response.status_code < 300:
|
|
98
|
+
return typing.cast(
|
|
99
|
+
typing.List[EmbeddingConfig],
|
|
100
|
+
construct_type(
|
|
101
|
+
type_=typing.List[EmbeddingConfig], # type: ignore
|
|
102
|
+
object_=_response.json(),
|
|
103
|
+
),
|
|
104
|
+
)
|
|
105
|
+
_response_json = _response.json()
|
|
106
|
+
except JSONDecodeError:
|
|
107
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
108
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
letta_client/groups/client.py
CHANGED
|
@@ -408,64 +408,6 @@ class GroupsClient:
|
|
|
408
408
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
409
409
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
410
410
|
|
|
411
|
-
def reset_messages(
|
|
412
|
-
self, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
413
|
-
) -> typing.Optional[typing.Any]:
|
|
414
|
-
"""
|
|
415
|
-
Delete the group messages for all agents that are part of the multi-agent group.
|
|
416
|
-
|
|
417
|
-
Parameters
|
|
418
|
-
----------
|
|
419
|
-
group_id : str
|
|
420
|
-
|
|
421
|
-
request_options : typing.Optional[RequestOptions]
|
|
422
|
-
Request-specific configuration.
|
|
423
|
-
|
|
424
|
-
Returns
|
|
425
|
-
-------
|
|
426
|
-
typing.Optional[typing.Any]
|
|
427
|
-
Successful Response
|
|
428
|
-
|
|
429
|
-
Examples
|
|
430
|
-
--------
|
|
431
|
-
from letta_client import Letta
|
|
432
|
-
|
|
433
|
-
client = Letta(
|
|
434
|
-
token="YOUR_TOKEN",
|
|
435
|
-
)
|
|
436
|
-
client.groups.reset_messages(
|
|
437
|
-
group_id="group_id",
|
|
438
|
-
)
|
|
439
|
-
"""
|
|
440
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
441
|
-
f"v1/groups/{jsonable_encoder(group_id)}/reset-messages",
|
|
442
|
-
method="PATCH",
|
|
443
|
-
request_options=request_options,
|
|
444
|
-
)
|
|
445
|
-
try:
|
|
446
|
-
if 200 <= _response.status_code < 300:
|
|
447
|
-
return typing.cast(
|
|
448
|
-
typing.Optional[typing.Any],
|
|
449
|
-
construct_type(
|
|
450
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
451
|
-
object_=_response.json(),
|
|
452
|
-
),
|
|
453
|
-
)
|
|
454
|
-
if _response.status_code == 422:
|
|
455
|
-
raise UnprocessableEntityError(
|
|
456
|
-
typing.cast(
|
|
457
|
-
HttpValidationError,
|
|
458
|
-
construct_type(
|
|
459
|
-
type_=HttpValidationError, # type: ignore
|
|
460
|
-
object_=_response.json(),
|
|
461
|
-
),
|
|
462
|
-
)
|
|
463
|
-
)
|
|
464
|
-
_response_json = _response.json()
|
|
465
|
-
except JSONDecodeError:
|
|
466
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
467
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
468
|
-
|
|
469
411
|
|
|
470
412
|
class AsyncGroupsClient:
|
|
471
413
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -892,69 +834,3 @@ class AsyncGroupsClient:
|
|
|
892
834
|
except JSONDecodeError:
|
|
893
835
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
894
836
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
895
|
-
|
|
896
|
-
async def reset_messages(
|
|
897
|
-
self, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
898
|
-
) -> typing.Optional[typing.Any]:
|
|
899
|
-
"""
|
|
900
|
-
Delete the group messages for all agents that are part of the multi-agent group.
|
|
901
|
-
|
|
902
|
-
Parameters
|
|
903
|
-
----------
|
|
904
|
-
group_id : str
|
|
905
|
-
|
|
906
|
-
request_options : typing.Optional[RequestOptions]
|
|
907
|
-
Request-specific configuration.
|
|
908
|
-
|
|
909
|
-
Returns
|
|
910
|
-
-------
|
|
911
|
-
typing.Optional[typing.Any]
|
|
912
|
-
Successful Response
|
|
913
|
-
|
|
914
|
-
Examples
|
|
915
|
-
--------
|
|
916
|
-
import asyncio
|
|
917
|
-
|
|
918
|
-
from letta_client import AsyncLetta
|
|
919
|
-
|
|
920
|
-
client = AsyncLetta(
|
|
921
|
-
token="YOUR_TOKEN",
|
|
922
|
-
)
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
async def main() -> None:
|
|
926
|
-
await client.groups.reset_messages(
|
|
927
|
-
group_id="group_id",
|
|
928
|
-
)
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
asyncio.run(main())
|
|
932
|
-
"""
|
|
933
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
934
|
-
f"v1/groups/{jsonable_encoder(group_id)}/reset-messages",
|
|
935
|
-
method="PATCH",
|
|
936
|
-
request_options=request_options,
|
|
937
|
-
)
|
|
938
|
-
try:
|
|
939
|
-
if 200 <= _response.status_code < 300:
|
|
940
|
-
return typing.cast(
|
|
941
|
-
typing.Optional[typing.Any],
|
|
942
|
-
construct_type(
|
|
943
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
944
|
-
object_=_response.json(),
|
|
945
|
-
),
|
|
946
|
-
)
|
|
947
|
-
if _response.status_code == 422:
|
|
948
|
-
raise UnprocessableEntityError(
|
|
949
|
-
typing.cast(
|
|
950
|
-
HttpValidationError,
|
|
951
|
-
construct_type(
|
|
952
|
-
type_=HttpValidationError, # type: ignore
|
|
953
|
-
object_=_response.json(),
|
|
954
|
-
),
|
|
955
|
-
)
|
|
956
|
-
)
|
|
957
|
-
_response_json = _response.json()
|
|
958
|
-
except JSONDecodeError:
|
|
959
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
960
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|