supermemory 3.0.0a29__py3-none-any.whl → 3.0.0a30__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.
Potentially problematic release.
This version of supermemory might be problematic. Click here for more details.
- supermemory/_base_client.py +3 -3
- supermemory/_client.py +1 -9
- supermemory/_compat.py +48 -48
- supermemory/_files.py +1 -1
- supermemory/_models.py +40 -40
- supermemory/_types.py +35 -1
- supermemory/_utils/__init__.py +9 -2
- supermemory/_utils/_compat.py +45 -0
- supermemory/_utils/_datetime_parse.py +136 -0
- supermemory/_utils/_transform.py +11 -1
- supermemory/_utils/_typing.py +6 -1
- supermemory/_utils/_utils.py +0 -1
- supermemory/_version.py +1 -1
- supermemory/resources/__init__.py +0 -14
- supermemory/resources/connections.py +14 -14
- supermemory/resources/search.py +9 -9
- supermemory/types/__init__.py +0 -9
- supermemory/types/connection_create_params.py +3 -2
- supermemory/types/connection_delete_by_provider_params.py +2 -2
- supermemory/types/connection_get_by_tags_params.py +2 -2
- supermemory/types/connection_import_params.py +2 -2
- supermemory/types/connection_list_documents_params.py +2 -2
- supermemory/types/connection_list_params.py +2 -2
- supermemory/types/search_documents_params.py +3 -2
- supermemory/types/search_execute_params.py +3 -2
- supermemory/types/search_memories_response.py +10 -7
- {supermemory-3.0.0a29.dist-info → supermemory-3.0.0a30.dist-info}/METADATA +18 -25
- supermemory-3.0.0a30.dist-info/RECORD +60 -0
- supermemory/resources/memories.py +0 -806
- supermemory/types/memory_add_params.py +0 -53
- supermemory/types/memory_add_response.py +0 -11
- supermemory/types/memory_get_response.py +0 -103
- supermemory/types/memory_list_params.py +0 -40
- supermemory/types/memory_list_response.py +0 -94
- supermemory/types/memory_update_params.py +0 -53
- supermemory/types/memory_update_response.py +0 -11
- supermemory/types/memory_upload_file_params.py +0 -16
- supermemory/types/memory_upload_file_response.py +0 -11
- supermemory-3.0.0a29.dist-info/RECORD +0 -68
- {supermemory-3.0.0a29.dist-info → supermemory-3.0.0a30.dist-info}/WHEEL +0 -0
- {supermemory-3.0.0a29.dist-info → supermemory-3.0.0a30.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This file contains code from https://github.com/pydantic/pydantic/blob/main/pydantic/v1/datetime_parse.py
|
|
3
|
+
without the Pydantic v1 specific errors.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import re
|
|
9
|
+
from typing import Dict, Union, Optional
|
|
10
|
+
from datetime import date, datetime, timezone, timedelta
|
|
11
|
+
|
|
12
|
+
from .._types import StrBytesIntFloat
|
|
13
|
+
|
|
14
|
+
date_expr = r"(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})"
|
|
15
|
+
time_expr = (
|
|
16
|
+
r"(?P<hour>\d{1,2}):(?P<minute>\d{1,2})"
|
|
17
|
+
r"(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?"
|
|
18
|
+
r"(?P<tzinfo>Z|[+-]\d{2}(?::?\d{2})?)?$"
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
date_re = re.compile(f"{date_expr}$")
|
|
22
|
+
datetime_re = re.compile(f"{date_expr}[T ]{time_expr}")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
EPOCH = datetime(1970, 1, 1)
|
|
26
|
+
# if greater than this, the number is in ms, if less than or equal it's in seconds
|
|
27
|
+
# (in seconds this is 11th October 2603, in ms it's 20th August 1970)
|
|
28
|
+
MS_WATERSHED = int(2e10)
|
|
29
|
+
# slightly more than datetime.max in ns - (datetime.max - EPOCH).total_seconds() * 1e9
|
|
30
|
+
MAX_NUMBER = int(3e20)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _get_numeric(value: StrBytesIntFloat, native_expected_type: str) -> Union[None, int, float]:
|
|
34
|
+
if isinstance(value, (int, float)):
|
|
35
|
+
return value
|
|
36
|
+
try:
|
|
37
|
+
return float(value)
|
|
38
|
+
except ValueError:
|
|
39
|
+
return None
|
|
40
|
+
except TypeError:
|
|
41
|
+
raise TypeError(f"invalid type; expected {native_expected_type}, string, bytes, int or float") from None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _from_unix_seconds(seconds: Union[int, float]) -> datetime:
|
|
45
|
+
if seconds > MAX_NUMBER:
|
|
46
|
+
return datetime.max
|
|
47
|
+
elif seconds < -MAX_NUMBER:
|
|
48
|
+
return datetime.min
|
|
49
|
+
|
|
50
|
+
while abs(seconds) > MS_WATERSHED:
|
|
51
|
+
seconds /= 1000
|
|
52
|
+
dt = EPOCH + timedelta(seconds=seconds)
|
|
53
|
+
return dt.replace(tzinfo=timezone.utc)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _parse_timezone(value: Optional[str]) -> Union[None, int, timezone]:
|
|
57
|
+
if value == "Z":
|
|
58
|
+
return timezone.utc
|
|
59
|
+
elif value is not None:
|
|
60
|
+
offset_mins = int(value[-2:]) if len(value) > 3 else 0
|
|
61
|
+
offset = 60 * int(value[1:3]) + offset_mins
|
|
62
|
+
if value[0] == "-":
|
|
63
|
+
offset = -offset
|
|
64
|
+
return timezone(timedelta(minutes=offset))
|
|
65
|
+
else:
|
|
66
|
+
return None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime:
|
|
70
|
+
"""
|
|
71
|
+
Parse a datetime/int/float/string and return a datetime.datetime.
|
|
72
|
+
|
|
73
|
+
This function supports time zone offsets. When the input contains one,
|
|
74
|
+
the output uses a timezone with a fixed offset from UTC.
|
|
75
|
+
|
|
76
|
+
Raise ValueError if the input is well formatted but not a valid datetime.
|
|
77
|
+
Raise ValueError if the input isn't well formatted.
|
|
78
|
+
"""
|
|
79
|
+
if isinstance(value, datetime):
|
|
80
|
+
return value
|
|
81
|
+
|
|
82
|
+
number = _get_numeric(value, "datetime")
|
|
83
|
+
if number is not None:
|
|
84
|
+
return _from_unix_seconds(number)
|
|
85
|
+
|
|
86
|
+
if isinstance(value, bytes):
|
|
87
|
+
value = value.decode()
|
|
88
|
+
|
|
89
|
+
assert not isinstance(value, (float, int))
|
|
90
|
+
|
|
91
|
+
match = datetime_re.match(value)
|
|
92
|
+
if match is None:
|
|
93
|
+
raise ValueError("invalid datetime format")
|
|
94
|
+
|
|
95
|
+
kw = match.groupdict()
|
|
96
|
+
if kw["microsecond"]:
|
|
97
|
+
kw["microsecond"] = kw["microsecond"].ljust(6, "0")
|
|
98
|
+
|
|
99
|
+
tzinfo = _parse_timezone(kw.pop("tzinfo"))
|
|
100
|
+
kw_: Dict[str, Union[None, int, timezone]] = {k: int(v) for k, v in kw.items() if v is not None}
|
|
101
|
+
kw_["tzinfo"] = tzinfo
|
|
102
|
+
|
|
103
|
+
return datetime(**kw_) # type: ignore
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def parse_date(value: Union[date, StrBytesIntFloat]) -> date:
|
|
107
|
+
"""
|
|
108
|
+
Parse a date/int/float/string and return a datetime.date.
|
|
109
|
+
|
|
110
|
+
Raise ValueError if the input is well formatted but not a valid date.
|
|
111
|
+
Raise ValueError if the input isn't well formatted.
|
|
112
|
+
"""
|
|
113
|
+
if isinstance(value, date):
|
|
114
|
+
if isinstance(value, datetime):
|
|
115
|
+
return value.date()
|
|
116
|
+
else:
|
|
117
|
+
return value
|
|
118
|
+
|
|
119
|
+
number = _get_numeric(value, "date")
|
|
120
|
+
if number is not None:
|
|
121
|
+
return _from_unix_seconds(number).date()
|
|
122
|
+
|
|
123
|
+
if isinstance(value, bytes):
|
|
124
|
+
value = value.decode()
|
|
125
|
+
|
|
126
|
+
assert not isinstance(value, (float, int))
|
|
127
|
+
match = date_re.match(value)
|
|
128
|
+
if match is None:
|
|
129
|
+
raise ValueError("invalid date format")
|
|
130
|
+
|
|
131
|
+
kw = {k: int(v) for k, v in match.groupdict().items()}
|
|
132
|
+
|
|
133
|
+
try:
|
|
134
|
+
return date(**kw)
|
|
135
|
+
except ValueError:
|
|
136
|
+
raise ValueError("invalid date format") from None
|
supermemory/_utils/_transform.py
CHANGED
|
@@ -16,18 +16,20 @@ from ._utils import (
|
|
|
16
16
|
lru_cache,
|
|
17
17
|
is_mapping,
|
|
18
18
|
is_iterable,
|
|
19
|
+
is_sequence,
|
|
19
20
|
)
|
|
20
21
|
from .._files import is_base64_file_input
|
|
22
|
+
from ._compat import get_origin, is_typeddict
|
|
21
23
|
from ._typing import (
|
|
22
24
|
is_list_type,
|
|
23
25
|
is_union_type,
|
|
24
26
|
extract_type_arg,
|
|
25
27
|
is_iterable_type,
|
|
26
28
|
is_required_type,
|
|
29
|
+
is_sequence_type,
|
|
27
30
|
is_annotated_type,
|
|
28
31
|
strip_annotated_type,
|
|
29
32
|
)
|
|
30
|
-
from .._compat import get_origin, model_dump, is_typeddict
|
|
31
33
|
|
|
32
34
|
_T = TypeVar("_T")
|
|
33
35
|
|
|
@@ -167,6 +169,8 @@ def _transform_recursive(
|
|
|
167
169
|
|
|
168
170
|
Defaults to the same value as the `annotation` argument.
|
|
169
171
|
"""
|
|
172
|
+
from .._compat import model_dump
|
|
173
|
+
|
|
170
174
|
if inner_type is None:
|
|
171
175
|
inner_type = annotation
|
|
172
176
|
|
|
@@ -184,6 +188,8 @@ def _transform_recursive(
|
|
|
184
188
|
(is_list_type(stripped_type) and is_list(data))
|
|
185
189
|
# Iterable[T]
|
|
186
190
|
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
|
|
191
|
+
# Sequence[T]
|
|
192
|
+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
|
|
187
193
|
):
|
|
188
194
|
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
|
|
189
195
|
# intended as an iterable, so we don't transform it.
|
|
@@ -329,6 +335,8 @@ async def _async_transform_recursive(
|
|
|
329
335
|
|
|
330
336
|
Defaults to the same value as the `annotation` argument.
|
|
331
337
|
"""
|
|
338
|
+
from .._compat import model_dump
|
|
339
|
+
|
|
332
340
|
if inner_type is None:
|
|
333
341
|
inner_type = annotation
|
|
334
342
|
|
|
@@ -346,6 +354,8 @@ async def _async_transform_recursive(
|
|
|
346
354
|
(is_list_type(stripped_type) and is_list(data))
|
|
347
355
|
# Iterable[T]
|
|
348
356
|
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
|
|
357
|
+
# Sequence[T]
|
|
358
|
+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
|
|
349
359
|
):
|
|
350
360
|
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
|
|
351
361
|
# intended as an iterable, so we don't transform it.
|
supermemory/_utils/_typing.py
CHANGED
|
@@ -15,7 +15,7 @@ from typing_extensions import (
|
|
|
15
15
|
|
|
16
16
|
from ._utils import lru_cache
|
|
17
17
|
from .._types import InheritsGeneric
|
|
18
|
-
from
|
|
18
|
+
from ._compat import is_union as _is_union
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def is_annotated_type(typ: type) -> bool:
|
|
@@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool:
|
|
|
26
26
|
return (get_origin(typ) or typ) == list
|
|
27
27
|
|
|
28
28
|
|
|
29
|
+
def is_sequence_type(typ: type) -> bool:
|
|
30
|
+
origin = get_origin(typ) or typ
|
|
31
|
+
return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence
|
|
32
|
+
|
|
33
|
+
|
|
29
34
|
def is_iterable_type(typ: type) -> bool:
|
|
30
35
|
"""If the given type is `typing.Iterable[T]`"""
|
|
31
36
|
origin = get_origin(typ) or typ
|
supermemory/_utils/_utils.py
CHANGED
|
@@ -22,7 +22,6 @@ from typing_extensions import TypeGuard
|
|
|
22
22
|
import sniffio
|
|
23
23
|
|
|
24
24
|
from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike
|
|
25
|
-
from .._compat import parse_date as parse_date, parse_datetime as parse_datetime
|
|
26
25
|
|
|
27
26
|
_T = TypeVar("_T")
|
|
28
27
|
_TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])
|
supermemory/_version.py
CHANGED
|
@@ -8,14 +8,6 @@ from .search import (
|
|
|
8
8
|
SearchResourceWithStreamingResponse,
|
|
9
9
|
AsyncSearchResourceWithStreamingResponse,
|
|
10
10
|
)
|
|
11
|
-
from .memories import (
|
|
12
|
-
MemoriesResource,
|
|
13
|
-
AsyncMemoriesResource,
|
|
14
|
-
MemoriesResourceWithRawResponse,
|
|
15
|
-
AsyncMemoriesResourceWithRawResponse,
|
|
16
|
-
MemoriesResourceWithStreamingResponse,
|
|
17
|
-
AsyncMemoriesResourceWithStreamingResponse,
|
|
18
|
-
)
|
|
19
11
|
from .settings import (
|
|
20
12
|
SettingsResource,
|
|
21
13
|
AsyncSettingsResource,
|
|
@@ -34,12 +26,6 @@ from .connections import (
|
|
|
34
26
|
)
|
|
35
27
|
|
|
36
28
|
__all__ = [
|
|
37
|
-
"MemoriesResource",
|
|
38
|
-
"AsyncMemoriesResource",
|
|
39
|
-
"MemoriesResourceWithRawResponse",
|
|
40
|
-
"AsyncMemoriesResourceWithRawResponse",
|
|
41
|
-
"MemoriesResourceWithStreamingResponse",
|
|
42
|
-
"AsyncMemoriesResourceWithStreamingResponse",
|
|
43
29
|
"SearchResource",
|
|
44
30
|
"AsyncSearchResource",
|
|
45
31
|
"SearchResourceWithRawResponse",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict,
|
|
5
|
+
from typing import Dict, Union, Optional
|
|
6
6
|
from typing_extensions import Literal
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
@@ -15,7 +15,7 @@ from ..types import (
|
|
|
15
15
|
connection_list_documents_params,
|
|
16
16
|
connection_delete_by_provider_params,
|
|
17
17
|
)
|
|
18
|
-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
18
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
|
|
19
19
|
from .._utils import maybe_transform, async_maybe_transform
|
|
20
20
|
from .._compat import cached_property
|
|
21
21
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -61,7 +61,7 @@ class ConnectionsResource(SyncAPIResource):
|
|
|
61
61
|
self,
|
|
62
62
|
provider: Literal["notion", "google-drive", "onedrive"],
|
|
63
63
|
*,
|
|
64
|
-
container_tags:
|
|
64
|
+
container_tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
65
65
|
document_limit: int | NotGiven = NOT_GIVEN,
|
|
66
66
|
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
|
67
67
|
redirect_url: str | NotGiven = NOT_GIVEN,
|
|
@@ -106,7 +106,7 @@ class ConnectionsResource(SyncAPIResource):
|
|
|
106
106
|
def list(
|
|
107
107
|
self,
|
|
108
108
|
*,
|
|
109
|
-
container_tags:
|
|
109
|
+
container_tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
110
110
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
111
111
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
112
112
|
extra_headers: Headers | None = None,
|
|
@@ -174,7 +174,7 @@ class ConnectionsResource(SyncAPIResource):
|
|
|
174
174
|
self,
|
|
175
175
|
provider: Literal["notion", "google-drive", "onedrive"],
|
|
176
176
|
*,
|
|
177
|
-
container_tags:
|
|
177
|
+
container_tags: SequenceNotStr[str],
|
|
178
178
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
179
179
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
180
180
|
extra_headers: Headers | None = None,
|
|
@@ -247,7 +247,7 @@ class ConnectionsResource(SyncAPIResource):
|
|
|
247
247
|
self,
|
|
248
248
|
provider: Literal["notion", "google-drive", "onedrive"],
|
|
249
249
|
*,
|
|
250
|
-
container_tags:
|
|
250
|
+
container_tags: SequenceNotStr[str],
|
|
251
251
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
252
252
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
253
253
|
extra_headers: Headers | None = None,
|
|
@@ -286,7 +286,7 @@ class ConnectionsResource(SyncAPIResource):
|
|
|
286
286
|
self,
|
|
287
287
|
provider: Literal["notion", "google-drive", "onedrive"],
|
|
288
288
|
*,
|
|
289
|
-
container_tags:
|
|
289
|
+
container_tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
290
290
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
291
291
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
292
292
|
extra_headers: Headers | None = None,
|
|
@@ -324,7 +324,7 @@ class ConnectionsResource(SyncAPIResource):
|
|
|
324
324
|
self,
|
|
325
325
|
provider: Literal["notion", "google-drive", "onedrive"],
|
|
326
326
|
*,
|
|
327
|
-
container_tags:
|
|
327
|
+
container_tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
328
328
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
329
329
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
330
330
|
extra_headers: Headers | None = None,
|
|
@@ -384,7 +384,7 @@ class AsyncConnectionsResource(AsyncAPIResource):
|
|
|
384
384
|
self,
|
|
385
385
|
provider: Literal["notion", "google-drive", "onedrive"],
|
|
386
386
|
*,
|
|
387
|
-
container_tags:
|
|
387
|
+
container_tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
388
388
|
document_limit: int | NotGiven = NOT_GIVEN,
|
|
389
389
|
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
|
390
390
|
redirect_url: str | NotGiven = NOT_GIVEN,
|
|
@@ -429,7 +429,7 @@ class AsyncConnectionsResource(AsyncAPIResource):
|
|
|
429
429
|
async def list(
|
|
430
430
|
self,
|
|
431
431
|
*,
|
|
432
|
-
container_tags:
|
|
432
|
+
container_tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
433
433
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
434
434
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
435
435
|
extra_headers: Headers | None = None,
|
|
@@ -499,7 +499,7 @@ class AsyncConnectionsResource(AsyncAPIResource):
|
|
|
499
499
|
self,
|
|
500
500
|
provider: Literal["notion", "google-drive", "onedrive"],
|
|
501
501
|
*,
|
|
502
|
-
container_tags:
|
|
502
|
+
container_tags: SequenceNotStr[str],
|
|
503
503
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
504
504
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
505
505
|
extra_headers: Headers | None = None,
|
|
@@ -572,7 +572,7 @@ class AsyncConnectionsResource(AsyncAPIResource):
|
|
|
572
572
|
self,
|
|
573
573
|
provider: Literal["notion", "google-drive", "onedrive"],
|
|
574
574
|
*,
|
|
575
|
-
container_tags:
|
|
575
|
+
container_tags: SequenceNotStr[str],
|
|
576
576
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
577
577
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
578
578
|
extra_headers: Headers | None = None,
|
|
@@ -611,7 +611,7 @@ class AsyncConnectionsResource(AsyncAPIResource):
|
|
|
611
611
|
self,
|
|
612
612
|
provider: Literal["notion", "google-drive", "onedrive"],
|
|
613
613
|
*,
|
|
614
|
-
container_tags:
|
|
614
|
+
container_tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
615
615
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
616
616
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
617
617
|
extra_headers: Headers | None = None,
|
|
@@ -651,7 +651,7 @@ class AsyncConnectionsResource(AsyncAPIResource):
|
|
|
651
651
|
self,
|
|
652
652
|
provider: Literal["notion", "google-drive", "onedrive"],
|
|
653
653
|
*,
|
|
654
|
-
container_tags:
|
|
654
|
+
container_tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
655
655
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
656
656
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
657
657
|
extra_headers: Headers | None = None,
|
supermemory/resources/search.py
CHANGED
|
@@ -8,7 +8,7 @@ from typing_extensions import Literal
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
10
|
from ..types import search_execute_params, search_memories_params, search_documents_params
|
|
11
|
-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
11
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
|
|
12
12
|
from .._utils import maybe_transform, async_maybe_transform
|
|
13
13
|
from .._compat import cached_property
|
|
14
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -52,7 +52,7 @@ class SearchResource(SyncAPIResource):
|
|
|
52
52
|
q: str,
|
|
53
53
|
categories_filter: List[Literal["technology", "science", "business", "health"]] | NotGiven = NOT_GIVEN,
|
|
54
54
|
chunk_threshold: float | NotGiven = NOT_GIVEN,
|
|
55
|
-
container_tags:
|
|
55
|
+
container_tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
56
56
|
doc_id: str | NotGiven = NOT_GIVEN,
|
|
57
57
|
document_threshold: float | NotGiven = NOT_GIVEN,
|
|
58
58
|
filters: search_documents_params.Filters | NotGiven = NOT_GIVEN,
|
|
@@ -82,7 +82,7 @@ class SearchResource(SyncAPIResource):
|
|
|
82
82
|
results)
|
|
83
83
|
|
|
84
84
|
container_tags: Optional tags this search should be containerized by. This can be an ID for your
|
|
85
|
-
user, a project ID, or any other identifier you wish to use to filter
|
|
85
|
+
user, a project ID, or any other identifier you wish to use to filter documents.
|
|
86
86
|
|
|
87
87
|
doc_id: Optional document ID to search within. You can use this to find chunks in a very
|
|
88
88
|
large document.
|
|
@@ -151,7 +151,7 @@ class SearchResource(SyncAPIResource):
|
|
|
151
151
|
q: str,
|
|
152
152
|
categories_filter: List[Literal["technology", "science", "business", "health"]] | NotGiven = NOT_GIVEN,
|
|
153
153
|
chunk_threshold: float | NotGiven = NOT_GIVEN,
|
|
154
|
-
container_tags:
|
|
154
|
+
container_tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
155
155
|
doc_id: str | NotGiven = NOT_GIVEN,
|
|
156
156
|
document_threshold: float | NotGiven = NOT_GIVEN,
|
|
157
157
|
filters: search_execute_params.Filters | NotGiven = NOT_GIVEN,
|
|
@@ -181,7 +181,7 @@ class SearchResource(SyncAPIResource):
|
|
|
181
181
|
results)
|
|
182
182
|
|
|
183
183
|
container_tags: Optional tags this search should be containerized by. This can be an ID for your
|
|
184
|
-
user, a project ID, or any other identifier you wish to use to filter
|
|
184
|
+
user, a project ID, or any other identifier you wish to use to filter documents.
|
|
185
185
|
|
|
186
186
|
doc_id: Optional document ID to search within. You can use this to find chunks in a very
|
|
187
187
|
large document.
|
|
@@ -341,7 +341,7 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
341
341
|
q: str,
|
|
342
342
|
categories_filter: List[Literal["technology", "science", "business", "health"]] | NotGiven = NOT_GIVEN,
|
|
343
343
|
chunk_threshold: float | NotGiven = NOT_GIVEN,
|
|
344
|
-
container_tags:
|
|
344
|
+
container_tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
345
345
|
doc_id: str | NotGiven = NOT_GIVEN,
|
|
346
346
|
document_threshold: float | NotGiven = NOT_GIVEN,
|
|
347
347
|
filters: search_documents_params.Filters | NotGiven = NOT_GIVEN,
|
|
@@ -371,7 +371,7 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
371
371
|
results)
|
|
372
372
|
|
|
373
373
|
container_tags: Optional tags this search should be containerized by. This can be an ID for your
|
|
374
|
-
user, a project ID, or any other identifier you wish to use to filter
|
|
374
|
+
user, a project ID, or any other identifier you wish to use to filter documents.
|
|
375
375
|
|
|
376
376
|
doc_id: Optional document ID to search within. You can use this to find chunks in a very
|
|
377
377
|
large document.
|
|
@@ -440,7 +440,7 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
440
440
|
q: str,
|
|
441
441
|
categories_filter: List[Literal["technology", "science", "business", "health"]] | NotGiven = NOT_GIVEN,
|
|
442
442
|
chunk_threshold: float | NotGiven = NOT_GIVEN,
|
|
443
|
-
container_tags:
|
|
443
|
+
container_tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
444
444
|
doc_id: str | NotGiven = NOT_GIVEN,
|
|
445
445
|
document_threshold: float | NotGiven = NOT_GIVEN,
|
|
446
446
|
filters: search_execute_params.Filters | NotGiven = NOT_GIVEN,
|
|
@@ -470,7 +470,7 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
470
470
|
results)
|
|
471
471
|
|
|
472
472
|
container_tags: Optional tags this search should be containerized by. This can be an ID for your
|
|
473
|
-
user, a project ID, or any other identifier you wish to use to filter
|
|
473
|
+
user, a project ID, or any other identifier you wish to use to filter documents.
|
|
474
474
|
|
|
475
475
|
doc_id: Optional document ID to search within. You can use this to find chunks in a very
|
|
476
476
|
large document.
|
supermemory/types/__init__.py
CHANGED
|
@@ -2,17 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from .memory_add_params import MemoryAddParams as MemoryAddParams
|
|
6
|
-
from .memory_list_params import MemoryListParams as MemoryListParams
|
|
7
|
-
from .memory_add_response import MemoryAddResponse as MemoryAddResponse
|
|
8
|
-
from .memory_get_response import MemoryGetResponse as MemoryGetResponse
|
|
9
|
-
from .memory_list_response import MemoryListResponse as MemoryListResponse
|
|
10
|
-
from .memory_update_params import MemoryUpdateParams as MemoryUpdateParams
|
|
11
5
|
from .setting_get_response import SettingGetResponse as SettingGetResponse
|
|
12
6
|
from .search_execute_params import SearchExecuteParams as SearchExecuteParams
|
|
13
7
|
from .setting_update_params import SettingUpdateParams as SettingUpdateParams
|
|
14
8
|
from .connection_list_params import ConnectionListParams as ConnectionListParams
|
|
15
|
-
from .memory_update_response import MemoryUpdateResponse as MemoryUpdateResponse
|
|
16
9
|
from .search_memories_params import SearchMemoriesParams as SearchMemoriesParams
|
|
17
10
|
from .search_documents_params import SearchDocumentsParams as SearchDocumentsParams
|
|
18
11
|
from .search_execute_response import SearchExecuteResponse as SearchExecuteResponse
|
|
@@ -21,11 +14,9 @@ from .connection_create_params import ConnectionCreateParams as ConnectionCreate
|
|
|
21
14
|
from .connection_import_params import ConnectionImportParams as ConnectionImportParams
|
|
22
15
|
from .connection_list_response import ConnectionListResponse as ConnectionListResponse
|
|
23
16
|
from .search_memories_response import SearchMemoriesResponse as SearchMemoriesResponse
|
|
24
|
-
from .memory_upload_file_params import MemoryUploadFileParams as MemoryUploadFileParams
|
|
25
17
|
from .search_documents_response import SearchDocumentsResponse as SearchDocumentsResponse
|
|
26
18
|
from .connection_create_response import ConnectionCreateResponse as ConnectionCreateResponse
|
|
27
19
|
from .connection_import_response import ConnectionImportResponse as ConnectionImportResponse
|
|
28
|
-
from .memory_upload_file_response import MemoryUploadFileResponse as MemoryUploadFileResponse
|
|
29
20
|
from .connection_get_by_id_response import ConnectionGetByIDResponse as ConnectionGetByIDResponse
|
|
30
21
|
from .connection_get_by_tags_params import ConnectionGetByTagsParams as ConnectionGetByTagsParams
|
|
31
22
|
from .connection_get_by_tags_response import ConnectionGetByTagsResponse as ConnectionGetByTagsResponse
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict,
|
|
5
|
+
from typing import Dict, Union, Optional
|
|
6
6
|
from typing_extensions import Annotated, TypedDict
|
|
7
7
|
|
|
8
|
+
from .._types import SequenceNotStr
|
|
8
9
|
from .._utils import PropertyInfo
|
|
9
10
|
|
|
10
11
|
__all__ = ["ConnectionCreateParams"]
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class ConnectionCreateParams(TypedDict, total=False):
|
|
14
|
-
container_tags: Annotated[
|
|
15
|
+
container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
|
|
15
16
|
|
|
16
17
|
document_limit: Annotated[int, PropertyInfo(alias="documentLimit")]
|
|
17
18
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import List
|
|
6
5
|
from typing_extensions import Required, Annotated, TypedDict
|
|
7
6
|
|
|
7
|
+
from .._types import SequenceNotStr
|
|
8
8
|
from .._utils import PropertyInfo
|
|
9
9
|
|
|
10
10
|
__all__ = ["ConnectionDeleteByProviderParams"]
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class ConnectionDeleteByProviderParams(TypedDict, total=False):
|
|
14
|
-
container_tags: Required[Annotated[
|
|
14
|
+
container_tags: Required[Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]]
|
|
15
15
|
"""Optional comma-separated list of container tags to filter connections by"""
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import List
|
|
6
5
|
from typing_extensions import Required, Annotated, TypedDict
|
|
7
6
|
|
|
7
|
+
from .._types import SequenceNotStr
|
|
8
8
|
from .._utils import PropertyInfo
|
|
9
9
|
|
|
10
10
|
__all__ = ["ConnectionGetByTagsParams"]
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class ConnectionGetByTagsParams(TypedDict, total=False):
|
|
14
|
-
container_tags: Required[Annotated[
|
|
14
|
+
container_tags: Required[Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]]
|
|
15
15
|
"""Comma-separated list of container tags to filter connection by"""
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import List
|
|
6
5
|
from typing_extensions import Annotated, TypedDict
|
|
7
6
|
|
|
7
|
+
from .._types import SequenceNotStr
|
|
8
8
|
from .._utils import PropertyInfo
|
|
9
9
|
|
|
10
10
|
__all__ = ["ConnectionImportParams"]
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class ConnectionImportParams(TypedDict, total=False):
|
|
14
|
-
container_tags: Annotated[
|
|
14
|
+
container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
|
|
15
15
|
"""Optional comma-separated list of container tags to filter connections by"""
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import List
|
|
6
5
|
from typing_extensions import Annotated, TypedDict
|
|
7
6
|
|
|
7
|
+
from .._types import SequenceNotStr
|
|
8
8
|
from .._utils import PropertyInfo
|
|
9
9
|
|
|
10
10
|
__all__ = ["ConnectionListDocumentsParams"]
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class ConnectionListDocumentsParams(TypedDict, total=False):
|
|
14
|
-
container_tags: Annotated[
|
|
14
|
+
container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
|
|
15
15
|
"""Optional comma-separated list of container tags to filter documents by"""
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import List
|
|
6
5
|
from typing_extensions import Annotated, TypedDict
|
|
7
6
|
|
|
7
|
+
from .._types import SequenceNotStr
|
|
8
8
|
from .._utils import PropertyInfo
|
|
9
9
|
|
|
10
10
|
__all__ = ["ConnectionListParams"]
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class ConnectionListParams(TypedDict, total=False):
|
|
14
|
-
container_tags: Annotated[
|
|
14
|
+
container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
|
|
15
15
|
"""Optional comma-separated list of container tags to filter documents by"""
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
from typing import Dict, List, Union, Iterable
|
|
6
6
|
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
|
|
7
7
|
|
|
8
|
+
from .._types import SequenceNotStr
|
|
8
9
|
from .._utils import PropertyInfo
|
|
9
10
|
|
|
10
11
|
__all__ = ["SearchDocumentsParams", "Filters", "FiltersUnionMember0"]
|
|
@@ -26,11 +27,11 @@ class SearchDocumentsParams(TypedDict, total=False):
|
|
|
26
27
|
(returns lesser chunks, accurate results)
|
|
27
28
|
"""
|
|
28
29
|
|
|
29
|
-
container_tags: Annotated[
|
|
30
|
+
container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
|
|
30
31
|
"""Optional tags this search should be containerized by.
|
|
31
32
|
|
|
32
33
|
This can be an ID for your user, a project ID, or any other identifier you wish
|
|
33
|
-
to use to filter
|
|
34
|
+
to use to filter documents.
|
|
34
35
|
"""
|
|
35
36
|
|
|
36
37
|
doc_id: Annotated[str, PropertyInfo(alias="docId")]
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
from typing import Dict, List, Union, Iterable
|
|
6
6
|
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
|
|
7
7
|
|
|
8
|
+
from .._types import SequenceNotStr
|
|
8
9
|
from .._utils import PropertyInfo
|
|
9
10
|
|
|
10
11
|
__all__ = ["SearchExecuteParams", "Filters", "FiltersUnionMember0"]
|
|
@@ -26,11 +27,11 @@ class SearchExecuteParams(TypedDict, total=False):
|
|
|
26
27
|
(returns lesser chunks, accurate results)
|
|
27
28
|
"""
|
|
28
29
|
|
|
29
|
-
container_tags: Annotated[
|
|
30
|
+
container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
|
|
30
31
|
"""Optional tags this search should be containerized by.
|
|
31
32
|
|
|
32
33
|
This can be an ID for your user, a project ID, or any other identifier you wish
|
|
33
|
-
to use to filter
|
|
34
|
+
to use to filter documents.
|
|
34
35
|
"""
|
|
35
36
|
|
|
36
37
|
doc_id: Annotated[str, PropertyInfo(alias="docId")]
|