supermemory 3.0.0a1__tar.gz → 3.0.0a19__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.
Files changed (97) hide show
  1. supermemory-3.0.0a19/.release-please-manifest.json +3 -0
  2. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/CHANGELOG.md +66 -0
  3. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/CONTRIBUTING.md +1 -2
  4. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/PKG-INFO +46 -9
  5. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/README.md +42 -8
  6. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/SECURITY.md +2 -2
  7. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/api.md +2 -22
  8. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/pyproject.toml +5 -2
  9. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/requirements-dev.lock +31 -0
  10. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/requirements.lock +27 -0
  11. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/__init__.py +2 -1
  12. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_base_client.py +44 -2
  13. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_client.py +1 -9
  14. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_models.py +2 -0
  15. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_types.py +2 -0
  16. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_version.py +1 -1
  17. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/resources/__init__.py +0 -14
  18. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/resources/connections.py +30 -117
  19. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/resources/memories.py +100 -137
  20. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/resources/settings.py +47 -11
  21. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/types/__init__.py +0 -7
  22. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/types/connection_create_params.py +5 -3
  23. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/types/connection_get_response.py +4 -0
  24. supermemory-3.0.0a19/src/supermemory/types/memory_add_params.py +46 -0
  25. supermemory-3.0.0a1/src/supermemory/types/memory_list_response.py → supermemory-3.0.0a19/src/supermemory/types/memory_get_response.py +22 -20
  26. supermemory-3.0.0a19/src/supermemory/types/memory_update_params.py +46 -0
  27. supermemory-3.0.0a19/src/supermemory/types/setting_get_response.py +45 -0
  28. supermemory-3.0.0a19/src/supermemory/types/setting_update_params.py +46 -0
  29. supermemory-3.0.0a19/src/supermemory/types/setting_update_response.py +53 -0
  30. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/api_resources/test_connections.py +10 -82
  31. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/api_resources/test_memories.py +17 -93
  32. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/api_resources/test_settings.py +29 -9
  33. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/conftest.py +39 -6
  34. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/test_client.py +122 -53
  35. supermemory-3.0.0a1/.release-please-manifest.json +0 -3
  36. supermemory-3.0.0a1/src/supermemory/resources/search.py +0 -296
  37. supermemory-3.0.0a1/src/supermemory/types/connection_list_params.py +0 -13
  38. supermemory-3.0.0a1/src/supermemory/types/connection_list_response.py +0 -25
  39. supermemory-3.0.0a1/src/supermemory/types/memory_add_params.py +0 -18
  40. supermemory-3.0.0a1/src/supermemory/types/memory_delete_response.py +0 -9
  41. supermemory-3.0.0a1/src/supermemory/types/memory_get_response.py +0 -11
  42. supermemory-3.0.0a1/src/supermemory/types/memory_list_params.py +0 -24
  43. supermemory-3.0.0a1/src/supermemory/types/memory_update_params.py +0 -18
  44. supermemory-3.0.0a1/src/supermemory/types/search_execute_params.py +0 -86
  45. supermemory-3.0.0a1/src/supermemory/types/search_execute_response.py +0 -52
  46. supermemory-3.0.0a1/src/supermemory/types/setting_get_response.py +0 -11
  47. supermemory-3.0.0a1/src/supermemory/types/setting_update_params.py +0 -22
  48. supermemory-3.0.0a1/src/supermemory/types/setting_update_response.py +0 -27
  49. supermemory-3.0.0a1/tests/api_resources/test_search.py +0 -160
  50. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/.gitignore +0 -0
  51. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/LICENSE +0 -0
  52. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/bin/check-release-environment +0 -0
  53. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/bin/publish-pypi +0 -0
  54. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/examples/.keep +0 -0
  55. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/mypy.ini +0 -0
  56. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/noxfile.py +0 -0
  57. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/release-please-config.json +0 -0
  58. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_compat.py +0 -0
  59. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_constants.py +0 -0
  60. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_exceptions.py +0 -0
  61. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_files.py +0 -0
  62. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_qs.py +0 -0
  63. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_resource.py +0 -0
  64. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_response.py +0 -0
  65. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_streaming.py +0 -0
  66. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_utils/__init__.py +0 -0
  67. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_utils/_logs.py +0 -0
  68. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_utils/_proxy.py +0 -0
  69. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_utils/_reflection.py +0 -0
  70. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_utils/_resources_proxy.py +0 -0
  71. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_utils/_streams.py +0 -0
  72. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_utils/_sync.py +0 -0
  73. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_utils/_transform.py +0 -0
  74. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_utils/_typing.py +0 -0
  75. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/_utils/_utils.py +0 -0
  76. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/lib/.keep +0 -0
  77. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/py.typed +0 -0
  78. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/types/connection_create_response.py +0 -0
  79. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/types/memory_add_response.py +0 -0
  80. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/types/memory_update_response.py +0 -0
  81. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/types/memory_upload_file_params.py +0 -0
  82. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/src/supermemory/types/memory_upload_file_response.py +0 -0
  83. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/__init__.py +0 -0
  84. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/api_resources/__init__.py +0 -0
  85. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/sample_file.txt +0 -0
  86. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/test_deepcopy.py +0 -0
  87. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/test_extract_files.py +0 -0
  88. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/test_files.py +0 -0
  89. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/test_models.py +0 -0
  90. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/test_qs.py +0 -0
  91. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/test_required_args.py +0 -0
  92. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/test_response.py +0 -0
  93. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/test_streaming.py +0 -0
  94. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/test_transform.py +0 -0
  95. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/test_utils/test_proxy.py +0 -0
  96. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/test_utils/test_typing.py +0 -0
  97. {supermemory-3.0.0a1 → supermemory-3.0.0a19}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "3.0.0-alpha.19"
