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.
Files changed (35) hide show
  1. supermemory/__init__.py +5 -0
  2. supermemory/_client.py +29 -29
  3. supermemory/_files.py +1 -1
  4. supermemory/_utils/_proxy.py +4 -1
  5. supermemory/_utils/_resources_proxy.py +24 -0
  6. supermemory/_version.py +1 -1
  7. supermemory/resources/__init__.py +33 -33
  8. supermemory/resources/{connection.py → connections.py} +154 -61
  9. supermemory/resources/{memory.py → memories.py} +264 -88
  10. supermemory/resources/search.py +92 -50
  11. supermemory/resources/settings.py +58 -11
  12. supermemory/types/__init__.py +10 -2
  13. supermemory/types/connection_create_params.py +5 -2
  14. supermemory/types/connection_create_response.py +7 -1
  15. supermemory/types/connection_get_response.py +21 -0
  16. supermemory/types/connection_list_params.py +13 -0
  17. supermemory/types/connection_list_response.py +25 -0
  18. supermemory/types/memory_add_params.py +18 -0
  19. supermemory/types/{memory_create_response.py → memory_add_response.py} +2 -2
  20. supermemory/types/memory_get_response.py +3 -19
  21. supermemory/types/memory_list_response.py +48 -12
  22. supermemory/types/memory_update_params.py +18 -0
  23. supermemory/types/memory_update_response.py +11 -0
  24. supermemory/types/memory_upload_file_params.py +13 -0
  25. supermemory/types/memory_upload_file_response.py +11 -0
  26. supermemory/types/search_execute_params.py +36 -6
  27. supermemory/types/setting_get_response.py +11 -0
  28. supermemory/types/setting_update_params.py +4 -12
  29. supermemory/types/setting_update_response.py +3 -11
  30. {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a1.dist-info}/METADATA +24 -7
  31. supermemory-3.0.0a1.dist-info/RECORD +56 -0
  32. supermemory/types/memory_create_params.py +0 -23
  33. supermemory-0.1.0a1.dist-info/RECORD +0 -47
  34. {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a1.dist-info}/WHEEL +0 -0
  35. {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 memory, search, settings, connection
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
- settings: settings.SettingsResource
47
- memory: memory.MemoryResource
46
+ memories: memories.MemoriesResource
48
47
  search: search.SearchResource
49
- connection: connection.ConnectionResource
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://v2.api.supermemory.ai"
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.settings = settings.SettingsResource(self)
108
- self.memory = memory.MemoryResource(self)
107
+ self.memories = memories.MemoriesResource(self)
109
108
  self.search = search.SearchResource(self)
110
- self.connection = connection.ConnectionResource(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 {"X-API-Key": api_key}
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
- settings: settings.AsyncSettingsResource
221
- memory: memory.AsyncMemoryResource
220
+ memories: memories.AsyncMemoriesResource
222
221
  search: search.AsyncSearchResource
223
- connection: connection.AsyncConnectionResource
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://v2.api.supermemory.ai"
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.settings = settings.AsyncSettingsResource(self)
282
- self.memory = memory.AsyncMemoryResource(self)
281
+ self.memories = memories.AsyncMemoriesResource(self)
283
282
  self.search = search.AsyncSearchResource(self)
284
- self.connection = connection.AsyncConnectionResource(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 {"X-API-Key": api_key}
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.settings = settings.SettingsResourceWithRawResponse(client.settings)
396
- self.memory = memory.MemoryResourceWithRawResponse(client.memory)
395
+ self.memories = memories.MemoriesResourceWithRawResponse(client.memories)
397
396
  self.search = search.SearchResourceWithRawResponse(client.search)
398
- self.connection = connection.ConnectionResourceWithRawResponse(client.connection)
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.settings = settings.AsyncSettingsResourceWithRawResponse(client.settings)
404
- self.memory = memory.AsyncMemoryResourceWithRawResponse(client.memory)
403
+ self.memories = memories.AsyncMemoriesResourceWithRawResponse(client.memories)
405
404
  self.search = search.AsyncSearchResourceWithRawResponse(client.search)
406
- self.connection = connection.AsyncConnectionResourceWithRawResponse(client.connection)
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.settings = settings.SettingsResourceWithStreamingResponse(client.settings)
412
- self.memory = memory.MemoryResourceWithStreamingResponse(client.memory)
411
+ self.memories = memories.MemoriesResourceWithStreamingResponse(client.memories)
413
412
  self.search = search.SearchResourceWithStreamingResponse(client.search)
414
- self.connection = connection.ConnectionResourceWithStreamingResponse(client.connection)
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.settings = settings.AsyncSettingsResourceWithStreamingResponse(client.settings)
420
- self.memory = memory.AsyncMemoryResourceWithStreamingResponse(client.memory)
419
+ self.memories = memories.AsyncMemoriesResourceWithStreamingResponse(client.memories)
421
420
  self.search = search.AsyncSearchResourceWithStreamingResponse(client.search)
422
- self.connection = connection.AsyncConnectionResourceWithStreamingResponse(client.connection)
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
 
@@ -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
- proxied = self.__get_proxied__()
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,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "supermemory"
4
- __version__ = "0.1.0-alpha.1" # x-release-please-version
4
+ __version__ = "3.0.0-alpha.1" # x-release-please-version
@@ -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 .connection import (
28
- ConnectionResource,
29
- AsyncConnectionResource,
30
- ConnectionResourceWithRawResponse,
31
- AsyncConnectionResourceWithRawResponse,
32
- ConnectionResourceWithStreamingResponse,
33
- AsyncConnectionResourceWithStreamingResponse,
27
+ from .connections import (
28
+ ConnectionsResource,
29
+ AsyncConnectionsResource,
30
+ ConnectionsResourceWithRawResponse,
31
+ AsyncConnectionsResourceWithRawResponse,
32
+ ConnectionsResourceWithStreamingResponse,
33
+ AsyncConnectionsResourceWithStreamingResponse,
34
34
  )
35
35
 
36
36
  __all__ = [
37
- "SettingsResource",
38
- "AsyncSettingsResource",
39
- "SettingsResourceWithRawResponse",
40
- "AsyncSettingsResourceWithRawResponse",
41
- "SettingsResourceWithStreamingResponse",
42
- "AsyncSettingsResourceWithStreamingResponse",
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
- "ConnectionResource",
56
- "AsyncConnectionResource",
57
- "ConnectionResourceWithRawResponse",
58
- "AsyncConnectionResourceWithRawResponse",
59
- "ConnectionResourceWithStreamingResponse",
60
- "AsyncConnectionResourceWithStreamingResponse",
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
  ]