supermemory 0.1.0a1__py3-none-any.whl → 3.0.0a2__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.
- supermemory/__init__.py +7 -1
- supermemory/_base_client.py +44 -2
- supermemory/_client.py +21 -29
- supermemory/_models.py +2 -0
- supermemory/_types.py +2 -0
- supermemory/_utils/_proxy.py +4 -1
- supermemory/_utils/_resources_proxy.py +24 -0
- supermemory/_version.py +1 -1
- supermemory/resources/__init__.py +26 -40
- supermemory/resources/{connection.py → connections.py} +86 -80
- supermemory/resources/{memory.py → memories.py} +224 -176
- supermemory/resources/settings.py +102 -19
- supermemory/types/__init__.py +6 -7
- supermemory/types/connection_create_params.py +7 -2
- supermemory/types/connection_create_response.py +7 -1
- supermemory/types/connection_get_response.py +25 -0
- supermemory/types/memory_add_params.py +46 -0
- supermemory/types/{memory_create_response.py → memory_add_response.py} +2 -2
- supermemory/types/memory_get_response.py +79 -9
- supermemory/types/memory_update_params.py +46 -0
- supermemory/types/{memory_delete_response.py → memory_update_response.py} +5 -3
- supermemory/types/setting_get_response.py +45 -0
- supermemory/types/setting_update_params.py +28 -12
- supermemory/types/setting_update_response.py +31 -13
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a2.dist-info}/METADATA +52 -15
- supermemory-3.0.0a2.dist-info/RECORD +46 -0
- supermemory/resources/search.py +0 -254
- supermemory/types/memory_create_params.py +0 -23
- supermemory/types/memory_list_params.py +0 -24
- supermemory/types/memory_list_response.py +0 -59
- supermemory/types/search_execute_params.py +0 -56
- supermemory/types/search_execute_response.py +0 -52
- supermemory-0.1.0a1.dist-info/RECORD +0 -47
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a2.dist-info}/WHEEL +0 -0
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a2.dist-info}/licenses/LICENSE +0 -0
@@ -2,13 +2,12 @@
|
|
2
2
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
|
-
from typing import Dict, Union
|
6
|
-
from typing_extensions import Literal
|
5
|
+
from typing import Dict, List, Union
|
7
6
|
|
8
7
|
import httpx
|
9
8
|
|
10
|
-
from ..types import
|
11
|
-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
9
|
+
from ..types import memory_add_params, memory_update_params
|
10
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
12
11
|
from .._utils import maybe_transform, async_maybe_transform
|
13
12
|
from .._compat import cached_property
|
14
13
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
@@ -19,57 +18,72 @@ from .._response import (
|
|
19
18
|
async_to_streamed_response_wrapper,
|
20
19
|
)
|
21
20
|
from .._base_client import make_request_options
|
21
|
+
from ..types.memory_add_response import MemoryAddResponse
|
22
22
|
from ..types.memory_get_response import MemoryGetResponse
|
23
|
-
from ..types.
|
24
|
-
from ..types.memory_create_response import MemoryCreateResponse
|
25
|
-
from ..types.memory_delete_response import MemoryDeleteResponse
|
23
|
+
from ..types.memory_update_response import MemoryUpdateResponse
|
26
24
|
|
27
|
-
__all__ = ["
|
25
|
+
__all__ = ["MemoriesResource", "AsyncMemoriesResource"]
|
28
26
|
|
29
27
|
|
30
|
-
class
|
28
|
+
class MemoriesResource(SyncAPIResource):
|
31
29
|
@cached_property
|
32
|
-
def with_raw_response(self) ->
|
30
|
+
def with_raw_response(self) -> MemoriesResourceWithRawResponse:
|
33
31
|
"""
|
34
32
|
This property can be used as a prefix for any HTTP method call to return
|
35
33
|
the raw response object instead of the parsed content.
|
36
34
|
|
37
35
|
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
38
36
|
"""
|
39
|
-
return
|
37
|
+
return MemoriesResourceWithRawResponse(self)
|
40
38
|
|
41
39
|
@cached_property
|
42
|
-
def with_streaming_response(self) ->
|
40
|
+
def with_streaming_response(self) -> MemoriesResourceWithStreamingResponse:
|
43
41
|
"""
|
44
42
|
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
45
43
|
|
46
44
|
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
47
45
|
"""
|
48
|
-
return
|
46
|
+
return MemoriesResourceWithStreamingResponse(self)
|
49
47
|
|
50
|
-
def
|
48
|
+
def update(
|
51
49
|
self,
|
50
|
+
id: str,
|
52
51
|
*,
|
53
52
|
content: str,
|
54
|
-
|
53
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
54
|
+
custom_id: str | NotGiven = NOT_GIVEN,
|
55
55
|
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
|
56
|
-
user_id: str | NotGiven = NOT_GIVEN,
|
57
56
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
58
57
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
59
58
|
extra_headers: Headers | None = None,
|
60
59
|
extra_query: Query | None = None,
|
61
60
|
extra_body: Body | None = None,
|
62
61
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
63
|
-
) ->
|
62
|
+
) -> MemoryUpdateResponse:
|
64
63
|
"""
|
65
|
-
|
64
|
+
Update a memory with any content type (text, url, file, etc.) and metadata
|
66
65
|
|
67
66
|
Args:
|
68
|
-
content:
|
67
|
+
content: The content to extract and process into a memory. This can be a URL to a
|
68
|
+
website, a PDF, an image, or a video.
|
69
|
+
|
70
|
+
Plaintext: Any plaintext format
|
71
|
+
|
72
|
+
URL: A URL to a website, PDF, image, or video
|
69
73
|
|
70
|
-
|
74
|
+
We automatically detect the content type from the url's response format.
|
71
75
|
|
72
|
-
|
76
|
+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
77
|
+
user, a project ID, or any other identifier you wish to use to group memories.
|
78
|
+
|
79
|
+
custom_id: Optional custom ID of the memory. This could be an ID from your database that
|
80
|
+
will uniquely identify this memory.
|
81
|
+
|
82
|
+
metadata: Optional metadata for the memory. This is used to store additional information
|
83
|
+
about the memory. You can use this to store any additional information you need
|
84
|
+
about the memory. Metadata can be filtered through. Keys must be strings and are
|
85
|
+
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
|
86
|
+
objects.
|
73
87
|
|
74
88
|
extra_headers: Send extra headers
|
75
89
|
|
@@ -79,52 +93,40 @@ class MemoryResource(SyncAPIResource):
|
|
79
93
|
|
80
94
|
timeout: Override the client-level default timeout for this request, in seconds
|
81
95
|
"""
|
82
|
-
|
83
|
-
"
|
96
|
+
if not id:
|
97
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
98
|
+
return self._patch(
|
99
|
+
f"/v3/memories/{id}",
|
84
100
|
body=maybe_transform(
|
85
101
|
{
|
86
102
|
"content": content,
|
87
|
-
"
|
103
|
+
"container_tags": container_tags,
|
104
|
+
"custom_id": custom_id,
|
88
105
|
"metadata": metadata,
|
89
|
-
"user_id": user_id,
|
90
106
|
},
|
91
|
-
|
107
|
+
memory_update_params.MemoryUpdateParams,
|
92
108
|
),
|
93
109
|
options=make_request_options(
|
94
110
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
95
111
|
),
|
96
|
-
cast_to=
|
112
|
+
cast_to=MemoryUpdateResponse,
|
97
113
|
)
|
98
114
|
|
99
|
-
def
|
115
|
+
def delete(
|
100
116
|
self,
|
117
|
+
id: str,
|
101
118
|
*,
|
102
|
-
filters: str | NotGiven = NOT_GIVEN,
|
103
|
-
limit: str | NotGiven = NOT_GIVEN,
|
104
|
-
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
105
|
-
page: str | NotGiven = NOT_GIVEN,
|
106
|
-
sort: Literal["createdAt", "updatedAt"] | NotGiven = NOT_GIVEN,
|
107
119
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
108
120
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
109
121
|
extra_headers: Headers | None = None,
|
110
122
|
extra_query: Query | None = None,
|
111
123
|
extra_body: Body | None = None,
|
112
124
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
113
|
-
) ->
|
125
|
+
) -> None:
|
114
126
|
"""
|
115
|
-
|
127
|
+
Delete a memory
|
116
128
|
|
117
129
|
Args:
|
118
|
-
filters: Optional filters to apply to the search
|
119
|
-
|
120
|
-
limit: Number of items per page
|
121
|
-
|
122
|
-
order: Sort order
|
123
|
-
|
124
|
-
page: Page number to fetch
|
125
|
-
|
126
|
-
sort: Field to sort by
|
127
|
-
|
128
130
|
extra_headers: Send extra headers
|
129
131
|
|
130
132
|
extra_query: Add additional query parameters to the request
|
@@ -133,42 +135,56 @@ class MemoryResource(SyncAPIResource):
|
|
133
135
|
|
134
136
|
timeout: Override the client-level default timeout for this request, in seconds
|
135
137
|
"""
|
136
|
-
|
137
|
-
"
|
138
|
+
if not id:
|
139
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
140
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
141
|
+
return self._delete(
|
142
|
+
f"/v3/memories/{id}",
|
138
143
|
options=make_request_options(
|
139
|
-
extra_headers=extra_headers,
|
140
|
-
extra_query=extra_query,
|
141
|
-
extra_body=extra_body,
|
142
|
-
timeout=timeout,
|
143
|
-
query=maybe_transform(
|
144
|
-
{
|
145
|
-
"filters": filters,
|
146
|
-
"limit": limit,
|
147
|
-
"order": order,
|
148
|
-
"page": page,
|
149
|
-
"sort": sort,
|
150
|
-
},
|
151
|
-
memory_list_params.MemoryListParams,
|
152
|
-
),
|
144
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
153
145
|
),
|
154
|
-
cast_to=
|
146
|
+
cast_to=NoneType,
|
155
147
|
)
|
156
148
|
|
157
|
-
def
|
149
|
+
def add(
|
158
150
|
self,
|
159
|
-
id: str,
|
160
151
|
*,
|
152
|
+
content: str,
|
153
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
154
|
+
custom_id: str | NotGiven = NOT_GIVEN,
|
155
|
+
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
|
161
156
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
162
157
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
163
158
|
extra_headers: Headers | None = None,
|
164
159
|
extra_query: Query | None = None,
|
165
160
|
extra_body: Body | None = None,
|
166
161
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
167
|
-
) ->
|
162
|
+
) -> MemoryAddResponse:
|
168
163
|
"""
|
169
|
-
|
164
|
+
Add a memory with any content type (text, url, file, etc.) and metadata
|
170
165
|
|
171
166
|
Args:
|
167
|
+
content: The content to extract and process into a memory. This can be a URL to a
|
168
|
+
website, a PDF, an image, or a video.
|
169
|
+
|
170
|
+
Plaintext: Any plaintext format
|
171
|
+
|
172
|
+
URL: A URL to a website, PDF, image, or video
|
173
|
+
|
174
|
+
We automatically detect the content type from the url's response format.
|
175
|
+
|
176
|
+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
177
|
+
user, a project ID, or any other identifier you wish to use to group memories.
|
178
|
+
|
179
|
+
custom_id: Optional custom ID of the memory. This could be an ID from your database that
|
180
|
+
will uniquely identify this memory.
|
181
|
+
|
182
|
+
metadata: Optional metadata for the memory. This is used to store additional information
|
183
|
+
about the memory. You can use this to store any additional information you need
|
184
|
+
about the memory. Metadata can be filtered through. Keys must be strings and are
|
185
|
+
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
|
186
|
+
objects.
|
187
|
+
|
172
188
|
extra_headers: Send extra headers
|
173
189
|
|
174
190
|
extra_query: Add additional query parameters to the request
|
@@ -177,14 +193,21 @@ class MemoryResource(SyncAPIResource):
|
|
177
193
|
|
178
194
|
timeout: Override the client-level default timeout for this request, in seconds
|
179
195
|
"""
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
196
|
+
return self._post(
|
197
|
+
"/v3/memories",
|
198
|
+
body=maybe_transform(
|
199
|
+
{
|
200
|
+
"content": content,
|
201
|
+
"container_tags": container_tags,
|
202
|
+
"custom_id": custom_id,
|
203
|
+
"metadata": metadata,
|
204
|
+
},
|
205
|
+
memory_add_params.MemoryAddParams,
|
206
|
+
),
|
184
207
|
options=make_request_options(
|
185
208
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
186
209
|
),
|
187
|
-
cast_to=
|
210
|
+
cast_to=MemoryAddResponse,
|
188
211
|
)
|
189
212
|
|
190
213
|
def get(
|
@@ -213,7 +236,7 @@ class MemoryResource(SyncAPIResource):
|
|
213
236
|
if not id:
|
214
237
|
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
215
238
|
return self._get(
|
216
|
-
f"/
|
239
|
+
f"/v3/memories/{id}",
|
217
240
|
options=make_request_options(
|
218
241
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
219
242
|
),
|
@@ -221,49 +244,65 @@ class MemoryResource(SyncAPIResource):
|
|
221
244
|
)
|
222
245
|
|
223
246
|
|
224
|
-
class
|
247
|
+
class AsyncMemoriesResource(AsyncAPIResource):
|
225
248
|
@cached_property
|
226
|
-
def with_raw_response(self) ->
|
249
|
+
def with_raw_response(self) -> AsyncMemoriesResourceWithRawResponse:
|
227
250
|
"""
|
228
251
|
This property can be used as a prefix for any HTTP method call to return
|
229
252
|
the raw response object instead of the parsed content.
|
230
253
|
|
231
254
|
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
232
255
|
"""
|
233
|
-
return
|
256
|
+
return AsyncMemoriesResourceWithRawResponse(self)
|
234
257
|
|
235
258
|
@cached_property
|
236
|
-
def with_streaming_response(self) ->
|
259
|
+
def with_streaming_response(self) -> AsyncMemoriesResourceWithStreamingResponse:
|
237
260
|
"""
|
238
261
|
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
239
262
|
|
240
263
|
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
241
264
|
"""
|
242
|
-
return
|
265
|
+
return AsyncMemoriesResourceWithStreamingResponse(self)
|
243
266
|
|
244
|
-
async def
|
267
|
+
async def update(
|
245
268
|
self,
|
269
|
+
id: str,
|
246
270
|
*,
|
247
271
|
content: str,
|
248
|
-
|
272
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
273
|
+
custom_id: str | NotGiven = NOT_GIVEN,
|
249
274
|
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
|
250
|
-
user_id: str | NotGiven = NOT_GIVEN,
|
251
275
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
252
276
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
253
277
|
extra_headers: Headers | None = None,
|
254
278
|
extra_query: Query | None = None,
|
255
279
|
extra_body: Body | None = None,
|
256
280
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
257
|
-
) ->
|
281
|
+
) -> MemoryUpdateResponse:
|
258
282
|
"""
|
259
|
-
|
283
|
+
Update a memory with any content type (text, url, file, etc.) and metadata
|
260
284
|
|
261
285
|
Args:
|
262
|
-
content:
|
286
|
+
content: The content to extract and process into a memory. This can be a URL to a
|
287
|
+
website, a PDF, an image, or a video.
|
288
|
+
|
289
|
+
Plaintext: Any plaintext format
|
290
|
+
|
291
|
+
URL: A URL to a website, PDF, image, or video
|
292
|
+
|
293
|
+
We automatically detect the content type from the url's response format.
|
263
294
|
|
264
|
-
|
295
|
+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
296
|
+
user, a project ID, or any other identifier you wish to use to group memories.
|
265
297
|
|
266
|
-
|
298
|
+
custom_id: Optional custom ID of the memory. This could be an ID from your database that
|
299
|
+
will uniquely identify this memory.
|
300
|
+
|
301
|
+
metadata: Optional metadata for the memory. This is used to store additional information
|
302
|
+
about the memory. You can use this to store any additional information you need
|
303
|
+
about the memory. Metadata can be filtered through. Keys must be strings and are
|
304
|
+
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
|
305
|
+
objects.
|
267
306
|
|
268
307
|
extra_headers: Send extra headers
|
269
308
|
|
@@ -273,52 +312,40 @@ class AsyncMemoryResource(AsyncAPIResource):
|
|
273
312
|
|
274
313
|
timeout: Override the client-level default timeout for this request, in seconds
|
275
314
|
"""
|
276
|
-
|
277
|
-
"
|
315
|
+
if not id:
|
316
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
317
|
+
return await self._patch(
|
318
|
+
f"/v3/memories/{id}",
|
278
319
|
body=await async_maybe_transform(
|
279
320
|
{
|
280
321
|
"content": content,
|
281
|
-
"
|
322
|
+
"container_tags": container_tags,
|
323
|
+
"custom_id": custom_id,
|
282
324
|
"metadata": metadata,
|
283
|
-
"user_id": user_id,
|
284
325
|
},
|
285
|
-
|
326
|
+
memory_update_params.MemoryUpdateParams,
|
286
327
|
),
|
287
328
|
options=make_request_options(
|
288
329
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
289
330
|
),
|
290
|
-
cast_to=
|
331
|
+
cast_to=MemoryUpdateResponse,
|
291
332
|
)
|
292
333
|
|
293
|
-
async def
|
334
|
+
async def delete(
|
294
335
|
self,
|
336
|
+
id: str,
|
295
337
|
*,
|
296
|
-
filters: str | NotGiven = NOT_GIVEN,
|
297
|
-
limit: str | NotGiven = NOT_GIVEN,
|
298
|
-
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
299
|
-
page: str | NotGiven = NOT_GIVEN,
|
300
|
-
sort: Literal["createdAt", "updatedAt"] | NotGiven = NOT_GIVEN,
|
301
338
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
302
339
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
303
340
|
extra_headers: Headers | None = None,
|
304
341
|
extra_query: Query | None = None,
|
305
342
|
extra_body: Body | None = None,
|
306
343
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
307
|
-
) ->
|
344
|
+
) -> None:
|
308
345
|
"""
|
309
|
-
|
346
|
+
Delete a memory
|
310
347
|
|
311
348
|
Args:
|
312
|
-
filters: Optional filters to apply to the search
|
313
|
-
|
314
|
-
limit: Number of items per page
|
315
|
-
|
316
|
-
order: Sort order
|
317
|
-
|
318
|
-
page: Page number to fetch
|
319
|
-
|
320
|
-
sort: Field to sort by
|
321
|
-
|
322
349
|
extra_headers: Send extra headers
|
323
350
|
|
324
351
|
extra_query: Add additional query parameters to the request
|
@@ -327,42 +354,56 @@ class AsyncMemoryResource(AsyncAPIResource):
|
|
327
354
|
|
328
355
|
timeout: Override the client-level default timeout for this request, in seconds
|
329
356
|
"""
|
330
|
-
|
331
|
-
"
|
357
|
+
if not id:
|
358
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
359
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
360
|
+
return await self._delete(
|
361
|
+
f"/v3/memories/{id}",
|
332
362
|
options=make_request_options(
|
333
|
-
extra_headers=extra_headers,
|
334
|
-
extra_query=extra_query,
|
335
|
-
extra_body=extra_body,
|
336
|
-
timeout=timeout,
|
337
|
-
query=await async_maybe_transform(
|
338
|
-
{
|
339
|
-
"filters": filters,
|
340
|
-
"limit": limit,
|
341
|
-
"order": order,
|
342
|
-
"page": page,
|
343
|
-
"sort": sort,
|
344
|
-
},
|
345
|
-
memory_list_params.MemoryListParams,
|
346
|
-
),
|
363
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
347
364
|
),
|
348
|
-
cast_to=
|
365
|
+
cast_to=NoneType,
|
349
366
|
)
|
350
367
|
|
351
|
-
async def
|
368
|
+
async def add(
|
352
369
|
self,
|
353
|
-
id: str,
|
354
370
|
*,
|
371
|
+
content: str,
|
372
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
373
|
+
custom_id: str | NotGiven = NOT_GIVEN,
|
374
|
+
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
|
355
375
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
356
376
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
357
377
|
extra_headers: Headers | None = None,
|
358
378
|
extra_query: Query | None = None,
|
359
379
|
extra_body: Body | None = None,
|
360
380
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
361
|
-
) ->
|
381
|
+
) -> MemoryAddResponse:
|
362
382
|
"""
|
363
|
-
|
383
|
+
Add a memory with any content type (text, url, file, etc.) and metadata
|
364
384
|
|
365
385
|
Args:
|
386
|
+
content: The content to extract and process into a memory. This can be a URL to a
|
387
|
+
website, a PDF, an image, or a video.
|
388
|
+
|
389
|
+
Plaintext: Any plaintext format
|
390
|
+
|
391
|
+
URL: A URL to a website, PDF, image, or video
|
392
|
+
|
393
|
+
We automatically detect the content type from the url's response format.
|
394
|
+
|
395
|
+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
396
|
+
user, a project ID, or any other identifier you wish to use to group memories.
|
397
|
+
|
398
|
+
custom_id: Optional custom ID of the memory. This could be an ID from your database that
|
399
|
+
will uniquely identify this memory.
|
400
|
+
|
401
|
+
metadata: Optional metadata for the memory. This is used to store additional information
|
402
|
+
about the memory. You can use this to store any additional information you need
|
403
|
+
about the memory. Metadata can be filtered through. Keys must be strings and are
|
404
|
+
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
|
405
|
+
objects.
|
406
|
+
|
366
407
|
extra_headers: Send extra headers
|
367
408
|
|
368
409
|
extra_query: Add additional query parameters to the request
|
@@ -371,14 +412,21 @@ class AsyncMemoryResource(AsyncAPIResource):
|
|
371
412
|
|
372
413
|
timeout: Override the client-level default timeout for this request, in seconds
|
373
414
|
"""
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
415
|
+
return await self._post(
|
416
|
+
"/v3/memories",
|
417
|
+
body=await async_maybe_transform(
|
418
|
+
{
|
419
|
+
"content": content,
|
420
|
+
"container_tags": container_tags,
|
421
|
+
"custom_id": custom_id,
|
422
|
+
"metadata": metadata,
|
423
|
+
},
|
424
|
+
memory_add_params.MemoryAddParams,
|
425
|
+
),
|
378
426
|
options=make_request_options(
|
379
427
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
380
428
|
),
|
381
|
-
cast_to=
|
429
|
+
cast_to=MemoryAddResponse,
|
382
430
|
)
|
383
431
|
|
384
432
|
async def get(
|
@@ -407,7 +455,7 @@ class AsyncMemoryResource(AsyncAPIResource):
|
|
407
455
|
if not id:
|
408
456
|
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
409
457
|
return await self._get(
|
410
|
-
f"/
|
458
|
+
f"/v3/memories/{id}",
|
411
459
|
options=make_request_options(
|
412
460
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
413
461
|
),
|
@@ -415,73 +463,73 @@ class AsyncMemoryResource(AsyncAPIResource):
|
|
415
463
|
)
|
416
464
|
|
417
465
|
|
418
|
-
class
|
419
|
-
def __init__(self,
|
420
|
-
self.
|
466
|
+
class MemoriesResourceWithRawResponse:
|
467
|
+
def __init__(self, memories: MemoriesResource) -> None:
|
468
|
+
self._memories = memories
|
421
469
|
|
422
|
-
self.
|
423
|
-
|
424
|
-
)
|
425
|
-
self.list = to_raw_response_wrapper(
|
426
|
-
memory.list,
|
470
|
+
self.update = to_raw_response_wrapper(
|
471
|
+
memories.update,
|
427
472
|
)
|
428
473
|
self.delete = to_raw_response_wrapper(
|
429
|
-
|
474
|
+
memories.delete,
|
475
|
+
)
|
476
|
+
self.add = to_raw_response_wrapper(
|
477
|
+
memories.add,
|
430
478
|
)
|
431
479
|
self.get = to_raw_response_wrapper(
|
432
|
-
|
480
|
+
memories.get,
|
433
481
|
)
|
434
482
|
|
435
483
|
|
436
|
-
class
|
437
|
-
def __init__(self,
|
438
|
-
self.
|
484
|
+
class AsyncMemoriesResourceWithRawResponse:
|
485
|
+
def __init__(self, memories: AsyncMemoriesResource) -> None:
|
486
|
+
self._memories = memories
|
439
487
|
|
440
|
-
self.
|
441
|
-
|
442
|
-
)
|
443
|
-
self.list = async_to_raw_response_wrapper(
|
444
|
-
memory.list,
|
488
|
+
self.update = async_to_raw_response_wrapper(
|
489
|
+
memories.update,
|
445
490
|
)
|
446
491
|
self.delete = async_to_raw_response_wrapper(
|
447
|
-
|
492
|
+
memories.delete,
|
493
|
+
)
|
494
|
+
self.add = async_to_raw_response_wrapper(
|
495
|
+
memories.add,
|
448
496
|
)
|
449
497
|
self.get = async_to_raw_response_wrapper(
|
450
|
-
|
498
|
+
memories.get,
|
451
499
|
)
|
452
500
|
|
453
501
|
|
454
|
-
class
|
455
|
-
def __init__(self,
|
456
|
-
self.
|
502
|
+
class MemoriesResourceWithStreamingResponse:
|
503
|
+
def __init__(self, memories: MemoriesResource) -> None:
|
504
|
+
self._memories = memories
|
457
505
|
|
458
|
-
self.
|
459
|
-
|
460
|
-
)
|
461
|
-
self.list = to_streamed_response_wrapper(
|
462
|
-
memory.list,
|
506
|
+
self.update = to_streamed_response_wrapper(
|
507
|
+
memories.update,
|
463
508
|
)
|
464
509
|
self.delete = to_streamed_response_wrapper(
|
465
|
-
|
510
|
+
memories.delete,
|
511
|
+
)
|
512
|
+
self.add = to_streamed_response_wrapper(
|
513
|
+
memories.add,
|
466
514
|
)
|
467
515
|
self.get = to_streamed_response_wrapper(
|
468
|
-
|
516
|
+
memories.get,
|
469
517
|
)
|
470
518
|
|
471
519
|
|
472
|
-
class
|
473
|
-
def __init__(self,
|
474
|
-
self.
|
520
|
+
class AsyncMemoriesResourceWithStreamingResponse:
|
521
|
+
def __init__(self, memories: AsyncMemoriesResource) -> None:
|
522
|
+
self._memories = memories
|
475
523
|
|
476
|
-
self.
|
477
|
-
|
478
|
-
)
|
479
|
-
self.list = async_to_streamed_response_wrapper(
|
480
|
-
memory.list,
|
524
|
+
self.update = async_to_streamed_response_wrapper(
|
525
|
+
memories.update,
|
481
526
|
)
|
482
527
|
self.delete = async_to_streamed_response_wrapper(
|
483
|
-
|
528
|
+
memories.delete,
|
529
|
+
)
|
530
|
+
self.add = async_to_streamed_response_wrapper(
|
531
|
+
memories.add,
|
484
532
|
)
|
485
533
|
self.get = async_to_streamed_response_wrapper(
|
486
|
-
|
534
|
+
memories.get,
|
487
535
|
)
|