letta-client 0.1.6__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 +28 -27
- letta/agents/__init__.py +40 -29
- letta/agents/archival_memory/client.py +17 -17
- letta/agents/client.py +405 -1721
- 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/client.py +232 -17
- letta/agents/messages/types/letta_streaming_response.py +21 -16
- letta/agents/messages/types/messages_list_response_item.py +19 -14
- 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/{types/agents_migrate_response.py → templates/types/templates_migrate_response.py} +3 -3
- letta/agents/tools/client.py +13 -13
- letta/agents/types/__init__.py +23 -37
- letta/agents/types/agents_search_request_combinator.py +5 -0
- letta/agents/types/{agents_search_deployed_agents_request_search_item.py → agents_search_request_search_item.py} +17 -20
- letta/agents/types/{agents_search_deployed_agents_request_search_item_name.py → agents_search_request_search_item_name.py} +4 -6
- 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_search_deployed_agents_request_search_item_version.py → agents_search_request_search_item_version.py} +2 -2
- letta/blocks/client.py +25 -25
- letta/client.py +4 -0
- letta/core/__init__.py +4 -0
- letta/core/client_wrapper.py +1 -1
- 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 +4 -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 +2 -7
- letta/types/agent_state.py +5 -8
- 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 +2 -2
- 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 +2 -7
- 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 +2 -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 +2 -2
- 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 +2 -7
- letta/types/letta_request.py +7 -2
- letta/types/letta_response.py +2 -2
- letta/types/letta_response_messages_item.py +19 -14
- letta/types/letta_schemas_letta_message_tool_call.py +2 -2
- letta/types/letta_schemas_message_message.py +2 -7
- 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 +9 -8
- letta/types/letta_usage_statistics.py +2 -2
- letta/types/llm_config.py +2 -2
- 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 +2 -7
- letta/types/provider.py +38 -0
- letta/types/reasoning_message.py +2 -2
- 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 -2
- letta/types/source.py +2 -7
- letta/types/system_message_input.py +2 -2
- letta/types/system_message_output.py +2 -2
- 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 +2 -2
- 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 +2 -2
- letta/types/tool_type.py +5 -0
- letta/types/usage_statistics.py +2 -2
- letta/types/user.py +2 -7
- letta/types/user_create.py +2 -7
- letta/types/user_message_input.py +2 -2
- letta/types/user_message_output.py +2 -2
- letta/types/user_update.py +2 -7
- letta/types/validation_error.py +2 -2
- {letta_client-0.1.6.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_name_operator.py +0 -7
- letta/agents/types/agents_search_deployed_agents_request_search_item_order_by.py +0 -26
- letta/agents/types/agents_search_deployed_agents_request_search_item_order_by_direction.py +0 -5
- letta/agents/types/agents_search_deployed_agents_request_search_item_order_by_value.py +0 -7
- letta_client-0.1.6.dist-info/RECORD +0 -193
- /letta/agents/{memory/messages → core_memory}/__init__.py +0 -0
- /letta/{agents/memory_blocks → providers}/__init__.py +0 -0
- {letta_client-0.1.6.dist-info → letta_client-0.1.9.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import inspect
|
|
5
|
+
import typing
|
|
6
|
+
import uuid
|
|
7
|
+
|
|
8
|
+
import typing_extensions
|
|
9
|
+
from pydantic_core import PydanticUndefined
|
|
10
|
+
|
|
11
|
+
import pydantic
|
|
12
|
+
|
|
13
|
+
from .pydantic_utilities import (
|
|
14
|
+
IS_PYDANTIC_V2,
|
|
15
|
+
ModelField,
|
|
16
|
+
UniversalBaseModel,
|
|
17
|
+
get_args,
|
|
18
|
+
get_origin,
|
|
19
|
+
is_literal_type,
|
|
20
|
+
is_union,
|
|
21
|
+
parse_date,
|
|
22
|
+
parse_datetime,
|
|
23
|
+
parse_obj_as,
|
|
24
|
+
)
|
|
25
|
+
from .serialization import get_field_to_alias_mapping
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class UnionMetadata:
|
|
29
|
+
discriminant: str
|
|
30
|
+
|
|
31
|
+
def __init__(self, *, discriminant: str) -> None:
|
|
32
|
+
self.discriminant = discriminant
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Model = typing.TypeVar("Model", bound=pydantic.BaseModel)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class UncheckedBaseModel(UniversalBaseModel):
|
|
39
|
+
if IS_PYDANTIC_V2:
|
|
40
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2
|
|
41
|
+
else:
|
|
42
|
+
|
|
43
|
+
class Config:
|
|
44
|
+
extra = pydantic.Extra.allow
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def model_construct(
|
|
48
|
+
cls: typing.Type["Model"],
|
|
49
|
+
_fields_set: typing.Optional[typing.Set[str]] = None,
|
|
50
|
+
**values: typing.Any,
|
|
51
|
+
) -> "Model":
|
|
52
|
+
# Fallback construct function to the specified override below.
|
|
53
|
+
return cls.construct(_fields_set=_fields_set, **values)
|
|
54
|
+
|
|
55
|
+
# Allow construct to not validate model
|
|
56
|
+
# Implementation taken from: https://github.com/pydantic/pydantic/issues/1168#issuecomment-817742836
|
|
57
|
+
@classmethod
|
|
58
|
+
def construct(
|
|
59
|
+
cls: typing.Type["Model"],
|
|
60
|
+
_fields_set: typing.Optional[typing.Set[str]] = None,
|
|
61
|
+
**values: typing.Any,
|
|
62
|
+
) -> "Model":
|
|
63
|
+
m = cls.__new__(cls)
|
|
64
|
+
fields_values = {}
|
|
65
|
+
|
|
66
|
+
if _fields_set is None:
|
|
67
|
+
_fields_set = set(values.keys())
|
|
68
|
+
|
|
69
|
+
fields = _get_model_fields(cls)
|
|
70
|
+
populate_by_name = _get_is_populate_by_name(cls)
|
|
71
|
+
field_aliases = get_field_to_alias_mapping(cls)
|
|
72
|
+
|
|
73
|
+
for name, field in fields.items():
|
|
74
|
+
# Key here is only used to pull data from the values dict
|
|
75
|
+
# you should always use the NAME of the field to for field_values, etc.
|
|
76
|
+
# because that's how the object is constructed from a pydantic perspective
|
|
77
|
+
key = field.alias
|
|
78
|
+
if (key is None or field.alias == name) and name in field_aliases:
|
|
79
|
+
key = field_aliases[name]
|
|
80
|
+
|
|
81
|
+
if key is None or (key not in values and populate_by_name): # Added this to allow population by field name
|
|
82
|
+
key = name
|
|
83
|
+
|
|
84
|
+
if key in values:
|
|
85
|
+
if IS_PYDANTIC_V2:
|
|
86
|
+
type_ = field.annotation # type: ignore # Pydantic v2
|
|
87
|
+
else:
|
|
88
|
+
type_ = typing.cast(typing.Type, field.outer_type_) # type: ignore # Pydantic < v1.10.15
|
|
89
|
+
|
|
90
|
+
fields_values[name] = (
|
|
91
|
+
construct_type(object_=values[key], type_=type_) if type_ is not None else values[key]
|
|
92
|
+
)
|
|
93
|
+
_fields_set.add(name)
|
|
94
|
+
else:
|
|
95
|
+
default = _get_field_default(field)
|
|
96
|
+
fields_values[name] = default
|
|
97
|
+
|
|
98
|
+
# If the default values are non-null act like they've been set
|
|
99
|
+
# This effectively allows exclude_unset to work like exclude_none where
|
|
100
|
+
# the latter passes through intentionally set none values.
|
|
101
|
+
if default != None and default != PydanticUndefined:
|
|
102
|
+
_fields_set.add(name)
|
|
103
|
+
|
|
104
|
+
# Add extras back in
|
|
105
|
+
extras = {}
|
|
106
|
+
pydantic_alias_fields = [field.alias for field in fields.values()]
|
|
107
|
+
internal_alias_fields = list(field_aliases.values())
|
|
108
|
+
for key, value in values.items():
|
|
109
|
+
# If the key is not a field by name, nor an alias to a field, then it's extra
|
|
110
|
+
if (key not in pydantic_alias_fields and key not in internal_alias_fields) and key not in fields:
|
|
111
|
+
if IS_PYDANTIC_V2:
|
|
112
|
+
extras[key] = value
|
|
113
|
+
else:
|
|
114
|
+
_fields_set.add(key)
|
|
115
|
+
fields_values[key] = value
|
|
116
|
+
|
|
117
|
+
object.__setattr__(m, "__dict__", fields_values)
|
|
118
|
+
|
|
119
|
+
if IS_PYDANTIC_V2:
|
|
120
|
+
object.__setattr__(m, "__pydantic_private__", None)
|
|
121
|
+
object.__setattr__(m, "__pydantic_extra__", extras)
|
|
122
|
+
object.__setattr__(m, "__pydantic_fields_set__", _fields_set)
|
|
123
|
+
else:
|
|
124
|
+
object.__setattr__(m, "__fields_set__", _fields_set)
|
|
125
|
+
m._init_private_attributes() # type: ignore # Pydantic v1
|
|
126
|
+
return m
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _convert_undiscriminated_union_type(union_type: typing.Type[typing.Any], object_: typing.Any) -> typing.Any:
|
|
130
|
+
inner_types = get_args(union_type)
|
|
131
|
+
if typing.Any in inner_types:
|
|
132
|
+
return object_
|
|
133
|
+
|
|
134
|
+
for inner_type in inner_types:
|
|
135
|
+
try:
|
|
136
|
+
if inspect.isclass(inner_type) and issubclass(inner_type, pydantic.BaseModel):
|
|
137
|
+
# Attempt a validated parse until one works
|
|
138
|
+
return parse_obj_as(inner_type, object_)
|
|
139
|
+
except Exception:
|
|
140
|
+
continue
|
|
141
|
+
|
|
142
|
+
# If none of the types work, just return the first successful cast
|
|
143
|
+
for inner_type in inner_types:
|
|
144
|
+
try:
|
|
145
|
+
return construct_type(object_=object_, type_=inner_type)
|
|
146
|
+
except Exception:
|
|
147
|
+
continue
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def _convert_union_type(type_: typing.Type[typing.Any], object_: typing.Any) -> typing.Any:
|
|
151
|
+
base_type = get_origin(type_) or type_
|
|
152
|
+
union_type = type_
|
|
153
|
+
if base_type == typing_extensions.Annotated:
|
|
154
|
+
union_type = get_args(type_)[0]
|
|
155
|
+
annotated_metadata = get_args(type_)[1:]
|
|
156
|
+
for metadata in annotated_metadata:
|
|
157
|
+
if isinstance(metadata, UnionMetadata):
|
|
158
|
+
try:
|
|
159
|
+
# Cast to the correct type, based on the discriminant
|
|
160
|
+
for inner_type in get_args(union_type):
|
|
161
|
+
try:
|
|
162
|
+
objects_discriminant = getattr(object_, metadata.discriminant)
|
|
163
|
+
except:
|
|
164
|
+
objects_discriminant = object_[metadata.discriminant]
|
|
165
|
+
if inner_type.__fields__[metadata.discriminant].default == objects_discriminant:
|
|
166
|
+
return construct_type(object_=object_, type_=inner_type)
|
|
167
|
+
except Exception:
|
|
168
|
+
# Allow to fall through to our regular union handling
|
|
169
|
+
pass
|
|
170
|
+
return _convert_undiscriminated_union_type(union_type, object_)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def construct_type(*, type_: typing.Type[typing.Any], object_: typing.Any) -> typing.Any:
|
|
174
|
+
"""
|
|
175
|
+
Here we are essentially creating the same `construct` method in spirit as the above, but for all types, not just
|
|
176
|
+
Pydantic models.
|
|
177
|
+
The idea is to essentially attempt to coerce object_ to type_ (recursively)
|
|
178
|
+
"""
|
|
179
|
+
# Short circuit when dealing with optionals, don't try to coerces None to a type
|
|
180
|
+
if object_ is None:
|
|
181
|
+
return None
|
|
182
|
+
|
|
183
|
+
base_type = get_origin(type_) or type_
|
|
184
|
+
is_annotated = base_type == typing_extensions.Annotated
|
|
185
|
+
maybe_annotation_members = get_args(type_)
|
|
186
|
+
is_annotated_union = is_annotated and is_union(get_origin(maybe_annotation_members[0]))
|
|
187
|
+
|
|
188
|
+
if base_type == typing.Any:
|
|
189
|
+
return object_
|
|
190
|
+
|
|
191
|
+
if base_type == dict:
|
|
192
|
+
if not isinstance(object_, typing.Mapping):
|
|
193
|
+
return object_
|
|
194
|
+
|
|
195
|
+
key_type, items_type = get_args(type_)
|
|
196
|
+
d = {
|
|
197
|
+
construct_type(object_=key, type_=key_type): construct_type(object_=item, type_=items_type)
|
|
198
|
+
for key, item in object_.items()
|
|
199
|
+
}
|
|
200
|
+
return d
|
|
201
|
+
|
|
202
|
+
if base_type == list:
|
|
203
|
+
if not isinstance(object_, list):
|
|
204
|
+
return object_
|
|
205
|
+
|
|
206
|
+
inner_type = get_args(type_)[0]
|
|
207
|
+
return [construct_type(object_=entry, type_=inner_type) for entry in object_]
|
|
208
|
+
|
|
209
|
+
if base_type == set:
|
|
210
|
+
if not isinstance(object_, set) and not isinstance(object_, list):
|
|
211
|
+
return object_
|
|
212
|
+
|
|
213
|
+
inner_type = get_args(type_)[0]
|
|
214
|
+
return {construct_type(object_=entry, type_=inner_type) for entry in object_}
|
|
215
|
+
|
|
216
|
+
if is_union(base_type) or is_annotated_union:
|
|
217
|
+
return _convert_union_type(type_, object_)
|
|
218
|
+
|
|
219
|
+
# Cannot do an `issubclass` with a literal type, let's also just confirm we have a class before this call
|
|
220
|
+
if (
|
|
221
|
+
object_ is not None
|
|
222
|
+
and not is_literal_type(type_)
|
|
223
|
+
and (
|
|
224
|
+
(inspect.isclass(base_type) and issubclass(base_type, pydantic.BaseModel))
|
|
225
|
+
or (
|
|
226
|
+
is_annotated
|
|
227
|
+
and inspect.isclass(maybe_annotation_members[0])
|
|
228
|
+
and issubclass(maybe_annotation_members[0], pydantic.BaseModel)
|
|
229
|
+
)
|
|
230
|
+
)
|
|
231
|
+
):
|
|
232
|
+
if IS_PYDANTIC_V2:
|
|
233
|
+
return type_.model_construct(**object_)
|
|
234
|
+
else:
|
|
235
|
+
return type_.construct(**object_)
|
|
236
|
+
|
|
237
|
+
if base_type == dt.datetime:
|
|
238
|
+
try:
|
|
239
|
+
return parse_datetime(object_)
|
|
240
|
+
except Exception:
|
|
241
|
+
return object_
|
|
242
|
+
|
|
243
|
+
if base_type == dt.date:
|
|
244
|
+
try:
|
|
245
|
+
return parse_date(object_)
|
|
246
|
+
except Exception:
|
|
247
|
+
return object_
|
|
248
|
+
|
|
249
|
+
if base_type == uuid.UUID:
|
|
250
|
+
try:
|
|
251
|
+
return uuid.UUID(object_)
|
|
252
|
+
except Exception:
|
|
253
|
+
return object_
|
|
254
|
+
|
|
255
|
+
if base_type == int:
|
|
256
|
+
try:
|
|
257
|
+
return int(object_)
|
|
258
|
+
except Exception:
|
|
259
|
+
return object_
|
|
260
|
+
|
|
261
|
+
if base_type == bool:
|
|
262
|
+
try:
|
|
263
|
+
if isinstance(object_, str):
|
|
264
|
+
stringified_object = object_.lower()
|
|
265
|
+
return stringified_object == "true" or stringified_object == "1"
|
|
266
|
+
|
|
267
|
+
return bool(object_)
|
|
268
|
+
except Exception:
|
|
269
|
+
return object_
|
|
270
|
+
|
|
271
|
+
return object_
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def _get_is_populate_by_name(model: typing.Type["Model"]) -> bool:
|
|
275
|
+
if IS_PYDANTIC_V2:
|
|
276
|
+
return model.model_config.get("populate_by_name", False) # type: ignore # Pydantic v2
|
|
277
|
+
return model.__config__.allow_population_by_field_name # type: ignore # Pydantic v1
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
PydanticField = typing.Union[ModelField, pydantic.fields.FieldInfo]
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
# Pydantic V1 swapped the typing of __fields__'s values from ModelField to FieldInfo
|
|
284
|
+
# And so we try to handle both V1 cases, as well as V2 (FieldInfo from model.model_fields)
|
|
285
|
+
def _get_model_fields(
|
|
286
|
+
model: typing.Type["Model"],
|
|
287
|
+
) -> typing.Mapping[str, PydanticField]:
|
|
288
|
+
if IS_PYDANTIC_V2:
|
|
289
|
+
return model.model_fields # type: ignore # Pydantic v2
|
|
290
|
+
else:
|
|
291
|
+
return model.__fields__ # type: ignore # Pydantic v1
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def _get_field_default(field: PydanticField) -> typing.Any:
|
|
295
|
+
try:
|
|
296
|
+
value = field.get_default() # type: ignore # Pydantic < v1.10.15
|
|
297
|
+
except:
|
|
298
|
+
value = field.default
|
|
299
|
+
if IS_PYDANTIC_V2:
|
|
300
|
+
from pydantic_core import PydanticUndefined
|
|
301
|
+
|
|
302
|
+
if value == PydanticUndefined:
|
|
303
|
+
return None
|
|
304
|
+
return value
|
|
305
|
+
return value
|
letta/health/client.py
CHANGED
|
@@ -4,7 +4,7 @@ from ..core.client_wrapper import SyncClientWrapper
|
|
|
4
4
|
import typing
|
|
5
5
|
from ..core.request_options import RequestOptions
|
|
6
6
|
from ..types.health import Health
|
|
7
|
-
from ..core.
|
|
7
|
+
from ..core.unchecked_base_model import construct_type
|
|
8
8
|
from json.decoder import JSONDecodeError
|
|
9
9
|
from ..core.api_error import ApiError
|
|
10
10
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
@@ -44,7 +44,7 @@ class HealthClient:
|
|
|
44
44
|
if 200 <= _response.status_code < 300:
|
|
45
45
|
return typing.cast(
|
|
46
46
|
Health,
|
|
47
|
-
|
|
47
|
+
construct_type(
|
|
48
48
|
type_=Health, # type: ignore
|
|
49
49
|
object_=_response.json(),
|
|
50
50
|
),
|
|
@@ -97,7 +97,7 @@ class AsyncHealthClient:
|
|
|
97
97
|
if 200 <= _response.status_code < 300:
|
|
98
98
|
return typing.cast(
|
|
99
99
|
Health,
|
|
100
|
-
|
|
100
|
+
construct_type(
|
|
101
101
|
type_=Health, # type: ignore
|
|
102
102
|
object_=_response.json(),
|
|
103
103
|
),
|
letta/jobs/client.py
CHANGED
|
@@ -4,7 +4,7 @@ from ..core.client_wrapper import SyncClientWrapper
|
|
|
4
4
|
import typing
|
|
5
5
|
from ..core.request_options import RequestOptions
|
|
6
6
|
from ..types.job import Job
|
|
7
|
-
from ..core.
|
|
7
|
+
from ..core.unchecked_base_model import construct_type
|
|
8
8
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
9
9
|
from ..types.http_validation_error import HttpValidationError
|
|
10
10
|
from json.decoder import JSONDecodeError
|
|
@@ -57,7 +57,7 @@ class JobsClient:
|
|
|
57
57
|
if 200 <= _response.status_code < 300:
|
|
58
58
|
return typing.cast(
|
|
59
59
|
typing.List[Job],
|
|
60
|
-
|
|
60
|
+
construct_type(
|
|
61
61
|
type_=typing.List[Job], # type: ignore
|
|
62
62
|
object_=_response.json(),
|
|
63
63
|
),
|
|
@@ -66,7 +66,7 @@ class JobsClient:
|
|
|
66
66
|
raise UnprocessableEntityError(
|
|
67
67
|
typing.cast(
|
|
68
68
|
HttpValidationError,
|
|
69
|
-
|
|
69
|
+
construct_type(
|
|
70
70
|
type_=HttpValidationError, # type: ignore
|
|
71
71
|
object_=_response.json(),
|
|
72
72
|
),
|
|
@@ -109,7 +109,7 @@ class JobsClient:
|
|
|
109
109
|
if 200 <= _response.status_code < 300:
|
|
110
110
|
return typing.cast(
|
|
111
111
|
typing.List[Job],
|
|
112
|
-
|
|
112
|
+
construct_type(
|
|
113
113
|
type_=typing.List[Job], # type: ignore
|
|
114
114
|
object_=_response.json(),
|
|
115
115
|
),
|
|
@@ -118,7 +118,7 @@ class JobsClient:
|
|
|
118
118
|
raise UnprocessableEntityError(
|
|
119
119
|
typing.cast(
|
|
120
120
|
HttpValidationError,
|
|
121
|
-
|
|
121
|
+
construct_type(
|
|
122
122
|
type_=HttpValidationError, # type: ignore
|
|
123
123
|
object_=_response.json(),
|
|
124
124
|
),
|
|
@@ -165,7 +165,7 @@ class JobsClient:
|
|
|
165
165
|
if 200 <= _response.status_code < 300:
|
|
166
166
|
return typing.cast(
|
|
167
167
|
Job,
|
|
168
|
-
|
|
168
|
+
construct_type(
|
|
169
169
|
type_=Job, # type: ignore
|
|
170
170
|
object_=_response.json(),
|
|
171
171
|
),
|
|
@@ -174,7 +174,7 @@ class JobsClient:
|
|
|
174
174
|
raise UnprocessableEntityError(
|
|
175
175
|
typing.cast(
|
|
176
176
|
HttpValidationError,
|
|
177
|
-
|
|
177
|
+
construct_type(
|
|
178
178
|
type_=HttpValidationError, # type: ignore
|
|
179
179
|
object_=_response.json(),
|
|
180
180
|
),
|
|
@@ -221,7 +221,7 @@ class JobsClient:
|
|
|
221
221
|
if 200 <= _response.status_code < 300:
|
|
222
222
|
return typing.cast(
|
|
223
223
|
Job,
|
|
224
|
-
|
|
224
|
+
construct_type(
|
|
225
225
|
type_=Job, # type: ignore
|
|
226
226
|
object_=_response.json(),
|
|
227
227
|
),
|
|
@@ -230,7 +230,7 @@ class JobsClient:
|
|
|
230
230
|
raise UnprocessableEntityError(
|
|
231
231
|
typing.cast(
|
|
232
232
|
HttpValidationError,
|
|
233
|
-
|
|
233
|
+
construct_type(
|
|
234
234
|
type_=HttpValidationError, # type: ignore
|
|
235
235
|
object_=_response.json(),
|
|
236
236
|
),
|
|
@@ -294,7 +294,7 @@ class AsyncJobsClient:
|
|
|
294
294
|
if 200 <= _response.status_code < 300:
|
|
295
295
|
return typing.cast(
|
|
296
296
|
typing.List[Job],
|
|
297
|
-
|
|
297
|
+
construct_type(
|
|
298
298
|
type_=typing.List[Job], # type: ignore
|
|
299
299
|
object_=_response.json(),
|
|
300
300
|
),
|
|
@@ -303,7 +303,7 @@ class AsyncJobsClient:
|
|
|
303
303
|
raise UnprocessableEntityError(
|
|
304
304
|
typing.cast(
|
|
305
305
|
HttpValidationError,
|
|
306
|
-
|
|
306
|
+
construct_type(
|
|
307
307
|
type_=HttpValidationError, # type: ignore
|
|
308
308
|
object_=_response.json(),
|
|
309
309
|
),
|
|
@@ -354,7 +354,7 @@ class AsyncJobsClient:
|
|
|
354
354
|
if 200 <= _response.status_code < 300:
|
|
355
355
|
return typing.cast(
|
|
356
356
|
typing.List[Job],
|
|
357
|
-
|
|
357
|
+
construct_type(
|
|
358
358
|
type_=typing.List[Job], # type: ignore
|
|
359
359
|
object_=_response.json(),
|
|
360
360
|
),
|
|
@@ -363,7 +363,7 @@ class AsyncJobsClient:
|
|
|
363
363
|
raise UnprocessableEntityError(
|
|
364
364
|
typing.cast(
|
|
365
365
|
HttpValidationError,
|
|
366
|
-
|
|
366
|
+
construct_type(
|
|
367
367
|
type_=HttpValidationError, # type: ignore
|
|
368
368
|
object_=_response.json(),
|
|
369
369
|
),
|
|
@@ -418,7 +418,7 @@ class AsyncJobsClient:
|
|
|
418
418
|
if 200 <= _response.status_code < 300:
|
|
419
419
|
return typing.cast(
|
|
420
420
|
Job,
|
|
421
|
-
|
|
421
|
+
construct_type(
|
|
422
422
|
type_=Job, # type: ignore
|
|
423
423
|
object_=_response.json(),
|
|
424
424
|
),
|
|
@@ -427,7 +427,7 @@ class AsyncJobsClient:
|
|
|
427
427
|
raise UnprocessableEntityError(
|
|
428
428
|
typing.cast(
|
|
429
429
|
HttpValidationError,
|
|
430
|
-
|
|
430
|
+
construct_type(
|
|
431
431
|
type_=HttpValidationError, # type: ignore
|
|
432
432
|
object_=_response.json(),
|
|
433
433
|
),
|
|
@@ -482,7 +482,7 @@ class AsyncJobsClient:
|
|
|
482
482
|
if 200 <= _response.status_code < 300:
|
|
483
483
|
return typing.cast(
|
|
484
484
|
Job,
|
|
485
|
-
|
|
485
|
+
construct_type(
|
|
486
486
|
type_=Job, # type: ignore
|
|
487
487
|
object_=_response.json(),
|
|
488
488
|
),
|
|
@@ -491,7 +491,7 @@ class AsyncJobsClient:
|
|
|
491
491
|
raise UnprocessableEntityError(
|
|
492
492
|
typing.cast(
|
|
493
493
|
HttpValidationError,
|
|
494
|
-
|
|
494
|
+
construct_type(
|
|
495
495
|
type_=HttpValidationError, # type: ignore
|
|
496
496
|
object_=_response.json(),
|
|
497
497
|
),
|
letta/models/client.py
CHANGED
|
@@ -4,7 +4,7 @@ from ..core.client_wrapper import SyncClientWrapper
|
|
|
4
4
|
import typing
|
|
5
5
|
from ..core.request_options import RequestOptions
|
|
6
6
|
from ..types.llm_config import LlmConfig
|
|
7
|
-
from ..core.
|
|
7
|
+
from ..core.unchecked_base_model import construct_type
|
|
8
8
|
from json.decoder import JSONDecodeError
|
|
9
9
|
from ..core.api_error import ApiError
|
|
10
10
|
from ..types.embedding_config import EmbeddingConfig
|
|
@@ -45,7 +45,7 @@ class ModelsClient:
|
|
|
45
45
|
if 200 <= _response.status_code < 300:
|
|
46
46
|
return typing.cast(
|
|
47
47
|
typing.List[LlmConfig],
|
|
48
|
-
|
|
48
|
+
construct_type(
|
|
49
49
|
type_=typing.List[LlmConfig], # type: ignore
|
|
50
50
|
object_=_response.json(),
|
|
51
51
|
),
|
|
@@ -87,7 +87,7 @@ class ModelsClient:
|
|
|
87
87
|
if 200 <= _response.status_code < 300:
|
|
88
88
|
return typing.cast(
|
|
89
89
|
typing.List[EmbeddingConfig],
|
|
90
|
-
|
|
90
|
+
construct_type(
|
|
91
91
|
type_=typing.List[EmbeddingConfig], # type: ignore
|
|
92
92
|
object_=_response.json(),
|
|
93
93
|
),
|
|
@@ -140,7 +140,7 @@ class AsyncModelsClient:
|
|
|
140
140
|
if 200 <= _response.status_code < 300:
|
|
141
141
|
return typing.cast(
|
|
142
142
|
typing.List[LlmConfig],
|
|
143
|
-
|
|
143
|
+
construct_type(
|
|
144
144
|
type_=typing.List[LlmConfig], # type: ignore
|
|
145
145
|
object_=_response.json(),
|
|
146
146
|
),
|
|
@@ -190,7 +190,7 @@ class AsyncModelsClient:
|
|
|
190
190
|
if 200 <= _response.status_code < 300:
|
|
191
191
|
return typing.cast(
|
|
192
192
|
typing.List[EmbeddingConfig],
|
|
193
|
-
|
|
193
|
+
construct_type(
|
|
194
194
|
type_=typing.List[EmbeddingConfig], # type: ignore
|
|
195
195
|
object_=_response.json(),
|
|
196
196
|
),
|