letta-client 0.1.4__py3-none-any.whl → 0.1.9__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/__init__.py +44 -21
- letta/agents/__init__.py +71 -24
- letta/agents/archival_memory/client.py +17 -17
- letta/agents/client.py +424 -1700
- letta/agents/context/client.py +5 -5
- letta/agents/core_memory/client.py +1080 -0
- letta/agents/memory_variables/__init__.py +5 -0
- letta/agents/{memory → memory_variables}/client.py +41 -40
- letta/agents/memory_variables/types/__init__.py +5 -0
- letta/agents/{types/agents_get_agent_variables_response.py → memory_variables/types/memory_variables_get_response.py} +3 -3
- letta/agents/messages/__init__.py +36 -2
- letta/agents/messages/client.py +278 -17
- letta/agents/messages/types/__init__.py +37 -3
- letta/agents/messages/types/letta_streaming_response.py +139 -16
- letta/agents/messages/types/messages_list_response_item.py +121 -9
- letta/agents/recall_memory/client.py +5 -5
- letta/agents/sources/client.py +5 -5
- letta/agents/templates/__init__.py +5 -0
- letta/agents/templates/client.py +578 -0
- letta/agents/templates/types/__init__.py +5 -0
- letta/agents/templates/types/templates_migrate_response.py +19 -0
- letta/agents/tools/client.py +13 -13
- letta/agents/types/__init__.py +23 -29
- letta/agents/types/agents_search_request_combinator.py +5 -0
- letta/agents/types/agents_search_request_search_item.py +64 -0
- letta/agents/types/{agents_search_deployed_agents_request_search_item_zero.py → agents_search_request_search_item_name.py} +5 -4
- letta/agents/types/agents_search_request_search_item_name_operator.py +5 -0
- letta/agents/types/agents_search_request_search_item_order_by.py +22 -0
- letta/agents/types/agents_search_request_search_item_order_by_direction.py +5 -0
- letta/agents/types/agents_search_request_search_item_order_by_value.py +5 -0
- letta/agents/types/{agents_migrate_response.py → agents_search_request_search_item_version.py} +3 -3
- letta/blocks/client.py +25 -25
- letta/client.py +8 -4
- letta/core/__init__.py +4 -0
- letta/core/client_wrapper.py +7 -18
- letta/core/unchecked_base_model.py +305 -0
- letta/health/client.py +3 -3
- letta/jobs/client.py +17 -17
- letta/models/client.py +5 -5
- letta/providers/client.py +597 -0
- letta/sources/client.py +33 -33
- letta/sources/files/client.py +11 -11
- letta/sources/passages/client.py +5 -5
- letta/tools/client.py +77 -57
- letta/types/__init__.py +22 -0
- letta/types/action_model.py +2 -2
- letta/types/action_parameters_model.py +2 -2
- letta/types/action_response_model.py +2 -2
- letta/types/agent_environment_variable.py +63 -0
- letta/types/agent_state.py +19 -16
- letta/types/agent_type.py +1 -2
- letta/types/app_auth_scheme.py +2 -2
- letta/types/app_model.py +2 -2
- letta/types/archival_memory_summary.py +2 -2
- letta/types/assistant_file.py +2 -2
- letta/types/assistant_message_input.py +2 -2
- letta/types/assistant_message_output.py +3 -4
- letta/types/auth_request.py +2 -2
- letta/types/auth_response.py +2 -2
- letta/types/auth_scheme_field.py +2 -2
- letta/types/block.py +11 -16
- letta/types/block_update.py +2 -2
- letta/types/chat_completion_request.py +2 -2
- letta/types/chat_completion_response.py +2 -2
- letta/types/child_tool_rule.py +2 -2
- letta/types/choice.py +2 -2
- letta/types/conditional_tool_rule.py +2 -2
- letta/types/conflict_error_body.py +2 -2
- letta/types/context_window_overview.py +7 -2
- letta/types/create_assistant_file_request.py +2 -2
- letta/types/create_assistant_request.py +2 -2
- letta/types/create_block.py +2 -2
- letta/types/delete_assistant_file_response.py +2 -2
- letta/types/delete_assistant_response.py +2 -2
- letta/types/e_2_b_sandbox_config.py +2 -2
- letta/types/embedding_config.py +10 -10
- letta/types/file_metadata.py +2 -7
- letta/types/function_call_input.py +2 -2
- letta/types/function_call_output.py +2 -2
- letta/types/function_schema.py +2 -2
- letta/types/health.py +2 -2
- letta/types/http_validation_error.py +2 -2
- letta/types/init_tool_rule.py +2 -2
- letta/types/internal_server_error_body.py +2 -2
- letta/types/job.py +7 -12
- letta/types/letta_request.py +7 -2
- letta/types/letta_response.py +6 -5
- letta/types/letta_response_messages_item.py +125 -0
- letta/types/letta_schemas_letta_message_tool_call.py +2 -2
- letta/types/letta_schemas_message_message.py +12 -17
- letta/types/letta_schemas_openai_chat_completion_request_tool.py +2 -2
- letta/types/letta_schemas_openai_chat_completion_request_tool_call.py +2 -2
- letta/types/letta_schemas_openai_chat_completion_request_tool_call_function.py +2 -2
- letta/types/letta_schemas_openai_chat_completion_response_message.py +2 -2
- letta/types/letta_schemas_openai_chat_completion_response_tool_call.py +2 -2
- letta/types/letta_schemas_openai_chat_completions_tool_call_function.py +2 -2
- letta/types/letta_schemas_openai_chat_completions_tool_call_input.py +2 -2
- letta/types/letta_schemas_openai_chat_completions_tool_call_output.py +2 -2
- letta/types/letta_schemas_tool_tool.py +14 -13
- letta/types/letta_usage_statistics.py +6 -7
- letta/types/llm_config.py +9 -9
- letta/types/local_sandbox_config.py +2 -2
- letta/types/log_prob_token.py +2 -2
- letta/types/memory.py +2 -2
- letta/types/message_content_log_prob.py +2 -2
- letta/types/message_create.py +2 -2
- letta/types/not_found_error_body.py +2 -2
- letta/types/open_ai_assistant.py +2 -2
- letta/types/organization.py +2 -2
- letta/types/organization_create.py +2 -2
- letta/types/passage.py +10 -15
- letta/types/provider.py +38 -0
- letta/types/reasoning_message.py +6 -7
- letta/types/recall_memory_summary.py +2 -2
- letta/types/response_format.py +2 -2
- letta/types/sandbox_config.py +2 -7
- letta/types/sandbox_config_create.py +2 -2
- letta/types/sandbox_config_update.py +2 -2
- letta/types/sandbox_environment_variable.py +2 -7
- letta/types/sandbox_environment_variable_create.py +2 -2
- letta/types/sandbox_environment_variable_update.py +2 -6
- letta/types/source.py +8 -13
- letta/types/system_message_input.py +2 -2
- letta/types/system_message_output.py +6 -7
- letta/types/terminal_tool_rule.py +2 -2
- letta/types/tool_call_delta.py +2 -2
- letta/types/tool_call_function_output.py +2 -2
- letta/types/tool_call_message.py +6 -7
- letta/types/tool_create.py +2 -2
- letta/types/tool_function_choice.py +2 -2
- letta/types/tool_input.py +2 -2
- letta/types/tool_message.py +2 -2
- letta/types/tool_return_message.py +10 -11
- letta/types/tool_type.py +5 -0
- letta/types/usage_statistics.py +2 -2
- letta/types/user.py +5 -10
- letta/types/user_create.py +2 -7
- letta/types/user_message_input.py +2 -2
- letta/types/user_message_output.py +6 -7
- letta/types/user_update.py +2 -7
- letta/types/validation_error.py +2 -2
- {letta_client-0.1.4.dist-info → letta_client-0.1.9.dist-info}/METADATA +1 -1
- letta_client-0.1.9.dist-info/RECORD +200 -0
- letta/agents/memory/__init__.py +0 -5
- letta/agents/memory/messages/client.py +0 -147
- letta/agents/memory_blocks/client.py +0 -364
- letta/agents/types/agents_search_deployed_agents_request_combinator.py +0 -5
- letta/agents/types/agents_search_deployed_agents_request_search_item.py +0 -16
- letta/agents/types/agents_search_deployed_agents_request_search_item_direction.py +0 -27
- letta/agents/types/agents_search_deployed_agents_request_search_item_direction_direction.py +0 -5
- letta/agents/types/agents_search_deployed_agents_request_search_item_direction_value.py +0 -7
- letta/agents/types/agents_search_deployed_agents_request_search_item_operator.py +0 -24
- letta/agents/types/agents_search_deployed_agents_request_search_item_operator_operator.py +0 -7
- letta_client-0.1.4.dist-info/RECORD +0 -191
- /letta/agents/{memory/messages → core_memory}/__init__.py +0 -0
- /letta/{agents/memory_blocks → providers}/__init__.py +0 -0
- {letta_client-0.1.4.dist-info → letta_client-0.1.9.dist-info}/WHEEL +0 -0
letta/tools/client.py
CHANGED
|
@@ -5,7 +5,7 @@ from ..core.client_wrapper import SyncClientWrapper
|
|
|
5
5
|
from ..core.request_options import RequestOptions
|
|
6
6
|
from ..types.letta_schemas_tool_tool import LettaSchemasToolTool
|
|
7
7
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
8
|
-
from ..core.
|
|
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
|
|
@@ -59,7 +59,7 @@ class ToolsClient:
|
|
|
59
59
|
if 200 <= _response.status_code < 300:
|
|
60
60
|
return typing.cast(
|
|
61
61
|
LettaSchemasToolTool,
|
|
62
|
-
|
|
62
|
+
construct_type(
|
|
63
63
|
type_=LettaSchemasToolTool, # type: ignore
|
|
64
64
|
object_=_response.json(),
|
|
65
65
|
),
|
|
@@ -68,7 +68,7 @@ class ToolsClient:
|
|
|
68
68
|
raise UnprocessableEntityError(
|
|
69
69
|
typing.cast(
|
|
70
70
|
HttpValidationError,
|
|
71
|
-
|
|
71
|
+
construct_type(
|
|
72
72
|
type_=HttpValidationError, # type: ignore
|
|
73
73
|
object_=_response.json(),
|
|
74
74
|
),
|
|
@@ -117,7 +117,7 @@ class ToolsClient:
|
|
|
117
117
|
if 200 <= _response.status_code < 300:
|
|
118
118
|
return typing.cast(
|
|
119
119
|
typing.Optional[typing.Any],
|
|
120
|
-
|
|
120
|
+
construct_type(
|
|
121
121
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
122
122
|
object_=_response.json(),
|
|
123
123
|
),
|
|
@@ -126,7 +126,7 @@ class ToolsClient:
|
|
|
126
126
|
raise UnprocessableEntityError(
|
|
127
127
|
typing.cast(
|
|
128
128
|
HttpValidationError,
|
|
129
|
-
|
|
129
|
+
construct_type(
|
|
130
130
|
type_=HttpValidationError, # type: ignore
|
|
131
131
|
object_=_response.json(),
|
|
132
132
|
),
|
|
@@ -148,6 +148,7 @@ class ToolsClient:
|
|
|
148
148
|
source_code: typing.Optional[str] = OMIT,
|
|
149
149
|
source_type: typing.Optional[str] = OMIT,
|
|
150
150
|
json_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
151
|
+
return_char_limit: typing.Optional[int] = OMIT,
|
|
151
152
|
request_options: typing.Optional[RequestOptions] = None,
|
|
152
153
|
) -> LettaSchemasToolTool:
|
|
153
154
|
"""
|
|
@@ -178,6 +179,9 @@ class ToolsClient:
|
|
|
178
179
|
json_schema : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
179
180
|
The JSON schema of the function (auto-generated from source_code if not provided)
|
|
180
181
|
|
|
182
|
+
return_char_limit : typing.Optional[int]
|
|
183
|
+
The maximum number of characters in the response.
|
|
184
|
+
|
|
181
185
|
request_options : typing.Optional[RequestOptions]
|
|
182
186
|
Request-specific configuration.
|
|
183
187
|
|
|
@@ -208,6 +212,7 @@ class ToolsClient:
|
|
|
208
212
|
"source_code": source_code,
|
|
209
213
|
"source_type": source_type,
|
|
210
214
|
"json_schema": json_schema,
|
|
215
|
+
"return_char_limit": return_char_limit,
|
|
211
216
|
},
|
|
212
217
|
headers={
|
|
213
218
|
"content-type": "application/json",
|
|
@@ -219,7 +224,7 @@ class ToolsClient:
|
|
|
219
224
|
if 200 <= _response.status_code < 300:
|
|
220
225
|
return typing.cast(
|
|
221
226
|
LettaSchemasToolTool,
|
|
222
|
-
|
|
227
|
+
construct_type(
|
|
223
228
|
type_=LettaSchemasToolTool, # type: ignore
|
|
224
229
|
object_=_response.json(),
|
|
225
230
|
),
|
|
@@ -228,7 +233,7 @@ class ToolsClient:
|
|
|
228
233
|
raise UnprocessableEntityError(
|
|
229
234
|
typing.cast(
|
|
230
235
|
HttpValidationError,
|
|
231
|
-
|
|
236
|
+
construct_type(
|
|
232
237
|
type_=HttpValidationError, # type: ignore
|
|
233
238
|
object_=_response.json(),
|
|
234
239
|
),
|
|
@@ -275,7 +280,7 @@ class ToolsClient:
|
|
|
275
280
|
if 200 <= _response.status_code < 300:
|
|
276
281
|
return typing.cast(
|
|
277
282
|
str,
|
|
278
|
-
|
|
283
|
+
construct_type(
|
|
279
284
|
type_=str, # type: ignore
|
|
280
285
|
object_=_response.json(),
|
|
281
286
|
),
|
|
@@ -284,7 +289,7 @@ class ToolsClient:
|
|
|
284
289
|
raise UnprocessableEntityError(
|
|
285
290
|
typing.cast(
|
|
286
291
|
HttpValidationError,
|
|
287
|
-
|
|
292
|
+
construct_type(
|
|
288
293
|
type_=HttpValidationError, # type: ignore
|
|
289
294
|
object_=_response.json(),
|
|
290
295
|
),
|
|
@@ -341,7 +346,7 @@ class ToolsClient:
|
|
|
341
346
|
if 200 <= _response.status_code < 300:
|
|
342
347
|
return typing.cast(
|
|
343
348
|
typing.List[LettaSchemasToolTool],
|
|
344
|
-
|
|
349
|
+
construct_type(
|
|
345
350
|
type_=typing.List[LettaSchemasToolTool], # type: ignore
|
|
346
351
|
object_=_response.json(),
|
|
347
352
|
),
|
|
@@ -350,7 +355,7 @@ class ToolsClient:
|
|
|
350
355
|
raise UnprocessableEntityError(
|
|
351
356
|
typing.cast(
|
|
352
357
|
HttpValidationError,
|
|
353
|
-
|
|
358
|
+
construct_type(
|
|
354
359
|
type_=HttpValidationError, # type: ignore
|
|
355
360
|
object_=_response.json(),
|
|
356
361
|
),
|
|
@@ -442,7 +447,7 @@ class ToolsClient:
|
|
|
442
447
|
if 200 <= _response.status_code < 300:
|
|
443
448
|
return typing.cast(
|
|
444
449
|
LettaSchemasToolTool,
|
|
445
|
-
|
|
450
|
+
construct_type(
|
|
446
451
|
type_=LettaSchemasToolTool, # type: ignore
|
|
447
452
|
object_=_response.json(),
|
|
448
453
|
),
|
|
@@ -451,7 +456,7 @@ class ToolsClient:
|
|
|
451
456
|
raise UnprocessableEntityError(
|
|
452
457
|
typing.cast(
|
|
453
458
|
HttpValidationError,
|
|
454
|
-
|
|
459
|
+
construct_type(
|
|
455
460
|
type_=HttpValidationError, # type: ignore
|
|
456
461
|
object_=_response.json(),
|
|
457
462
|
),
|
|
@@ -543,7 +548,7 @@ class ToolsClient:
|
|
|
543
548
|
if 200 <= _response.status_code < 300:
|
|
544
549
|
return typing.cast(
|
|
545
550
|
LettaSchemasToolTool,
|
|
546
|
-
|
|
551
|
+
construct_type(
|
|
547
552
|
type_=LettaSchemasToolTool, # type: ignore
|
|
548
553
|
object_=_response.json(),
|
|
549
554
|
),
|
|
@@ -552,7 +557,7 @@ class ToolsClient:
|
|
|
552
557
|
raise UnprocessableEntityError(
|
|
553
558
|
typing.cast(
|
|
554
559
|
HttpValidationError,
|
|
555
|
-
|
|
560
|
+
construct_type(
|
|
556
561
|
type_=HttpValidationError, # type: ignore
|
|
557
562
|
object_=_response.json(),
|
|
558
563
|
),
|
|
@@ -597,7 +602,7 @@ class ToolsClient:
|
|
|
597
602
|
if 200 <= _response.status_code < 300:
|
|
598
603
|
return typing.cast(
|
|
599
604
|
typing.List[LettaSchemasToolTool],
|
|
600
|
-
|
|
605
|
+
construct_type(
|
|
601
606
|
type_=typing.List[LettaSchemasToolTool], # type: ignore
|
|
602
607
|
object_=_response.json(),
|
|
603
608
|
),
|
|
@@ -606,7 +611,7 @@ class ToolsClient:
|
|
|
606
611
|
raise UnprocessableEntityError(
|
|
607
612
|
typing.cast(
|
|
608
613
|
HttpValidationError,
|
|
609
|
-
|
|
614
|
+
construct_type(
|
|
610
615
|
type_=HttpValidationError, # type: ignore
|
|
611
616
|
object_=_response.json(),
|
|
612
617
|
),
|
|
@@ -621,7 +626,8 @@ class ToolsClient:
|
|
|
621
626
|
self,
|
|
622
627
|
*,
|
|
623
628
|
source_code: str,
|
|
624
|
-
args: str,
|
|
629
|
+
args: typing.Dict[str, str],
|
|
630
|
+
env_vars: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
625
631
|
name: typing.Optional[str] = OMIT,
|
|
626
632
|
source_type: typing.Optional[str] = OMIT,
|
|
627
633
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -634,8 +640,11 @@ class ToolsClient:
|
|
|
634
640
|
source_code : str
|
|
635
641
|
The source code of the function.
|
|
636
642
|
|
|
637
|
-
args : str
|
|
638
|
-
The arguments to pass to the tool
|
|
643
|
+
args : typing.Dict[str, str]
|
|
644
|
+
The arguments to pass to the tool.
|
|
645
|
+
|
|
646
|
+
env_vars : typing.Optional[typing.Dict[str, str]]
|
|
647
|
+
The environment variables to pass to the tool.
|
|
639
648
|
|
|
640
649
|
name : typing.Optional[str]
|
|
641
650
|
The name of the tool to run.
|
|
@@ -660,7 +669,7 @@ class ToolsClient:
|
|
|
660
669
|
)
|
|
661
670
|
client.tools.run_tool_from_source(
|
|
662
671
|
source_code="source_code",
|
|
663
|
-
args="
|
|
672
|
+
args={"key": "value"},
|
|
664
673
|
)
|
|
665
674
|
"""
|
|
666
675
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -669,6 +678,7 @@ class ToolsClient:
|
|
|
669
678
|
json={
|
|
670
679
|
"source_code": source_code,
|
|
671
680
|
"args": args,
|
|
681
|
+
"env_vars": env_vars,
|
|
672
682
|
"name": name,
|
|
673
683
|
"source_type": source_type,
|
|
674
684
|
},
|
|
@@ -682,7 +692,7 @@ class ToolsClient:
|
|
|
682
692
|
if 200 <= _response.status_code < 300:
|
|
683
693
|
return typing.cast(
|
|
684
694
|
ToolReturnMessage,
|
|
685
|
-
|
|
695
|
+
construct_type(
|
|
686
696
|
type_=ToolReturnMessage, # type: ignore
|
|
687
697
|
object_=_response.json(),
|
|
688
698
|
),
|
|
@@ -691,7 +701,7 @@ class ToolsClient:
|
|
|
691
701
|
raise UnprocessableEntityError(
|
|
692
702
|
typing.cast(
|
|
693
703
|
HttpValidationError,
|
|
694
|
-
|
|
704
|
+
construct_type(
|
|
695
705
|
type_=HttpValidationError, # type: ignore
|
|
696
706
|
object_=_response.json(),
|
|
697
707
|
),
|
|
@@ -734,7 +744,7 @@ class ToolsClient:
|
|
|
734
744
|
if 200 <= _response.status_code < 300:
|
|
735
745
|
return typing.cast(
|
|
736
746
|
typing.List[AppModel],
|
|
737
|
-
|
|
747
|
+
construct_type(
|
|
738
748
|
type_=typing.List[AppModel], # type: ignore
|
|
739
749
|
object_=_response.json(),
|
|
740
750
|
),
|
|
@@ -743,7 +753,7 @@ class ToolsClient:
|
|
|
743
753
|
raise UnprocessableEntityError(
|
|
744
754
|
typing.cast(
|
|
745
755
|
HttpValidationError,
|
|
746
|
-
|
|
756
|
+
construct_type(
|
|
747
757
|
type_=HttpValidationError, # type: ignore
|
|
748
758
|
object_=_response.json(),
|
|
749
759
|
),
|
|
@@ -792,7 +802,7 @@ class ToolsClient:
|
|
|
792
802
|
if 200 <= _response.status_code < 300:
|
|
793
803
|
return typing.cast(
|
|
794
804
|
typing.List[ActionModel],
|
|
795
|
-
|
|
805
|
+
construct_type(
|
|
796
806
|
type_=typing.List[ActionModel], # type: ignore
|
|
797
807
|
object_=_response.json(),
|
|
798
808
|
),
|
|
@@ -801,7 +811,7 @@ class ToolsClient:
|
|
|
801
811
|
raise UnprocessableEntityError(
|
|
802
812
|
typing.cast(
|
|
803
813
|
HttpValidationError,
|
|
804
|
-
|
|
814
|
+
construct_type(
|
|
805
815
|
type_=HttpValidationError, # type: ignore
|
|
806
816
|
object_=_response.json(),
|
|
807
817
|
),
|
|
@@ -850,7 +860,7 @@ class ToolsClient:
|
|
|
850
860
|
if 200 <= _response.status_code < 300:
|
|
851
861
|
return typing.cast(
|
|
852
862
|
LettaSchemasToolTool,
|
|
853
|
-
|
|
863
|
+
construct_type(
|
|
854
864
|
type_=LettaSchemasToolTool, # type: ignore
|
|
855
865
|
object_=_response.json(),
|
|
856
866
|
),
|
|
@@ -859,7 +869,7 @@ class ToolsClient:
|
|
|
859
869
|
raise UnprocessableEntityError(
|
|
860
870
|
typing.cast(
|
|
861
871
|
HttpValidationError,
|
|
862
|
-
|
|
872
|
+
construct_type(
|
|
863
873
|
type_=HttpValidationError, # type: ignore
|
|
864
874
|
object_=_response.json(),
|
|
865
875
|
),
|
|
@@ -921,7 +931,7 @@ class AsyncToolsClient:
|
|
|
921
931
|
if 200 <= _response.status_code < 300:
|
|
922
932
|
return typing.cast(
|
|
923
933
|
LettaSchemasToolTool,
|
|
924
|
-
|
|
934
|
+
construct_type(
|
|
925
935
|
type_=LettaSchemasToolTool, # type: ignore
|
|
926
936
|
object_=_response.json(),
|
|
927
937
|
),
|
|
@@ -930,7 +940,7 @@ class AsyncToolsClient:
|
|
|
930
940
|
raise UnprocessableEntityError(
|
|
931
941
|
typing.cast(
|
|
932
942
|
HttpValidationError,
|
|
933
|
-
|
|
943
|
+
construct_type(
|
|
934
944
|
type_=HttpValidationError, # type: ignore
|
|
935
945
|
object_=_response.json(),
|
|
936
946
|
),
|
|
@@ -987,7 +997,7 @@ class AsyncToolsClient:
|
|
|
987
997
|
if 200 <= _response.status_code < 300:
|
|
988
998
|
return typing.cast(
|
|
989
999
|
typing.Optional[typing.Any],
|
|
990
|
-
|
|
1000
|
+
construct_type(
|
|
991
1001
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
992
1002
|
object_=_response.json(),
|
|
993
1003
|
),
|
|
@@ -996,7 +1006,7 @@ class AsyncToolsClient:
|
|
|
996
1006
|
raise UnprocessableEntityError(
|
|
997
1007
|
typing.cast(
|
|
998
1008
|
HttpValidationError,
|
|
999
|
-
|
|
1009
|
+
construct_type(
|
|
1000
1010
|
type_=HttpValidationError, # type: ignore
|
|
1001
1011
|
object_=_response.json(),
|
|
1002
1012
|
),
|
|
@@ -1018,6 +1028,7 @@ class AsyncToolsClient:
|
|
|
1018
1028
|
source_code: typing.Optional[str] = OMIT,
|
|
1019
1029
|
source_type: typing.Optional[str] = OMIT,
|
|
1020
1030
|
json_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
1031
|
+
return_char_limit: typing.Optional[int] = OMIT,
|
|
1021
1032
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1022
1033
|
) -> LettaSchemasToolTool:
|
|
1023
1034
|
"""
|
|
@@ -1048,6 +1059,9 @@ class AsyncToolsClient:
|
|
|
1048
1059
|
json_schema : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1049
1060
|
The JSON schema of the function (auto-generated from source_code if not provided)
|
|
1050
1061
|
|
|
1062
|
+
return_char_limit : typing.Optional[int]
|
|
1063
|
+
The maximum number of characters in the response.
|
|
1064
|
+
|
|
1051
1065
|
request_options : typing.Optional[RequestOptions]
|
|
1052
1066
|
Request-specific configuration.
|
|
1053
1067
|
|
|
@@ -1086,6 +1100,7 @@ class AsyncToolsClient:
|
|
|
1086
1100
|
"source_code": source_code,
|
|
1087
1101
|
"source_type": source_type,
|
|
1088
1102
|
"json_schema": json_schema,
|
|
1103
|
+
"return_char_limit": return_char_limit,
|
|
1089
1104
|
},
|
|
1090
1105
|
headers={
|
|
1091
1106
|
"content-type": "application/json",
|
|
@@ -1097,7 +1112,7 @@ class AsyncToolsClient:
|
|
|
1097
1112
|
if 200 <= _response.status_code < 300:
|
|
1098
1113
|
return typing.cast(
|
|
1099
1114
|
LettaSchemasToolTool,
|
|
1100
|
-
|
|
1115
|
+
construct_type(
|
|
1101
1116
|
type_=LettaSchemasToolTool, # type: ignore
|
|
1102
1117
|
object_=_response.json(),
|
|
1103
1118
|
),
|
|
@@ -1106,7 +1121,7 @@ class AsyncToolsClient:
|
|
|
1106
1121
|
raise UnprocessableEntityError(
|
|
1107
1122
|
typing.cast(
|
|
1108
1123
|
HttpValidationError,
|
|
1109
|
-
|
|
1124
|
+
construct_type(
|
|
1110
1125
|
type_=HttpValidationError, # type: ignore
|
|
1111
1126
|
object_=_response.json(),
|
|
1112
1127
|
),
|
|
@@ -1161,7 +1176,7 @@ class AsyncToolsClient:
|
|
|
1161
1176
|
if 200 <= _response.status_code < 300:
|
|
1162
1177
|
return typing.cast(
|
|
1163
1178
|
str,
|
|
1164
|
-
|
|
1179
|
+
construct_type(
|
|
1165
1180
|
type_=str, # type: ignore
|
|
1166
1181
|
object_=_response.json(),
|
|
1167
1182
|
),
|
|
@@ -1170,7 +1185,7 @@ class AsyncToolsClient:
|
|
|
1170
1185
|
raise UnprocessableEntityError(
|
|
1171
1186
|
typing.cast(
|
|
1172
1187
|
HttpValidationError,
|
|
1173
|
-
|
|
1188
|
+
construct_type(
|
|
1174
1189
|
type_=HttpValidationError, # type: ignore
|
|
1175
1190
|
object_=_response.json(),
|
|
1176
1191
|
),
|
|
@@ -1235,7 +1250,7 @@ class AsyncToolsClient:
|
|
|
1235
1250
|
if 200 <= _response.status_code < 300:
|
|
1236
1251
|
return typing.cast(
|
|
1237
1252
|
typing.List[LettaSchemasToolTool],
|
|
1238
|
-
|
|
1253
|
+
construct_type(
|
|
1239
1254
|
type_=typing.List[LettaSchemasToolTool], # type: ignore
|
|
1240
1255
|
object_=_response.json(),
|
|
1241
1256
|
),
|
|
@@ -1244,7 +1259,7 @@ class AsyncToolsClient:
|
|
|
1244
1259
|
raise UnprocessableEntityError(
|
|
1245
1260
|
typing.cast(
|
|
1246
1261
|
HttpValidationError,
|
|
1247
|
-
|
|
1262
|
+
construct_type(
|
|
1248
1263
|
type_=HttpValidationError, # type: ignore
|
|
1249
1264
|
object_=_response.json(),
|
|
1250
1265
|
),
|
|
@@ -1344,7 +1359,7 @@ class AsyncToolsClient:
|
|
|
1344
1359
|
if 200 <= _response.status_code < 300:
|
|
1345
1360
|
return typing.cast(
|
|
1346
1361
|
LettaSchemasToolTool,
|
|
1347
|
-
|
|
1362
|
+
construct_type(
|
|
1348
1363
|
type_=LettaSchemasToolTool, # type: ignore
|
|
1349
1364
|
object_=_response.json(),
|
|
1350
1365
|
),
|
|
@@ -1353,7 +1368,7 @@ class AsyncToolsClient:
|
|
|
1353
1368
|
raise UnprocessableEntityError(
|
|
1354
1369
|
typing.cast(
|
|
1355
1370
|
HttpValidationError,
|
|
1356
|
-
|
|
1371
|
+
construct_type(
|
|
1357
1372
|
type_=HttpValidationError, # type: ignore
|
|
1358
1373
|
object_=_response.json(),
|
|
1359
1374
|
),
|
|
@@ -1453,7 +1468,7 @@ class AsyncToolsClient:
|
|
|
1453
1468
|
if 200 <= _response.status_code < 300:
|
|
1454
1469
|
return typing.cast(
|
|
1455
1470
|
LettaSchemasToolTool,
|
|
1456
|
-
|
|
1471
|
+
construct_type(
|
|
1457
1472
|
type_=LettaSchemasToolTool, # type: ignore
|
|
1458
1473
|
object_=_response.json(),
|
|
1459
1474
|
),
|
|
@@ -1462,7 +1477,7 @@ class AsyncToolsClient:
|
|
|
1462
1477
|
raise UnprocessableEntityError(
|
|
1463
1478
|
typing.cast(
|
|
1464
1479
|
HttpValidationError,
|
|
1465
|
-
|
|
1480
|
+
construct_type(
|
|
1466
1481
|
type_=HttpValidationError, # type: ignore
|
|
1467
1482
|
object_=_response.json(),
|
|
1468
1483
|
),
|
|
@@ -1515,7 +1530,7 @@ class AsyncToolsClient:
|
|
|
1515
1530
|
if 200 <= _response.status_code < 300:
|
|
1516
1531
|
return typing.cast(
|
|
1517
1532
|
typing.List[LettaSchemasToolTool],
|
|
1518
|
-
|
|
1533
|
+
construct_type(
|
|
1519
1534
|
type_=typing.List[LettaSchemasToolTool], # type: ignore
|
|
1520
1535
|
object_=_response.json(),
|
|
1521
1536
|
),
|
|
@@ -1524,7 +1539,7 @@ class AsyncToolsClient:
|
|
|
1524
1539
|
raise UnprocessableEntityError(
|
|
1525
1540
|
typing.cast(
|
|
1526
1541
|
HttpValidationError,
|
|
1527
|
-
|
|
1542
|
+
construct_type(
|
|
1528
1543
|
type_=HttpValidationError, # type: ignore
|
|
1529
1544
|
object_=_response.json(),
|
|
1530
1545
|
),
|
|
@@ -1539,7 +1554,8 @@ class AsyncToolsClient:
|
|
|
1539
1554
|
self,
|
|
1540
1555
|
*,
|
|
1541
1556
|
source_code: str,
|
|
1542
|
-
args: str,
|
|
1557
|
+
args: typing.Dict[str, str],
|
|
1558
|
+
env_vars: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
1543
1559
|
name: typing.Optional[str] = OMIT,
|
|
1544
1560
|
source_type: typing.Optional[str] = OMIT,
|
|
1545
1561
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -1552,8 +1568,11 @@ class AsyncToolsClient:
|
|
|
1552
1568
|
source_code : str
|
|
1553
1569
|
The source code of the function.
|
|
1554
1570
|
|
|
1555
|
-
args : str
|
|
1556
|
-
The arguments to pass to the tool
|
|
1571
|
+
args : typing.Dict[str, str]
|
|
1572
|
+
The arguments to pass to the tool.
|
|
1573
|
+
|
|
1574
|
+
env_vars : typing.Optional[typing.Dict[str, str]]
|
|
1575
|
+
The environment variables to pass to the tool.
|
|
1557
1576
|
|
|
1558
1577
|
name : typing.Optional[str]
|
|
1559
1578
|
The name of the tool to run.
|
|
@@ -1583,7 +1602,7 @@ class AsyncToolsClient:
|
|
|
1583
1602
|
async def main() -> None:
|
|
1584
1603
|
await client.tools.run_tool_from_source(
|
|
1585
1604
|
source_code="source_code",
|
|
1586
|
-
args="
|
|
1605
|
+
args={"key": "value"},
|
|
1587
1606
|
)
|
|
1588
1607
|
|
|
1589
1608
|
|
|
@@ -1595,6 +1614,7 @@ class AsyncToolsClient:
|
|
|
1595
1614
|
json={
|
|
1596
1615
|
"source_code": source_code,
|
|
1597
1616
|
"args": args,
|
|
1617
|
+
"env_vars": env_vars,
|
|
1598
1618
|
"name": name,
|
|
1599
1619
|
"source_type": source_type,
|
|
1600
1620
|
},
|
|
@@ -1608,7 +1628,7 @@ class AsyncToolsClient:
|
|
|
1608
1628
|
if 200 <= _response.status_code < 300:
|
|
1609
1629
|
return typing.cast(
|
|
1610
1630
|
ToolReturnMessage,
|
|
1611
|
-
|
|
1631
|
+
construct_type(
|
|
1612
1632
|
type_=ToolReturnMessage, # type: ignore
|
|
1613
1633
|
object_=_response.json(),
|
|
1614
1634
|
),
|
|
@@ -1617,7 +1637,7 @@ class AsyncToolsClient:
|
|
|
1617
1637
|
raise UnprocessableEntityError(
|
|
1618
1638
|
typing.cast(
|
|
1619
1639
|
HttpValidationError,
|
|
1620
|
-
|
|
1640
|
+
construct_type(
|
|
1621
1641
|
type_=HttpValidationError, # type: ignore
|
|
1622
1642
|
object_=_response.json(),
|
|
1623
1643
|
),
|
|
@@ -1670,7 +1690,7 @@ class AsyncToolsClient:
|
|
|
1670
1690
|
if 200 <= _response.status_code < 300:
|
|
1671
1691
|
return typing.cast(
|
|
1672
1692
|
typing.List[AppModel],
|
|
1673
|
-
|
|
1693
|
+
construct_type(
|
|
1674
1694
|
type_=typing.List[AppModel], # type: ignore
|
|
1675
1695
|
object_=_response.json(),
|
|
1676
1696
|
),
|
|
@@ -1679,7 +1699,7 @@ class AsyncToolsClient:
|
|
|
1679
1699
|
raise UnprocessableEntityError(
|
|
1680
1700
|
typing.cast(
|
|
1681
1701
|
HttpValidationError,
|
|
1682
|
-
|
|
1702
|
+
construct_type(
|
|
1683
1703
|
type_=HttpValidationError, # type: ignore
|
|
1684
1704
|
object_=_response.json(),
|
|
1685
1705
|
),
|
|
@@ -1736,7 +1756,7 @@ class AsyncToolsClient:
|
|
|
1736
1756
|
if 200 <= _response.status_code < 300:
|
|
1737
1757
|
return typing.cast(
|
|
1738
1758
|
typing.List[ActionModel],
|
|
1739
|
-
|
|
1759
|
+
construct_type(
|
|
1740
1760
|
type_=typing.List[ActionModel], # type: ignore
|
|
1741
1761
|
object_=_response.json(),
|
|
1742
1762
|
),
|
|
@@ -1745,7 +1765,7 @@ class AsyncToolsClient:
|
|
|
1745
1765
|
raise UnprocessableEntityError(
|
|
1746
1766
|
typing.cast(
|
|
1747
1767
|
HttpValidationError,
|
|
1748
|
-
|
|
1768
|
+
construct_type(
|
|
1749
1769
|
type_=HttpValidationError, # type: ignore
|
|
1750
1770
|
object_=_response.json(),
|
|
1751
1771
|
),
|
|
@@ -1802,7 +1822,7 @@ class AsyncToolsClient:
|
|
|
1802
1822
|
if 200 <= _response.status_code < 300:
|
|
1803
1823
|
return typing.cast(
|
|
1804
1824
|
LettaSchemasToolTool,
|
|
1805
|
-
|
|
1825
|
+
construct_type(
|
|
1806
1826
|
type_=LettaSchemasToolTool, # type: ignore
|
|
1807
1827
|
object_=_response.json(),
|
|
1808
1828
|
),
|
|
@@ -1811,7 +1831,7 @@ class AsyncToolsClient:
|
|
|
1811
1831
|
raise UnprocessableEntityError(
|
|
1812
1832
|
typing.cast(
|
|
1813
1833
|
HttpValidationError,
|
|
1814
|
-
|
|
1834
|
+
construct_type(
|
|
1815
1835
|
type_=HttpValidationError, # type: ignore
|
|
1816
1836
|
object_=_response.json(),
|
|
1817
1837
|
),
|
letta/types/__init__.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from .action_model import ActionModel
|
|
4
4
|
from .action_parameters_model import ActionParametersModel
|
|
5
5
|
from .action_response_model import ActionResponseModel
|
|
6
|
+
from .agent_environment_variable import AgentEnvironmentVariable
|
|
6
7
|
from .agent_state import AgentState
|
|
7
8
|
from .agent_state_tool_rules_item import AgentStateToolRulesItem
|
|
8
9
|
from .agent_type import AgentType
|
|
@@ -49,6 +50,15 @@ from .job import Job
|
|
|
49
50
|
from .job_status import JobStatus
|
|
50
51
|
from .letta_request import LettaRequest
|
|
51
52
|
from .letta_response import LettaResponse
|
|
53
|
+
from .letta_response_messages_item import (
|
|
54
|
+
LettaResponseMessagesItem,
|
|
55
|
+
LettaResponseMessagesItem_AssistantMessage,
|
|
56
|
+
LettaResponseMessagesItem_ReasoningMessage,
|
|
57
|
+
LettaResponseMessagesItem_SystemMessage,
|
|
58
|
+
LettaResponseMessagesItem_ToolCallMessage,
|
|
59
|
+
LettaResponseMessagesItem_ToolReturnMessage,
|
|
60
|
+
LettaResponseMessagesItem_UserMessage,
|
|
61
|
+
)
|
|
52
62
|
from .letta_schemas_letta_message_tool_call import LettaSchemasLettaMessageToolCall
|
|
53
63
|
from .letta_schemas_message_message import LettaSchemasMessageMessage
|
|
54
64
|
from .letta_schemas_openai_chat_completion_request_tool import LettaSchemasOpenaiChatCompletionRequestTool
|
|
@@ -78,6 +88,7 @@ from .open_ai_assistant import OpenAiAssistant
|
|
|
78
88
|
from .organization import Organization
|
|
79
89
|
from .organization_create import OrganizationCreate
|
|
80
90
|
from .passage import Passage
|
|
91
|
+
from .provider import Provider
|
|
81
92
|
from .reasoning_message import ReasoningMessage
|
|
82
93
|
from .recall_memory_summary import RecallMemorySummary
|
|
83
94
|
from .response_format import ResponseFormat
|
|
@@ -105,6 +116,7 @@ from .tool_message import ToolMessage
|
|
|
105
116
|
from .tool_return_message import ToolReturnMessage
|
|
106
117
|
from .tool_return_message_status import ToolReturnMessageStatus
|
|
107
118
|
from .tool_rule_type import ToolRuleType
|
|
119
|
+
from .tool_type import ToolType
|
|
108
120
|
from .usage_statistics import UsageStatistics
|
|
109
121
|
from .user import User
|
|
110
122
|
from .user_create import UserCreate
|
|
@@ -119,6 +131,7 @@ __all__ = [
|
|
|
119
131
|
"ActionModel",
|
|
120
132
|
"ActionParametersModel",
|
|
121
133
|
"ActionResponseModel",
|
|
134
|
+
"AgentEnvironmentVariable",
|
|
122
135
|
"AgentState",
|
|
123
136
|
"AgentStateToolRulesItem",
|
|
124
137
|
"AgentType",
|
|
@@ -165,6 +178,13 @@ __all__ = [
|
|
|
165
178
|
"JobStatus",
|
|
166
179
|
"LettaRequest",
|
|
167
180
|
"LettaResponse",
|
|
181
|
+
"LettaResponseMessagesItem",
|
|
182
|
+
"LettaResponseMessagesItem_AssistantMessage",
|
|
183
|
+
"LettaResponseMessagesItem_ReasoningMessage",
|
|
184
|
+
"LettaResponseMessagesItem_SystemMessage",
|
|
185
|
+
"LettaResponseMessagesItem_ToolCallMessage",
|
|
186
|
+
"LettaResponseMessagesItem_ToolReturnMessage",
|
|
187
|
+
"LettaResponseMessagesItem_UserMessage",
|
|
168
188
|
"LettaSchemasLettaMessageToolCall",
|
|
169
189
|
"LettaSchemasMessageMessage",
|
|
170
190
|
"LettaSchemasOpenaiChatCompletionRequestTool",
|
|
@@ -192,6 +212,7 @@ __all__ = [
|
|
|
192
212
|
"Organization",
|
|
193
213
|
"OrganizationCreate",
|
|
194
214
|
"Passage",
|
|
215
|
+
"Provider",
|
|
195
216
|
"ReasoningMessage",
|
|
196
217
|
"RecallMemorySummary",
|
|
197
218
|
"ResponseFormat",
|
|
@@ -219,6 +240,7 @@ __all__ = [
|
|
|
219
240
|
"ToolReturnMessage",
|
|
220
241
|
"ToolReturnMessageStatus",
|
|
221
242
|
"ToolRuleType",
|
|
243
|
+
"ToolType",
|
|
222
244
|
"UsageStatistics",
|
|
223
245
|
"User",
|
|
224
246
|
"UserCreate",
|
letta/types/action_model.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
4
|
import typing
|
|
5
5
|
from .action_parameters_model import ActionParametersModel
|
|
6
6
|
from .action_response_model import ActionResponseModel
|
|
@@ -10,7 +10,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
|
10
10
|
import pydantic
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
class ActionModel(
|
|
13
|
+
class ActionModel(UncheckedBaseModel):
|
|
14
14
|
"""
|
|
15
15
|
Action data model.
|
|
16
16
|
"""
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
4
|
import typing
|
|
5
5
|
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
6
|
import pydantic
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class ActionParametersModel(
|
|
9
|
+
class ActionParametersModel(UncheckedBaseModel):
|
|
10
10
|
"""
|
|
11
11
|
Action parameter data models.
|
|
12
12
|
"""
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from ..core.
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
4
|
import typing
|
|
5
5
|
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
6
|
import pydantic
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class ActionResponseModel(
|
|
9
|
+
class ActionResponseModel(UncheckedBaseModel):
|
|
10
10
|
"""
|
|
11
11
|
Action response data model.
|
|
12
12
|
"""
|