supermemory 3.7.0__py3-none-any.whl → 3.19.0__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 (53) hide show
  1. supermemory/_base_client.py +140 -11
  2. supermemory/_client.py +226 -52
  3. supermemory/_models.py +16 -1
  4. supermemory/_streaming.py +12 -10
  5. supermemory/_types.py +12 -2
  6. supermemory/_version.py +1 -1
  7. supermemory/resources/connections.py +219 -29
  8. supermemory/resources/documents.py +306 -2
  9. supermemory/resources/memories.py +270 -1
  10. supermemory/resources/search.py +14 -0
  11. supermemory/resources/settings.py +12 -0
  12. supermemory/types/__init__.py +15 -2
  13. supermemory/types/client_profile_params.py +6 -0
  14. supermemory/types/connection_configure_params.py +12 -0
  15. supermemory/types/connection_configure_response.py +17 -0
  16. supermemory/types/connection_get_by_id_response.py +3 -1
  17. supermemory/types/{connection_get_by_tags_params.py → connection_get_by_tag_params.py} +2 -2
  18. supermemory/types/{connection_get_by_tags_response.py → connection_get_by_tag_response.py} +5 -3
  19. supermemory/types/connection_list_response.py +2 -0
  20. supermemory/types/connection_resources_params.py +13 -0
  21. supermemory/types/connection_resources_response.py +13 -0
  22. supermemory/types/document_batch_add_params.py +84 -0
  23. supermemory/types/document_batch_add_response.py +19 -0
  24. supermemory/types/document_delete_bulk_params.py +18 -0
  25. supermemory/types/document_delete_bulk_response.py +37 -0
  26. supermemory/types/document_get_response.py +7 -0
  27. supermemory/types/document_list_params.py +3790 -3
  28. supermemory/types/document_list_processing_response.py +75 -0
  29. supermemory/types/document_list_response.py +5 -0
  30. supermemory/types/document_upload_file_params.py +8 -0
  31. supermemory/types/memory_forget_params.py +26 -0
  32. supermemory/types/memory_forget_response.py +15 -0
  33. supermemory/types/memory_get_response.py +7 -0
  34. supermemory/types/memory_list_params.py +3790 -3
  35. supermemory/types/memory_list_response.py +5 -0
  36. supermemory/types/memory_update_memory_params.py +31 -0
  37. supermemory/types/memory_update_memory_response.py +31 -0
  38. supermemory/types/memory_upload_file_params.py +8 -0
  39. supermemory/types/profile_response.py +2 -0
  40. supermemory/types/search_documents_params.py +3791 -4
  41. supermemory/types/search_documents_response.py +2 -0
  42. supermemory/types/search_execute_params.py +3791 -4
  43. supermemory/types/search_execute_response.py +2 -0
  44. supermemory/types/search_memories_params.py +3809 -8
  45. supermemory/types/search_memories_response.py +33 -5
  46. supermemory/types/setting_get_response.py +6 -0
  47. supermemory/types/setting_update_params.py +6 -0
  48. supermemory/types/setting_update_response.py +6 -0
  49. {supermemory-3.7.0.dist-info → supermemory-3.19.0.dist-info}/METADATA +12 -2
  50. supermemory-3.19.0.dist-info/RECORD +97 -0
  51. {supermemory-3.7.0.dist-info → supermemory-3.19.0.dist-info}/licenses/LICENSE +1 -1
  52. supermemory-3.7.0.dist-info/RECORD +0 -84
  53. {supermemory-3.7.0.dist-info → supermemory-3.19.0.dist-info}/WHEEL +0 -0
@@ -9,6 +9,7 @@ import asyncio
9
9
  import inspect
10
10
  import logging
11
11
  import platform
12
+ import warnings
12
13
  import email.utils
13
14
  from types import TracebackType
14
15
  from random import random
@@ -51,9 +52,11 @@ from ._types import (
51
52
  ResponseT,
52
53
  AnyMapping,
53
54
  PostParser,
55
+ BinaryTypes,
54
56
  RequestFiles,
55
57
  HttpxSendArgs,
56
58
  RequestOptions,
59
+ AsyncBinaryTypes,
57
60
  HttpxRequestFiles,
58
61
  ModelBuilderProtocol,
59
62
  not_given,
@@ -477,8 +480,19 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
477
480
  retries_taken: int = 0,
478
481
  ) -> httpx.Request:
