letta-client 0.1.6__py3-none-any.whl → 0.1.10__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 → letta_client}/__init__.py +33 -27
- {letta → letta_client}/agents/__init__.py +40 -29
- {letta → letta_client}/agents/archival_memory/client.py +25 -25
- letta_client/agents/client.py +1328 -0
- {letta → letta_client}/agents/context/client.py +7 -7
- letta_client/agents/core_memory/client.py +1080 -0
- letta_client/agents/memory_variables/__init__.py +5 -0
- {letta/agents/memory → letta_client/agents/memory_variables}/client.py +43 -42
- letta_client/agents/memory_variables/types/__init__.py +5 -0
- letta/agents/types/agents_get_agent_variables_response.py → letta_client/agents/memory_variables/types/memory_variables_get_response.py +3 -3
- {letta → letta_client}/agents/messages/client.py +240 -25
- {letta → letta_client}/agents/messages/types/letta_streaming_response.py +21 -16
- {letta → letta_client}/agents/messages/types/messages_list_response_item.py +19 -14
- {letta → letta_client}/agents/recall_memory/client.py +7 -7
- {letta → letta_client}/agents/sources/client.py +7 -7
- letta_client/agents/templates/__init__.py +5 -0
- letta_client/agents/templates/client.py +578 -0
- letta_client/agents/templates/types/__init__.py +5 -0
- letta/agents/types/agents_migrate_response.py → letta_client/agents/templates/types/templates_migrate_response.py +3 -3
- {letta → letta_client}/agents/tools/client.py +19 -19
- letta_client/agents/types/__init__.py +33 -0
- letta_client/agents/types/agents_search_request_combinator.py +5 -0
- letta/agents/types/agents_search_deployed_agents_request_search_item.py → letta_client/agents/types/agents_search_request_search_item.py +17 -20
- letta/agents/types/agents_search_deployed_agents_request_search_item_name.py → letta_client/agents/types/agents_search_request_search_item_name.py +4 -6
- letta_client/agents/types/agents_search_request_search_item_name_operator.py +5 -0
- letta_client/agents/types/agents_search_request_search_item_order_by.py +22 -0
- letta_client/agents/types/agents_search_request_search_item_order_by_direction.py +5 -0
- letta_client/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 → letta_client/agents/types/agents_search_request_search_item_version.py +2 -2
- {letta → letta_client}/blocks/client.py +39 -39
- {letta → letta_client}/client.py +10 -2
- {letta → letta_client}/core/__init__.py +4 -0
- {letta → letta_client}/core/client_wrapper.py +1 -1
- letta_client/core/unchecked_base_model.py +305 -0
- {letta → letta_client}/health/client.py +5 -5
- {letta → letta_client}/jobs/client.py +25 -25
- {letta → letta_client}/models/client.py +9 -9
- letta_client/providers/client.py +597 -0
- letta_client/runs/client.py +876 -0
- {letta → letta_client}/sources/client.py +49 -49
- {letta → letta_client}/sources/files/client.py +17 -17
- {letta → letta_client}/sources/passages/client.py +7 -7
- letta_client/tools/__init__.py +2 -0
- {letta → letta_client}/tools/client.py +101 -81
- {letta → letta_client}/types/__init__.py +8 -0
- {letta → letta_client}/types/action_model.py +2 -2
- {letta → letta_client}/types/action_parameters_model.py +2 -2
- {letta → letta_client}/types/action_response_model.py +2 -2
- {letta → letta_client}/types/agent_environment_variable.py +2 -7
- {letta → letta_client}/types/agent_state.py +5 -8
- letta_client/types/agent_type.py +7 -0
- {letta → letta_client}/types/app_auth_scheme.py +2 -2
- {letta → letta_client}/types/app_model.py +2 -2
- {letta → letta_client}/types/archival_memory_summary.py +2 -2
- {letta → letta_client}/types/assistant_file.py +2 -2
- {letta → letta_client}/types/assistant_message_input.py +2 -2
- {letta → letta_client}/types/assistant_message_output.py +2 -2
- {letta → letta_client}/types/auth_request.py +2 -2
- {letta → letta_client}/types/auth_response.py +2 -2
- {letta → letta_client}/types/auth_scheme_field.py +2 -2
- {letta → letta_client}/types/block.py +2 -7
- {letta → letta_client}/types/block_update.py +2 -2
- {letta → letta_client}/types/chat_completion_request.py +2 -2
- {letta → letta_client}/types/chat_completion_response.py +2 -2
- {letta → letta_client}/types/child_tool_rule.py +2 -2
- {letta → letta_client}/types/choice.py +2 -2
- {letta → letta_client}/types/conditional_tool_rule.py +2 -2
- {letta → letta_client}/types/conflict_error_body.py +2 -2
- {letta → letta_client}/types/context_window_overview.py +2 -2
- {letta → letta_client}/types/create_assistant_file_request.py +2 -2
- {letta → letta_client}/types/create_assistant_request.py +2 -2
- {letta → letta_client}/types/create_block.py +2 -2
- {letta → letta_client}/types/delete_assistant_file_response.py +2 -2
- {letta → letta_client}/types/delete_assistant_response.py +2 -2
- {letta → letta_client}/types/e_2_b_sandbox_config.py +2 -2
- {letta → letta_client}/types/embedding_config.py +2 -2
- {letta → letta_client}/types/file_metadata.py +2 -7
- {letta → letta_client}/types/function_call_input.py +2 -2
- {letta → letta_client}/types/function_call_output.py +2 -2
- {letta → letta_client}/types/function_schema.py +2 -2
- {letta → letta_client}/types/health.py +2 -2
- {letta → letta_client}/types/http_validation_error.py +2 -2
- {letta → letta_client}/types/init_tool_rule.py +2 -2
- {letta → letta_client}/types/internal_server_error_body.py +2 -2
- {letta → letta_client}/types/job.py +7 -6
- letta_client/types/job_type.py +5 -0
- {letta → letta_client}/types/letta_request.py +7 -2
- {letta → letta_client}/types/letta_response.py +2 -2
- {letta → letta_client}/types/letta_response_messages_item.py +19 -14
- {letta → letta_client}/types/letta_schemas_letta_message_tool_call.py +2 -2
- {letta → letta_client}/types/letta_schemas_message_message.py +2 -7
- {letta → letta_client}/types/letta_schemas_openai_chat_completion_request_tool.py +2 -2
- {letta → letta_client}/types/letta_schemas_openai_chat_completion_request_tool_call.py +2 -2
- {letta → letta_client}/types/letta_schemas_openai_chat_completion_request_tool_call_function.py +2 -2
- {letta → letta_client}/types/letta_schemas_openai_chat_completion_response_message.py +2 -2
- {letta → letta_client}/types/letta_schemas_openai_chat_completion_response_tool_call.py +2 -2
- {letta → letta_client}/types/letta_schemas_openai_chat_completions_tool_call_function.py +2 -2
- {letta → letta_client}/types/letta_schemas_openai_chat_completions_tool_call_input.py +2 -2
- {letta → letta_client}/types/letta_schemas_openai_chat_completions_tool_call_output.py +2 -2
- {letta → letta_client}/types/letta_schemas_tool_tool.py +9 -8
- {letta → letta_client}/types/letta_usage_statistics.py +2 -2
- {letta → letta_client}/types/llm_config.py +2 -2
- {letta → letta_client}/types/local_sandbox_config.py +2 -2
- {letta → letta_client}/types/log_prob_token.py +2 -2
- {letta → letta_client}/types/memory.py +2 -2
- {letta → letta_client}/types/message_content_log_prob.py +2 -2
- {letta → letta_client}/types/message_create.py +2 -2
- {letta → letta_client}/types/not_found_error_body.py +2 -2
- {letta → letta_client}/types/open_ai_assistant.py +2 -2
- {letta → letta_client}/types/organization.py +2 -2
- {letta → letta_client}/types/organization_create.py +2 -2
- {letta → letta_client}/types/passage.py +2 -7
- letta_client/types/provider.py +38 -0
- {letta → letta_client}/types/reasoning_message.py +2 -2
- {letta → letta_client}/types/recall_memory_summary.py +2 -2
- {letta → letta_client}/types/response_format.py +2 -2
- letta_client/types/run.py +77 -0
- {letta → letta_client}/types/sandbox_config.py +2 -7
- {letta → letta_client}/types/sandbox_config_create.py +2 -2
- {letta → letta_client}/types/sandbox_config_update.py +2 -2
- {letta → letta_client}/types/sandbox_environment_variable.py +2 -7
- {letta → letta_client}/types/sandbox_environment_variable_create.py +2 -2
- {letta → letta_client}/types/sandbox_environment_variable_update.py +2 -2
- {letta → letta_client}/types/source.py +2 -7
- {letta → letta_client}/types/system_message_input.py +2 -2
- {letta → letta_client}/types/system_message_output.py +2 -2
- {letta → letta_client}/types/terminal_tool_rule.py +2 -2
- {letta → letta_client}/types/tool_call_delta.py +2 -2
- {letta → letta_client}/types/tool_call_function_output.py +2 -2
- {letta → letta_client}/types/tool_call_message.py +2 -2
- {letta → letta_client}/types/tool_create.py +2 -2
- {letta → letta_client}/types/tool_function_choice.py +2 -2
- {letta → letta_client}/types/tool_input.py +2 -2
- {letta → letta_client}/types/tool_message.py +2 -2
- {letta → letta_client}/types/tool_return_message.py +2 -2
- letta_client/types/tool_type.py +5 -0
- {letta → letta_client}/types/usage_statistics.py +2 -2
- {letta → letta_client}/types/user.py +2 -7
- {letta → letta_client}/types/user_create.py +2 -7
- {letta → letta_client}/types/user_message_input.py +2 -2
- {letta → letta_client}/types/user_message_output.py +2 -2
- {letta → letta_client}/types/user_update.py +2 -7
- {letta → letta_client}/types/validation_error.py +2 -2
- {letta_client-0.1.6.dist-info → letta_client-0.1.10.dist-info}/METADATA +7 -7
- letta_client-0.1.10.dist-info/RECORD +204 -0
- letta/agents/client.py +0 -2644
- 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/__init__.py +0 -47
- 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/types/agent_type.py +0 -8
- letta_client-0.1.6.dist-info/RECORD +0 -193
- {letta → letta_client}/agents/archival_memory/__init__.py +0 -0
- {letta → letta_client}/agents/context/__init__.py +0 -0
- {letta/agents/memory/messages → letta_client/agents/core_memory}/__init__.py +0 -0
- {letta → letta_client}/agents/messages/__init__.py +0 -0
- {letta → letta_client}/agents/messages/types/__init__.py +0 -0
- {letta → letta_client}/agents/messages/types/messages_list_response.py +0 -0
- {letta/agents/memory_blocks → letta_client/agents/recall_memory}/__init__.py +0 -0
- {letta/agents/recall_memory → letta_client/agents/sources}/__init__.py +0 -0
- {letta/agents/sources → letta_client/agents/tools}/__init__.py +0 -0
- {letta → letta_client}/agents/types/create_agent_request_tool_rules_item.py +0 -0
- {letta → letta_client}/agents/types/update_agent_tool_rules_item.py +0 -0
- {letta/agents/tools → letta_client/blocks}/__init__.py +0 -0
- {letta → letta_client}/core/api_error.py +0 -0
- {letta → letta_client}/core/datetime_utils.py +0 -0
- {letta → letta_client}/core/file.py +0 -0
- {letta → letta_client}/core/http_client.py +0 -0
- {letta → letta_client}/core/jsonable_encoder.py +0 -0
- {letta → letta_client}/core/pydantic_utilities.py +0 -0
- {letta → letta_client}/core/query_encoder.py +0 -0
- {letta → letta_client}/core/remove_none_from_dict.py +0 -0
- {letta → letta_client}/core/request_options.py +0 -0
- {letta → letta_client}/core/serialization.py +0 -0
- {letta → letta_client}/environment.py +0 -0
- {letta → letta_client}/errors/__init__.py +0 -0
- {letta → letta_client}/errors/conflict_error.py +0 -0
- {letta → letta_client}/errors/internal_server_error.py +0 -0
- {letta → letta_client}/errors/not_found_error.py +0 -0
- {letta → letta_client}/errors/unprocessable_entity_error.py +0 -0
- {letta/blocks → letta_client/health}/__init__.py +0 -0
- {letta/health → letta_client/jobs}/__init__.py +0 -0
- {letta/jobs → letta_client/models}/__init__.py +0 -0
- {letta/models → letta_client/providers}/__init__.py +0 -0
- {letta → letta_client}/py.typed +0 -0
- {letta/sources/files → letta_client/runs}/__init__.py +0 -0
- {letta → letta_client}/sources/__init__.py +0 -0
- {letta/sources/passages → letta_client/sources/files}/__init__.py +0 -0
- {letta/tools → letta_client/sources/passages}/__init__.py +0 -0
- {letta → letta_client}/types/agent_state_tool_rules_item.py +0 -0
- {letta → letta_client}/types/app_auth_scheme_auth_mode.py +0 -0
- {letta → letta_client}/types/chat_completion_request_function_call.py +0 -0
- {letta → letta_client}/types/chat_completion_request_messages_item.py +0 -0
- {letta → letta_client}/types/chat_completion_request_stop.py +0 -0
- {letta → letta_client}/types/chat_completion_request_tool_choice.py +0 -0
- {letta → letta_client}/types/embedding_config_embedding_endpoint_type.py +0 -0
- {letta → letta_client}/types/job_status.py +0 -0
- {letta → letta_client}/types/llm_config_model_endpoint_type.py +0 -0
- {letta → letta_client}/types/message_create_role.py +0 -0
- {letta → letta_client}/types/message_role.py +0 -0
- {letta → letta_client}/types/not_found_error_body_message.py +0 -0
- {letta → letta_client}/types/sandbox_config_create_config.py +0 -0
- {letta → letta_client}/types/sandbox_config_update_config.py +0 -0
- {letta → letta_client}/types/sandbox_type.py +0 -0
- {letta → letta_client}/types/tool_call_message_tool_call.py +0 -0
- {letta → letta_client}/types/tool_return_message_status.py +0 -0
- {letta → letta_client}/types/tool_rule_type.py +0 -0
- {letta → letta_client}/types/user_message_input_content.py +0 -0
- {letta → letta_client}/types/validation_error_loc_item.py +0 -0
- {letta → letta_client}/version.py +0 -0
- {letta_client-0.1.6.dist-info → letta_client-0.1.10.dist-info}/WHEEL +0 -0
letta/agents/memory/__init__.py
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
from ....core.client_wrapper import SyncClientWrapper
|
|
4
|
-
import typing
|
|
5
|
-
from ....core.request_options import RequestOptions
|
|
6
|
-
from ....types.letta_schemas_message_message import LettaSchemasMessageMessage
|
|
7
|
-
from ....core.jsonable_encoder import jsonable_encoder
|
|
8
|
-
from ....core.pydantic_utilities import parse_obj_as
|
|
9
|
-
from ....errors.unprocessable_entity_error import UnprocessableEntityError
|
|
10
|
-
from ....types.http_validation_error import HttpValidationError
|
|
11
|
-
from json.decoder import JSONDecodeError
|
|
12
|
-
from ....core.api_error import ApiError
|
|
13
|
-
from ....core.client_wrapper import AsyncClientWrapper
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class MessagesClient:
|
|
17
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
18
|
-
self._client_wrapper = client_wrapper
|
|
19
|
-
|
|
20
|
-
def list_in_context(
|
|
21
|
-
self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
22
|
-
) -> typing.List[LettaSchemasMessageMessage]:
|
|
23
|
-
"""
|
|
24
|
-
Retrieve the messages in the context of a specific agent.
|
|
25
|
-
|
|
26
|
-
Parameters
|
|
27
|
-
----------
|
|
28
|
-
agent_id : str
|
|
29
|
-
|
|
30
|
-
request_options : typing.Optional[RequestOptions]
|
|
31
|
-
Request-specific configuration.
|
|
32
|
-
|
|
33
|
-
Returns
|
|
34
|
-
-------
|
|
35
|
-
typing.List[LettaSchemasMessageMessage]
|
|
36
|
-
Successful Response
|
|
37
|
-
|
|
38
|
-
Examples
|
|
39
|
-
--------
|
|
40
|
-
from letta import Letta
|
|
41
|
-
|
|
42
|
-
client = Letta(
|
|
43
|
-
token="YOUR_TOKEN",
|
|
44
|
-
)
|
|
45
|
-
client.agents.memory.messages.list_in_context(
|
|
46
|
-
agent_id="agent_id",
|
|
47
|
-
)
|
|
48
|
-
"""
|
|
49
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
50
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/memory/messages",
|
|
51
|
-
method="GET",
|
|
52
|
-
request_options=request_options,
|
|
53
|
-
)
|
|
54
|
-
try:
|
|
55
|
-
if 200 <= _response.status_code < 300:
|
|
56
|
-
return typing.cast(
|
|
57
|
-
typing.List[LettaSchemasMessageMessage],
|
|
58
|
-
parse_obj_as(
|
|
59
|
-
type_=typing.List[LettaSchemasMessageMessage], # type: ignore
|
|
60
|
-
object_=_response.json(),
|
|
61
|
-
),
|
|
62
|
-
)
|
|
63
|
-
if _response.status_code == 422:
|
|
64
|
-
raise UnprocessableEntityError(
|
|
65
|
-
typing.cast(
|
|
66
|
-
HttpValidationError,
|
|
67
|
-
parse_obj_as(
|
|
68
|
-
type_=HttpValidationError, # type: ignore
|
|
69
|
-
object_=_response.json(),
|
|
70
|
-
),
|
|
71
|
-
)
|
|
72
|
-
)
|
|
73
|
-
_response_json = _response.json()
|
|
74
|
-
except JSONDecodeError:
|
|
75
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
76
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
class AsyncMessagesClient:
|
|
80
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
81
|
-
self._client_wrapper = client_wrapper
|
|
82
|
-
|
|
83
|
-
async def list_in_context(
|
|
84
|
-
self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
85
|
-
) -> typing.List[LettaSchemasMessageMessage]:
|
|
86
|
-
"""
|
|
87
|
-
Retrieve the messages in the context of a specific agent.
|
|
88
|
-
|
|
89
|
-
Parameters
|
|
90
|
-
----------
|
|
91
|
-
agent_id : str
|
|
92
|
-
|
|
93
|
-
request_options : typing.Optional[RequestOptions]
|
|
94
|
-
Request-specific configuration.
|
|
95
|
-
|
|
96
|
-
Returns
|
|
97
|
-
-------
|
|
98
|
-
typing.List[LettaSchemasMessageMessage]
|
|
99
|
-
Successful Response
|
|
100
|
-
|
|
101
|
-
Examples
|
|
102
|
-
--------
|
|
103
|
-
import asyncio
|
|
104
|
-
|
|
105
|
-
from letta import AsyncLetta
|
|
106
|
-
|
|
107
|
-
client = AsyncLetta(
|
|
108
|
-
token="YOUR_TOKEN",
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
async def main() -> None:
|
|
113
|
-
await client.agents.memory.messages.list_in_context(
|
|
114
|
-
agent_id="agent_id",
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
asyncio.run(main())
|
|
119
|
-
"""
|
|
120
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
121
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/memory/messages",
|
|
122
|
-
method="GET",
|
|
123
|
-
request_options=request_options,
|
|
124
|
-
)
|
|
125
|
-
try:
|
|
126
|
-
if 200 <= _response.status_code < 300:
|
|
127
|
-
return typing.cast(
|
|
128
|
-
typing.List[LettaSchemasMessageMessage],
|
|
129
|
-
parse_obj_as(
|
|
130
|
-
type_=typing.List[LettaSchemasMessageMessage], # type: ignore
|
|
131
|
-
object_=_response.json(),
|
|
132
|
-
),
|
|
133
|
-
)
|
|
134
|
-
if _response.status_code == 422:
|
|
135
|
-
raise UnprocessableEntityError(
|
|
136
|
-
typing.cast(
|
|
137
|
-
HttpValidationError,
|
|
138
|
-
parse_obj_as(
|
|
139
|
-
type_=HttpValidationError, # type: ignore
|
|
140
|
-
object_=_response.json(),
|
|
141
|
-
),
|
|
142
|
-
)
|
|
143
|
-
)
|
|
144
|
-
_response_json = _response.json()
|
|
145
|
-
except JSONDecodeError:
|
|
146
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
147
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
from ...core.client_wrapper import SyncClientWrapper
|
|
5
|
-
from ...core.request_options import RequestOptions
|
|
6
|
-
from ...types.memory import Memory
|
|
7
|
-
from ...core.jsonable_encoder import jsonable_encoder
|
|
8
|
-
from ...core.pydantic_utilities import parse_obj_as
|
|
9
|
-
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
10
|
-
from ...types.http_validation_error import HttpValidationError
|
|
11
|
-
from json.decoder import JSONDecodeError
|
|
12
|
-
from ...core.api_error import ApiError
|
|
13
|
-
from ...core.client_wrapper import AsyncClientWrapper
|
|
14
|
-
|
|
15
|
-
# this is used as the default value for optional parameters
|
|
16
|
-
OMIT = typing.cast(typing.Any, ...)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class MemoryBlocksClient:
|
|
20
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
21
|
-
self._client_wrapper = client_wrapper
|
|
22
|
-
|
|
23
|
-
def remove(
|
|
24
|
-
self, agent_id: str, block_label: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
25
|
-
) -> Memory:
|
|
26
|
-
"""
|
|
27
|
-
Removes a memory block from an agent by unlnking it. If the block is not linked to any other agent, it is deleted.
|
|
28
|
-
|
|
29
|
-
Parameters
|
|
30
|
-
----------
|
|
31
|
-
agent_id : str
|
|
32
|
-
|
|
33
|
-
block_label : str
|
|
34
|
-
|
|
35
|
-
request_options : typing.Optional[RequestOptions]
|
|
36
|
-
Request-specific configuration.
|
|
37
|
-
|
|
38
|
-
Returns
|
|
39
|
-
-------
|
|
40
|
-
Memory
|
|
41
|
-
Successful Response
|
|
42
|
-
|
|
43
|
-
Examples
|
|
44
|
-
--------
|
|
45
|
-
from letta import Letta
|
|
46
|
-
|
|
47
|
-
client = Letta(
|
|
48
|
-
token="YOUR_TOKEN",
|
|
49
|
-
)
|
|
50
|
-
client.agents.memory_blocks.remove(
|
|
51
|
-
agent_id="agent_id",
|
|
52
|
-
block_label="block_label",
|
|
53
|
-
)
|
|
54
|
-
"""
|
|
55
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
56
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/memory/block/{jsonable_encoder(block_label)}",
|
|
57
|
-
method="DELETE",
|
|
58
|
-
request_options=request_options,
|
|
59
|
-
)
|
|
60
|
-
try:
|
|
61
|
-
if 200 <= _response.status_code < 300:
|
|
62
|
-
return typing.cast(
|
|
63
|
-
Memory,
|
|
64
|
-
parse_obj_as(
|
|
65
|
-
type_=Memory, # type: ignore
|
|
66
|
-
object_=_response.json(),
|
|
67
|
-
),
|
|
68
|
-
)
|
|
69
|
-
if _response.status_code == 422:
|
|
70
|
-
raise UnprocessableEntityError(
|
|
71
|
-
typing.cast(
|
|
72
|
-
HttpValidationError,
|
|
73
|
-
parse_obj_as(
|
|
74
|
-
type_=HttpValidationError, # type: ignore
|
|
75
|
-
object_=_response.json(),
|
|
76
|
-
),
|
|
77
|
-
)
|
|
78
|
-
)
|
|
79
|
-
_response_json = _response.json()
|
|
80
|
-
except JSONDecodeError:
|
|
81
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
82
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
83
|
-
|
|
84
|
-
def add(
|
|
85
|
-
self,
|
|
86
|
-
agent_id: str,
|
|
87
|
-
*,
|
|
88
|
-
value: str,
|
|
89
|
-
label: str,
|
|
90
|
-
limit: typing.Optional[int] = OMIT,
|
|
91
|
-
name: typing.Optional[str] = OMIT,
|
|
92
|
-
is_template: typing.Optional[bool] = OMIT,
|
|
93
|
-
description: typing.Optional[str] = OMIT,
|
|
94
|
-
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
95
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
96
|
-
) -> Memory:
|
|
97
|
-
"""
|
|
98
|
-
Creates a memory block and links it to the agent.
|
|
99
|
-
|
|
100
|
-
Parameters
|
|
101
|
-
----------
|
|
102
|
-
agent_id : str
|
|
103
|
-
|
|
104
|
-
value : str
|
|
105
|
-
Value of the block.
|
|
106
|
-
|
|
107
|
-
label : str
|
|
108
|
-
Label of the block.
|
|
109
|
-
|
|
110
|
-
limit : typing.Optional[int]
|
|
111
|
-
Character limit of the block.
|
|
112
|
-
|
|
113
|
-
name : typing.Optional[str]
|
|
114
|
-
Name of the block if it is a template.
|
|
115
|
-
|
|
116
|
-
is_template : typing.Optional[bool]
|
|
117
|
-
|
|
118
|
-
description : typing.Optional[str]
|
|
119
|
-
Description of the block.
|
|
120
|
-
|
|
121
|
-
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
122
|
-
Metadata of the block.
|
|
123
|
-
|
|
124
|
-
request_options : typing.Optional[RequestOptions]
|
|
125
|
-
Request-specific configuration.
|
|
126
|
-
|
|
127
|
-
Returns
|
|
128
|
-
-------
|
|
129
|
-
Memory
|
|
130
|
-
Successful Response
|
|
131
|
-
|
|
132
|
-
Examples
|
|
133
|
-
--------
|
|
134
|
-
from letta import Letta
|
|
135
|
-
|
|
136
|
-
client = Letta(
|
|
137
|
-
token="YOUR_TOKEN",
|
|
138
|
-
)
|
|
139
|
-
client.agents.memory_blocks.add(
|
|
140
|
-
agent_id="agent_id",
|
|
141
|
-
value="value",
|
|
142
|
-
label="label",
|
|
143
|
-
)
|
|
144
|
-
"""
|
|
145
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
146
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/memory/block",
|
|
147
|
-
method="POST",
|
|
148
|
-
json={
|
|
149
|
-
"value": value,
|
|
150
|
-
"limit": limit,
|
|
151
|
-
"name": name,
|
|
152
|
-
"is_template": is_template,
|
|
153
|
-
"label": label,
|
|
154
|
-
"description": description,
|
|
155
|
-
"metadata_": metadata,
|
|
156
|
-
},
|
|
157
|
-
request_options=request_options,
|
|
158
|
-
omit=OMIT,
|
|
159
|
-
)
|
|
160
|
-
try:
|
|
161
|
-
if 200 <= _response.status_code < 300:
|
|
162
|
-
return typing.cast(
|
|
163
|
-
Memory,
|
|
164
|
-
parse_obj_as(
|
|
165
|
-
type_=Memory, # type: ignore
|
|
166
|
-
object_=_response.json(),
|
|
167
|
-
),
|
|
168
|
-
)
|
|
169
|
-
if _response.status_code == 422:
|
|
170
|
-
raise UnprocessableEntityError(
|
|
171
|
-
typing.cast(
|
|
172
|
-
HttpValidationError,
|
|
173
|
-
parse_obj_as(
|
|
174
|
-
type_=HttpValidationError, # type: ignore
|
|
175
|
-
object_=_response.json(),
|
|
176
|
-
),
|
|
177
|
-
)
|
|
178
|
-
)
|
|
179
|
-
_response_json = _response.json()
|
|
180
|
-
except JSONDecodeError:
|
|
181
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
182
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
class AsyncMemoryBlocksClient:
|
|
186
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
187
|
-
self._client_wrapper = client_wrapper
|
|
188
|
-
|
|
189
|
-
async def remove(
|
|
190
|
-
self, agent_id: str, block_label: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
191
|
-
) -> Memory:
|
|
192
|
-
"""
|
|
193
|
-
Removes a memory block from an agent by unlnking it. If the block is not linked to any other agent, it is deleted.
|
|
194
|
-
|
|
195
|
-
Parameters
|
|
196
|
-
----------
|
|
197
|
-
agent_id : str
|
|
198
|
-
|
|
199
|
-
block_label : str
|
|
200
|
-
|
|
201
|
-
request_options : typing.Optional[RequestOptions]
|
|
202
|
-
Request-specific configuration.
|
|
203
|
-
|
|
204
|
-
Returns
|
|
205
|
-
-------
|
|
206
|
-
Memory
|
|
207
|
-
Successful Response
|
|
208
|
-
|
|
209
|
-
Examples
|
|
210
|
-
--------
|
|
211
|
-
import asyncio
|
|
212
|
-
|
|
213
|
-
from letta import AsyncLetta
|
|
214
|
-
|
|
215
|
-
client = AsyncLetta(
|
|
216
|
-
token="YOUR_TOKEN",
|
|
217
|
-
)
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
async def main() -> None:
|
|
221
|
-
await client.agents.memory_blocks.remove(
|
|
222
|
-
agent_id="agent_id",
|
|
223
|
-
block_label="block_label",
|
|
224
|
-
)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
asyncio.run(main())
|
|
228
|
-
"""
|
|
229
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
230
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/memory/block/{jsonable_encoder(block_label)}",
|
|
231
|
-
method="DELETE",
|
|
232
|
-
request_options=request_options,
|
|
233
|
-
)
|
|
234
|
-
try:
|
|
235
|
-
if 200 <= _response.status_code < 300:
|
|
236
|
-
return typing.cast(
|
|
237
|
-
Memory,
|
|
238
|
-
parse_obj_as(
|
|
239
|
-
type_=Memory, # type: ignore
|
|
240
|
-
object_=_response.json(),
|
|
241
|
-
),
|
|
242
|
-
)
|
|
243
|
-
if _response.status_code == 422:
|
|
244
|
-
raise UnprocessableEntityError(
|
|
245
|
-
typing.cast(
|
|
246
|
-
HttpValidationError,
|
|
247
|
-
parse_obj_as(
|
|
248
|
-
type_=HttpValidationError, # type: ignore
|
|
249
|
-
object_=_response.json(),
|
|
250
|
-
),
|
|
251
|
-
)
|
|
252
|
-
)
|
|
253
|
-
_response_json = _response.json()
|
|
254
|
-
except JSONDecodeError:
|
|
255
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
256
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
257
|
-
|
|
258
|
-
async def add(
|
|
259
|
-
self,
|
|
260
|
-
agent_id: str,
|
|
261
|
-
*,
|
|
262
|
-
value: str,
|
|
263
|
-
label: str,
|
|
264
|
-
limit: typing.Optional[int] = OMIT,
|
|
265
|
-
name: typing.Optional[str] = OMIT,
|
|
266
|
-
is_template: typing.Optional[bool] = OMIT,
|
|
267
|
-
description: typing.Optional[str] = OMIT,
|
|
268
|
-
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
269
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
270
|
-
) -> Memory:
|
|
271
|
-
"""
|
|
272
|
-
Creates a memory block and links it to the agent.
|
|
273
|
-
|
|
274
|
-
Parameters
|
|
275
|
-
----------
|
|
276
|
-
agent_id : str
|
|
277
|
-
|
|
278
|
-
value : str
|
|
279
|
-
Value of the block.
|
|
280
|
-
|
|
281
|
-
label : str
|
|
282
|
-
Label of the block.
|
|
283
|
-
|
|
284
|
-
limit : typing.Optional[int]
|
|
285
|
-
Character limit of the block.
|
|
286
|
-
|
|
287
|
-
name : typing.Optional[str]
|
|
288
|
-
Name of the block if it is a template.
|
|
289
|
-
|
|
290
|
-
is_template : typing.Optional[bool]
|
|
291
|
-
|
|
292
|
-
description : typing.Optional[str]
|
|
293
|
-
Description of the block.
|
|
294
|
-
|
|
295
|
-
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
296
|
-
Metadata of the block.
|
|
297
|
-
|
|
298
|
-
request_options : typing.Optional[RequestOptions]
|
|
299
|
-
Request-specific configuration.
|
|
300
|
-
|
|
301
|
-
Returns
|
|
302
|
-
-------
|
|
303
|
-
Memory
|
|
304
|
-
Successful Response
|
|
305
|
-
|
|
306
|
-
Examples
|
|
307
|
-
--------
|
|
308
|
-
import asyncio
|
|
309
|
-
|
|
310
|
-
from letta import AsyncLetta
|
|
311
|
-
|
|
312
|
-
client = AsyncLetta(
|
|
313
|
-
token="YOUR_TOKEN",
|
|
314
|
-
)
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
async def main() -> None:
|
|
318
|
-
await client.agents.memory_blocks.add(
|
|
319
|
-
agent_id="agent_id",
|
|
320
|
-
value="value",
|
|
321
|
-
label="label",
|
|
322
|
-
)
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
asyncio.run(main())
|
|
326
|
-
"""
|
|
327
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
328
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/memory/block",
|
|
329
|
-
method="POST",
|
|
330
|
-
json={
|
|
331
|
-
"value": value,
|
|
332
|
-
"limit": limit,
|
|
333
|
-
"name": name,
|
|
334
|
-
"is_template": is_template,
|
|
335
|
-
"label": label,
|
|
336
|
-
"description": description,
|
|
337
|
-
"metadata_": metadata,
|
|
338
|
-
},
|
|
339
|
-
request_options=request_options,
|
|
340
|
-
omit=OMIT,
|
|
341
|
-
)
|
|
342
|
-
try:
|
|
343
|
-
if 200 <= _response.status_code < 300:
|
|
344
|
-
return typing.cast(
|
|
345
|
-
Memory,
|
|
346
|
-
parse_obj_as(
|
|
347
|
-
type_=Memory, # type: ignore
|
|
348
|
-
object_=_response.json(),
|
|
349
|
-
),
|
|
350
|
-
)
|
|
351
|
-
if _response.status_code == 422:
|
|
352
|
-
raise UnprocessableEntityError(
|
|
353
|
-
typing.cast(
|
|
354
|
-
HttpValidationError,
|
|
355
|
-
parse_obj_as(
|
|
356
|
-
type_=HttpValidationError, # type: ignore
|
|
357
|
-
object_=_response.json(),
|
|
358
|
-
),
|
|
359
|
-
)
|
|
360
|
-
)
|
|
361
|
-
_response_json = _response.json()
|
|
362
|
-
except JSONDecodeError:
|
|
363
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
364
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
letta/agents/types/__init__.py
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
from .agents_get_agent_variables_response import AgentsGetAgentVariablesResponse
|
|
4
|
-
from .agents_migrate_response import AgentsMigrateResponse
|
|
5
|
-
from .agents_search_deployed_agents_request_combinator import AgentsSearchDeployedAgentsRequestCombinator
|
|
6
|
-
from .agents_search_deployed_agents_request_search_item import (
|
|
7
|
-
AgentsSearchDeployedAgentsRequestSearchItem,
|
|
8
|
-
AgentsSearchDeployedAgentsRequestSearchItem_Name,
|
|
9
|
-
AgentsSearchDeployedAgentsRequestSearchItem_OrderBy,
|
|
10
|
-
AgentsSearchDeployedAgentsRequestSearchItem_Version,
|
|
11
|
-
)
|
|
12
|
-
from .agents_search_deployed_agents_request_search_item_name import AgentsSearchDeployedAgentsRequestSearchItemName
|
|
13
|
-
from .agents_search_deployed_agents_request_search_item_name_operator import (
|
|
14
|
-
AgentsSearchDeployedAgentsRequestSearchItemNameOperator,
|
|
15
|
-
)
|
|
16
|
-
from .agents_search_deployed_agents_request_search_item_order_by import (
|
|
17
|
-
AgentsSearchDeployedAgentsRequestSearchItemOrderBy,
|
|
18
|
-
)
|
|
19
|
-
from .agents_search_deployed_agents_request_search_item_order_by_direction import (
|
|
20
|
-
AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection,
|
|
21
|
-
)
|
|
22
|
-
from .agents_search_deployed_agents_request_search_item_order_by_value import (
|
|
23
|
-
AgentsSearchDeployedAgentsRequestSearchItemOrderByValue,
|
|
24
|
-
)
|
|
25
|
-
from .agents_search_deployed_agents_request_search_item_version import (
|
|
26
|
-
AgentsSearchDeployedAgentsRequestSearchItemVersion,
|
|
27
|
-
)
|
|
28
|
-
from .create_agent_request_tool_rules_item import CreateAgentRequestToolRulesItem
|
|
29
|
-
from .update_agent_tool_rules_item import UpdateAgentToolRulesItem
|
|
30
|
-
|
|
31
|
-
__all__ = [
|
|
32
|
-
"AgentsGetAgentVariablesResponse",
|
|
33
|
-
"AgentsMigrateResponse",
|
|
34
|
-
"AgentsSearchDeployedAgentsRequestCombinator",
|
|
35
|
-
"AgentsSearchDeployedAgentsRequestSearchItem",
|
|
36
|
-
"AgentsSearchDeployedAgentsRequestSearchItemName",
|
|
37
|
-
"AgentsSearchDeployedAgentsRequestSearchItemNameOperator",
|
|
38
|
-
"AgentsSearchDeployedAgentsRequestSearchItemOrderBy",
|
|
39
|
-
"AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection",
|
|
40
|
-
"AgentsSearchDeployedAgentsRequestSearchItemOrderByValue",
|
|
41
|
-
"AgentsSearchDeployedAgentsRequestSearchItemVersion",
|
|
42
|
-
"AgentsSearchDeployedAgentsRequestSearchItem_Name",
|
|
43
|
-
"AgentsSearchDeployedAgentsRequestSearchItem_OrderBy",
|
|
44
|
-
"AgentsSearchDeployedAgentsRequestSearchItem_Version",
|
|
45
|
-
"CreateAgentRequestToolRulesItem",
|
|
46
|
-
"UpdateAgentToolRulesItem",
|
|
47
|
-
]
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
|
-
from .agents_search_deployed_agents_request_search_item_order_by_value import (
|
|
5
|
-
AgentsSearchDeployedAgentsRequestSearchItemOrderByValue,
|
|
6
|
-
)
|
|
7
|
-
from .agents_search_deployed_agents_request_search_item_order_by_direction import (
|
|
8
|
-
AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection,
|
|
9
|
-
)
|
|
10
|
-
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
11
|
-
import typing
|
|
12
|
-
import pydantic
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class AgentsSearchDeployedAgentsRequestSearchItemOrderBy(UniversalBaseModel):
|
|
16
|
-
value: AgentsSearchDeployedAgentsRequestSearchItemOrderByValue
|
|
17
|
-
direction: AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection
|
|
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
|
letta/types/agent_type.py
DELETED