supermemory 3.0.0a19__tar.gz → 3.0.0a20__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.0a20/.release-please-manifest.json +3 -0
- supermemory-3.0.0a20/CHANGELOG.md +21 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/CONTRIBUTING.md +1 -1
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/PKG-INFO +32 -49
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/README.md +31 -48
- supermemory-3.0.0a20/api.md +70 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/bin/check-release-environment +1 -1
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/mypy.ini +1 -1
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/pyproject.toml +5 -5
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/release-please-config.json +1 -1
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/__init__.py +2 -2
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_base_client.py +1 -1
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_client.py +11 -3
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_files.py +1 -1
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_response.py +4 -4
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_types.py +1 -1
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_utils/_logs.py +2 -2
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_utils/_resources_proxy.py +4 -4
- supermemory-3.0.0a20/src/supermemory_new/_version.py +4 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/resources/__init__.py +14 -0
- supermemory-3.0.0a20/src/supermemory_new/resources/connections.py +728 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/resources/memories.py +138 -95
- supermemory-3.0.0a20/src/supermemory_new/resources/search.py +300 -0
- supermemory-3.0.0a20/src/supermemory_new/types/__init__.py +30 -0
- supermemory-3.0.0a20/src/supermemory_new/types/connection_delete_by_provider_params.py +15 -0
- supermemory-3.0.0a19/src/supermemory/types/memory_upload_file_response.py → supermemory-3.0.0a20/src/supermemory_new/types/connection_delete_by_provider_response.py +3 -3
- supermemory-3.0.0a19/src/supermemory/types/connection_get_response.py → supermemory-3.0.0a20/src/supermemory_new/types/connection_get_by_id_response.py +2 -2
- supermemory-3.0.0a20/src/supermemory_new/types/connection_get_by_tags_params.py +15 -0
- supermemory-3.0.0a20/src/supermemory_new/types/connection_get_by_tags_response.py +25 -0
- supermemory-3.0.0a20/src/supermemory_new/types/connection_import_params.py +15 -0
- supermemory-3.0.0a20/src/supermemory_new/types/connection_list_documents_params.py +15 -0
- supermemory-3.0.0a20/src/supermemory_new/types/connection_list_documents_response.py +29 -0
- supermemory-3.0.0a20/src/supermemory_new/types/connection_list_params.py +15 -0
- supermemory-3.0.0a20/src/supermemory_new/types/connection_list_response.py +29 -0
- supermemory-3.0.0a20/src/supermemory_new/types/memory_list_params.py +34 -0
- supermemory-3.0.0a20/src/supermemory_new/types/memory_list_response.py +91 -0
- supermemory-3.0.0a20/src/supermemory_new/types/search_execute_params.py +93 -0
- supermemory-3.0.0a20/src/supermemory_new/types/search_execute_response.py +55 -0
- supermemory-3.0.0a20/tests/api_resources/test_connections.py +599 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/api_resources/test_memories.py +97 -83
- supermemory-3.0.0a20/tests/api_resources/test_search.py +164 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/api_resources/test_settings.py +2 -2
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/conftest.py +3 -3
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/test_client.py +23 -23
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/test_deepcopy.py +1 -1
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/test_extract_files.py +2 -2
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/test_files.py +1 -1
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/test_models.py +3 -3
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/test_qs.py +1 -1
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/test_required_args.py +1 -1
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/test_response.py +7 -7
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/test_streaming.py +2 -2
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/test_transform.py +4 -4
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/test_utils/test_proxy.py +1 -1
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/test_utils/test_typing.py +1 -1
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/utils.py +4 -4
- supermemory-3.0.0a19/.release-please-manifest.json +0 -3
- supermemory-3.0.0a19/CHANGELOG.md +0 -152
- supermemory-3.0.0a19/api.md +0 -46
- supermemory-3.0.0a19/src/supermemory/_version.py +0 -4
- supermemory-3.0.0a19/src/supermemory/resources/connections.py +0 -273
- supermemory-3.0.0a19/src/supermemory/types/__init__.py +0 -17
- supermemory-3.0.0a19/src/supermemory/types/memory_upload_file_params.py +0 -13
- supermemory-3.0.0a19/tests/api_resources/test_connections.py +0 -200
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/.gitignore +0 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/LICENSE +0 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/SECURITY.md +0 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/bin/publish-pypi +0 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/examples/.keep +0 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/noxfile.py +0 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/requirements-dev.lock +0 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/requirements.lock +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_compat.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_constants.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_exceptions.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_models.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_qs.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_resource.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_streaming.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_utils/__init__.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_utils/_proxy.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_utils/_reflection.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_utils/_streams.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_utils/_sync.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_utils/_transform.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_utils/_typing.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_utils/_utils.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/lib/.keep +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/py.typed +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/resources/settings.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/types/connection_create_params.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/types/connection_create_response.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/types/memory_add_params.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/types/memory_add_response.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/types/memory_get_response.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/types/memory_update_params.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/types/memory_update_response.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/types/setting_get_response.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/types/setting_update_params.py +0 -0
- {supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/types/setting_update_response.py +0 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/__init__.py +0 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/api_resources/__init__.py +0 -0
- {supermemory-3.0.0a19 → supermemory-3.0.0a20}/tests/sample_file.txt +0 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 3.0.0-alpha.20 (2025-06-27)
|
4
|
+
|
5
|
+
Full Changelog: [v3.0.0-alpha.19...v3.0.0-alpha.20](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.19...v3.0.0-alpha.20)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* **api:** api update ([3c35763](https://github.com/supermemoryai/python-sdk/commit/3c357637aab2e68e3a80e33b9f721c3a8182483a))
|
10
|
+
* **api:** api update ([08ffef9](https://github.com/supermemoryai/python-sdk/commit/08ffef95b8f7be8ce8a57ba2fe2761653cd42e5d))
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* **ci:** release-doctor — report correct token name ([dadfa9f](https://github.com/supermemoryai/python-sdk/commit/dadfa9f74851fc81e5af92e47c41115bee87aad7))
|
16
|
+
|
17
|
+
|
18
|
+
### Chores
|
19
|
+
|
20
|
+
* sync repo ([380252a](https://github.com/supermemoryai/python-sdk/commit/380252a9cb2d9c723b5c6b36a33573c462e48049))
|
21
|
+
* update SDK settings ([8c6f297](https://github.com/supermemoryai/python-sdk/commit/8c6f297fc2b8f7a6b600205a5c313767a99612cb))
|
@@ -36,7 +36,7 @@ $ pip install -r requirements-dev.lock
|
|
36
36
|
|
37
37
|
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
|
38
38
|
result in merge conflicts between manual patches and changes from the generator. The generator will never
|
39
|
-
modify the contents of the `src/
|
39
|
+
modify the contents of the `src/supermemory_new/lib/` and `examples/` directories.
|
40
40
|
|
41
41
|
## Adding and running examples
|
42
42
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: supermemory
|
3
|
-
Version: 3.0.
|
3
|
+
Version: 3.0.0a20
|
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
|
@@ -44,7 +44,7 @@ It is generated with [Stainless](https://www.stainless.com/).
|
|
44
44
|
|
45
45
|
## Documentation
|
46
46
|
|
47
|
-
The REST API documentation can be found on [docs.supermemory.
|
47
|
+
The REST API documentation can be found on [docs.supermemory.ai](https://docs.supermemory.ai). The full API of this library can be found in [api.md](https://github.com/supermemoryai/python-sdk/tree/main/api.md).
|
48
48
|
|
49
49
|
## Installation
|
50
50
|
|
@@ -59,16 +59,16 @@ The full API of this library can be found in [api.md](https://github.com/superme
|
|
59
59
|
|
60
60
|
```python
|
61
61
|
import os
|
62
|
-
from
|
62
|
+
from supermemory_new import Supermemory
|
63
63
|
|
64
64
|
client = Supermemory(
|
65
65
|
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
66
66
|
)
|
67
67
|
|
68
|
-
response = client.
|
69
|
-
|
68
|
+
response = client.search.execute(
|
69
|
+
q="documents related to python",
|
70
70
|
)
|
71
|
-
print(response.
|
71
|
+
print(response.results)
|
72
72
|
```
|
73
73
|
|
74
74
|
While you can provide an `api_key` keyword argument,
|
@@ -83,7 +83,7 @@ Simply import `AsyncSupermemory` instead of `Supermemory` and use `await` with e
|
|
83
83
|
```python
|
84
84
|
import os
|
85
85
|
import asyncio
|
86
|
-
from
|
86
|
+
from supermemory_new import AsyncSupermemory
|
87
87
|
|
88
88
|
client = AsyncSupermemory(
|
89
89
|
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
@@ -91,10 +91,10 @@ client = AsyncSupermemory(
|
|
91
91
|
|
92
92
|
|
93
93
|
async def main() -> None:
|
94
|
-
response = await client.
|
95
|
-
|
94
|
+
response = await client.search.execute(
|
95
|
+
q="documents related to python",
|
96
96
|
)
|
97
|
-
print(response.
|
97
|
+
print(response.results)
|
98
98
|
|
99
99
|
|
100
100
|
asyncio.run(main())
|
@@ -118,8 +118,8 @@ Then you can enable it by instantiating the client with `http_client=DefaultAioH
|
|
118
118
|
```python
|
119
119
|
import os
|
120
120
|
import asyncio
|
121
|
-
from
|
122
|
-
from
|
121
|
+
from supermemory_new import DefaultAioHttpClient
|
122
|
+
from supermemory_new import AsyncSupermemory
|
123
123
|
|
124
124
|
|
125
125
|
async def main() -> None:
|
@@ -127,10 +127,10 @@ async def main() -> None:
|
|
127
127
|
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
128
128
|
http_client=DefaultAioHttpClient(),
|
129
129
|
) as client:
|
130
|
-
response = await client.
|
131
|
-
|
130
|
+
response = await client.search.execute(
|
131
|
+
q="documents related to python",
|
132
132
|
)
|
133
|
-
print(response.
|
133
|
+
print(response.results)
|
134
134
|
|
135
135
|
|
136
136
|
asyncio.run(main())
|
@@ -145,35 +145,18 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
|
|
145
145
|
|
146
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`.
|
147
147
|
|
148
|
-
## File uploads
|
149
|
-
|
150
|
-
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)`.
|
151
|
-
|
152
|
-
```python
|
153
|
-
from pathlib import Path
|
154
|
-
from supermemory import Supermemory
|
155
|
-
|
156
|
-
client = Supermemory()
|
157
|
-
|
158
|
-
client.memories.upload_file(
|
159
|
-
file=Path("/path/to/file"),
|
160
|
-
)
|
161
|
-
```
|
162
|
-
|
163
|
-
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.
|
164
|
-
|
165
148
|
## Handling errors
|
166
149
|
|
167
|
-
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `
|
150
|
+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `supermemory_new.APIConnectionError` is raised.
|
168
151
|
|
169
152
|
When the API returns a non-success status code (that is, 4xx or 5xx
|
170
|
-
response), a subclass of `
|
153
|
+
response), a subclass of `supermemory_new.APIStatusError` is raised, containing `status_code` and `response` properties.
|
171
154
|
|
172
|
-
All errors inherit from `
|
155
|
+
All errors inherit from `supermemory_new.APIError`.
|
173
156
|
|
174
157
|
```python
|
175
|
-
import
|
176
|
-
from
|
158
|
+
import supermemory_new
|
159
|
+
from supermemory_new import Supermemory
|
177
160
|
|
178
161
|
client = Supermemory()
|
179
162
|
|
@@ -181,12 +164,12 @@ try:
|
|
181
164
|
client.memories.add(
|
182
165
|
content="This is a detailed article about machine learning concepts...",
|
183
166
|
)
|
184
|
-
except
|
167
|
+
except supermemory_new.APIConnectionError as e:
|
185
168
|
print("The server could not be reached")
|
186
169
|
print(e.__cause__) # an underlying Exception, likely raised within httpx.
|
187
|
-
except
|
170
|
+
except supermemory_new.RateLimitError as e:
|
188
171
|
print("A 429 status code was received; we should back off a bit.")
|
189
|
-
except
|
172
|
+
except supermemory_new.APIStatusError as e:
|
190
173
|
print("Another non-200-range status code was received")
|
191
174
|
print(e.status_code)
|
192
175
|
print(e.response)
|
@@ -214,7 +197,7 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
|
|
214
197
|
You can use the `max_retries` option to configure or disable retry settings:
|
215
198
|
|
216
199
|
```python
|
217
|
-
from
|
200
|
+
from supermemory_new import Supermemory
|
218
201
|
|
219
202
|
# Configure the default for all requests:
|
220
203
|
client = Supermemory(
|
@@ -234,7 +217,7 @@ By default requests time out after 1 minute. You can configure this with a `time
|
|
234
217
|
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
235
218
|
|
236
219
|
```python
|
237
|
-
from
|
220
|
+
from supermemory_new import Supermemory
|
238
221
|
|
239
222
|
# Configure the default for all requests:
|
240
223
|
client = Supermemory(
|
@@ -288,7 +271,7 @@ if response.my_field is None:
|
|
288
271
|
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
|
289
272
|
|
290
273
|
```py
|
291
|
-
from
|
274
|
+
from supermemory_new import Supermemory
|
292
275
|
|
293
276
|
client = Supermemory()
|
294
277
|
response = client.memories.with_raw_response.add(
|
@@ -300,9 +283,9 @@ memory = response.parse() # get the object that `memories.add()` would have ret
|
|
300
283
|
print(memory.id)
|
301
284
|
```
|
302
285
|
|
303
|
-
These methods return an [`APIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/
|
286
|
+
These methods return an [`APIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory_new/_response.py) object.
|
304
287
|
|
305
|
-
The async client returns an [`AsyncAPIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/
|
288
|
+
The async client returns an [`AsyncAPIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory_new/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
|
306
289
|
|
307
290
|
#### `.with_streaming_response`
|
308
291
|
|
@@ -366,7 +349,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
|
|
366
349
|
|
367
350
|
```python
|
368
351
|
import httpx
|
369
|
-
from
|
352
|
+
from supermemory_new import Supermemory, DefaultHttpxClient
|
370
353
|
|
371
354
|
client = Supermemory(
|
372
355
|
# Or use the `SUPERMEMORY_BASE_URL` env var
|
@@ -389,7 +372,7 @@ client.with_options(http_client=DefaultHttpxClient(...))
|
|
389
372
|
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
|
390
373
|
|
391
374
|
```py
|
392
|
-
from
|
375
|
+
from supermemory_new import Supermemory
|
393
376
|
|
394
377
|
with Supermemory() as client:
|
395
378
|
# make requests here
|
@@ -417,8 +400,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
|
|
417
400
|
You can determine the version that is being used at runtime with:
|
418
401
|
|
419
402
|
```py
|
420
|
-
import
|
421
|
-
print(
|
403
|
+
import supermemory_new
|
404
|
+
print(supermemory_new.__version__)
|
422
405
|
```
|
423
406
|
|
424
407
|
## Requirements
|
@@ -10,7 +10,7 @@ It is generated with [Stainless](https://www.stainless.com/).
|
|
10
10
|
|
11
11
|
## Documentation
|
12
12
|
|
13
|
-
The REST API documentation can be found on [docs.supermemory.
|
13
|
+
The REST API documentation can be found on [docs.supermemory.ai](https://docs.supermemory.ai). The full API of this library can be found in [api.md](api.md).
|
14
14
|
|
15
15
|
## Installation
|
16
16
|
|
@@ -25,16 +25,16 @@ The full API of this library can be found in [api.md](api.md).
|
|
25
25
|
|
26
26
|
```python
|
27
27
|
import os
|
28
|
-
from
|
28
|
+
from supermemory_new import Supermemory
|
29
29
|
|
30
30
|
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.search.execute(
|
35
|
+
q="documents related to python",
|
36
36
|
)
|
37
|
-
print(response.
|
37
|
+
print(response.results)
|
38
38
|
```
|
39
39
|
|
40
40
|
While you can provide an `api_key` keyword argument,
|
@@ -49,7 +49,7 @@ Simply import `AsyncSupermemory` instead of `Supermemory` and use `await` with e
|
|
49
49
|
```python
|
50
50
|
import os
|
51
51
|
import asyncio
|
52
|
-
from
|
52
|
+
from supermemory_new import AsyncSupermemory
|
53
53
|
|
54
54
|
client = AsyncSupermemory(
|
55
55
|
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
@@ -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.search.execute(
|
61
|
+
q="documents related to python",
|
62
62
|
)
|
63
|
-
print(response.
|
63
|
+
print(response.results)
|
64
64
|
|
65
65
|
|
66
66
|
asyncio.run(main())
|
@@ -84,8 +84,8 @@ Then you can enable it by instantiating the client with `http_client=DefaultAioH
|
|
84
84
|
```python
|
85
85
|
import os
|
86
86
|
import asyncio
|
87
|
-
from
|
88
|
-
from
|
87
|
+
from supermemory_new import DefaultAioHttpClient
|
88
|
+
from supermemory_new import AsyncSupermemory
|
89
89
|
|
90
90
|
|
91
91
|
async def main() -> None:
|
@@ -93,10 +93,10 @@ async def main() -> None:
|
|
93
93
|
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
94
94
|
http_client=DefaultAioHttpClient(),
|
95
95
|
) as client:
|
96
|
-
response = await client.
|
97
|
-
|
96
|
+
response = await client.search.execute(
|
97
|
+
q="documents related to python",
|
98
98
|
)
|
99
|
-
print(response.
|
99
|
+
print(response.results)
|
100
100
|
|
101
101
|
|
102
102
|
asyncio.run(main())
|
@@ -111,35 +111,18 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
|
|
111
111
|
|
112
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`.
|
113
113
|
|
114
|
-
## File uploads
|
115
|
-
|
116
|
-
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)`.
|
117
|
-
|
118
|
-
```python
|
119
|
-
from pathlib import Path
|
120
|
-
from supermemory import Supermemory
|
121
|
-
|
122
|
-
client = Supermemory()
|
123
|
-
|
124
|
-
client.memories.upload_file(
|
125
|
-
file=Path("/path/to/file"),
|
126
|
-
)
|
127
|
-
```
|
128
|
-
|
129
|
-
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.
|
130
|
-
|
131
114
|
## Handling errors
|
132
115
|
|
133
|
-
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `
|
116
|
+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `supermemory_new.APIConnectionError` is raised.
|
134
117
|
|
135
118
|
When the API returns a non-success status code (that is, 4xx or 5xx
|
136
|
-
response), a subclass of `
|
119
|
+
response), a subclass of `supermemory_new.APIStatusError` is raised, containing `status_code` and `response` properties.
|
137
120
|
|
138
|
-
All errors inherit from `
|
121
|
+
All errors inherit from `supermemory_new.APIError`.
|
139
122
|
|
140
123
|
```python
|
141
|
-
import
|
142
|
-
from
|
124
|
+
import supermemory_new
|
125
|
+
from supermemory_new import Supermemory
|
143
126
|
|
144
127
|
client = Supermemory()
|
145
128
|
|
@@ -147,12 +130,12 @@ try:
|
|
147
130
|
client.memories.add(
|
148
131
|
content="This is a detailed article about machine learning concepts...",
|
149
132
|
)
|
150
|
-
except
|
133
|
+
except supermemory_new.APIConnectionError as e:
|
151
134
|
print("The server could not be reached")
|
152
135
|
print(e.__cause__) # an underlying Exception, likely raised within httpx.
|
153
|
-
except
|
136
|
+
except supermemory_new.RateLimitError as e:
|
154
137
|
print("A 429 status code was received; we should back off a bit.")
|
155
|
-
except
|
138
|
+
except supermemory_new.APIStatusError as e:
|
156
139
|
print("Another non-200-range status code was received")
|
157
140
|
print(e.status_code)
|
158
141
|
print(e.response)
|
@@ -180,7 +163,7 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
|
|
180
163
|
You can use the `max_retries` option to configure or disable retry settings:
|
181
164
|
|
182
165
|
```python
|
183
|
-
from
|
166
|
+
from supermemory_new import Supermemory
|
184
167
|
|
185
168
|
# Configure the default for all requests:
|
186
169
|
client = Supermemory(
|
@@ -200,7 +183,7 @@ By default requests time out after 1 minute. You can configure this with a `time
|
|
200
183
|
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
201
184
|
|
202
185
|
```python
|
203
|
-
from
|
186
|
+
from supermemory_new import Supermemory
|
204
187
|
|
205
188
|
# Configure the default for all requests:
|
206
189
|
client = Supermemory(
|
@@ -254,7 +237,7 @@ if response.my_field is None:
|
|
254
237
|
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
|
255
238
|
|
256
239
|
```py
|
257
|
-
from
|
240
|
+
from supermemory_new import Supermemory
|
258
241
|
|
259
242
|
client = Supermemory()
|
260
243
|
response = client.memories.with_raw_response.add(
|
@@ -266,9 +249,9 @@ memory = response.parse() # get the object that `memories.add()` would have ret
|
|
266
249
|
print(memory.id)
|
267
250
|
```
|
268
251
|
|
269
|
-
These methods return an [`APIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/
|
252
|
+
These methods return an [`APIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory_new/_response.py) object.
|
270
253
|
|
271
|
-
The async client returns an [`AsyncAPIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/
|
254
|
+
The async client returns an [`AsyncAPIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory_new/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
|
272
255
|
|
273
256
|
#### `.with_streaming_response`
|
274
257
|
|
@@ -332,7 +315,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
|
|
332
315
|
|
333
316
|
```python
|
334
317
|
import httpx
|
335
|
-
from
|
318
|
+
from supermemory_new import Supermemory, DefaultHttpxClient
|
336
319
|
|
337
320
|
client = Supermemory(
|
338
321
|
# Or use the `SUPERMEMORY_BASE_URL` env var
|
@@ -355,7 +338,7 @@ client.with_options(http_client=DefaultHttpxClient(...))
|
|
355
338
|
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
|
356
339
|
|
357
340
|
```py
|
358
|
-
from
|
341
|
+
from supermemory_new import Supermemory
|
359
342
|
|
360
343
|
with Supermemory() as client:
|
361
344
|
# make requests here
|
@@ -383,8 +366,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
|
|
383
366
|
You can determine the version that is being used at runtime with:
|
384
367
|
|
385
368
|
```py
|
386
|
-
import
|
387
|
-
print(
|
369
|
+
import supermemory_new
|
370
|
+
print(supermemory_new.__version__)
|
388
371
|
```
|
389
372
|
|
390
373
|
## Requirements
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Memories
|
2
|
+
|
3
|
+
Types:
|
4
|
+
|
5
|
+
```python
|
6
|
+
from supermemory_new.types import (
|
7
|
+
MemoryUpdateResponse,
|
8
|
+
MemoryListResponse,
|
9
|
+
MemoryAddResponse,
|
10
|
+
MemoryGetResponse,
|
11
|
+
)
|
12
|
+
```
|
13
|
+
|
14
|
+
Methods:
|
15
|
+
|
16
|
+
- <code title="patch /v3/memories/{id}">client.memories.<a href="./src/supermemory_new/resources/memories.py">update</a>(id, \*\*<a href="src/supermemory_new/types/memory_update_params.py">params</a>) -> <a href="./src/supermemory_new/types/memory_update_response.py">MemoryUpdateResponse</a></code>
|
17
|
+
- <code title="post /v3/memories/list">client.memories.<a href="./src/supermemory_new/resources/memories.py">list</a>(\*\*<a href="src/supermemory_new/types/memory_list_params.py">params</a>) -> <a href="./src/supermemory_new/types/memory_list_response.py">MemoryListResponse</a></code>
|
18
|
+
- <code title="delete /v3/memories/{id}">client.memories.<a href="./src/supermemory_new/resources/memories.py">delete</a>(id) -> None</code>
|
19
|
+
- <code title="post /v3/memories">client.memories.<a href="./src/supermemory_new/resources/memories.py">add</a>(\*\*<a href="src/supermemory_new/types/memory_add_params.py">params</a>) -> <a href="./src/supermemory_new/types/memory_add_response.py">MemoryAddResponse</a></code>
|
20
|
+
- <code title="get /v3/memories/{id}">client.memories.<a href="./src/supermemory_new/resources/memories.py">get</a>(id) -> <a href="./src/supermemory_new/types/memory_get_response.py">MemoryGetResponse</a></code>
|
21
|
+
|
22
|
+
# Search
|
23
|
+
|
24
|
+
Types:
|
25
|
+
|
26
|
+
```python
|
27
|
+
from supermemory_new.types import SearchExecuteResponse
|
28
|
+
```
|
29
|
+
|
30
|
+
Methods:
|
31
|
+
|
32
|
+
- <code title="post /v3/search">client.search.<a href="./src/supermemory_new/resources/search.py">execute</a>(\*\*<a href="src/supermemory_new/types/search_execute_params.py">params</a>) -> <a href="./src/supermemory_new/types/search_execute_response.py">SearchExecuteResponse</a></code>
|
33
|
+
|
34
|
+
# Settings
|
35
|
+
|
36
|
+
Types:
|
37
|
+
|
38
|
+
```python
|
39
|
+
from supermemory_new.types import SettingUpdateResponse, SettingGetResponse
|
40
|
+
```
|
41
|
+
|
42
|
+
Methods:
|
43
|
+
|
44
|
+
- <code title="patch /v3/settings">client.settings.<a href="./src/supermemory_new/resources/settings.py">update</a>(\*\*<a href="src/supermemory_new/types/setting_update_params.py">params</a>) -> <a href="./src/supermemory_new/types/setting_update_response.py">SettingUpdateResponse</a></code>
|
45
|
+
- <code title="get /v3/settings">client.settings.<a href="./src/supermemory_new/resources/settings.py">get</a>() -> <a href="./src/supermemory_new/types/setting_get_response.py">SettingGetResponse</a></code>
|
46
|
+
|
47
|
+
# Connections
|
48
|
+
|
49
|
+
Types:
|
50
|
+
|
51
|
+
```python
|
52
|
+
from supermemory_new.types import (
|
53
|
+
ConnectionCreateResponse,
|
54
|
+
ConnectionListResponse,
|
55
|
+
ConnectionDeleteByProviderResponse,
|
56
|
+
ConnectionGetByIDResponse,
|
57
|
+
ConnectionGetByTagsResponse,
|
58
|
+
ConnectionListDocumentsResponse,
|
59
|
+
)
|
60
|
+
```
|
61
|
+
|
62
|
+
Methods:
|
63
|
+
|
64
|
+
- <code title="post /v3/connections/{provider}">client.connections.<a href="./src/supermemory_new/resources/connections.py">create</a>(provider, \*\*<a href="src/supermemory_new/types/connection_create_params.py">params</a>) -> <a href="./src/supermemory_new/types/connection_create_response.py">ConnectionCreateResponse</a></code>
|
65
|
+
- <code title="post /v3/connections/list">client.connections.<a href="./src/supermemory_new/resources/connections.py">list</a>(\*\*<a href="src/supermemory_new/types/connection_list_params.py">params</a>) -> <a href="./src/supermemory_new/types/connection_list_response.py">ConnectionListResponse</a></code>
|
66
|
+
- <code title="delete /v3/connections/{provider}">client.connections.<a href="./src/supermemory_new/resources/connections.py">delete_by_provider</a>(provider, \*\*<a href="src/supermemory_new/types/connection_delete_by_provider_params.py">params</a>) -> <a href="./src/supermemory_new/types/connection_delete_by_provider_response.py">ConnectionDeleteByProviderResponse</a></code>
|
67
|
+
- <code title="get /v3/connections/{connectionId}">client.connections.<a href="./src/supermemory_new/resources/connections.py">get_by_id</a>(connection_id) -> <a href="./src/supermemory_new/types/connection_get_by_id_response.py">ConnectionGetByIDResponse</a></code>
|
68
|
+
- <code title="post /v3/connections/{provider}/connection">client.connections.<a href="./src/supermemory_new/resources/connections.py">get_by_tags</a>(provider, \*\*<a href="src/supermemory_new/types/connection_get_by_tags_params.py">params</a>) -> <a href="./src/supermemory_new/types/connection_get_by_tags_response.py">ConnectionGetByTagsResponse</a></code>
|
69
|
+
- <code title="post /v3/connections/{provider}/import">client.connections.<a href="./src/supermemory_new/resources/connections.py">import\_</a>(provider, \*\*<a href="src/supermemory_new/types/connection_import_params.py">params</a>) -> None</code>
|
70
|
+
- <code title="post /v3/connections/{provider}/documents">client.connections.<a href="./src/supermemory_new/resources/connections.py">list_documents</a>(provider, \*\*<a href="src/supermemory_new/types/connection_list_documents_params.py">params</a>) -> <a href="./src/supermemory_new/types/connection_list_documents_response.py">ConnectionListDocumentsResponse</a></code>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
errors=()
|
4
4
|
|
5
5
|
if [ -z "${PYPI_TOKEN}" ]; then
|
6
|
-
errors+=("The
|
6
|
+
errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
|
7
7
|
fi
|
8
8
|
|
9
9
|
lenErrors=${#errors[@]}
|
@@ -8,7 +8,7 @@ show_error_codes = True
|
|
8
8
|
#
|
9
9
|
# We also exclude our `tests` as mypy doesn't always infer
|
10
10
|
# types correctly and Pyright will still catch any type errors.
|
11
|
-
exclude = ^(src/
|
11
|
+
exclude = ^(src/supermemory_new/_files\.py|_dev/.*\.py|tests/.*)$
|
12
12
|
|
13
13
|
strict_equality = True
|
14
14
|
implicit_reexport = True
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "supermemory"
|
3
|
-
version = "3.0.0-alpha.
|
3
|
+
version = "3.0.0-alpha.20"
|
4
4
|
description = "The official Python library for the supermemory API"
|
5
5
|
dynamic = ["readme"]
|
6
6
|
license = "Apache-2.0"
|
@@ -78,14 +78,14 @@ format = { chain = [
|
|
78
78
|
"check:ruff" = "ruff check ."
|
79
79
|
"fix:ruff" = "ruff check --fix ."
|
80
80
|
|
81
|
-
"check:importable" = "python -c 'import
|
81
|
+
"check:importable" = "python -c 'import supermemory_new'"
|
82
82
|
|
83
83
|
typecheck = { chain = [
|
84
84
|
"typecheck:pyright",
|
85
85
|
"typecheck:mypy"
|
86
86
|
]}
|
87
87
|
"typecheck:pyright" = "pyright"
|
88
|
-
"typecheck:verify-types" = "pyright --verifytypes
|
88
|
+
"typecheck:verify-types" = "pyright --verifytypes supermemory_new --ignoreexternal"
|
89
89
|
"typecheck:mypy" = "mypy ."
|
90
90
|
|
91
91
|
[build-system]
|
@@ -98,7 +98,7 @@ include = [
|
|
98
98
|
]
|
99
99
|
|
100
100
|
[tool.hatch.build.targets.wheel]
|
101
|
-
packages = ["src/
|
101
|
+
packages = ["src/supermemory_new"]
|
102
102
|
|
103
103
|
[tool.hatch.build.targets.sdist]
|
104
104
|
# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc)
|
@@ -201,7 +201,7 @@ length-sort = true
|
|
201
201
|
length-sort-straight = true
|
202
202
|
combine-as-imports = true
|
203
203
|
extra-standard-library = ["typing_extensions"]
|
204
|
-
known-first-party = ["
|
204
|
+
known-first-party = ["supermemory_new", "tests"]
|
205
205
|
|
206
206
|
[tool.ruff.lint.per-file-ignores]
|
207
207
|
"bin/**.py" = ["T201", "T203"]
|
{supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/__init__.py
RENAMED
@@ -89,12 +89,12 @@ _setup_logging()
|
|
89
89
|
# Update the __module__ attribute for exported symbols so that
|
90
90
|
# error messages point to this module instead of the module
|
91
91
|
# it was originally defined in, e.g.
|
92
|
-
#
|
92
|
+
# supermemory_new._exceptions.NotFoundError -> supermemory_new.NotFoundError
|
93
93
|
__locals = locals()
|
94
94
|
for __name in __all__:
|
95
95
|
if not __name.startswith("__"):
|
96
96
|
try:
|
97
|
-
__locals[__name].__module__ = "
|
97
|
+
__locals[__name].__module__ = "supermemory_new"
|
98
98
|
except (TypeError, AttributeError):
|
99
99
|
# Some of our exported symbols are builtins which we can't set attributes for.
|
100
100
|
pass
|
{supermemory-3.0.0a19/src/supermemory → supermemory-3.0.0a20/src/supermemory_new}/_base_client.py
RENAMED
@@ -389,7 +389,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
389
389
|
|
390
390
|
if max_retries is None: # pyright: ignore[reportUnnecessaryComparison]
|
391
391
|
raise TypeError(
|
392
|
-
"max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `
|
392
|
+
"max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `supermemory_new.DEFAULT_MAX_RETRIES`"
|
393
393
|
)
|
394
394
|
|
395
395
|
def _enforce_trailing_slash(self, url: URL) -> URL:
|