supermemory 3.0.0a29__py3-none-any.whl → 3.0.0a30__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 supermemory might be problematic. Click here for more details.
- supermemory/_base_client.py +3 -3
- supermemory/_client.py +1 -9
- supermemory/_compat.py +48 -48
- supermemory/_files.py +1 -1
- supermemory/_models.py +40 -40
- supermemory/_types.py +35 -1
- supermemory/_utils/__init__.py +9 -2
- supermemory/_utils/_compat.py +45 -0
- supermemory/_utils/_datetime_parse.py +136 -0
- supermemory/_utils/_transform.py +11 -1
- supermemory/_utils/_typing.py +6 -1
- supermemory/_utils/_utils.py +0 -1
- supermemory/_version.py +1 -1
- supermemory/resources/__init__.py +0 -14
- supermemory/resources/connections.py +14 -14
- supermemory/resources/search.py +9 -9
- supermemory/types/__init__.py +0 -9
- supermemory/types/connection_create_params.py +3 -2
- supermemory/types/connection_delete_by_provider_params.py +2 -2
- supermemory/types/connection_get_by_tags_params.py +2 -2
- supermemory/types/connection_import_params.py +2 -2
- supermemory/types/connection_list_documents_params.py +2 -2
- supermemory/types/connection_list_params.py +2 -2
- supermemory/types/search_documents_params.py +3 -2
- supermemory/types/search_execute_params.py +3 -2
- supermemory/types/search_memories_response.py +10 -7
- {supermemory-3.0.0a29.dist-info → supermemory-3.0.0a30.dist-info}/METADATA +18 -25
- supermemory-3.0.0a30.dist-info/RECORD +60 -0
- supermemory/resources/memories.py +0 -806
- supermemory/types/memory_add_params.py +0 -53
- supermemory/types/memory_add_response.py +0 -11
- supermemory/types/memory_get_response.py +0 -103
- supermemory/types/memory_list_params.py +0 -40
- supermemory/types/memory_list_response.py +0 -94
- supermemory/types/memory_update_params.py +0 -53
- supermemory/types/memory_update_response.py +0 -11
- supermemory/types/memory_upload_file_params.py +0 -16
- supermemory/types/memory_upload_file_response.py +0 -11
- supermemory-3.0.0a29.dist-info/RECORD +0 -68
- {supermemory-3.0.0a29.dist-info → supermemory-3.0.0a30.dist-info}/WHEEL +0 -0
- {supermemory-3.0.0a29.dist-info → supermemory-3.0.0a30.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,806 +0,0 @@
|
|
|
1
|
-
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from typing import Dict, List, Union, Mapping, cast
|
|
6
|
-
from typing_extensions import Literal
|
|
7
|
-
|
|
8
|
-
import httpx
|
|
9
|
-
|
|
10
|
-
from ..types import memory_add_params, memory_list_params, memory_update_params, memory_upload_file_params
|
|
11
|
-
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes
|
|
12
|
-
from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
|
|
13
|
-
from .._compat import cached_property
|
|
14
|
-
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
-
from .._response import (
|
|
16
|
-
to_raw_response_wrapper,
|
|
17
|
-
to_streamed_response_wrapper,
|
|
18
|
-
async_to_raw_response_wrapper,
|
|
19
|
-
async_to_streamed_response_wrapper,
|
|
20
|
-
)
|
|
21
|
-
from .._base_client import make_request_options
|
|
22
|
-
from ..types.memory_add_response import MemoryAddResponse
|
|
23
|
-
from ..types.memory_get_response import MemoryGetResponse
|
|
24
|
-
from ..types.memory_list_response import MemoryListResponse
|
|
25
|
-
from ..types.memory_update_response import MemoryUpdateResponse
|
|
26
|
-
from ..types.memory_upload_file_response import MemoryUploadFileResponse
|
|
27
|
-
|
|
28
|
-
__all__ = ["MemoriesResource", "AsyncMemoriesResource"]
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class MemoriesResource(SyncAPIResource):
|
|
32
|
-
@cached_property
|
|
33
|
-
def with_raw_response(self) -> MemoriesResourceWithRawResponse:
|
|
34
|
-
"""
|
|
35
|
-
This property can be used as a prefix for any HTTP method call to return
|
|
36
|
-
the raw response object instead of the parsed content.
|
|
37
|
-
|
|
38
|
-
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
|
39
|
-
"""
|
|
40
|
-
return MemoriesResourceWithRawResponse(self)
|
|
41
|
-
|
|
42
|
-
@cached_property
|
|
43
|
-
def with_streaming_response(self) -> MemoriesResourceWithStreamingResponse:
|
|
44
|
-
"""
|
|
45
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
46
|
-
|
|
47
|
-
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
|
48
|
-
"""
|
|
49
|
-
return MemoriesResourceWithStreamingResponse(self)
|
|
50
|
-
|
|
51
|
-
def update(
|
|
52
|
-
self,
|
|
53
|
-
id: str,
|
|
54
|
-
*,
|
|
55
|
-
container_tag: str | NotGiven = NOT_GIVEN,
|
|
56
|
-
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
|
57
|
-
content: str | NotGiven = NOT_GIVEN,
|
|
58
|
-
custom_id: str | NotGiven = NOT_GIVEN,
|
|
59
|
-
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
|
|
60
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
61
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
62
|
-
extra_headers: Headers | None = None,
|
|
63
|
-
extra_query: Query | None = None,
|
|
64
|
-
extra_body: Body | None = None,
|
|
65
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
66
|
-
) -> MemoryUpdateResponse:
|
|
67
|
-
"""
|
|
68
|
-
Update a memory with any content type (text, url, file, etc.) and metadata
|
|
69
|
-
|
|
70
|
-
Args:
|
|
71
|
-
container_tag: Optional tag this memory should be containerized by. This can be an ID for your
|
|
72
|
-
user, a project ID, or any other identifier you wish to use to group memories.
|
|
73
|
-
|
|
74
|
-
container_tags: (DEPRECATED: Use containerTag instead) Optional tags this memory should be
|
|
75
|
-
containerized by. This can be an ID for your user, a project ID, or any other
|
|
76
|
-
identifier you wish to use to group memories.
|
|
77
|
-
|
|
78
|
-
content: The content to extract and process into a memory. This can be a URL to a
|
|
79
|
-
website, a PDF, an image, or a video.
|
|
80
|
-
|
|
81
|
-
Plaintext: Any plaintext format
|
|
82
|
-
|
|
83
|
-
URL: A URL to a website, PDF, image, or video
|
|
84
|
-
|
|
85
|
-
We automatically detect the content type from the url's response format.
|
|
86
|
-
|
|
87
|
-
custom_id: Optional custom ID of the memory. This could be an ID from your database that
|
|
88
|
-
will uniquely identify this memory.
|
|
89
|
-
|
|
90
|
-
metadata: Optional metadata for the memory. This is used to store additional information
|
|
91
|
-
about the memory. You can use this to store any additional information you need
|
|
92
|
-
about the memory. Metadata can be filtered through. Keys must be strings and are
|
|
93
|
-
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
|
|
94
|
-
objects.
|
|
95
|
-
|
|
96
|
-
extra_headers: Send extra headers
|
|
97
|
-
|
|
98
|
-
extra_query: Add additional query parameters to the request
|
|
99
|
-
|
|
100
|
-
extra_body: Add additional JSON properties to the request
|
|
101
|
-
|
|
102
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
103
|
-
"""
|
|
104
|
-
if not id:
|
|
105
|
-
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
106
|
-
return self._patch(
|
|
107
|
-
f"/v3/memories/{id}",
|
|
108
|
-
body=maybe_transform(
|
|
109
|
-
{
|
|
110
|
-
"container_tag": container_tag,
|
|
111
|
-
"container_tags": container_tags,
|
|
112
|
-
"content": content,
|
|
113
|
-
"custom_id": custom_id,
|
|
114
|
-
"metadata": metadata,
|
|
115
|
-
},
|
|
116
|
-
memory_update_params.MemoryUpdateParams,
|
|
117
|
-
),
|
|
118
|
-
options=make_request_options(
|
|
119
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
120
|
-
),
|
|
121
|
-
cast_to=MemoryUpdateResponse,
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
def list(
|
|
125
|
-
self,
|
|
126
|
-
*,
|
|
127
|
-
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
|
128
|
-
filters: str | NotGiven = NOT_GIVEN,
|
|
129
|
-
include_content: bool | NotGiven = NOT_GIVEN,
|
|
130
|
-
limit: Union[str, float] | NotGiven = NOT_GIVEN,
|
|
131
|
-
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
|
132
|
-
page: Union[str, float] | NotGiven = NOT_GIVEN,
|
|
133
|
-
sort: Literal["createdAt", "updatedAt"] | NotGiven = NOT_GIVEN,
|
|
134
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
135
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
136
|
-
extra_headers: Headers | None = None,
|
|
137
|
-
extra_query: Query | None = None,
|
|
138
|
-
extra_body: Body | None = None,
|
|
139
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
140
|
-
) -> MemoryListResponse:
|
|
141
|
-
"""
|
|
142
|
-
Retrieves a paginated list of memories with their metadata and workflow status
|
|
143
|
-
|
|
144
|
-
Args:
|
|
145
|
-
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
|
146
|
-
user, a project ID, or any other identifier you wish to use to group memories.
|
|
147
|
-
|
|
148
|
-
filters: Optional filters to apply to the search
|
|
149
|
-
|
|
150
|
-
include_content: Whether to include the content field in the response. Warning: This can make
|
|
151
|
-
responses significantly larger.
|
|
152
|
-
|
|
153
|
-
limit: Number of items per page
|
|
154
|
-
|
|
155
|
-
order: Sort order
|
|
156
|
-
|
|
157
|
-
page: Page number to fetch
|
|
158
|
-
|
|
159
|
-
sort: Field to sort by
|
|
160
|
-
|
|
161
|
-
extra_headers: Send extra headers
|
|
162
|
-
|
|
163
|
-
extra_query: Add additional query parameters to the request
|
|
164
|
-
|
|
165
|
-
extra_body: Add additional JSON properties to the request
|
|
166
|
-
|
|
167
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
168
|
-
"""
|
|
169
|
-
return self._post(
|
|
170
|
-
"/v3/memories/list",
|
|
171
|
-
body=maybe_transform(
|
|
172
|
-
{
|
|
173
|
-
"container_tags": container_tags,
|
|
174
|
-
"filters": filters,
|
|
175
|
-
"include_content": include_content,
|
|
176
|
-
"limit": limit,
|
|
177
|
-
"order": order,
|
|
178
|
-
"page": page,
|
|
179
|
-
"sort": sort,
|
|
180
|
-
},
|
|
181
|
-
memory_list_params.MemoryListParams,
|
|
182
|
-
),
|
|
183
|
-
options=make_request_options(
|
|
184
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
185
|
-
),
|
|
186
|
-
cast_to=MemoryListResponse,
|
|
187
|
-
)
|
|
188
|
-
|
|
189
|
-
def delete(
|
|
190
|
-
self,
|
|
191
|
-
id: str,
|
|
192
|
-
*,
|
|
193
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
194
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
195
|
-
extra_headers: Headers | None = None,
|
|
196
|
-
extra_query: Query | None = None,
|
|
197
|
-
extra_body: Body | None = None,
|
|
198
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
199
|
-
) -> None:
|
|
200
|
-
"""
|
|
201
|
-
Delete a memory by ID
|
|
202
|
-
|
|
203
|
-
Args:
|
|
204
|
-
extra_headers: Send extra headers
|
|
205
|
-
|
|
206
|
-
extra_query: Add additional query parameters to the request
|
|
207
|
-
|
|
208
|
-
extra_body: Add additional JSON properties to the request
|
|
209
|
-
|
|
210
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
211
|
-
"""
|
|
212
|
-
if not id:
|
|
213
|
-
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
214
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
215
|
-
return self._delete(
|
|
216
|
-
f"/v3/memories/{id}",
|
|
217
|
-
options=make_request_options(
|
|
218
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
219
|
-
),
|
|
220
|
-
cast_to=NoneType,
|
|
221
|
-
)
|
|
222
|
-
|
|
223
|
-
def add(
|
|
224
|
-
self,
|
|
225
|
-
*,
|
|
226
|
-
container_tag: str | NotGiven = NOT_GIVEN,
|
|
227
|
-
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
|
228
|
-
content: str | NotGiven = NOT_GIVEN,
|
|
229
|
-
custom_id: str | NotGiven = NOT_GIVEN,
|
|
230
|
-
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
|
|
231
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
232
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
233
|
-
extra_headers: Headers | None = None,
|
|
234
|
-
extra_query: Query | None = None,
|
|
235
|
-
extra_body: Body | None = None,
|
|
236
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
237
|
-
) -> MemoryAddResponse:
|
|
238
|
-
"""
|
|
239
|
-
Add a memory with any content type (text, url, file, etc.) and metadata
|
|
240
|
-
|
|
241
|
-
Args:
|
|
242
|
-
container_tag: Optional tag this memory should be containerized by. This can be an ID for your
|
|
243
|
-
user, a project ID, or any other identifier you wish to use to group memories.
|
|
244
|
-
|
|
245
|
-
container_tags: (DEPRECATED: Use containerTag instead) Optional tags this memory should be
|
|
246
|
-
containerized by. This can be an ID for your user, a project ID, or any other
|
|
247
|
-
identifier you wish to use to group memories.
|
|
248
|
-
|
|
249
|
-
content: The content to extract and process into a memory. This can be a URL to a
|
|
250
|
-
website, a PDF, an image, or a video.
|
|
251
|
-
|
|
252
|
-
Plaintext: Any plaintext format
|
|
253
|
-
|
|
254
|
-
URL: A URL to a website, PDF, image, or video
|
|
255
|
-
|
|
256
|
-
We automatically detect the content type from the url's response format.
|
|
257
|
-
|
|
258
|
-
custom_id: Optional custom ID of the memory. This could be an ID from your database that
|
|
259
|
-
will uniquely identify this memory.
|
|
260
|
-
|
|
261
|
-
metadata: Optional metadata for the memory. This is used to store additional information
|
|
262
|
-
about the memory. You can use this to store any additional information you need
|
|
263
|
-
about the memory. Metadata can be filtered through. Keys must be strings and are
|
|
264
|
-
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
|
|
265
|
-
objects.
|
|
266
|
-
|
|
267
|
-
extra_headers: Send extra headers
|
|
268
|
-
|
|
269
|
-
extra_query: Add additional query parameters to the request
|
|
270
|
-
|
|
271
|
-
extra_body: Add additional JSON properties to the request
|
|
272
|
-
|
|
273
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
274
|
-
"""
|
|
275
|
-
return self._post(
|
|
276
|
-
"/v3/memories",
|
|
277
|
-
body=maybe_transform(
|
|
278
|
-
{
|
|
279
|
-
"container_tag": container_tag,
|
|
280
|
-
"container_tags": container_tags,
|
|
281
|
-
"content": content,
|
|
282
|
-
"custom_id": custom_id,
|
|
283
|
-
"metadata": metadata,
|
|
284
|
-
},
|
|
285
|
-
memory_add_params.MemoryAddParams,
|
|
286
|
-
),
|
|
287
|
-
options=make_request_options(
|
|
288
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
289
|
-
),
|
|
290
|
-
cast_to=MemoryAddResponse,
|
|
291
|
-
)
|
|
292
|
-
|
|
293
|
-
def get(
|
|
294
|
-
self,
|
|
295
|
-
id: str,
|
|
296
|
-
*,
|
|
297
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
298
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
299
|
-
extra_headers: Headers | None = None,
|
|
300
|
-
extra_query: Query | None = None,
|
|
301
|
-
extra_body: Body | None = None,
|
|
302
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
303
|
-
) -> MemoryGetResponse:
|
|
304
|
-
"""
|
|
305
|
-
Get a memory by ID
|
|
306
|
-
|
|
307
|
-
Args:
|
|
308
|
-
extra_headers: Send extra headers
|
|
309
|
-
|
|
310
|
-
extra_query: Add additional query parameters to the request
|
|
311
|
-
|
|
312
|
-
extra_body: Add additional JSON properties to the request
|
|
313
|
-
|
|
314
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
315
|
-
"""
|
|
316
|
-
if not id:
|
|
317
|
-
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
318
|
-
return self._get(
|
|
319
|
-
f"/v3/memories/{id}",
|
|
320
|
-
options=make_request_options(
|
|
321
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
322
|
-
),
|
|
323
|
-
cast_to=MemoryGetResponse,
|
|
324
|
-
)
|
|
325
|
-
|
|
326
|
-
def upload_file(
|
|
327
|
-
self,
|
|
328
|
-
*,
|
|
329
|
-
file: FileTypes,
|
|
330
|
-
container_tags: str | NotGiven = NOT_GIVEN,
|
|
331
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
332
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
333
|
-
extra_headers: Headers | None = None,
|
|
334
|
-
extra_query: Query | None = None,
|
|
335
|
-
extra_body: Body | None = None,
|
|
336
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
337
|
-
) -> MemoryUploadFileResponse:
|
|
338
|
-
"""
|
|
339
|
-
Upload a file to be processed
|
|
340
|
-
|
|
341
|
-
Args:
|
|
342
|
-
extra_headers: Send extra headers
|
|
343
|
-
|
|
344
|
-
extra_query: Add additional query parameters to the request
|
|
345
|
-
|
|
346
|
-
extra_body: Add additional JSON properties to the request
|
|
347
|
-
|
|
348
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
349
|
-
"""
|
|
350
|
-
body = deepcopy_minimal(
|
|
351
|
-
{
|
|
352
|
-
"file": file,
|
|
353
|
-
"container_tags": container_tags,
|
|
354
|
-
}
|
|
355
|
-
)
|
|
356
|
-
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
|
357
|
-
# It should be noted that the actual Content-Type header that will be
|
|
358
|
-
# sent to the server will contain a `boundary` parameter, e.g.
|
|
359
|
-
# multipart/form-data; boundary=---abc--
|
|
360
|
-
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
361
|
-
return self._post(
|
|
362
|
-
"/v3/memories/file",
|
|
363
|
-
body=maybe_transform(body, memory_upload_file_params.MemoryUploadFileParams),
|
|
364
|
-
files=files,
|
|
365
|
-
options=make_request_options(
|
|
366
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
367
|
-
),
|
|
368
|
-
cast_to=MemoryUploadFileResponse,
|
|
369
|
-
)
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
class AsyncMemoriesResource(AsyncAPIResource):
|
|
373
|
-
@cached_property
|
|
374
|
-
def with_raw_response(self) -> AsyncMemoriesResourceWithRawResponse:
|
|
375
|
-
"""
|
|
376
|
-
This property can be used as a prefix for any HTTP method call to return
|
|
377
|
-
the raw response object instead of the parsed content.
|
|
378
|
-
|
|
379
|
-
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
|
380
|
-
"""
|
|
381
|
-
return AsyncMemoriesResourceWithRawResponse(self)
|
|
382
|
-
|
|
383
|
-
@cached_property
|
|
384
|
-
def with_streaming_response(self) -> AsyncMemoriesResourceWithStreamingResponse:
|
|
385
|
-
"""
|
|
386
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
387
|
-
|
|
388
|
-
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
|
389
|
-
"""
|
|
390
|
-
return AsyncMemoriesResourceWithStreamingResponse(self)
|
|
391
|
-
|
|
392
|
-
async def update(
|
|
393
|
-
self,
|
|
394
|
-
id: str,
|
|
395
|
-
*,
|
|
396
|
-
container_tag: str | NotGiven = NOT_GIVEN,
|
|
397
|
-
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
|
398
|
-
content: str | NotGiven = NOT_GIVEN,
|
|
399
|
-
custom_id: str | NotGiven = NOT_GIVEN,
|
|
400
|
-
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
|
|
401
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
402
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
403
|
-
extra_headers: Headers | None = None,
|
|
404
|
-
extra_query: Query | None = None,
|
|
405
|
-
extra_body: Body | None = None,
|
|
406
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
407
|
-
) -> MemoryUpdateResponse:
|
|
408
|
-
"""
|
|
409
|
-
Update a memory with any content type (text, url, file, etc.) and metadata
|
|
410
|
-
|
|
411
|
-
Args:
|
|
412
|
-
container_tag: Optional tag this memory should be containerized by. This can be an ID for your
|
|
413
|
-
user, a project ID, or any other identifier you wish to use to group memories.
|
|
414
|
-
|
|
415
|
-
container_tags: (DEPRECATED: Use containerTag instead) Optional tags this memory should be
|
|
416
|
-
containerized by. This can be an ID for your user, a project ID, or any other
|
|
417
|
-
identifier you wish to use to group memories.
|
|
418
|
-
|
|
419
|
-
content: The content to extract and process into a memory. This can be a URL to a
|
|
420
|
-
website, a PDF, an image, or a video.
|
|
421
|
-
|
|
422
|
-
Plaintext: Any plaintext format
|
|
423
|
-
|
|
424
|
-
URL: A URL to a website, PDF, image, or video
|
|
425
|
-
|
|
426
|
-
We automatically detect the content type from the url's response format.
|
|
427
|
-
|
|
428
|
-
custom_id: Optional custom ID of the memory. This could be an ID from your database that
|
|
429
|
-
will uniquely identify this memory.
|
|
430
|
-
|
|
431
|
-
metadata: Optional metadata for the memory. This is used to store additional information
|
|
432
|
-
about the memory. You can use this to store any additional information you need
|
|
433
|
-
about the memory. Metadata can be filtered through. Keys must be strings and are
|
|
434
|
-
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
|
|
435
|
-
objects.
|
|
436
|
-
|
|
437
|
-
extra_headers: Send extra headers
|
|
438
|
-
|
|
439
|
-
extra_query: Add additional query parameters to the request
|
|
440
|
-
|
|
441
|
-
extra_body: Add additional JSON properties to the request
|
|
442
|
-
|
|
443
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
444
|
-
"""
|
|
445
|
-
if not id:
|
|
446
|
-
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
447
|
-
return await self._patch(
|
|
448
|
-
f"/v3/memories/{id}",
|
|
449
|
-
body=await async_maybe_transform(
|
|
450
|
-
{
|
|
451
|
-
"container_tag": container_tag,
|
|
452
|
-
"container_tags": container_tags,
|
|
453
|
-
"content": content,
|
|
454
|
-
"custom_id": custom_id,
|
|
455
|
-
"metadata": metadata,
|
|
456
|
-
},
|
|
457
|
-
memory_update_params.MemoryUpdateParams,
|
|
458
|
-
),
|
|
459
|
-
options=make_request_options(
|
|
460
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
461
|
-
),
|
|
462
|
-
cast_to=MemoryUpdateResponse,
|
|
463
|
-
)
|
|
464
|
-
|
|
465
|
-
async def list(
|
|
466
|
-
self,
|
|
467
|
-
*,
|
|
468
|
-
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
|
469
|
-
filters: str | NotGiven = NOT_GIVEN,
|
|
470
|
-
include_content: bool | NotGiven = NOT_GIVEN,
|
|
471
|
-
limit: Union[str, float] | NotGiven = NOT_GIVEN,
|
|
472
|
-
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
|
473
|
-
page: Union[str, float] | NotGiven = NOT_GIVEN,
|
|
474
|
-
sort: Literal["createdAt", "updatedAt"] | NotGiven = NOT_GIVEN,
|
|
475
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
476
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
477
|
-
extra_headers: Headers | None = None,
|
|
478
|
-
extra_query: Query | None = None,
|
|
479
|
-
extra_body: Body | None = None,
|
|
480
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
481
|
-
) -> MemoryListResponse:
|
|
482
|
-
"""
|
|
483
|
-
Retrieves a paginated list of memories with their metadata and workflow status
|
|
484
|
-
|
|
485
|
-
Args:
|
|
486
|
-
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
|
487
|
-
user, a project ID, or any other identifier you wish to use to group memories.
|
|
488
|
-
|
|
489
|
-
filters: Optional filters to apply to the search
|
|
490
|
-
|
|
491
|
-
include_content: Whether to include the content field in the response. Warning: This can make
|
|
492
|
-
responses significantly larger.
|
|
493
|
-
|
|
494
|
-
limit: Number of items per page
|
|
495
|
-
|
|
496
|
-
order: Sort order
|
|
497
|
-
|
|
498
|
-
page: Page number to fetch
|
|
499
|
-
|
|
500
|
-
sort: Field to sort by
|
|
501
|
-
|
|
502
|
-
extra_headers: Send extra headers
|
|
503
|
-
|
|
504
|
-
extra_query: Add additional query parameters to the request
|
|
505
|
-
|
|
506
|
-
extra_body: Add additional JSON properties to the request
|
|
507
|
-
|
|
508
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
509
|
-
"""
|
|
510
|
-
return await self._post(
|
|
511
|
-
"/v3/memories/list",
|
|
512
|
-
body=await async_maybe_transform(
|
|
513
|
-
{
|
|
514
|
-
"container_tags": container_tags,
|
|
515
|
-
"filters": filters,
|
|
516
|
-
"include_content": include_content,
|
|
517
|
-
"limit": limit,
|
|
518
|
-
"order": order,
|
|
519
|
-
"page": page,
|
|
520
|
-
"sort": sort,
|
|
521
|
-
},
|
|
522
|
-
memory_list_params.MemoryListParams,
|
|
523
|
-
),
|
|
524
|
-
options=make_request_options(
|
|
525
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
526
|
-
),
|
|
527
|
-
cast_to=MemoryListResponse,
|
|
528
|
-
)
|
|
529
|
-
|
|
530
|
-
async def delete(
|
|
531
|
-
self,
|
|
532
|
-
id: str,
|
|
533
|
-
*,
|
|
534
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
535
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
536
|
-
extra_headers: Headers | None = None,
|
|
537
|
-
extra_query: Query | None = None,
|
|
538
|
-
extra_body: Body | None = None,
|
|
539
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
540
|
-
) -> None:
|
|
541
|
-
"""
|
|
542
|
-
Delete a memory by ID
|
|
543
|
-
|
|
544
|
-
Args:
|
|
545
|
-
extra_headers: Send extra headers
|
|
546
|
-
|
|
547
|
-
extra_query: Add additional query parameters to the request
|
|
548
|
-
|
|
549
|
-
extra_body: Add additional JSON properties to the request
|
|
550
|
-
|
|
551
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
552
|
-
"""
|
|
553
|
-
if not id:
|
|
554
|
-
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
555
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
556
|
-
return await self._delete(
|
|
557
|
-
f"/v3/memories/{id}",
|
|
558
|
-
options=make_request_options(
|
|
559
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
560
|
-
),
|
|
561
|
-
cast_to=NoneType,
|
|
562
|
-
)
|
|
563
|
-
|
|
564
|
-
async def add(
|
|
565
|
-
self,
|
|
566
|
-
*,
|
|
567
|
-
container_tag: str | NotGiven = NOT_GIVEN,
|
|
568
|
-
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
|
569
|
-
content: str | NotGiven = NOT_GIVEN,
|
|
570
|
-
custom_id: str | NotGiven = NOT_GIVEN,
|
|
571
|
-
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
|
|
572
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
573
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
574
|
-
extra_headers: Headers | None = None,
|
|
575
|
-
extra_query: Query | None = None,
|
|
576
|
-
extra_body: Body | None = None,
|
|
577
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
578
|
-
) -> MemoryAddResponse:
|
|
579
|
-
"""
|
|
580
|
-
Add a memory with any content type (text, url, file, etc.) and metadata
|
|
581
|
-
|
|
582
|
-
Args:
|
|
583
|
-
container_tag: Optional tag this memory should be containerized by. This can be an ID for your
|
|
584
|
-
user, a project ID, or any other identifier you wish to use to group memories.
|
|
585
|
-
|
|
586
|
-
container_tags: (DEPRECATED: Use containerTag instead) Optional tags this memory should be
|
|
587
|
-
containerized by. This can be an ID for your user, a project ID, or any other
|
|
588
|
-
identifier you wish to use to group memories.
|
|
589
|
-
|
|
590
|
-
content: The content to extract and process into a memory. This can be a URL to a
|
|
591
|
-
website, a PDF, an image, or a video.
|
|
592
|
-
|
|
593
|
-
Plaintext: Any plaintext format
|
|
594
|
-
|
|
595
|
-
URL: A URL to a website, PDF, image, or video
|
|
596
|
-
|
|
597
|
-
We automatically detect the content type from the url's response format.
|
|
598
|
-
|
|
599
|
-
custom_id: Optional custom ID of the memory. This could be an ID from your database that
|
|
600
|
-
will uniquely identify this memory.
|
|
601
|
-
|
|
602
|
-
metadata: Optional metadata for the memory. This is used to store additional information
|
|
603
|
-
about the memory. You can use this to store any additional information you need
|
|
604
|
-
about the memory. Metadata can be filtered through. Keys must be strings and are
|
|
605
|
-
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
|
|
606
|
-
objects.
|
|
607
|
-
|
|
608
|
-
extra_headers: Send extra headers
|
|
609
|
-
|
|
610
|
-
extra_query: Add additional query parameters to the request
|
|
611
|
-
|
|
612
|
-
extra_body: Add additional JSON properties to the request
|
|
613
|
-
|
|
614
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
615
|
-
"""
|
|
616
|
-
return await self._post(
|
|
617
|
-
"/v3/memories",
|
|
618
|
-
body=await async_maybe_transform(
|
|
619
|
-
{
|
|
620
|
-
"container_tag": container_tag,
|
|
621
|
-
"container_tags": container_tags,
|
|
622
|
-
"content": content,
|
|
623
|
-
"custom_id": custom_id,
|
|
624
|
-
"metadata": metadata,
|
|
625
|
-
},
|
|
626
|
-
memory_add_params.MemoryAddParams,
|
|
627
|
-
),
|
|
628
|
-
options=make_request_options(
|
|
629
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
630
|
-
),
|
|
631
|
-
cast_to=MemoryAddResponse,
|
|
632
|
-
)
|
|
633
|
-
|
|
634
|
-
async def get(
|
|
635
|
-
self,
|
|
636
|
-
id: str,
|
|
637
|
-
*,
|
|
638
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
639
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
640
|
-
extra_headers: Headers | None = None,
|
|
641
|
-
extra_query: Query | None = None,
|
|
642
|
-
extra_body: Body | None = None,
|
|
643
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
644
|
-
) -> MemoryGetResponse:
|
|
645
|
-
"""
|
|
646
|
-
Get a memory by ID
|
|
647
|
-
|
|
648
|
-
Args:
|
|
649
|
-
extra_headers: Send extra headers
|
|
650
|
-
|
|
651
|
-
extra_query: Add additional query parameters to the request
|
|
652
|
-
|
|
653
|
-
extra_body: Add additional JSON properties to the request
|
|
654
|
-
|
|
655
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
656
|
-
"""
|
|
657
|
-
if not id:
|
|
658
|
-
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
659
|
-
return await self._get(
|
|
660
|
-
f"/v3/memories/{id}",
|
|
661
|
-
options=make_request_options(
|
|
662
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
663
|
-
),
|
|
664
|
-
cast_to=MemoryGetResponse,
|
|
665
|
-
)
|
|
666
|
-
|
|
667
|
-
async def upload_file(
|
|
668
|
-
self,
|
|
669
|
-
*,
|
|
670
|
-
file: FileTypes,
|
|
671
|
-
container_tags: str | NotGiven = NOT_GIVEN,
|
|
672
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
673
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
674
|
-
extra_headers: Headers | None = None,
|
|
675
|
-
extra_query: Query | None = None,
|
|
676
|
-
extra_body: Body | None = None,
|
|
677
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
678
|
-
) -> MemoryUploadFileResponse:
|
|
679
|
-
"""
|
|
680
|
-
Upload a file to be processed
|
|
681
|
-
|
|
682
|
-
Args:
|
|
683
|
-
extra_headers: Send extra headers
|
|
684
|
-
|
|
685
|
-
extra_query: Add additional query parameters to the request
|
|
686
|
-
|
|
687
|
-
extra_body: Add additional JSON properties to the request
|
|
688
|
-
|
|
689
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
690
|
-
"""
|
|
691
|
-
body = deepcopy_minimal(
|
|
692
|
-
{
|
|
693
|
-
"file": file,
|
|
694
|
-
"container_tags": container_tags,
|
|
695
|
-
}
|
|
696
|
-
)
|
|
697
|
-
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
|
698
|
-
# It should be noted that the actual Content-Type header that will be
|
|
699
|
-
# sent to the server will contain a `boundary` parameter, e.g.
|
|
700
|
-
# multipart/form-data; boundary=---abc--
|
|
701
|
-
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
702
|
-
return await self._post(
|
|
703
|
-
"/v3/memories/file",
|
|
704
|
-
body=await async_maybe_transform(body, memory_upload_file_params.MemoryUploadFileParams),
|
|
705
|
-
files=files,
|
|
706
|
-
options=make_request_options(
|
|
707
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
708
|
-
),
|
|
709
|
-
cast_to=MemoryUploadFileResponse,
|
|
710
|
-
)
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
class MemoriesResourceWithRawResponse:
|
|
714
|
-
def __init__(self, memories: MemoriesResource) -> None:
|
|
715
|
-
self._memories = memories
|
|
716
|
-
|
|
717
|
-
self.update = to_raw_response_wrapper(
|
|
718
|
-
memories.update,
|
|
719
|
-
)
|
|
720
|
-
self.list = to_raw_response_wrapper(
|
|
721
|
-
memories.list,
|
|
722
|
-
)
|
|
723
|
-
self.delete = to_raw_response_wrapper(
|
|
724
|
-
memories.delete,
|
|
725
|
-
)
|
|
726
|
-
self.add = to_raw_response_wrapper(
|
|
727
|
-
memories.add,
|
|
728
|
-
)
|
|
729
|
-
self.get = to_raw_response_wrapper(
|
|
730
|
-
memories.get,
|
|
731
|
-
)
|
|
732
|
-
self.upload_file = to_raw_response_wrapper(
|
|
733
|
-
memories.upload_file,
|
|
734
|
-
)
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
class AsyncMemoriesResourceWithRawResponse:
|
|
738
|
-
def __init__(self, memories: AsyncMemoriesResource) -> None:
|
|
739
|
-
self._memories = memories
|
|
740
|
-
|
|
741
|
-
self.update = async_to_raw_response_wrapper(
|
|
742
|
-
memories.update,
|
|
743
|
-
)
|
|
744
|
-
self.list = async_to_raw_response_wrapper(
|
|
745
|
-
memories.list,
|
|
746
|
-
)
|
|
747
|
-
self.delete = async_to_raw_response_wrapper(
|
|
748
|
-
memories.delete,
|
|
749
|
-
)
|
|
750
|
-
self.add = async_to_raw_response_wrapper(
|
|
751
|
-
memories.add,
|
|
752
|
-
)
|
|
753
|
-
self.get = async_to_raw_response_wrapper(
|
|
754
|
-
memories.get,
|
|
755
|
-
)
|
|
756
|
-
self.upload_file = async_to_raw_response_wrapper(
|
|
757
|
-
memories.upload_file,
|
|
758
|
-
)
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
class MemoriesResourceWithStreamingResponse:
|
|
762
|
-
def __init__(self, memories: MemoriesResource) -> None:
|
|
763
|
-
self._memories = memories
|
|
764
|
-
|
|
765
|
-
self.update = to_streamed_response_wrapper(
|
|
766
|
-
memories.update,
|
|
767
|
-
)
|
|
768
|
-
self.list = to_streamed_response_wrapper(
|
|
769
|
-
memories.list,
|
|
770
|
-
)
|
|
771
|
-
self.delete = to_streamed_response_wrapper(
|
|
772
|
-
memories.delete,
|
|
773
|
-
)
|
|
774
|
-
self.add = to_streamed_response_wrapper(
|
|
775
|
-
memories.add,
|
|
776
|
-
)
|
|
777
|
-
self.get = to_streamed_response_wrapper(
|
|
778
|
-
memories.get,
|
|
779
|
-
)
|
|
780
|
-
self.upload_file = to_streamed_response_wrapper(
|
|
781
|
-
memories.upload_file,
|
|
782
|
-
)
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
class AsyncMemoriesResourceWithStreamingResponse:
|
|
786
|
-
def __init__(self, memories: AsyncMemoriesResource) -> None:
|
|
787
|
-
self._memories = memories
|
|
788
|
-
|
|
789
|
-
self.update = async_to_streamed_response_wrapper(
|
|
790
|
-
memories.update,
|
|
791
|
-
)
|
|
792
|
-
self.list = async_to_streamed_response_wrapper(
|
|
793
|
-
memories.list,
|
|
794
|
-
)
|
|
795
|
-
self.delete = async_to_streamed_response_wrapper(
|
|
796
|
-
memories.delete,
|
|
797
|
-
)
|
|
798
|
-
self.add = async_to_streamed_response_wrapper(
|
|
799
|
-
memories.add,
|
|
800
|
-
)
|
|
801
|
-
self.get = async_to_streamed_response_wrapper(
|
|
802
|
-
memories.get,
|
|
803
|
-
)
|
|
804
|
-
self.upload_file = async_to_streamed_response_wrapper(
|
|
805
|
-
memories.upload_file,
|
|
806
|
-
)
|