Skip to content

Commit 8b9942e

Browse files
authored
Merge pull request #12 from supermemoryai/release-please--branches--main--changes--next
release: 3.0.0-alpha.26
2 parents b31cccb + 2714677 commit 8b9942e

19 files changed

+1273
-16
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "3.0.0-alpha.25"
2+
".": "3.0.0-alpha.26"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 16
1+
configured_endpoints: 18
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-d52acd1a525b4bfe9f4befcc3a645f5d1289d75e7bad999cf1330e539b2ed84e.yml
33
openapi_spec_hash: c34df5406cfa4d245812d30f99d28116
4-
config_hash: be10c837d5319a33f30809a3ec223caf
4+
config_hash: 9b9291a6c872b063900a46386729ba3c

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 3.0.0-alpha.26 (2025-08-15)
4+
5+
Full Changelog: [v3.0.0-alpha.25...v3.0.0-alpha.26](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.25...v3.0.0-alpha.26)
6+
7+
### Features
8+
9+
* **api:** manual updates ([c2623b2](https://github.com/supermemoryai/python-sdk/commit/c2623b2b645eefd7e2cbb5027eb5a46cee7b62eb))
10+
* **api:** manual updates ([9e373ef](https://github.com/supermemoryai/python-sdk/commit/9e373ef0b585eb15cb04b95a1bab46c8c102970c))
11+
* **api:** manual updates ([fa75aff](https://github.com/supermemoryai/python-sdk/commit/fa75affffb701259be14445da95c77a1cdde512b))
12+
313
## 3.0.0-alpha.25 (2025-08-15)
414

515
Full Changelog: [v3.0.0-alpha.24...v3.0.0-alpha.25](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.24...v3.0.0-alpha.25)

README.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ client = Supermemory(
3232
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
3333
)
3434

35-
response = client.search.execute(
35+
response = client.search.documents(
3636
q="documents related to python",
3737
)
3838
print(response.results)
@@ -58,7 +58,7 @@ client = AsyncSupermemory(
5858

5959

6060
async def main() -> None:
61-
response = await client.search.execute(
61+
response = await client.search.documents(
6262
q="documents related to python",
6363
)
6464
print(response.results)
@@ -93,7 +93,7 @@ async def main() -> None:
9393
api_key="My API Key",
9494
http_client=DefaultAioHttpClient(),
9595
) as client:
96-
response = await client.search.execute(
96+
response = await client.search.documents(
9797
q="documents related to python",
9898
)
9999
print(response.results)
@@ -111,6 +111,39 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
111111

112112
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
113113

114+
## Nested params
115+
116+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
117+
118+
```python
119+
from supermemory import Supermemory
120+
121+
client = Supermemory()
122+
123+
response = client.search.memories(
124+
q="machine learning concepts",
125+
include={},
126+
)
127+
print(response.include)
128+
```
129+
130+
## File uploads
131+
132+
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
133+
134+
```python
135+
from pathlib import Path
136+
from supermemory import Supermemory
137+
138+
client = Supermemory()
139+
140+
client.memories.upload_file(
141+
file=Path("/path/to/file"),
142+
)
143+
```
144+
145+
The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
146+
114147
## Handling errors
115148

116149
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `supermemory.APIConnectionError` is raised.

api.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ from supermemory.types import (
88
MemoryListResponse,
99
MemoryAddResponse,
1010
MemoryGetResponse,
11+
MemoryUploadFileResponse,
1112
)
1213
```
1314

@@ -18,18 +19,21 @@ Methods:
1819
- <code title="delete /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">delete</a>(id) -> None</code>
1920
- <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>
2021
- <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>
22+
- <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>
2123

2224
# Search
2325

2426
Types:
2527

2628
```python
27-
from supermemory.types import SearchExecuteResponse
29+
from supermemory.types import SearchDocumentsResponse, SearchExecuteResponse, SearchMemoriesResponse
2830
```
2931

3032
Methods:
3133

34+
- <code title="post /v3/search">client.search.<a href="./src/supermemory/resources/search.py">documents</a>(\*\*<a href="src/supermemory/types/search_documents_params.py">params</a>) -> <a href="./src/supermemory/types/search_documents_response.py">SearchDocumentsResponse</a></code>
3235
- <code title="post /v3/search">client.search.<a href="./src/supermemory/resources/search.py">execute</a>(\*\*<a href="src/supermemory/types/search_execute_params.py">params</a>) -> <a href="./src/supermemory/types/search_execute_response.py">SearchExecuteResponse</a></code>
36+
- <code title="post /v4/search">client.search.<a href="./src/supermemory/resources/search.py">memories</a>(\*\*<a href="src/supermemory/types/search_memories_params.py">params</a>) -> <a href="./src/supermemory/types/search_memories_response.py">SearchMemoriesResponse</a></code>
3337

3438
# Settings
3539

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "supermemory"
3-
version = "3.0.0-alpha.25"
3+
version = "3.0.0-alpha.26"
44
description = "The official Python library for the supermemory API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/supermemory/_files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
3434
if not is_file_content(obj):
3535
prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
3636
raise RuntimeError(
37-
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead."
37+
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/supermemoryai/python-sdk/tree/main#file-uploads"
3838
) from None
3939

4040

src/supermemory/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "supermemory"
4-
__version__ = "3.0.0-alpha.25" # x-release-please-version
4+
__version__ = "3.0.0-alpha.26" # x-release-please-version

src/supermemory/resources/memories.py

Lines changed: 107 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, List, Union
5+
from typing import Dict, List, Union, Mapping, cast
66
from typing_extensions import Literal
77

88
import httpx
99

10-
from ..types import memory_add_params, memory_list_params, memory_update_params
11-
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
12-
from .._utils import maybe_transform, async_maybe_transform
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
1313
from .._compat import cached_property
1414
from .._resource import SyncAPIResource, AsyncAPIResource
1515
from .._response import (
@@ -23,6 +23,7 @@
2323
from ..types.memory_get_response import MemoryGetResponse
2424
from ..types.memory_list_response import MemoryListResponse
2525
from ..types.memory_update_response import MemoryUpdateResponse
26+
from ..types.memory_upload_file_response import MemoryUploadFileResponse
2627

2728
__all__ = ["MemoriesResource", "AsyncMemoriesResource"]
2829

@@ -305,6 +306,51 @@ def get(
305306
cast_to=MemoryGetResponse,
306307
)
307308

309+
def upload_file(
310+
self,
311+
*,
312+
file: FileTypes,
313+
container_tags: str | NotGiven = NOT_GIVEN,
314+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
315+
# The extra values given here take precedence over values defined on the client or passed to this method.
316+
extra_headers: Headers | None = None,
317+
extra_query: Query | None = None,
318+
extra_body: Body | None = None,
319+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
320+
) -> MemoryUploadFileResponse:
321+
"""
322+
Upload a file to be processed
323+
324+
Args:
325+
extra_headers: Send extra headers
326+
327+
extra_query: Add additional query parameters to the request
328+
329+
extra_body: Add additional JSON properties to the request
330+
331+
timeout: Override the client-level default timeout for this request, in seconds
332+
"""
333+
body = deepcopy_minimal(
334+
{
335+
"file": file,
336+
"container_tags": container_tags,
337+
}
338+
)
339+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
340+
# It should be noted that the actual Content-Type header that will be
341+
# sent to the server will contain a `boundary` parameter, e.g.
342+
# multipart/form-data; boundary=---abc--
343+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
344+
return self._post(
345+
"/v3/memories/file",
346+
body=maybe_transform(body, memory_upload_file_params.MemoryUploadFileParams),
347+
files=files,
348+
options=make_request_options(
349+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
350+
),
351+
cast_to=MemoryUploadFileResponse,
352+
)
353+
308354

309355
class AsyncMemoriesResource(AsyncAPIResource):
310356
@cached_property
@@ -584,6 +630,51 @@ async def get(
584630
cast_to=MemoryGetResponse,
585631
)
586632

633+
async def upload_file(
634+
self,
635+
*,
636+
file: FileTypes,
637+
container_tags: str | NotGiven = NOT_GIVEN,
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+
) -> MemoryUploadFileResponse:
645+
"""
646+
Upload a file to be processed
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+
body = deepcopy_minimal(
658+
{
659+
"file": file,
660+
"container_tags": container_tags,
661+
}
662+
)
663+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
664+
# It should be noted that the actual Content-Type header that will be
665+
# sent to the server will contain a `boundary` parameter, e.g.
666+
# multipart/form-data; boundary=---abc--
667+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
668+
return await self._post(
669+
"/v3/memories/file",
670+
body=await async_maybe_transform(body, memory_upload_file_params.MemoryUploadFileParams),
671+
files=files,
672+
options=make_request_options(
673+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
674+
),
675+
cast_to=MemoryUploadFileResponse,
676+
)
677+
587678

588679
class MemoriesResourceWithRawResponse:
589680
def __init__(self, memories: MemoriesResource) -> None:
@@ -604,6 +695,9 @@ def __init__(self, memories: MemoriesResource) -> None:
604695
self.get = to_raw_response_wrapper(
605696
memories.get,
606697
)
698+
self.upload_file = to_raw_response_wrapper(
699+
memories.upload_file,
700+
)
607701

608702

609703
class AsyncMemoriesResourceWithRawResponse:
@@ -625,6 +719,9 @@ def __init__(self, memories: AsyncMemoriesResource) -> None:
625719
self.get = async_to_raw_response_wrapper(
626720
memories.get,
627721
)
722+
self.upload_file = async_to_raw_response_wrapper(
723+
memories.upload_file,
724+
)
628725

629726

630727
class MemoriesResourceWithStreamingResponse:
@@ -646,6 +743,9 @@ def __init__(self, memories: MemoriesResource) -> None:
646743
self.get = to_streamed_response_wrapper(
647744
memories.get,
648745
)
746+
self.upload_file = to_streamed_response_wrapper(
747+
memories.upload_file,
748+
)
649749

650750

651751
class AsyncMemoriesResourceWithStreamingResponse:
@@ -667,3 +767,6 @@ def __init__(self, memories: AsyncMemoriesResource) -> None:
667767
self.get = async_to_streamed_response_wrapper(
668768
memories.get,
669769
)
770+
self.upload_file = async_to_streamed_response_wrapper(
771+
memories.upload_file,
772+
)

0 commit comments

Comments
 (0)