Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0c627bd
feat(api): api update
stainless-app[bot] May 19, 2025
1f9f018
chore(docs): grammar improvements
stainless-app[bot] May 22, 2025
5bc5a86
feat(api): api update
stainless-app[bot] May 24, 2025
1788d47
feat(api): api update
stainless-app[bot] May 25, 2025
02e8b00
feat(api): api update
stainless-app[bot] May 25, 2025
ca1c596
codegen metadata
stainless-app[bot] May 25, 2025
7d2fded
codegen metadata
stainless-app[bot] May 25, 2025
173a337
feat(api): api update
stainless-app[bot] May 26, 2025
beffc5e
feat(api): api update
stainless-app[bot] May 29, 2025
e95b77e
feat(api): api update
stainless-app[bot] Jun 1, 2025
f58d93d
feat(api): api update
stainless-app[bot] Jun 2, 2025
cd4782d
feat(api): api update
stainless-app[bot] Jun 2, 2025
a0d7515
codegen metadata
stainless-app[bot] Jun 3, 2025
51586e6
feat(api): api update
stainless-app[bot] Jun 3, 2025
23840c8
chore(docs): remove reference to rye shell
stainless-app[bot] Jun 3, 2025
abd637d
feat(client): add follow_redirects request option
stainless-app[bot] Jun 3, 2025
07a5196
codegen metadata
stainless-app[bot] Jun 3, 2025
755cef6
codegen metadata
stainless-app[bot] Jun 3, 2025
02180e2
feat(api): api update
stainless-app[bot] Jun 4, 2025
625befe
codegen metadata
stainless-app[bot] Jun 5, 2025
d1b2a97
feat(api): api update
stainless-app[bot] Jun 5, 2025
fa9f582
feat(api): api update
stainless-app[bot] Jun 7, 2025
d517cbc
feat(api): api update
stainless-app[bot] Jun 8, 2025
c194b2e
feat(api): api update
stainless-app[bot] Jun 9, 2025
7b7711f
feat(api): api update
stainless-app[bot] Jun 10, 2025
378085f
feat(api): api update
stainless-app[bot] Jun 12, 2025
486888d
feat(api): api update
stainless-app[bot] Jun 12, 2025
79f6359
chore(tests): run tests in parallel
stainless-app[bot] Jun 13, 2025
b236e85
fix(client): correctly parse binary response | stream
stainless-app[bot] Jun 13, 2025
c7e0c2c
feat(api): api update
stainless-app[bot] Jun 13, 2025
2d9b26c
feat(api): api update
stainless-app[bot] Jun 16, 2025
a462f22
chore(tests): add tests for httpx client instantiation & proxies
stainless-app[bot] Jun 17, 2025
355810b
chore(internal): update conftest.py
stainless-app[bot] Jun 17, 2025
ec1b12b
chore(ci): enable for pull requests
stainless-app[bot] Jun 17, 2025
9415b50
chore(readme): update badges
stainless-app[bot] Jun 18, 2025
f9bf3c1
fix(tests): fix: tests which call HTTP endpoints directly with the ex…
stainless-app[bot] Jun 18, 2025
be3ccbd
docs(client): fix httpx.Timeout documentation reference
stainless-app[bot] Jun 19, 2025
1e9b706
codegen metadata
stainless-app[bot] Jun 19, 2025
200e97a
feat(api): api update
stainless-app[bot] Jun 20, 2025
5aefc85
feat(api): api update
stainless-app[bot] Jun 21, 2025
d376719
feat(client): add support for aiohttp
stainless-app[bot] Jun 21, 2025
fc586f7
feat(api): api update
stainless-app[bot] Jun 21, 2025
c4039a7
chore(internal): codegen related update
stainless-app[bot] Jun 21, 2025
75c22e3
feat(api): api update
stainless-app[bot] Jun 23, 2025
d792e5f
codegen metadata
stainless-app[bot] Jun 23, 2025
2b10aa8
chore(internal): codegen related update
stainless-app[bot] Jun 24, 2025
394e639
chore(tests): skip some failing tests on the latest python versions
stainless-app[bot] Jun 24, 2025
95a924d
release: 3.0.0-alpha.2
stainless-app[bot] Jun 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.0.0-alpha.1"
".": "3.0.0-alpha.2"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 12
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-e6735b03c258b382c527550bb78042bdc3aad32a5cf564785dcb9f3fb13a2862.yml
openapi_spec_hash: 8168fb51314d986893554e1cc935ca7d
configured_endpoints: 8
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-4c45e387cbdc7c80d75cdb8eb924cf92a3a48a0c10060fda917b83a7e454aef5.yml
openapi_spec_hash: c859ac2e3429ad3663337b99c722f317
config_hash: 8477e3ee6fd596ab6ac911d052e4de79
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
# Changelog

