letta-client 0.1.16__py3-none-any.whl → 0.1.19__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.
- letta_client/__init__.py +34 -120
- letta_client/agents/__init__.py +18 -54
- letta_client/agents/archival_memory/client.py +25 -343
- letta_client/agents/client.py +1640 -347
- letta_client/agents/context/client.py +6 -4
- letta_client/agents/core_memory/client.py +95 -624
- 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 +32 -38
- letta_client/agents/messages/types/__init__.py +2 -21
- letta_client/agents/messages/types/letta_streaming_response.py +16 -139
- 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 +12 -260
- 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 +74 -74
- letta_client/runs/client.py +14 -12
- letta_client/sources/client.py +12 -288
- letta_client/tools/client.py +63 -189
- letta_client/types/__init__.py +21 -103
- letta_client/types/agent_state.py +3 -7
- letta_client/types/{assistant_message_output.py → assistant_message.py} +3 -2
- letta_client/types/block.py +2 -6
- letta_client/types/block_update.py +1 -5
- letta_client/types/{archival_memory_summary.py → chat_completion_message_tool_call.py} +7 -7
- letta_client/types/context_window_overview.py +4 -6
- letta_client/types/create_block.py +1 -5
- letta_client/types/embedding_config_embedding_endpoint_type.py +1 -0
- 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/{create_assistant_file_request.py → function_tool.py} +6 -7
- 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_model_endpoint_type.py +1 -0
- letta_client/types/{letta_schemas_message_message.py → message.py} +9 -6
- 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} +3 -2
- 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} +3 -2
- {letta_client-0.1.16.dist-info → letta_client-0.1.19.dist-info}/METADATA +2 -2
- {letta_client-0.1.16.dist-info → letta_client-0.1.19.dist-info}/RECORD +66 -101
- letta_client/agents/recall_memory/__init__.py +0 -2
- letta_client/agents/recall_memory/client.py +0 -147
- 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/function_call_input.py +0 -19
- 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_completion_response_tool_call.py +0 -22
- 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/recall_memory_summary.py +0 -22
- 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.16.dist-info → letta_client-0.1.19.dist-info}/WHEEL +0 -0
letta_client/tools/client.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import typing
|
|
4
4
|
from ..core.client_wrapper import SyncClientWrapper
|
|
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
|
|
@@ -23,7 +23,7 @@ class ToolsClient:
|
|
|
23
23
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
24
24
|
self._client_wrapper = client_wrapper
|
|
25
25
|
|
|
26
|
-
def
|
|
26
|
+
def retrieve(self, tool_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Tool:
|
|
27
27
|
"""
|
|
28
28
|
Get a tool by ID
|
|
29
29
|
|
|
@@ -36,7 +36,7 @@ class ToolsClient:
|
|
|
36
36
|
|
|
37
37
|
Returns
|
|
38
38
|
-------
|
|
39
|
-
|
|
39
|
+
Tool
|
|
40
40
|
Successful Response
|
|
41
41
|
|
|
42
42
|
Examples
|
|
@@ -46,7 +46,7 @@ class ToolsClient:
|
|
|
46
46
|
client = Letta(
|
|
47
47
|
token="YOUR_TOKEN",
|
|
48
48
|
)
|
|
49
|
-
client.tools.
|
|
49
|
+
client.tools.retrieve(
|
|
50
50
|
tool_id="tool_id",
|
|
51
51
|
)
|
|
52
52
|
"""
|
|
@@ -58,9 +58,9 @@ class ToolsClient:
|
|
|
58
58
|
try:
|
|
59
59
|
if 200 <= _response.status_code < 300:
|
|
60
60
|
return typing.cast(
|
|
61
|
-
|
|
61
|
+
Tool,
|
|
62
62
|
construct_type(
|
|
63
|
-
type_=
|
|
63
|
+
type_=Tool, # type: ignore
|
|
64
64
|
object_=_response.json(),
|
|
65
65
|
),
|
|
66
66
|
)
|
|
@@ -137,7 +137,7 @@ class ToolsClient:
|
|
|
137
137
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
138
138
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
139
139
|
|
|
140
|
-
def
|
|
140
|
+
def modify(
|
|
141
141
|
self,
|
|
142
142
|
tool_id: str,
|
|
143
143
|
*,
|
|
@@ -149,7 +149,7 @@ class ToolsClient:
|
|
|
149
149
|
json_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
150
150
|
return_char_limit: typing.Optional[int] = OMIT,
|
|
151
151
|
request_options: typing.Optional[RequestOptions] = None,
|
|
152
|
-
) ->
|
|
152
|
+
) -> Tool:
|
|
153
153
|
"""
|
|
154
154
|
Update an existing tool
|
|
155
155
|
|
|
@@ -183,7 +183,7 @@ class ToolsClient:
|
|
|
183
183
|
|
|
184
184
|
Returns
|
|
185
185
|
-------
|
|
186
|
-
|
|
186
|
+
Tool
|
|
187
187
|
Successful Response
|
|
188
188
|
|
|
189
189
|
Examples
|
|
@@ -193,7 +193,7 @@ class ToolsClient:
|
|
|
193
193
|
client = Letta(
|
|
194
194
|
token="YOUR_TOKEN",
|
|
195
195
|
)
|
|
196
|
-
client.tools.
|
|
196
|
+
client.tools.modify(
|
|
197
197
|
tool_id="tool_id",
|
|
198
198
|
)
|
|
199
199
|
"""
|
|
@@ -218,65 +218,9 @@ class ToolsClient:
|
|
|
218
218
|
try:
|
|
219
219
|
if 200 <= _response.status_code < 300:
|
|
220
220
|
return typing.cast(
|
|
221
|
-
|
|
221
|
+
Tool,
|
|
222
222
|
construct_type(
|
|
223
|
-
type_=
|
|
224
|
-
object_=_response.json(),
|
|
225
|
-
),
|
|
226
|
-
)
|
|
227
|
-
if _response.status_code == 422:
|
|
228
|
-
raise UnprocessableEntityError(
|
|
229
|
-
typing.cast(
|
|
230
|
-
HttpValidationError,
|
|
231
|
-
construct_type(
|
|
232
|
-
type_=HttpValidationError, # type: ignore
|
|
233
|
-
object_=_response.json(),
|
|
234
|
-
),
|
|
235
|
-
)
|
|
236
|
-
)
|
|
237
|
-
_response_json = _response.json()
|
|
238
|
-
except JSONDecodeError:
|
|
239
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
240
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
241
|
-
|
|
242
|
-
def get_by_name(self, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None) -> str:
|
|
243
|
-
"""
|
|
244
|
-
Get a tool ID by name
|
|
245
|
-
|
|
246
|
-
Parameters
|
|
247
|
-
----------
|
|
248
|
-
tool_name : str
|
|
249
|
-
|
|
250
|
-
request_options : typing.Optional[RequestOptions]
|
|
251
|
-
Request-specific configuration.
|
|
252
|
-
|
|
253
|
-
Returns
|
|
254
|
-
-------
|
|
255
|
-
str
|
|
256
|
-
Successful Response
|
|
257
|
-
|
|
258
|
-
Examples
|
|
259
|
-
--------
|
|
260
|
-
from letta_client import Letta
|
|
261
|
-
|
|
262
|
-
client = Letta(
|
|
263
|
-
token="YOUR_TOKEN",
|
|
264
|
-
)
|
|
265
|
-
client.tools.get_by_name(
|
|
266
|
-
tool_name="tool_name",
|
|
267
|
-
)
|
|
268
|
-
"""
|
|
269
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
270
|
-
f"v1/tools/name/{jsonable_encoder(tool_name)}",
|
|
271
|
-
method="GET",
|
|
272
|
-
request_options=request_options,
|
|
273
|
-
)
|
|
274
|
-
try:
|
|
275
|
-
if 200 <= _response.status_code < 300:
|
|
276
|
-
return typing.cast(
|
|
277
|
-
str,
|
|
278
|
-
construct_type(
|
|
279
|
-
type_=str, # type: ignore
|
|
223
|
+
type_=Tool, # type: ignore
|
|
280
224
|
object_=_response.json(),
|
|
281
225
|
),
|
|
282
226
|
)
|
|
@@ -301,7 +245,7 @@ class ToolsClient:
|
|
|
301
245
|
cursor: typing.Optional[str] = None,
|
|
302
246
|
limit: typing.Optional[int] = None,
|
|
303
247
|
request_options: typing.Optional[RequestOptions] = None,
|
|
304
|
-
) -> typing.List[
|
|
248
|
+
) -> typing.List[Tool]:
|
|
305
249
|
"""
|
|
306
250
|
Get a list of all tools available to agents belonging to the org of the user
|
|
307
251
|
|
|
@@ -316,7 +260,7 @@ class ToolsClient:
|
|
|
316
260
|
|
|
317
261
|
Returns
|
|
318
262
|
-------
|
|
319
|
-
typing.List[
|
|
263
|
+
typing.List[Tool]
|
|
320
264
|
Successful Response
|
|
321
265
|
|
|
322
266
|
Examples
|
|
@@ -340,9 +284,9 @@ class ToolsClient:
|
|
|
340
284
|
try:
|
|
341
285
|
if 200 <= _response.status_code < 300:
|
|
342
286
|
return typing.cast(
|
|
343
|
-
typing.List[
|
|
287
|
+
typing.List[Tool],
|
|
344
288
|
construct_type(
|
|
345
|
-
type_=typing.List[
|
|
289
|
+
type_=typing.List[Tool], # type: ignore
|
|
346
290
|
object_=_response.json(),
|
|
347
291
|
),
|
|
348
292
|
)
|
|
@@ -372,7 +316,7 @@ class ToolsClient:
|
|
|
372
316
|
json_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
373
317
|
return_char_limit: typing.Optional[int] = OMIT,
|
|
374
318
|
request_options: typing.Optional[RequestOptions] = None,
|
|
375
|
-
) ->
|
|
319
|
+
) -> Tool:
|
|
376
320
|
"""
|
|
377
321
|
Create a new tool
|
|
378
322
|
|
|
@@ -404,7 +348,7 @@ class ToolsClient:
|
|
|
404
348
|
|
|
405
349
|
Returns
|
|
406
350
|
-------
|
|
407
|
-
|
|
351
|
+
Tool
|
|
408
352
|
Successful Response
|
|
409
353
|
|
|
410
354
|
Examples
|
|
@@ -436,9 +380,9 @@ class ToolsClient:
|
|
|
436
380
|
try:
|
|
437
381
|
if 200 <= _response.status_code < 300:
|
|
438
382
|
return typing.cast(
|
|
439
|
-
|
|
383
|
+
Tool,
|
|
440
384
|
construct_type(
|
|
441
|
-
type_=
|
|
385
|
+
type_=Tool, # type: ignore
|
|
442
386
|
object_=_response.json(),
|
|
443
387
|
),
|
|
444
388
|
)
|
|
@@ -468,7 +412,7 @@ class ToolsClient:
|
|
|
468
412
|
json_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
469
413
|
return_char_limit: typing.Optional[int] = OMIT,
|
|
470
414
|
request_options: typing.Optional[RequestOptions] = None,
|
|
471
|
-
) ->
|
|
415
|
+
) -> Tool:
|
|
472
416
|
"""
|
|
473
417
|
Create or update a tool
|
|
474
418
|
|
|
@@ -500,7 +444,7 @@ class ToolsClient:
|
|
|
500
444
|
|
|
501
445
|
Returns
|
|
502
446
|
-------
|
|
503
|
-
|
|
447
|
+
Tool
|
|
504
448
|
Successful Response
|
|
505
449
|
|
|
506
450
|
Examples
|
|
@@ -532,9 +476,9 @@ class ToolsClient:
|
|
|
532
476
|
try:
|
|
533
477
|
if 200 <= _response.status_code < 300:
|
|
534
478
|
return typing.cast(
|
|
535
|
-
|
|
479
|
+
Tool,
|
|
536
480
|
construct_type(
|
|
537
|
-
type_=
|
|
481
|
+
type_=Tool, # type: ignore
|
|
538
482
|
object_=_response.json(),
|
|
539
483
|
),
|
|
540
484
|
)
|
|
@@ -553,9 +497,7 @@ class ToolsClient:
|
|
|
553
497
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
554
498
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
555
499
|
|
|
556
|
-
def add_base_tool(
|
|
557
|
-
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
558
|
-
) -> typing.List[LettaSchemasToolTool]:
|
|
500
|
+
def add_base_tool(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Tool]:
|
|
559
501
|
"""
|
|
560
502
|
Upsert base tools
|
|
561
503
|
|
|
@@ -566,7 +508,7 @@ class ToolsClient:
|
|
|
566
508
|
|
|
567
509
|
Returns
|
|
568
510
|
-------
|
|
569
|
-
typing.List[
|
|
511
|
+
typing.List[Tool]
|
|
570
512
|
Successful Response
|
|
571
513
|
|
|
572
514
|
Examples
|
|
@@ -586,9 +528,9 @@ class ToolsClient:
|
|
|
586
528
|
try:
|
|
587
529
|
if 200 <= _response.status_code < 300:
|
|
588
530
|
return typing.cast(
|
|
589
|
-
typing.List[
|
|
531
|
+
typing.List[Tool],
|
|
590
532
|
construct_type(
|
|
591
|
-
type_=typing.List[
|
|
533
|
+
type_=typing.List[Tool], # type: ignore
|
|
592
534
|
object_=_response.json(),
|
|
593
535
|
),
|
|
594
536
|
)
|
|
@@ -809,7 +751,7 @@ class ToolsClient:
|
|
|
809
751
|
|
|
810
752
|
def add_composio_tool(
|
|
811
753
|
self, composio_action_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
812
|
-
) ->
|
|
754
|
+
) -> Tool:
|
|
813
755
|
"""
|
|
814
756
|
Add a new Composio tool by action name (Composio refers to each tool as an `Action`)
|
|
815
757
|
|
|
@@ -822,7 +764,7 @@ class ToolsClient:
|
|
|
822
764
|
|
|
823
765
|
Returns
|
|
824
766
|
-------
|
|
825
|
-
|
|
767
|
+
Tool
|
|
826
768
|
Successful Response
|
|
827
769
|
|
|
828
770
|
Examples
|
|
@@ -844,9 +786,9 @@ class ToolsClient:
|
|
|
844
786
|
try:
|
|
845
787
|
if 200 <= _response.status_code < 300:
|
|
846
788
|
return typing.cast(
|
|
847
|
-
|
|
789
|
+
Tool,
|
|
848
790
|
construct_type(
|
|
849
|
-
type_=
|
|
791
|
+
type_=Tool, # type: ignore
|
|
850
792
|
object_=_response.json(),
|
|
851
793
|
),
|
|
852
794
|
)
|
|
@@ -870,9 +812,7 @@ class AsyncToolsClient:
|
|
|
870
812
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
871
813
|
self._client_wrapper = client_wrapper
|
|
872
814
|
|
|
873
|
-
async def
|
|
874
|
-
self, tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
875
|
-
) -> LettaSchemasToolTool:
|
|
815
|
+
async def retrieve(self, tool_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Tool:
|
|
876
816
|
"""
|
|
877
817
|
Get a tool by ID
|
|
878
818
|
|
|
@@ -885,7 +825,7 @@ class AsyncToolsClient:
|
|
|
885
825
|
|
|
886
826
|
Returns
|
|
887
827
|
-------
|
|
888
|
-
|
|
828
|
+
Tool
|
|
889
829
|
Successful Response
|
|
890
830
|
|
|
891
831
|
Examples
|
|
@@ -900,7 +840,7 @@ class AsyncToolsClient:
|
|
|
900
840
|
|
|
901
841
|
|
|
902
842
|
async def main() -> None:
|
|
903
|
-
await client.tools.
|
|
843
|
+
await client.tools.retrieve(
|
|
904
844
|
tool_id="tool_id",
|
|
905
845
|
)
|
|
906
846
|
|
|
@@ -915,9 +855,9 @@ class AsyncToolsClient:
|
|
|
915
855
|
try:
|
|
916
856
|
if 200 <= _response.status_code < 300:
|
|
917
857
|
return typing.cast(
|
|
918
|
-
|
|
858
|
+
Tool,
|
|
919
859
|
construct_type(
|
|
920
|
-
type_=
|
|
860
|
+
type_=Tool, # type: ignore
|
|
921
861
|
object_=_response.json(),
|
|
922
862
|
),
|
|
923
863
|
)
|
|
@@ -1002,7 +942,7 @@ class AsyncToolsClient:
|
|
|
1002
942
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1003
943
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1004
944
|
|
|
1005
|
-
async def
|
|
945
|
+
async def modify(
|
|
1006
946
|
self,
|
|
1007
947
|
tool_id: str,
|
|
1008
948
|
*,
|
|
@@ -1014,7 +954,7 @@ class AsyncToolsClient:
|
|
|
1014
954
|
json_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
1015
955
|
return_char_limit: typing.Optional[int] = OMIT,
|
|
1016
956
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1017
|
-
) ->
|
|
957
|
+
) -> Tool:
|
|
1018
958
|
"""
|
|
1019
959
|
Update an existing tool
|
|
1020
960
|
|
|
@@ -1048,7 +988,7 @@ class AsyncToolsClient:
|
|
|
1048
988
|
|
|
1049
989
|
Returns
|
|
1050
990
|
-------
|
|
1051
|
-
|
|
991
|
+
Tool
|
|
1052
992
|
Successful Response
|
|
1053
993
|
|
|
1054
994
|
Examples
|
|
@@ -1063,7 +1003,7 @@ class AsyncToolsClient:
|
|
|
1063
1003
|
|
|
1064
1004
|
|
|
1065
1005
|
async def main() -> None:
|
|
1066
|
-
await client.tools.
|
|
1006
|
+
await client.tools.modify(
|
|
1067
1007
|
tool_id="tool_id",
|
|
1068
1008
|
)
|
|
1069
1009
|
|
|
@@ -1091,73 +1031,9 @@ class AsyncToolsClient:
|
|
|
1091
1031
|
try:
|
|
1092
1032
|
if 200 <= _response.status_code < 300:
|
|
1093
1033
|
return typing.cast(
|
|
1094
|
-
|
|
1034
|
+
Tool,
|
|
1095
1035
|
construct_type(
|
|
1096
|
-
type_=
|
|
1097
|
-
object_=_response.json(),
|
|
1098
|
-
),
|
|
1099
|
-
)
|
|
1100
|
-
if _response.status_code == 422:
|
|
1101
|
-
raise UnprocessableEntityError(
|
|
1102
|
-
typing.cast(
|
|
1103
|
-
HttpValidationError,
|
|
1104
|
-
construct_type(
|
|
1105
|
-
type_=HttpValidationError, # type: ignore
|
|
1106
|
-
object_=_response.json(),
|
|
1107
|
-
),
|
|
1108
|
-
)
|
|
1109
|
-
)
|
|
1110
|
-
_response_json = _response.json()
|
|
1111
|
-
except JSONDecodeError:
|
|
1112
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1113
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1114
|
-
|
|
1115
|
-
async def get_by_name(self, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None) -> str:
|
|
1116
|
-
"""
|
|
1117
|
-
Get a tool ID by name
|
|
1118
|
-
|
|
1119
|
-
Parameters
|
|
1120
|
-
----------
|
|
1121
|
-
tool_name : str
|
|
1122
|
-
|
|
1123
|
-
request_options : typing.Optional[RequestOptions]
|
|
1124
|
-
Request-specific configuration.
|
|
1125
|
-
|
|
1126
|
-
Returns
|
|
1127
|
-
-------
|
|
1128
|
-
str
|
|
1129
|
-
Successful Response
|
|
1130
|
-
|
|
1131
|
-
Examples
|
|
1132
|
-
--------
|
|
1133
|
-
import asyncio
|
|
1134
|
-
|
|
1135
|
-
from letta_client import AsyncLetta
|
|
1136
|
-
|
|
1137
|
-
client = AsyncLetta(
|
|
1138
|
-
token="YOUR_TOKEN",
|
|
1139
|
-
)
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
async def main() -> None:
|
|
1143
|
-
await client.tools.get_by_name(
|
|
1144
|
-
tool_name="tool_name",
|
|
1145
|
-
)
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
asyncio.run(main())
|
|
1149
|
-
"""
|
|
1150
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
1151
|
-
f"v1/tools/name/{jsonable_encoder(tool_name)}",
|
|
1152
|
-
method="GET",
|
|
1153
|
-
request_options=request_options,
|
|
1154
|
-
)
|
|
1155
|
-
try:
|
|
1156
|
-
if 200 <= _response.status_code < 300:
|
|
1157
|
-
return typing.cast(
|
|
1158
|
-
str,
|
|
1159
|
-
construct_type(
|
|
1160
|
-
type_=str, # type: ignore
|
|
1036
|
+
type_=Tool, # type: ignore
|
|
1161
1037
|
object_=_response.json(),
|
|
1162
1038
|
),
|
|
1163
1039
|
)
|
|
@@ -1182,7 +1058,7 @@ class AsyncToolsClient:
|
|
|
1182
1058
|
cursor: typing.Optional[str] = None,
|
|
1183
1059
|
limit: typing.Optional[int] = None,
|
|
1184
1060
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1185
|
-
) -> typing.List[
|
|
1061
|
+
) -> typing.List[Tool]:
|
|
1186
1062
|
"""
|
|
1187
1063
|
Get a list of all tools available to agents belonging to the org of the user
|
|
1188
1064
|
|
|
@@ -1197,7 +1073,7 @@ class AsyncToolsClient:
|
|
|
1197
1073
|
|
|
1198
1074
|
Returns
|
|
1199
1075
|
-------
|
|
1200
|
-
typing.List[
|
|
1076
|
+
typing.List[Tool]
|
|
1201
1077
|
Successful Response
|
|
1202
1078
|
|
|
1203
1079
|
Examples
|
|
@@ -1229,9 +1105,9 @@ class AsyncToolsClient:
|
|
|
1229
1105
|
try:
|
|
1230
1106
|
if 200 <= _response.status_code < 300:
|
|
1231
1107
|
return typing.cast(
|
|
1232
|
-
typing.List[
|
|
1108
|
+
typing.List[Tool],
|
|
1233
1109
|
construct_type(
|
|
1234
|
-
type_=typing.List[
|
|
1110
|
+
type_=typing.List[Tool], # type: ignore
|
|
1235
1111
|
object_=_response.json(),
|
|
1236
1112
|
),
|
|
1237
1113
|
)
|
|
@@ -1261,7 +1137,7 @@ class AsyncToolsClient:
|
|
|
1261
1137
|
json_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
1262
1138
|
return_char_limit: typing.Optional[int] = OMIT,
|
|
1263
1139
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1264
|
-
) ->
|
|
1140
|
+
) -> Tool:
|
|
1265
1141
|
"""
|
|
1266
1142
|
Create a new tool
|
|
1267
1143
|
|
|
@@ -1293,7 +1169,7 @@ class AsyncToolsClient:
|
|
|
1293
1169
|
|
|
1294
1170
|
Returns
|
|
1295
1171
|
-------
|
|
1296
|
-
|
|
1172
|
+
Tool
|
|
1297
1173
|
Successful Response
|
|
1298
1174
|
|
|
1299
1175
|
Examples
|
|
@@ -1333,9 +1209,9 @@ class AsyncToolsClient:
|
|
|
1333
1209
|
try:
|
|
1334
1210
|
if 200 <= _response.status_code < 300:
|
|
1335
1211
|
return typing.cast(
|
|
1336
|
-
|
|
1212
|
+
Tool,
|
|
1337
1213
|
construct_type(
|
|
1338
|
-
type_=
|
|
1214
|
+
type_=Tool, # type: ignore
|
|
1339
1215
|
object_=_response.json(),
|
|
1340
1216
|
),
|
|
1341
1217
|
)
|
|
@@ -1365,7 +1241,7 @@ class AsyncToolsClient:
|
|
|
1365
1241
|
json_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
1366
1242
|
return_char_limit: typing.Optional[int] = OMIT,
|
|
1367
1243
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1368
|
-
) ->
|
|
1244
|
+
) -> Tool:
|
|
1369
1245
|
"""
|
|
1370
1246
|
Create or update a tool
|
|
1371
1247
|
|
|
@@ -1397,7 +1273,7 @@ class AsyncToolsClient:
|
|
|
1397
1273
|
|
|
1398
1274
|
Returns
|
|
1399
1275
|
-------
|
|
1400
|
-
|
|
1276
|
+
Tool
|
|
1401
1277
|
Successful Response
|
|
1402
1278
|
|
|
1403
1279
|
Examples
|
|
@@ -1437,9 +1313,9 @@ class AsyncToolsClient:
|
|
|
1437
1313
|
try:
|
|
1438
1314
|
if 200 <= _response.status_code < 300:
|
|
1439
1315
|
return typing.cast(
|
|
1440
|
-
|
|
1316
|
+
Tool,
|
|
1441
1317
|
construct_type(
|
|
1442
|
-
type_=
|
|
1318
|
+
type_=Tool, # type: ignore
|
|
1443
1319
|
object_=_response.json(),
|
|
1444
1320
|
),
|
|
1445
1321
|
)
|
|
@@ -1458,9 +1334,7 @@ class AsyncToolsClient:
|
|
|
1458
1334
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1459
1335
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1460
1336
|
|
|
1461
|
-
async def add_base_tool(
|
|
1462
|
-
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1463
|
-
) -> typing.List[LettaSchemasToolTool]:
|
|
1337
|
+
async def add_base_tool(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Tool]:
|
|
1464
1338
|
"""
|
|
1465
1339
|
Upsert base tools
|
|
1466
1340
|
|
|
@@ -1471,7 +1345,7 @@ class AsyncToolsClient:
|
|
|
1471
1345
|
|
|
1472
1346
|
Returns
|
|
1473
1347
|
-------
|
|
1474
|
-
typing.List[
|
|
1348
|
+
typing.List[Tool]
|
|
1475
1349
|
Successful Response
|
|
1476
1350
|
|
|
1477
1351
|
Examples
|
|
@@ -1499,9 +1373,9 @@ class AsyncToolsClient:
|
|
|
1499
1373
|
try:
|
|
1500
1374
|
if 200 <= _response.status_code < 300:
|
|
1501
1375
|
return typing.cast(
|
|
1502
|
-
typing.List[
|
|
1376
|
+
typing.List[Tool],
|
|
1503
1377
|
construct_type(
|
|
1504
|
-
type_=typing.List[
|
|
1378
|
+
type_=typing.List[Tool], # type: ignore
|
|
1505
1379
|
object_=_response.json(),
|
|
1506
1380
|
),
|
|
1507
1381
|
)
|
|
@@ -1748,7 +1622,7 @@ class AsyncToolsClient:
|
|
|
1748
1622
|
|
|
1749
1623
|
async def add_composio_tool(
|
|
1750
1624
|
self, composio_action_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1751
|
-
) ->
|
|
1625
|
+
) -> Tool:
|
|
1752
1626
|
"""
|
|
1753
1627
|
Add a new Composio tool by action name (Composio refers to each tool as an `Action`)
|
|
1754
1628
|
|
|
@@ -1761,7 +1635,7 @@ class AsyncToolsClient:
|
|
|
1761
1635
|
|
|
1762
1636
|
Returns
|
|
1763
1637
|
-------
|
|
1764
|
-
|
|
1638
|
+
Tool
|
|
1765
1639
|
Successful Response
|
|
1766
1640
|
|
|
1767
1641
|
Examples
|
|
@@ -1791,9 +1665,9 @@ class AsyncToolsClient:
|
|
|
1791
1665
|
try:
|
|
1792
1666
|
if 200 <= _response.status_code < 300:
|
|
1793
1667
|
return typing.cast(
|
|
1794
|
-
|
|
1668
|
+
Tool,
|
|
1795
1669
|
construct_type(
|
|
1796
|
-
type_=
|
|
1670
|
+
type_=Tool, # type: ignore
|
|
1797
1671
|
object_=_response.json(),
|
|
1798
1672
|
),
|
|
1799
1673
|
)
|