supermemory 0.1.0a1__py3-none-any.whl → 3.0.0a1__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 +5 -0
- supermemory/_client.py +29 -29
- supermemory/_files.py +1 -1
- supermemory/_utils/_proxy.py +4 -1
- supermemory/_utils/_resources_proxy.py +24 -0
- supermemory/_version.py +1 -1
- supermemory/resources/__init__.py +33 -33
- supermemory/resources/{connection.py → connections.py} +154 -61
- supermemory/resources/{memory.py → memories.py} +264 -88
- supermemory/resources/search.py +92 -50
- supermemory/resources/settings.py +58 -11
- supermemory/types/__init__.py +10 -2
- supermemory/types/connection_create_params.py +5 -2
- supermemory/types/connection_create_response.py +7 -1
- supermemory/types/connection_get_response.py +21 -0
- supermemory/types/connection_list_params.py +13 -0
- supermemory/types/connection_list_response.py +25 -0
- supermemory/types/memory_add_params.py +18 -0
- supermemory/types/{memory_create_response.py → memory_add_response.py} +2 -2
- supermemory/types/memory_get_response.py +3 -19
- supermemory/types/memory_list_response.py +48 -12
- supermemory/types/memory_update_params.py +18 -0
- supermemory/types/memory_update_response.py +11 -0
- supermemory/types/memory_upload_file_params.py +13 -0
- supermemory/types/memory_upload_file_response.py +11 -0
- supermemory/types/search_execute_params.py +36 -6
- supermemory/types/setting_get_response.py +11 -0
- supermemory/types/setting_update_params.py +4 -12
- supermemory/types/setting_update_response.py +3 -11
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a1.dist-info}/METADATA +24 -7
- supermemory-3.0.0a1.dist-info/RECORD +56 -0
- supermemory/types/memory_create_params.py +0 -23
- supermemory-0.1.0a1.dist-info/RECORD +0 -47
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a1.dist-info}/WHEEL +0 -0
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a1.dist-info}/licenses/LICENSE +0 -0
supermemory/__init__.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
2
|
|
3
|
+
import typing as _t
|
4
|
+
|
3
5
|
from . import types
|
4
6
|
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
|
5
7
|
from ._utils import file_from_path
|
@@ -78,6 +80,9 @@ __all__ = [
|
|
78
80
|
"DefaultAsyncHttpxClient",
|
79
81
|
]
|
80
82
|
|
83
|
+
if not _t.TYPE_CHECKING:
|
84
|
+
from ._utils._resources_proxy import resources as resources
|
85
|
+
|
81
86
|
_setup_logging()
|
82
87
|
|
83
88
|
# Update the __module__ attribute for exported symbols so that
|
supermemory/_client.py
CHANGED
@@ -21,7 +21,7 @@ from ._types import (
|
|
21
21
|
)
|
22
22
|
from ._utils import is_given, get_async_library
|
23
23
|
from ._version import __version__
|
24
|
-
from .resources import
|
24
|
+
from .resources import search, memories, settings, connections
|
25
25
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
26
26
|
from ._exceptions import APIStatusError, SupermemoryError
|
27
27
|
from ._base_client import (
|
@@ -43,10 +43,10 @@ __all__ = [
|
|
43
43
|
|
44
44
|
|
45
45
|
class Supermemory(SyncAPIClient):
|
46
|
-
|
47
|
-
memory: memory.MemoryResource
|
46
|
+
memories: memories.MemoriesResource
|
48
47
|
search: search.SearchResource
|
49
|
-
|
48
|
+
settings: settings.SettingsResource
|
49
|
+
connections: connections.ConnectionsResource
|
50
50
|
with_raw_response: SupermemoryWithRawResponse
|
51
51
|
with_streaming_response: SupermemoryWithStreamedResponse
|
52
52
|
|
@@ -91,7 +91,7 @@ class Supermemory(SyncAPIClient):
|
|
91
91
|
if base_url is None:
|
92
92
|
base_url = os.environ.get("SUPERMEMORY_BASE_URL")
|
93
93
|
if base_url is None:
|
94
|
-
base_url = f"https://
|
94
|
+
base_url = f"https://api.supermemory.ai/"
|
95
95
|
|
96
96
|
super().__init__(
|
97
97
|
version=__version__,
|
@@ -104,10 +104,10 @@ class Supermemory(SyncAPIClient):
|
|
104
104
|
_strict_response_validation=_strict_response_validation,
|
105
105
|
)
|
106
106
|
|
107
|
-
self.
|
108
|
-
self.memory = memory.MemoryResource(self)
|
107
|
+
self.memories = memories.MemoriesResource(self)
|
109
108
|
self.search = search.SearchResource(self)
|
110
|
-
self.
|
109
|
+
self.settings = settings.SettingsResource(self)
|
110
|
+
self.connections = connections.ConnectionsResource(self)
|
111
111
|
self.with_raw_response = SupermemoryWithRawResponse(self)
|
112
112
|
self.with_streaming_response = SupermemoryWithStreamedResponse(self)
|
113
113
|
|
@@ -120,7 +120,7 @@ class Supermemory(SyncAPIClient):
|
|
120
120
|
@override
|
121
121
|
def auth_headers(self) -> dict[str, str]:
|
122
122
|
api_key = self.api_key
|
123
|
-
return {"
|
123
|
+
return {"Authorization": f"Bearer {api_key}"}
|
124
124
|
|
125
125
|
@property
|
126
126
|
@override
|
@@ -217,10 +217,10 @@ class Supermemory(SyncAPIClient):
|
|
217
217
|
|
218
218
|
|
219
219
|
class AsyncSupermemory(AsyncAPIClient):
|
220
|
-
|
221
|
-
memory: memory.AsyncMemoryResource
|
220
|
+
memories: memories.AsyncMemoriesResource
|
222
221
|
search: search.AsyncSearchResource
|
223
|
-
|
222
|
+
settings: settings.AsyncSettingsResource
|
223
|
+
connections: connections.AsyncConnectionsResource
|
224
224
|
with_raw_response: AsyncSupermemoryWithRawResponse
|
225
225
|
with_streaming_response: AsyncSupermemoryWithStreamedResponse
|
226
226
|
|
@@ -265,7 +265,7 @@ class AsyncSupermemory(AsyncAPIClient):
|
|
265
265
|
if base_url is None:
|
266
266
|
base_url = os.environ.get("SUPERMEMORY_BASE_URL")
|
267
267
|
if base_url is None:
|
268
|
-
base_url = f"https://
|
268
|
+
base_url = f"https://api.supermemory.ai/"
|
269
269
|
|
270
270
|
super().__init__(
|
271
271
|
version=__version__,
|
@@ -278,10 +278,10 @@ class AsyncSupermemory(AsyncAPIClient):
|
|
278
278
|
_strict_response_validation=_strict_response_validation,
|
279
279
|
)
|
280
280
|
|
281
|
-
self.
|
282
|
-
self.memory = memory.AsyncMemoryResource(self)
|
281
|
+
self.memories = memories.AsyncMemoriesResource(self)
|
283
282
|
self.search = search.AsyncSearchResource(self)
|
284
|
-
self.
|
283
|
+
self.settings = settings.AsyncSettingsResource(self)
|
284
|
+
self.connections = connections.AsyncConnectionsResource(self)
|
285
285
|
self.with_raw_response = AsyncSupermemoryWithRawResponse(self)
|
286
286
|
self.with_streaming_response = AsyncSupermemoryWithStreamedResponse(self)
|
287
287
|
|
@@ -294,7 +294,7 @@ class AsyncSupermemory(AsyncAPIClient):
|
|
294
294
|
@override
|
295
295
|
def auth_headers(self) -> dict[str, str]:
|
296
296
|
api_key = self.api_key
|
297
|
-
return {"
|
297
|
+
return {"Authorization": f"Bearer {api_key}"}
|
298
298
|
|
299
299
|
@property
|
300
300
|
@override
|
@@ -392,34 +392,34 @@ class AsyncSupermemory(AsyncAPIClient):
|
|
392
392
|
|
393
393
|
class SupermemoryWithRawResponse:
|
394
394
|
def __init__(self, client: Supermemory) -> None:
|
395
|
-
self.
|
396
|
-
self.memory = memory.MemoryResourceWithRawResponse(client.memory)
|
395
|
+
self.memories = memories.MemoriesResourceWithRawResponse(client.memories)
|
397
396
|
self.search = search.SearchResourceWithRawResponse(client.search)
|
398
|
-
self.
|
397
|
+
self.settings = settings.SettingsResourceWithRawResponse(client.settings)
|
398
|
+
self.connections = connections.ConnectionsResourceWithRawResponse(client.connections)
|
399
399
|
|
400
400
|
|
401
401
|
class AsyncSupermemoryWithRawResponse:
|
402
402
|
def __init__(self, client: AsyncSupermemory) -> None:
|
403
|
-
self.
|
404
|
-
self.memory = memory.AsyncMemoryResourceWithRawResponse(client.memory)
|
403
|
+
self.memories = memories.AsyncMemoriesResourceWithRawResponse(client.memories)
|
405
404
|
self.search = search.AsyncSearchResourceWithRawResponse(client.search)
|
406
|
-
self.
|
405
|
+
self.settings = settings.AsyncSettingsResourceWithRawResponse(client.settings)
|
406
|
+
self.connections = connections.AsyncConnectionsResourceWithRawResponse(client.connections)
|
407
407
|
|
408
408
|
|
409
409
|
class SupermemoryWithStreamedResponse:
|
410
410
|
def __init__(self, client: Supermemory) -> None:
|
411
|
-
self.
|
412
|
-
self.memory = memory.MemoryResourceWithStreamingResponse(client.memory)
|
411
|
+
self.memories = memories.MemoriesResourceWithStreamingResponse(client.memories)
|
413
412
|
self.search = search.SearchResourceWithStreamingResponse(client.search)
|
414
|
-
self.
|
413
|
+
self.settings = settings.SettingsResourceWithStreamingResponse(client.settings)
|
414
|
+
self.connections = connections.ConnectionsResourceWithStreamingResponse(client.connections)
|
415
415
|
|
416
416
|
|
417
417
|
class AsyncSupermemoryWithStreamedResponse:
|
418
418
|
def __init__(self, client: AsyncSupermemory) -> None:
|
419
|
-
self.
|
420
|
-
self.memory = memory.AsyncMemoryResourceWithStreamingResponse(client.memory)
|
419
|
+
self.memories = memories.AsyncMemoriesResourceWithStreamingResponse(client.memories)
|
421
420
|
self.search = search.AsyncSearchResourceWithStreamingResponse(client.search)
|
422
|
-
self.
|
421
|
+
self.settings = settings.AsyncSettingsResourceWithStreamingResponse(client.settings)
|
422
|
+
self.connections = connections.AsyncConnectionsResourceWithStreamingResponse(client.connections)
|
423
423
|
|
424
424
|
|
425
425
|
Client = Supermemory
|
supermemory/_files.py
CHANGED
@@ -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
|
|
supermemory/_utils/_proxy.py
CHANGED
@@ -46,7 +46,10 @@ class LazyProxy(Generic[T], ABC):
|
|
46
46
|
@property # type: ignore
|
47
47
|
@override
|
48
48
|
def __class__(self) -> type: # pyright: ignore
|
49
|
-
|
49
|
+
try:
|
50
|
+
proxied = self.__get_proxied__()
|
51
|
+
except Exception:
|
52
|
+
return type(self)
|
50
53
|
if issubclass(type(proxied), LazyProxy):
|
51
54
|
return type(proxied)
|
52
55
|
return proxied.__class__
|
@@ -0,0 +1,24 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import Any
|
4
|
+
from typing_extensions import override
|
5
|
+
|
6
|
+
from ._proxy import LazyProxy
|
7
|
+
|
8
|
+
|
9
|
+
class ResourcesProxy(LazyProxy[Any]):
|
10
|
+
"""A proxy for the `supermemory.resources` module.
|
11
|
+
|
12
|
+
This is used so that we can lazily import `supermemory.resources` only when
|
13
|
+
needed *and* so that users can just import `supermemory` and reference `supermemory.resources`
|
14
|
+
"""
|
15
|
+
|
16
|
+
@override
|
17
|
+
def __load__(self) -> Any:
|
18
|
+
import importlib
|
19
|
+
|
20
|
+
mod = importlib.import_module("supermemory.resources")
|
21
|
+
return mod
|
22
|
+
|
23
|
+
|
24
|
+
resources = ResourcesProxy().__as_proxied__()
|
supermemory/_version.py
CHANGED
@@ -1,13 +1,5 @@
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
2
|
|
3
|
-
from .memory import (
|
4
|
-
MemoryResource,
|
5
|
-
AsyncMemoryResource,
|
6
|
-
MemoryResourceWithRawResponse,
|
7
|
-
AsyncMemoryResourceWithRawResponse,
|
8
|
-
MemoryResourceWithStreamingResponse,
|
9
|
-
AsyncMemoryResourceWithStreamingResponse,
|
10
|
-
)
|
11
3
|
from .search import (
|
12
4
|
SearchResource,
|
13
5
|
AsyncSearchResource,
|
@@ -16,6 +8,14 @@ from .search import (
|
|
16
8
|
SearchResourceWithStreamingResponse,
|
17
9
|
AsyncSearchResourceWithStreamingResponse,
|
18
10
|
)
|
11
|
+
from .memories import (
|
12
|
+
MemoriesResource,
|
13
|
+
AsyncMemoriesResource,
|
14
|
+
MemoriesResourceWithRawResponse,
|
15
|
+
AsyncMemoriesResourceWithRawResponse,
|
16
|
+
MemoriesResourceWithStreamingResponse,
|
17
|
+
AsyncMemoriesResourceWithStreamingResponse,
|
18
|
+
)
|
19
19
|
from .settings import (
|
20
20
|
SettingsResource,
|
21
21
|
AsyncSettingsResource,
|
@@ -24,38 +24,38 @@ from .settings import (
|
|
24
24
|
SettingsResourceWithStreamingResponse,
|
25
25
|
AsyncSettingsResourceWithStreamingResponse,
|
26
26
|
)
|
27
|
-
from .
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
27
|
+
from .connections import (
|
28
|
+
ConnectionsResource,
|
29
|
+
AsyncConnectionsResource,
|
30
|
+
ConnectionsResourceWithRawResponse,
|
31
|
+
AsyncConnectionsResourceWithRawResponse,
|
32
|
+
ConnectionsResourceWithStreamingResponse,
|
33
|
+
AsyncConnectionsResourceWithStreamingResponse,
|
34
34
|
)
|
35
35
|
|
36
36
|
__all__ = [
|
37
|
-
"
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"
|
43
|
-
"MemoryResource",
|
44
|
-
"AsyncMemoryResource",
|
45
|
-
"MemoryResourceWithRawResponse",
|
46
|
-
"AsyncMemoryResourceWithRawResponse",
|
47
|
-
"MemoryResourceWithStreamingResponse",
|
48
|
-
"AsyncMemoryResourceWithStreamingResponse",
|
37
|
+
"MemoriesResource",
|
38
|
+
"AsyncMemoriesResource",
|
39
|
+
"MemoriesResourceWithRawResponse",
|
40
|
+
"AsyncMemoriesResourceWithRawResponse",
|
41
|
+
"MemoriesResourceWithStreamingResponse",
|
42
|
+
"AsyncMemoriesResourceWithStreamingResponse",
|
49
43
|
"SearchResource",
|
50
44
|
"AsyncSearchResource",
|
51
45
|
"SearchResourceWithRawResponse",
|
52
46
|
"AsyncSearchResourceWithRawResponse",
|
53
47
|
"SearchResourceWithStreamingResponse",
|
54
48
|
"AsyncSearchResourceWithStreamingResponse",
|
55
|
-
"
|
56
|
-
"
|
57
|
-
"
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"
|
49
|
+
"SettingsResource",
|
50
|
+
"AsyncSettingsResource",
|
51
|
+
"SettingsResourceWithRawResponse",
|
52
|
+
"AsyncSettingsResourceWithRawResponse",
|
53
|
+
"SettingsResourceWithStreamingResponse",
|
54
|
+
"AsyncSettingsResourceWithStreamingResponse",
|
55
|
+
"ConnectionsResource",
|
56
|
+
"AsyncConnectionsResource",
|
57
|
+
"ConnectionsResourceWithRawResponse",
|
58
|
+
"AsyncConnectionsResourceWithRawResponse",
|
59
|
+
"ConnectionsResourceWithStreamingResponse",
|
60
|
+
"AsyncConnectionsResourceWithStreamingResponse",
|
61
61
|
]
|