letta-client 0.1.17__py3-none-any.whl → 0.1.21__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 +44 -116
- letta_client/agents/__init__.py +18 -42
- letta_client/agents/archival_memory/client.py +6 -6
- letta_client/agents/client.py +28 -18
- letta_client/agents/context/client.py +6 -4
- letta_client/agents/core_memory/client.py +152 -227
- letta_client/agents/memory_variables/__init__.py +2 -2
- letta_client/agents/memory_variables/client.py +15 -15
- letta_client/agents/memory_variables/types/__init__.py +2 -2
- letta_client/agents/memory_variables/types/{memory_variables_get_response.py → memory_variables_list_response.py} +1 -1
- letta_client/agents/messages/__init__.py +2 -22
- letta_client/agents/messages/client.py +39 -40
- letta_client/agents/messages/types/__init__.py +3 -21
- letta_client/agents/messages/types/letta_streaming_response.py +16 -139
- letta_client/agents/messages/types/message_update_content.py +6 -0
- letta_client/agents/messages/types/messages_list_response.py +2 -2
- letta_client/agents/sources/client.py +266 -5
- letta_client/agents/tools/client.py +25 -27
- letta_client/agents/types/__init__.py +15 -25
- letta_client/agents/types/agents_search_request_search_item.py +10 -78
- letta_client/agents/types/{agents_search_request_search_item_order_by.py → agents_search_request_search_item_direction.py} +7 -6
- letta_client/agents/types/agents_search_request_search_item_direction_direction.py +5 -0
- letta_client/agents/types/agents_search_request_search_item_direction_value.py +5 -0
- letta_client/agents/types/{agents_search_request_search_item_name.py → agents_search_request_search_item_one.py} +5 -4
- letta_client/agents/types/agents_search_request_search_item_one_operator.py +5 -0
- letta_client/agents/types/{agents_search_request_search_item_tags.py → agents_search_request_search_item_two.py} +2 -1
- letta_client/agents/types/{agents_search_request_search_item_version.py → agents_search_request_search_item_zero.py} +3 -2
- letta_client/blocks/client.py +45 -166
- letta_client/client.py +3 -3
- letta_client/core/client_wrapper.py +1 -1
- letta_client/jobs/client.py +4 -4
- letta_client/providers/client.py +10 -10
- letta_client/runs/client.py +44 -30
- letta_client/sources/client.py +12 -288
- letta_client/sources/files/client.py +6 -6
- letta_client/tag/client.py +6 -6
- letta_client/tools/client.py +69 -75
- letta_client/types/__init__.py +31 -99
- letta_client/types/agent_state.py +3 -7
- letta_client/types/{letta_schemas_openai_chat_completion_response_tool_call.py → assistant_message.py} +6 -4
- letta_client/types/assistant_message_content.py +6 -0
- letta_client/types/block.py +2 -6
- letta_client/types/block_update.py +1 -5
- letta_client/types/{assistant_message_output.py → chat_completion_message_tool_call.py} +5 -5
- letta_client/types/context_window_overview.py +4 -6
- letta_client/types/create_block.py +1 -5
- letta_client/types/{function_call_output.py → function.py} +1 -1
- letta_client/types/{function_schema.py → function_definition.py} +2 -1
- letta_client/types/{function_call_input.py → function_tool.py} +5 -3
- letta_client/types/job.py +1 -5
- letta_client/types/letta_message_union.py +9 -121
- letta_client/types/letta_usage_statistics.py +1 -0
- letta_client/types/llm_config.py +6 -0
- letta_client/types/{letta_schemas_message_message.py → message.py} +7 -8
- letta_client/types/message_create.py +3 -2
- letta_client/types/message_create_content.py +6 -0
- letta_client/types/passage.py +1 -5
- letta_client/types/reasoning_message.py +2 -1
- letta_client/types/run.py +1 -5
- letta_client/types/source.py +2 -6
- letta_client/types/{system_message_output.py → system_message.py} +6 -4
- letta_client/types/system_message_content.py +6 -0
- letta_client/types/{create_assistant_file_request.py → text_content.py} +5 -4
- letta_client/types/{letta_schemas_tool_tool.py → tool.py} +1 -1
- letta_client/types/{letta_schemas_letta_message_tool_call.py → tool_call.py} +1 -1
- letta_client/types/tool_call_message.py +2 -1
- letta_client/types/tool_call_message_tool_call.py +2 -2
- letta_client/types/tool_return_message.py +2 -1
- letta_client/types/tool_type.py +2 -1
- letta_client/types/{user_message_output.py → user_message.py} +6 -4
- letta_client/types/user_message_content.py +6 -0
- {letta_client-0.1.17.dist-info → letta_client-0.1.21.dist-info}/METADATA +2 -2
- {letta_client-0.1.17.dist-info → letta_client-0.1.21.dist-info}/RECORD +74 -99
- letta_client/agents/types/agents_search_request_search_item_name_operator.py +0 -5
- letta_client/agents/types/agents_search_request_search_item_order_by_direction.py +0 -5
- letta_client/agents/types/agents_search_request_search_item_order_by_value.py +0 -5
- letta_client/types/assistant_file.py +0 -33
- letta_client/types/assistant_message_input.py +0 -23
- letta_client/types/chat_completion_request.py +0 -49
- letta_client/types/chat_completion_request_function_call.py +0 -6
- letta_client/types/chat_completion_request_messages_item.py +0 -11
- letta_client/types/chat_completion_request_stop.py +0 -5
- letta_client/types/chat_completion_request_tool_choice.py +0 -8
- letta_client/types/chat_completion_response.py +0 -32
- letta_client/types/choice.py +0 -25
- letta_client/types/create_assistant_request.py +0 -57
- letta_client/types/delete_assistant_file_response.py +0 -28
- letta_client/types/delete_assistant_response.py +0 -28
- letta_client/types/letta_schemas_openai_chat_completion_request_tool.py +0 -21
- letta_client/types/letta_schemas_openai_chat_completion_request_tool_call.py +0 -24
- letta_client/types/letta_schemas_openai_chat_completion_request_tool_call_function.py +0 -20
- letta_client/types/letta_schemas_openai_chat_completion_response_message.py +0 -24
- letta_client/types/letta_schemas_openai_chat_completions_tool_call_function.py +0 -27
- letta_client/types/letta_schemas_openai_chat_completions_tool_call_input.py +0 -29
- letta_client/types/letta_schemas_openai_chat_completions_tool_call_output.py +0 -29
- letta_client/types/log_prob_token.py +0 -21
- letta_client/types/message_content_log_prob.py +0 -23
- letta_client/types/open_ai_assistant.py +0 -67
- letta_client/types/response_format.py +0 -19
- letta_client/types/system_message_input.py +0 -21
- letta_client/types/tool_call_function_output.py +0 -27
- letta_client/types/tool_function_choice.py +0 -21
- letta_client/types/tool_input.py +0 -21
- letta_client/types/tool_message.py +0 -21
- letta_client/types/user_message_input.py +0 -22
- letta_client/types/user_message_input_content.py +0 -5
- {letta_client-0.1.17.dist-info → letta_client-0.1.21.dist-info}/WHEEL +0 -0
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
from ...core.client_wrapper import SyncClientWrapper
|
|
4
4
|
import typing
|
|
5
5
|
from ...core.request_options import RequestOptions
|
|
6
|
-
from ...types.
|
|
6
|
+
from ...types.agent_state import AgentState
|
|
7
7
|
from ...core.jsonable_encoder import jsonable_encoder
|
|
8
8
|
from ...core.unchecked_base_model import construct_type
|
|
9
9
|
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
10
10
|
from ...types.http_validation_error import HttpValidationError
|
|
11
11
|
from json.decoder import JSONDecodeError
|
|
12
12
|
from ...core.api_error import ApiError
|
|
13
|
+
from ...types.source import Source
|
|
13
14
|
from ...core.client_wrapper import AsyncClientWrapper
|
|
14
15
|
|
|
15
16
|
|
|
@@ -17,7 +18,129 @@ class SourcesClient:
|
|
|
17
18
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
18
19
|
self._client_wrapper = client_wrapper
|
|
19
20
|
|
|
20
|
-
def
|
|
21
|
+
def attach(
|
|
22
|
+
self, agent_id: str, source_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
23
|
+
) -> AgentState:
|
|
24
|
+
"""
|
|
25
|
+
Attach a source to an agent.
|
|
26
|
+
|
|
27
|
+
Parameters
|
|
28
|
+
----------
|
|
29
|
+
agent_id : str
|
|
30
|
+
|
|
31
|
+
source_id : str
|
|
32
|
+
|
|
33
|
+
request_options : typing.Optional[RequestOptions]
|
|
34
|
+
Request-specific configuration.
|
|
35
|
+
|
|
36
|
+
Returns
|
|
37
|
+
-------
|
|
38
|
+
AgentState
|
|
39
|
+
Successful Response
|
|
40
|
+
|
|
41
|
+
Examples
|
|
42
|
+
--------
|
|
43
|
+
from letta_client import Letta
|
|
44
|
+
|
|
45
|
+
client = Letta(
|
|
46
|
+
token="YOUR_TOKEN",
|
|
47
|
+
)
|
|
48
|
+
client.agents.sources.attach(
|
|
49
|
+
agent_id="agent_id",
|
|
50
|
+
source_id="source_id",
|
|
51
|
+
)
|
|
52
|
+
"""
|
|
53
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
54
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/sources/attach/{jsonable_encoder(source_id)}",
|
|
55
|
+
method="PATCH",
|
|
56
|
+
request_options=request_options,
|
|
57
|
+
)
|
|
58
|
+
try:
|
|
59
|
+
if 200 <= _response.status_code < 300:
|
|
60
|
+
return typing.cast(
|
|
61
|
+
AgentState,
|
|
62
|
+
construct_type(
|
|
63
|
+
type_=AgentState, # type: ignore
|
|
64
|
+
object_=_response.json(),
|
|
65
|
+
),
|
|
66
|
+
)
|
|
67
|
+
if _response.status_code == 422:
|
|
68
|
+
raise UnprocessableEntityError(
|
|
69
|
+
typing.cast(
|
|
70
|
+
HttpValidationError,
|
|
71
|
+
construct_type(
|
|
72
|
+
type_=HttpValidationError, # type: ignore
|
|
73
|
+
object_=_response.json(),
|
|
74
|
+
),
|
|
75
|
+
)
|
|
76
|
+
)
|
|
77
|
+
_response_json = _response.json()
|
|
78
|
+
except JSONDecodeError:
|
|
79
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
80
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
81
|
+
|
|
82
|
+
def detach(
|
|
83
|
+
self, agent_id: str, source_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
84
|
+
) -> AgentState:
|
|
85
|
+
"""
|
|
86
|
+
Detach a source from an agent.
|
|
87
|
+
|
|
88
|
+
Parameters
|
|
89
|
+
----------
|
|
90
|
+
agent_id : str
|
|
91
|
+
|
|
92
|
+
source_id : str
|
|
93
|
+
|
|
94
|
+
request_options : typing.Optional[RequestOptions]
|
|
95
|
+
Request-specific configuration.
|
|
96
|
+
|
|
97
|
+
Returns
|
|
98
|
+
-------
|
|
99
|
+
AgentState
|
|
100
|
+
Successful Response
|
|
101
|
+
|
|
102
|
+
Examples
|
|
103
|
+
--------
|
|
104
|
+
from letta_client import Letta
|
|
105
|
+
|
|
106
|
+
client = Letta(
|
|
107
|
+
token="YOUR_TOKEN",
|
|
108
|
+
)
|
|
109
|
+
client.agents.sources.detach(
|
|
110
|
+
agent_id="agent_id",
|
|
111
|
+
source_id="source_id",
|
|
112
|
+
)
|
|
113
|
+
"""
|
|
114
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
115
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/sources/detach/{jsonable_encoder(source_id)}",
|
|
116
|
+
method="PATCH",
|
|
117
|
+
request_options=request_options,
|
|
118
|
+
)
|
|
119
|
+
try:
|
|
120
|
+
if 200 <= _response.status_code < 300:
|
|
121
|
+
return typing.cast(
|
|
122
|
+
AgentState,
|
|
123
|
+
construct_type(
|
|
124
|
+
type_=AgentState, # type: ignore
|
|
125
|
+
object_=_response.json(),
|
|
126
|
+
),
|
|
127
|
+
)
|
|
128
|
+
if _response.status_code == 422:
|
|
129
|
+
raise UnprocessableEntityError(
|
|
130
|
+
typing.cast(
|
|
131
|
+
HttpValidationError,
|
|
132
|
+
construct_type(
|
|
133
|
+
type_=HttpValidationError, # type: ignore
|
|
134
|
+
object_=_response.json(),
|
|
135
|
+
),
|
|
136
|
+
)
|
|
137
|
+
)
|
|
138
|
+
_response_json = _response.json()
|
|
139
|
+
except JSONDecodeError:
|
|
140
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
141
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
142
|
+
|
|
143
|
+
def list(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Source]:
|
|
21
144
|
"""
|
|
22
145
|
Get the sources associated with an agent.
|
|
23
146
|
|
|
@@ -40,7 +163,7 @@ class SourcesClient:
|
|
|
40
163
|
client = Letta(
|
|
41
164
|
token="YOUR_TOKEN",
|
|
42
165
|
)
|
|
43
|
-
client.agents.sources.
|
|
166
|
+
client.agents.sources.list(
|
|
44
167
|
agent_id="agent_id",
|
|
45
168
|
)
|
|
46
169
|
"""
|
|
@@ -78,7 +201,145 @@ class AsyncSourcesClient:
|
|
|
78
201
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
79
202
|
self._client_wrapper = client_wrapper
|
|
80
203
|
|
|
81
|
-
async def
|
|
204
|
+
async def attach(
|
|
205
|
+
self, agent_id: str, source_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
206
|
+
) -> AgentState:
|
|
207
|
+
"""
|
|
208
|
+
Attach a source to an agent.
|
|
209
|
+
|
|
210
|
+
Parameters
|
|
211
|
+
----------
|
|
212
|
+
agent_id : str
|
|
213
|
+
|
|
214
|
+
source_id : str
|
|
215
|
+
|
|
216
|
+
request_options : typing.Optional[RequestOptions]
|
|
217
|
+
Request-specific configuration.
|
|
218
|
+
|
|
219
|
+
Returns
|
|
220
|
+
-------
|
|
221
|
+
AgentState
|
|
222
|
+
Successful Response
|
|
223
|
+
|
|
224
|
+
Examples
|
|
225
|
+
--------
|
|
226
|
+
import asyncio
|
|
227
|
+
|
|
228
|
+
from letta_client import AsyncLetta
|
|
229
|
+
|
|
230
|
+
client = AsyncLetta(
|
|
231
|
+
token="YOUR_TOKEN",
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
async def main() -> None:
|
|
236
|
+
await client.agents.sources.attach(
|
|
237
|
+
agent_id="agent_id",
|
|
238
|
+
source_id="source_id",
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
asyncio.run(main())
|
|
243
|
+
"""
|
|
244
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
245
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/sources/attach/{jsonable_encoder(source_id)}",
|
|
246
|
+
method="PATCH",
|
|
247
|
+
request_options=request_options,
|
|
248
|
+
)
|
|
249
|
+
try:
|
|
250
|
+
if 200 <= _response.status_code < 300:
|
|
251
|
+
return typing.cast(
|
|
252
|
+
AgentState,
|
|
253
|
+
construct_type(
|
|
254
|
+
type_=AgentState, # type: ignore
|
|
255
|
+
object_=_response.json(),
|
|
256
|
+
),
|
|
257
|
+
)
|
|
258
|
+
if _response.status_code == 422:
|
|
259
|
+
raise UnprocessableEntityError(
|
|
260
|
+
typing.cast(
|
|
261
|
+
HttpValidationError,
|
|
262
|
+
construct_type(
|
|
263
|
+
type_=HttpValidationError, # type: ignore
|
|
264
|
+
object_=_response.json(),
|
|
265
|
+
),
|
|
266
|
+
)
|
|
267
|
+
)
|
|
268
|
+
_response_json = _response.json()
|
|
269
|
+
except JSONDecodeError:
|
|
270
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
271
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
272
|
+
|
|
273
|
+
async def detach(
|
|
274
|
+
self, agent_id: str, source_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
275
|
+
) -> AgentState:
|
|
276
|
+
"""
|
|
277
|
+
Detach a source from an agent.
|
|
278
|
+
|
|
279
|
+
Parameters
|
|
280
|
+
----------
|
|
281
|
+
agent_id : str
|
|
282
|
+
|
|
283
|
+
source_id : str
|
|
284
|
+
|
|
285
|
+
request_options : typing.Optional[RequestOptions]
|
|
286
|
+
Request-specific configuration.
|
|
287
|
+
|
|
288
|
+
Returns
|
|
289
|
+
-------
|
|
290
|
+
AgentState
|
|
291
|
+
Successful Response
|
|
292
|
+
|
|
293
|
+
Examples
|
|
294
|
+
--------
|
|
295
|
+
import asyncio
|
|
296
|
+
|
|
297
|
+
from letta_client import AsyncLetta
|
|
298
|
+
|
|
299
|
+
client = AsyncLetta(
|
|
300
|
+
token="YOUR_TOKEN",
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
async def main() -> None:
|
|
305
|
+
await client.agents.sources.detach(
|
|
306
|
+
agent_id="agent_id",
|
|
307
|
+
source_id="source_id",
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
asyncio.run(main())
|
|
312
|
+
"""
|
|
313
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
314
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/sources/detach/{jsonable_encoder(source_id)}",
|
|
315
|
+
method="PATCH",
|
|
316
|
+
request_options=request_options,
|
|
317
|
+
)
|
|
318
|
+
try:
|
|
319
|
+
if 200 <= _response.status_code < 300:
|
|
320
|
+
return typing.cast(
|
|
321
|
+
AgentState,
|
|
322
|
+
construct_type(
|
|
323
|
+
type_=AgentState, # type: ignore
|
|
324
|
+
object_=_response.json(),
|
|
325
|
+
),
|
|
326
|
+
)
|
|
327
|
+
if _response.status_code == 422:
|
|
328
|
+
raise UnprocessableEntityError(
|
|
329
|
+
typing.cast(
|
|
330
|
+
HttpValidationError,
|
|
331
|
+
construct_type(
|
|
332
|
+
type_=HttpValidationError, # type: ignore
|
|
333
|
+
object_=_response.json(),
|
|
334
|
+
),
|
|
335
|
+
)
|
|
336
|
+
)
|
|
337
|
+
_response_json = _response.json()
|
|
338
|
+
except JSONDecodeError:
|
|
339
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
340
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
341
|
+
|
|
342
|
+
async def list(
|
|
82
343
|
self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
83
344
|
) -> typing.List[Source]:
|
|
84
345
|
"""
|
|
@@ -108,7 +369,7 @@ class AsyncSourcesClient:
|
|
|
108
369
|
|
|
109
370
|
|
|
110
371
|
async def main() -> None:
|
|
111
|
-
await client.agents.sources.
|
|
372
|
+
await client.agents.sources.list(
|
|
112
373
|
agent_id="agent_id",
|
|
113
374
|
)
|
|
114
375
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from ...core.client_wrapper import SyncClientWrapper
|
|
4
4
|
import typing
|
|
5
5
|
from ...core.request_options import RequestOptions
|
|
6
|
-
from ...types.
|
|
6
|
+
from ...types.tool import Tool
|
|
7
7
|
from ...core.jsonable_encoder import jsonable_encoder
|
|
8
8
|
from ...core.unchecked_base_model import construct_type
|
|
9
9
|
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
@@ -18,9 +18,7 @@ class ToolsClient:
|
|
|
18
18
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
19
|
self._client_wrapper = client_wrapper
|
|
20
20
|
|
|
21
|
-
def list(
|
|
22
|
-
self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
23
|
-
) -> typing.List[LettaSchemasToolTool]:
|
|
21
|
+
def list(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Tool]:
|
|
24
22
|
"""
|
|
25
23
|
Get tools from an existing agent
|
|
26
24
|
|
|
@@ -33,7 +31,7 @@ class ToolsClient:
|
|
|
33
31
|
|
|
34
32
|
Returns
|
|
35
33
|
-------
|
|
36
|
-
typing.List[
|
|
34
|
+
typing.List[Tool]
|
|
37
35
|
Successful Response
|
|
38
36
|
|
|
39
37
|
Examples
|
|
@@ -55,9 +53,9 @@ class ToolsClient:
|
|
|
55
53
|
try:
|
|
56
54
|
if 200 <= _response.status_code < 300:
|
|
57
55
|
return typing.cast(
|
|
58
|
-
typing.List[
|
|
56
|
+
typing.List[Tool],
|
|
59
57
|
construct_type(
|
|
60
|
-
type_=typing.List[
|
|
58
|
+
type_=typing.List[Tool], # type: ignore
|
|
61
59
|
object_=_response.json(),
|
|
62
60
|
),
|
|
63
61
|
)
|
|
@@ -76,11 +74,11 @@ class ToolsClient:
|
|
|
76
74
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
77
75
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
78
76
|
|
|
79
|
-
def
|
|
77
|
+
def attach(
|
|
80
78
|
self, agent_id: str, tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
81
79
|
) -> AgentState:
|
|
82
80
|
"""
|
|
83
|
-
|
|
81
|
+
Attach a tool to an agent.
|
|
84
82
|
|
|
85
83
|
Parameters
|
|
86
84
|
----------
|
|
@@ -103,13 +101,13 @@ class ToolsClient:
|
|
|
103
101
|
client = Letta(
|
|
104
102
|
token="YOUR_TOKEN",
|
|
105
103
|
)
|
|
106
|
-
client.agents.tools.
|
|
104
|
+
client.agents.tools.attach(
|
|
107
105
|
agent_id="agent_id",
|
|
108
106
|
tool_id="tool_id",
|
|
109
107
|
)
|
|
110
108
|
"""
|
|
111
109
|
_response = self._client_wrapper.httpx_client.request(
|
|
112
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/
|
|
110
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/tools/attach/{jsonable_encoder(tool_id)}",
|
|
113
111
|
method="PATCH",
|
|
114
112
|
request_options=request_options,
|
|
115
113
|
)
|
|
@@ -137,11 +135,11 @@ class ToolsClient:
|
|
|
137
135
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
138
136
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
139
137
|
|
|
140
|
-
def
|
|
138
|
+
def detach(
|
|
141
139
|
self, agent_id: str, tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
142
140
|
) -> AgentState:
|
|
143
141
|
"""
|
|
144
|
-
|
|
142
|
+
Detach a tool from an agent.
|
|
145
143
|
|
|
146
144
|
Parameters
|
|
147
145
|
----------
|
|
@@ -164,13 +162,13 @@ class ToolsClient:
|
|
|
164
162
|
client = Letta(
|
|
165
163
|
token="YOUR_TOKEN",
|
|
166
164
|
)
|
|
167
|
-
client.agents.tools.
|
|
165
|
+
client.agents.tools.detach(
|
|
168
166
|
agent_id="agent_id",
|
|
169
167
|
tool_id="tool_id",
|
|
170
168
|
)
|
|
171
169
|
"""
|
|
172
170
|
_response = self._client_wrapper.httpx_client.request(
|
|
173
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/
|
|
171
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/tools/detach/{jsonable_encoder(tool_id)}",
|
|
174
172
|
method="PATCH",
|
|
175
173
|
request_options=request_options,
|
|
176
174
|
)
|
|
@@ -205,7 +203,7 @@ class AsyncToolsClient:
|
|
|
205
203
|
|
|
206
204
|
async def list(
|
|
207
205
|
self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
208
|
-
) -> typing.List[
|
|
206
|
+
) -> typing.List[Tool]:
|
|
209
207
|
"""
|
|
210
208
|
Get tools from an existing agent
|
|
211
209
|
|
|
@@ -218,7 +216,7 @@ class AsyncToolsClient:
|
|
|
218
216
|
|
|
219
217
|
Returns
|
|
220
218
|
-------
|
|
221
|
-
typing.List[
|
|
219
|
+
typing.List[Tool]
|
|
222
220
|
Successful Response
|
|
223
221
|
|
|
224
222
|
Examples
|
|
@@ -248,9 +246,9 @@ class AsyncToolsClient:
|
|
|
248
246
|
try:
|
|
249
247
|
if 200 <= _response.status_code < 300:
|
|
250
248
|
return typing.cast(
|
|
251
|
-
typing.List[
|
|
249
|
+
typing.List[Tool],
|
|
252
250
|
construct_type(
|
|
253
|
-
type_=typing.List[
|
|
251
|
+
type_=typing.List[Tool], # type: ignore
|
|
254
252
|
object_=_response.json(),
|
|
255
253
|
),
|
|
256
254
|
)
|
|
@@ -269,11 +267,11 @@ class AsyncToolsClient:
|
|
|
269
267
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
270
268
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
271
269
|
|
|
272
|
-
async def
|
|
270
|
+
async def attach(
|
|
273
271
|
self, agent_id: str, tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
274
272
|
) -> AgentState:
|
|
275
273
|
"""
|
|
276
|
-
|
|
274
|
+
Attach a tool to an agent.
|
|
277
275
|
|
|
278
276
|
Parameters
|
|
279
277
|
----------
|
|
@@ -301,7 +299,7 @@ class AsyncToolsClient:
|
|
|
301
299
|
|
|
302
300
|
|
|
303
301
|
async def main() -> None:
|
|
304
|
-
await client.agents.tools.
|
|
302
|
+
await client.agents.tools.attach(
|
|
305
303
|
agent_id="agent_id",
|
|
306
304
|
tool_id="tool_id",
|
|
307
305
|
)
|
|
@@ -310,7 +308,7 @@ class AsyncToolsClient:
|
|
|
310
308
|
asyncio.run(main())
|
|
311
309
|
"""
|
|
312
310
|
_response = await self._client_wrapper.httpx_client.request(
|
|
313
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/
|
|
311
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/tools/attach/{jsonable_encoder(tool_id)}",
|
|
314
312
|
method="PATCH",
|
|
315
313
|
request_options=request_options,
|
|
316
314
|
)
|
|
@@ -338,11 +336,11 @@ class AsyncToolsClient:
|
|
|
338
336
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
339
337
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
340
338
|
|
|
341
|
-
async def
|
|
339
|
+
async def detach(
|
|
342
340
|
self, agent_id: str, tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
343
341
|
) -> AgentState:
|
|
344
342
|
"""
|
|
345
|
-
|
|
343
|
+
Detach a tool from an agent.
|
|
346
344
|
|
|
347
345
|
Parameters
|
|
348
346
|
----------
|
|
@@ -370,7 +368,7 @@ class AsyncToolsClient:
|
|
|
370
368
|
|
|
371
369
|
|
|
372
370
|
async def main() -> None:
|
|
373
|
-
await client.agents.tools.
|
|
371
|
+
await client.agents.tools.detach(
|
|
374
372
|
agent_id="agent_id",
|
|
375
373
|
tool_id="tool_id",
|
|
376
374
|
)
|
|
@@ -379,7 +377,7 @@ class AsyncToolsClient:
|
|
|
379
377
|
asyncio.run(main())
|
|
380
378
|
"""
|
|
381
379
|
_response = await self._client_wrapper.httpx_client.request(
|
|
382
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/
|
|
380
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/tools/detach/{jsonable_encoder(tool_id)}",
|
|
383
381
|
method="PATCH",
|
|
384
382
|
request_options=request_options,
|
|
385
383
|
)
|
|
@@ -1,37 +1,27 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from .agents_search_request_combinator import AgentsSearchRequestCombinator
|
|
4
|
-
from .agents_search_request_search_item import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
from .
|
|
12
|
-
from .agents_search_request_search_item_name_operator import AgentsSearchRequestSearchItemNameOperator
|
|
13
|
-
from .agents_search_request_search_item_order_by import AgentsSearchRequestSearchItemOrderBy
|
|
14
|
-
from .agents_search_request_search_item_order_by_direction import AgentsSearchRequestSearchItemOrderByDirection
|
|
15
|
-
from .agents_search_request_search_item_order_by_value import AgentsSearchRequestSearchItemOrderByValue
|
|
16
|
-
from .agents_search_request_search_item_tags import AgentsSearchRequestSearchItemTags
|
|
17
|
-
from .agents_search_request_search_item_version import AgentsSearchRequestSearchItemVersion
|
|
4
|
+
from .agents_search_request_search_item import AgentsSearchRequestSearchItem
|
|
5
|
+
from .agents_search_request_search_item_direction import AgentsSearchRequestSearchItemDirection
|
|
6
|
+
from .agents_search_request_search_item_direction_direction import AgentsSearchRequestSearchItemDirectionDirection
|
|
7
|
+
from .agents_search_request_search_item_direction_value import AgentsSearchRequestSearchItemDirectionValue
|
|
8
|
+
from .agents_search_request_search_item_one import AgentsSearchRequestSearchItemOne
|
|
9
|
+
from .agents_search_request_search_item_one_operator import AgentsSearchRequestSearchItemOneOperator
|
|
10
|
+
from .agents_search_request_search_item_two import AgentsSearchRequestSearchItemTwo
|
|
11
|
+
from .agents_search_request_search_item_zero import AgentsSearchRequestSearchItemZero
|
|
18
12
|
from .create_agent_request_tool_rules_item import CreateAgentRequestToolRulesItem
|
|
19
13
|
from .update_agent_tool_rules_item import UpdateAgentToolRulesItem
|
|
20
14
|
|
|
21
15
|
__all__ = [
|
|
22
16
|
"AgentsSearchRequestCombinator",
|
|
23
17
|
"AgentsSearchRequestSearchItem",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"AgentsSearchRequestSearchItem_Name",
|
|
32
|
-
"AgentsSearchRequestSearchItem_OrderBy",
|
|
33
|
-
"AgentsSearchRequestSearchItem_Tags",
|
|
34
|
-
"AgentsSearchRequestSearchItem_Version",
|
|
18
|
+
"AgentsSearchRequestSearchItemDirection",
|
|
19
|
+
"AgentsSearchRequestSearchItemDirectionDirection",
|
|
20
|
+
"AgentsSearchRequestSearchItemDirectionValue",
|
|
21
|
+
"AgentsSearchRequestSearchItemOne",
|
|
22
|
+
"AgentsSearchRequestSearchItemOneOperator",
|
|
23
|
+
"AgentsSearchRequestSearchItemTwo",
|
|
24
|
+
"AgentsSearchRequestSearchItemZero",
|
|
35
25
|
"CreateAgentRequestToolRulesItem",
|
|
36
26
|
"UpdateAgentToolRulesItem",
|
|
37
27
|
]
|
|
@@ -1,82 +1,14 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
from ...core.unchecked_base_model import UncheckedBaseModel
|
|
5
3
|
import typing
|
|
6
|
-
from
|
|
7
|
-
import
|
|
8
|
-
from .
|
|
9
|
-
from .
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
field: typing.Literal["version"] = "version"
|
|
17
|
-
value: str
|
|
18
|
-
|
|
19
|
-
if IS_PYDANTIC_V2:
|
|
20
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
21
|
-
else:
|
|
22
|
-
|
|
23
|
-
class Config:
|
|
24
|
-
frozen = True
|
|
25
|
-
smart_union = True
|
|
26
|
-
extra = pydantic.Extra.allow
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class AgentsSearchRequestSearchItem_Name(UncheckedBaseModel):
|
|
30
|
-
field: typing.Literal["name"] = "name"
|
|
31
|
-
operator: AgentsSearchRequestSearchItemNameOperator
|
|
32
|
-
value: str
|
|
33
|
-
|
|
34
|
-
if IS_PYDANTIC_V2:
|
|
35
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
36
|
-
else:
|
|
37
|
-
|
|
38
|
-
class Config:
|
|
39
|
-
frozen = True
|
|
40
|
-
smart_union = True
|
|
41
|
-
extra = pydantic.Extra.allow
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class AgentsSearchRequestSearchItem_Tags(UncheckedBaseModel):
|
|
45
|
-
field: typing.Literal["tags"] = "tags"
|
|
46
|
-
operator: typing.Literal["contains"] = "contains"
|
|
47
|
-
value: typing.List[str]
|
|
48
|
-
|
|
49
|
-
if IS_PYDANTIC_V2:
|
|
50
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
51
|
-
else:
|
|
52
|
-
|
|
53
|
-
class Config:
|
|
54
|
-
frozen = True
|
|
55
|
-
smart_union = True
|
|
56
|
-
extra = pydantic.Extra.allow
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
class AgentsSearchRequestSearchItem_OrderBy(UncheckedBaseModel):
|
|
60
|
-
field: typing.Literal["order_by"] = "order_by"
|
|
61
|
-
value: AgentsSearchRequestSearchItemOrderByValue
|
|
62
|
-
direction: AgentsSearchRequestSearchItemOrderByDirection
|
|
63
|
-
|
|
64
|
-
if IS_PYDANTIC_V2:
|
|
65
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
66
|
-
else:
|
|
67
|
-
|
|
68
|
-
class Config:
|
|
69
|
-
frozen = True
|
|
70
|
-
smart_union = True
|
|
71
|
-
extra = pydantic.Extra.allow
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
AgentsSearchRequestSearchItem = typing_extensions.Annotated[
|
|
75
|
-
typing.Union[
|
|
76
|
-
AgentsSearchRequestSearchItem_Version,
|
|
77
|
-
AgentsSearchRequestSearchItem_Name,
|
|
78
|
-
AgentsSearchRequestSearchItem_Tags,
|
|
79
|
-
AgentsSearchRequestSearchItem_OrderBy,
|
|
80
|
-
],
|
|
81
|
-
UnionMetadata(discriminant="field"),
|
|
4
|
+
from .agents_search_request_search_item_zero import AgentsSearchRequestSearchItemZero
|
|
5
|
+
from .agents_search_request_search_item_one import AgentsSearchRequestSearchItemOne
|
|
6
|
+
from .agents_search_request_search_item_two import AgentsSearchRequestSearchItemTwo
|
|
7
|
+
from .agents_search_request_search_item_direction import AgentsSearchRequestSearchItemDirection
|
|
8
|
+
|
|
9
|
+
AgentsSearchRequestSearchItem = typing.Union[
|
|
10
|
+
AgentsSearchRequestSearchItemZero,
|
|
11
|
+
AgentsSearchRequestSearchItemOne,
|
|
12
|
+
AgentsSearchRequestSearchItemTwo,
|
|
13
|
+
AgentsSearchRequestSearchItemDirection,
|
|
82
14
|
]
|
|
@@ -1,16 +1,17 @@
|
|
|
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 .agents_search_request_search_item_order_by_value import AgentsSearchRequestSearchItemOrderByValue
|
|
5
|
-
from .agents_search_request_search_item_order_by_direction import AgentsSearchRequestSearchItemOrderByDirection
|
|
6
|
-
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
4
|
import typing
|
|
5
|
+
from .agents_search_request_search_item_direction_value import AgentsSearchRequestSearchItemDirectionValue
|
|
6
|
+
from .agents_search_request_search_item_direction_direction import AgentsSearchRequestSearchItemDirectionDirection
|
|
7
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
8
|
import pydantic
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
class AgentsSearchRequestSearchItemDirection(UncheckedBaseModel):
|
|
12
|
+
field: typing.Literal["order_by"] = "order_by"
|
|
13
|
+
value: AgentsSearchRequestSearchItemDirectionValue
|
|
14
|
+
direction: AgentsSearchRequestSearchItemDirectionDirection
|
|
14
15
|
|
|
15
16
|
if IS_PYDANTIC_V2:
|
|
16
17
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|