supermemory 3.0.0a24__tar.gz → 3.0.0a26__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.0a26/.release-please-manifest.json +3 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/CHANGELOG.md +23 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/PKG-INFO +37 -4
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/README.md +36 -3
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/api.md +5 -1
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/pyproject.toml +1 -1
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_files.py +1 -1
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_version.py +1 -1
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/resources/memories.py +107 -4
- supermemory-3.0.0a26/src/supermemory/resources/search.py +664 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/__init__.py +6 -0
- supermemory-3.0.0a26/src/supermemory/types/memory_upload_file_params.py +16 -0
- supermemory-3.0.0a26/src/supermemory/types/memory_upload_file_response.py +11 -0
- supermemory-3.0.0a26/src/supermemory/types/search_documents_params.py +93 -0
- supermemory-3.0.0a26/src/supermemory/types/search_documents_response.py +61 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/search_execute_response.py +3 -0
- supermemory-3.0.0a26/src/supermemory/types/search_memories_params.py +66 -0
- supermemory-3.0.0a26/src/supermemory/types/search_memories_response.py +121 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/api_resources/test_connections.py +60 -60
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/api_resources/test_memories.py +129 -42
- supermemory-3.0.0a26/tests/api_resources/test_search.py +446 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/api_resources/test_settings.py +14 -14
- supermemory-3.0.0a24/.release-please-manifest.json +0 -3
- supermemory-3.0.0a24/src/supermemory/resources/search.py +0 -300
- supermemory-3.0.0a24/tests/api_resources/test_search.py +0 -164
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/.gitignore +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/CONTRIBUTING.md +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/LICENSE +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/SECURITY.md +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/bin/check-release-environment +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/bin/publish-pypi +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/examples/.keep +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/mypy.ini +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/noxfile.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/release-please-config.json +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/requirements-dev.lock +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/requirements.lock +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/__init__.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_base_client.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_client.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_compat.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_constants.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_exceptions.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_models.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_qs.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_resource.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_streaming.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_types.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_utils/__init__.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_utils/_logs.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_utils/_proxy.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_utils/_reflection.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_utils/_resources_proxy.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_utils/_streams.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_utils/_sync.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_utils/_transform.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_utils/_typing.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/_utils/_utils.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/lib/.keep +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/py.typed +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/resources/__init__.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/resources/connections.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/resources/settings.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_create_params.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_create_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_delete_by_id_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_delete_by_provider_params.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_delete_by_provider_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_get_by_id_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_get_by_tags_params.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_get_by_tags_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_import_params.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_list_documents_params.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_list_documents_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_list_params.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/connection_list_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/memory_add_params.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/memory_add_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/memory_get_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/memory_list_params.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/memory_list_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/memory_update_params.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/memory_update_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/search_execute_params.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/setting_get_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/setting_update_params.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory/types/setting_update_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/src/supermemory_new/lib/.keep +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/__init__.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/api_resources/__init__.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/conftest.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/sample_file.txt +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/test_client.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/test_deepcopy.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/test_extract_files.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/test_files.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/test_models.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/test_qs.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/test_required_args.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/test_response.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/test_streaming.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/test_transform.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/test_utils/test_proxy.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/test_utils/test_typing.py +0 -0
- {supermemory-3.0.0a24 → supermemory-3.0.0a26}/tests/utils.py +0 -0
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.0.0-alpha.26 (2025-08-15)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v3.0.0-alpha.25...v3.0.0-alpha.26](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.25...v3.0.0-alpha.26)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** manual updates ([c2623b2](https://github.com/supermemoryai/python-sdk/commit/c2623b2b645eefd7e2cbb5027eb5a46cee7b62eb))
|
|
10
|
+
* **api:** manual updates ([9e373ef](https://github.com/supermemoryai/python-sdk/commit/9e373ef0b585eb15cb04b95a1bab46c8c102970c))
|
|
11
|
+
* **api:** manual updates ([fa75aff](https://github.com/supermemoryai/python-sdk/commit/fa75affffb701259be14445da95c77a1cdde512b))
|
|
12
|
+
|
|
13
|
+
## 3.0.0-alpha.25 (2025-08-15)
|
|
14
|
+
|
|
15
|
+
Full Changelog: [v3.0.0-alpha.24...v3.0.0-alpha.25](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.24...v3.0.0-alpha.25)
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **api:** api update ([9bfc023](https://github.com/supermemoryai/python-sdk/commit/9bfc023373df244fa4d45c12ad31fe5ca2bddc8b))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Chores
|
|
23
|
+
|
|
24
|
+
* **internal:** codegen related update ([8df15a7](https://github.com/supermemoryai/python-sdk/commit/8df15a767ca5007ee34b4b7b1bc39e1961203c80))
|
|
25
|
+
|
|
3
26
|
## 3.0.0-alpha.24 (2025-08-10)
|
|
4
27
|
|
|
5
28
|
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)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: supermemory
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.0a26
|
|
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
|
|
@@ -67,7 +67,7 @@ client = Supermemory(
|
|
|
67
67
|
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
|
68
68
|
)
|
|
69
69
|
|
|
70
|
-
response = client.search.
|
|
70
|
+
response = client.search.documents(
|
|
71
71
|
q="documents related to python",
|
|
72
72
|
)
|
|
73
73
|
print(response.results)
|
|
@@ -93,7 +93,7 @@ client = AsyncSupermemory(
|
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
async def main() -> None:
|
|
96
|
-
response = await client.search.
|
|
96
|
+
response = await client.search.documents(
|
|
97
97
|
q="documents related to python",
|
|
98
98
|
)
|
|
99
99
|
print(response.results)
|
|
@@ -128,7 +128,7 @@ async def main() -> None:
|
|
|
128
128
|
api_key="My API Key",
|
|
129
129
|
http_client=DefaultAioHttpClient(),
|
|
130
130
|
) as client:
|
|
131
|
-
response = await client.search.
|
|
131
|
+
response = await client.search.documents(
|
|
132
132
|
q="documents related to python",
|
|
133
133
|
)
|
|
134
134
|
print(response.results)
|
|
@@ -146,6 +146,39 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
|
|
|
146
146
|
|
|
147
147
|
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
|
|
148
148
|
|
|
149
|
+
## Nested params
|
|
150
|
+
|
|
151
|
+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
from supermemory import Supermemory
|
|
155
|
+
|
|
156
|
+
client = Supermemory()
|
|
157
|
+
|
|
158
|
+
response = client.search.memories(
|
|
159
|
+
q="machine learning concepts",
|
|
160
|
+
include={},
|
|
161
|
+
)
|
|
162
|
+
print(response.include)
|
|
163
|
+
```
|
|
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
|
+
|
|
149
182
|
## Handling errors
|
|
150
183
|
|
|
151
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.
|
|
@@ -32,7 +32,7 @@ client = Supermemory(
|
|
|
32
32
|
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
-
response = client.search.
|
|
35
|
+
response = client.search.documents(
|
|
36
36
|
q="documents related to python",
|
|
37
37
|
)
|
|
38
38
|
print(response.results)
|
|
@@ -58,7 +58,7 @@ client = AsyncSupermemory(
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
async def main() -> None:
|
|
61
|
-
response = await client.search.
|
|
61
|
+
response = await client.search.documents(
|
|
62
62
|
q="documents related to python",
|
|
63
63
|
)
|
|
64
64
|
print(response.results)
|
|
@@ -93,7 +93,7 @@ async def main() -> None:
|
|
|
93
93
|
api_key="My API Key",
|
|
94
94
|
http_client=DefaultAioHttpClient(),
|
|
95
95
|
) as client:
|
|
96
|
-
response = await client.search.
|
|
96
|
+
response = await client.search.documents(
|
|
97
97
|
q="documents related to python",
|
|
98
98
|
)
|
|
99
99
|
print(response.results)
|
|
@@ -111,6 +111,39 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
|
|
|
111
111
|
|
|
112
112
|
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
|
|
113
113
|
|
|
114
|
+
## Nested params
|
|
115
|
+
|
|
116
|
+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from supermemory import Supermemory
|
|
120
|
+
|
|
121
|
+
client = Supermemory()
|
|
122
|
+
|
|
123
|
+
response = client.search.memories(
|
|
124
|
+
q="machine learning concepts",
|
|
125
|
+
include={},
|
|
126
|
+
)
|
|
127
|
+
print(response.include)
|
|
128
|
+
```
|
|
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
|
+
|
|
114
147
|
## Handling errors
|
|
115
148
|
|
|
116
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.
|
|
@@ -8,6 +8,7 @@ from supermemory.types import (
|
|
|
8
8
|
MemoryListResponse,
|
|
9
9
|
MemoryAddResponse,
|
|
10
10
|
MemoryGetResponse,
|
|
11
|
+
MemoryUploadFileResponse,
|
|
11
12
|
)
|
|
12
13
|
```
|
|
13
14
|
|
|
@@ -18,18 +19,21 @@ Methods:
|
|
|
18
19
|
- <code title="delete /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">delete</a>(id) -> None</code>
|
|
19
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>
|
|
20
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>
|
|
21
23
|
|
|
22
24
|
# Search
|
|
23
25
|
|
|
24
26
|
Types:
|
|
25
27
|
|
|
26
28
|
```python
|
|
27
|
-
from supermemory.types import SearchExecuteResponse
|
|
29
|
+
from supermemory.types import SearchDocumentsResponse, SearchExecuteResponse, SearchMemoriesResponse
|
|
28
30
|
```
|
|
29
31
|
|
|
30
32
|
Methods:
|
|
31
33
|
|
|
34
|
+
- <code title="post /v3/search">client.search.<a href="./src/supermemory/resources/search.py">documents</a>(\*\*<a href="src/supermemory/types/search_documents_params.py">params</a>) -> <a href="./src/supermemory/types/search_documents_response.py">SearchDocumentsResponse</a></code>
|
|
32
35
|
- <code title="post /v3/search">client.search.<a href="./src/supermemory/resources/search.py">execute</a>(\*\*<a href="src/supermemory/types/search_execute_params.py">params</a>) -> <a href="./src/supermemory/types/search_execute_response.py">SearchExecuteResponse</a></code>
|
|
36
|
+
- <code title="post /v4/search">client.search.<a href="./src/supermemory/resources/search.py">memories</a>(\*\*<a href="src/supermemory/types/search_memories_params.py">params</a>) -> <a href="./src/supermemory/types/search_memories_response.py">SearchMemoriesResponse</a></code>
|
|
33
37
|
|
|
34
38
|
# Settings
|
|
35
39
|
|
|
@@ -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
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict, List, Union
|
|
5
|
+
from typing import Dict, List, Union, Mapping, cast
|
|
6
6
|
from typing_extensions import Literal
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
|
-
from ..types import memory_add_params, memory_list_params, memory_update_params
|
|
11
|
-
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
|
12
|
-
from .._utils import maybe_transform, async_maybe_transform
|
|
10
|
+
from ..types import memory_add_params, memory_list_params, memory_update_params, memory_upload_file_params
|
|
11
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes
|
|
12
|
+
from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
|
|
13
13
|
from .._compat import cached_property
|
|
14
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
15
|
from .._response import (
|
|
@@ -23,6 +23,7 @@ from ..types.memory_add_response import MemoryAddResponse
|
|
|
23
23
|
from ..types.memory_get_response import MemoryGetResponse
|
|
24
24
|
from ..types.memory_list_response import MemoryListResponse
|
|
25
25
|
from ..types.memory_update_response import MemoryUpdateResponse
|
|
26
|
+
from ..types.memory_upload_file_response import MemoryUploadFileResponse
|
|
26
27
|
|
|
27
28
|
__all__ = ["MemoriesResource", "AsyncMemoriesResource"]
|
|
28
29
|
|
|
@@ -305,6 +306,51 @@ class MemoriesResource(SyncAPIResource):
|
|
|
305
306
|
cast_to=MemoryGetResponse,
|
|
306
307
|
)
|
|
307
308
|
|
|
309
|
+
def upload_file(
|
|
310
|
+
self,
|
|
311
|
+
*,
|
|
312
|
+
file: FileTypes,
|
|
313
|
+
container_tags: str | NotGiven = NOT_GIVEN,
|
|
314
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
315
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
316
|
+
extra_headers: Headers | None = None,
|
|
317
|
+
extra_query: Query | None = None,
|
|
318
|
+
extra_body: Body | None = None,
|
|
319
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
320
|
+
) -> MemoryUploadFileResponse:
|
|
321
|
+
"""
|
|
322
|
+
Upload a file to be processed
|
|
323
|
+
|
|
324
|
+
Args:
|
|
325
|
+
extra_headers: Send extra headers
|
|
326
|
+
|
|
327
|
+
extra_query: Add additional query parameters to the request
|
|
328
|
+
|
|
329
|
+
extra_body: Add additional JSON properties to the request
|
|
330
|
+
|
|
331
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
332
|
+
"""
|
|
333
|
+
body = deepcopy_minimal(
|
|
334
|
+
{
|
|
335
|
+
"file": file,
|
|
336
|
+
"container_tags": container_tags,
|
|
337
|
+
}
|
|
338
|
+
)
|
|
339
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
|
340
|
+
# It should be noted that the actual Content-Type header that will be
|
|
341
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
342
|
+
# multipart/form-data; boundary=---abc--
|
|
343
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
344
|
+
return self._post(
|
|
345
|
+
"/v3/memories/file",
|
|
346
|
+
body=maybe_transform(body, memory_upload_file_params.MemoryUploadFileParams),
|
|
347
|
+
files=files,
|
|
348
|
+
options=make_request_options(
|
|
349
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
350
|
+
),
|
|
351
|
+
cast_to=MemoryUploadFileResponse,
|
|
352
|
+
)
|
|
353
|
+
|
|
308
354
|
|
|
309
355
|
class AsyncMemoriesResource(AsyncAPIResource):
|
|
310
356
|
@cached_property
|
|
@@ -584,6 +630,51 @@ class AsyncMemoriesResource(AsyncAPIResource):
|
|
|
584
630
|
cast_to=MemoryGetResponse,
|
|
585
631
|
)
|
|
586
632
|
|
|
633
|
+
async def upload_file(
|
|
634
|
+
self,
|
|
635
|
+
*,
|
|
636
|
+
file: FileTypes,
|
|
637
|
+
container_tags: str | NotGiven = NOT_GIVEN,
|
|
638
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
639
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
640
|
+
extra_headers: Headers | None = None,
|
|
641
|
+
extra_query: Query | None = None,
|
|
642
|
+
extra_body: Body | None = None,
|
|
643
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
644
|
+
) -> MemoryUploadFileResponse:
|
|
645
|
+
"""
|
|
646
|
+
Upload a file to be processed
|
|
647
|
+
|
|
648
|
+
Args:
|
|
649
|
+
extra_headers: Send extra headers
|
|
650
|
+
|
|
651
|
+
extra_query: Add additional query parameters to the request
|
|
652
|
+
|
|
653
|
+
extra_body: Add additional JSON properties to the request
|
|
654
|
+
|
|
655
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
656
|
+
"""
|
|
657
|
+
body = deepcopy_minimal(
|
|
658
|
+
{
|
|
659
|
+
"file": file,
|
|
660
|
+
"container_tags": container_tags,
|
|
661
|
+
}
|
|
662
|
+
)
|
|
663
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
|
664
|
+
# It should be noted that the actual Content-Type header that will be
|
|
665
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
666
|
+
# multipart/form-data; boundary=---abc--
|
|
667
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
668
|
+
return await self._post(
|
|
669
|
+
"/v3/memories/file",
|
|
670
|
+
body=await async_maybe_transform(body, memory_upload_file_params.MemoryUploadFileParams),
|
|
671
|
+
files=files,
|
|
672
|
+
options=make_request_options(
|
|
673
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
674
|
+
),
|
|
675
|
+
cast_to=MemoryUploadFileResponse,
|
|
676
|
+
)
|
|
677
|
+
|
|
587
678
|
|
|
588
679
|
class MemoriesResourceWithRawResponse:
|
|
589
680
|
def __init__(self, memories: MemoriesResource) -> None:
|
|
@@ -604,6 +695,9 @@ class MemoriesResourceWithRawResponse:
|
|
|
604
695
|
self.get = to_raw_response_wrapper(
|
|
605
696
|
memories.get,
|
|
606
697
|
)
|
|
698
|
+
self.upload_file = to_raw_response_wrapper(
|
|
699
|
+
memories.upload_file,
|
|
700
|
+
)
|
|
607
701
|
|
|
608
702
|
|
|
609
703
|
class AsyncMemoriesResourceWithRawResponse:
|
|
@@ -625,6 +719,9 @@ class AsyncMemoriesResourceWithRawResponse:
|
|
|
625
719
|
self.get = async_to_raw_response_wrapper(
|
|
626
720
|
memories.get,
|
|
627
721
|
)
|
|
722
|
+
self.upload_file = async_to_raw_response_wrapper(
|
|
723
|
+
memories.upload_file,
|
|
724
|
+
)
|
|
628
725
|
|
|
629
726
|
|
|
630
727
|
class MemoriesResourceWithStreamingResponse:
|
|
@@ -646,6 +743,9 @@ class MemoriesResourceWithStreamingResponse:
|
|
|
646
743
|
self.get = to_streamed_response_wrapper(
|
|
647
744
|
memories.get,
|
|
648
745
|
)
|
|
746
|
+
self.upload_file = to_streamed_response_wrapper(
|
|
747
|
+
memories.upload_file,
|
|
748
|
+
)
|
|
649
749
|
|
|
650
750
|
|
|
651
751
|
class AsyncMemoriesResourceWithStreamingResponse:
|
|
@@ -667,3 +767,6 @@ class AsyncMemoriesResourceWithStreamingResponse:
|
|
|
667
767
|
self.get = async_to_streamed_response_wrapper(
|
|
668
768
|
memories.get,
|
|
669
769
|
)
|
|
770
|
+
self.upload_file = async_to_streamed_response_wrapper(
|
|
771
|
+
memories.upload_file,
|
|
772
|
+
)
|