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/base_client.py
CHANGED
|
@@ -10,6 +10,7 @@ from .agents.client import AgentsClient
|
|
|
10
10
|
from .groups.client import GroupsClient
|
|
11
11
|
from .identities.client import IdentitiesClient
|
|
12
12
|
from .models.client import ModelsClient
|
|
13
|
+
from .embeddings.client import EmbeddingsClient
|
|
13
14
|
from .blocks.client import BlocksClient
|
|
14
15
|
from .jobs.client import JobsClient
|
|
15
16
|
from .health.client import HealthClient
|
|
@@ -17,11 +18,13 @@ from .providers.client import ProvidersClient
|
|
|
17
18
|
from .runs.client import RunsClient
|
|
18
19
|
from .steps.client import StepsClient
|
|
19
20
|
from .tag.client import TagClient
|
|
21
|
+
from .batches.client import BatchesClient
|
|
20
22
|
from .messages.client import MessagesClient
|
|
21
23
|
from .voice.client import VoiceClient
|
|
22
24
|
from .templates.client import TemplatesClient
|
|
23
25
|
from .client_side_access_tokens.client import ClientSideAccessTokensClient
|
|
24
26
|
from .projects.client import ProjectsClient
|
|
27
|
+
from .tags.client import TagsClient
|
|
25
28
|
from .core.client_wrapper import AsyncClientWrapper
|
|
26
29
|
from .tools.client import AsyncToolsClient
|
|
27
30
|
from .sources.client import AsyncSourcesClient
|
|
@@ -29,6 +32,7 @@ from .agents.client import AsyncAgentsClient
|
|
|
29
32
|
from .groups.client import AsyncGroupsClient
|
|
30
33
|
from .identities.client import AsyncIdentitiesClient
|
|
31
34
|
from .models.client import AsyncModelsClient
|
|
35
|
+
from .embeddings.client import AsyncEmbeddingsClient
|
|
32
36
|
from .blocks.client import AsyncBlocksClient
|
|
33
37
|
from .jobs.client import AsyncJobsClient
|
|
34
38
|
from .health.client import AsyncHealthClient
|
|
@@ -36,11 +40,13 @@ from .providers.client import AsyncProvidersClient
|
|
|
36
40
|
from .runs.client import AsyncRunsClient
|
|
37
41
|
from .steps.client import AsyncStepsClient
|
|
38
42
|
from .tag.client import AsyncTagClient
|
|
43
|
+
from .batches.client import AsyncBatchesClient
|
|
39
44
|
from .messages.client import AsyncMessagesClient
|
|
40
45
|
from .voice.client import AsyncVoiceClient
|
|
41
46
|
from .templates.client import AsyncTemplatesClient
|
|
42
47
|
from .client_side_access_tokens.client import AsyncClientSideAccessTokensClient
|
|
43
48
|
from .projects.client import AsyncProjectsClient
|
|
49
|
+
from .tags.client import AsyncTagsClient
|
|
44
50
|
|
|
45
51
|
|
|
46
52
|
class LettaBase:
|
|
@@ -107,6 +113,7 @@ class LettaBase:
|
|
|
107
113
|
self.groups = GroupsClient(client_wrapper=self._client_wrapper)
|
|
108
114
|
self.identities = IdentitiesClient(client_wrapper=self._client_wrapper)
|
|
109
115
|
self.models = ModelsClient(client_wrapper=self._client_wrapper)
|
|
116
|
+
self.embeddings = EmbeddingsClient(client_wrapper=self._client_wrapper)
|
|
110
117
|
self.blocks = BlocksClient(client_wrapper=self._client_wrapper)
|
|
111
118
|
self.jobs = JobsClient(client_wrapper=self._client_wrapper)
|
|
112
119
|
self.health = HealthClient(client_wrapper=self._client_wrapper)
|
|
@@ -114,11 +121,13 @@ class LettaBase:
|
|
|
114
121
|
self.runs = RunsClient(client_wrapper=self._client_wrapper)
|
|
115
122
|
self.steps = StepsClient(client_wrapper=self._client_wrapper)
|
|
116
123
|
self.tag = TagClient(client_wrapper=self._client_wrapper)
|
|
124
|
+
self.batches = BatchesClient(client_wrapper=self._client_wrapper)
|
|
117
125
|
self.messages = MessagesClient(client_wrapper=self._client_wrapper)
|
|
118
126
|
self.voice = VoiceClient(client_wrapper=self._client_wrapper)
|
|
119
127
|
self.templates = TemplatesClient(client_wrapper=self._client_wrapper)
|
|
120
128
|
self.client_side_access_tokens = ClientSideAccessTokensClient(client_wrapper=self._client_wrapper)
|
|
121
129
|
self.projects = ProjectsClient(client_wrapper=self._client_wrapper)
|
|
130
|
+
self.tags = TagsClient(client_wrapper=self._client_wrapper)
|
|
122
131
|
|
|
123
132
|
|
|
124
133
|
class AsyncLettaBase:
|
|
@@ -185,6 +194,7 @@ class AsyncLettaBase:
|
|
|
185
194
|
self.groups = AsyncGroupsClient(client_wrapper=self._client_wrapper)
|
|
186
195
|
self.identities = AsyncIdentitiesClient(client_wrapper=self._client_wrapper)
|
|
187
196
|
self.models = AsyncModelsClient(client_wrapper=self._client_wrapper)
|
|
197
|
+
self.embeddings = AsyncEmbeddingsClient(client_wrapper=self._client_wrapper)
|
|
188
198
|
self.blocks = AsyncBlocksClient(client_wrapper=self._client_wrapper)
|
|
189
199
|
self.jobs = AsyncJobsClient(client_wrapper=self._client_wrapper)
|
|
190
200
|
self.health = AsyncHealthClient(client_wrapper=self._client_wrapper)
|
|
@@ -192,11 +202,13 @@ class AsyncLettaBase:
|
|
|
192
202
|
self.runs = AsyncRunsClient(client_wrapper=self._client_wrapper)
|
|
193
203
|
self.steps = AsyncStepsClient(client_wrapper=self._client_wrapper)
|
|
194
204
|
self.tag = AsyncTagClient(client_wrapper=self._client_wrapper)
|
|
205
|
+
self.batches = AsyncBatchesClient(client_wrapper=self._client_wrapper)
|
|
195
206
|
self.messages = AsyncMessagesClient(client_wrapper=self._client_wrapper)
|
|
196
207
|
self.voice = AsyncVoiceClient(client_wrapper=self._client_wrapper)
|
|
197
208
|
self.templates = AsyncTemplatesClient(client_wrapper=self._client_wrapper)
|
|
198
209
|
self.client_side_access_tokens = AsyncClientSideAccessTokensClient(client_wrapper=self._client_wrapper)
|
|
199
210
|
self.projects = AsyncProjectsClient(client_wrapper=self._client_wrapper)
|
|
211
|
+
self.tags = AsyncTagsClient(client_wrapper=self._client_wrapper)
|
|
200
212
|
|
|
201
213
|
|
|
202
214
|
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: LettaEnvironment) -> str:
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
4
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from ..core.request_options import RequestOptions
|
|
6
|
+
from ..types.batch_job import BatchJob
|
|
7
|
+
from ..core.unchecked_base_model import construct_type
|
|
8
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
9
|
+
from ..types.http_validation_error import HttpValidationError
|
|
10
10
|
from json.decoder import JSONDecodeError
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
11
|
+
from ..core.api_error import ApiError
|
|
12
|
+
from ..types.letta_batch_request import LettaBatchRequest
|
|
13
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
14
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
15
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
16
16
|
|
|
17
17
|
# this is used as the default value for optional parameters
|
|
18
18
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -43,7 +43,7 @@ class BatchesClient:
|
|
|
43
43
|
client = Letta(
|
|
44
44
|
token="YOUR_TOKEN",
|
|
45
45
|
)
|
|
46
|
-
client.
|
|
46
|
+
client.batches.list()
|
|
47
47
|
"""
|
|
48
48
|
_response = self._client_wrapper.httpx_client.request(
|
|
49
49
|
"v1/messages/batches",
|
|
@@ -108,7 +108,7 @@ class BatchesClient:
|
|
|
108
108
|
client = Letta(
|
|
109
109
|
token="YOUR_TOKEN",
|
|
110
110
|
)
|
|
111
|
-
client.
|
|
111
|
+
client.batches.create(
|
|
112
112
|
requests=[
|
|
113
113
|
LettaBatchRequest(
|
|
114
114
|
messages=[
|
|
@@ -188,7 +188,7 @@ class BatchesClient:
|
|
|
188
188
|
client = Letta(
|
|
189
189
|
token="YOUR_TOKEN",
|
|
190
190
|
)
|
|
191
|
-
client.
|
|
191
|
+
client.batches.retrieve(
|
|
192
192
|
batch_id="batch_id",
|
|
193
193
|
)
|
|
194
194
|
"""
|
|
@@ -241,7 +241,7 @@ class BatchesClient:
|
|
|
241
241
|
client = Letta(
|
|
242
242
|
token="YOUR_TOKEN",
|
|
243
243
|
)
|
|
244
|
-
client.
|
|
244
|
+
client.batches.cancel(
|
|
245
245
|
batch_id="batch_id",
|
|
246
246
|
)
|
|
247
247
|
"""
|
|
@@ -289,7 +289,7 @@ class AsyncBatchesClient:
|
|
|
289
289
|
|
|
290
290
|
|
|
291
291
|
async def main() -> None:
|
|
292
|
-
await client.
|
|
292
|
+
await client.batches.list()
|
|
293
293
|
|
|
294
294
|
|
|
295
295
|
asyncio.run(main())
|
|
@@ -367,7 +367,7 @@ class AsyncBatchesClient:
|
|
|
367
367
|
|
|
368
368
|
|
|
369
369
|
async def main() -> None:
|
|
370
|
-
await client.
|
|
370
|
+
await client.batches.create(
|
|
371
371
|
requests=[
|
|
372
372
|
LettaBatchRequest(
|
|
373
373
|
messages=[
|
|
@@ -455,7 +455,7 @@ class AsyncBatchesClient:
|
|
|
455
455
|
|
|
456
456
|
|
|
457
457
|
async def main() -> None:
|
|
458
|
-
await client.
|
|
458
|
+
await client.batches.retrieve(
|
|
459
459
|
batch_id="batch_id",
|
|
460
460
|
)
|
|
461
461
|
|
|
@@ -516,7 +516,7 @@ class AsyncBatchesClient:
|
|
|
516
516
|
|
|
517
517
|
|
|
518
518
|
async def main() -> None:
|
|
519
|
-
await client.
|
|
519
|
+
await client.batches.cancel(
|
|
520
520
|
batch_id="batch_id",
|
|
521
521
|
)
|
|
522
522
|
|
letta_client/blocks/__init__.py
CHANGED
|
@@ -0,0 +1,149 @@
|
|
|
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.agent_state import AgentState
|
|
7
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
8
|
+
from ...core.unchecked_base_model import construct_type
|
|
9
|
+
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
10
|
+
from ...types.http_validation_error import HttpValidationError
|
|
11
|
+
from json.decoder import JSONDecodeError
|
|
12
|
+
from ...core.api_error import ApiError
|
|
13
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class AgentsClient:
|
|
17
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
18
|
+
self._client_wrapper = client_wrapper
|
|
19
|
+
|
|
20
|
+
def list(
|
|
21
|
+
self, block_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
22
|
+
) -> typing.List[AgentState]:
|
|
23
|
+
"""
|
|
24
|
+
Retrieves all agents associated with the specified block.
|
|
25
|
+
Raises a 404 if the block does not exist.
|
|
26
|
+
|
|
27
|
+
Parameters
|
|
28
|
+
----------
|
|
29
|
+
block_id : str
|
|
30
|
+
|
|
31
|
+
request_options : typing.Optional[RequestOptions]
|
|
32
|
+
Request-specific configuration.
|
|
33
|
+
|
|
34
|
+
Returns
|
|
35
|
+
-------
|
|
36
|
+
typing.List[AgentState]
|
|
37
|
+
Successful Response
|
|
38
|
+
|
|
39
|
+
Examples
|
|
40
|
+
--------
|
|
41
|
+
from letta_client import Letta
|
|
42
|
+
|
|
43
|
+
client = Letta(
|
|
44
|
+
token="YOUR_TOKEN",
|
|
45
|
+
)
|
|
46
|
+
client.blocks.agents.list(
|
|
47
|
+
block_id="block_id",
|
|
48
|
+
)
|
|
49
|
+
"""
|
|
50
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
51
|
+
f"v1/blocks/{jsonable_encoder(block_id)}/agents",
|
|
52
|
+
method="GET",
|
|
53
|
+
request_options=request_options,
|
|
54
|
+
)
|
|
55
|
+
try:
|
|
56
|
+
if 200 <= _response.status_code < 300:
|
|
57
|
+
return typing.cast(
|
|
58
|
+
typing.List[AgentState],
|
|
59
|
+
construct_type(
|
|
60
|
+
type_=typing.List[AgentState], # type: ignore
|
|
61
|
+
object_=_response.json(),
|
|
62
|
+
),
|
|
63
|
+
)
|
|
64
|
+
if _response.status_code == 422:
|
|
65
|
+
raise UnprocessableEntityError(
|
|
66
|
+
typing.cast(
|
|
67
|
+
HttpValidationError,
|
|
68
|
+
construct_type(
|
|
69
|
+
type_=HttpValidationError, # type: ignore
|
|
70
|
+
object_=_response.json(),
|
|
71
|
+
),
|
|
72
|
+
)
|
|
73
|
+
)
|
|
74
|
+
_response_json = _response.json()
|
|
75
|
+
except JSONDecodeError:
|
|
76
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
77
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class AsyncAgentsClient:
|
|
81
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
82
|
+
self._client_wrapper = client_wrapper
|
|
83
|
+
|
|
84
|
+
async def list(
|
|
85
|
+
self, block_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
86
|
+
) -> typing.List[AgentState]:
|
|
87
|
+
"""
|
|
88
|
+
Retrieves all agents associated with the specified block.
|
|
89
|
+
Raises a 404 if the block does not exist.
|
|
90
|
+
|
|
91
|
+
Parameters
|
|
92
|
+
----------
|
|
93
|
+
block_id : str
|
|
94
|
+
|
|
95
|
+
request_options : typing.Optional[RequestOptions]
|
|
96
|
+
Request-specific configuration.
|
|
97
|
+
|
|
98
|
+
Returns
|
|
99
|
+
-------
|
|
100
|
+
typing.List[AgentState]
|
|
101
|
+
Successful Response
|
|
102
|
+
|
|
103
|
+
Examples
|
|
104
|
+
--------
|
|
105
|
+
import asyncio
|
|
106
|
+
|
|
107
|
+
from letta_client import AsyncLetta
|
|
108
|
+
|
|
109
|
+
client = AsyncLetta(
|
|
110
|
+
token="YOUR_TOKEN",
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
async def main() -> None:
|
|
115
|
+
await client.blocks.agents.list(
|
|
116
|
+
block_id="block_id",
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
asyncio.run(main())
|
|
121
|
+
"""
|
|
122
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
123
|
+
f"v1/blocks/{jsonable_encoder(block_id)}/agents",
|
|
124
|
+
method="GET",
|
|
125
|
+
request_options=request_options,
|
|
126
|
+
)
|
|
127
|
+
try:
|
|
128
|
+
if 200 <= _response.status_code < 300:
|
|
129
|
+
return typing.cast(
|
|
130
|
+
typing.List[AgentState],
|
|
131
|
+
construct_type(
|
|
132
|
+
type_=typing.List[AgentState], # type: ignore
|
|
133
|
+
object_=_response.json(),
|
|
134
|
+
),
|
|
135
|
+
)
|
|
136
|
+
if _response.status_code == 422:
|
|
137
|
+
raise UnprocessableEntityError(
|
|
138
|
+
typing.cast(
|
|
139
|
+
HttpValidationError,
|
|
140
|
+
construct_type(
|
|
141
|
+
type_=HttpValidationError, # type: ignore
|
|
142
|
+
object_=_response.json(),
|
|
143
|
+
),
|
|
144
|
+
)
|
|
145
|
+
)
|
|
146
|
+
_response_json = _response.json()
|
|
147
|
+
except JSONDecodeError:
|
|
148
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
149
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
letta_client/blocks/client.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
4
|
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from .agents.client import AgentsClient
|
|
5
6
|
from ..core.request_options import RequestOptions
|
|
6
7
|
from ..types.block import Block
|
|
7
8
|
from ..core.unchecked_base_model import construct_type
|
|
@@ -10,8 +11,8 @@ from ..types.http_validation_error import HttpValidationError
|
|
|
10
11
|
from json.decoder import JSONDecodeError
|
|
11
12
|
from ..core.api_error import ApiError
|
|
12
13
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
13
|
-
from ..types.agent_state import AgentState
|
|
14
14
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
15
|
+
from .agents.client import AsyncAgentsClient
|
|
15
16
|
|
|
16
17
|
# this is used as the default value for optional parameters
|
|
17
18
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -20,6 +21,7 @@ OMIT = typing.cast(typing.Any, ...)
|
|
|
20
21
|
class BlocksClient:
|
|
21
22
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
22
23
|
self._client_wrapper = client_wrapper
|
|
24
|
+
self.agents = AgentsClient(client_wrapper=self._client_wrapper)
|
|
23
25
|
|
|
24
26
|
def list(
|
|
25
27
|
self,
|
|
@@ -401,69 +403,11 @@ class BlocksClient:
|
|
|
401
403
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
402
404
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
403
405
|
|
|
404
|
-
def list_agents_for_block(
|
|
405
|
-
self, block_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
406
|
-
) -> typing.List[AgentState]:
|
|
407
|
-
"""
|
|
408
|
-
Retrieves all agents associated with the specified block.
|
|
409
|
-
Raises a 404 if the block does not exist.
|
|
410
|
-
|
|
411
|
-
Parameters
|
|
412
|
-
----------
|
|
413
|
-
block_id : str
|
|
414
|
-
|
|
415
|
-
request_options : typing.Optional[RequestOptions]
|
|
416
|
-
Request-specific configuration.
|
|
417
|
-
|
|
418
|
-
Returns
|
|
419
|
-
-------
|
|
420
|
-
typing.List[AgentState]
|
|
421
|
-
Successful Response
|
|
422
|
-
|
|
423
|
-
Examples
|
|
424
|
-
--------
|
|
425
|
-
from letta_client import Letta
|
|
426
|
-
|
|
427
|
-
client = Letta(
|
|
428
|
-
token="YOUR_TOKEN",
|
|
429
|
-
)
|
|
430
|
-
client.blocks.list_agents_for_block(
|
|
431
|
-
block_id="block_id",
|
|
432
|
-
)
|
|
433
|
-
"""
|
|
434
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
435
|
-
f"v1/blocks/{jsonable_encoder(block_id)}/agents",
|
|
436
|
-
method="GET",
|
|
437
|
-
request_options=request_options,
|
|
438
|
-
)
|
|
439
|
-
try:
|
|
440
|
-
if 200 <= _response.status_code < 300:
|
|
441
|
-
return typing.cast(
|
|
442
|
-
typing.List[AgentState],
|
|
443
|
-
construct_type(
|
|
444
|
-
type_=typing.List[AgentState], # type: ignore
|
|
445
|
-
object_=_response.json(),
|
|
446
|
-
),
|
|
447
|
-
)
|
|
448
|
-
if _response.status_code == 422:
|
|
449
|
-
raise UnprocessableEntityError(
|
|
450
|
-
typing.cast(
|
|
451
|
-
HttpValidationError,
|
|
452
|
-
construct_type(
|
|
453
|
-
type_=HttpValidationError, # type: ignore
|
|
454
|
-
object_=_response.json(),
|
|
455
|
-
),
|
|
456
|
-
)
|
|
457
|
-
)
|
|
458
|
-
_response_json = _response.json()
|
|
459
|
-
except JSONDecodeError:
|
|
460
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
461
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
462
|
-
|
|
463
406
|
|
|
464
407
|
class AsyncBlocksClient:
|
|
465
408
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
466
409
|
self._client_wrapper = client_wrapper
|
|
410
|
+
self.agents = AsyncAgentsClient(client_wrapper=self._client_wrapper)
|
|
467
411
|
|
|
468
412
|
async def list(
|
|
469
413
|
self,
|
|
@@ -884,70 +828,3 @@ class AsyncBlocksClient:
|
|
|
884
828
|
except JSONDecodeError:
|
|
885
829
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
886
830
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
887
|
-
|
|
888
|
-
async def list_agents_for_block(
|
|
889
|
-
self, block_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
890
|
-
) -> typing.List[AgentState]:
|
|
891
|
-
"""
|
|
892
|
-
Retrieves all agents associated with the specified block.
|
|
893
|
-
Raises a 404 if the block does not exist.
|
|
894
|
-
|
|
895
|
-
Parameters
|
|
896
|
-
----------
|
|
897
|
-
block_id : str
|
|
898
|
-
|
|
899
|
-
request_options : typing.Optional[RequestOptions]
|
|
900
|
-
Request-specific configuration.
|
|
901
|
-
|
|
902
|
-
Returns
|
|
903
|
-
-------
|
|
904
|
-
typing.List[AgentState]
|
|
905
|
-
Successful Response
|
|
906
|
-
|
|
907
|
-
Examples
|
|
908
|
-
--------
|
|
909
|
-
import asyncio
|
|
910
|
-
|
|
911
|
-
from letta_client import AsyncLetta
|
|
912
|
-
|
|
913
|
-
client = AsyncLetta(
|
|
914
|
-
token="YOUR_TOKEN",
|
|
915
|
-
)
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
async def main() -> None:
|
|
919
|
-
await client.blocks.list_agents_for_block(
|
|
920
|
-
block_id="block_id",
|
|
921
|
-
)
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
asyncio.run(main())
|
|
925
|
-
"""
|
|
926
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
927
|
-
f"v1/blocks/{jsonable_encoder(block_id)}/agents",
|
|
928
|
-
method="GET",
|
|
929
|
-
request_options=request_options,
|
|
930
|
-
)
|
|
931
|
-
try:
|
|
932
|
-
if 200 <= _response.status_code < 300:
|
|
933
|
-
return typing.cast(
|
|
934
|
-
typing.List[AgentState],
|
|
935
|
-
construct_type(
|
|
936
|
-
type_=typing.List[AgentState], # type: ignore
|
|
937
|
-
object_=_response.json(),
|
|
938
|
-
),
|
|
939
|
-
)
|
|
940
|
-
if _response.status_code == 422:
|
|
941
|
-
raise UnprocessableEntityError(
|
|
942
|
-
typing.cast(
|
|
943
|
-
HttpValidationError,
|
|
944
|
-
construct_type(
|
|
945
|
-
type_=HttpValidationError, # type: ignore
|
|
946
|
-
object_=_response.json(),
|
|
947
|
-
),
|
|
948
|
-
)
|
|
949
|
-
)
|
|
950
|
-
_response_json = _response.json()
|
|
951
|
-
except JSONDecodeError:
|
|
952
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
953
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -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.122",
|
|
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)
|