letta-client 0.1.16__py3-none-any.whl → 0.1.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of letta-client might be problematic. Click here for more details.
- letta_client/__init__.py +34 -120
- letta_client/agents/__init__.py +18 -54
- letta_client/agents/archival_memory/client.py +25 -343
- letta_client/agents/client.py +1640 -347
- letta_client/agents/context/client.py +6 -4
- letta_client/agents/core_memory/client.py +95 -624
- letta_client/agents/memory_variables/__init__.py +2 -2
- letta_client/agents/memory_variables/client.py +15 -15
- letta_client/agents/memory_variables/types/__init__.py +2 -2
- letta_client/agents/memory_variables/types/{memory_variables_get_response.py → memory_variables_list_response.py} +1 -1
- letta_client/agents/messages/__init__.py +2 -22
- letta_client/agents/messages/client.py +32 -38
- letta_client/agents/messages/types/__init__.py +2 -21
- letta_client/agents/messages/types/letta_streaming_response.py +16 -139
- letta_client/agents/messages/types/messages_list_response.py +2 -2
- letta_client/agents/sources/client.py +266 -5
- letta_client/agents/tools/client.py +25 -27
- letta_client/agents/types/__init__.py +15 -25
- letta_client/agents/types/agents_search_request_search_item.py +10 -78
- letta_client/agents/types/{agents_search_request_search_item_order_by.py → agents_search_request_search_item_direction.py} +7 -6
- letta_client/agents/types/agents_search_request_search_item_direction_direction.py +5 -0
- letta_client/agents/types/agents_search_request_search_item_direction_value.py +5 -0
- letta_client/agents/types/{agents_search_request_search_item_name.py → agents_search_request_search_item_one.py} +5 -4
- letta_client/agents/types/agents_search_request_search_item_one_operator.py +5 -0
- letta_client/agents/types/{agents_search_request_search_item_tags.py → agents_search_request_search_item_two.py} +2 -1
- letta_client/agents/types/{agents_search_request_search_item_version.py → agents_search_request_search_item_zero.py} +3 -2
- letta_client/blocks/client.py +12 -260
- letta_client/client.py +3 -3
- letta_client/core/client_wrapper.py +1 -1
- letta_client/jobs/client.py +4 -4
- letta_client/providers/client.py +74 -74
- letta_client/runs/client.py +14 -12
- letta_client/sources/client.py +12 -288
- letta_client/tools/client.py +63 -189
- letta_client/types/__init__.py +21 -103
- letta_client/types/agent_state.py +3 -7
- letta_client/types/{assistant_message_output.py → assistant_message.py} +3 -2
- letta_client/types/block.py +2 -6
- letta_client/types/block_update.py +1 -5
- letta_client/types/{archival_memory_summary.py → chat_completion_message_tool_call.py} +7 -7
- letta_client/types/context_window_overview.py +4 -6
- letta_client/types/create_block.py +1 -5
- letta_client/types/embedding_config_embedding_endpoint_type.py +1 -0
- letta_client/types/{function_call_output.py → function.py} +1 -1
- letta_client/types/{function_schema.py → function_definition.py} +2 -1
- letta_client/types/{create_assistant_file_request.py → function_tool.py} +6 -7
- letta_client/types/job.py +1 -5
- letta_client/types/letta_message_union.py +9 -121
- letta_client/types/letta_usage_statistics.py +1 -0
- letta_client/types/llm_config_model_endpoint_type.py +1 -0
- letta_client/types/{letta_schemas_message_message.py → message.py} +9 -6
- letta_client/types/passage.py +1 -5
- letta_client/types/reasoning_message.py +2 -1
- letta_client/types/run.py +1 -5
- letta_client/types/source.py +2 -6
- letta_client/types/{system_message_output.py → system_message.py} +3 -2
- letta_client/types/{letta_schemas_tool_tool.py → tool.py} +1 -1
- letta_client/types/{letta_schemas_letta_message_tool_call.py → tool_call.py} +1 -1
- letta_client/types/tool_call_message.py +2 -1
- letta_client/types/tool_call_message_tool_call.py +2 -2
- letta_client/types/tool_return_message.py +2 -1
- letta_client/types/tool_type.py +2 -1
- letta_client/types/{user_message_output.py → user_message.py} +3 -2
- {letta_client-0.1.16.dist-info → letta_client-0.1.19.dist-info}/METADATA +2 -2
- {letta_client-0.1.16.dist-info → letta_client-0.1.19.dist-info}/RECORD +66 -101
- letta_client/agents/recall_memory/__init__.py +0 -2
- letta_client/agents/recall_memory/client.py +0 -147
- letta_client/agents/types/agents_search_request_search_item_name_operator.py +0 -5
- letta_client/agents/types/agents_search_request_search_item_order_by_direction.py +0 -5
- letta_client/agents/types/agents_search_request_search_item_order_by_value.py +0 -5
- letta_client/types/assistant_file.py +0 -33
- letta_client/types/assistant_message_input.py +0 -23
- letta_client/types/chat_completion_request.py +0 -49
- letta_client/types/chat_completion_request_function_call.py +0 -6
- letta_client/types/chat_completion_request_messages_item.py +0 -11
- letta_client/types/chat_completion_request_stop.py +0 -5
- letta_client/types/chat_completion_request_tool_choice.py +0 -8
- letta_client/types/chat_completion_response.py +0 -32
- letta_client/types/choice.py +0 -25
- letta_client/types/create_assistant_request.py +0 -57
- letta_client/types/delete_assistant_file_response.py +0 -28
- letta_client/types/delete_assistant_response.py +0 -28
- letta_client/types/function_call_input.py +0 -19
- letta_client/types/letta_schemas_openai_chat_completion_request_tool.py +0 -21
- letta_client/types/letta_schemas_openai_chat_completion_request_tool_call.py +0 -24
- letta_client/types/letta_schemas_openai_chat_completion_request_tool_call_function.py +0 -20
- letta_client/types/letta_schemas_openai_chat_completion_response_message.py +0 -24
- letta_client/types/letta_schemas_openai_chat_completion_response_tool_call.py +0 -22
- letta_client/types/letta_schemas_openai_chat_completions_tool_call_function.py +0 -27
- letta_client/types/letta_schemas_openai_chat_completions_tool_call_input.py +0 -29
- letta_client/types/letta_schemas_openai_chat_completions_tool_call_output.py +0 -29
- letta_client/types/log_prob_token.py +0 -21
- letta_client/types/message_content_log_prob.py +0 -23
- letta_client/types/open_ai_assistant.py +0 -67
- letta_client/types/recall_memory_summary.py +0 -22
- letta_client/types/response_format.py +0 -19
- letta_client/types/system_message_input.py +0 -21
- letta_client/types/tool_call_function_output.py +0 -27
- letta_client/types/tool_function_choice.py +0 -21
- letta_client/types/tool_input.py +0 -21
- letta_client/types/tool_message.py +0 -21
- letta_client/types/user_message_input.py +0 -22
- letta_client/types/user_message_input_content.py +0 -5
- {letta_client-0.1.16.dist-info → letta_client-0.1.19.dist-info}/WHEEL +0 -0
|
@@ -1,116 +1,30 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
import typing
|
|
4
3
|
from ...core.client_wrapper import SyncClientWrapper
|
|
4
|
+
import typing
|
|
5
5
|
from ...core.request_options import RequestOptions
|
|
6
|
-
from ...types.archival_memory_summary import ArchivalMemorySummary
|
|
7
6
|
from ...core.jsonable_encoder import jsonable_encoder
|
|
8
|
-
from ...core.unchecked_base_model import construct_type
|
|
9
|
-
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
10
|
-
from ...types.http_validation_error import HttpValidationError
|
|
11
7
|
from json.decoder import JSONDecodeError
|
|
12
8
|
from ...core.api_error import ApiError
|
|
13
|
-
from ...types.passage import Passage
|
|
14
9
|
from ...core.client_wrapper import AsyncClientWrapper
|
|
15
10
|
|
|
16
|
-
# this is used as the default value for optional parameters
|
|
17
|
-
OMIT = typing.cast(typing.Any, ...)
|
|
18
|
-
|
|
19
11
|
|
|
20
12
|
class ArchivalMemoryClient:
|
|
21
13
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
22
14
|
self._client_wrapper = client_wrapper
|
|
23
15
|
|
|
24
|
-
def
|
|
25
|
-
self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
26
|
-
) -> ArchivalMemorySummary:
|
|
27
|
-
"""
|
|
28
|
-
Retrieve the summary of the archival memory of a specific agent.
|
|
29
|
-
|
|
30
|
-
Parameters
|
|
31
|
-
----------
|
|
32
|
-
agent_id : str
|
|
33
|
-
|
|
34
|
-
request_options : typing.Optional[RequestOptions]
|
|
35
|
-
Request-specific configuration.
|
|
36
|
-
|
|
37
|
-
Returns
|
|
38
|
-
-------
|
|
39
|
-
ArchivalMemorySummary
|
|
40
|
-
Successful Response
|
|
41
|
-
|
|
42
|
-
Examples
|
|
43
|
-
--------
|
|
44
|
-
from letta_client import Letta
|
|
45
|
-
|
|
46
|
-
client = Letta(
|
|
47
|
-
token="YOUR_TOKEN",
|
|
48
|
-
)
|
|
49
|
-
client.agents.archival_memory.get_summary(
|
|
50
|
-
agent_id="agent_id",
|
|
51
|
-
)
|
|
52
|
-
"""
|
|
53
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
54
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/memory/archival",
|
|
55
|
-
method="GET",
|
|
56
|
-
request_options=request_options,
|
|
57
|
-
)
|
|
58
|
-
try:
|
|
59
|
-
if 200 <= _response.status_code < 300:
|
|
60
|
-
return typing.cast(
|
|
61
|
-
ArchivalMemorySummary,
|
|
62
|
-
construct_type(
|
|
63
|
-
type_=ArchivalMemorySummary, # type: ignore
|
|
64
|
-
object_=_response.json(),
|
|
65
|
-
),
|
|
66
|
-
)
|
|
67
|
-
if _response.status_code == 422:
|
|
68
|
-
raise UnprocessableEntityError(
|
|
69
|
-
typing.cast(
|
|
70
|
-
HttpValidationError,
|
|
71
|
-
construct_type(
|
|
72
|
-
type_=HttpValidationError, # type: ignore
|
|
73
|
-
object_=_response.json(),
|
|
74
|
-
),
|
|
75
|
-
)
|
|
76
|
-
)
|
|
77
|
-
_response_json = _response.json()
|
|
78
|
-
except JSONDecodeError:
|
|
79
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
80
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
81
|
-
|
|
82
|
-
def list(
|
|
83
|
-
self,
|
|
84
|
-
agent_id: str,
|
|
85
|
-
*,
|
|
86
|
-
after: typing.Optional[int] = None,
|
|
87
|
-
before: typing.Optional[int] = None,
|
|
88
|
-
limit: typing.Optional[int] = None,
|
|
89
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
90
|
-
) -> typing.List[Passage]:
|
|
16
|
+
def list(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
91
17
|
"""
|
|
92
|
-
Retrieve the memories in an agent's archival memory store (paginated query).
|
|
93
|
-
|
|
94
18
|
Parameters
|
|
95
19
|
----------
|
|
96
20
|
agent_id : str
|
|
97
21
|
|
|
98
|
-
after : typing.Optional[int]
|
|
99
|
-
Unique ID of the memory to start the query range at.
|
|
100
|
-
|
|
101
|
-
before : typing.Optional[int]
|
|
102
|
-
Unique ID of the memory to end the query range at.
|
|
103
|
-
|
|
104
|
-
limit : typing.Optional[int]
|
|
105
|
-
How many results to include in the response.
|
|
106
|
-
|
|
107
22
|
request_options : typing.Optional[RequestOptions]
|
|
108
23
|
Request-specific configuration.
|
|
109
24
|
|
|
110
25
|
Returns
|
|
111
26
|
-------
|
|
112
|
-
|
|
113
|
-
Successful Response
|
|
27
|
+
None
|
|
114
28
|
|
|
115
29
|
Examples
|
|
116
30
|
--------
|
|
@@ -124,59 +38,30 @@ class ArchivalMemoryClient:
|
|
|
124
38
|
)
|
|
125
39
|
"""
|
|
126
40
|
_response = self._client_wrapper.httpx_client.request(
|
|
127
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/
|
|
41
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/archival_memory",
|
|
128
42
|
method="GET",
|
|
129
|
-
params={
|
|
130
|
-
"after": after,
|
|
131
|
-
"before": before,
|
|
132
|
-
"limit": limit,
|
|
133
|
-
},
|
|
134
43
|
request_options=request_options,
|
|
135
44
|
)
|
|
136
45
|
try:
|
|
137
46
|
if 200 <= _response.status_code < 300:
|
|
138
|
-
return
|
|
139
|
-
typing.List[Passage],
|
|
140
|
-
construct_type(
|
|
141
|
-
type_=typing.List[Passage], # type: ignore
|
|
142
|
-
object_=_response.json(),
|
|
143
|
-
),
|
|
144
|
-
)
|
|
145
|
-
if _response.status_code == 422:
|
|
146
|
-
raise UnprocessableEntityError(
|
|
147
|
-
typing.cast(
|
|
148
|
-
HttpValidationError,
|
|
149
|
-
construct_type(
|
|
150
|
-
type_=HttpValidationError, # type: ignore
|
|
151
|
-
object_=_response.json(),
|
|
152
|
-
),
|
|
153
|
-
)
|
|
154
|
-
)
|
|
47
|
+
return
|
|
155
48
|
_response_json = _response.json()
|
|
156
49
|
except JSONDecodeError:
|
|
157
50
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
158
51
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
159
52
|
|
|
160
|
-
def create(
|
|
161
|
-
self, agent_id: str, *, text: str, request_options: typing.Optional[RequestOptions] = None
|
|
162
|
-
) -> typing.List[Passage]:
|
|
53
|
+
def create(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
163
54
|
"""
|
|
164
|
-
Insert a memory into an agent's archival memory store.
|
|
165
|
-
|
|
166
55
|
Parameters
|
|
167
56
|
----------
|
|
168
57
|
agent_id : str
|
|
169
58
|
|
|
170
|
-
text : str
|
|
171
|
-
Text to write to archival memory.
|
|
172
|
-
|
|
173
59
|
request_options : typing.Optional[RequestOptions]
|
|
174
60
|
Request-specific configuration.
|
|
175
61
|
|
|
176
62
|
Returns
|
|
177
63
|
-------
|
|
178
|
-
|
|
179
|
-
Successful Response
|
|
64
|
+
None
|
|
180
65
|
|
|
181
66
|
Examples
|
|
182
67
|
--------
|
|
@@ -187,51 +72,23 @@ class ArchivalMemoryClient:
|
|
|
187
72
|
)
|
|
188
73
|
client.agents.archival_memory.create(
|
|
189
74
|
agent_id="agent_id",
|
|
190
|
-
text="text",
|
|
191
75
|
)
|
|
192
76
|
"""
|
|
193
77
|
_response = self._client_wrapper.httpx_client.request(
|
|
194
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/
|
|
78
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/archival_memory",
|
|
195
79
|
method="POST",
|
|
196
|
-
json={
|
|
197
|
-
"text": text,
|
|
198
|
-
},
|
|
199
|
-
headers={
|
|
200
|
-
"content-type": "application/json",
|
|
201
|
-
},
|
|
202
80
|
request_options=request_options,
|
|
203
|
-
omit=OMIT,
|
|
204
81
|
)
|
|
205
82
|
try:
|
|
206
83
|
if 200 <= _response.status_code < 300:
|
|
207
|
-
return
|
|
208
|
-
typing.List[Passage],
|
|
209
|
-
construct_type(
|
|
210
|
-
type_=typing.List[Passage], # type: ignore
|
|
211
|
-
object_=_response.json(),
|
|
212
|
-
),
|
|
213
|
-
)
|
|
214
|
-
if _response.status_code == 422:
|
|
215
|
-
raise UnprocessableEntityError(
|
|
216
|
-
typing.cast(
|
|
217
|
-
HttpValidationError,
|
|
218
|
-
construct_type(
|
|
219
|
-
type_=HttpValidationError, # type: ignore
|
|
220
|
-
object_=_response.json(),
|
|
221
|
-
),
|
|
222
|
-
)
|
|
223
|
-
)
|
|
84
|
+
return
|
|
224
85
|
_response_json = _response.json()
|
|
225
86
|
except JSONDecodeError:
|
|
226
87
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
227
88
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
228
89
|
|
|
229
|
-
def delete(
|
|
230
|
-
self, agent_id: str, memory_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
231
|
-
) -> typing.Optional[typing.Any]:
|
|
90
|
+
def delete(self, agent_id: str, memory_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
232
91
|
"""
|
|
233
|
-
Delete a memory from an agent's archival memory store.
|
|
234
|
-
|
|
235
92
|
Parameters
|
|
236
93
|
----------
|
|
237
94
|
agent_id : str
|
|
@@ -243,8 +100,7 @@ class ArchivalMemoryClient:
|
|
|
243
100
|
|
|
244
101
|
Returns
|
|
245
102
|
-------
|
|
246
|
-
|
|
247
|
-
Successful Response
|
|
103
|
+
None
|
|
248
104
|
|
|
249
105
|
Examples
|
|
250
106
|
--------
|
|
@@ -259,29 +115,13 @@ class ArchivalMemoryClient:
|
|
|
259
115
|
)
|
|
260
116
|
"""
|
|
261
117
|
_response = self._client_wrapper.httpx_client.request(
|
|
262
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/
|
|
118
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/archival_memory/{jsonable_encoder(memory_id)}",
|
|
263
119
|
method="DELETE",
|
|
264
120
|
request_options=request_options,
|
|
265
121
|
)
|
|
266
122
|
try:
|
|
267
123
|
if 200 <= _response.status_code < 300:
|
|
268
|
-
return
|
|
269
|
-
typing.Optional[typing.Any],
|
|
270
|
-
construct_type(
|
|
271
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
272
|
-
object_=_response.json(),
|
|
273
|
-
),
|
|
274
|
-
)
|
|
275
|
-
if _response.status_code == 422:
|
|
276
|
-
raise UnprocessableEntityError(
|
|
277
|
-
typing.cast(
|
|
278
|
-
HttpValidationError,
|
|
279
|
-
construct_type(
|
|
280
|
-
type_=HttpValidationError, # type: ignore
|
|
281
|
-
object_=_response.json(),
|
|
282
|
-
),
|
|
283
|
-
)
|
|
284
|
-
)
|
|
124
|
+
return
|
|
285
125
|
_response_json = _response.json()
|
|
286
126
|
except JSONDecodeError:
|
|
287
127
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -292,104 +132,18 @@ class AsyncArchivalMemoryClient:
|
|
|
292
132
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
293
133
|
self._client_wrapper = client_wrapper
|
|
294
134
|
|
|
295
|
-
async def
|
|
296
|
-
self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
297
|
-
) -> ArchivalMemorySummary:
|
|
298
|
-
"""
|
|
299
|
-
Retrieve the summary of the archival memory of a specific agent.
|
|
300
|
-
|
|
301
|
-
Parameters
|
|
302
|
-
----------
|
|
303
|
-
agent_id : str
|
|
304
|
-
|
|
305
|
-
request_options : typing.Optional[RequestOptions]
|
|
306
|
-
Request-specific configuration.
|
|
307
|
-
|
|
308
|
-
Returns
|
|
309
|
-
-------
|
|
310
|
-
ArchivalMemorySummary
|
|
311
|
-
Successful Response
|
|
312
|
-
|
|
313
|
-
Examples
|
|
314
|
-
--------
|
|
315
|
-
import asyncio
|
|
316
|
-
|
|
317
|
-
from letta_client import AsyncLetta
|
|
318
|
-
|
|
319
|
-
client = AsyncLetta(
|
|
320
|
-
token="YOUR_TOKEN",
|
|
321
|
-
)
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
async def main() -> None:
|
|
325
|
-
await client.agents.archival_memory.get_summary(
|
|
326
|
-
agent_id="agent_id",
|
|
327
|
-
)
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
asyncio.run(main())
|
|
135
|
+
async def list(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
331
136
|
"""
|
|
332
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
333
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/memory/archival",
|
|
334
|
-
method="GET",
|
|
335
|
-
request_options=request_options,
|
|
336
|
-
)
|
|
337
|
-
try:
|
|
338
|
-
if 200 <= _response.status_code < 300:
|
|
339
|
-
return typing.cast(
|
|
340
|
-
ArchivalMemorySummary,
|
|
341
|
-
construct_type(
|
|
342
|
-
type_=ArchivalMemorySummary, # type: ignore
|
|
343
|
-
object_=_response.json(),
|
|
344
|
-
),
|
|
345
|
-
)
|
|
346
|
-
if _response.status_code == 422:
|
|
347
|
-
raise UnprocessableEntityError(
|
|
348
|
-
typing.cast(
|
|
349
|
-
HttpValidationError,
|
|
350
|
-
construct_type(
|
|
351
|
-
type_=HttpValidationError, # type: ignore
|
|
352
|
-
object_=_response.json(),
|
|
353
|
-
),
|
|
354
|
-
)
|
|
355
|
-
)
|
|
356
|
-
_response_json = _response.json()
|
|
357
|
-
except JSONDecodeError:
|
|
358
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
359
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
360
|
-
|
|
361
|
-
async def list(
|
|
362
|
-
self,
|
|
363
|
-
agent_id: str,
|
|
364
|
-
*,
|
|
365
|
-
after: typing.Optional[int] = None,
|
|
366
|
-
before: typing.Optional[int] = None,
|
|
367
|
-
limit: typing.Optional[int] = None,
|
|
368
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
369
|
-
) -> typing.List[Passage]:
|
|
370
|
-
"""
|
|
371
|
-
Retrieve the memories in an agent's archival memory store (paginated query).
|
|
372
|
-
|
|
373
137
|
Parameters
|
|
374
138
|
----------
|
|
375
139
|
agent_id : str
|
|
376
140
|
|
|
377
|
-
after : typing.Optional[int]
|
|
378
|
-
Unique ID of the memory to start the query range at.
|
|
379
|
-
|
|
380
|
-
before : typing.Optional[int]
|
|
381
|
-
Unique ID of the memory to end the query range at.
|
|
382
|
-
|
|
383
|
-
limit : typing.Optional[int]
|
|
384
|
-
How many results to include in the response.
|
|
385
|
-
|
|
386
141
|
request_options : typing.Optional[RequestOptions]
|
|
387
142
|
Request-specific configuration.
|
|
388
143
|
|
|
389
144
|
Returns
|
|
390
145
|
-------
|
|
391
|
-
|
|
392
|
-
Successful Response
|
|
146
|
+
None
|
|
393
147
|
|
|
394
148
|
Examples
|
|
395
149
|
--------
|
|
@@ -411,59 +165,30 @@ class AsyncArchivalMemoryClient:
|
|
|
411
165
|
asyncio.run(main())
|
|
412
166
|
"""
|
|
413
167
|
_response = await self._client_wrapper.httpx_client.request(
|
|
414
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/
|
|
168
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/archival_memory",
|
|
415
169
|
method="GET",
|
|
416
|
-
params={
|
|
417
|
-
"after": after,
|
|
418
|
-
"before": before,
|
|
419
|
-
"limit": limit,
|
|
420
|
-
},
|
|
421
170
|
request_options=request_options,
|
|
422
171
|
)
|
|
423
172
|
try:
|
|
424
173
|
if 200 <= _response.status_code < 300:
|
|
425
|
-
return
|
|
426
|
-
typing.List[Passage],
|
|
427
|
-
construct_type(
|
|
428
|
-
type_=typing.List[Passage], # type: ignore
|
|
429
|
-
object_=_response.json(),
|
|
430
|
-
),
|
|
431
|
-
)
|
|
432
|
-
if _response.status_code == 422:
|
|
433
|
-
raise UnprocessableEntityError(
|
|
434
|
-
typing.cast(
|
|
435
|
-
HttpValidationError,
|
|
436
|
-
construct_type(
|
|
437
|
-
type_=HttpValidationError, # type: ignore
|
|
438
|
-
object_=_response.json(),
|
|
439
|
-
),
|
|
440
|
-
)
|
|
441
|
-
)
|
|
174
|
+
return
|
|
442
175
|
_response_json = _response.json()
|
|
443
176
|
except JSONDecodeError:
|
|
444
177
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
445
178
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
446
179
|
|
|
447
|
-
async def create(
|
|
448
|
-
self, agent_id: str, *, text: str, request_options: typing.Optional[RequestOptions] = None
|
|
449
|
-
) -> typing.List[Passage]:
|
|
180
|
+
async def create(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
450
181
|
"""
|
|
451
|
-
Insert a memory into an agent's archival memory store.
|
|
452
|
-
|
|
453
182
|
Parameters
|
|
454
183
|
----------
|
|
455
184
|
agent_id : str
|
|
456
185
|
|
|
457
|
-
text : str
|
|
458
|
-
Text to write to archival memory.
|
|
459
|
-
|
|
460
186
|
request_options : typing.Optional[RequestOptions]
|
|
461
187
|
Request-specific configuration.
|
|
462
188
|
|
|
463
189
|
Returns
|
|
464
190
|
-------
|
|
465
|
-
|
|
466
|
-
Successful Response
|
|
191
|
+
None
|
|
467
192
|
|
|
468
193
|
Examples
|
|
469
194
|
--------
|
|
@@ -479,43 +204,19 @@ class AsyncArchivalMemoryClient:
|
|
|
479
204
|
async def main() -> None:
|
|
480
205
|
await client.agents.archival_memory.create(
|
|
481
206
|
agent_id="agent_id",
|
|
482
|
-
text="text",
|
|
483
207
|
)
|
|
484
208
|
|
|
485
209
|
|
|
486
210
|
asyncio.run(main())
|
|
487
211
|
"""
|
|
488
212
|
_response = await self._client_wrapper.httpx_client.request(
|
|
489
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/
|
|
213
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/archival_memory",
|
|
490
214
|
method="POST",
|
|
491
|
-
json={
|
|
492
|
-
"text": text,
|
|
493
|
-
},
|
|
494
|
-
headers={
|
|
495
|
-
"content-type": "application/json",
|
|
496
|
-
},
|
|
497
215
|
request_options=request_options,
|
|
498
|
-
omit=OMIT,
|
|
499
216
|
)
|
|
500
217
|
try:
|
|
501
218
|
if 200 <= _response.status_code < 300:
|
|
502
|
-
return
|
|
503
|
-
typing.List[Passage],
|
|
504
|
-
construct_type(
|
|
505
|
-
type_=typing.List[Passage], # type: ignore
|
|
506
|
-
object_=_response.json(),
|
|
507
|
-
),
|
|
508
|
-
)
|
|
509
|
-
if _response.status_code == 422:
|
|
510
|
-
raise UnprocessableEntityError(
|
|
511
|
-
typing.cast(
|
|
512
|
-
HttpValidationError,
|
|
513
|
-
construct_type(
|
|
514
|
-
type_=HttpValidationError, # type: ignore
|
|
515
|
-
object_=_response.json(),
|
|
516
|
-
),
|
|
517
|
-
)
|
|
518
|
-
)
|
|
219
|
+
return
|
|
519
220
|
_response_json = _response.json()
|
|
520
221
|
except JSONDecodeError:
|
|
521
222
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -523,10 +224,8 @@ class AsyncArchivalMemoryClient:
|
|
|
523
224
|
|
|
524
225
|
async def delete(
|
|
525
226
|
self, agent_id: str, memory_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
526
|
-
) ->
|
|
227
|
+
) -> None:
|
|
527
228
|
"""
|
|
528
|
-
Delete a memory from an agent's archival memory store.
|
|
529
|
-
|
|
530
229
|
Parameters
|
|
531
230
|
----------
|
|
532
231
|
agent_id : str
|
|
@@ -538,8 +237,7 @@ class AsyncArchivalMemoryClient:
|
|
|
538
237
|
|
|
539
238
|
Returns
|
|
540
239
|
-------
|
|
541
|
-
|
|
542
|
-
Successful Response
|
|
240
|
+
None
|
|
543
241
|
|
|
544
242
|
Examples
|
|
545
243
|
--------
|
|
@@ -562,29 +260,13 @@ class AsyncArchivalMemoryClient:
|
|
|
562
260
|
asyncio.run(main())
|
|
563
261
|
"""
|
|
564
262
|
_response = await self._client_wrapper.httpx_client.request(
|
|
565
|
-
f"v1/agents/{jsonable_encoder(agent_id)}/
|
|
263
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/archival_memory/{jsonable_encoder(memory_id)}",
|
|
566
264
|
method="DELETE",
|
|
567
265
|
request_options=request_options,
|
|
568
266
|
)
|
|
569
267
|
try:
|
|
570
268
|
if 200 <= _response.status_code < 300:
|
|
571
|
-
return
|
|
572
|
-
typing.Optional[typing.Any],
|
|
573
|
-
construct_type(
|
|
574
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
575
|
-
object_=_response.json(),
|
|
576
|
-
),
|
|
577
|
-
)
|
|
578
|
-
if _response.status_code == 422:
|
|
579
|
-
raise UnprocessableEntityError(
|
|
580
|
-
typing.cast(
|
|
581
|
-
HttpValidationError,
|
|
582
|
-
construct_type(
|
|
583
|
-
type_=HttpValidationError, # type: ignore
|
|
584
|
-
object_=_response.json(),
|
|
585
|
-
),
|
|
586
|
-
)
|
|
587
|
-
)
|
|
269
|
+
return
|
|
588
270
|
_response_json = _response.json()
|
|
589
271
|
except JSONDecodeError:
|
|
590
272
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|