Skip to content

Commit 0c627bd

Browse files
feat(api): api update
1 parent 68370a4 commit 0c627bd

File tree

11 files changed

+236
-59
lines changed

11 files changed

+236
-59
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 12
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-e6735b03c258b382c527550bb78042bdc3aad32a5cf564785dcb9f3fb13a2862.yml
3-
openapi_spec_hash: 8168fb51314d986893554e1cc935ca7d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-101f86a36ccd7f0652cfb6cac5d8f49e45ce3bee2b96692e8decd1eda3419604.yml
3+
openapi_spec_hash: b6c08c22ab103285c7ada4eff95cfd0a
44
config_hash: 8477e3ee6fd596ab6ac911d052e4de79

api.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Types:
66
from supermemory.types import (
77
MemoryUpdateResponse,
88
MemoryListResponse,
9-
MemoryDeleteResponse,
109
MemoryAddResponse,
1110
MemoryGetResponse,
1211
MemoryUploadFileResponse,
@@ -15,9 +14,9 @@ from supermemory.types import (
1514

1615
Methods:
1716

18-
- <code title="patch /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">update</a>(id, \*\*<a href="src/supermemory/types/memory_update_params.py">params</a>) -> <a href="./src/supermemory/types/memory_update_response.py">MemoryUpdateResponse</a></code>
17+
- <code title="patch /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">update</a>(path_id, \*\*<a href="src/supermemory/types/memory_update_params.py">params</a>) -> <a href="./src/supermemory/types/memory_update_response.py">MemoryUpdateResponse</a></code>
1918
- <code title="get /v3/memories">client.memories.<a href="./src/supermemory/resources/memories.py">list</a>(\*\*<a href="src/supermemory/types/memory_list_params.py">params</a>) -> <a href="./src/supermemory/types/memory_list_response.py">MemoryListResponse</a></code>
20-
- <code title="delete /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">delete</a>(id) -> <a href="./src/supermemory/types/memory_delete_response.py">MemoryDeleteResponse</a></code>
19+
- <code title="delete /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">delete</a>(id) -> None</code>
2120
- <code title="post /v3/memories">client.memories.<a href="./src/supermemory/resources/memories.py">add</a>(\*\*<a href="src/supermemory/types/memory_add_params.py">params</a>) -> <a href="./src/supermemory/types/memory_add_response.py">MemoryAddResponse</a></code>
2221
- <code title="get /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">get</a>(id) -> <a href="./src/supermemory/types/memory_get_response.py">MemoryGetResponse</a></code>
2322
- <code title="post /v3/memories/file">client.memories.<a href="./src/supermemory/resources/memories.py">upload_file</a>(\*\*<a href="src/supermemory/types/memory_upload_file_params.py">params</a>) -> <a href="./src/supermemory/types/memory_upload_file_response.py">MemoryUploadFileResponse</a></code>

src/supermemory/resources/memories.py

Lines changed: 115 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import httpx
99

1010
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, NotGiven, FileTypes
11+
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes
1212
from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
1313
from .._compat import cached_property
1414
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -22,7 +22,6 @@
2222
from ..types.memory_add_response import MemoryAddResponse
2323
from ..types.memory_get_response import MemoryGetResponse
2424
from ..types.memory_list_response import MemoryListResponse
25-
from ..types.memory_delete_response import MemoryDeleteResponse
2625
from ..types.memory_update_response import MemoryUpdateResponse
2726
from ..types.memory_upload_file_response import MemoryUploadFileResponse
2827

@@ -51,10 +50,12 @@ def with_streaming_response(self) -> MemoriesResourceWithStreamingResponse:
5150

5251
def update(
5352
self,
54-
id: str,
53+
path_id: str,
5554
*,
55+
body_id: str,
5656
content: str,
5757
container_tags: List[str] | NotGiven = NOT_GIVEN,
58+
custom_id: str | NotGiven = NOT_GIVEN,
5859
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
5960
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6061
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -67,6 +68,29 @@ def update(
6768
Update a memory with any content type (text, url, file, etc.) and metadata
6869
6970
Args:
71+
body_id: Unique identifier of the memory.
72+
73+
content: The content to extract and process into a memory. This can be a URL to a
74+
website, a PDF, an image, or a video.
75+
76+
Plaintext: Any plaintext format
77+
78+
URL: A URL to a website, PDF, image, or video
79+
80+
We automatically detect the content type from the url's response format.
81+
82+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
83+
user, a project ID, or any other identifier you wish to use to group memories.
84+
85+
custom_id: Optional custom ID of the memory. This could be an ID from your database that
86+
will uniquely identify this memory.
87+
88+
metadata: Optional metadata for the memory. This is used to store additional information
89+
about the memory. You can use this to store any additional information you need
90+
about the memory. Metadata can be filtered through. Keys must be strings and are
91+
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
92+
objects.
93+
7094
extra_headers: Send extra headers
7195
7296
extra_query: Add additional query parameters to the request
@@ -75,14 +99,16 @@ def update(
7599
76100
timeout: Override the client-level default timeout for this request, in seconds
77101
"""
78-
if not id:
79-
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
102+
if not path_id:
103+
raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}")
80104
return self._patch(
81-
f"/v3/memories/{id}",
105+
f"/v3/memories/{path_id}",
82106
body=maybe_transform(
83107
{
108+
"body_id": body_id,
84109
"content": content,
85110
"container_tags": container_tags,
111+
"custom_id": custom_id,
86112
"metadata": metadata,
87113
},
88114
memory_update_params.MemoryUpdateParams,
@@ -161,7 +187,7 @@ def delete(
161187
extra_query: Query | None = None,
162188
extra_body: Body | None = None,
163189
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
164-
) -> MemoryDeleteResponse:
190+
) -> None:
165191
"""
166192
Delete a memory
167193
@@ -176,19 +202,21 @@ def delete(
176202
"""
177203
if not id:
178204
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
205+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
179206
return self._delete(
180207
f"/v3/memories/{id}",
181208
options=make_request_options(
182209
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
183210
),
184-
cast_to=MemoryDeleteResponse,
211+
cast_to=NoneType,
185212
)
186213

187214
def add(
188215
self,
189216
*,
190217
content: str,
191218
container_tags: List[str] | NotGiven = NOT_GIVEN,
219+
custom_id: str | NotGiven = NOT_GIVEN,
192220
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
193221
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
194222
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -201,6 +229,27 @@ def add(
201229
Add a memory with any content type (text, url, file, etc.) and metadata
202230
203231
Args:
232+
content: The content to extract and process into a memory. This can be a URL to a
233+
website, a PDF, an image, or a video.
234+
235+
Plaintext: Any plaintext format
236+
237+
URL: A URL to a website, PDF, image, or video
238+
239+
We automatically detect the content type from the url's response format.
240+
241+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
242+
user, a project ID, or any other identifier you wish to use to group memories.
243+
244+
custom_id: Optional custom ID of the memory. This could be an ID from your database that
245+
will uniquely identify this memory.
246+
247+
metadata: Optional metadata for the memory. This is used to store additional information
248+
about the memory. You can use this to store any additional information you need
249+
about the memory. Metadata can be filtered through. Keys must be strings and are
250+
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
251+
objects.
252+
204253
extra_headers: Send extra headers
205254
206255
extra_query: Add additional query parameters to the request
@@ -215,6 +264,7 @@ def add(
215264
{
216265
"content": content,
217266
"container_tags": container_tags,
267+
"custom_id": custom_id,
218268
"metadata": metadata,
219269
},
220270
memory_add_params.MemoryAddParams,
@@ -320,10 +370,12 @@ def with_streaming_response(self) -> AsyncMemoriesResourceWithStreamingResponse:
320370

321371
async def update(
322372
self,
323-
id: str,
373+
path_id: str,
324374
*,
375+
body_id: str,
325376
content: str,
326377
container_tags: List[str] | NotGiven = NOT_GIVEN,
378+
custom_id: str | NotGiven = NOT_GIVEN,
327379
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
328380
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
329381
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -336,6 +388,29 @@ async def update(
336388
Update a memory with any content type (text, url, file, etc.) and metadata
337389
338390
Args:
391+
body_id: Unique identifier of the memory.
392+
393+
content: The content to extract and process into a memory. This can be a URL to a
394+
website, a PDF, an image, or a video.
395+
396+
Plaintext: Any plaintext format
397+
398+
URL: A URL to a website, PDF, image, or video
399+
400+
We automatically detect the content type from the url's response format.
401+
402+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
403+
user, a project ID, or any other identifier you wish to use to group memories.
404+
405+
custom_id: Optional custom ID of the memory. This could be an ID from your database that
406+
will uniquely identify this memory.
407+
408+
metadata: Optional metadata for the memory. This is used to store additional information
409+
about the memory. You can use this to store any additional information you need
410+
about the memory. Metadata can be filtered through. Keys must be strings and are
411+
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
412+
objects.
413+
339414
extra_headers: Send extra headers
340415
341416
extra_query: Add additional query parameters to the request
@@ -344,14 +419,16 @@ async def update(
344419
345420
timeout: Override the client-level default timeout for this request, in seconds
346421
"""
347-
if not id:
348-
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
422+
if not path_id:
423+
raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}")
349424
return await self._patch(
350-
f"/v3/memories/{id}",
425+
f"/v3/memories/{path_id}",
351426
body=await async_maybe_transform(
352427
{
428+
"body_id": body_id,
353429
"content": content,
354430
"container_tags": container_tags,
431+
"custom_id": custom_id,
355432
"metadata": metadata,
356433
},
357434
memory_update_params.MemoryUpdateParams,
@@ -430,7 +507,7 @@ async def delete(
430507
extra_query: Query | None = None,
431508
extra_body: Body | None = None,
432509
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
433-
) -> MemoryDeleteResponse:
510+
) -> None:
434511
"""
435512
Delete a memory
436513
@@ -445,19 +522,21 @@ async def delete(
445522
"""
446523
if not id:
447524
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
525+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
448526
return await self._delete(
449527
f"/v3/memories/{id}",
450528
options=make_request_options(
451529
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
452530
),
453-
cast_to=MemoryDeleteResponse,
531+
cast_to=NoneType,
454532
)
455533

456534
async def add(
457535
self,
458536
*,
459537
content: str,
460538
container_tags: List[str] | NotGiven = NOT_GIVEN,
539+
custom_id: str | NotGiven = NOT_GIVEN,
461540
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
462541
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
463542
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -470,6 +549,27 @@ async def add(
470549
Add a memory with any content type (text, url, file, etc.) and metadata
471550
472551
Args:
552+
content: The content to extract and process into a memory. This can be a URL to a
553+
website, a PDF, an image, or a video.
554+
555+
Plaintext: Any plaintext format
556+
557+
URL: A URL to a website, PDF, image, or video
558+
559+
We automatically detect the content type from the url's response format.
560+
561+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
562+
user, a project ID, or any other identifier you wish to use to group memories.
563+
564+
custom_id: Optional custom ID of the memory. This could be an ID from your database that
565+
will uniquely identify this memory.
566+
567+
metadata: Optional metadata for the memory. This is used to store additional information
568+
about the memory. You can use this to store any additional information you need
569+
about the memory. Metadata can be filtered through. Keys must be strings and are
570+
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
571+
objects.
572+
473573
extra_headers: Send extra headers
474574
475575
extra_query: Add additional query parameters to the request
@@ -484,6 +584,7 @@ async def add(
484584
{
485585
"content": content,
486586
"container_tags": container_tags,
587+
"custom_id": custom_id,
487588
"metadata": metadata,
488589
},
489590
memory_add_params.MemoryAddParams,

src/supermemory/types/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from .search_execute_params import SearchExecuteParams as SearchExecuteParams
1313
from .setting_update_params import SettingUpdateParams as SettingUpdateParams
1414
from .connection_list_params import ConnectionListParams as ConnectionListParams
15-
from .memory_delete_response import MemoryDeleteResponse as MemoryDeleteResponse
1615
from .memory_update_response import MemoryUpdateResponse as MemoryUpdateResponse
1716
from .connection_get_response import ConnectionGetResponse as ConnectionGetResponse
1817
from .search_execute_response import SearchExecuteResponse as SearchExecuteResponse

src/supermemory/types/memory_add_params.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,35 @@
1212

1313
class MemoryAddParams(TypedDict, total=False):
1414
content: Required[str]
15+
"""The content to extract and process into a memory.
16+
17+
This can be a URL to a website, a PDF, an image, or a video.
18+
19+
Plaintext: Any plaintext format
20+
21+
URL: A URL to a website, PDF, image, or video
22+
23+
We automatically detect the content type from the url's response format.
24+
"""
1525

1626
container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")]
27+
"""Optional tags this memory should be containerized by.
28+
29+
This can be an ID for your user, a project ID, or any other identifier you wish
30+
to use to group memories.
31+
"""
32+
33+
custom_id: Annotated[str, PropertyInfo(alias="customId")]
34+
"""Optional custom ID of the memory.
35+
36+
This could be an ID from your database that will uniquely identify this memory.
37+
"""
1738

1839
metadata: Dict[str, Union[str, float, bool]]
40+
"""Optional metadata for the memory.
41+
42+
This is used to store additional information about the memory. You can use this
43+
to store any additional information you need about the memory. Metadata can be
44+
filtered through. Keys must be strings and are case sensitive. Values can be
45+
strings, numbers, or booleans. You cannot nest objects.
46+
"""

src/supermemory/types/memory_delete_response.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)