479
482
  if log.isEnabledFor(logging.DEBUG):
480
- log.debug("Request options: %s", model_dump(options, exclude_unset=True))
481
-
483
+ log.debug(
484
+ "Request options: %s",
485
+ model_dump(
486
+ options,
487
+ exclude_unset=True,
488
+ # Pydantic v1 can't dump every type we support in content, so we exclude it for now.
489
+ exclude={
490
+ "content",
491
+ }
492
+ if PYDANTIC_V1
493
+ else {},
494
+ ),
495
+ )
482
496
  kwargs: dict[str, Any] = {}
483
497
 
484
498
  json_data = options.json_data
@@ -532,7 +546,13 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
532
546
  is_body_allowed = options.method.lower() != "get"
533
547
 
534
548
  if is_body_allowed:
535
- if isinstance(json_data, bytes):
549
+ if options.content is not None and json_data is not None:
550
+ raise TypeError("Passing both `content` and `json_data` is not supported")
551
+ if options.content is not None and files is not None:
552
+ raise TypeError("Passing both `content` and `files` is not supported")
553
+ if options.content is not None:
554
+ kwargs["content"] = options.content
555
+ elif isinstance(json_data, bytes):
536
556
  kwargs["content"] = json_data
537
557
  else:
538
558
  kwargs["json"] = json_data if is_given(json_data) else None
@@ -1194,6 +1214,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1194
1214
  *,
1195
1215
  cast_to: Type[ResponseT],
1196
1216
  body: Body | None = None,
1217
+ content: BinaryTypes | None = None,
1197
1218
  options: RequestOptions = {},
1198
1219
  files: RequestFiles | None = None,
1199
1220
  stream: Literal[False] = False,
@@ -1206,6 +1227,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1206
1227
  *,
1207
1228
  cast_to: Type[ResponseT],
1208
1229
  body: Body | None = None,
1230
+ content: BinaryTypes | None = None,
1209
1231
  options: RequestOptions = {},
1210
1232
  files: RequestFiles | None = None,
1211
1233
  stream: Literal[True],
@@ -1219,6 +1241,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1219
1241
  *,
1220
1242
  cast_to: Type[ResponseT],
1221
1243
  body: Body | None = None,
1244
+ content: BinaryTypes | None = None,
1222
1245
  options: RequestOptions = {},
1223
1246
  files: RequestFiles | None = None,
1224
1247
  stream: bool,
@@ -1231,13 +1254,25 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1231
1254
  *,
1232
1255
  cast_to: Type[ResponseT],
1233
1256
  body: Body | None = None,
1257
+ content: BinaryTypes | None = None,
1234
1258
  options: RequestOptions = {},
1235
1259
  files: RequestFiles | None = None,
1236
1260
  stream: bool = False,
1237
1261
  stream_cls: type[_StreamT] | None = None,
1238
1262
  ) -> ResponseT | _StreamT:
1263
+ if body is not None and content is not None:
1264
+ raise TypeError("Passing both `body` and `content` is not supported")
1265
+ if files is not None and content is not None:
1266
+ raise TypeError("Passing both `files` and `content` is not supported")
1267
+ if isinstance(body, bytes):
1268
+ warnings.warn(
1269
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
1270
+ "Please pass raw bytes via the `content` parameter instead.",
1271
+ DeprecationWarning,
1272
+ stacklevel=2,
1273
+ )
1239
1274
  opts = FinalRequestOptions.construct(
1240
- method="post", url=path, json_data=body, files=to_httpx_files(files), **options
1275
+ method="post", url=path, json_data=body, content=content, files=to_httpx_files(files), **options
1241
1276
  )
1242
1277
  return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
1243
1278
 
@@ -1247,9 +1282,24 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1247
1282
  *,
1248
1283
  cast_to: Type[ResponseT],
1249
1284
  body: Body | None = None,
1285
+ content: BinaryTypes | None = None,
1286
+ files: RequestFiles | None = None,
1250
1287
  options: RequestOptions = {},
