supermemory 3.0.0a23__py3-none-any.whl → 3.0.0a25__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.

@@ -532,7 +532,10 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
532
532
  is_body_allowed = options.method.lower() != "get"
533
533
 
534
534
  if is_body_allowed:
535
- kwargs["json"] = json_data if is_given(json_data) else None
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
536
539
  kwargs["files"] = files
537
540
  else:
538
541
  headers.pop("Content-Type", None)
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], _read_file_content(file[1]), *file[2:])
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 _read_file_content(file: FileContent) -> HttpxFileContent:
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 _async_read_file_content(file[1]), *file[2:])
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 _async_read_file_content(file: FileContent) -> HttpxFileContent:
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
@@ -208,14 +208,18 @@ class BaseModel(pydantic.BaseModel):
208
208
  else:
209
209
  fields_values[name] = field_get_default(field)
210
210
 
211
+ extra_field_type = _get_extra_fields_type(__cls)
212
+
211
213
  _extra = {}
212
214
  for key, value in values.items():
213
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
+
214
218
  if PYDANTIC_V2:
215
- _extra[key] = value
219
+ _extra[key] = parsed
216
220
  else:
217
221
  _fields_set.add(key)
218
- fields_values[key] = value
222
+ fields_values[key] = parsed
219
223
 
220
224
  object.__setattr__(m, "__dict__", fields_values)
221
225
 
@@ -370,6 +374,23 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
370
374
  return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
371
375
 
372
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
392
+
393
+
373
394
  def is_basemodel(type_: type) -> bool:
374
395
  """Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`"""
375
396
  if is_union(type_):
@@ -439,7 +460,7 @@ def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]
439
460
  type_ = type_.__value__ # type: ignore[unreachable]
440
461
 
441
462
  # unwrap `Annotated[T, ...]` -> `T`
442
- if metadata is not None:
463
+ if metadata is not None and len(metadata) > 0:
443
464
  meta: tuple[Any, ...] = tuple(metadata)
444
465
  elif is_annotated_type(type_):
445
466
  meta = get_args(type_)[1:]
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__ = "3.0.0-alpha.23" # x-release-please-version
4
+ __version__ = "3.0.0-alpha.25" # x-release-please-version
@@ -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
@@ -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
@@ -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: float = FieldInfo(alias="createdAt")
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[float] = FieldInfo(alias="expiresAt", default=None)
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: float = FieldInfo(alias="createdAt")
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[float] = FieldInfo(alias="expiresAt", default=None)
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: float = FieldInfo(alias="createdAt")
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[float] = FieldInfo(alias="expiresAt", default=None)
25
+ expires_at: Optional[datetime] = FieldInfo(alias="expiresAt", default=None)
25
26
 
26
27
  metadata: Optional[Dict[str, object]] = None
27
28
 
@@ -40,9 +40,15 @@ class Result(BaseModel):
40
40
  title: Optional[str] = None
41
41
  """Document title"""
42
42
 
43
+ type: Optional[str] = None
44
+ """Document type"""
45
+
43
46
  updated_at: datetime = FieldInfo(alias="updatedAt")
44
47
  """Document last update date"""
45
48
 
49
+ content: Optional[str] = None
50
+ """Full document content (only included when includeFullDocs=true)"""
51
+
46
52
  summary: Optional[str] = None
47
53
  """Document summary"""
48
54
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: supermemory
3
- Version: 3.0.0a23
3
+ Version: 3.0.0a25
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
@@ -1,17 +1,17 @@
1
1
  supermemory/__init__.py,sha256=PDWpv0_OWO8lBFh21lQl5k0zrlBzcGf643CKXRoQgzM,2664
2
- supermemory/_base_client.py,sha256=QgICS6jlUewh2gBXzb6SyAL7QIomu4yyztK4aZKSpHQ,66927
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=mf4dOgL4b0ryyZlbqLhggD3GVgDf6XxdGFAgce01ugE,3549
8
- supermemory/_models.py,sha256=viD5E6aDMhxslcFHDYvkHaKzE8YLcNmsPsMe8STixvs,29294
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=l9FP-9dtpXi66ABXyv8NMhU_slS2WPQnMJACoZLhQQ8,172
14
+ supermemory/_version.py,sha256=ayogEgVcdRtqyjCWUnynAHZSzkPhBycE73D5v8L7dqk,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=tN2XaV2Fr3XW1JrW_I1dEWpL_M0PJL2jnxehd-byrYk,26441
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,14 +35,14 @@ 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=IDJYDLxiuun1XiOdEnENe78zQIbM6YJy2IW3X7mStAA,614
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=JLmGSgNS46arQgz8ohIPn8kphfG8HB5eMu7GPdJFqzI,618
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=ZwrRv6zICkn4-M-92ZgDZ2NiVHAEAJZKLZEcu_h_gO4,759
45
+ supermemory/types/connection_list_response.py,sha256=D4mYePuR9NAGMDkbgDncN-KjulLXbCWDfRBvRDXSE58,795
46
46
  supermemory/types/memory_add_params.py,sha256=RmaUzYT-FNMfE3263U44lA-OlPS99P27qhiXPgKmQgI,1508
47
47
  supermemory/types/memory_add_response.py,sha256=5lim8sVXM7WzG8tUuKORHEe2lJc6yVWvyjylzNsLGjw,219
48
48
  supermemory/types/memory_get_response.py,sha256=qWe-mdEBA-d-zklNnsbULSlGax3KXBMHlyLTPpNglFg,3164
@@ -51,11 +51,11 @@ supermemory/types/memory_list_response.py,sha256=Lq2ChggQ1YCFQLi2M9u61hxRwGf2ib3
51
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=iyKh6SHeInl8BYIlvPVWXhfHBjrO6AgWt-1E76Dk8xw,1295
54
+ supermemory/types/search_execute_response.py,sha256=U1Fh4JX433A442Di9nnaQq6ts1olDdz3-SSbKzIFBPc,1460
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.0a23.dist-info/METADATA,sha256=vJPjw_7LAg2r0PckCXJBj-sJ1JqtDMHb7Lp-ytMFHys,13809
59
- supermemory-3.0.0a23.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
60
- supermemory-3.0.0a23.dist-info/licenses/LICENSE,sha256=M2NcpYEBpakciOULpWzo-xO2Lincf74gGwfaU00Sct0,11341
61
- supermemory-3.0.0a23.dist-info/RECORD,,
58
+ supermemory-3.0.0a25.dist-info/METADATA,sha256=S80mW0mqvXO9FiSMoQMyzD8DSFXM6-ZG7yp6txOMVAk,13809
59
+ supermemory-3.0.0a25.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
60
+ supermemory-3.0.0a25.dist-info/licenses/LICENSE,sha256=M2NcpYEBpakciOULpWzo-xO2Lincf74gGwfaU00Sct0,11341
61
+ supermemory-3.0.0a25.dist-info/RECORD,,