supermemory 3.0.0a22__tar.gz → 3.0.0a24__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.0a22 → supermemory-3.0.0a24}/.gitignore +0 -1
- supermemory-3.0.0a24/.release-please-manifest.json +3 -0
- supermemory-3.0.0a24/CHANGELOG.md +101 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/PKG-INFO +11 -20
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/README.md +8 -18
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/pyproject.toml +4 -3
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/requirements-dev.lock +3 -3
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/requirements.lock +3 -3
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_base_client.py +12 -2
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_files.py +4 -4
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_models.py +31 -7
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_version.py +1 -1
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/resources/memories.py +22 -22
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_get_by_id_response.py +3 -2
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_get_by_tags_response.py +3 -2
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_list_response.py +3 -2
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/memory_add_params.py +9 -9
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/memory_get_response.py +9 -3
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/memory_update_params.py +9 -9
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/search_execute_response.py +3 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/api_resources/test_memories.py +10 -30
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/test_client.py +12 -36
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/test_models.py +73 -1
- supermemory-3.0.0a22/.release-please-manifest.json +0 -3
- supermemory-3.0.0a22/CHANGELOG.md +0 -51
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/CONTRIBUTING.md +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/LICENSE +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/SECURITY.md +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/api.md +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/bin/check-release-environment +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/bin/publish-pypi +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/examples/.keep +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/mypy.ini +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/noxfile.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/release-please-config.json +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/__init__.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_client.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_compat.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_constants.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_exceptions.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_qs.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_resource.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_response.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_streaming.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_types.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_utils/__init__.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_utils/_logs.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_utils/_proxy.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_utils/_reflection.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_utils/_resources_proxy.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_utils/_streams.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_utils/_sync.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_utils/_transform.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_utils/_typing.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/_utils/_utils.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/lib/.keep +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/py.typed +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/resources/__init__.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/resources/connections.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/resources/search.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/resources/settings.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/__init__.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_create_params.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_create_response.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_delete_by_id_response.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_delete_by_provider_params.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_delete_by_provider_response.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_get_by_tags_params.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_import_params.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_list_documents_params.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_list_documents_response.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/connection_list_params.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/memory_add_response.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/memory_list_params.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/memory_list_response.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/memory_update_response.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/search_execute_params.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/setting_get_response.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/setting_update_params.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory/types/setting_update_response.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/src/supermemory_new/lib/.keep +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/__init__.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/api_resources/__init__.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/api_resources/test_connections.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/api_resources/test_search.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/api_resources/test_settings.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/conftest.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/sample_file.txt +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/test_deepcopy.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/test_extract_files.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/test_files.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/test_qs.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/test_required_args.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/test_response.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/test_streaming.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/test_transform.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/test_utils/test_proxy.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/test_utils/test_typing.py +0 -0
- {supermemory-3.0.0a22 → supermemory-3.0.0a24}/tests/utils.py +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 3.0.0-alpha.24 (2025-08-10)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v3.0.0-alpha.23...v3.0.0-alpha.24](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.23...v3.0.0-alpha.24)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([4aacfa8](https://github.com/supermemoryai/python-sdk/commit/4aacfa8f2e35f50ab9ac01c4ae9b5086b8dc2230))
|
|
10
|
+
* **api:** api update ([9fe90d9](https://github.com/supermemoryai/python-sdk/commit/9fe90d99035348910c215cb196a27390b7c595d3))
|
|
11
|
+
* **api:** api update ([f9c7013](https://github.com/supermemoryai/python-sdk/commit/f9c70137f404d7638d6e77dbf360a276877a55a5))
|
|
12
|
+
* **api:** api update ([125afc9](https://github.com/supermemoryai/python-sdk/commit/125afc957cab83c2a0c75ba003479b09e5e0f63c))
|
|
13
|
+
* **api:** api update ([04b249d](https://github.com/supermemoryai/python-sdk/commit/04b249d0a09d2fcbd8aecd08bcfc6ff89673fb75))
|
|
14
|
+
* **client:** support file upload requests ([b6c42b1](https://github.com/supermemoryai/python-sdk/commit/b6c42b10e8412ccc5dbbed23d86c36598319df00))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **parsing:** ignore empty metadata ([a58758c](https://github.com/supermemoryai/python-sdk/commit/a58758ce1f1ae0c87d0fa3bea43367bb2d198891))
|
|
20
|
+
* **parsing:** parse extra field types ([5253128](https://github.com/supermemoryai/python-sdk/commit/5253128de66dc303f8c9e4d295f133f24f770d95))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Chores
|
|
24
|
+
|
|
25
|
+
* **internal:** fix ruff target version ([25adc14](https://github.com/supermemoryai/python-sdk/commit/25adc1412380631fa8ce53034b519e819b45dec3))
|
|
26
|
+
* **internal:** update comment in script ([8fc31e8](https://github.com/supermemoryai/python-sdk/commit/8fc31e8cb2058d8bb4da67c5aebbac421474c3b8))
|
|
27
|
+
* **project:** add settings file for vscode ([2327687](https://github.com/supermemoryai/python-sdk/commit/232768766d49d14af45667f08ad66b890cc6a230))
|
|
28
|
+
* update @stainless-api/prism-cli to v5.15.0 ([7f4ff8b](https://github.com/supermemoryai/python-sdk/commit/7f4ff8b2712055be8a6100a2c132b514cf7e2e6d))
|
|
29
|
+
|
|
30
|
+
## 3.0.0-alpha.23 (2025-07-15)
|
|
31
|
+
|
|
32
|
+
Full Changelog: [v3.0.0-alpha.22...v3.0.0-alpha.23](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.22...v3.0.0-alpha.23)
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* **api:** api update ([3f71f60](https://github.com/supermemoryai/python-sdk/commit/3f71f60954dedc0a91e1859df48c5c3ca0a47c88))
|
|
37
|
+
* **api:** api update ([b614732](https://github.com/supermemoryai/python-sdk/commit/b61473253183d434613b0aeb631376262d22cb0c))
|
|
38
|
+
* clean up environment call outs ([4aaccf1](https://github.com/supermemoryai/python-sdk/commit/4aaccf17ae31c04f3097fe04a6a081171fc725d1))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* **client:** don't send Content-Type header on GET requests ([80480dd](https://github.com/supermemoryai/python-sdk/commit/80480dd46271dc5136f39c5ff1315555b8d51e31))
|
|
44
|
+
* **parsing:** correctly handle nested discriminated unions ([812e982](https://github.com/supermemoryai/python-sdk/commit/812e982cbba93e197d4cd3cf8bdfa710e7830a78))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Chores
|
|
48
|
+
|
|
49
|
+
* **internal:** bump pinned h11 dep ([9e822a1](https://github.com/supermemoryai/python-sdk/commit/9e822a16ce8cf30791abf6384e2e3205233eeaba))
|
|
50
|
+
* **package:** mark python 3.13 as supported ([2dc73dd](https://github.com/supermemoryai/python-sdk/commit/2dc73dd51ac30fa4d6b2d370b7411857518c1ddd))
|
|
51
|
+
* **readme:** fix version rendering on pypi ([a6d7d7a](https://github.com/supermemoryai/python-sdk/commit/a6d7d7a100680cfaa03138542f60b7b7407ad347))
|
|
52
|
+
|
|
53
|
+
## 3.0.0-alpha.22 (2025-07-03)
|
|
54
|
+
|
|
55
|
+
Full Changelog: [v3.0.0-alpha.21...v3.0.0-alpha.22](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.21...v3.0.0-alpha.22)
|
|
56
|
+
|
|
57
|
+
### Features
|
|
58
|
+
|
|
59
|
+
* **api:** manual updates ([2a863a1](https://github.com/supermemoryai/python-sdk/commit/2a863a166b5c39208ef910d84530a27898ed0c71))
|
|
60
|
+
|
|
61
|
+
## 3.0.0-alpha.21 (2025-07-03)
|
|
62
|
+
|
|
63
|
+
Full Changelog: [v3.0.0-alpha.20...v3.0.0-alpha.21](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.20...v3.0.0-alpha.21)
|
|
64
|
+
|
|
65
|
+
### Features
|
|
66
|
+
|
|
67
|
+
* **api:** api update ([8b94b9e](https://github.com/supermemoryai/python-sdk/commit/8b94b9e043564f8daf605289683270dba97ca323))
|
|
68
|
+
* **api:** api update ([7b7eda7](https://github.com/supermemoryai/python-sdk/commit/7b7eda703a9d3dcf9b235a5045829c69147240c6))
|
|
69
|
+
* **api:** manual updates ([e7bfa6e](https://github.com/supermemoryai/python-sdk/commit/e7bfa6ef5804b758d3da98206ee643f9ae44ce0a))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### Bug Fixes
|
|
73
|
+
|
|
74
|
+
* **ci:** correct conditional ([0b20719](https://github.com/supermemoryai/python-sdk/commit/0b20719ce022a872dd7334587317235b7a5562c3))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Chores
|
|
78
|
+
|
|
79
|
+
* **ci:** change upload type ([38f5701](https://github.com/supermemoryai/python-sdk/commit/38f5701dff0cc09b4a42d1c86e6250ed4695783d))
|
|
80
|
+
* **ci:** only run for pushes and fork pull requests ([901a43c](https://github.com/supermemoryai/python-sdk/commit/901a43c0c06fb8ed2ee2cfc3c56d44002b108a06))
|
|
81
|
+
* **internal:** codegen related update ([9c82bc7](https://github.com/supermemoryai/python-sdk/commit/9c82bc7c2fff3e85ec8a8d3278b04741bedaf7d3))
|
|
82
|
+
|
|
83
|
+
## 3.0.0-alpha.20 (2025-06-27)
|
|
84
|
+
|
|
85
|
+
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)
|
|
86
|
+
|
|
87
|
+
### Features
|
|
88
|
+
|
|
89
|
+
* **api:** api update ([3c35763](https://github.com/supermemoryai/python-sdk/commit/3c357637aab2e68e3a80e33b9f721c3a8182483a))
|
|
90
|
+
* **api:** api update ([08ffef9](https://github.com/supermemoryai/python-sdk/commit/08ffef95b8f7be8ce8a57ba2fe2761653cd42e5d))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
### Bug Fixes
|
|
94
|
+
|
|
95
|
+
* **ci:** release-doctor — report correct token name ([dadfa9f](https://github.com/supermemoryai/python-sdk/commit/dadfa9f74851fc81e5af92e47c41115bee87aad7))
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Chores
|
|
99
|
+
|
|
100
|
+
* sync repo ([380252a](https://github.com/supermemoryai/python-sdk/commit/380252a9cb2d9c723b5c6b36a33573c462e48049))
|
|
101
|
+
* update SDK settings ([8c6f297](https://github.com/supermemoryai/python-sdk/commit/8c6f297fc2b8f7a6b600205a5c313767a99612cb))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: supermemory
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.0a24
|
|
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
|
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
23
|
Classifier: Typing :: Typed
|
|
23
24
|
Requires-Python: >=3.8
|
|
@@ -29,12 +30,13 @@ Requires-Dist: sniffio
|
|
|
29
30
|
Requires-Dist: typing-extensions<5,>=4.10
|
|
30
31
|
Provides-Extra: aiohttp
|
|
31
32
|
Requires-Dist: aiohttp; extra == 'aiohttp'
|
|
32
|
-
Requires-Dist: httpx-aiohttp>=0.1.
|
|
33
|
+
Requires-Dist: httpx-aiohttp>=0.1.8; extra == 'aiohttp'
|
|
33
34
|
Description-Content-Type: text/markdown
|
|
34
35
|
|
|
35
36
|
# Supermemory Python API library
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
<!-- prettier-ignore -->
|
|
39
|
+
[)](https://pypi.org/project/supermemory/)
|
|
38
40
|
|
|
39
41
|
The Supermemory Python library provides convenient access to the Supermemory REST API from any Python 3.8+
|
|
40
42
|
application. The library includes type definitions for all request params and response fields,
|
|
@@ -116,7 +118,6 @@ pip install --pre supermemory[aiohttp]
|
|
|
116
118
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
117
119
|
|
|
118
120
|
```python
|
|
119
|
-
import os
|
|
120
121
|
import asyncio
|
|
121
122
|
from supermemory import DefaultAioHttpClient
|
|
122
123
|
from supermemory import AsyncSupermemory
|
|
@@ -124,7 +125,7 @@ from supermemory import AsyncSupermemory
|
|
|
124
125
|
|
|
125
126
|
async def main() -> None:
|
|
126
127
|
async with AsyncSupermemory(
|
|
127
|
-
api_key=
|
|
128
|
+
api_key="My API Key",
|
|
128
129
|
http_client=DefaultAioHttpClient(),
|
|
129
130
|
) as client:
|
|
130
131
|
response = await client.search.execute(
|
|
@@ -161,9 +162,7 @@ from supermemory import Supermemory
|
|
|
161
162
|
client = Supermemory()
|
|
162
163
|
|
|
163
164
|
try:
|
|
164
|
-
client.memories.add(
|
|
165
|
-
content="This is a detailed article about machine learning concepts...",
|
|
166
|
-
)
|
|
165
|
+
client.memories.add()
|
|
167
166
|
except supermemory.APIConnectionError as e:
|
|
168
167
|
print("The server could not be reached")
|
|
169
168
|
print(e.__cause__) # an underlying Exception, likely raised within httpx.
|
|
@@ -206,9 +205,7 @@ client = Supermemory(
|
|
|
206
205
|
)
|
|
207
206
|
|
|
208
207
|
# Or, configure per-request:
|
|
209
|
-
client.with_options(max_retries=5).memories.add(
|
|
210
|
-
content="This is a detailed article about machine learning concepts...",
|
|
211
|
-
)
|
|
208
|
+
client.with_options(max_retries=5).memories.add()
|
|
212
209
|
```
|
|
213
210
|
|
|
214
211
|
### Timeouts
|
|
@@ -231,9 +228,7 @@ client = Supermemory(
|
|
|
231
228
|
)
|
|
232
229
|
|
|
233
230
|
# Override per-request:
|
|
234
|
-
client.with_options(timeout=5.0).memories.add(
|
|
235
|
-
content="This is a detailed article about machine learning concepts...",
|
|
236
|
-
)
|
|
231
|
+
client.with_options(timeout=5.0).memories.add()
|
|
237
232
|
```
|
|
238
233
|
|
|
239
234
|
On timeout, an `APITimeoutError` is thrown.
|
|
@@ -274,9 +269,7 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
274
269
|
from supermemory import Supermemory
|
|
275
270
|
|
|
276
271
|
client = Supermemory()
|
|
277
|
-
response = client.memories.with_raw_response.add(
|
|
278
|
-
content="This is a detailed article about machine learning concepts...",
|
|
279
|
-
)
|
|
272
|
+
response = client.memories.with_raw_response.add()
|
|
280
273
|
print(response.headers.get('X-My-Header'))
|
|
281
274
|
|
|
282
275
|
memory = response.parse() # get the object that `memories.add()` would have returned
|
|
@@ -294,9 +287,7 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
294
287
|
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.
|
|
295
288
|
|
|
296
289
|
```python
|
|
297
|
-
with client.memories.with_streaming_response.add(
|
|
298
|
-
content="This is a detailed article about machine learning concepts...",
|
|
299
|
-
) as response:
|
|
290
|
+
with client.memories.with_streaming_response.add() as response:
|
|
300
291
|
print(response.headers.get("X-My-Header"))
|
|
301
292
|
|
|
302
293
|
for line in response.iter_lines():
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Supermemory Python API library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<!-- prettier-ignore -->
|
|
4
|
+
[)](https://pypi.org/project/supermemory/)
|
|
4
5
|
|
|
5
6
|
The Supermemory Python library provides convenient access to the Supermemory REST API from any Python 3.8+
|
|
6
7
|
application. The library includes type definitions for all request params and response fields,
|
|
@@ -82,7 +83,6 @@ pip install --pre supermemory[aiohttp]
|
|
|
82
83
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
83
84
|
|
|
84
85
|
```python
|
|
85
|
-
import os
|
|
86
86
|
import asyncio
|
|
87
87
|
from supermemory import DefaultAioHttpClient
|
|
88
88
|
from supermemory import AsyncSupermemory
|
|
@@ -90,7 +90,7 @@ from supermemory import AsyncSupermemory
|
|
|
90
90
|
|
|
91
91
|
async def main() -> None:
|
|
92
92
|
async with AsyncSupermemory(
|
|
93
|
-
api_key=
|
|
93
|
+
api_key="My API Key",
|
|
94
94
|
http_client=DefaultAioHttpClient(),
|
|
95
95
|
) as client:
|
|
96
96
|
response = await client.search.execute(
|
|
@@ -127,9 +127,7 @@ from supermemory import Supermemory
|
|
|
127
127
|
client = Supermemory()
|
|
128
128
|
|
|
129
129
|
try:
|
|
130
|
-
client.memories.add(
|
|
131
|
-
content="This is a detailed article about machine learning concepts...",
|
|
132
|
-
)
|
|
130
|
+
client.memories.add()
|
|
133
131
|
except supermemory.APIConnectionError as e:
|
|
134
132
|
print("The server could not be reached")
|
|
135
133
|
print(e.__cause__) # an underlying Exception, likely raised within httpx.
|
|
@@ -172,9 +170,7 @@ client = Supermemory(
|
|
|
172
170
|
)
|
|
173
171
|
|
|
174
172
|
# Or, configure per-request:
|
|
175
|
-
client.with_options(max_retries=5).memories.add(
|
|
176
|
-
content="This is a detailed article about machine learning concepts...",
|
|
177
|
-
)
|
|
173
|
+
client.with_options(max_retries=5).memories.add()
|
|
178
174
|
```
|
|
179
175
|
|
|
180
176
|
### Timeouts
|
|
@@ -197,9 +193,7 @@ client = Supermemory(
|
|
|
197
193
|
)
|
|
198
194
|
|
|
199
195
|
# Override per-request:
|
|
200
|
-
client.with_options(timeout=5.0).memories.add(
|
|
201
|
-
content="This is a detailed article about machine learning concepts...",
|
|
202
|
-
)
|
|
196
|
+
client.with_options(timeout=5.0).memories.add()
|
|
203
197
|
```
|
|
204
198
|
|
|
205
199
|
On timeout, an `APITimeoutError` is thrown.
|
|
@@ -240,9 +234,7 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
240
234
|
from supermemory import Supermemory
|
|
241
235
|
|
|
242
236
|
client = Supermemory()
|
|
243
|
-
response = client.memories.with_raw_response.add(
|
|
244
|
-
content="This is a detailed article about machine learning concepts...",
|
|
245
|
-
)
|
|
237
|
+
response = client.memories.with_raw_response.add()
|
|
246
238
|
print(response.headers.get('X-My-Header'))
|
|
247
239
|
|
|
248
240
|
memory = response.parse() # get the object that `memories.add()` would have returned
|
|
@@ -260,9 +252,7 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
260
252
|
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.
|
|
261
253
|
|
|
262
254
|
```python
|
|
263
|
-
with client.memories.with_streaming_response.add(
|
|
264
|
-
content="This is a detailed article about machine learning concepts...",
|
|
265
|
-
) as response:
|
|
255
|
+
with client.memories.with_streaming_response.add() as response:
|
|
266
256
|
print(response.headers.get("X-My-Header"))
|
|
267
257
|
|
|
268
258
|
for line in response.iter_lines():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "supermemory"
|
|
3
|
-
version = "3.0.0-alpha.
|
|
3
|
+
version = "3.0.0-alpha.24"
|
|
4
4
|
description = "The official Python library for the supermemory API"
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -24,6 +24,7 @@ classifiers = [
|
|
|
24
24
|
"Programming Language :: Python :: 3.10",
|
|
25
25
|
"Programming Language :: Python :: 3.11",
|
|
26
26
|
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
27
28
|
"Operating System :: OS Independent",
|
|
28
29
|
"Operating System :: POSIX",
|
|
29
30
|
"Operating System :: MacOS",
|
|
@@ -38,7 +39,7 @@ Homepage = "https://github.com/supermemoryai/python-sdk"
|
|
|
38
39
|
Repository = "https://github.com/supermemoryai/python-sdk"
|
|
39
40
|
|
|
40
41
|
[project.optional-dependencies]
|
|
41
|
-
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.
|
|
42
|
+
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]
|
|
42
43
|
|
|
43
44
|
[tool.rye]
|
|
44
45
|
managed = true
|
|
@@ -158,7 +159,7 @@ reportPrivateUsage = false
|
|
|
158
159
|
[tool.ruff]
|
|
159
160
|
line-length = 120
|
|
160
161
|
output-format = "grouped"
|
|
161
|
-
target-version = "
|
|
162
|
+
target-version = "py38"
|
|
162
163
|
|
|
163
164
|
[tool.ruff.format]
|
|
164
165
|
docstring-code-format = true
|
|
@@ -48,15 +48,15 @@ filelock==3.12.4
|
|
|
48
48
|
frozenlist==1.6.2
|
|
49
49
|
# via aiohttp
|
|
50
50
|
# via aiosignal
|
|
51
|
-
h11==0.
|
|
51
|
+
h11==0.16.0
|
|
52
52
|
# via httpcore
|
|
53
|
-
httpcore==1.0.
|
|
53
|
+
httpcore==1.0.9
|
|
54
54
|
# via httpx
|
|
55
55
|
httpx==0.28.1
|
|
56
56
|
# via httpx-aiohttp
|
|
57
57
|
# via respx
|
|
58
58
|
# via supermemory
|
|
59
|
-
httpx-aiohttp==0.1.
|
|
59
|
+
httpx-aiohttp==0.1.8
|
|
60
60
|
# via supermemory
|
|
61
61
|
idna==3.4
|
|
62
62
|
# via anyio
|
|
@@ -36,14 +36,14 @@ exceptiongroup==1.2.2
|
|
|
36
36
|
frozenlist==1.6.2
|
|
37
37
|
# via aiohttp
|
|
38
38
|
# via aiosignal
|
|
39
|
-
h11==0.
|
|
39
|
+
h11==0.16.0
|
|
40
40
|
# via httpcore
|
|
41
|
-
httpcore==1.0.
|
|
41
|
+
httpcore==1.0.9
|
|
42
42
|
# via httpx
|
|
43
43
|
httpx==0.28.1
|
|
44
44
|
# via httpx-aiohttp
|
|
45
45
|
# via supermemory
|
|
46
|
-
httpx-aiohttp==0.1.
|
|
46
|
+
httpx-aiohttp==0.1.8
|
|
47
47
|
# via supermemory
|
|
48
48
|
idna==3.4
|
|
49
49
|
# via anyio
|
|
@@ -529,6 +529,18 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
529
529
|
# work around https://github.com/encode/httpx/discussions/2880
|
|
530
530
|
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
|
|
531
531
|
|
|
532
|
+
is_body_allowed = options.method.lower() != "get"
|
|
533
|
+
|
|
534
|
+
if is_body_allowed:
|
|
535
|
+
if isinstance(json_data, bytes):
|
|
536
|
+
kwargs["content"] = json_data
|
|
537
|
+
else:
|
|
538
|
+
kwargs["json"] = json_data if is_given(json_data) else None
|
|
539
|
+
kwargs["files"] = files
|
|
540
|
+
else:
|
|
541
|
+
headers.pop("Content-Type", None)
|
|
542
|
+
kwargs.pop("data", None)
|
|
543
|
+
|
|
532
544
|
# TODO: report this error to httpx
|
|
533
545
|
return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
|
|
534
546
|
headers=headers,
|
|
@@ -540,8 +552,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
540
552
|
# so that passing a `TypedDict` doesn't cause an error.
|
|
541
553
|
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
|
|
542
554
|
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
|
|
543
|
-
json=json_data if is_given(json_data) else None,
|
|
544
|
-
files=files,
|
|
545
555
|
**kwargs,
|
|
546
556
|
)
|
|
547
557
|
|
|
@@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes:
|
|
|
69
69
|
return file
|
|
70
70
|
|
|
71
71
|
if is_tuple_t(file):
|
|
72
|
-
return (file[0],
|
|
72
|
+
return (file[0], read_file_content(file[1]), *file[2:])
|
|
73
73
|
|
|
74
74
|
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
def
|
|
77
|
+
def read_file_content(file: FileContent) -> HttpxFileContent:
|
|
78
78
|
if isinstance(file, os.PathLike):
|
|
79
79
|
return pathlib.Path(file).read_bytes()
|
|
80
80
|
return file
|
|
@@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes:
|
|
|
111
111
|
return file
|
|
112
112
|
|
|
113
113
|
if is_tuple_t(file):
|
|
114
|
-
return (file[0], await
|
|
114
|
+
return (file[0], await async_read_file_content(file[1]), *file[2:])
|
|
115
115
|
|
|
116
116
|
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
async def
|
|
119
|
+
async def async_read_file_content(file: FileContent) -> HttpxFileContent:
|
|
120
120
|
if isinstance(file, os.PathLike):
|
|
121
121
|
return await anyio.Path(file).read_bytes()
|
|
122
122
|
|
|
@@ -2,9 +2,10 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
import inspect
|
|
5
|
-
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
|
|
6
6
|
from datetime import date, datetime
|
|
7
7
|
from typing_extensions import (
|
|
8
|
+
List,
|
|
8
9
|
Unpack,
|
|
9
10
|
Literal,
|
|
10
11
|
ClassVar,
|
|
@@ -207,14 +208,18 @@ class BaseModel(pydantic.BaseModel):
|
|
|
207
208
|
else:
|
|
208
209
|
fields_values[name] = field_get_default(field)
|
|
209
210
|
|
|
211
|
+
extra_field_type = _get_extra_fields_type(__cls)
|
|
212
|
+
|
|
210
213
|
_extra = {}
|
|
211
214
|
for key, value in values.items():
|
|
212
215
|
if key not in model_fields:
|
|
216
|
+
parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value
|
|
217
|
+
|
|
213
218
|
if PYDANTIC_V2:
|
|
214
|
-
_extra[key] =
|
|
219
|
+
_extra[key] = parsed
|
|
215
220
|
else:
|
|
216
221
|
_fields_set.add(key)
|
|
217
|
-
fields_values[key] =
|
|
222
|
+
fields_values[key] = parsed
|
|
218
223
|
|
|
219
224
|
object.__setattr__(m, "__dict__", fields_values)
|
|
220
225
|
|
|
@@ -366,7 +371,24 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
|
|
|
366
371
|
if type_ is None:
|
|
367
372
|
raise RuntimeError(f"Unexpected field type is None for {key}")
|
|
368
373
|
|
|
369
|
-
return construct_type(value=value, type_=type_)
|
|
374
|
+
return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None:
|
|
378
|
+
if not PYDANTIC_V2:
|
|
379
|
+
# TODO
|
|
380
|
+
return None
|
|
381
|
+
|
|
382
|
+
schema = cls.__pydantic_core_schema__
|
|
383
|
+
if schema["type"] == "model":
|
|
384
|
+
fields = schema["schema"]
|
|
385
|
+
if fields["type"] == "model-fields":
|
|
386
|
+
extras = fields.get("extras_schema")
|
|
387
|
+
if extras and "cls" in extras:
|
|
388
|
+
# mypy can't narrow the type
|
|
389
|
+
return extras["cls"] # type: ignore[no-any-return]
|
|
390
|
+
|
|
391
|
+
return None
|
|
370
392
|
|
|
371
393
|
|
|
372
394
|
def is_basemodel(type_: type) -> bool:
|
|
@@ -420,7 +442,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
|
|
|
420
442
|
return cast(_T, construct_type(value=value, type_=type_))
|
|
421
443
|
|
|
422
444
|
|
|
423
|
-
def construct_type(*, value: object, type_: object) -> object:
|
|
445
|
+
def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object:
|
|
424
446
|
"""Loose coercion to the expected type with construction of nested values.
|
|
425
447
|
|
|
426
448
|
If the given value does not match the expected type then it is returned as-is.
|
|
@@ -438,8 +460,10 @@ def construct_type(*, value: object, type_: object) -> object:
|
|
|
438
460
|
type_ = type_.__value__ # type: ignore[unreachable]
|
|
439
461
|
|
|
440
462
|
# unwrap `Annotated[T, ...]` -> `T`
|
|
441
|
-
if
|
|
442
|
-
meta: tuple[Any, ...] =
|
|
463
|
+
if metadata is not None and len(metadata) > 0:
|
|
464
|
+
meta: tuple[Any, ...] = tuple(metadata)
|
|
465
|
+
elif is_annotated_type(type_):
|
|
466
|
+
meta = get_args(type_)[1:]
|
|
443
467
|
type_ = extract_type_arg(type_, 0)
|
|
444
468
|
else:
|
|
445
469
|
meta = tuple()
|