supermemory 3.0.0a30__tar.gz → 3.2.0__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.2.0/.release-please-manifest.json +3 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/CHANGELOG.md +26 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/PKG-INFO +32 -15
- {supermemory-3.0.0a30 → supermemory-3.2.0}/README.md +31 -14
- {supermemory-3.0.0a30 → supermemory-3.2.0}/api.md +46 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/pyproject.toml +1 -1
- {supermemory-3.0.0a30 → supermemory-3.2.0}/requirements-dev.lock +5 -2
- {supermemory-3.0.0a30 → supermemory-3.2.0}/requirements.lock +5 -2
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/__init__.py +3 -1
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_base_client.py +9 -9
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_client.py +25 -9
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_files.py +1 -1
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_models.py +10 -4
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_qs.py +7 -7
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_types.py +18 -11
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_utils/_transform.py +2 -2
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_utils/_utils.py +4 -4
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_version.py +1 -1
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/resources/__init__.py +28 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/resources/connections.py +31 -31
- supermemory-3.2.0/src/supermemory/resources/documents.py +894 -0
- supermemory-3.2.0/src/supermemory/resources/memories.py +894 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/resources/search.py +75 -75
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/resources/settings.py +35 -31
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/__init__.py +18 -0
- supermemory-3.2.0/src/supermemory/types/document_add_params.py +69 -0
- supermemory-3.2.0/src/supermemory/types/document_add_response.py +11 -0
- supermemory-3.2.0/src/supermemory/types/document_get_response.py +104 -0
- supermemory-3.2.0/src/supermemory/types/document_list_params.py +111 -0
- supermemory-3.2.0/src/supermemory/types/document_list_response.py +95 -0
- supermemory-3.2.0/src/supermemory/types/document_update_params.py +69 -0
- supermemory-3.2.0/src/supermemory/types/document_update_response.py +11 -0
- supermemory-3.2.0/src/supermemory/types/document_upload_file_params.py +36 -0
- supermemory-3.2.0/src/supermemory/types/document_upload_file_response.py +11 -0
- supermemory-3.2.0/src/supermemory/types/memory_add_params.py +69 -0
- supermemory-3.2.0/src/supermemory/types/memory_add_response.py +11 -0
- supermemory-3.2.0/src/supermemory/types/memory_get_response.py +104 -0
- supermemory-3.2.0/src/supermemory/types/memory_list_params.py +111 -0
- supermemory-3.2.0/src/supermemory/types/memory_list_response.py +95 -0
- supermemory-3.2.0/src/supermemory/types/memory_update_params.py +69 -0
- supermemory-3.2.0/src/supermemory/types/memory_update_response.py +11 -0
- supermemory-3.2.0/src/supermemory/types/memory_upload_file_params.py +36 -0
- supermemory-3.2.0/src/supermemory/types/memory_upload_file_response.py +11 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/search_documents_params.py +68 -7
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/search_execute_params.py +68 -7
- supermemory-3.2.0/src/supermemory/types/search_memories_params.py +135 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/setting_get_response.py +2 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/setting_update_params.py +2 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/setting_update_response.py +2 -0
- supermemory-3.2.0/tests/api_resources/test_documents.py +644 -0
- supermemory-3.2.0/tests/api_resources/test_memories.py +644 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/api_resources/test_search.py +44 -36
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/api_resources/test_settings.py +2 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_client.py +40 -24
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_transform.py +9 -2
- supermemory-3.0.0a30/.release-please-manifest.json +0 -3
- supermemory-3.0.0a30/src/supermemory/types/search_memories_params.py +0 -66
- {supermemory-3.0.0a30 → supermemory-3.2.0}/.gitignore +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/CONTRIBUTING.md +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/LICENSE +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/SECURITY.md +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/bin/check-release-environment +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/bin/publish-pypi +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/examples/.keep +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/noxfile.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/release-please-config.json +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_compat.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_constants.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_exceptions.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_resource.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_streaming.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_utils/__init__.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_utils/_compat.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_utils/_datetime_parse.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_utils/_logs.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_utils/_proxy.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_utils/_reflection.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_utils/_resources_proxy.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_utils/_streams.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_utils/_sync.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/_utils/_typing.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/lib/.keep +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/py.typed +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_create_params.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_create_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_delete_by_id_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_delete_by_provider_params.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_delete_by_provider_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_get_by_id_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_get_by_tags_params.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_get_by_tags_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_import_params.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_import_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_list_documents_params.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_list_documents_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_list_params.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/connection_list_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/search_documents_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/search_execute_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory/types/search_memories_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/src/supermemory_new/lib/.keep +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/__init__.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/api_resources/__init__.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/api_resources/test_connections.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/conftest.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/sample_file.txt +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_deepcopy.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_extract_files.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_files.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_models.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_qs.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_required_args.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_response.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_streaming.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_utils/test_datetime_parse.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_utils/test_proxy.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/test_utils/test_typing.py +0 -0
- {supermemory-3.0.0a30 → supermemory-3.2.0}/tests/utils.py +0 -0
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.2.0 (2025-09-21)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v3.1.0...v3.2.0](https://github.com/supermemoryai/python-sdk/compare/v3.1.0...v3.2.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([82b35f0](https://github.com/supermemoryai/python-sdk/commit/82b35f0447a67d089304d57f41d1d1527f6da7fb))
|
|
10
|
+
|
|
11
|
+
## 3.1.0 (2025-09-20)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v3.0.0-alpha.30...v3.1.0](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.30...v3.1.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** api update ([19c5dd3](https://github.com/supermemoryai/python-sdk/commit/19c5dd364b496d9a7858e1764000aba6d71613c6))
|
|
18
|
+
* **api:** api update ([3082481](https://github.com/supermemoryai/python-sdk/commit/30824814233753584a89c56a2efb69d72995be02))
|
|
19
|
+
* **api:** manual updates ([e92cb27](https://github.com/supermemoryai/python-sdk/commit/e92cb27550c2190a6804a2865ae359ff79fa1866))
|
|
20
|
+
* **api:** manual updates ([251fdf1](https://github.com/supermemoryai/python-sdk/commit/251fdf116f5f1b0c1ecfb74bef94ba08f7921dca))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Chores
|
|
24
|
+
|
|
25
|
+
* do not install brew dependencies in ./scripts/bootstrap by default ([fb748cf](https://github.com/supermemoryai/python-sdk/commit/fb748cf2375b1ce1eddd2584503e81d3b8386443))
|
|
26
|
+
* **internal:** update pydantic dependency ([8c480f7](https://github.com/supermemoryai/python-sdk/commit/8c480f70cf3d0e55c4c5bc3b77d83bd6b21c4fdf))
|
|
27
|
+
* **types:** change optional parameter type from NotGiven to Omit ([3031781](https://github.com/supermemoryai/python-sdk/commit/30317810d7089dbdf59f5e143bd66b1a0495b2b6))
|
|
28
|
+
|
|
3
29
|
## 3.0.0-alpha.30 (2025-09-15)
|
|
4
30
|
|
|
5
31
|
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)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: supermemory
|
|
3
|
-
Version: 3.0
|
|
3
|
+
Version: 3.2.0
|
|
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
|
|
@@ -52,7 +52,7 @@ The REST API documentation can be found on [docs.supermemory.ai](https://docs.su
|
|
|
52
52
|
|
|
53
53
|
```sh
|
|
54
54
|
# install from PyPI
|
|
55
|
-
pip install
|
|
55
|
+
pip install supermemory
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
## Usage
|
|
@@ -112,7 +112,7 @@ You can enable this by installing `aiohttp`:
|
|
|
112
112
|
|
|
113
113
|
```sh
|
|
114
114
|
# install from PyPI
|
|
115
|
-
pip install
|
|
115
|
+
pip install supermemory[aiohttp]
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
@@ -162,6 +162,23 @@ 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
|
+
|
|
165
182
|
## Handling errors
|
|
166
183
|
|
|
167
184
|
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.
|
|
@@ -178,8 +195,8 @@ from supermemory import Supermemory
|
|
|
178
195
|
client = Supermemory()
|
|
179
196
|
|
|
180
197
|
try:
|
|
181
|
-
client.
|
|
182
|
-
|
|
198
|
+
client.memories.add(
|
|
199
|
+
content="This is a detailed article about machine learning concepts...",
|
|
183
200
|
)
|
|
184
201
|
except supermemory.APIConnectionError as e:
|
|
185
202
|
print("The server could not be reached")
|
|
@@ -223,8 +240,8 @@ client = Supermemory(
|
|
|
223
240
|
)
|
|
224
241
|
|
|
225
242
|
# Or, configure per-request:
|
|
226
|
-
client.with_options(max_retries=5).
|
|
227
|
-
|
|
243
|
+
client.with_options(max_retries=5).memories.add(
|
|
244
|
+
content="This is a detailed article about machine learning concepts...",
|
|
228
245
|
)
|
|
229
246
|
```
|
|
230
247
|
|
|
@@ -248,8 +265,8 @@ client = Supermemory(
|
|
|
248
265
|
)
|
|
249
266
|
|
|
250
267
|
# Override per-request:
|
|
251
|
-
client.with_options(timeout=5.0).
|
|
252
|
-
|
|
268
|
+
client.with_options(timeout=5.0).memories.add(
|
|
269
|
+
content="This is a detailed article about machine learning concepts...",
|
|
253
270
|
)
|
|
254
271
|
```
|
|
255
272
|
|
|
@@ -291,13 +308,13 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
291
308
|
from supermemory import Supermemory
|
|
292
309
|
|
|
293
310
|
client = Supermemory()
|
|
294
|
-
response = client.
|
|
295
|
-
|
|
311
|
+
response = client.memories.with_raw_response.add(
|
|
312
|
+
content="This is a detailed article about machine learning concepts...",
|
|
296
313
|
)
|
|
297
314
|
print(response.headers.get('X-My-Header'))
|
|
298
315
|
|
|
299
|
-
|
|
300
|
-
print(
|
|
316
|
+
memory = response.parse() # get the object that `memories.add()` would have returned
|
|
317
|
+
print(memory.id)
|
|
301
318
|
```
|
|
302
319
|
|
|
303
320
|
These methods return an [`APIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory/_response.py) object.
|
|
@@ -311,8 +328,8 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
311
328
|
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.
|
|
312
329
|
|
|
313
330
|
```python
|
|
314
|
-
with client.
|
|
315
|
-
|
|
331
|
+
with client.memories.with_streaming_response.add(
|
|
332
|
+
content="This is a detailed article about machine learning concepts...",
|
|
316
333
|
) as response:
|
|
317
334
|
print(response.headers.get("X-My-Header"))
|
|
318
335
|
|
|
@@ -17,7 +17,7 @@ The REST API documentation can be found on [docs.supermemory.ai](https://docs.su
|
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
19
|
# install from PyPI
|
|
20
|
-
pip install
|
|
20
|
+
pip install supermemory
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
@@ -77,7 +77,7 @@ You can enable this by installing `aiohttp`:
|
|
|
77
77
|
|
|
78
78
|
```sh
|
|
79
79
|
# install from PyPI
|
|
80
|
-
pip install
|
|
80
|
+
pip install supermemory[aiohttp]
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
@@ -127,6 +127,23 @@ 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
|
+
|
|
130
147
|
## Handling errors
|
|
131
148
|
|
|
132
149
|
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.
|
|
@@ -143,8 +160,8 @@ from supermemory import Supermemory
|
|
|
143
160
|
client = Supermemory()
|
|
144
161
|
|
|
145
162
|
try:
|
|
146
|
-
client.
|
|
147
|
-
|
|
163
|
+
client.memories.add(
|
|
164
|
+
content="This is a detailed article about machine learning concepts...",
|
|
148
165
|
)
|
|
149
166
|
except supermemory.APIConnectionError as e:
|
|
150
167
|
print("The server could not be reached")
|
|
@@ -188,8 +205,8 @@ client = Supermemory(
|
|
|
188
205
|
)
|
|
189
206
|
|
|
190
207
|
# Or, configure per-request:
|
|
191
|
-
client.with_options(max_retries=5).
|
|
192
|
-
|
|
208
|
+
client.with_options(max_retries=5).memories.add(
|
|
209
|
+
content="This is a detailed article about machine learning concepts...",
|
|
193
210
|
)
|
|
194
211
|
```
|
|
195
212
|
|
|
@@ -213,8 +230,8 @@ client = Supermemory(
|
|
|
213
230
|
)
|
|
214
231
|
|
|
215
232
|
# Override per-request:
|
|
216
|
-
client.with_options(timeout=5.0).
|
|
217
|
-
|
|
233
|
+
client.with_options(timeout=5.0).memories.add(
|
|
234
|
+
content="This is a detailed article about machine learning concepts...",
|
|
218
235
|
)
|
|
219
236
|
```
|
|
220
237
|
|
|
@@ -256,13 +273,13 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
256
273
|
from supermemory import Supermemory
|
|
257
274
|
|
|
258
275
|
client = Supermemory()
|
|
259
|
-
response = client.
|
|
260
|
-
|
|
276
|
+
response = client.memories.with_raw_response.add(
|
|
277
|
+
content="This is a detailed article about machine learning concepts...",
|
|
261
278
|
)
|
|
262
279
|
print(response.headers.get('X-My-Header'))
|
|
263
280
|
|
|
264
|
-
|
|
265
|
-
print(
|
|
281
|
+
memory = response.parse() # get the object that `memories.add()` would have returned
|
|
282
|
+
print(memory.id)
|
|
266
283
|
```
|
|
267
284
|
|
|
268
285
|
These methods return an [`APIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory/_response.py) object.
|
|
@@ -276,8 +293,8 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
276
293
|
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.
|
|
277
294
|
|
|
278
295
|
```python
|
|
279
|
-
with client.
|
|
280
|
-
|
|
296
|
+
with client.memories.with_streaming_response.add(
|
|
297
|
+
content="This is a detailed article about machine learning concepts...",
|
|
281
298
|
) as response:
|
|
282
299
|
print(response.headers.get("X-My-Header"))
|
|
283
300
|
|
|
@@ -1,3 +1,49 @@
|
|
|
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/documents/{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/documents/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/documents/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">delete</a>(id) -> None</code>
|
|
20
|
+
- <code title="post /v3/documents">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/documents/{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/documents/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
|
+
# Documents
|
|
25
|
+
|
|
26
|
+
Types:
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from supermemory.types import (
|
|
30
|
+
DocumentUpdateResponse,
|
|
31
|
+
DocumentListResponse,
|
|
32
|
+
DocumentAddResponse,
|
|
33
|
+
DocumentGetResponse,
|
|
34
|
+
DocumentUploadFileResponse,
|
|
35
|
+
)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Methods:
|
|
39
|
+
|
|
40
|
+
- <code title="patch /v3/documents/{id}">client.documents.<a href="./src/supermemory/resources/documents.py">update</a>(id, \*\*<a href="src/supermemory/types/document_update_params.py">params</a>) -> <a href="./src/supermemory/types/document_update_response.py">DocumentUpdateResponse</a></code>
|
|
41
|
+
- <code title="post /v3/documents/list">client.documents.<a href="./src/supermemory/resources/documents.py">list</a>(\*\*<a href="src/supermemory/types/document_list_params.py">params</a>) -> <a href="./src/supermemory/types/document_list_response.py">DocumentListResponse</a></code>
|
|
42
|
+
- <code title="delete /v3/documents/{id}">client.documents.<a href="./src/supermemory/resources/documents.py">delete</a>(id) -> None</code>
|
|
43
|
+
- <code title="post /v3/documents">client.documents.<a href="./src/supermemory/resources/documents.py">add</a>(\*\*<a href="src/supermemory/types/document_add_params.py">params</a>) -> <a href="./src/supermemory/types/document_add_response.py">DocumentAddResponse</a></code>
|
|
44
|
+
- <code title="get /v3/documents/{id}">client.documents.<a href="./src/supermemory/resources/documents.py">get</a>(id) -> <a href="./src/supermemory/types/document_get_response.py">DocumentGetResponse</a></code>
|
|
45
|
+
- <code title="post /v3/documents/file">client.documents.<a href="./src/supermemory/resources/documents.py">upload_file</a>(\*\*<a href="src/supermemory/types/document_upload_file_params.py">params</a>) -> <a href="./src/supermemory/types/document_upload_file_response.py">DocumentUploadFileResponse</a></code>
|
|
46
|
+
|
|
1
47
|
# Search
|
|
2
48
|
|
|
3
49
|
Types:
|
|
@@ -88,9 +88,9 @@ pluggy==1.5.0
|
|
|
88
88
|
propcache==0.3.1
|
|
89
89
|
# via aiohttp
|
|
90
90
|
# via yarl
|
|
91
|
-
pydantic==2.
|
|
91
|
+
pydantic==2.11.9
|
|
92
92
|
# via supermemory
|
|
93
|
-
pydantic-core==2.
|
|
93
|
+
pydantic-core==2.33.2
|
|
94
94
|
# via pydantic
|
|
95
95
|
pygments==2.18.0
|
|
96
96
|
# via rich
|
|
@@ -126,6 +126,9 @@ typing-extensions==4.12.2
|
|
|
126
126
|
# via pydantic-core
|
|
127
127
|
# via pyright
|
|
128
128
|
# via supermemory
|
|
129
|
+
# via typing-inspection
|
|
130
|
+
typing-inspection==0.4.1
|
|
131
|
+
# via pydantic
|
|
129
132
|
virtualenv==20.24.5
|
|
130
133
|
# via nox
|
|
131
134
|
yarl==1.20.0
|
|
@@ -55,9 +55,9 @@ multidict==6.4.4
|
|
|
55
55
|
propcache==0.3.1
|
|
56
56
|
# via aiohttp
|
|
57
57
|
# via yarl
|
|
58
|
-
pydantic==2.
|
|
58
|
+
pydantic==2.11.9
|
|
59
59
|
# via supermemory
|
|
60
|
-
pydantic-core==2.
|
|
60
|
+
pydantic-core==2.33.2
|
|
61
61
|
# via pydantic
|
|
62
62
|
sniffio==1.3.0
|
|
63
63
|
# via anyio
|
|
@@ -68,5 +68,8 @@ typing-extensions==4.12.2
|
|
|
68
68
|
# via pydantic
|
|
69
69
|
# via pydantic-core
|
|
70
70
|
# via supermemory
|
|
71
|
+
# via typing-inspection
|
|
72
|
+
typing-inspection==0.4.1
|
|
73
|
+
# via pydantic
|
|
71
74
|
yarl==1.20.0
|
|
72
75
|
# via aiohttp
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import typing as _t
|
|
4
4
|
|
|
5
5
|
from . import types
|
|
6
|
-
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
|
|
6
|
+
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given
|
|
7
7
|
from ._utils import file_from_path
|
|
8
8
|
from ._client import (
|
|
9
9
|
Client,
|
|
@@ -48,7 +48,9 @@ __all__ = [
|
|
|
48
48
|
"ProxiesTypes",
|
|
49
49
|
"NotGiven",
|
|
50
50
|
"NOT_GIVEN",
|
|
51
|
+
"not_given",
|
|
51
52
|
"Omit",
|
|
53
|
+
"omit",
|
|
52
54
|
"SupermemoryError",
|
|
53
55
|
"APIError",
|
|
54
56
|
"APIStatusError",
|
|
@@ -42,7 +42,6 @@ from . import _exceptions
|
|
|
42
42
|
from ._qs import Querystring
|
|
43
43
|
from ._files import to_httpx_files, async_to_httpx_files
|
|
44
44
|
from ._types import (
|
|
45
|
-
NOT_GIVEN,
|
|
46
45
|
Body,
|
|
47
46
|
Omit,
|
|
48
47
|
Query,
|
|
@@ -57,6 +56,7 @@ from ._types import (
|
|
|
57
56
|
RequestOptions,
|
|
58
57
|
HttpxRequestFiles,
|
|
59
58
|
ModelBuilderProtocol,
|
|
59
|
+
not_given,
|
|
60
60
|
)
|
|
61
61
|
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
|
|
62
62
|
from ._compat import PYDANTIC_V1, model_copy, model_dump
|
|
@@ -145,9 +145,9 @@ class PageInfo:
|
|
|
145
145
|
def __init__(
|
|
146
146
|
self,
|
|
147
147
|
*,
|
|
148
|
-
url: URL | NotGiven =
|
|
149
|
-
json: Body | NotGiven =
|
|
150
|
-
params: Query | NotGiven =
|
|
148
|
+
url: URL | NotGiven = not_given,
|
|
149
|
+
json: Body | NotGiven = not_given,
|
|
150
|
+
params: Query | NotGiven = not_given,
|
|
151
151
|
) -> None:
|
|
152
152
|
self.url = url
|
|
153
153
|
self.json = json
|
|
@@ -595,7 +595,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
595
595
|
# we internally support defining a temporary header to override the
|
|
596
596
|
# default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response`
|
|
597
597
|
# see _response.py for implementation details
|
|
598
|
-
override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER,
|
|
598
|
+
override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given)
|
|
599
599
|
if is_given(override_cast_to):
|
|
600
600
|
options.headers = headers
|
|
601
601
|
return cast(Type[ResponseT], override_cast_to)
|
|
@@ -825,7 +825,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
825
825
|
version: str,
|
|
826
826
|
base_url: str | URL,
|
|
827
827
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
828
|
-
timeout: float | Timeout | None | NotGiven =
|
|
828
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
829
829
|
http_client: httpx.Client | None = None,
|
|
830
830
|
custom_headers: Mapping[str, str] | None = None,
|
|
831
831
|
custom_query: Mapping[str, object] | None = None,
|
|
@@ -1356,7 +1356,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1356
1356
|
base_url: str | URL,
|
|
1357
1357
|
_strict_response_validation: bool,
|
|
1358
1358
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
1359
|
-
timeout: float | Timeout | None | NotGiven =
|
|
1359
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
1360
1360
|
http_client: httpx.AsyncClient | None = None,
|
|
1361
1361
|
custom_headers: Mapping[str, str] | None = None,
|
|
1362
1362
|
custom_query: Mapping[str, object] | None = None,
|
|
@@ -1818,8 +1818,8 @@ def make_request_options(
|
|
|
1818
1818
|
extra_query: Query | None = None,
|
|
1819
1819
|
extra_body: Body | None = None,
|
|
1820
1820
|
idempotency_key: str | None = None,
|
|
1821
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
1822
|
-
post_parser: PostParser | NotGiven =
|
|
1821
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1822
|
+
post_parser: PostParser | NotGiven = not_given,
|
|
1823
1823
|
) -> RequestOptions:
|
|
1824
1824
|
"""Create a dict of type RequestOptions without keys of NotGiven values."""
|
|
1825
1825
|
options: RequestOptions = {}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, Mapping
|
|
7
7
|
from typing_extensions import Self, override
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
@@ -11,17 +11,17 @@ import httpx
|
|
|
11
11
|
from . import _exceptions
|
|
12
12
|
from ._qs import Querystring
|
|
13
13
|
from ._types import (
|
|
14
|
-
NOT_GIVEN,
|
|
15
14
|
Omit,
|
|
16
15
|
Timeout,
|
|
17
16
|
NotGiven,
|
|
18
17
|
Transport,
|
|
19
18
|
ProxiesTypes,
|
|
20
19
|
RequestOptions,
|
|
20
|
+
not_given,
|
|
21
21
|
)
|
|
22
22
|
from ._utils import is_given, get_async_library
|
|
23
23
|
from ._version import __version__
|
|
24
|
-
from .resources import search, settings, connections
|
|
24
|
+
from .resources import search, memories, settings, documents, 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,6 +43,8 @@ __all__ = [
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
class Supermemory(SyncAPIClient):
|
|
46
|
+
memories: memories.MemoriesResource
|
|
47
|
+
documents: documents.DocumentsResource
|
|
46
48
|
search: search.SearchResource
|
|
47
49
|
settings: settings.SettingsResource
|
|
48
50
|
connections: connections.ConnectionsResource
|
|
@@ -57,7 +59,7 @@ class Supermemory(SyncAPIClient):
|
|
|
57
59
|
*,
|
|
58
60
|
api_key: str | None = None,
|
|
59
61
|
base_url: str | httpx.URL | None = None,
|
|
60
|
-
timeout:
|
|
62
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
61
63
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
62
64
|
default_headers: Mapping[str, str] | None = None,
|
|
63
65
|
default_query: Mapping[str, object] | None = None,
|
|
@@ -103,6 +105,8 @@ class Supermemory(SyncAPIClient):
|
|
|
103
105
|
_strict_response_validation=_strict_response_validation,
|
|
104
106
|
)
|
|
105
107
|
|
|
108
|
+
self.memories = memories.MemoriesResource(self)
|
|
109
|
+
self.documents = documents.DocumentsResource(self)
|
|
106
110
|
self.search = search.SearchResource(self)
|
|
107
111
|
self.settings = settings.SettingsResource(self)
|
|
108
112
|
self.connections = connections.ConnectionsResource(self)
|
|
@@ -134,9 +138,9 @@ class Supermemory(SyncAPIClient):
|
|
|
134
138
|
*,
|
|
135
139
|
api_key: str | None = None,
|
|
136
140
|
base_url: str | httpx.URL | None = None,
|
|
137
|
-
timeout: float | Timeout | None | NotGiven =
|
|
141
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
138
142
|
http_client: httpx.Client | None = None,
|
|
139
|
-
max_retries: int | NotGiven =
|
|
143
|
+
max_retries: int | NotGiven = not_given,
|
|
140
144
|
default_headers: Mapping[str, str] | None = None,
|
|
141
145
|
set_default_headers: Mapping[str, str] | None = None,
|
|
142
146
|
default_query: Mapping[str, object] | None = None,
|
|
@@ -215,6 +219,8 @@ class Supermemory(SyncAPIClient):
|
|
|
215
219
|
|
|
216
220
|
|
|
217
221
|
class AsyncSupermemory(AsyncAPIClient):
|
|
222
|
+
memories: memories.AsyncMemoriesResource
|
|
223
|
+
documents: documents.AsyncDocumentsResource
|
|
218
224
|
search: search.AsyncSearchResource
|
|
219
225
|
settings: settings.AsyncSettingsResource
|
|
220
226
|
connections: connections.AsyncConnectionsResource
|
|
@@ -229,7 +235,7 @@ class AsyncSupermemory(AsyncAPIClient):
|
|
|
229
235
|
*,
|
|
230
236
|
api_key: str | None = None,
|
|
231
237
|
base_url: str | httpx.URL | None = None,
|
|
232
|
-
timeout:
|
|
238
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
233
239
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
234
240
|
default_headers: Mapping[str, str] | None = None,
|
|
235
241
|
default_query: Mapping[str, object] | None = None,
|
|
@@ -275,6 +281,8 @@ class AsyncSupermemory(AsyncAPIClient):
|
|
|
275
281
|
_strict_response_validation=_strict_response_validation,
|
|
276
282
|
)
|
|
277
283
|
|
|
284
|
+
self.memories = memories.AsyncMemoriesResource(self)
|
|
285
|
+
self.documents = documents.AsyncDocumentsResource(self)
|
|
278
286
|
self.search = search.AsyncSearchResource(self)
|
|
279
287
|
self.settings = settings.AsyncSettingsResource(self)
|
|
280
288
|
self.connections = connections.AsyncConnectionsResource(self)
|
|
@@ -306,9 +314,9 @@ class AsyncSupermemory(AsyncAPIClient):
|
|
|
306
314
|
*,
|
|
307
315
|
api_key: str | None = None,
|
|
308
316
|
base_url: str | httpx.URL | None = None,
|
|
309
|
-
timeout: float | Timeout | None | NotGiven =
|
|
317
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
310
318
|
http_client: httpx.AsyncClient | None = None,
|
|
311
|
-
max_retries: int | NotGiven =
|
|
319
|
+
max_retries: int | NotGiven = not_given,
|
|
312
320
|
default_headers: Mapping[str, str] | None = None,
|
|
313
321
|
set_default_headers: Mapping[str, str] | None = None,
|
|
314
322
|
default_query: Mapping[str, object] | None = None,
|
|
@@ -388,6 +396,8 @@ class AsyncSupermemory(AsyncAPIClient):
|
|
|
388
396
|
|
|
389
397
|
class SupermemoryWithRawResponse:
|
|
390
398
|
def __init__(self, client: Supermemory) -> None:
|
|
399
|
+
self.memories = memories.MemoriesResourceWithRawResponse(client.memories)
|
|
400
|
+
self.documents = documents.DocumentsResourceWithRawResponse(client.documents)
|
|
391
401
|
self.search = search.SearchResourceWithRawResponse(client.search)
|
|
392
402
|
self.settings = settings.SettingsResourceWithRawResponse(client.settings)
|
|
393
403
|
self.connections = connections.ConnectionsResourceWithRawResponse(client.connections)
|
|
@@ -395,6 +405,8 @@ class SupermemoryWithRawResponse:
|
|
|
395
405
|
|
|
396
406
|
class AsyncSupermemoryWithRawResponse:
|
|
397
407
|
def __init__(self, client: AsyncSupermemory) -> None:
|
|
408
|
+
self.memories = memories.AsyncMemoriesResourceWithRawResponse(client.memories)
|
|
409
|
+
self.documents = documents.AsyncDocumentsResourceWithRawResponse(client.documents)
|
|
398
410
|
self.search = search.AsyncSearchResourceWithRawResponse(client.search)
|
|
399
411
|
self.settings = settings.AsyncSettingsResourceWithRawResponse(client.settings)
|
|
400
412
|
self.connections = connections.AsyncConnectionsResourceWithRawResponse(client.connections)
|
|
@@ -402,6 +414,8 @@ class AsyncSupermemoryWithRawResponse:
|
|
|
402
414
|
|
|
403
415
|
class SupermemoryWithStreamedResponse:
|
|
404
416
|
def __init__(self, client: Supermemory) -> None:
|
|
417
|
+
self.memories = memories.MemoriesResourceWithStreamingResponse(client.memories)
|
|
418
|
+
self.documents = documents.DocumentsResourceWithStreamingResponse(client.documents)
|
|
405
419
|
self.search = search.SearchResourceWithStreamingResponse(client.search)
|
|
406
420
|
self.settings = settings.SettingsResourceWithStreamingResponse(client.settings)
|
|
407
421
|
self.connections = connections.ConnectionsResourceWithStreamingResponse(client.connections)
|
|
@@ -409,6 +423,8 @@ class SupermemoryWithStreamedResponse:
|
|
|
409
423
|
|
|
410
424
|
class AsyncSupermemoryWithStreamedResponse:
|
|
411
425
|
def __init__(self, client: AsyncSupermemory) -> None:
|
|
426
|
+
self.memories = memories.AsyncMemoriesResourceWithStreamingResponse(client.memories)
|
|
427
|
+
self.documents = documents.AsyncDocumentsResourceWithStreamingResponse(client.documents)
|
|
412
428
|
self.search = search.AsyncSearchResourceWithStreamingResponse(client.search)
|
|
413
429
|
self.settings = settings.AsyncSettingsResourceWithStreamingResponse(client.settings)
|
|
414
430
|
self.connections = connections.AsyncConnectionsResourceWithStreamingResponse(client.connections)
|
|
@@ -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. See https://github.com/supermemoryai/python-sdk/tree/main#file-uploads"
|
|
38
38
|
) from None
|
|
39
39
|
|
|
40
40
|
|
|
@@ -256,7 +256,7 @@ class BaseModel(pydantic.BaseModel):
|
|
|
256
256
|
mode: Literal["json", "python"] | str = "python",
|
|
257
257
|
include: IncEx | None = None,
|
|
258
258
|
exclude: IncEx | None = None,
|
|
259
|
-
by_alias: bool =
|
|
259
|
+
by_alias: bool | None = None,
|
|
260
260
|
exclude_unset: bool = False,
|
|
261
261
|
exclude_defaults: bool = False,
|
|
262
262
|
exclude_none: bool = False,
|
|
@@ -264,6 +264,7 @@ class BaseModel(pydantic.BaseModel):
|
|
|
264
264
|
warnings: bool | Literal["none", "warn", "error"] = True,
|
|
265
265
|
context: dict[str, Any] | None = None,
|
|
266
266
|
serialize_as_any: bool = False,
|
|
267
|
+
fallback: Callable[[Any], Any] | None = None,
|
|
267
268
|
) -> dict[str, Any]:
|
|
268
269
|
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump
|
|
269
270
|
|
|
@@ -295,10 +296,12 @@ class BaseModel(pydantic.BaseModel):
|
|
|
295
296
|
raise ValueError("context is only supported in Pydantic v2")
|
|
296
297
|
if serialize_as_any != False:
|
|
297
298
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
299
|
+
if fallback is not None:
|
|
300
|
+
raise ValueError("fallback is only supported in Pydantic v2")
|
|
298
301
|
dumped = super().dict( # pyright: ignore[reportDeprecated]
|
|
299
302
|
include=include,
|
|
300
303
|
exclude=exclude,
|
|
301
|
-
by_alias=by_alias,
|
|
304
|
+
by_alias=by_alias if by_alias is not None else False,
|
|
302
305
|
exclude_unset=exclude_unset,
|
|
303
306
|
exclude_defaults=exclude_defaults,
|
|
304
307
|
exclude_none=exclude_none,
|
|
@@ -313,13 +316,14 @@ class BaseModel(pydantic.BaseModel):
|
|
|
313
316
|
indent: int | None = None,
|
|
314
317
|
include: IncEx | None = None,
|
|
315
318
|
exclude: IncEx | None = None,
|
|
316
|
-
by_alias: bool =
|
|
319
|
+
by_alias: bool | None = None,
|
|
317
320
|
exclude_unset: bool = False,
|
|
318
321
|
exclude_defaults: bool = False,
|
|
319
322
|
exclude_none: bool = False,
|
|
320
323
|
round_trip: bool = False,
|
|
321
324
|
warnings: bool | Literal["none", "warn", "error"] = True,
|
|
322
325
|
context: dict[str, Any] | None = None,
|
|
326
|
+
fallback: Callable[[Any], Any] | None = None,
|
|
323
327
|
serialize_as_any: bool = False,
|
|
324
328
|
) -> str:
|
|
325
329
|
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json
|
|
@@ -348,11 +352,13 @@ class BaseModel(pydantic.BaseModel):
|
|
|
348
352
|
raise ValueError("context is only supported in Pydantic v2")
|
|
349
353
|
if serialize_as_any != False:
|
|
350
354
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
355
|
+
if fallback is not None:
|
|
356
|
+
raise ValueError("fallback is only supported in Pydantic v2")
|
|
351
357
|
return super().json( # type: ignore[reportDeprecated]
|
|
352
358
|
indent=indent,
|
|
353
359
|
include=include,
|
|
354
360
|
exclude=exclude,
|
|
355
|
-
by_alias=by_alias,
|
|
361
|
+
by_alias=by_alias if by_alias is not None else False,
|
|
356
362
|
exclude_unset=exclude_unset,
|
|
357
363
|
exclude_defaults=exclude_defaults,
|
|
358
364
|
exclude_none=exclude_none,
|