## 3.0.0-alpha.2 (2025-06-24)

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

### Features

* **api:** api update ([75c22e3](https://github.com/supermemoryai/python-sdk/commit/75c22e3f2db8eda857ca184f5bd531ff736a1c8c))
* **api:** api update ([fc586f7](https://github.com/supermemoryai/python-sdk/commit/fc586f729ac602946e95de2e61b6d27a8c3b1167))
* **api:** api update ([5aefc85](https://github.com/supermemoryai/python-sdk/commit/5aefc85540c70a195c2c59a8e9cdd529ff124a3b))
* **api:** api update ([200e97a](https://github.com/supermemoryai/python-sdk/commit/200e97acf9f2be46a3ffef069912da9e4d05a951))
* **api:** api update ([2d9b26c](https://github.com/supermemoryai/python-sdk/commit/2d9b26ce58cf533ffbff6d7a002c8504752c1e6a))
* **api:** api update ([c7e0c2c](https://github.com/supermemoryai/python-sdk/commit/c7e0c2ccae941136705f2328fe536870789cf52a))
* **api:** api update ([486888d](https://github.com/supermemoryai/python-sdk/commit/486888da89d570779e132f3b810c7d1a4f59082a))
* **api:** api update ([378085f](https://github.com/supermemoryai/python-sdk/commit/378085f0090ebf25bbc46d0e3947737457ae3a30))
* **api:** api update ([7b7711f](https://github.com/supermemoryai/python-sdk/commit/7b7711f282eebbaf4edb462b1dc2ed5dfb1bc0fc))
* **api:** api update ([c194b2e](https://github.com/supermemoryai/python-sdk/commit/c194b2ecbe42ebe5997aab4bc96fb7120a5f6b9c))
* **api:** api update ([d517cbc](https://github.com/supermemoryai/python-sdk/commit/d517cbce5d74b7cd92d8921d16ba1bb025848549))
* **api:** api update ([fa9f582](https://github.com/supermemoryai/python-sdk/commit/fa9f582226ed9dee9ea8196b78b9312938093465))
* **api:** api update ([d1b2a97](https://github.com/supermemoryai/python-sdk/commit/d1b2a9719deb080c4b64ae97893ba139ecaebf68))
* **api:** api update ([02180e2](https://github.com/supermemoryai/python-sdk/commit/02180e296f97a30626b183ba533f45879981cc62))
* **api:** api update ([51586e6](https://github.com/supermemoryai/python-sdk/commit/51586e68f9ec7b04b7aba149142f6e550113c0b9))
* **api:** api update ([cd4782d](https://github.com/supermemoryai/python-sdk/commit/cd4782de2b4f05196e6b3f37768de900a6a9e81d))
* **api:** api update ([f58d93d](https://github.com/supermemoryai/python-sdk/commit/f58d93dc249798bdf62c00335c6b9bfdf8430795))
* **api:** api update ([e95b77e](https://github.com/supermemoryai/python-sdk/commit/e95b77ee719a76f0eb22c56f07e90f05712de7cd))
* **api:** api update ([beffc5e](https://github.com/supermemoryai/python-sdk/commit/beffc5e09b5aee9c1517453b2f5574881ecf5dd7))
* **api:** api update ([173a337](https://github.com/supermemoryai/python-sdk/commit/173a337626cbd75d951d10a04e91261ed3a2a384))
* **api:** api update ([02e8b00](https://github.com/supermemoryai/python-sdk/commit/02e8b0072cb84a52124f61f5d8f64d69809c7833))
* **api:** api update ([1788d47](https://github.com/supermemoryai/python-sdk/commit/1788d476d76fd786ed495ee5f8048c301fae0799))
* **api:** api update ([5bc5a86](https://github.com/supermemoryai/python-sdk/commit/5bc5a8611c00f3c77c1e3787f578c91577ddfbb0))
* **api:** api update ([0c627bd](https://github.com/supermemoryai/python-sdk/commit/0c627bde6c7f6ef8d55e94993a612f34c75c7f80))
* **client:** add follow_redirects request option ([abd637d](https://github.com/supermemoryai/python-sdk/commit/abd637db1e3642c0dcc609bf4cac3d0a2bdad061))
* **client:** add support for aiohttp ([d376719](https://github.com/supermemoryai/python-sdk/commit/d37671920ac604d643c0d9edaaee08aaaea2d881))


### Bug Fixes

* **client:** correctly parse binary response | stream ([b236e85](https://github.com/supermemoryai/python-sdk/commit/b236e8552e9393048b3541c2c41d969fd5a88ac0))
* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([f9bf3c1](https://github.com/supermemoryai/python-sdk/commit/f9bf3c135c6a6236c8ef0ee5d538843021448b9d))


### Chores

* **ci:** enable for pull requests ([ec1b12b](https://github.com/supermemoryai/python-sdk/commit/ec1b12b9447ff582d80a0dedf75dc5c924aee6e4))
* **docs:** grammar improvements ([1f9f018](https://github.com/supermemoryai/python-sdk/commit/1f9f01876a2754521ab8cc75c92634b05221f6c5))
* **docs:** remove reference to rye shell ([23840c8](https://github.com/supermemoryai/python-sdk/commit/23840c8b8a67cb3b60e94c1eb74994d28b3508f1))
* **internal:** codegen related update ([2b10aa8](https://github.com/supermemoryai/python-sdk/commit/2b10aa88d82e044d1a7df2bdd266209f4c130c8d))
* **internal:** codegen related update ([c4039a7](https://github.com/supermemoryai/python-sdk/commit/c4039a7d5124d2c6719508830bf8067ebbb4fd58))
* **internal:** update conftest.py ([355810b](https://github.com/supermemoryai/python-sdk/commit/355810b458222ddf405ec130cf43887cf7b2138d))
* **readme:** update badges ([9415b50](https://github.com/supermemoryai/python-sdk/commit/9415b50222cea2e827a8e9c13525ad8e19df9ff2))
* **tests:** add tests for httpx client instantiation & proxies ([a462f22](https://github.com/supermemoryai/python-sdk/commit/a462f2240dac23bf780f540ba39da3febbc561e7))
* **tests:** run tests in parallel ([79f6359](https://github.com/supermemoryai/python-sdk/commit/79f6359beb267f85e273a5a3017283d9e231e78a))
* **tests:** skip some failing tests on the latest python versions ([394e639](https://github.com/supermemoryai/python-sdk/commit/394e639fb904cd4c27b299f5960fd2f02f159b10))


### Documentation

* **client:** fix httpx.Timeout documentation reference ([be3ccbd](https://github.com/supermemoryai/python-sdk/commit/be3ccbdebe4974592c670cb43ed572ced78e60a3))

## 3.0.0-alpha.1 (2025-05-17)

Full Changelog: [v0.1.0-alpha.1...v3.0.0-alpha.1](https://github.com/supermemoryai/python-sdk/compare/v0.1.0-alpha.1...v3.0.0-alpha.1)
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ $ rye sync --all-features
You can then run scripts using `rye run python script.py` or by activating the virtual environment:

```sh
$ rye shell
# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
$ source .venv/bin/activate

# now you can omit the `rye run` prefix
Expand Down
63 changes: 40 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Supermemory Python API library

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

The Supermemory Python library provides convenient access to the Supermemory REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
Expand Down Expand Up @@ -31,10 +31,10 @@ client = Supermemory(
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
)

response = client.search.execute(
q="documents related to python",
response = client.memories.add(
content="This is a detailed article about machine learning concepts...",
)
print(response.results)
print(response.id)
```

While you can provide an `api_key` keyword argument,
Expand All @@ -57,42 +57,59 @@ client = AsyncSupermemory(


async def main() -> None:
response = await client.search.execute(
q="documents related to python",
response = await client.memories.add(
content="This is a detailed article about machine learning concepts...",
)
print(response.results)
print(response.id)


asyncio.run(main())
```

Functionality between the synchronous and asynchronous clients is otherwise identical.

## Using types

Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
### With aiohttp

- Serializing back into JSON, `model.to_json()`
- Converting to a dictionary, `model.to_dict()`
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.

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`.
You can enable this by installing `aiohttp`:

## File uploads
```sh
# install from PyPI
pip install --pre supermemory[aiohttp]
```

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)`.
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:

```python
from pathlib import Path
from supermemory import Supermemory
import os
import asyncio
from supermemory import DefaultAioHttpClient
from supermemory import AsyncSupermemory

client = Supermemory()

client.memories.upload_file(
file=Path("/path/to/file"),
)
async def main() -> None:
async with AsyncSupermemory(
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
http_client=DefaultAioHttpClient(),
) as client:
response = await client.memories.add(
content="This is a detailed article about machine learning concepts...",
)
print(response.id)


asyncio.run(main())
```

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.
## Using types

Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:

- Serializing back into JSON, `model.to_json()`
- Converting to a dictionary, `model.to_dict()`

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`.

## Handling errors

Expand Down Expand Up @@ -163,7 +180,7 @@ client.with_options(max_retries=5).memories.add(
### Timeouts

By default requests time out after 1 minute. You can configure this with a `timeout` option,
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:

```python
from supermemory import Supermemory
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ before making any information public.
## Reporting Non-SDK Related Security Issues

If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by Supermemory please follow the respective company's security reporting guidelines.
or products provided by Supermemory, please follow the respective company's security reporting guidelines.

### Supermemory Terms and Policies

Please contact dhravya@supermemory.com for any questions or concerns regarding security of our services.
Please contact dhravya@supermemory.com for any questions or concerns regarding the security of our services.

---

Expand Down
32 changes: 3 additions & 29 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,15 @@
Types:

```python
from supermemory.types import (
MemoryUpdateResponse,
MemoryListResponse,
MemoryDeleteResponse,
MemoryAddResponse,
MemoryGetResponse,
MemoryUploadFileResponse,
)
from supermemory.types import MemoryUpdateResponse, MemoryAddResponse, MemoryGetResponse
```

Methods:

- <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>
- <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>
- <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>
- <code title="delete /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">delete</a>(id) -> None</code>
- <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>
- <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>
- <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>

# Search

Types:

```python
from supermemory.types import SearchExecuteResponse
```

Methods:

- <code title="get /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>

# Settings

Expand All @@ -52,15 +31,10 @@ Methods:
Types:

```python
from supermemory.types import (
ConnectionCreateResponse,
ConnectionListResponse,
ConnectionGetResponse,
)
from supermemory.types import ConnectionCreateResponse, ConnectionGetResponse
```

Methods:

- <code title="post /v3/connections/{provider}">client.connections.<a href="./src/supermemory/resources/connections.py">create</a>(provider, \*\*<a href="src/supermemory/types/connection_create_params.py">params</a>) -> <a href="./src/supermemory/types/connection_create_response.py">ConnectionCreateResponse</a></code>
- <code title="get /v3/connections">client.connections.<a href="./src/supermemory/resources/connections.py">list</a>(\*\*<a href="src/supermemory/types/connection_list_params.py">params</a>) -> <a href="./src/supermemory/types/connection_list_response.py">ConnectionListResponse</a></code>
- <code title="get /v3/connections/{connectionId}">client.connections.<a href="./src/supermemory/resources/connections.py">get</a>(connection_id) -> <a href="./src/supermemory/types/connection_get_response.py">ConnectionGetResponse</a></code>
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "supermemory"
version = "3.0.0-alpha.1"
version = "3.0.0-alpha.2"
description = "The official Python library for the supermemory API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -37,6 +37,8 @@ classifiers = [
Homepage = "https://github.com/supermemoryai/python-sdk"
Repository = "https://github.com/supermemoryai/python-sdk"

[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"]

[tool.rye]
managed = true
Expand All @@ -54,6 +56,7 @@ dev-dependencies = [
"importlib-metadata>=6.7.0",
"rich>=13.7.1",
"nest_asyncio==1.6.0",
"pytest-xdist>=3.6.1",
]

[tool.rye.scripts]
Expand Down Expand Up @@ -125,7 +128,7 @@ replacement = '[\1](https://github.com/supermemoryai/python-sdk/tree/main/\g<2>)

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short"
addopts = "--tb=short -n auto"
xfail_strict = true
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
Expand Down
Loading