3
+ }
@@ -1,5 +1,71 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0-alpha.19 (2025-06-26)
4
+
5
+ Full Changelog: [v3.0.0-alpha.2...v3.0.0-alpha.19](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.2...v3.0.0-alpha.19)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([10e12a2](https://github.com/supermemoryai/python-sdk/commit/10e12a2f0453c3e5a2eaeee86a3da9738c161e50))
10
+
11
+ ## 3.0.0-alpha.2 (2025-06-24)
12
+
13
+ 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)
14
+
15
+ ### Features
16
+
17
+ * **api:** api update ([75c22e3](https://github.com/supermemoryai/python-sdk/commit/75c22e3f2db8eda857ca184f5bd531ff736a1c8c))
18
+ * **api:** api update ([fc586f7](https://github.com/supermemoryai/python-sdk/commit/fc586f729ac602946e95de2e61b6d27a8c3b1167))
19
+ * **api:** api update ([5aefc85](https://github.com/supermemoryai/python-sdk/commit/5aefc85540c70a195c2c59a8e9cdd529ff124a3b))
20
+ * **api:** api update ([200e97a](https://github.com/supermemoryai/python-sdk/commit/200e97acf9f2be46a3ffef069912da9e4d05a951))
21
+ * **api:** api update ([2d9b26c](https://github.com/supermemoryai/python-sdk/commit/2d9b26ce58cf533ffbff6d7a002c8504752c1e6a))
22
+ * **api:** api update ([c7e0c2c](https://github.com/supermemoryai/python-sdk/commit/c7e0c2ccae941136705f2328fe536870789cf52a))
23
+ * **api:** api update ([486888d](https://github.com/supermemoryai/python-sdk/commit/486888da89d570779e132f3b810c7d1a4f59082a))
24
+ * **api:** api update ([378085f](https://github.com/supermemoryai/python-sdk/commit/378085f0090ebf25bbc46d0e3947737457ae3a30))
25
+ * **api:** api update ([7b7711f](https://github.com/supermemoryai/python-sdk/commit/7b7711f282eebbaf4edb462b1dc2ed5dfb1bc0fc))
26
+ * **api:** api update ([c194b2e](https://github.com/supermemoryai/python-sdk/commit/c194b2ecbe42ebe5997aab4bc96fb7120a5f6b9c))
27
+ * **api:** api update ([d517cbc](https://github.com/supermemoryai/python-sdk/commit/d517cbce5d74b7cd92d8921d16ba1bb025848549))
28
+ * **api:** api update ([fa9f582](https://github.com/supermemoryai/python-sdk/commit/fa9f582226ed9dee9ea8196b78b9312938093465))
29
+ * **api:** api update ([d1b2a97](https://github.com/supermemoryai/python-sdk/commit/d1b2a9719deb080c4b64ae97893ba139ecaebf68))
30
+ * **api:** api update ([02180e2](https://github.com/supermemoryai/python-sdk/commit/02180e296f97a30626b183ba533f45879981cc62))
31
+ * **api:** api update ([51586e6](https://github.com/supermemoryai/python-sdk/commit/51586e68f9ec7b04b7aba149142f6e550113c0b9))
32
+ * **api:** api update ([cd4782d](https://github.com/supermemoryai/python-sdk/commit/cd4782de2b4f05196e6b3f37768de900a6a9e81d))
33
+ * **api:** api update ([f58d93d](https://github.com/supermemoryai/python-sdk/commit/f58d93dc249798bdf62c00335c6b9bfdf8430795))
34
+ * **api:** api update ([e95b77e](https://github.com/supermemoryai/python-sdk/commit/e95b77ee719a76f0eb22c56f07e90f05712de7cd))
35
+ * **api:** api update ([beffc5e](https://github.com/supermemoryai/python-sdk/commit/beffc5e09b5aee9c1517453b2f5574881ecf5dd7))
36
+ * **api:** api update ([173a337](https://github.com/supermemoryai/python-sdk/commit/173a337626cbd75d951d10a04e91261ed3a2a384))
37
+ * **api:** api update ([02e8b00](https://github.com/supermemoryai/python-sdk/commit/02e8b0072cb84a52124f61f5d8f64d69809c7833))
38
+ * **api:** api update ([1788d47](https://github.com/supermemoryai/python-sdk/commit/1788d476d76fd786ed495ee5f8048c301fae0799))
39
+ * **api:** api update ([5bc5a86](https://github.com/supermemoryai/python-sdk/commit/5bc5a8611c00f3c77c1e3787f578c91577ddfbb0))
40
+ * **api:** api update ([0c627bd](https://github.com/supermemoryai/python-sdk/commit/0c627bde6c7f6ef8d55e94993a612f34c75c7f80))
41
+ * **client:** add follow_redirects request option ([abd637d](https://github.com/supermemoryai/python-sdk/commit/abd637db1e3642c0dcc609bf4cac3d0a2bdad061))
42
+ * **client:** add support for aiohttp ([d376719](https://github.com/supermemoryai/python-sdk/commit/d37671920ac604d643c0d9edaaee08aaaea2d881))
43
+
44
+
45
+ ### Bug Fixes
46
+
47
+ * **client:** correctly parse binary response | stream ([b236e85](https://github.com/supermemoryai/python-sdk/commit/b236e8552e9393048b3541c2c41d969fd5a88ac0))
48
+ * **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([f9bf3c1](https://github.com/supermemoryai/python-sdk/commit/f9bf3c135c6a6236c8ef0ee5d538843021448b9d))
49
+
50
+
51
+ ### Chores
52
+
53
+ * **ci:** enable for pull requests ([ec1b12b](https://github.com/supermemoryai/python-sdk/commit/ec1b12b9447ff582d80a0dedf75dc5c924aee6e4))
54
+ * **docs:** grammar improvements ([1f9f018](https://github.com/supermemoryai/python-sdk/commit/1f9f01876a2754521ab8cc75c92634b05221f6c5))
55
+ * **docs:** remove reference to rye shell ([23840c8](https://github.com/supermemoryai/python-sdk/commit/23840c8b8a67cb3b60e94c1eb74994d28b3508f1))
56
+ * **internal:** codegen related update ([2b10aa8](https://github.com/supermemoryai/python-sdk/commit/2b10aa88d82e044d1a7df2bdd266209f4c130c8d))
57
+ * **internal:** codegen related update ([c4039a7](https://github.com/supermemoryai/python-sdk/commit/c4039a7d5124d2c6719508830bf8067ebbb4fd58))
58
+ * **internal:** update conftest.py ([355810b](https://github.com/supermemoryai/python-sdk/commit/355810b458222ddf405ec130cf43887cf7b2138d))
59
+ * **readme:** update badges ([9415b50](https://github.com/supermemoryai/python-sdk/commit/9415b50222cea2e827a8e9c13525ad8e19df9ff2))
60
+ * **tests:** add tests for httpx client instantiation & proxies ([a462f22](https://github.com/supermemoryai/python-sdk/commit/a462f2240dac23bf780f540ba39da3febbc561e7))
61
+ * **tests:** run tests in parallel ([79f6359](https://github.com/supermemoryai/python-sdk/commit/79f6359beb267f85e273a5a3017283d9e231e78a))
62
+ * **tests:** skip some failing tests on the latest python versions ([394e639](https://github.com/supermemoryai/python-sdk/commit/394e639fb904cd4c27b299f5960fd2f02f159b10))
63
+
64
+
65
+ ### Documentation
66
+
67
+ * **client:** fix httpx.Timeout documentation reference ([be3ccbd](https://github.com/supermemoryai/python-sdk/commit/be3ccbdebe4974592c670cb43ed572ced78e60a3))
68
+
3
69
  ## 3.0.0-alpha.1 (2025-05-17)
4
70
 
5
71
  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
- $ rye shell
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.0a1
3
+ Version: 3.0.0a19
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
- [![PyPI version](https://img.shields.io/pypi/v/supermemory.svg)](https://pypi.org/project/supermemory/)
37
+ [![PyPI version](https://github.com/supermemoryai/python-sdk/tree/main/<https://img.shields.io/pypi/v/supermemory.svg?label=pypi%20(stable)>)](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.search.execute(
66
- q="documents related to python",
68
+ response = client.memories.add(
69
+ content="This is a detailed article about machine learning concepts...",
67
70
  )
68
- print(response.results)
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.search.execute(
92
- q="documents related to python",
94
+ response = await client.memories.add(
95
+ content="This is a detailed article about machine learning concepts...",
93
96
  )
94
- print(response.results)
97
+ print(response.id)
95
98
 
96
99
 
97
100
  asyncio.run(main())
@@ -99,6 +102,40 @@ asyncio.run(main())
99
102
 
100
103
  Functionality between the synchronous and asynchronous clients is otherwise identical.
101
104
 
105
+ ### With aiohttp
106
+
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
+
109
+ You can enable this by installing `aiohttp`:
110
+
111
+ ```sh
112
+ # install from PyPI
113
+ pip install --pre supermemory[aiohttp]
114
+ ```
115
+
116
+ Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
117
+
118
+ ```python
119
+ import os
120
+ import asyncio
121
+ from supermemory import DefaultAioHttpClient
122
+ from supermemory import AsyncSupermemory
123
+
124
+
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())
137
+ ```
138
+
102
139
  ## Using types
103
140
 
104
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:
@@ -194,7 +231,7 @@ client.with_options(max_retries=5).memories.add(
194
231
  ### Timeouts
195
232
 
196
233
  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:
234
+ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
198
235
 
199
236
  ```python
200
237
  from supermemory import Supermemory
@@ -1,6 +1,6 @@
1
1
  # Supermemory Python API library
2
2
 
3
- [![PyPI version](https://img.shields.io/pypi/v/supermemory.svg)](https://pypi.org/project/supermemory/)
3
+ [![PyPI version](<https://img.shields.io/pypi/v/supermemory.svg?label=pypi%20(stable)>)](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.search.execute(
35
- q="documents related to python",
34
+ response = client.memories.add(
35
+ content="This is a detailed article about machine learning concepts...",
36
36
  )
37
- print(response.results)
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.search.execute(
61
- q="documents related to python",
60
+ response = await client.memories.add(
61
+ content="This is a detailed article about machine learning concepts...",
62
62
  )
63
- print(response.results)
63
+ print(response.id)
64
64
 
65
65
 
66
66
  asyncio.run(main())
@@ -68,6 +68,40 @@ asyncio.run(main())
68
68
 
69
69
  Functionality between the synchronous and asynchronous clients is otherwise identical.
70
70
 
71
+ ### With aiohttp
72
+
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.
74
+
75
+ You can enable this by installing `aiohttp`:
76
+
77
+ ```sh
78
+ # install from PyPI
79
+ pip install --pre supermemory[aiohttp]
80
+ ```
81
+
82
+ Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
83
+
84
+ ```python
85
+ import os
86
+ import asyncio
87
+ from supermemory import DefaultAioHttpClient
88
+ from supermemory import AsyncSupermemory
89
+
90
+
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())
103
+ ```
104
+
71
105
  ## Using types
72
106
 
73
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:
@@ -163,7 +197,7 @@ client.with_options(max_retries=5).memories.add(
163
197
  ### Timeouts
164
198
 
165
199
  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:
200
+ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
167
201
 
168
202
  ```python
169
203
  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
 
@@ -5,8 +5,6 @@ Types:
5
5
  ```python
6
6
  from supermemory.types import (
7
7
  MemoryUpdateResponse,
8
- MemoryListResponse,
9
- MemoryDeleteResponse,
10
8
  MemoryAddResponse,
11
9
  MemoryGetResponse,
12
10
  MemoryUploadFileResponse,
@@ -16,24 +14,11 @@ from supermemory.types import (
16
14
  Methods:
17
15
 
18
16
  - <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="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>
17
+ - <code title="delete /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">delete</a>(id) -> None</code>
21
18
  - <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
19
  - <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
20
  - <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
21
 
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
-
37
22
  # Settings
38
23
 
39
24
  Types:
@@ -52,15 +37,10 @@ Methods:
52
37
  Types:
53
38
 
54
39
  ```python
55
- from supermemory.types import (
56
- ConnectionCreateResponse,
57
- ConnectionListResponse,
58
- ConnectionGetResponse,
59
- )
40
+ from supermemory.types import ConnectionCreateResponse, ConnectionGetResponse
60
41
  ```
61
42
 
62
43
  Methods:
63
44
 
64
45
  - <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
46
  - <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.1"
3
+ version = "3.0.0-alpha.19"
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:
@@ -960,6 +960,9 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
960
960
  if self.custom_auth is not None:
961
961
  kwargs["auth"] = self.custom_auth
962
962
 
963
+ if options.follow_redirects is not None:
964
+ kwargs["follow_redirects"] = options.follow_redirects
965
+
963
966
  log.debug("Sending HTTP Request: %s %s", request.method, request.url)
964
967
 
965
968
  response = None
@@ -1068,7 +1071,14 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1068
1071
  ) -> ResponseT:
1069
1072
  origin = get_origin(cast_to) or cast_to
1070
1073
 
1071
- if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse):
1074
+ if (
1075
+ inspect.isclass(origin)
1076
+ and issubclass(origin, BaseAPIResponse)
1077
+ # we only want to actually return the custom BaseAPIResponse class if we're
1078
+ # returning the raw response, or if we're not streaming SSE, as if we're streaming
1079
+ # SSE then `cast_to` doesn't actively reflect the type we need to parse into
1080
+ and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER)))
1081
+ ):
1072
1082
  if not issubclass(origin, APIResponse):
1073
1083
  raise TypeError(f"API Response types must subclass {APIResponse}; Received {origin}")
1074
1084
 
@@ -1279,6 +1289,24 @@ class _DefaultAsyncHttpxClient(httpx.AsyncClient):
1279
1289
  super().__init__(**kwargs)
1280
1290
 
1281
1291
 
1292
+ try:
1293
+ import httpx_aiohttp
1294
+ except ImportError:
1295
+
1296
+ class _DefaultAioHttpClient(httpx.AsyncClient):
1297
+ def __init__(self, **_kwargs: Any) -> None:
1298
+ raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra")
1299
+ else:
1300
+
1301
+ class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
1302
+ def __init__(self, **kwargs: Any) -> None:
1303
+ kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
1304
+ kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
1305
+ kwargs.setdefault("follow_redirects", True)
1306
+
1307
+ super().__init__(**kwargs)
1308
+
1309
+
1282
1310
  if TYPE_CHECKING:
1283
1311
  DefaultAsyncHttpxClient = httpx.AsyncClient
1284
1312
  """An alias to `httpx.AsyncClient` that provides the same defaults that this SDK
@@ -1287,8 +1315,12 @@ if TYPE_CHECKING:
1287
1315
  This is useful because overriding the `http_client` with your own instance of
1288
1316
  `httpx.AsyncClient` will result in httpx's defaults being used, not ours.
1289
1317
  """
1318
+
1319
+ DefaultAioHttpClient = httpx.AsyncClient
1320
+ """An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`."""
1290
1321
  else:
1291
1322
  DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient
1323
+ DefaultAioHttpClient = _DefaultAioHttpClient
1292
1324
 
1293
1325
 
1294
1326
  class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):
@@ -1460,6 +1492,9 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1460
1492
  if self.custom_auth is not None:
1461
1493
  kwargs["auth"] = self.custom_auth
1462
1494
 
1495
+ if options.follow_redirects is not None:
1496
+ kwargs["follow_redirects"] = options.follow_redirects
1497
+
1463
1498
  log.debug("Sending HTTP Request: %s %s", request.method, request.url)
1464
1499
 
1465
1500
  response = None
@@ -1568,7 +1603,14 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1568
1603
  ) -> ResponseT:
1569
1604
  origin = get_origin(cast_to) or cast_to
1570
1605
 
1571
- if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse):
1606
+ if (
1607
+ inspect.isclass(origin)
1608
+ and issubclass(origin, BaseAPIResponse)
1609
+ # we only want to actually return the custom BaseAPIResponse class if we're
1610
+ # returning the raw response, or if we're not streaming SSE, as if we're streaming
1611
+ # SSE then `cast_to` doesn't actively reflect the type we need to parse into
1612
+ and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER)))
1613
+ ):
1572
1614
  if not issubclass(origin, AsyncAPIResponse):
1573
1615
  raise TypeError(f"API Response types must subclass {AsyncAPIResponse}; Received {origin}")
1574
1616