supermemory 3.0.0a22__py3-none-any.whl → 3.0.0a24__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 +12 -2
- supermemory/_files.py +4 -4
- supermemory/_models.py +31 -7
- supermemory/_version.py +1 -1
- supermemory/resources/memories.py +22 -22
- supermemory/types/connection_get_by_id_response.py +3 -2
- supermemory/types/connection_get_by_tags_response.py +3 -2
- supermemory/types/connection_list_response.py +3 -2
- supermemory/types/memory_add_params.py +9 -9
- supermemory/types/memory_get_response.py +9 -3
- supermemory/types/memory_update_params.py +9 -9
- supermemory/types/search_execute_response.py +3 -0
- {supermemory-3.0.0a22.dist-info → supermemory-3.0.0a24.dist-info}/METADATA +11 -20
- {supermemory-3.0.0a22.dist-info → supermemory-3.0.0a24.dist-info}/RECORD +16 -16
- {supermemory-3.0.0a22.dist-info → supermemory-3.0.0a24.dist-info}/WHEEL +0 -0
- {supermemory-3.0.0a22.dist-info → supermemory-3.0.0a24.dist-info}/licenses/LICENSE +0 -0
supermemory/_base_client.py
CHANGED
|
@@ -529,6 +529,18 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
529
529
|
# work around https://github.com/encode/httpx/discussions/2880
|
|
530
530
|
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
|
|
531
531
|
|
|
532
|
+
is_body_allowed = options.method.lower() != "get"
|
|
533
|
+
|
|
534
|
+
if is_body_allowed:
|
|
535
|
+
if isinstance(json_data, bytes):
|
|
536
|
+
kwargs["content"] = json_data
|
|
537
|
+
else:
|
|
538
|
+
kwargs["json"] = json_data if is_given(json_data) else None
|
|
539
|
+
kwargs["files"] = files
|
|
540
|
+
else:
|
|
541
|
+
headers.pop("Content-Type", None)
|
|
542
|
+
kwargs.pop("data", None)
|
|
543
|
+
|
|
532
544
|
# TODO: report this error to httpx
|
|
533
545
|
return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
|
|
534
546
|
headers=headers,
|
|
@@ -540,8 +552,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
540
552
|
# so that passing a `TypedDict` doesn't cause an error.
|
|
541
553
|
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
|
|
542
554
|
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
|
|
543
|
-
json=json_data if is_given(json_data) else None,
|
|
544
|
-
files=files,
|
|
545
555
|
**kwargs,
|
|
546
556
|
)
|
|
547
557
|
|
supermemory/_files.py
CHANGED
|
@@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes:
|
|
|
69
69
|
return file
|
|
70
70
|
|
|
71
71
|
if is_tuple_t(file):
|
|
72
|
-
return (file[0],
|
|
72
|
+
return (file[0], read_file_content(file[1]), *file[2:])
|
|
73
73
|
|
|
74
74
|
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
def
|
|
77
|
+
def read_file_content(file: FileContent) -> HttpxFileContent:
|
|
78
78
|
if isinstance(file, os.PathLike):
|
|
79
79
|
return pathlib.Path(file).read_bytes()
|
|
80
80
|
return file
|
|
@@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes:
|
|
|
111
111
|
return file
|
|
112
112
|
|
|
113
113
|
if is_tuple_t(file):
|
|
114
|
-
return (file[0], await
|
|
114
|
+
return (file[0], await async_read_file_content(file[1]), *file[2:])
|
|
115
115
|
|
|
116
116
|
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
async def
|
|
119
|
+
async def async_read_file_content(file: FileContent) -> HttpxFileContent:
|
|
120
120
|
if isinstance(file, os.PathLike):
|
|
121
121
|
return await anyio.Path(file).read_bytes()
|
|
122
122
|
|
supermemory/_models.py
CHANGED
|
@@ -2,9 +2,10 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
import inspect
|
|
5
|
-
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
|
|
6
6
|
from datetime import date, datetime
|
|
7
7
|
from typing_extensions import (
|
|
8
|
+
List,
|
|
8
9
|
Unpack,
|
|
9
10
|
Literal,
|
|
10
11
|
ClassVar,
|
|
@@ -207,14 +208,18 @@ class BaseModel(pydantic.BaseModel):
|
|
|
207
208
|
else:
|
|
208
209
|
fields_values[name] = field_get_default(field)
|
|
209
210
|
|
|
211
|
+
extra_field_type = _get_extra_fields_type(__cls)
|
|
212
|
+
|
|
210
213
|
_extra = {}
|
|
211
214
|
for key, value in values.items():
|
|
212
215
|
if key not in model_fields:
|
|
216
|
+
parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value
|
|
217
|
+
|
|
213
218
|
if PYDANTIC_V2:
|
|
214
|
-
_extra[key] =
|
|
219
|
+
_extra[key] = parsed
|
|
215
220
|
else:
|
|
216
221
|
_fields_set.add(key)
|
|
217
|
-
fields_values[key] =
|
|
222
|
+
fields_values[key] = parsed
|
|
218
223
|
|
|
219
224
|
object.__setattr__(m, "__dict__", fields_values)
|
|
220
225
|
|
|
@@ -366,7 +371,24 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
|
|
|
366
371
|
if type_ is None:
|
|
367
372
|
raise RuntimeError(f"Unexpected field type is None for {key}")
|
|
368
373
|
|
|
369
|
-
return construct_type(value=value, type_=type_)
|
|
374
|
+
return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None:
|
|
378
|
+
if not PYDANTIC_V2:
|
|
379
|
+
# TODO
|
|
380
|
+
return None
|
|
381
|
+
|
|
382
|
+
schema = cls.__pydantic_core_schema__
|
|
383
|
+
if schema["type"] == "model":
|
|
384
|
+
fields = schema["schema"]
|
|
385
|
+
if fields["type"] == "model-fields":
|
|
386
|
+
extras = fields.get("extras_schema")
|
|
387
|
+
if extras and "cls" in extras:
|
|
388
|
+
# mypy can't narrow the type
|
|
389
|
+
return extras["cls"] # type: ignore[no-any-return]
|
|
390
|
+
|
|
391
|
+
return None
|
|
370
392
|
|
|
371
393
|
|
|
372
394
|
def is_basemodel(type_: type) -> bool:
|
|
@@ -420,7 +442,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
|
|
|
420
442
|
return cast(_T, construct_type(value=value, type_=type_))
|
|
421
443
|
|
|
422
444
|
|
|
423
|
-
def construct_type(*, value: object, type_: object) -> object:
|
|
445
|
+
def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object:
|
|
424
446
|
"""Loose coercion to the expected type with construction of nested values.
|
|
425
447
|
|
|
426
448
|
If the given value does not match the expected type then it is returned as-is.
|
|
@@ -438,8 +460,10 @@ def construct_type(*, value: object, type_: object) -> object:
|
|
|
438
460
|
type_ = type_.__value__ # type: ignore[unreachable]
|
|
439
461
|
|
|
440
462
|
# unwrap `Annotated[T, ...]` -> `T`
|
|
441
|
-
if
|
|
442
|
-
meta: tuple[Any, ...] =
|
|
463
|
+
if metadata is not None and len(metadata) > 0:
|
|
464
|
+
meta: tuple[Any, ...] = tuple(metadata)
|
|
465
|
+
elif is_annotated_type(type_):
|
|
466
|
+
meta = get_args(type_)[1:]
|
|
443
467
|
type_ = extract_type_arg(type_, 0)
|
|
444
468
|
else:
|
|
445
469
|
meta = tuple()
|
supermemory/_version.py
CHANGED
|
@@ -51,8 +51,8 @@ class MemoriesResource(SyncAPIResource):
|
|
|
51
51
|
self,
|
|
52
52
|
id: str,
|
|
53
53
|
*,
|
|
54
|
-
content: str,
|
|
55
54
|
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
|
55
|
+
content: str | NotGiven = NOT_GIVEN,
|
|
56
56
|
custom_id: str | NotGiven = NOT_GIVEN,
|
|
57
57
|
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
|
|
58
58
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -66,6 +66,9 @@ class MemoriesResource(SyncAPIResource):
|
|
|
66
66
|
Update a memory with any content type (text, url, file, etc.) and metadata
|
|
67
67
|
|
|
68
68
|
Args:
|
|
69
|
+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
|
70
|
+
user, a project ID, or any other identifier you wish to use to group memories.
|
|
71
|
+
|
|
69
72
|
content: The content to extract and process into a memory. This can be a URL to a
|
|
70
73
|
website, a PDF, an image, or a video.
|
|
71
74
|
|
|
@@ -75,9 +78,6 @@ class MemoriesResource(SyncAPIResource):
|
|
|
75
78
|
|
|
76
79
|
We automatically detect the content type from the url's response format.
|
|
77
80
|
|
|
78
|
-
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
|
79
|
-
user, a project ID, or any other identifier you wish to use to group memories.
|
|
80
|
-
|
|
81
81
|
custom_id: Optional custom ID of the memory. This could be an ID from your database that
|
|
82
82
|
will uniquely identify this memory.
|
|
83
83
|
|
|
@@ -101,8 +101,8 @@ class MemoriesResource(SyncAPIResource):
|
|
|
101
101
|
f"/v3/memories/{id}",
|
|
102
102
|
body=maybe_transform(
|
|
103
103
|
{
|
|
104
|
-
"content": content,
|
|
105
104
|
"container_tags": container_tags,
|
|
105
|
+
"content": content,
|
|
106
106
|
"custom_id": custom_id,
|
|
107
107
|
"metadata": metadata,
|
|
108
108
|
},
|
|
@@ -186,7 +186,7 @@ class MemoriesResource(SyncAPIResource):
|
|
|
186
186
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
187
187
|
) -> None:
|
|
188
188
|
"""
|
|
189
|
-
Delete a memory
|
|
189
|
+
Delete a memory by ID
|
|
190
190
|
|
|
191
191
|
Args:
|
|
192
192
|
extra_headers: Send extra headers
|
|
@@ -211,8 +211,8 @@ class MemoriesResource(SyncAPIResource):
|
|
|
211
211
|
def add(
|
|
212
212
|
self,
|
|
213
213
|
*,
|
|
214
|
-
content: str,
|
|
215
214
|
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
|
215
|
+
content: str | NotGiven = NOT_GIVEN,
|
|
216
216
|
custom_id: str | NotGiven = NOT_GIVEN,
|
|
217
217
|
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
|
|
218
218
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -226,6 +226,9 @@ class MemoriesResource(SyncAPIResource):
|
|
|
226
226
|
Add a memory with any content type (text, url, file, etc.) and metadata
|
|
227
227
|
|
|
228
228
|
Args:
|
|
229
|
+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
|
230
|
+
user, a project ID, or any other identifier you wish to use to group memories.
|
|
231
|
+
|
|
229
232
|
content: The content to extract and process into a memory. This can be a URL to a
|
|
230
233
|
website, a PDF, an image, or a video.
|
|
231
234
|
|
|
@@ -235,9 +238,6 @@ class MemoriesResource(SyncAPIResource):
|
|
|
235
238
|
|
|
236
239
|
We automatically detect the content type from the url's response format.
|
|
237
240
|
|
|
238
|
-
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
|
239
|
-
user, a project ID, or any other identifier you wish to use to group memories.
|
|
240
|
-
|
|
241
241
|
custom_id: Optional custom ID of the memory. This could be an ID from your database that
|
|
242
242
|
will uniquely identify this memory.
|
|
243
243
|
|
|
@@ -259,8 +259,8 @@ class MemoriesResource(SyncAPIResource):
|
|
|
259
259
|
"/v3/memories",
|
|
260
260
|
body=maybe_transform(
|
|
261
261
|
{
|
|
262
|
-
"content": content,
|
|
263
262
|
"container_tags": container_tags,
|
|
263
|
+
"content": content,
|
|
264
264
|
"custom_id": custom_id,
|
|
265
265
|
"metadata": metadata,
|
|
266
266
|
},
|
|
@@ -330,8 +330,8 @@ class AsyncMemoriesResource(AsyncAPIResource):
|
|
|
330
330
|
self,
|
|
331
331
|
id: str,
|
|
332
332
|
*,
|
|
333
|
-
content: str,
|
|
334
333
|
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
|
334
|
+
content: str | NotGiven = NOT_GIVEN,
|
|
335
335
|
custom_id: str | NotGiven = NOT_GIVEN,
|
|
336
336
|
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
|
|
337
337
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -345,6 +345,9 @@ class AsyncMemoriesResource(AsyncAPIResource):
|
|
|
345
345
|
Update a memory with any content type (text, url, file, etc.) and metadata
|
|
346
346
|
|
|
347
347
|
Args:
|
|
348
|
+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
|
349
|
+
user, a project ID, or any other identifier you wish to use to group memories.
|
|
350
|
+
|
|
348
351
|
content: The content to extract and process into a memory. This can be a URL to a
|
|
349
352
|
website, a PDF, an image, or a video.
|
|
350
353
|
|
|
@@ -354,9 +357,6 @@ class AsyncMemoriesResource(AsyncAPIResource):
|
|
|
354
357
|
|
|
355
358
|
We automatically detect the content type from the url's response format.
|
|
356
359
|
|
|
357
|
-
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
|
358
|
-
user, a project ID, or any other identifier you wish to use to group memories.
|
|
359
|
-
|
|
360
360
|
custom_id: Optional custom ID of the memory. This could be an ID from your database that
|
|
361
361
|
will uniquely identify this memory.
|
|
362
362
|
|
|
@@ -380,8 +380,8 @@ class AsyncMemoriesResource(AsyncAPIResource):
|
|
|
380
380
|
f"/v3/memories/{id}",
|
|
381
381
|
body=await async_maybe_transform(
|
|
382
382
|
{
|
|
383
|
-
"content": content,
|
|
384
383
|
"container_tags": container_tags,
|
|
384
|
+
"content": content,
|
|
385
385
|
"custom_id": custom_id,
|
|
386
386
|
"metadata": metadata,
|
|
387
387
|
},
|
|
@@ -465,7 +465,7 @@ class AsyncMemoriesResource(AsyncAPIResource):
|
|
|
465
465
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
466
466
|
) -> None:
|
|
467
467
|
"""
|
|
468
|
-
Delete a memory
|
|
468
|
+
Delete a memory by ID
|
|
469
469
|
|
|
470
470
|
Args:
|
|
471
471
|
extra_headers: Send extra headers
|
|
@@ -490,8 +490,8 @@ class AsyncMemoriesResource(AsyncAPIResource):
|
|
|
490
490
|
async def add(
|
|
491
491
|
self,
|
|
492
492
|
*,
|
|
493
|
-
content: str,
|
|
494
493
|
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
|
494
|
+
content: str | NotGiven = NOT_GIVEN,
|
|
495
495
|
custom_id: str | NotGiven = NOT_GIVEN,
|
|
496
496
|
metadata: Dict[str, Union[str, float, bool]] | NotGiven = NOT_GIVEN,
|
|
497
497
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -505,6 +505,9 @@ class AsyncMemoriesResource(AsyncAPIResource):
|
|
|
505
505
|
Add a memory with any content type (text, url, file, etc.) and metadata
|
|
506
506
|
|
|
507
507
|
Args:
|
|
508
|
+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
|
509
|
+
user, a project ID, or any other identifier you wish to use to group memories.
|
|
510
|
+
|
|
508
511
|
content: The content to extract and process into a memory. This can be a URL to a
|
|
509
512
|
website, a PDF, an image, or a video.
|
|
510
513
|
|
|
@@ -514,9 +517,6 @@ class AsyncMemoriesResource(AsyncAPIResource):
|
|
|
514
517
|
|
|
515
518
|
We automatically detect the content type from the url's response format.
|
|
516
519
|
|
|
517
|
-
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
|
518
|
-
user, a project ID, or any other identifier you wish to use to group memories.
|
|
519
|
-
|
|
520
520
|
custom_id: Optional custom ID of the memory. This could be an ID from your database that
|
|
521
521
|
will uniquely identify this memory.
|
|
522
522
|
|
|
@@ -538,8 +538,8 @@ class AsyncMemoriesResource(AsyncAPIResource):
|
|
|
538
538
|
"/v3/memories",
|
|
539
539
|
body=await async_maybe_transform(
|
|
540
540
|
{
|
|
541
|
-
"content": content,
|
|
542
541
|
"container_tags": container_tags,
|
|
542
|
+
"content": content,
|
|
543
543
|
"custom_id": custom_id,
|
|
544
544
|
"metadata": metadata,
|
|
545
545
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
from typing import Dict, Optional
|
|
4
|
+
from datetime import datetime
|
|
4
5
|
|
|
5
6
|
from pydantic import Field as FieldInfo
|
|
6
7
|
|
|
@@ -12,7 +13,7 @@ __all__ = ["ConnectionGetByIDResponse"]
|
|
|
12
13
|
class ConnectionGetByIDResponse(BaseModel):
|
|
13
14
|
id: str
|
|
14
15
|
|
|
15
|
-
created_at:
|
|
16
|
+
created_at: datetime = FieldInfo(alias="createdAt")
|
|
16
17
|
|
|
17
18
|
provider: str
|
|
18
19
|
|
|
@@ -20,6 +21,6 @@ class ConnectionGetByIDResponse(BaseModel):
|
|
|
20
21
|
|
|
21
22
|
email: Optional[str] = None
|
|
22
23
|
|
|
23
|
-
expires_at: Optional[
|
|
24
|
+
expires_at: Optional[datetime] = FieldInfo(alias="expiresAt", default=None)
|
|
24
25
|
|
|
25
26
|
metadata: Optional[Dict[str, object]] = None
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
from typing import Dict, Optional
|
|
4
|
+
from datetime import datetime
|
|
4
5
|
|
|
5
6
|
from pydantic import Field as FieldInfo
|
|
6
7
|
|
|
@@ -12,7 +13,7 @@ __all__ = ["ConnectionGetByTagsResponse"]
|
|
|
12
13
|
class ConnectionGetByTagsResponse(BaseModel):
|
|
13
14
|
id: str
|
|
14
15
|
|
|
15
|
-
created_at:
|
|
16
|
+
created_at: datetime = FieldInfo(alias="createdAt")
|
|
16
17
|
|
|
17
18
|
provider: str
|
|
18
19
|
|
|
@@ -20,6 +21,6 @@ class ConnectionGetByTagsResponse(BaseModel):
|
|
|
20
21
|
|
|
21
22
|
email: Optional[str] = None
|
|
22
23
|
|
|
23
|
-
expires_at: Optional[
|
|
24
|
+
expires_at: Optional[datetime] = FieldInfo(alias="expiresAt", default=None)
|
|
24
25
|
|
|
25
26
|
metadata: Optional[Dict[str, object]] = None
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
from typing import Dict, List, Optional
|
|
4
|
+
from datetime import datetime
|
|
4
5
|
from typing_extensions import TypeAlias
|
|
5
6
|
|
|
6
7
|
from pydantic import Field as FieldInfo
|
|
@@ -13,7 +14,7 @@ __all__ = ["ConnectionListResponse", "ConnectionListResponseItem"]
|
|
|
13
14
|
class ConnectionListResponseItem(BaseModel):
|
|
14
15
|
id: str
|
|
15
16
|
|
|
16
|
-
created_at:
|
|
17
|
+
created_at: datetime = FieldInfo(alias="createdAt")
|
|
17
18
|
|
|
18
19
|
provider: str
|
|
19
20
|
|
|
@@ -21,7 +22,7 @@ class ConnectionListResponseItem(BaseModel):
|
|
|
21
22
|
|
|
22
23
|
email: Optional[str] = None
|
|
23
24
|
|
|
24
|
-
expires_at: Optional[
|
|
25
|
+
expires_at: Optional[datetime] = FieldInfo(alias="expiresAt", default=None)
|
|
25
26
|
|
|
26
27
|
metadata: Optional[Dict[str, object]] = None
|
|
27
28
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from typing import Dict, List, Union
|
|
6
|
-
from typing_extensions import
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
7
7
|
|
|
8
8
|
from .._utils import PropertyInfo
|
|
9
9
|
|
|
@@ -11,7 +11,14 @@ __all__ = ["MemoryAddParams"]
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class MemoryAddParams(TypedDict, total=False):
|
|
14
|
-
|
|
14
|
+
container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")]
|
|
15
|
+
"""Optional tags this memory should be containerized by.
|
|
16
|
+
|
|
17
|
+
This can be an ID for your user, a project ID, or any other identifier you wish
|
|
18
|
+
to use to group memories.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
content: str
|
|
15
22
|
"""The content to extract and process into a memory.
|
|
16
23
|
|
|
17
24
|
This can be a URL to a website, a PDF, an image, or a video.
|
|
@@ -23,13 +30,6 @@ class MemoryAddParams(TypedDict, total=False):
|
|
|
23
30
|
We automatically detect the content type from the url's response format.
|
|
24
31
|
"""
|
|
25
32
|
|
|
26
|
-
container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")]
|
|
27
|
-
"""Optional tags this memory should be containerized by.
|
|
28
|
-
|
|
29
|
-
This can be an ID for your user, a project ID, or any other identifier you wish
|
|
30
|
-
to use to group memories.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
33
|
custom_id: Annotated[str, PropertyInfo(alias="customId")]
|
|
34
34
|
"""Optional custom ID of the memory.
|
|
35
35
|
|
|
@@ -62,6 +62,12 @@ class MemoryGetResponse(BaseModel):
|
|
|
62
62
|
summary: Optional[str] = None
|
|
63
63
|
"""Summary of the memory content"""
|
|
64
64
|
|
|
65
|
+
summary_embedding_model: Optional[str] = FieldInfo(alias="summaryEmbeddingModel", default=None)
|
|
66
|
+
|
|
67
|
+
summary_embedding_model_new: Optional[str] = FieldInfo(alias="summaryEmbeddingModelNew", default=None)
|
|
68
|
+
|
|
69
|
+
summary_embedding_new: Optional[List[float]] = FieldInfo(alias="summaryEmbeddingNew", default=None)
|
|
70
|
+
|
|
65
71
|
title: Optional[str] = None
|
|
66
72
|
"""Title of the memory"""
|
|
67
73
|
|
|
@@ -83,9 +89,6 @@ class MemoryGetResponse(BaseModel):
|
|
|
83
89
|
updated_at: datetime = FieldInfo(alias="updatedAt")
|
|
84
90
|
"""Last update timestamp"""
|
|
85
91
|
|
|
86
|
-
url: Optional[str] = None
|
|
87
|
-
"""URL of the memory"""
|
|
88
|
-
|
|
89
92
|
container_tags: Optional[List[str]] = FieldInfo(alias="containerTags", default=None)
|
|
90
93
|
"""Optional tags this memory should be containerized by.
|
|
91
94
|
|
|
@@ -95,3 +98,6 @@ class MemoryGetResponse(BaseModel):
|
|
|
95
98
|
|
|
96
99
|
raw: None = None
|
|
97
100
|
"""Raw content of the memory"""
|
|
101
|
+
|
|
102
|
+
url: Optional[str] = None
|
|
103
|
+
"""URL of the memory"""
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from typing import Dict, List, Union
|
|
6
|
-
from typing_extensions import
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
7
7
|
|
|
8
8
|
from .._utils import PropertyInfo
|
|
9
9
|
|
|
@@ -11,7 +11,14 @@ __all__ = ["MemoryUpdateParams"]
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class MemoryUpdateParams(TypedDict, total=False):
|
|
14
|
-
|
|
14
|
+
container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")]
|
|
15
|
+
"""Optional tags this memory should be containerized by.
|
|
16
|
+
|
|
17
|
+
This can be an ID for your user, a project ID, or any other identifier you wish
|
|
18
|
+
to use to group memories.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
content: str
|
|
15
22
|
"""The content to extract and process into a memory.
|
|
16
23
|
|
|
17
24
|
This can be a URL to a website, a PDF, an image, or a video.
|
|
@@ -23,13 +30,6 @@ class MemoryUpdateParams(TypedDict, total=False):
|
|
|
23
30
|
We automatically detect the content type from the url's response format.
|
|
24
31
|
"""
|
|
25
32
|
|
|
26
|
-
container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")]
|
|
27
|
-
"""Optional tags this memory should be containerized by.
|
|
28
|
-
|
|
29
|
-
This can be an ID for your user, a project ID, or any other identifier you wish
|
|
30
|
-
to use to group memories.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
33
|
custom_id: Annotated[str, PropertyInfo(alias="customId")]
|
|
34
34
|
"""Optional custom ID of the memory.
|
|
35
35
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: supermemory
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.0a24
|
|
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
|
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
23
|
Classifier: Typing :: Typed
|
|
23
24
|
Requires-Python: >=3.8
|
|
@@ -29,12 +30,13 @@ Requires-Dist: sniffio
|
|
|
29
30
|
Requires-Dist: typing-extensions<5,>=4.10
|
|
30
31
|
Provides-Extra: aiohttp
|
|
31
32
|
Requires-Dist: aiohttp; extra == 'aiohttp'
|
|
32
|
-
Requires-Dist: httpx-aiohttp>=0.1.
|
|
33
|
+
Requires-Dist: httpx-aiohttp>=0.1.8; extra == 'aiohttp'
|
|
33
34
|
Description-Content-Type: text/markdown
|
|
34
35
|
|
|
35
36
|
# Supermemory Python API library
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
<!-- prettier-ignore -->
|
|
39
|
+
[)](https://pypi.org/project/supermemory/)
|
|
38
40
|
|
|
39
41
|
The Supermemory Python library provides convenient access to the Supermemory REST API from any Python 3.8+
|
|
40
42
|
application. The library includes type definitions for all request params and response fields,
|
|
@@ -116,7 +118,6 @@ pip install --pre supermemory[aiohttp]
|
|
|
116
118
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
117
119
|
|
|
118
120
|
```python
|
|
119
|
-
import os
|
|
120
121
|
import asyncio
|
|
121
122
|
from supermemory import DefaultAioHttpClient
|
|
122
123
|
from supermemory import AsyncSupermemory
|
|
@@ -124,7 +125,7 @@ from supermemory import AsyncSupermemory
|
|
|
124
125
|
|
|
125
126
|
async def main() -> None:
|
|
126
127
|
async with AsyncSupermemory(
|
|
127
|
-
api_key=
|
|
128
|
+
api_key="My API Key",
|
|
128
129
|
http_client=DefaultAioHttpClient(),
|
|
129
130
|
) as client:
|
|
130
131
|
response = await client.search.execute(
|
|
@@ -161,9 +162,7 @@ from supermemory import Supermemory
|
|
|
161
162
|
client = Supermemory()
|
|
162
163
|
|
|
163
164
|
try:
|
|
164
|
-
client.memories.add(
|
|
165
|
-
content="This is a detailed article about machine learning concepts...",
|
|
166
|
-
)
|
|
165
|
+
client.memories.add()
|
|
167
166
|
except supermemory.APIConnectionError as e:
|
|
168
167
|
print("The server could not be reached")
|
|
169
168
|
print(e.__cause__) # an underlying Exception, likely raised within httpx.
|
|
@@ -206,9 +205,7 @@ client = Supermemory(
|
|
|
206
205
|
)
|
|
207
206
|
|
|
208
207
|
# Or, configure per-request:
|
|
209
|
-
client.with_options(max_retries=5).memories.add(
|
|
210
|
-
content="This is a detailed article about machine learning concepts...",
|
|
211
|
-
)
|
|
208
|
+
client.with_options(max_retries=5).memories.add()
|
|
212
209
|
```
|
|
213
210
|
|
|
214
211
|
### Timeouts
|
|
@@ -231,9 +228,7 @@ client = Supermemory(
|
|
|
231
228
|
)
|
|
232
229
|
|
|
233
230
|
# Override per-request:
|
|
234
|
-
client.with_options(timeout=5.0).memories.add(
|
|
235
|
-
content="This is a detailed article about machine learning concepts...",
|
|
236
|
-
)
|
|
231
|
+
client.with_options(timeout=5.0).memories.add()
|
|
237
232
|
```
|
|
238
233
|
|
|
239
234
|
On timeout, an `APITimeoutError` is thrown.
|
|
@@ -274,9 +269,7 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
274
269
|
from supermemory import Supermemory
|
|
275
270
|
|
|
276
271
|
client = Supermemory()
|
|
277
|
-
response = client.memories.with_raw_response.add(
|
|
278
|
-
content="This is a detailed article about machine learning concepts...",
|
|
279
|
-
)
|
|
272
|
+
response = client.memories.with_raw_response.add()
|
|
280
273
|
print(response.headers.get('X-My-Header'))
|
|
281
274
|
|
|
282
275
|
memory = response.parse() # get the object that `memories.add()` would have returned
|
|
@@ -294,9 +287,7 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
294
287
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
|
295
288
|
|
|
296
289
|
```python
|
|
297
|
-
with client.memories.with_streaming_response.add(
|
|
298
|
-
content="This is a detailed article about machine learning concepts...",
|
|
299
|
-
) as response:
|
|
290
|
+
with client.memories.with_streaming_response.add() as response:
|
|
300
291
|
print(response.headers.get("X-My-Header"))
|
|
301
292
|
|
|
302
293
|
for line in response.iter_lines():
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
supermemory/__init__.py,sha256=PDWpv0_OWO8lBFh21lQl5k0zrlBzcGf643CKXRoQgzM,2664
|
|
2
|
-
supermemory/_base_client.py,sha256=
|
|
2
|
+
supermemory/_base_client.py,sha256=dfr5i58hXYTTqDiuvoEKTVNDiQ8EN425dcB7o0VCL98,67040
|
|
3
3
|
supermemory/_client.py,sha256=2KcNz77blgIaQddenKFBrWXUqBG7IlP4vGuVYTix5bk,16890
|
|
4
4
|
supermemory/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
|
|
5
5
|
supermemory/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
|
|
6
6
|
supermemory/_exceptions.py,sha256=5nnX7W8L_eA6LkX3SBl7csJy5d9QEcDqRVuwDq8wVh8,3230
|
|
7
|
-
supermemory/_files.py,sha256=
|
|
8
|
-
supermemory/_models.py,sha256=
|
|
7
|
+
supermemory/_files.py,sha256=KnEzGi_O756MvKyJ4fOCW_u3JhOeWPQ4RsmDvqihDQU,3545
|
|
8
|
+
supermemory/_models.py,sha256=KvjsMfb88XZlFUKVoOxr8OyDj47MhoH2OKqWNEbBhk4,30010
|
|
9
9
|
supermemory/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
|
|
10
10
|
supermemory/_resource.py,sha256=_wuaB1exMy-l-qqdJJdTv15hH5qBSN2Rj9CFwjXTZJU,1130
|
|
11
11
|
supermemory/_response.py,sha256=Yh869-U8INkojKZHFsNw69z5Y2BrK2isgRJ8mifEURM,28848
|
|
12
12
|
supermemory/_streaming.py,sha256=MGbosxSTqq0_JG52hvH2Z-Mr_Y95ws5UdFw77_iYukc,10120
|
|
13
13
|
supermemory/_types.py,sha256=ohS8PFDHBFM-0ua6YsUlS55BPHft3xY6DhiIKaYrlN0,6202
|
|
14
|
-
supermemory/_version.py,sha256=
|
|
14
|
+
supermemory/_version.py,sha256=6-V6tDVbHo8g5QanYNCYP_RJbQQ1_lZKg9ZOKq9ZuZE,172
|
|
15
15
|
supermemory/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
supermemory/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
|
|
17
17
|
supermemory/_utils/_logs.py,sha256=iceljYaEUb4Q4q1SgbSzwSrlJA64ISbaccczzZ8Z9Vg,789
|
|
@@ -26,7 +26,7 @@ supermemory/_utils/_utils.py,sha256=ts4CiiuNpFiGB6YMdkQRh2SZvYvsl7mAF-JWHCcLDf4,
|
|
|
26
26
|
supermemory/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
27
27
|
supermemory/resources/__init__.py,sha256=c1dal-ngMY7gwIf9PDPapYx6rHi670pREX5t3_d6298,2019
|
|
28
28
|
supermemory/resources/connections.py,sha256=-DabGIc4_3qFvFRmBOdHGtu4NkaUOaYz3y50CjpqMKQ,33199
|
|
29
|
-
supermemory/resources/memories.py,sha256=
|
|
29
|
+
supermemory/resources/memories.py,sha256=7Xg6GptloqKEz_eUxSMJT6nS0Orw_ifYnDtWUG5-r1Y,26453
|
|
30
30
|
supermemory/resources/search.py,sha256=9JIv99mPiAlWCEZ41QxAzN4bteCwyo6UCEL3Our-flo,12546
|
|
31
31
|
supermemory/resources/settings.py,sha256=tLM7ya1CEYI_TO8DMP_KLxXHqsxOeq3R3Xs4CQnvPuU,11855
|
|
32
32
|
supermemory/types/__init__.py,sha256=ufEnLZv6LSfCqlxj6R7HDKYZvbnDQdYMpMBTfY8cj6c,2351
|
|
@@ -35,27 +35,27 @@ supermemory/types/connection_create_response.py,sha256=i4sb0DSRs7wVVd8xDBOtr7vw-
|
|
|
35
35
|
supermemory/types/connection_delete_by_id_response.py,sha256=guD1vxqV2wiQnwnWCZSQH0z2HYXQOtvicRzouPVkHXA,243
|
|
36
36
|
supermemory/types/connection_delete_by_provider_params.py,sha256=VnVud6ADbvdYY37BqZ8T-s3wC4xuvbiztge96OuzigM,528
|
|
37
37
|
supermemory/types/connection_delete_by_provider_response.py,sha256=PgMQuSIhVFSF2LVa0FBei2bj3gyVRB7FyOi_-M-Rugc,255
|
|
38
|
-
supermemory/types/connection_get_by_id_response.py,sha256=
|
|
38
|
+
supermemory/types/connection_get_by_id_response.py,sha256=H0xkm41aGnhzN29iPWit9xMjTvKfgoE8BY5xDlEYNtU,650
|
|
39
39
|
supermemory/types/connection_get_by_tags_params.py,sha256=kPQfi7nrM3DbarVx8_Nlq20hVEqelPmfouizAZ6NHDY,504
|
|
40
|
-
supermemory/types/connection_get_by_tags_response.py,sha256=
|
|
40
|
+
supermemory/types/connection_get_by_tags_response.py,sha256=EX5wP1PHFO5uurKiTacudDX3Syp65TUJLN2KVZrb9QE,654
|
|
41
41
|
supermemory/types/connection_import_params.py,sha256=HbMAE6vjmhpJk4shqa9d78hxh_q3J6hdST8GUKGEopM,488
|
|
42
42
|
supermemory/types/connection_list_documents_params.py,sha256=pXMe7sDpqSwBVjPsY2qyTep6rlnfnzE150WdY0-CnOU,500
|
|
43
43
|
supermemory/types/connection_list_documents_response.py,sha256=0IdHufx0yErjfmoXYeY0KJ2QID9C-_58joyGEuu8gd4,682
|
|
44
44
|
supermemory/types/connection_list_params.py,sha256=E0thiUUlyGHeLmb-iAbat1vl8BOqaqCOPDjtYolKkng,482
|
|
45
|
-
supermemory/types/connection_list_response.py,sha256=
|
|
46
|
-
supermemory/types/memory_add_params.py,sha256=
|
|
45
|
+
supermemory/types/connection_list_response.py,sha256=D4mYePuR9NAGMDkbgDncN-KjulLXbCWDfRBvRDXSE58,795
|
|
46
|
+
supermemory/types/memory_add_params.py,sha256=RmaUzYT-FNMfE3263U44lA-OlPS99P27qhiXPgKmQgI,1508
|
|
47
47
|
supermemory/types/memory_add_response.py,sha256=5lim8sVXM7WzG8tUuKORHEe2lJc6yVWvyjylzNsLGjw,219
|
|
48
|
-
supermemory/types/memory_get_response.py,sha256=
|
|
48
|
+
supermemory/types/memory_get_response.py,sha256=qWe-mdEBA-d-zklNnsbULSlGax3KXBMHlyLTPpNglFg,3164
|
|
49
49
|
supermemory/types/memory_list_params.py,sha256=nE4fnYdubdjbGy5-7BxmSms6owZZIbv8PegZxRRzwjA,914
|
|
50
50
|
supermemory/types/memory_list_response.py,sha256=Lq2ChggQ1YCFQLi2M9u61hxRwGf2ib3p9_X8mywJF78,2620
|
|
51
|
-
supermemory/types/memory_update_params.py,sha256=
|
|
51
|
+
supermemory/types/memory_update_params.py,sha256=kyNU53my_W0wVpxgjPMY8IPDi3ccjhqYKkI1OiL6MKQ,1514
|
|
52
52
|
supermemory/types/memory_update_response.py,sha256=fvfO9lGM8xv2EUOQfOSxqig6fx6-ykq7syW69er_2ng,225
|
|
53
53
|
supermemory/types/search_execute_params.py,sha256=8JRtcQ7G1TmG9JW-f1XwNmvT1llM6FsPx0kkQN1Ellw,3130
|
|
54
|
-
supermemory/types/search_execute_response.py,sha256=
|
|
54
|
+
supermemory/types/search_execute_response.py,sha256=NeejFr32sx7PO9Wr_FtwWK1ESXkR9PK0s3-ysOB9sTs,1351
|
|
55
55
|
supermemory/types/setting_get_response.py,sha256=WvgAb9zGMsMnAhLiYk6h5NBptnq0D06TnuoI4EJg5Ds,1648
|
|
56
56
|
supermemory/types/setting_update_params.py,sha256=KsreaS35v25aRKBY5vHna3hZ31U3b1Q5ruQLoM0gcyE,1710
|
|
57
57
|
supermemory/types/setting_update_response.py,sha256=F__RcFFWiiSw11IV8PsWn6POEb1crDwO8QwHEQToVuQ,1806
|
|
58
|
-
supermemory-3.0.
|
|
59
|
-
supermemory-3.0.
|
|
60
|
-
supermemory-3.0.
|
|
61
|
-
supermemory-3.0.
|
|
58
|
+
supermemory-3.0.0a24.dist-info/METADATA,sha256=bJapeuukvXZp-a1_qdVj6Omk95Dhp9s57jUSkYvmz4w,13809
|
|
59
|
+
supermemory-3.0.0a24.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
60
|
+
supermemory-3.0.0a24.dist-info/licenses/LICENSE,sha256=M2NcpYEBpakciOULpWzo-xO2Lincf74gGwfaU00Sct0,11341
|
|
61
|
+
supermemory-3.0.0a24.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|