1251
1288
  ) -> ResponseT:
1252
- opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options)
1289
+ if body is not None and content is not None:
1290
+ raise TypeError("Passing both `body` and `content` is not supported")
1291
+ if files is not None and content is not None:
1292
+ raise TypeError("Passing both `files` and `content` is not supported")
1293
+ if isinstance(body, bytes):
1294
+ warnings.warn(
1295
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
1296
+ "Please pass raw bytes via the `content` parameter instead.",
1297
+ DeprecationWarning,
1298
+ stacklevel=2,
1299
+ )
1300
+ opts = FinalRequestOptions.construct(
1301
+ method="patch", url=path, json_data=body, content=content, files=to_httpx_files(files), **options
1302
+ )
1253
1303
  return self.request(cast_to, opts)
1254
1304
 
1255
1305
  def put(
@@ -1258,11 +1308,23 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1258
1308
  *,
1259
1309
  cast_to: Type[ResponseT],
1260
1310
  body: Body | None = None,
1311
+ content: BinaryTypes | None = None,
1261
1312
  files: RequestFiles | None = None,
1262
1313
  options: RequestOptions = {},
1263
1314
  ) -> ResponseT:
1315
+ if body is not None and content is not None:
1316
+ raise TypeError("Passing both `body` and `content` is not supported")
1317
+ if files is not None and content is not None:
1318
+ raise TypeError("Passing both `files` and `content` is not supported")
1319
+ if isinstance(body, bytes):
1320
+ warnings.warn(
1321
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
1322
+ "Please pass raw bytes via the `content` parameter instead.",
1323
+ DeprecationWarning,
1324
+ stacklevel=2,
1325
+ )
1264
1326
  opts = FinalRequestOptions.construct(
1265
- method="put", url=path, json_data=body, files=to_httpx_files(files), **options
1327
+ method="put", url=path, json_data=body, content=content, files=to_httpx_files(files), **options
1266
1328
  )
1267
1329
  return self.request(cast_to, opts)
1268
1330
 
@@ -1272,9 +1334,19 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1272
1334
  *,
1273
1335
  cast_to: Type[ResponseT],
1274
1336
  body: Body | None = None,
1337
+ content: BinaryTypes | None = None,
1275
1338
  options: RequestOptions = {},
1276
1339
  ) -> ResponseT:
1277
- opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options)
1340
+ if body is not None and content is not None:
1341
+ raise TypeError("Passing both `body` and `content` is not supported")
1342
+ if isinstance(body, bytes):
1343
+ warnings.warn(
1344
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
1345
+ "Please pass raw bytes via the `content` parameter instead.",
1346
+ DeprecationWarning,
1347
+ stacklevel=2,
1348
+ )
1349
+ opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options)
1278
1350
  return self.request(cast_to, opts)
1279
1351
 
1280
1352
  def get_api_list(
@@ -1714,6 +1786,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1714
1786
  *,
1715
1787
  cast_to: Type[ResponseT],
1716
1788
  body: Body | None = None,
1789
+ content: AsyncBinaryTypes | None = None,
1717
1790
  files: RequestFiles | None = None,
1718
1791
  options: RequestOptions = {},
1719
1792
  stream: Literal[False] = False,
@@ -1726,6 +1799,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1726
1799
  *,
1727
1800
  cast_to: Type[ResponseT],
1728
1801
  body: Body | None = None,
1802
+ content: AsyncBinaryTypes | None = None,
1729
1803
  files: RequestFiles | None = None,
1730
1804
  options: RequestOptions = {},
1731
1805
  stream: Literal[True],
@@ -1739,6 +1813,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1739
1813
  *,
1740
1814
  cast_to: Type[ResponseT],
1741
1815
  body: Body | None = None,
1816
+ content: AsyncBinaryTypes | None = None,
1742
1817
  files: RequestFiles | None = None,
1743
1818
  options: RequestOptions = {},
1744
1819
  stream: bool,
@@ -1751,13 +1826,25 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1751
1826
  *,
1752
1827
  cast_to: Type[ResponseT],
1753
1828
  body: Body | None = None,
1829
+ content: AsyncBinaryTypes | None = None,
1754
1830
  files: RequestFiles | None = None,
1755
1831
  options: RequestOptions = {},
1756
1832
  stream: bool = False,
1757
1833
  stream_cls: type[_AsyncStreamT] | None = None,
1758
1834
  ) -> ResponseT | _AsyncStreamT:
