supermemory 3.0.0a29__tar.gz → 3.0.0a30__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.
Potentially problematic release.
This version of supermemory might be problematic. Click here for more details.
- supermemory-3.0.0a30/.release-please-manifest.json +3 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/CHANGELOG.md +21 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/PKG-INFO +18 -25
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/README.md +17 -24
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/api.md +0 -23
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/pyproject.toml +53 -2
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/requirements-dev.lock +0 -1
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_base_client.py +3 -3
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_client.py +1 -9
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_compat.py +48 -48
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_files.py +1 -1
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_models.py +40 -40
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_types.py +35 -1
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_utils/__init__.py +9 -2
- supermemory-3.0.0a30/src/supermemory/_utils/_compat.py +45 -0
- supermemory-3.0.0a30/src/supermemory/_utils/_datetime_parse.py +136 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_utils/_transform.py +11 -1
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_utils/_typing.py +6 -1
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_utils/_utils.py +0 -1
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_version.py +1 -1
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/resources/__init__.py +0 -14
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/resources/connections.py +14 -14
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/resources/search.py +9 -9
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/__init__.py +0 -9
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_create_params.py +3 -2
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_delete_by_provider_params.py +2 -2
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_get_by_tags_params.py +2 -2
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_import_params.py +2 -2
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_list_documents_params.py +2 -2
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_list_params.py +2 -2
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/search_documents_params.py +3 -2
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/search_execute_params.py +3 -2
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/search_memories_response.py +10 -7
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/test_client.py +34 -67
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/test_models.py +24 -24
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/test_transform.py +8 -8
- supermemory-3.0.0a30/tests/test_utils/test_datetime_parse.py +110 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/utils.py +13 -5
- supermemory-3.0.0a29/.release-please-manifest.json +0 -3
- supermemory-3.0.0a29/mypy.ini +0 -50
- supermemory-3.0.0a29/src/supermemory/resources/memories.py +0 -806
- supermemory-3.0.0a29/src/supermemory/types/memory_add_params.py +0 -53
- supermemory-3.0.0a29/src/supermemory/types/memory_add_response.py +0 -11
- supermemory-3.0.0a29/src/supermemory/types/memory_get_response.py +0 -103
- supermemory-3.0.0a29/src/supermemory/types/memory_list_params.py +0 -40
- supermemory-3.0.0a29/src/supermemory/types/memory_list_response.py +0 -94
- supermemory-3.0.0a29/src/supermemory/types/memory_update_params.py +0 -53
- supermemory-3.0.0a29/src/supermemory/types/memory_update_response.py +0 -11
- supermemory-3.0.0a29/src/supermemory/types/memory_upload_file_params.py +0 -16
- supermemory-3.0.0a29/src/supermemory/types/memory_upload_file_response.py +0 -11
- supermemory-3.0.0a29/tests/api_resources/test_memories.py +0 -586
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/.gitignore +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/CONTRIBUTING.md +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/LICENSE +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/SECURITY.md +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/bin/check-release-environment +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/bin/publish-pypi +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/examples/.keep +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/noxfile.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/release-please-config.json +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/requirements.lock +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/__init__.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_constants.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_exceptions.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_qs.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_resource.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_streaming.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_utils/_logs.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_utils/_proxy.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_utils/_reflection.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_utils/_resources_proxy.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_utils/_streams.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/_utils/_sync.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/lib/.keep +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/py.typed +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/resources/settings.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_create_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_delete_by_id_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_delete_by_provider_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_get_by_id_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_get_by_tags_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_import_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_list_documents_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/connection_list_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/search_documents_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/search_execute_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/search_memories_params.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/setting_get_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/setting_update_params.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory/types/setting_update_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/src/supermemory_new/lib/.keep +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/__init__.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/api_resources/__init__.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/api_resources/test_connections.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/api_resources/test_search.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/api_resources/test_settings.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/conftest.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/sample_file.txt +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/test_deepcopy.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/test_extract_files.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/test_files.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/test_qs.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/test_required_args.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/test_response.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/test_streaming.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/test_utils/test_proxy.py +0 -0
- {supermemory-3.0.0a29 → supermemory-3.0.0a30}/tests/test_utils/test_typing.py +0 -0
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.0.0-alpha.30 (2025-09-15)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v3.0.0-alpha.29...v3.0.0-alpha.30](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.29...v3.0.0-alpha.30)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([b7df28e](https://github.com/supermemoryai/python-sdk/commit/b7df28ec025c70d7b8e1544aa1ef0262c0be8a03))
|
|
10
|
+
* **api:** api update ([54cf9c1](https://github.com/supermemoryai/python-sdk/commit/54cf9c13bf3ff378dd6a19a15c9e343e822ab99a))
|
|
11
|
+
* **api:** api update ([4812077](https://github.com/supermemoryai/python-sdk/commit/48120771b2476f2d2863a1614edc222e863ddde4))
|
|
12
|
+
* **api:** api update ([a4f4259](https://github.com/supermemoryai/python-sdk/commit/a4f425943298762bdfb7f3b0421f8d56d2e1473c))
|
|
13
|
+
* **api:** api update ([8412e4d](https://github.com/supermemoryai/python-sdk/commit/8412e4d06b0225fd3707a55b743c401d87b1c0aa))
|
|
14
|
+
* improve future compat with pydantic v3 ([70ea8b7](https://github.com/supermemoryai/python-sdk/commit/70ea8b7206b2e8db3d86f5a1674e7dd2f7a7e67b))
|
|
15
|
+
* **types:** replace List[str] with SequenceNotStr in params ([f4bfda3](https://github.com/supermemoryai/python-sdk/commit/f4bfda34d40ca947eae6a32ea323dafeddf51484))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Chores
|
|
19
|
+
|
|
20
|
+
* **internal:** add Sequence related utils ([d2b96ed](https://github.com/supermemoryai/python-sdk/commit/d2b96ed43577a3d046ffea7cbc87ba6b877beba7))
|
|
21
|
+
* **internal:** move mypy configurations to `pyproject.toml` file ([31832f5](https://github.com/supermemoryai/python-sdk/commit/31832f5046f7b6384c1bb506680319890e3a5194))
|
|
22
|
+
* **tests:** simplify `get_platform` test ([30d8e46](https://github.com/supermemoryai/python-sdk/commit/30d8e464a5d8ceb5cec41a6197c291962b78b0b5))
|
|
23
|
+
|
|
3
24
|
## 3.0.0-alpha.29 (2025-08-27)
|
|
4
25
|
|
|
5
26
|
Full Changelog: [v3.0.0-alpha.28...v3.0.0-alpha.29](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.28...v3.0.0-alpha.29)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: supermemory
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.0a30
|
|
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
|
|
@@ -162,23 +162,6 @@ response = client.search.memories(
|
|
|
162
162
|
print(response.include)
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
-
## File uploads
|
|
166
|
-
|
|
167
|
-
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)`.
|
|
168
|
-
|
|
169
|
-
```python
|
|
170
|
-
from pathlib import Path
|
|
171
|
-
from supermemory import Supermemory
|
|
172
|
-
|
|
173
|
-
client = Supermemory()
|
|
174
|
-
|
|
175
|
-
client.memories.upload_file(
|
|
176
|
-
file=Path("/path/to/file"),
|
|
177
|
-
)
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
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.
|
|
181
|
-
|
|
182
165
|
## Handling errors
|
|
183
166
|
|
|
184
167
|
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `supermemory.APIConnectionError` is raised.
|
|
@@ -195,7 +178,9 @@ from supermemory import Supermemory
|
|
|
195
178
|
client = Supermemory()
|
|
196
179
|
|
|
197
180
|
try:
|
|
198
|
-
client.
|
|
181
|
+
client.search.documents(
|
|
182
|
+
q="machine learning concepts",
|
|
183
|
+
)
|
|
199
184
|
except supermemory.APIConnectionError as e:
|
|
200
185
|
print("The server could not be reached")
|
|
201
186
|
print(e.__cause__) # an underlying Exception, likely raised within httpx.
|
|
@@ -238,7 +223,9 @@ client = Supermemory(
|
|
|
238
223
|
)
|
|
239
224
|
|
|
240
225
|
# Or, configure per-request:
|
|
241
|
-
client.with_options(max_retries=5).
|
|
226
|
+
client.with_options(max_retries=5).search.documents(
|
|
227
|
+
q="machine learning concepts",
|
|
228
|
+
)
|
|
242
229
|
```
|
|
243
230
|
|
|
244
231
|
### Timeouts
|
|
@@ -261,7 +248,9 @@ client = Supermemory(
|
|
|
261
248
|
)
|
|
262
249
|
|
|
263
250
|
# Override per-request:
|
|
264
|
-
client.with_options(timeout=5.0).
|
|
251
|
+
client.with_options(timeout=5.0).search.documents(
|
|
252
|
+
q="machine learning concepts",
|
|
253
|
+
)
|
|
265
254
|
```
|
|
266
255
|
|
|
267
256
|
On timeout, an `APITimeoutError` is thrown.
|
|
@@ -302,11 +291,13 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
302
291
|
from supermemory import Supermemory
|
|
303
292
|
|
|
304
293
|
client = Supermemory()
|
|
305
|
-
response = client.
|
|
294
|
+
response = client.search.with_raw_response.documents(
|
|
295
|
+
q="machine learning concepts",
|
|
296
|
+
)
|
|
306
297
|
print(response.headers.get('X-My-Header'))
|
|
307
298
|
|
|
308
|
-
|
|
309
|
-
print(
|
|
299
|
+
search = response.parse() # get the object that `search.documents()` would have returned
|
|
300
|
+
print(search.results)
|
|
310
301
|
```
|
|
311
302
|
|
|
312
303
|
These methods return an [`APIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory/_response.py) object.
|
|
@@ -320,7 +311,9 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
320
311
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
|
321
312
|
|
|
322
313
|
```python
|
|
323
|
-
with client.
|
|
314
|
+
with client.search.with_streaming_response.documents(
|
|
315
|
+
q="machine learning concepts",
|
|
316
|
+
) as response:
|
|
324
317
|
print(response.headers.get("X-My-Header"))
|
|
325
318
|
|
|
326
319
|
for line in response.iter_lines():
|
|
@@ -127,23 +127,6 @@ response = client.search.memories(
|
|
|
127
127
|
print(response.include)
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
## File uploads
|
|
131
|
-
|
|
132
|
-
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)`.
|
|
133
|
-
|
|
134
|
-
```python
|
|
135
|
-
from pathlib import Path
|
|
136
|
-
from supermemory import Supermemory
|
|
137
|
-
|
|
138
|
-
client = Supermemory()
|
|
139
|
-
|
|
140
|
-
client.memories.upload_file(
|
|
141
|
-
file=Path("/path/to/file"),
|
|
142
|
-
)
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
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.
|
|
146
|
-
|
|
147
130
|
## Handling errors
|
|
148
131
|
|
|
149
132
|
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `supermemory.APIConnectionError` is raised.
|
|
@@ -160,7 +143,9 @@ from supermemory import Supermemory
|
|
|
160
143
|
client = Supermemory()
|
|
161
144
|
|
|
162
145
|
try:
|
|
163
|
-
client.
|
|
146
|
+
client.search.documents(
|
|
147
|
+
q="machine learning concepts",
|
|
148
|
+
)
|
|
164
149
|
except supermemory.APIConnectionError as e:
|
|
165
150
|
print("The server could not be reached")
|
|
166
151
|
print(e.__cause__) # an underlying Exception, likely raised within httpx.
|
|
@@ -203,7 +188,9 @@ client = Supermemory(
|
|
|
203
188
|
)
|
|
204
189
|
|
|
205
190
|
# Or, configure per-request:
|
|
206
|
-
client.with_options(max_retries=5).
|
|
191
|
+
client.with_options(max_retries=5).search.documents(
|
|
192
|
+
q="machine learning concepts",
|
|
193
|
+
)
|
|
207
194
|
```
|
|
208
195
|
|
|
209
196
|
### Timeouts
|
|
@@ -226,7 +213,9 @@ client = Supermemory(
|
|
|
226
213
|
)
|
|
227
214
|
|
|
228
215
|
# Override per-request:
|
|
229
|
-
client.with_options(timeout=5.0).
|
|
216
|
+
client.with_options(timeout=5.0).search.documents(
|
|
217
|
+
q="machine learning concepts",
|
|
218
|
+
)
|
|
230
219
|
```
|
|
231
220
|
|
|
232
221
|
On timeout, an `APITimeoutError` is thrown.
|
|
@@ -267,11 +256,13 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
267
256
|
from supermemory import Supermemory
|
|
268
257
|
|
|
269
258
|
client = Supermemory()
|
|
270
|
-
response = client.
|
|
259
|
+
response = client.search.with_raw_response.documents(
|
|
260
|
+
q="machine learning concepts",
|
|
261
|
+
)
|
|
271
262
|
print(response.headers.get('X-My-Header'))
|
|
272
263
|
|
|
273
|
-
|
|
274
|
-
print(
|
|
264
|
+
search = response.parse() # get the object that `search.documents()` would have returned
|
|
265
|
+
print(search.results)
|
|
275
266
|
```
|
|
276
267
|
|
|
277
268
|
These methods return an [`APIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory/_response.py) object.
|
|
@@ -285,7 +276,9 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
285
276
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
|
286
277
|
|
|
287
278
|
```python
|
|
288
|
-
with client.
|
|
279
|
+
with client.search.with_streaming_response.documents(
|
|
280
|
+
q="machine learning concepts",
|
|
281
|
+
) as response:
|
|
289
282
|
print(response.headers.get("X-My-Header"))
|
|
290
283
|
|
|
291
284
|
for line in response.iter_lines():
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
# Memories
|
|
2
|
-
|
|
3
|
-
Types:
|
|
4
|
-
|
|
5
|
-
```python
|
|
6
|
-
from supermemory.types import (
|
|
7
|
-
MemoryUpdateResponse,
|
|
8
|
-
MemoryListResponse,
|
|
9
|
-
MemoryAddResponse,
|
|
10
|
-
MemoryGetResponse,
|
|
11
|
-
MemoryUploadFileResponse,
|
|
12
|
-
)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Methods:
|
|
16
|
-
|
|
17
|
-
- <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>
|
|
18
|
-
- <code title="post /v3/memories/list">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>
|
|
19
|
-
- <code title="delete /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">delete</a>(id) -> None</code>
|
|
20
|
-
- <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>
|
|
21
|
-
- <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>
|
|
22
|
-
- <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>
|
|
23
|
-
|
|
24
1
|
# Search
|
|
25
2
|
|
|
26
3
|
Types:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "supermemory"
|
|
3
|
-
version = "3.0.0-alpha.
|
|
3
|
+
version = "3.0.0-alpha.30"
|
|
4
4
|
description = "The official Python library for the supermemory API"
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -56,7 +56,6 @@ dev-dependencies = [
|
|
|
56
56
|
"dirty-equals>=0.6.0",
|
|
57
57
|
"importlib-metadata>=6.7.0",
|
|
58
58
|
"rich>=13.7.1",
|
|
59
|
-
"nest_asyncio==1.6.0",
|
|
60
59
|
"pytest-xdist>=3.6.1",
|
|
61
60
|
]
|
|
62
61
|
|
|
@@ -157,6 +156,58 @@ reportOverlappingOverload = false
|
|
|
157
156
|
reportImportCycles = false
|
|
158
157
|
reportPrivateUsage = false
|
|
159
158
|
|
|
159
|
+
[tool.mypy]
|
|
160
|
+
pretty = true
|
|
161
|
+
show_error_codes = true
|
|
162
|
+
|
|
163
|
+
# Exclude _files.py because mypy isn't smart enough to apply
|
|
164
|
+
# the correct type narrowing and as this is an internal module
|
|
165
|
+
# it's fine to just use Pyright.
|
|
166
|
+
#
|
|
167
|
+
# We also exclude our `tests` as mypy doesn't always infer
|
|
168
|
+
# types correctly and Pyright will still catch any type errors.
|
|
169
|
+
exclude = ['src/supermemory/_files.py', '_dev/.*.py', 'tests/.*']
|
|
170
|
+
|
|
171
|
+
strict_equality = true
|
|
172
|
+
implicit_reexport = true
|
|
173
|
+
check_untyped_defs = true
|
|
174
|
+
no_implicit_optional = true
|
|
175
|
+
|
|
176
|
+
warn_return_any = true
|
|
177
|
+
warn_unreachable = true
|
|
178
|
+
warn_unused_configs = true
|
|
179
|
+
|
|
180
|
+
# Turn these options off as it could cause conflicts
|
|
181
|
+
# with the Pyright options.
|
|
182
|
+
warn_unused_ignores = false
|
|
183
|
+
warn_redundant_casts = false
|
|
184
|
+
|
|
185
|
+
disallow_any_generics = true
|
|
186
|
+
disallow_untyped_defs = true
|
|
187
|
+
disallow_untyped_calls = true
|
|
188
|
+
disallow_subclassing_any = true
|
|
189
|
+
disallow_incomplete_defs = true
|
|
190
|
+
disallow_untyped_decorators = true
|
|
191
|
+
cache_fine_grained = true
|
|
192
|
+
|
|
193
|
+
# By default, mypy reports an error if you assign a value to the result
|
|
194
|
+
# of a function call that doesn't return anything. We do this in our test
|
|
195
|
+
# cases:
|
|
196
|
+
# ```
|
|
197
|
+
# result = ...
|
|
198
|
+
# assert result is None
|
|
199
|
+
# ```
|
|
200
|
+
# Changing this codegen to make mypy happy would increase complexity
|
|
201
|
+
# and would not be worth it.
|
|
202
|
+
disable_error_code = "func-returns-value,overload-cannot-match"
|
|
203
|
+
|
|
204
|
+
# https://github.com/python/mypy/issues/12162
|
|
205
|
+
[[tool.mypy.overrides]]
|
|
206
|
+
module = "black.files.*"
|
|
207
|
+
ignore_errors = true
|
|
208
|
+
ignore_missing_imports = true
|
|
209
|
+
|
|
210
|
+
|
|
160
211
|
[tool.ruff]
|
|
161
212
|
line-length = 120
|
|
162
213
|
output-format = "grouped"
|
|
@@ -59,7 +59,7 @@ from ._types import (
|
|
|
59
59
|
ModelBuilderProtocol,
|
|
60
60
|
)
|
|
61
61
|
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
|
|
62
|
-
from ._compat import
|
|
62
|
+
from ._compat import PYDANTIC_V1, model_copy, model_dump
|
|
63
63
|
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
|
|
64
64
|
from ._response import (
|
|
65
65
|
APIResponse,
|
|
@@ -232,7 +232,7 @@ class BaseSyncPage(BasePage[_T], Generic[_T]):
|
|
|
232
232
|
model: Type[_T],
|
|
233
233
|
options: FinalRequestOptions,
|
|
234
234
|
) -> None:
|
|
235
|
-
if
|
|
235
|
+
if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None:
|
|
236
236
|
self.__pydantic_private__ = {}
|
|
237
237
|
|
|
238
238
|
self._model = model
|
|
@@ -320,7 +320,7 @@ class BaseAsyncPage(BasePage[_T], Generic[_T]):
|
|
|
320
320
|
client: AsyncAPIClient,
|
|
321
321
|
options: FinalRequestOptions,
|
|
322
322
|
) -> None:
|
|
323
|
-
if
|
|
323
|
+
if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None:
|
|
324
324
|
self.__pydantic_private__ = {}
|
|
325
325
|
|
|
326
326
|
self._model = model
|
|
@@ -21,7 +21,7 @@ from ._types import (
|
|
|
21
21
|
)
|
|
22
22
|
from ._utils import is_given, get_async_library
|
|
23
23
|
from ._version import __version__
|
|
24
|
-
from .resources import search,
|
|
24
|
+
from .resources import search, settings, connections
|
|
25
25
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
26
26
|
from ._exceptions import APIStatusError, SupermemoryError
|
|
27
27
|
from ._base_client import (
|
|
@@ -43,7 +43,6 @@ __all__ = [
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
class Supermemory(SyncAPIClient):
|
|
46
|
-
memories: memories.MemoriesResource
|
|
47
46
|
search: search.SearchResource
|
|
48
47
|
settings: settings.SettingsResource
|
|
49
48
|
connections: connections.ConnectionsResource
|
|
@@ -104,7 +103,6 @@ class Supermemory(SyncAPIClient):
|
|
|
104
103
|
_strict_response_validation=_strict_response_validation,
|
|
105
104
|
)
|
|
106
105
|
|
|
107
|
-
self.memories = memories.MemoriesResource(self)
|
|
108
106
|
self.search = search.SearchResource(self)
|
|
109
107
|
self.settings = settings.SettingsResource(self)
|
|
110
108
|
self.connections = connections.ConnectionsResource(self)
|
|
@@ -217,7 +215,6 @@ class Supermemory(SyncAPIClient):
|
|
|
217
215
|
|
|
218
216
|
|
|
219
217
|
class AsyncSupermemory(AsyncAPIClient):
|
|
220
|
-
memories: memories.AsyncMemoriesResource
|
|
221
218
|
search: search.AsyncSearchResource
|
|
222
219
|
settings: settings.AsyncSettingsResource
|
|
223
220
|
connections: connections.AsyncConnectionsResource
|
|
@@ -278,7 +275,6 @@ class AsyncSupermemory(AsyncAPIClient):
|
|
|
278
275
|
_strict_response_validation=_strict_response_validation,
|
|
279
276
|
)
|
|
280
277
|
|
|
281
|
-
self.memories = memories.AsyncMemoriesResource(self)
|
|
282
278
|
self.search = search.AsyncSearchResource(self)
|
|
283
279
|
self.settings = settings.AsyncSettingsResource(self)
|
|
284
280
|
self.connections = connections.AsyncConnectionsResource(self)
|
|
@@ -392,7 +388,6 @@ class AsyncSupermemory(AsyncAPIClient):
|
|
|
392
388
|
|
|
393
389
|
class SupermemoryWithRawResponse:
|
|
394
390
|
def __init__(self, client: Supermemory) -> None:
|
|
395
|
-
self.memories = memories.MemoriesResourceWithRawResponse(client.memories)
|
|
396
391
|
self.search = search.SearchResourceWithRawResponse(client.search)
|
|
397
392
|
self.settings = settings.SettingsResourceWithRawResponse(client.settings)
|
|
398
393
|
self.connections = connections.ConnectionsResourceWithRawResponse(client.connections)
|
|
@@ -400,7 +395,6 @@ class SupermemoryWithRawResponse:
|
|
|
400
395
|
|
|
401
396
|
class AsyncSupermemoryWithRawResponse:
|
|
402
397
|
def __init__(self, client: AsyncSupermemory) -> None:
|
|
403
|
-
self.memories = memories.AsyncMemoriesResourceWithRawResponse(client.memories)
|
|
404
398
|
self.search = search.AsyncSearchResourceWithRawResponse(client.search)
|
|
405
399
|
self.settings = settings.AsyncSettingsResourceWithRawResponse(client.settings)
|
|
406
400
|
self.connections = connections.AsyncConnectionsResourceWithRawResponse(client.connections)
|
|
@@ -408,7 +402,6 @@ class AsyncSupermemoryWithRawResponse:
|
|
|
408
402
|
|
|
409
403
|
class SupermemoryWithStreamedResponse:
|
|
410
404
|
def __init__(self, client: Supermemory) -> None:
|
|
411
|
-
self.memories = memories.MemoriesResourceWithStreamingResponse(client.memories)
|
|
412
405
|
self.search = search.SearchResourceWithStreamingResponse(client.search)
|
|
413
406
|
self.settings = settings.SettingsResourceWithStreamingResponse(client.settings)
|
|
414
407
|
self.connections = connections.ConnectionsResourceWithStreamingResponse(client.connections)
|
|
@@ -416,7 +409,6 @@ class SupermemoryWithStreamedResponse:
|
|
|
416
409
|
|
|
417
410
|
class AsyncSupermemoryWithStreamedResponse:
|
|
418
411
|
def __init__(self, client: AsyncSupermemory) -> None:
|
|
419
|
-
self.memories = memories.AsyncMemoriesResourceWithStreamingResponse(client.memories)
|
|
420
412
|
self.search = search.AsyncSearchResourceWithStreamingResponse(client.search)
|
|
421
413
|
self.settings = settings.AsyncSettingsResourceWithStreamingResponse(client.settings)
|
|
422
414
|
self.connections = connections.AsyncConnectionsResourceWithStreamingResponse(client.connections)
|
|
@@ -12,14 +12,13 @@ from ._types import IncEx, StrBytesIntFloat
|
|
|
12
12
|
_T = TypeVar("_T")
|
|
13
13
|
_ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel)
|
|
14
14
|
|
|
15
|
-
# --------------- Pydantic v2 compatibility ---------------
|
|
15
|
+
# --------------- Pydantic v2, v3 compatibility ---------------
|
|
16
16
|
|
|
17
17
|
# Pyright incorrectly reports some of our functions as overriding a method when they don't
|
|
18
18
|
# pyright: reportIncompatibleMethodOverride=false
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
PYDANTIC_V1 = pydantic.VERSION.startswith("1.")
|
|
21
21
|
|
|
22
|
-
# v1 re-exports
|
|
23
22
|
if TYPE_CHECKING:
|
|
24
23
|
|
|
25
24
|
def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001
|
|
@@ -44,90 +43,92 @@ if TYPE_CHECKING:
|
|
|
44
43
|
...
|
|
45
44
|
|
|
46
45
|
else:
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
# v1 re-exports
|
|
47
|
+
if PYDANTIC_V1:
|
|
48
|
+
from pydantic.typing import (
|
|
49
49
|
get_args as get_args,
|
|
50
50
|
is_union as is_union,
|
|
51
51
|
get_origin as get_origin,
|
|
52
52
|
is_typeddict as is_typeddict,
|
|
53
53
|
is_literal_type as is_literal_type,
|
|
54
54
|
)
|
|
55
|
-
from pydantic.
|
|
55
|
+
from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
|
|
56
56
|
else:
|
|
57
|
-
from
|
|
57
|
+
from ._utils import (
|
|
58
58
|
get_args as get_args,
|
|
59
59
|
is_union as is_union,
|
|
60
60
|
get_origin as get_origin,
|
|
61
|
+
parse_date as parse_date,
|
|
61
62
|
is_typeddict as is_typeddict,
|
|
63
|
+
parse_datetime as parse_datetime,
|
|
62
64
|
is_literal_type as is_literal_type,
|
|
63
65
|
)
|
|
64
|
-
from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
# refactored config
|
|
68
69
|
if TYPE_CHECKING:
|
|
69
70
|
from pydantic import ConfigDict as ConfigDict
|
|
70
71
|
else:
|
|
71
|
-
if
|
|
72
|
-
from pydantic import ConfigDict
|
|
73
|
-
else:
|
|
72
|
+
if PYDANTIC_V1:
|
|
74
73
|
# TODO: provide an error message here?
|
|
75
74
|
ConfigDict = None
|
|
75
|
+
else:
|
|
76
|
+
from pydantic import ConfigDict as ConfigDict
|
|
76
77
|
|
|
77
78
|
|
|
78
79
|
# renamed methods / properties
|
|
79
80
|
def parse_obj(model: type[_ModelT], value: object) -> _ModelT:
|
|
80
|
-
if
|
|
81
|
-
return model.model_validate(value)
|
|
82
|
-
else:
|
|
81
|
+
if PYDANTIC_V1:
|
|
83
82
|
return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
|
|
83
|
+
else:
|
|
84
|
+
return model.model_validate(value)
|
|
84
85
|
|
|
85
86
|
|
|
86
87
|
def field_is_required(field: FieldInfo) -> bool:
|
|
87
|
-
if
|
|
88
|
-
return field.
|
|
89
|
-
return field.
|
|
88
|
+
if PYDANTIC_V1:
|
|
89
|
+
return field.required # type: ignore
|
|
90
|
+
return field.is_required()
|
|
90
91
|
|
|
91
92
|
|
|
92
93
|
def field_get_default(field: FieldInfo) -> Any:
|
|
93
94
|
value = field.get_default()
|
|
94
|
-
if
|
|
95
|
-
from pydantic_core import PydanticUndefined
|
|
96
|
-
|
|
97
|
-
if value == PydanticUndefined:
|
|
98
|
-
return None
|
|
95
|
+
if PYDANTIC_V1:
|
|
99
96
|
return value
|
|
97
|
+
from pydantic_core import PydanticUndefined
|
|
98
|
+
|
|
99
|
+
if value == PydanticUndefined:
|
|
100
|
+
return None
|
|
100
101
|
return value
|
|
101
102
|
|
|
102
103
|
|
|
103
104
|
def field_outer_type(field: FieldInfo) -> Any:
|
|
104
|
-
if
|
|
105
|
-
return field.
|
|
106
|
-
return field.
|
|
105
|
+
if PYDANTIC_V1:
|
|
106
|
+
return field.outer_type_ # type: ignore
|
|
107
|
+
return field.annotation
|
|
107
108
|
|
|
108
109
|
|
|
109
110
|
def get_model_config(model: type[pydantic.BaseModel]) -> Any:
|
|
110
|
-
if
|
|
111
|
-
return model.
|
|
112
|
-
return model.
|
|
111
|
+
if PYDANTIC_V1:
|
|
112
|
+
return model.__config__ # type: ignore
|
|
113
|
+
return model.model_config
|
|
113
114
|
|
|
114
115
|
|
|
115
116
|
def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]:
|
|
116
|
-
if
|
|
117
|
-
return model.
|
|
118
|
-
return model.
|
|
117
|
+
if PYDANTIC_V1:
|
|
118
|
+
return model.__fields__ # type: ignore
|
|
119
|
+
return model.model_fields
|
|
119
120
|
|
|
120
121
|
|
|
121
122
|
def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT:
|
|
122
|
-
if
|
|
123
|
-
return model.
|
|
124
|
-
return model.
|
|
123
|
+
if PYDANTIC_V1:
|
|
124
|
+
return model.copy(deep=deep) # type: ignore
|
|
125
|
+
return model.model_copy(deep=deep)
|
|
125
126
|
|
|
126
127
|
|
|
127
128
|
def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
|
|
128
|
-
if
|
|
129
|
-
return model.
|
|
130
|
-
return model.
|
|
129
|
+
if PYDANTIC_V1:
|
|
130
|
+
return model.json(indent=indent) # type: ignore
|
|
131
|
+
return model.model_dump_json(indent=indent)
|
|
131
132
|
|
|
132
133
|
|
|
133
134
|
def model_dump(
|
|
@@ -139,14 +140,14 @@ def model_dump(
|
|
|
139
140
|
warnings: bool = True,
|
|
140
141
|
mode: Literal["json", "python"] = "python",
|
|
141
142
|
) -> dict[str, Any]:
|
|
142
|
-
if
|
|
143
|
+
if (not PYDANTIC_V1) or hasattr(model, "model_dump"):
|
|
143
144
|
return model.model_dump(
|
|
144
145
|
mode=mode,
|
|
145
146
|
exclude=exclude,
|
|
146
147
|
exclude_unset=exclude_unset,
|
|
147
148
|
exclude_defaults=exclude_defaults,
|
|
148
149
|
# warnings are not supported in Pydantic v1
|
|
149
|
-
warnings=
|
|
150
|
+
warnings=True if PYDANTIC_V1 else warnings,
|
|
150
151
|
)
|
|
151
152
|
return cast(
|
|
152
153
|
"dict[str, Any]",
|
|
@@ -159,9 +160,9 @@ def model_dump(
|
|
|
159
160
|
|
|
160
161
|
|
|
161
162
|
def model_parse(model: type[_ModelT], data: Any) -> _ModelT:
|
|
162
|
-
if
|
|
163
|
-
return model.
|
|
164
|
-
return model.
|
|
163
|
+
if PYDANTIC_V1:
|
|
164
|
+
return model.parse_obj(data) # pyright: ignore[reportDeprecated]
|
|
165
|
+
return model.model_validate(data)
|
|
165
166
|
|
|
166
167
|
|
|
167
168
|
# generic models
|
|
@@ -170,17 +171,16 @@ if TYPE_CHECKING:
|
|
|
170
171
|
class GenericModel(pydantic.BaseModel): ...
|
|
171
172
|
|
|
172
173
|
else:
|
|
173
|
-
if
|
|
174
|
+
if PYDANTIC_V1:
|
|
175
|
+
import pydantic.generics
|
|
176
|
+
|
|
177
|
+
class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ...
|
|
178
|
+
else:
|
|
174
179
|
# there no longer needs to be a distinction in v2 but
|
|
175
180
|
# we still have to create our own subclass to avoid
|
|
176
181
|
# inconsistent MRO ordering errors
|
|
177
182
|
class GenericModel(pydantic.BaseModel): ...
|
|
178
183
|
|
|
179
|
-
else:
|
|
180
|
-
import pydantic.generics
|
|
181
|
-
|
|
182
|
-
class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ...
|
|
183
|
-
|
|
184
184
|
|
|
185
185
|
# cached properties
|
|
186
186
|
if TYPE_CHECKING:
|
|
@@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
|
|
|
34
34
|
if not is_file_content(obj):
|
|
35
35
|
prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
|
|
36
36
|
raise RuntimeError(
|
|
37
|
-
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead.
|
|
37
|
+
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead."
|
|
38
38
|
) from None
|
|
39
39
|
|
|
40
40
|
|