supermemory 0.1.0a1__py3-none-any.whl → 3.0.0a2__py3-none-any.whl
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/__init__.py +7 -1
- supermemory/_base_client.py +44 -2
- supermemory/_client.py +21 -29
- supermemory/_models.py +2 -0
- supermemory/_types.py +2 -0
- supermemory/_utils/_proxy.py +4 -1
- supermemory/_utils/_resources_proxy.py +24 -0
- supermemory/_version.py +1 -1
- supermemory/resources/__init__.py +26 -40
- supermemory/resources/{connection.py → connections.py} +86 -80
- supermemory/resources/{memory.py → memories.py} +224 -176
- supermemory/resources/settings.py +102 -19
- supermemory/types/__init__.py +6 -7
- supermemory/types/connection_create_params.py +7 -2
- supermemory/types/connection_create_response.py +7 -1
- supermemory/types/connection_get_response.py +25 -0
- supermemory/types/memory_add_params.py +46 -0
- supermemory/types/{memory_create_response.py → memory_add_response.py} +2 -2
- supermemory/types/memory_get_response.py +79 -9
- supermemory/types/memory_update_params.py +46 -0
- supermemory/types/{memory_delete_response.py → memory_update_response.py} +5 -3
- supermemory/types/setting_get_response.py +45 -0
- supermemory/types/setting_update_params.py +28 -12
- supermemory/types/setting_update_response.py +31 -13
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a2.dist-info}/METADATA +52 -15
- supermemory-3.0.0a2.dist-info/RECORD +46 -0
- supermemory/resources/search.py +0 -254
- supermemory/types/memory_create_params.py +0 -23
- supermemory/types/memory_list_params.py +0 -24
- supermemory/types/memory_list_response.py +0 -59
- supermemory/types/search_execute_params.py +0 -56
- supermemory/types/search_execute_response.py +0 -52
- supermemory-0.1.0a1.dist-info/RECORD +0 -47
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a2.dist-info}/WHEEL +0 -0
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a2.dist-info}/licenses/LICENSE +0 -0
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
|
+
from typing import Dict, List, Union, Optional
|
5
6
|
from typing_extensions import Literal
|
6
7
|
|
7
8
|
import httpx
|
8
9
|
|
9
10
|
from ..types import connection_create_params
|
10
|
-
from .._types import NOT_GIVEN, Body, Query, Headers,
|
11
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
11
12
|
from .._utils import maybe_transform, async_maybe_transform
|
12
13
|
from .._compat import cached_property
|
13
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
@@ -18,36 +19,39 @@ from .._response import (
|
|
18
19
|
async_to_streamed_response_wrapper,
|
19
20
|
)
|
20
21
|
from .._base_client import make_request_options
|
22
|
+
from ..types.connection_get_response import ConnectionGetResponse
|
21
23
|
from ..types.connection_create_response import ConnectionCreateResponse
|
22
24
|
|
23
|
-
__all__ = ["
|
25
|
+
__all__ = ["ConnectionsResource", "AsyncConnectionsResource"]
|
24
26
|
|
25
27
|
|
26
|
-
class
|
28
|
+
class ConnectionsResource(SyncAPIResource):
|
27
29
|
@cached_property
|
28
|
-
def with_raw_response(self) ->
|
30
|
+
def with_raw_response(self) -> ConnectionsResourceWithRawResponse:
|
29
31
|
"""
|
30
32
|
This property can be used as a prefix for any HTTP method call to return
|
31
33
|
the raw response object instead of the parsed content.
|
32
34
|
|
33
35
|
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
34
36
|
"""
|
35
|
-
return
|
37
|
+
return ConnectionsResourceWithRawResponse(self)
|
36
38
|
|
37
39
|
@cached_property
|
38
|
-
def with_streaming_response(self) ->
|
40
|
+
def with_streaming_response(self) -> ConnectionsResourceWithStreamingResponse:
|
39
41
|
"""
|
40
42
|
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
41
43
|
|
42
44
|
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
43
45
|
"""
|
44
|
-
return
|
46
|
+
return ConnectionsResourceWithStreamingResponse(self)
|
45
47
|
|
46
48
|
def create(
|
47
49
|
self,
|
48
|
-
|
50
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
49
51
|
*,
|
50
|
-
|
52
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
53
|
+
document_limit: int | NotGiven = NOT_GIVEN,
|
54
|
+
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
51
55
|
redirect_url: str | NotGiven = NOT_GIVEN,
|
52
56
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
53
57
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
@@ -68,27 +72,26 @@ class ConnectionResource(SyncAPIResource):
|
|
68
72
|
|
69
73
|
timeout: Override the client-level default timeout for this request, in seconds
|
70
74
|
"""
|
71
|
-
if not
|
72
|
-
raise ValueError(f"Expected a non-empty value for `
|
73
|
-
return self.
|
74
|
-
f"/
|
75
|
+
if not provider:
|
76
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
77
|
+
return self._post(
|
78
|
+
f"/v3/connections/{provider}",
|
79
|
+
body=maybe_transform(
|
80
|
+
{
|
81
|
+
"container_tags": container_tags,
|
82
|
+
"document_limit": document_limit,
|
83
|
+
"metadata": metadata,
|
84
|
+
"redirect_url": redirect_url,
|
85
|
+
},
|
86
|
+
connection_create_params.ConnectionCreateParams,
|
87
|
+
),
|
75
88
|
options=make_request_options(
|
76
|
-
extra_headers=extra_headers,
|
77
|
-
extra_query=extra_query,
|
78
|
-
extra_body=extra_body,
|
79
|
-
timeout=timeout,
|
80
|
-
query=maybe_transform(
|
81
|
-
{
|
82
|
-
"id": id,
|
83
|
-
"redirect_url": redirect_url,
|
84
|
-
},
|
85
|
-
connection_create_params.ConnectionCreateParams,
|
86
|
-
),
|
89
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
87
90
|
),
|
88
91
|
cast_to=ConnectionCreateResponse,
|
89
92
|
)
|
90
93
|
|
91
|
-
def
|
94
|
+
def get(
|
92
95
|
self,
|
93
96
|
connection_id: str,
|
94
97
|
*,
|
@@ -98,8 +101,10 @@ class ConnectionResource(SyncAPIResource):
|
|
98
101
|
extra_query: Query | None = None,
|
99
102
|
extra_body: Body | None = None,
|
100
103
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
101
|
-
) ->
|
104
|
+
) -> ConnectionGetResponse:
|
102
105
|
"""
|
106
|
+
Get connection details with id
|
107
|
+
|
103
108
|
Args:
|
104
109
|
extra_headers: Send extra headers
|
105
110
|
|
@@ -111,41 +116,42 @@ class ConnectionResource(SyncAPIResource):
|
|
111
116
|
"""
|
112
117
|
if not connection_id:
|
113
118
|
raise ValueError(f"Expected a non-empty value for `connection_id` but received {connection_id!r}")
|
114
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
115
119
|
return self._get(
|
116
|
-
f"/connections/{connection_id}",
|
120
|
+
f"/v3/connections/{connection_id}",
|
117
121
|
options=make_request_options(
|
118
122
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
119
123
|
),
|
120
|
-
cast_to=
|
124
|
+
cast_to=ConnectionGetResponse,
|
121
125
|
)
|
122
126
|
|
123
127
|
|
124
|
-
class
|
128
|
+
class AsyncConnectionsResource(AsyncAPIResource):
|
125
129
|
@cached_property
|
126
|
-
def with_raw_response(self) ->
|
130
|
+
def with_raw_response(self) -> AsyncConnectionsResourceWithRawResponse:
|
127
131
|
"""
|
128
132
|
This property can be used as a prefix for any HTTP method call to return
|
129
133
|
the raw response object instead of the parsed content.
|
130
134
|
|
131
135
|
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
132
136
|
"""
|
133
|
-
return
|
137
|
+
return AsyncConnectionsResourceWithRawResponse(self)
|
134
138
|
|
135
139
|
@cached_property
|
136
|
-
def with_streaming_response(self) ->
|
140
|
+
def with_streaming_response(self) -> AsyncConnectionsResourceWithStreamingResponse:
|
137
141
|
"""
|
138
142
|
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
139
143
|
|
140
144
|
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
141
145
|
"""
|
142
|
-
return
|
146
|
+
return AsyncConnectionsResourceWithStreamingResponse(self)
|
143
147
|
|
144
148
|
async def create(
|
145
149
|
self,
|
146
|
-
|
150
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
147
151
|
*,
|
148
|
-
|
152
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
153
|
+
document_limit: int | NotGiven = NOT_GIVEN,
|
154
|
+
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
149
155
|
redirect_url: str | NotGiven = NOT_GIVEN,
|
150
156
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
151
157
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
@@ -166,27 +172,26 @@ class AsyncConnectionResource(AsyncAPIResource):
|
|
166
172
|
|
167
173
|
timeout: Override the client-level default timeout for this request, in seconds
|
168
174
|
"""
|
169
|
-
if not
|
170
|
-
raise ValueError(f"Expected a non-empty value for `
|
171
|
-
return await self.
|
172
|
-
f"/
|
175
|
+
if not provider:
|
176
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
177
|
+
return await self._post(
|
178
|
+
f"/v3/connections/{provider}",
|
179
|
+
body=await async_maybe_transform(
|
180
|
+
{
|
181
|
+
"container_tags": container_tags,
|
182
|
+
"document_limit": document_limit,
|
183
|
+
"metadata": metadata,
|
184
|
+
"redirect_url": redirect_url,
|
185
|
+
},
|
186
|
+
connection_create_params.ConnectionCreateParams,
|
187
|
+
),
|
173
188
|
options=make_request_options(
|
174
|
-
extra_headers=extra_headers,
|
175
|
-
extra_query=extra_query,
|
176
|
-
extra_body=extra_body,
|
177
|
-
timeout=timeout,
|
178
|
-
query=await async_maybe_transform(
|
179
|
-
{
|
180
|
-
"id": id,
|
181
|
-
"redirect_url": redirect_url,
|
182
|
-
},
|
183
|
-
connection_create_params.ConnectionCreateParams,
|
184
|
-
),
|
189
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
185
190
|
),
|
186
191
|
cast_to=ConnectionCreateResponse,
|
187
192
|
)
|
188
193
|
|
189
|
-
async def
|
194
|
+
async def get(
|
190
195
|
self,
|
191
196
|
connection_id: str,
|
192
197
|
*,
|
@@ -196,8 +201,10 @@ class AsyncConnectionResource(AsyncAPIResource):
|
|
196
201
|
extra_query: Query | None = None,
|
197
202
|
extra_body: Body | None = None,
|
198
203
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
199
|
-
) ->
|
204
|
+
) -> ConnectionGetResponse:
|
200
205
|
"""
|
206
|
+
Get connection details with id
|
207
|
+
|
201
208
|
Args:
|
202
209
|
extra_headers: Send extra headers
|
203
210
|
|
@@ -209,59 +216,58 @@ class AsyncConnectionResource(AsyncAPIResource):
|
|
209
216
|
"""
|
210
217
|
if not connection_id:
|
211
218
|
raise ValueError(f"Expected a non-empty value for `connection_id` but received {connection_id!r}")
|
212
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
213
219
|
return await self._get(
|
214
|
-
f"/connections/{connection_id}",
|
220
|
+
f"/v3/connections/{connection_id}",
|
215
221
|
options=make_request_options(
|
216
222
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
217
223
|
),
|
218
|
-
cast_to=
|
224
|
+
cast_to=ConnectionGetResponse,
|
219
225
|
)
|
220
226
|
|
221
227
|
|
222
|
-
class
|
223
|
-
def __init__(self,
|
224
|
-
self.
|
228
|
+
class ConnectionsResourceWithRawResponse:
|
229
|
+
def __init__(self, connections: ConnectionsResource) -> None:
|
230
|
+
self._connections = connections
|
225
231
|
|
226
232
|
self.create = to_raw_response_wrapper(
|
227
|
-
|
233
|
+
connections.create,
|
228
234
|
)
|
229
|
-
self.
|
230
|
-
|
235
|
+
self.get = to_raw_response_wrapper(
|
236
|
+
connections.get,
|
231
237
|
)
|
232
238
|
|
233
239
|
|
234
|
-
class
|
235
|
-
def __init__(self,
|
236
|
-
self.
|
240
|
+
class AsyncConnectionsResourceWithRawResponse:
|
241
|
+
def __init__(self, connections: AsyncConnectionsResource) -> None:
|
242
|
+
self._connections = connections
|
237
243
|
|
238
244
|
self.create = async_to_raw_response_wrapper(
|
239
|
-
|
245
|
+
connections.create,
|
240
246
|
)
|
241
|
-
self.
|
242
|
-
|
247
|
+
self.get = async_to_raw_response_wrapper(
|
248
|
+
connections.get,
|
243
249
|
)
|
244
250
|
|
245
251
|
|
246
|
-
class
|
247
|
-
def __init__(self,
|
248
|
-
self.
|
252
|
+
class ConnectionsResourceWithStreamingResponse:
|
253
|
+
def __init__(self, connections: ConnectionsResource) -> None:
|
254
|
+
self._connections = connections
|
249
255
|
|
250
256
|
self.create = to_streamed_response_wrapper(
|
251
|
-
|
257
|
+
connections.create,
|
252
258
|
)
|
253
|
-
self.
|
254
|
-
|
259
|
+
self.get = to_streamed_response_wrapper(
|
260
|
+
connections.get,
|
255
261
|
)
|
256
262
|
|
257
263
|
|
258
|
-
class
|
259
|
-
def __init__(self,
|
260
|
-
self.
|
264
|
+
class AsyncConnectionsResourceWithStreamingResponse:
|
265
|
+
def __init__(self, connections: AsyncConnectionsResource) -> None:
|
266
|
+
self._connections = connections
|
261
267
|
|
262
268
|
self.create = async_to_streamed_response_wrapper(
|
263
|
-
|
269
|
+
connections.create,
|
264
270
|
)
|
265
|
-
self.
|
266
|
-
|
271
|
+
self.get = async_to_streamed_response_wrapper(
|
272
|
+
connections.get,
|
267
273
|
)
|