Skip to content

Commit 850f2f3

Browse files
authored
Merge pull request #9 from supermemoryai/release-please--branches--main--changes--next
release: 3.0.0-alpha.23
2 parents 3e32da8 + d7a36dc commit 850f2f3

17 files changed

+175
-144
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.22"
2+
".": "3.0.0-alpha.23"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 16
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-1a2a84a9cc99c25a9d726bc9300a72871f9469e3ceacebd5e71fd37e87891318.yml
3-
openapi_spec_hash: e71e86a645bc47a86664080c8697b8db
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-886787346bfd9007dbd58542fddf6fad4592b1ccc2d1923f44378678dda7c1c1.yml
3+
openapi_spec_hash: 1253fce7081c738f257275e9f49202b9
44
config_hash: be10c837d5319a33f30809a3ec223caf

CHANGELOG.md

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

3+
## 3.0.0-alpha.23 (2025-07-15)
4+
5+
Full Changelog: [v3.0.0-alpha.22...v3.0.0-alpha.23](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.22...v3.0.0-alpha.23)
6+
7+
### Features
8+
9+
* **api:** api update ([3f71f60](https://github.com/supermemoryai/python-sdk/commit/3f71f60954dedc0a91e1859df48c5c3ca0a47c88))
10+
* **api:** api update ([b614732](https://github.com/supermemoryai/python-sdk/commit/b61473253183d434613b0aeb631376262d22cb0c))
11+
* clean up environment call outs ([4aaccf1](https://github.com/supermemoryai/python-sdk/commit/4aaccf17ae31c04f3097fe04a6a081171fc725d1))
12+
13+
14+
### Bug Fixes
15+
16+
* **client:** don't send Content-Type header on GET requests ([80480dd](https://github.com/supermemoryai/python-sdk/commit/80480dd46271dc5136f39c5ff1315555b8d51e31))
17+
* **parsing:** correctly handle nested discriminated unions ([812e982](https://github.com/supermemoryai/python-sdk/commit/812e982cbba93e197d4cd3cf8bdfa710e7830a78))
18+
19+
20+
### Chores
21+
22+
* **internal:** bump pinned h11 dep ([9e822a1](https://github.com/supermemoryai/python-sdk/commit/9e822a16ce8cf30791abf6384e2e3205233eeaba))
23+
* **package:** mark python 3.13 as supported ([2dc73dd](https://github.com/supermemoryai/python-sdk/commit/2dc73dd51ac30fa4d6b2d370b7411857518c1ddd))
24+
* **readme:** fix version rendering on pypi ([a6d7d7a](https://github.com/supermemoryai/python-sdk/commit/a6d7d7a100680cfaa03138542f60b7b7407ad347))
25+
326
## 3.0.0-alpha.22 (2025-07-03)
427

528
Full Changelog: [v3.0.0-alpha.21...v3.0.0-alpha.22](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.21...v3.0.0-alpha.22)

README.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Supermemory Python API library
22

3-
[![PyPI version](<https://img.shields.io/pypi/v/supermemory.svg?label=pypi%20(stable)>)](https://pypi.org/project/supermemory/)
3+
<!-- prettier-ignore -->
4+
[![PyPI version](https://img.shields.io/pypi/v/supermemory.svg?label=pypi%20(stable))](https://pypi.org/project/supermemory/)
45

56
The Supermemory Python library provides convenient access to the Supermemory REST API from any Python 3.8+
67
application. The library includes type definitions for all request params and response fields,
@@ -82,15 +83,14 @@ pip install --pre supermemory[aiohttp]
8283
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
8384

8485
```python
85-
import os
8686
import asyncio
8787
from supermemory import DefaultAioHttpClient
8888
from supermemory import AsyncSupermemory
8989

9090

9191
async def main() -> None:
9292
async with AsyncSupermemory(
93-
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
93+
api_key="My API Key",
9494
http_client=DefaultAioHttpClient(),
9595
) as client:
9696
response = await client.search.execute(
@@ -127,9 +127,7 @@ from supermemory import Supermemory
127127
client = Supermemory()
128128

129129
try:
130-
client.memories.add(
131-
content="This is a detailed article about machine learning concepts...",
132-
)
130+
client.memories.add()
133131
except supermemory.APIConnectionError as e:
134132
print("The server could not be reached")
135133
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -172,9 +170,7 @@ client = Supermemory(
172170
)
173171

174172
# Or, configure per-request:
175-
client.with_options(max_retries=5).memories.add(
176-
content="This is a detailed article about machine learning concepts...",
177-
)
173+
client.with_options(max_retries=5).memories.add()
178174
```
179175

180176
### Timeouts
@@ -197,9 +193,7 @@ client = Supermemory(
197193
)
198194

199195
# Override per-request:
200-
client.with_options(timeout=5.0).memories.add(
201-
content="This is a detailed article about machine learning concepts...",
202-
)
196+
client.with_options(timeout=5.0).memories.add()
203197
```
204198

205199
On timeout, an `APITimeoutError` is thrown.
@@ -240,9 +234,7 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
240234
from supermemory import Supermemory
241235

242236
client = Supermemory()
243-
response = client.memories.with_raw_response.add(
244-
content="This is a detailed article about machine learning concepts...",
245-
)
237+
response = client.memories.with_raw_response.add()
246238
print(response.headers.get('X-My-Header'))
247239

248240
memory = response.parse() # get the object that `memories.add()` would have returned
@@ -260,9 +252,7 @@ The above interface eagerly reads the full response body when you make the reque
260252
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
261253

262254
```python
263-
with client.memories.with_streaming_response.add(
264-
content="This is a detailed article about machine learning concepts...",
265-
) as response:
255+
with client.memories.with_streaming_response.add() as response:
266256
print(response.headers.get("X-My-Header"))
267257

268258
for line in response.iter_lines():

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "supermemory"
3-
version = "3.0.0-alpha.22"
3+
version = "3.0.0-alpha.23"
44
description = "The official Python library for the supermemory API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -24,6 +24,7 @@ classifiers = [
2424
"Programming Language :: Python :: 3.10",
2525
"Programming Language :: Python :: 3.11",
2626
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
2728
"Operating System :: OS Independent",
2829
"Operating System :: POSIX",
2930
"Operating System :: MacOS",
@@ -38,7 +39,7 @@ Homepage = "https://github.com/supermemoryai/python-sdk"
3839
Repository = "https://github.com/supermemoryai/python-sdk"
3940

4041
[project.optional-dependencies]
41-
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"]
42+
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]
4243

4344
[tool.rye]
4445
managed = true

requirements-dev.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ filelock==3.12.4
4848
frozenlist==1.6.2
4949
# via aiohttp
5050
# via aiosignal
51-
h11==0.14.0
51+
h11==0.16.0
5252
# via httpcore
53-
httpcore==1.0.2
53+
httpcore==1.0.9
5454
# via httpx
5555
httpx==0.28.1
5656
# via httpx-aiohttp
5757
# via respx
5858
# via supermemory
59-
httpx-aiohttp==0.1.6
59+
httpx-aiohttp==0.1.8
6060
# via supermemory
6161
idna==3.4
6262
# via anyio

requirements.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ exceptiongroup==1.2.2
3636
frozenlist==1.6.2
3737
# via aiohttp
3838
# via aiosignal
39-
h11==0.14.0
39+
h11==0.16.0
4040
# via httpcore
41-
httpcore==1.0.2
41+
httpcore==1.0.9
4242
# via httpx
4343
httpx==0.28.1
4444
# via httpx-aiohttp
4545
# via supermemory
46-
httpx-aiohttp==0.1.6
46+
httpx-aiohttp==0.1.8
4747
# via supermemory
4848
idna==3.4
4949
# via anyio

src/supermemory/_base_client.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,15 @@ def _build_request(
529529
# work around https://github.com/encode/httpx/discussions/2880
530530
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
531531

532+
is_body_allowed = options.method.lower() != "get"
533+
534+
if is_body_allowed:
535+
kwargs["json"] = json_data if is_given(json_data) else None
536+
kwargs["files"] = files
537+
else:
538+
headers.pop("Content-Type", None)
539+
kwargs.pop("data", None)
540+
532541
# TODO: report this error to httpx
533542
return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
534543
headers=headers,
@@ -540,8 +549,6 @@ def _build_request(
540549
# so that passing a `TypedDict` doesn't cause an error.
541550
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
542551
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
543-
json=json_data if is_given(json_data) else None,
544-
files=files,
545552
**kwargs,
546553
)
547554

src/supermemory/_models.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
import os
44
import inspect
5-
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast
5+
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
66
from datetime import date, datetime
77
from typing_extensions import (
8+
List,
89
Unpack,
910
Literal,
1011
ClassVar,
@@ -366,7 +367,7 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
366367
if type_ is None:
367368
raise RuntimeError(f"Unexpected field type is None for {key}")
368369

369-
return construct_type(value=value, type_=type_)
370+
return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
370371

371372

372373
def is_basemodel(type_: type) -> bool:
@@ -420,7 +421,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
420421
return cast(_T, construct_type(value=value, type_=type_))
421422

422423

423-
def construct_type(*, value: object, type_: object) -> object:
424+
def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object:
424425
"""Loose coercion to the expected type with construction of nested values.
425426
426427
If the given value does not match the expected type then it is returned as-is.
@@ -438,8 +439,10 @@ def construct_type(*, value: object, type_: object) -> object:
438439
type_ = type_.__value__ # type: ignore[unreachable]
439440

440441
# unwrap `Annotated[T, ...]` -> `T`
441-
if is_annotated_type(type_):
442-
meta: tuple[Any, ...] = get_args(type_)[1:]
442+
if metadata is not None:
443+
meta: tuple[Any, ...] = tuple(metadata)
444+
elif is_annotated_type(type_):
445+
meta = get_args(type_)[1:]
443446
type_ = extract_type_arg(type_, 0)
444447
else:
445448
meta = tuple()

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.22" # x-release-please-version
4+
__version__ = "3.0.0-alpha.23" # x-release-please-version

0 commit comments

Comments
 (0)