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