1835
+ if body is not None and content is not None:
1836
+ raise TypeError("Passing both `body` and `content` is not supported")
1837
+ if files is not None and content is not None:
1838
+ raise TypeError("Passing both `files` and `content` is not supported")
1839
+ if isinstance(body, bytes):
1840
+ warnings.warn(
1841
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
1842
+ "Please pass raw bytes via the `content` parameter instead.",
1843
+ DeprecationWarning,
1844
+ stacklevel=2,
1845
+ )
1759
1846
  opts = FinalRequestOptions.construct(
1760
- method="post", url=path, json_data=body, files=await async_to_httpx_files(files), **options
1847
+ method="post", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options
1761
1848
  )
1762
1849
  return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
1763
1850
 
@@ -1767,9 +1854,29 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1767
1854
  *,
1768
1855
  cast_to: Type[ResponseT],
1769
1856
  body: Body | None = None,
1857
+ content: AsyncBinaryTypes | None = None,
1858
+ files: RequestFiles | None = None,
1770
1859
  options: RequestOptions = {},
1771
1860
  ) -> ResponseT:
1772
- opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options)
1861
+ if body is not None and content is not None:
1862
+ raise TypeError("Passing both `body` and `content` is not supported")
1863
+ if files is not None and content is not None:
1864
+ raise TypeError("Passing both `files` and `content` is not supported")
1865
+ if isinstance(body, bytes):
1866
+ warnings.warn(
1867
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
1868
+ "Please pass raw bytes via the `content` parameter instead.",
1869
+ DeprecationWarning,
1870
+ stacklevel=2,
1871
+ )
1872
+ opts = FinalRequestOptions.construct(
1873
+ method="patch",
1874
+ url=path,
1875
+ json_data=body,
1876
+ content=content,
1877
+ files=await async_to_httpx_files(files),
1878
+ **options,
1879
+ )
1773
1880
  return await self.request(cast_to, opts)
1774
1881
 
1775
1882
  async def put(
@@ -1778,11 +1885,23 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1778
1885
  *,
1779
1886
  cast_to: Type[ResponseT],
1780
1887
  body: Body | None = None,
1888
+ content: AsyncBinaryTypes | None = None,
1781
1889
  files: RequestFiles | None = None,
1782
1890
  options: RequestOptions = {},
1783
1891
  ) -> ResponseT:
1892
+ if body is not None and content is not None:
1893
+ raise TypeError("Passing both `body` and `content` is not supported")
1894
+ if files is not None and content is not None:
1895
+ raise TypeError("Passing both `files` and `content` is not supported")
1896
+ if isinstance(body, bytes):
1897
+ warnings.warn(
1898
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
1899
+ "Please pass raw bytes via the `content` parameter instead.",
1900
+ DeprecationWarning,
1901
+ stacklevel=2,
1902
+ )
1784
1903
  opts = FinalRequestOptions.construct(
1785
- method="put", url=path, json_data=body, files=await async_to_httpx_files(files), **options
1904
+ method="put", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options
1786
1905
  )
1787
1906
  return await self.request(cast_to, opts)
1788
1907
 
@@ -1792,9 +1911,19 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1792
1911
  *,
1793
1912
  cast_to: Type[ResponseT],
1794
1913
  body: Body | None = None,
1914
+ content: AsyncBinaryTypes | None = None,
1795
1915
  options: RequestOptions = {},
1796
1916
  ) -> ResponseT:
1797
- opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options)
1917
+ if body is not None and content is not None:
1918
+ raise TypeError("Passing both `body` and `content` is not supported")
1919
+ if isinstance(body, bytes):
1920
+ warnings.warn(
1921
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
1922
+ "Please pass raw bytes via the `content` parameter instead.",
1923
+ DeprecationWarning,
1924
+ stacklevel=2,
1925
+ )
1926
+ opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options)
1798
1927
  return await self.request(cast_to, opts)
1799
1928
 
1800
1929
  def get_api_list(