supermemory 3.0.0a1__tar.gz → 3.0.0a2__tar.gz
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-3.0.0a2/.release-please-manifest.json +3 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/CHANGELOG.md +58 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/CONTRIBUTING.md +1 -2
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/PKG-INFO +44 -24
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/README.md +40 -23
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/SECURITY.md +2 -2
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/api.md +3 -29
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/pyproject.toml +5 -2
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/requirements-dev.lock +31 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/requirements.lock +27 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/__init__.py +2 -1
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_base_client.py +44 -2
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_client.py +1 -9
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_files.py +1 -1
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_models.py +2 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_types.py +2 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_version.py +1 -1
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/resources/__init__.py +0 -14
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/resources/connections.py +30 -117
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/resources/memories.py +102 -230
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/resources/settings.py +47 -11
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/types/__init__.py +0 -9
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/types/connection_create_params.py +5 -3
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/types/connection_get_response.py +4 -0
- supermemory-3.0.0a2/src/supermemory/types/memory_add_params.py +46 -0
- supermemory-3.0.0a1/src/supermemory/types/memory_list_response.py → supermemory-3.0.0a2/src/supermemory/types/memory_get_response.py +22 -20
- supermemory-3.0.0a2/src/supermemory/types/memory_update_params.py +46 -0
- supermemory-3.0.0a2/src/supermemory/types/setting_get_response.py +45 -0
- supermemory-3.0.0a2/src/supermemory/types/setting_update_params.py +46 -0
- supermemory-3.0.0a2/src/supermemory/types/setting_update_response.py +53 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/api_resources/test_connections.py +10 -82
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/api_resources/test_memories.py +17 -162
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/api_resources/test_settings.py +29 -9
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/conftest.py +39 -6
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/test_client.py +122 -53
- supermemory-3.0.0a1/.release-please-manifest.json +0 -3
- supermemory-3.0.0a1/src/supermemory/resources/search.py +0 -296
- supermemory-3.0.0a1/src/supermemory/types/connection_list_params.py +0 -13
- supermemory-3.0.0a1/src/supermemory/types/connection_list_response.py +0 -25
- supermemory-3.0.0a1/src/supermemory/types/memory_add_params.py +0 -18
- supermemory-3.0.0a1/src/supermemory/types/memory_delete_response.py +0 -9
- supermemory-3.0.0a1/src/supermemory/types/memory_get_response.py +0 -11
- supermemory-3.0.0a1/src/supermemory/types/memory_list_params.py +0 -24
- supermemory-3.0.0a1/src/supermemory/types/memory_update_params.py +0 -18
- supermemory-3.0.0a1/src/supermemory/types/memory_upload_file_params.py +0 -13
- supermemory-3.0.0a1/src/supermemory/types/memory_upload_file_response.py +0 -11
- supermemory-3.0.0a1/src/supermemory/types/search_execute_params.py +0 -86
- supermemory-3.0.0a1/src/supermemory/types/search_execute_response.py +0 -52
- supermemory-3.0.0a1/src/supermemory/types/setting_get_response.py +0 -11
- supermemory-3.0.0a1/src/supermemory/types/setting_update_params.py +0 -22
- supermemory-3.0.0a1/src/supermemory/types/setting_update_response.py +0 -27
- supermemory-3.0.0a1/tests/api_resources/test_search.py +0 -160
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/.gitignore +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/LICENSE +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/bin/check-release-environment +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/bin/publish-pypi +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/examples/.keep +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/mypy.ini +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/noxfile.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/release-please-config.json +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_compat.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_constants.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_exceptions.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_qs.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_resource.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_response.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_streaming.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_utils/__init__.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_utils/_logs.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_utils/_proxy.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_utils/_reflection.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_utils/_resources_proxy.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_utils/_streams.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_utils/_sync.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_utils/_transform.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_utils/_typing.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/_utils/_utils.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/lib/.keep +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/py.typed +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/types/connection_create_response.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/types/memory_add_response.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/src/supermemory/types/memory_update_response.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/__init__.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/api_resources/__init__.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/sample_file.txt +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/test_deepcopy.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/test_extract_files.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/test_files.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/test_models.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/test_qs.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/test_required_args.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/test_response.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/test_streaming.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/test_transform.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/test_utils/test_proxy.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/test_utils/test_typing.py +0 -0
- {supermemory-3.0.0a1 → supermemory-3.0.0a2}/tests/utils.py +0 -0
@@ -1,5 +1,63 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.0.0-alpha.2 (2025-06-24)
|
4
|
+
|
5
|
+
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)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* **api:** api update ([75c22e3](https://github.com/supermemoryai/python-sdk/commit/75c22e3f2db8eda857ca184f5bd531ff736a1c8c))
|
10
|
+
* **api:** api update ([fc586f7](https://github.com/supermemoryai/python-sdk/commit/fc586f729ac602946e95de2e61b6d27a8c3b1167))
|
11
|
+
* **api:** api update ([5aefc85](https://github.com/supermemoryai/python-sdk/commit/5aefc85540c70a195c2c59a8e9cdd529ff124a3b))
|
12
|
+
* **api:** api update ([200e97a](https://github.com/supermemoryai/python-sdk/commit/200e97acf9f2be46a3ffef069912da9e4d05a951))
|
13
|
+
* **api:** api update ([2d9b26c](https://github.com/supermemoryai/python-sdk/commit/2d9b26ce58cf533ffbff6d7a002c8504752c1e6a))
|
14
|
+
* **api:** api update ([c7e0c2c](https://github.com/supermemoryai/python-sdk/commit/c7e0c2ccae941136705f2328fe536870789cf52a))
|
15
|
+
* **api:** api update ([486888d](https://github.com/supermemoryai/python-sdk/commit/486888da89d570779e132f3b810c7d1a4f59082a))
|
16
|
+
* **api:** api update ([378085f](https://github.com/supermemoryai/python-sdk/commit/378085f0090ebf25bbc46d0e3947737457ae3a30))
|
17
|
+
* **api:** api update ([7b7711f](https://github.com/supermemoryai/python-sdk/commit/7b7711f282eebbaf4edb462b1dc2ed5dfb1bc0fc))
|
18
|
+
* **api:** api update ([c194b2e](https://github.com/supermemoryai/python-sdk/commit/c194b2ecbe42ebe5997aab4bc96fb7120a5f6b9c))
|
19
|
+
* **api:** api update ([d517cbc](https://github.com/supermemoryai/python-sdk/commit/d517cbce5d74b7cd92d8921d16ba1bb025848549))
|
20
|
+
* **api:** api update ([fa9f582](https://github.com/supermemoryai/python-sdk/commit/fa9f582226ed9dee9ea8196b78b9312938093465))
|
21
|
+
* **api:** api update ([d1b2a97](https://github.com/supermemoryai/python-sdk/commit/d1b2a9719deb080c4b64ae97893ba139ecaebf68))
|
22
|
+
* **api:** api update ([02180e2](https://github.com/supermemoryai/python-sdk/commit/02180e296f97a30626b183ba533f45879981cc62))
|
23
|
+
* **api:** api update ([51586e6](https://github.com/supermemoryai/python-sdk/commit/51586e68f9ec7b04b7aba149142f6e550113c0b9))
|
24
|
+
* **api:** api update ([cd4782d](https://github.com/supermemoryai/python-sdk/commit/cd4782de2b4f05196e6b3f37768de900a6a9e81d))
|
25
|
+
* **api:** api update ([f58d93d](https://github.com/supermemoryai/python-sdk/commit/f58d93dc249798bdf62c00335c6b9bfdf8430795))
|
26
|
+
* **api:** api update ([e95b77e](https://github.com/supermemoryai/python-sdk/commit/e95b77ee719a76f0eb22c56f07e90f05712de7cd))
|
27
|
+
* **api:** api update ([beffc5e](https://github.com/supermemoryai/python-sdk/commit/beffc5e09b5aee9c1517453b2f5574881ecf5dd7))
|
28
|
+
* **api:** api update ([173a337](https://github.com/supermemoryai/python-sdk/commit/173a337626cbd75d951d10a04e91261ed3a2a384))
|
29
|
+
* **api:** api update ([02e8b00](https://github.com/supermemoryai/python-sdk/commit/02e8b0072cb84a52124f61f5d8f64d69809c7833))
|
30
|
+
* **api:** api update ([1788d47](https://github.com/supermemoryai/python-sdk/commit/1788d476d76fd786ed495ee5f8048c301fae0799))
|
31
|
+
* **api:** api update ([5bc5a86](https://github.com/supermemoryai/python-sdk/commit/5bc5a8611c00f3c77c1e3787f578c91577ddfbb0))
|
32
|
+
* **api:** api update ([0c627bd](https://github.com/supermemoryai/python-sdk/commit/0c627bde6c7f6ef8d55e94993a612f34c75c7f80))
|
33
|
+
* **client:** add follow_redirects request option ([abd637d](https://github.com/supermemoryai/python-sdk/commit/abd637db1e3642c0dcc609bf4cac3d0a2bdad061))
|
34
|
+
* **client:** add support for aiohttp ([d376719](https://github.com/supermemoryai/python-sdk/commit/d37671920ac604d643c0d9edaaee08aaaea2d881))
|
35
|
+
|
36
|
+
|
37
|
+
### Bug Fixes
|
38
|
+
|
39
|
+
* **client:** correctly parse binary response | stream ([b236e85](https://github.com/supermemoryai/python-sdk/commit/b236e8552e9393048b3541c2c41d969fd5a88ac0))
|
40
|
+
* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([f9bf3c1](https://github.com/supermemoryai/python-sdk/commit/f9bf3c135c6a6236c8ef0ee5d538843021448b9d))
|
41
|
+
|
42
|
+
|
43
|
+
### Chores
|
44
|
+
|
45
|
+
* **ci:** enable for pull requests ([ec1b12b](https://github.com/supermemoryai/python-sdk/commit/ec1b12b9447ff582d80a0dedf75dc5c924aee6e4))
|
46
|
+
* **docs:** grammar improvements ([1f9f018](https://github.com/supermemoryai/python-sdk/commit/1f9f01876a2754521ab8cc75c92634b05221f6c5))
|
47
|
+
* **docs:** remove reference to rye shell ([23840c8](https://github.com/supermemoryai/python-sdk/commit/23840c8b8a67cb3b60e94c1eb74994d28b3508f1))
|
48
|
+
* **internal:** codegen related update ([2b10aa8](https://github.com/supermemoryai/python-sdk/commit/2b10aa88d82e044d1a7df2bdd266209f4c130c8d))
|
49
|
+
* **internal:** codegen related update ([c4039a7](https://github.com/supermemoryai/python-sdk/commit/c4039a7d5124d2c6719508830bf8067ebbb4fd58))
|
50
|
+
* **internal:** update conftest.py ([355810b](https://github.com/supermemoryai/python-sdk/commit/355810b458222ddf405ec130cf43887cf7b2138d))
|
51
|
+
* **readme:** update badges ([9415b50](https://github.com/supermemoryai/python-sdk/commit/9415b50222cea2e827a8e9c13525ad8e19df9ff2))
|
52
|
+
* **tests:** add tests for httpx client instantiation & proxies ([a462f22](https://github.com/supermemoryai/python-sdk/commit/a462f2240dac23bf780f540ba39da3febbc561e7))
|
53
|
+
* **tests:** run tests in parallel ([79f6359](https://github.com/supermemoryai/python-sdk/commit/79f6359beb267f85e273a5a3017283d9e231e78a))
|
54
|
+
* **tests:** skip some failing tests on the latest python versions ([394e639](https://github.com/supermemoryai/python-sdk/commit/394e639fb904cd4c27b299f5960fd2f02f159b10))
|
55
|
+
|
56
|
+
|
57
|
+
### Documentation
|
58
|
+
|
59
|
+
* **client:** fix httpx.Timeout documentation reference ([be3ccbd](https://github.com/supermemoryai/python-sdk/commit/be3ccbdebe4974592c670cb43ed572ced78e60a3))
|
60
|
+
|
3
61
|
## 3.0.0-alpha.1 (2025-05-17)
|
4
62
|
|
5
63
|
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)
|
@@ -17,8 +17,7 @@ $ rye sync --all-features
|
|
17
17
|
You can then run scripts using `rye run python script.py` or by activating the virtual environment:
|
18
18
|
|
19
19
|
```sh
|
20
|
-
|
21
|
-
# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
|
20
|
+
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
|
22
21
|
$ source .venv/bin/activate
|
23
22
|
|
24
23
|
# now you can omit the `rye run` prefix
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: supermemory
|
3
|
-
Version: 3.0.
|
3
|
+
Version: 3.0.0a2
|
4
4
|
Summary: The official Python library for the supermemory API
|
5
5
|
Project-URL: Homepage, https://github.com/supermemoryai/python-sdk
|
6
6
|
Project-URL: Repository, https://github.com/supermemoryai/python-sdk
|
@@ -27,11 +27,14 @@ Requires-Dist: httpx<1,>=0.23.0
|
|
27
27
|
Requires-Dist: pydantic<3,>=1.9.0
|
28
28
|
Requires-Dist: sniffio
|
29
29
|
Requires-Dist: typing-extensions<5,>=4.10
|
30
|
+
Provides-Extra: aiohttp
|
31
|
+
Requires-Dist: aiohttp; extra == 'aiohttp'
|
32
|
+
Requires-Dist: httpx-aiohttp>=0.1.6; extra == 'aiohttp'
|
30
33
|
Description-Content-Type: text/markdown
|
31
34
|
|
32
35
|
# Supermemory Python API library
|
33
36
|
|
34
|
-
[](https://pypi.org/project/supermemory/)
|
37
|
+
[>)](https://pypi.org/project/supermemory/)
|
35
38
|
|
36
39
|
The Supermemory Python library provides convenient access to the Supermemory REST API from any Python 3.8+
|
37
40
|
application. The library includes type definitions for all request params and response fields,
|
@@ -62,10 +65,10 @@ client = Supermemory(
|
|
62
65
|
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
63
66
|
)
|
64
67
|
|
65
|
-
response = client.
|
66
|
-
|
68
|
+
response = client.memories.add(
|
69
|
+
content="This is a detailed article about machine learning concepts...",
|
67
70
|
)
|
68
|
-
print(response.
|
71
|
+
print(response.id)
|
69
72
|
```
|
70
73
|
|
71
74
|
While you can provide an `api_key` keyword argument,
|
@@ -88,10 +91,10 @@ client = AsyncSupermemory(
|
|
88
91
|
|
89
92
|
|
90
93
|
async def main() -> None:
|
91
|
-
response = await client.
|
92
|
-
|
94
|
+
response = await client.memories.add(
|
95
|
+
content="This is a detailed article about machine learning concepts...",
|
93
96
|
)
|
94
|
-
print(response.
|
97
|
+
print(response.id)
|
95
98
|
|
96
99
|
|
97
100
|
asyncio.run(main())
|
@@ -99,31 +102,48 @@ asyncio.run(main())
|
|
99
102
|
|
100
103
|
Functionality between the synchronous and asynchronous clients is otherwise identical.
|
101
104
|
|
102
|
-
|
103
|
-
|
104
|
-
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:
|
105
|
+
### With aiohttp
|
105
106
|
|
106
|
-
|
107
|
-
- Converting to a dictionary, `model.to_dict()`
|
107
|
+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
|
108
108
|
|
109
|
-
|
109
|
+
You can enable this by installing `aiohttp`:
|
110
110
|
|
111
|
-
|
111
|
+
```sh
|
112
|
+
# install from PyPI
|
113
|
+
pip install --pre supermemory[aiohttp]
|
114
|
+
```
|
112
115
|
|
113
|
-
|
116
|
+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
114
117
|
|
115
118
|
```python
|
116
|
-
|
117
|
-
|
119
|
+
import os
|
120
|
+
import asyncio
|
121
|
+
from supermemory import DefaultAioHttpClient
|
122
|
+
from supermemory import AsyncSupermemory
|
118
123
|
|
119
|
-
client = Supermemory()
|
120
124
|
|
121
|
-
|
122
|
-
|
123
|
-
)
|
125
|
+
async def main() -> None:
|
126
|
+
async with AsyncSupermemory(
|
127
|
+
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
128
|
+
http_client=DefaultAioHttpClient(),
|
129
|
+
) as client:
|
130
|
+
response = await client.memories.add(
|
131
|
+
content="This is a detailed article about machine learning concepts...",
|
132
|
+
)
|
133
|
+
print(response.id)
|
134
|
+
|
135
|
+
|
136
|
+
asyncio.run(main())
|
124
137
|
```
|
125
138
|
|
126
|
-
|
139
|
+
## Using types
|
140
|
+
|
141
|
+
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:
|
142
|
+
|
143
|
+
- Serializing back into JSON, `model.to_json()`
|
144
|
+
- Converting to a dictionary, `model.to_dict()`
|
145
|
+
|
146
|
+
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`.
|
127
147
|
|
128
148
|
## Handling errors
|
129
149
|
|
@@ -194,7 +214,7 @@ client.with_options(max_retries=5).memories.add(
|
|
194
214
|
### Timeouts
|
195
215
|
|
196
216
|
By default requests time out after 1 minute. You can configure this with a `timeout` option,
|
197
|
-
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
|
217
|
+
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
198
218
|
|
199
219
|
```python
|
200
220
|
from supermemory import Supermemory
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Supermemory Python API library
|
2
2
|
|
3
|
-
[](https://pypi.org/project/supermemory/)
|
3
|
+
[>)](https://pypi.org/project/supermemory/)
|
4
4
|
|
5
5
|
The Supermemory Python library provides convenient access to the Supermemory REST API from any Python 3.8+
|
6
6
|
application. The library includes type definitions for all request params and response fields,
|
@@ -31,10 +31,10 @@ client = Supermemory(
|
|
31
31
|
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
32
32
|
)
|
33
33
|
|
34
|
-
response = client.
|
35
|
-
|
34
|
+
response = client.memories.add(
|
35
|
+
content="This is a detailed article about machine learning concepts...",
|
36
36
|
)
|
37
|
-
print(response.
|
37
|
+
print(response.id)
|
38
38
|
```
|
39
39
|
|
40
40
|
While you can provide an `api_key` keyword argument,
|
@@ -57,10 +57,10 @@ client = AsyncSupermemory(
|
|
57
57
|
|
58
58
|
|
59
59
|
async def main() -> None:
|
60
|
-
response = await client.
|
61
|
-
|
60
|
+
response = await client.memories.add(
|
61
|
+
content="This is a detailed article about machine learning concepts...",
|
62
62
|
)
|
63
|
-
print(response.
|
63
|
+
print(response.id)
|
64
64
|
|
65
65
|
|
66
66
|
asyncio.run(main())
|
@@ -68,31 +68,48 @@ asyncio.run(main())
|
|
68
68
|
|
69
69
|
Functionality between the synchronous and asynchronous clients is otherwise identical.
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
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:
|
71
|
+
### With aiohttp
|
74
72
|
|
75
|
-
|
76
|
-
- Converting to a dictionary, `model.to_dict()`
|
73
|
+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
|
77
74
|
|
78
|
-
|
75
|
+
You can enable this by installing `aiohttp`:
|
79
76
|
|
80
|
-
|
77
|
+
```sh
|
78
|
+
# install from PyPI
|
79
|
+
pip install --pre supermemory[aiohttp]
|
80
|
+
```
|
81
81
|
|
82
|
-
|
82
|
+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
83
83
|
|
84
84
|
```python
|
85
|
-
|
86
|
-
|
85
|
+
import os
|
86
|
+
import asyncio
|
87
|
+
from supermemory import DefaultAioHttpClient
|
88
|
+
from supermemory import AsyncSupermemory
|
87
89
|
|
88
|
-
client = Supermemory()
|
89
90
|
|
90
|
-
|
91
|
-
|
92
|
-
)
|
91
|
+
async def main() -> None:
|
92
|
+
async with AsyncSupermemory(
|
93
|
+
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
94
|
+
http_client=DefaultAioHttpClient(),
|
95
|
+
) as client:
|
96
|
+
response = await client.memories.add(
|
97
|
+
content="This is a detailed article about machine learning concepts...",
|
98
|
+
)
|
99
|
+
print(response.id)
|
100
|
+
|
101
|
+
|
102
|
+
asyncio.run(main())
|
93
103
|
```
|
94
104
|
|
95
|
-
|
105
|
+
## Using types
|
106
|
+
|
107
|
+
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:
|
108
|
+
|
109
|
+
- Serializing back into JSON, `model.to_json()`
|
110
|
+
- Converting to a dictionary, `model.to_dict()`
|
111
|
+
|
112
|
+
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`.
|
96
113
|
|
97
114
|
## Handling errors
|
98
115
|
|
@@ -163,7 +180,7 @@ client.with_options(max_retries=5).memories.add(
|
|
163
180
|
### Timeouts
|
164
181
|
|
165
182
|
By default requests time out after 1 minute. You can configure this with a `timeout` option,
|
166
|
-
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
|
183
|
+
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
167
184
|
|
168
185
|
```python
|
169
186
|
from supermemory import Supermemory
|
@@ -16,11 +16,11 @@ before making any information public.
|
|
16
16
|
## Reporting Non-SDK Related Security Issues
|
17
17
|
|
18
18
|
If you encounter security issues that are not directly related to SDKs but pertain to the services
|
19
|
-
or products provided by Supermemory please follow the respective company's security reporting guidelines.
|
19
|
+
or products provided by Supermemory, please follow the respective company's security reporting guidelines.
|
20
20
|
|
21
21
|
### Supermemory Terms and Policies
|
22
22
|
|
23
|
-
Please contact dhravya@supermemory.com for any questions or concerns regarding security of our services.
|
23
|
+
Please contact dhravya@supermemory.com for any questions or concerns regarding the security of our services.
|
24
24
|
|
25
25
|
---
|
26
26
|
|
@@ -3,36 +3,15 @@
|
|
3
3
|
Types:
|
4
4
|
|
5
5
|
```python
|
6
|
-
from supermemory.types import
|
7
|
-
MemoryUpdateResponse,
|
8
|
-
MemoryListResponse,
|
9
|
-
MemoryDeleteResponse,
|
10
|
-
MemoryAddResponse,
|
11
|
-
MemoryGetResponse,
|
12
|
-
MemoryUploadFileResponse,
|
13
|
-
)
|
6
|
+
from supermemory.types import MemoryUpdateResponse, MemoryAddResponse, MemoryGetResponse
|
14
7
|
```
|
15
8
|
|
16
9
|
Methods:
|
17
10
|
|
18
11
|
- <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>
|
19
|
-
- <code title="
|
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>
|
12
|
+
- <code title="delete /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">delete</a>(id) -> None</code>
|
21
13
|
- <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>
|
22
14
|
- <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>
|
23
|
-
- <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>
|
24
|
-
|
25
|
-
# Search
|
26
|
-
|
27
|
-
Types:
|
28
|
-
|
29
|
-
```python
|
30
|
-
from supermemory.types import SearchExecuteResponse
|
31
|
-
```
|
32
|
-
|
33
|
-
Methods:
|
34
|
-
|
35
|
-
- <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>
|
36
15
|
|
37
16
|
# Settings
|
38
17
|
|
@@ -52,15 +31,10 @@ Methods:
|
|
52
31
|
Types:
|
53
32
|
|
54
33
|
```python
|
55
|
-
from supermemory.types import
|
56
|
-
ConnectionCreateResponse,
|
57
|
-
ConnectionListResponse,
|
58
|
-
ConnectionGetResponse,
|
59
|
-
)
|
34
|
+
from supermemory.types import ConnectionCreateResponse, ConnectionGetResponse
|
60
35
|
```
|
61
36
|
|
62
37
|
Methods:
|
63
38
|
|
64
39
|
- <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>
|
65
|
-
- <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>
|
66
40
|
- <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>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "supermemory"
|
3
|
-
version = "3.0.0-alpha.
|
3
|
+
version = "3.0.0-alpha.2"
|
4
4
|
description = "The official Python library for the supermemory API"
|
5
5
|
dynamic = ["readme"]
|
6
6
|
license = "Apache-2.0"
|
@@ -37,6 +37,8 @@ classifiers = [
|
|
37
37
|
Homepage = "https://github.com/supermemoryai/python-sdk"
|
38
38
|
Repository = "https://github.com/supermemoryai/python-sdk"
|
39
39
|
|
40
|
+
[project.optional-dependencies]
|
41
|
+
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"]
|
40
42
|
|
41
43
|
[tool.rye]
|
42
44
|
managed = true
|
@@ -54,6 +56,7 @@ dev-dependencies = [
|
|
54
56
|
"importlib-metadata>=6.7.0",
|
55
57
|
"rich>=13.7.1",
|
56
58
|
"nest_asyncio==1.6.0",
|
59
|
+
"pytest-xdist>=3.6.1",
|
57
60
|
]
|
58
61
|
|
59
62
|
[tool.rye.scripts]
|
@@ -125,7 +128,7 @@ replacement = '[\1](https://github.com/supermemoryai/python-sdk/tree/main/\g<2>)
|
|
125
128
|
|
126
129
|
[tool.pytest.ini_options]
|
127
130
|
testpaths = ["tests"]
|
128
|
-
addopts = "--tb=short"
|
131
|
+
addopts = "--tb=short -n auto"
|
129
132
|
xfail_strict = true
|
130
133
|
asyncio_mode = "auto"
|
131
134
|
asyncio_default_fixture_loop_scope = "session"
|
@@ -10,6 +10,13 @@
|
|
10
10
|
# universal: false
|
11
11
|
|
12
12
|
-e file:.
|
13
|
+
aiohappyeyeballs==2.6.1
|
14
|
+
# via aiohttp
|
15
|
+
aiohttp==3.12.8
|
16
|
+
# via httpx-aiohttp
|
17
|
+
# via supermemory
|
18
|
+
aiosignal==1.3.2
|
19
|
+
# via aiohttp
|
13
20
|
annotated-types==0.6.0
|
14
21
|
# via pydantic
|
15
22
|
anyio==4.4.0
|
@@ -17,6 +24,10 @@ anyio==4.4.0
|
|
17
24
|
# via supermemory
|
18
25
|
argcomplete==3.1.2
|
19
26
|
# via nox
|
27
|
+
async-timeout==5.0.1
|
28
|
+
# via aiohttp
|
29
|
+
attrs==25.3.0
|
30
|
+
# via aiohttp
|
20
31
|
certifi==2023.7.22
|
21
32
|
# via httpcore
|
22
33
|
# via httpx
|
@@ -30,18 +41,27 @@ distro==1.8.0
|
|
30
41
|
exceptiongroup==1.2.2
|
31
42
|
# via anyio
|
32
43
|
# via pytest
|
44
|
+
execnet==2.1.1
|
45
|
+
# via pytest-xdist
|
33
46
|
filelock==3.12.4
|
34
47
|
# via virtualenv
|
48
|
+
frozenlist==1.6.2
|
49
|
+
# via aiohttp
|
50
|
+
# via aiosignal
|
35
51
|
h11==0.14.0
|
36
52
|
# via httpcore
|
37
53
|
httpcore==1.0.2
|
38
54
|
# via httpx
|
39
55
|
httpx==0.28.1
|
56
|
+
# via httpx-aiohttp
|
40
57
|
# via respx
|
41
58
|
# via supermemory
|
59
|
+
httpx-aiohttp==0.1.6
|
60
|
+
# via supermemory
|
42
61
|
idna==3.4
|
43
62
|
# via anyio
|
44
63
|
# via httpx
|
64
|
+
# via yarl
|
45
65
|
importlib-metadata==7.0.0
|
46
66
|
iniconfig==2.0.0
|
47
67
|
# via pytest
|
@@ -49,6 +69,9 @@ markdown-it-py==3.0.0
|
|
49
69
|
# via rich
|
50
70
|
mdurl==0.1.2
|
51
71
|
# via markdown-it-py
|
72
|
+
multidict==6.4.4
|
73
|
+
# via aiohttp
|
74
|
+
# via yarl
|
52
75
|
mypy==1.14.1
|
53
76
|
mypy-extensions==1.0.0
|
54
77
|
# via mypy
|
@@ -63,6 +86,9 @@ platformdirs==3.11.0
|
|
63
86
|
# via virtualenv
|
64
87
|
pluggy==1.5.0
|
65
88
|
# via pytest
|
89
|
+
propcache==0.3.1
|
90
|
+
# via aiohttp
|
91
|
+
# via yarl
|
66
92
|
pydantic==2.10.3
|
67
93
|
# via supermemory
|
68
94
|
pydantic-core==2.27.1
|
@@ -72,7 +98,9 @@ pygments==2.18.0
|
|
72
98
|
pyright==1.1.399
|
73
99
|
pytest==8.3.3
|
74
100
|
# via pytest-asyncio
|
101
|
+
# via pytest-xdist
|
75
102
|
pytest-asyncio==0.24.0
|
103
|
+
pytest-xdist==3.7.0
|
76
104
|
python-dateutil==2.8.2
|
77
105
|
# via time-machine
|
78
106
|
pytz==2023.3.post1
|
@@ -93,6 +121,7 @@ tomli==2.0.2
|
|
93
121
|
# via pytest
|
94
122
|
typing-extensions==4.12.2
|
95
123
|
# via anyio
|
124
|
+
# via multidict
|
96
125
|
# via mypy
|
97
126
|
# via pydantic
|
98
127
|
# via pydantic-core
|
@@ -100,5 +129,7 @@ typing-extensions==4.12.2
|
|
100
129
|
# via supermemory
|
101
130
|
virtualenv==20.24.5
|
102
131
|
# via nox
|
132
|
+
yarl==1.20.0
|
133
|
+
# via aiohttp
|
103
134
|
zipp==3.17.0
|
104
135
|
# via importlib-metadata
|
@@ -10,11 +10,22 @@
|
|
10
10
|
# universal: false
|
11
11
|
|
12
12
|
-e file:.
|
13
|
+
aiohappyeyeballs==2.6.1
|
14
|
+
# via aiohttp
|
15
|
+
aiohttp==3.12.8
|
16
|
+
# via httpx-aiohttp
|
17
|
+
# via supermemory
|
18
|
+
aiosignal==1.3.2
|
19
|
+
# via aiohttp
|
13
20
|
annotated-types==0.6.0
|
14
21
|
# via pydantic
|
15
22
|
anyio==4.4.0
|
16
23
|
# via httpx
|
17
24
|
# via supermemory
|
25
|
+
async-timeout==5.0.1
|
26
|
+
# via aiohttp
|
27
|
+
attrs==25.3.0
|
28
|
+
# via aiohttp
|
18
29
|
certifi==2023.7.22
|
19
30
|
# via httpcore
|
20
31
|
# via httpx
|
@@ -22,15 +33,28 @@ distro==1.8.0
|
|
22
33
|
# via supermemory
|
23
34
|
exceptiongroup==1.2.2
|
24
35
|
# via anyio
|
36
|
+
frozenlist==1.6.2
|
37
|
+
# via aiohttp
|
38
|
+
# via aiosignal
|
25
39
|
h11==0.14.0
|
26
40
|
# via httpcore
|
27
41
|
httpcore==1.0.2
|
28
42
|
# via httpx
|
29
43
|
httpx==0.28.1
|
44
|
+
# via httpx-aiohttp
|
45
|
+
# via supermemory
|
46
|
+
httpx-aiohttp==0.1.6
|
30
47
|
# via supermemory
|
31
48
|
idna==3.4
|
32
49
|
# via anyio
|
33
50
|
# via httpx
|
51
|
+
# via yarl
|
52
|
+
multidict==6.4.4
|
53
|
+
# via aiohttp
|
54
|
+
# via yarl
|
55
|
+
propcache==0.3.1
|
56
|
+
# via aiohttp
|
57
|
+
# via yarl
|
34
58
|
pydantic==2.10.3
|
35
59
|
# via supermemory
|
36
60
|
pydantic-core==2.27.1
|
@@ -40,6 +64,9 @@ sniffio==1.3.0
|
|
40
64
|
# via supermemory
|
41
65
|
typing-extensions==4.12.2
|
42
66
|
# via anyio
|
67
|
+
# via multidict
|
43
68
|
# via pydantic
|
44
69
|
# via pydantic-core
|
45
70
|
# via supermemory
|
71
|
+
yarl==1.20.0
|
72
|
+
# via aiohttp
|
@@ -36,7 +36,7 @@ from ._exceptions import (
|
|
36
36
|
UnprocessableEntityError,
|
37
37
|
APIResponseValidationError,
|
38
38
|
)
|
39
|
-
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
|
39
|
+
from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
|
40
40
|
from ._utils._logs import setup_logging as _setup_logging
|
41
41
|
|
42
42
|
__all__ = [
|
@@ -78,6 +78,7 @@ __all__ = [
|
|
78
78
|
"DEFAULT_CONNECTION_LIMITS",
|
79
79
|
"DefaultHttpxClient",
|
80
80
|
"DefaultAsyncHttpxClient",
|
81
|
+
"DefaultAioHttpClient",
|
81
82
|
]
|
82
83
|
|
83
84
|
if not _t.TYPE_CHECKING:
|