supermemory 3.40.0__tar.gz → 3.42.0__tar.gz

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 (131) hide show
  1. supermemory-3.42.0/.release-please-manifest.json +3 -0
  2. {supermemory-3.40.0 → supermemory-3.42.0}/CHANGELOG.md +16 -0
  3. {supermemory-3.40.0 → supermemory-3.42.0}/PKG-INFO +1 -1
  4. {supermemory-3.40.0 → supermemory-3.42.0}/pyproject.toml +1 -1
  5. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_models.py +80 -0
  6. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_version.py +1 -1
  7. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/resources/documents.py +10 -0
  8. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_batch_add_params.py +12 -0
  9. {supermemory-3.40.0 → supermemory-3.42.0}/tests/api_resources/test_documents.py +78 -74
  10. {supermemory-3.40.0 → supermemory-3.42.0}/tests/api_resources/test_search.py +40 -40
  11. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_models.py +57 -3
  12. supermemory-3.40.0/.release-please-manifest.json +0 -3
  13. {supermemory-3.40.0 → supermemory-3.42.0}/.gitignore +0 -0
  14. {supermemory-3.40.0 → supermemory-3.42.0}/CONTRIBUTING.md +0 -0
  15. {supermemory-3.40.0 → supermemory-3.42.0}/LICENSE +0 -0
  16. {supermemory-3.40.0 → supermemory-3.42.0}/README.md +0 -0
  17. {supermemory-3.40.0 → supermemory-3.42.0}/SECURITY.md +0 -0
  18. {supermemory-3.40.0 → supermemory-3.42.0}/api.md +0 -0
  19. {supermemory-3.40.0 → supermemory-3.42.0}/bin/check-release-environment +0 -0
  20. {supermemory-3.40.0 → supermemory-3.42.0}/bin/publish-pypi +0 -0
  21. {supermemory-3.40.0 → supermemory-3.42.0}/examples/.keep +0 -0
  22. {supermemory-3.40.0 → supermemory-3.42.0}/noxfile.py +0 -0
  23. {supermemory-3.40.0 → supermemory-3.42.0}/release-please-config.json +0 -0
  24. {supermemory-3.40.0 → supermemory-3.42.0}/requirements-dev.lock +0 -0
  25. {supermemory-3.40.0 → supermemory-3.42.0}/requirements.lock +0 -0
  26. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/__init__.py +0 -0
  27. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_base_client.py +0 -0
  28. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_client.py +0 -0
  29. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_compat.py +0 -0
  30. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_constants.py +0 -0
  31. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_exceptions.py +0 -0
  32. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_files.py +0 -0
  33. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_qs.py +0 -0
  34. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_resource.py +0 -0
  35. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_response.py +0 -0
  36. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_streaming.py +0 -0
  37. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_types.py +0 -0
  38. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/__init__.py +0 -0
  39. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_compat.py +0 -0
  40. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_datetime_parse.py +0 -0
  41. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_json.py +0 -0
  42. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_logs.py +0 -0
  43. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_path.py +0 -0
  44. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_proxy.py +0 -0
  45. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_reflection.py +0 -0
  46. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_resources_proxy.py +0 -0
  47. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_streams.py +0 -0
  48. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_sync.py +0 -0
  49. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_transform.py +0 -0
  50. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_typing.py +0 -0
  51. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/_utils/_utils.py +0 -0
  52. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/lib/.keep +0 -0
  53. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/py.typed +0 -0
  54. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/resources/__init__.py +0 -0
  55. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/resources/connections.py +0 -0
  56. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/resources/memories.py +0 -0
  57. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/resources/search.py +0 -0
  58. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/resources/settings.py +0 -0
  59. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/__init__.py +0 -0
  60. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/add_response.py +0 -0
  61. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/client_add_params.py +0 -0
  62. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/client_profile_params.py +0 -0
  63. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_configure_params.py +0 -0
  64. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_configure_response.py +0 -0
  65. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_create_params.py +0 -0
  66. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_create_response.py +0 -0
  67. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_delete_by_id_params.py +0 -0
  68. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_delete_by_id_response.py +0 -0
  69. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_delete_by_provider_params.py +0 -0
  70. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_delete_by_provider_response.py +0 -0
  71. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_get_by_id_response.py +0 -0
  72. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_get_by_tag_params.py +0 -0
  73. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_get_by_tag_response.py +0 -0
  74. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_import_params.py +0 -0
  75. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_import_response.py +0 -0
  76. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_list_documents_params.py +0 -0
  77. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_list_documents_response.py +0 -0
  78. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_list_params.py +0 -0
  79. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_list_response.py +0 -0
  80. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_resources_params.py +0 -0
  81. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/connection_resources_response.py +0 -0
  82. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_add_params.py +0 -0
  83. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_add_response.py +0 -0
  84. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_batch_add_response.py +0 -0
  85. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_delete_bulk_params.py +0 -0
  86. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_delete_bulk_response.py +0 -0
  87. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_get_response.py +0 -0
  88. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_list_params.py +0 -0
  89. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_list_processing_response.py +0 -0
  90. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_list_response.py +0 -0
  91. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_update_params.py +0 -0
  92. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_update_response.py +0 -0
  93. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_upload_file_params.py +0 -0
  94. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/document_upload_file_response.py +0 -0
  95. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/memory_forget_params.py +0 -0
  96. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/memory_forget_response.py +0 -0
  97. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/memory_update_memory_params.py +0 -0
  98. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/memory_update_memory_response.py +0 -0
  99. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/profile_response.py +0 -0
  100. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/search_documents_params.py +0 -0
  101. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/search_documents_response.py +0 -0
  102. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/search_execute_params.py +0 -0
  103. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/search_execute_response.py +0 -0
  104. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/search_memories_params.py +0 -0
  105. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/search_memories_response.py +0 -0
  106. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/setting_get_response.py +0 -0
  107. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/setting_update_params.py +0 -0
  108. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory/types/setting_update_response.py +0 -0
  109. {supermemory-3.40.0 → supermemory-3.42.0}/src/supermemory_new/lib/.keep +0 -0
  110. {supermemory-3.40.0 → supermemory-3.42.0}/tests/__init__.py +0 -0
  111. {supermemory-3.40.0 → supermemory-3.42.0}/tests/api_resources/__init__.py +0 -0
  112. {supermemory-3.40.0 → supermemory-3.42.0}/tests/api_resources/test_client.py +0 -0
  113. {supermemory-3.40.0 → supermemory-3.42.0}/tests/api_resources/test_connections.py +0 -0
  114. {supermemory-3.40.0 → supermemory-3.42.0}/tests/api_resources/test_memories.py +0 -0
  115. {supermemory-3.40.0 → supermemory-3.42.0}/tests/api_resources/test_settings.py +0 -0
  116. {supermemory-3.40.0 → supermemory-3.42.0}/tests/conftest.py +0 -0
  117. {supermemory-3.40.0 → supermemory-3.42.0}/tests/sample_file.txt +0 -0
  118. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_client.py +0 -0
  119. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_extract_files.py +0 -0
  120. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_files.py +0 -0
  121. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_qs.py +0 -0
  122. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_required_args.py +0 -0
  123. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_response.py +0 -0
  124. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_streaming.py +0 -0
  125. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_transform.py +0 -0
  126. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_utils/test_datetime_parse.py +0 -0
  127. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_utils/test_json.py +0 -0
  128. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_utils/test_path.py +0 -0
  129. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_utils/test_proxy.py +0 -0
  130. {supermemory-3.40.0 → supermemory-3.42.0}/tests/test_utils/test_typing.py +0 -0
  131. {supermemory-3.40.0 → supermemory-3.42.0}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "3.42.0"
3
+ }
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.42.0 (2026-05-12)
4
+
5
+ Full Changelog: [v3.41.0...v3.42.0](https://github.com/supermemoryai/python-sdk/compare/v3.41.0...v3.42.0)
6
+
7
+ ### Features
8
+
9
+ * **internal/types:** support eagerly validating pydantic iterators ([5bb354d](https://github.com/supermemoryai/python-sdk/commit/5bb354dc5e11ef9f189fd06400b27bff1c727d39))
10
+
11
+ ## 3.41.0 (2026-05-12)
12
+
13
+ Full Changelog: [v3.40.0...v3.41.0](https://github.com/supermemoryai/python-sdk/compare/v3.40.0...v3.41.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** api update ([02a5d82](https://github.com/supermemoryai/python-sdk/commit/02a5d82aaaf3b11183d66ce5adfd154c26ecb324))
18
+
3
19
  ## 3.40.0 (2026-05-11)
4
20
 
5
21
  Full Changelog: [v3.39.0...v3.40.0](https://github.com/supermemoryai/python-sdk/compare/v3.39.0...v3.40.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: supermemory
3
- Version: 3.40.0
3
+ Version: 3.42.0
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,6 +1,6 @@
1
1
  [project]
2
2
  name = "supermemory"
3
- version = "3.40.0"
3
+ version = "3.42.0"
4
4
  description = "The official Python library for the supermemory API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -25,7 +25,9 @@ from typing_extensions import (
25
25
  ClassVar,
26
26
  Protocol,
27
27
  Required,
28
+ Annotated,
28
29
  ParamSpec,
30
+ TypeAlias,
29
31
  TypedDict,
30
32
  TypeGuard,
31
33
  final,
@@ -79,7 +81,15 @@ from ._compat import (
79
81
  from ._constants import RAW_RESPONSE_HEADER
80
82
 
81
83
  if TYPE_CHECKING:
84
+ from pydantic import GetCoreSchemaHandler, ValidatorFunctionWrapHandler
85
+ from pydantic_core import CoreSchema, core_schema
82
86
  from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
87
+ else:
88
+ try:
89
+ from pydantic_core import CoreSchema, core_schema
90
+ except ImportError:
91
+ CoreSchema = None
92
+ core_schema = None
83
93
 
84
94
  __all__ = ["BaseModel", "GenericModel"]
85
95
 
@@ -396,6 +406,76 @@ class BaseModel(pydantic.BaseModel):
396
406
  )
397
407
 
398
408
 
409
+ class _EagerIterable(list[_T], Generic[_T]):
410
+ """
411
+ Accepts any Iterable[T] input (including generators), consumes it
412
+ eagerly, and validates all items upfront.
413
+
414
+ Validation preserves the original container type where possible
415
+ (e.g. a set[T] stays a set[T]). Serialization (model_dump / JSON)
416
+ always emits a list — round-tripping through model_dump() will not
417
+ restore the original container type.
418
+ """
419
+
420
+ @classmethod
421
+ def __get_pydantic_core_schema__(
422
+ cls,
423
+ source_type: Any,
424
+ handler: GetCoreSchemaHandler,
425
+ ) -> CoreSchema:
426
+ (item_type,) = get_args(source_type) or (Any,)
427
+ item_schema: CoreSchema = handler.generate_schema(item_type)
428
+ list_of_items_schema: CoreSchema = core_schema.list_schema(item_schema)
429
+
430
+ return core_schema.no_info_wrap_validator_function(
431
+ cls._validate,
432
+ list_of_items_schema,
433
+ serialization=core_schema.plain_serializer_function_ser_schema(
434
+ cls._serialize,
435
+ info_arg=False,
436
+ ),
437
+ )
438
+
439
+ @staticmethod
440
+ def _validate(v: Iterable[_T], handler: "ValidatorFunctionWrapHandler") -> Any:
441
+ original_type: type[Any] = type(v)
442
+
443
+ # Normalize to list so list_schema can validate each item
444
+ if isinstance(v, list):
445
+ items: list[_T] = v
446
+ else:
447
+ try:
448
+ items = list(v)
449
+ except TypeError as e:
450
+ raise TypeError("Value is not iterable") from e
451
+
452
+ # Validate items against the inner schema
453
+ validated: list[_T] = handler(items)
454
+
455
+ # Reconstruct original container type
456
+ if original_type is list:
457
+ return validated
458
+ # str(list) produces the list's repr, not a string built from items,
459
+ # so skip reconstruction for str and its subclasses.
460
+ if issubclass(original_type, str):
461
+ return validated
462
+ try:
463
+ return original_type(validated)
464
+ except (TypeError, ValueError):
465
+ # If the type cannot be reconstructed, just return the validated list
466
+ return validated
467
+
468
+ @staticmethod
469
+ def _serialize(v: Iterable[_T]) -> list[_T]:
470
+ """Always serialize as a list so Pydantic's JSON encoder is happy."""
471
+ if isinstance(v, list):
472
+ return v
473
+ return list(v)
474
+
475
+
476
+ EagerIterable: TypeAlias = Annotated[Iterable[_T], _EagerIterable]
477
+
478
+
399
479
  def _construct_field(value: object, field: FieldInfo, key: str) -> object:
400
480
  if value is None:
401
481
  return field_get_default(field)
@@ -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.40.0" # x-release-please-version
4
+ __version__ = "3.42.0" # x-release-please-version
@@ -338,6 +338,7 @@ class DocumentsResource(SyncAPIResource):
338
338
  container_tag: str | Omit = omit,
339
339
  container_tags: SequenceNotStr[str] | Omit = omit,
340
340
  content: None | Omit = omit,
341
+ entity_context: str | Omit = omit,
341
342
  filepath: str | Omit = omit,
342
343
  filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
343
344
  metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
@@ -363,6 +364,9 @@ class DocumentsResource(SyncAPIResource):
363
364
  containerized by. This can be an ID for your user, a project ID, or any other
364
365
  identifier you wish to use to group documents.
365
366
 
367
+ entity_context: Optional entity context for this container tag. Max 1500 characters. Used during
368
+ document processing to guide memory extraction.
369
+
366
370
  filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used
367
371
  by supermemoryfs to map documents to filesystem paths.
368
372
 
@@ -396,6 +400,7 @@ class DocumentsResource(SyncAPIResource):
396
400
  "container_tag": container_tag,
397
401
  "container_tags": container_tags,
398
402
  "content": content,
403
+ "entity_context": entity_context,
399
404
  "filepath": filepath,
400
405
  "filter_by_metadata": filter_by_metadata,
401
406
  "metadata": metadata,
@@ -915,6 +920,7 @@ class AsyncDocumentsResource(AsyncAPIResource):
915
920
  container_tag: str | Omit = omit,
916
921
  container_tags: SequenceNotStr[str] | Omit = omit,
917
922
  content: None | Omit = omit,
923
+ entity_context: str | Omit = omit,
918
924
  filepath: str | Omit = omit,
919
925
  filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
920
926
  metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
@@ -940,6 +946,9 @@ class AsyncDocumentsResource(AsyncAPIResource):
940
946
  containerized by. This can be an ID for your user, a project ID, or any other
941
947
  identifier you wish to use to group documents.
942
948
 
949
+ entity_context: Optional entity context for this container tag. Max 1500 characters. Used during
950
+ document processing to guide memory extraction.
951
+
943
952
  filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used
944
953
  by supermemoryfs to map documents to filesystem paths.
945
954
 
@@ -973,6 +982,7 @@ class AsyncDocumentsResource(AsyncAPIResource):
973
982
  "container_tag": container_tag,
974
983
  "container_tags": container_tags,
975
984
  "content": content,
985
+ "entity_context": entity_context,
976
986
  "filepath": filepath,
977
987
  "filter_by_metadata": filter_by_metadata,
978
988
  "metadata": metadata,
@@ -30,6 +30,12 @@ class DocumentBatchAddParams(TypedDict, total=False):
30
30
 
31
31
  content: None
32
32
 
33
+ entity_context: Annotated[str, PropertyInfo(alias="entityContext")]
34
+ """Optional entity context for this container tag.
35
+
36
+ Max 1500 characters. Used during document processing to guide memory extraction.
37
+ """
38
+
33
39
  filepath: str
34
40
  """Optional file path for the document (e.g., '/documents/reports/file.pdf').
35
41
 
@@ -96,6 +102,12 @@ class DocumentsUnionMember0(TypedDict, total=False):
96
102
  document.
97
103
  """
98
104
 
105
+ entity_context: Annotated[str, PropertyInfo(alias="entityContext")]
106
+ """Optional entity context for this container tag.
107
+
108
+ Max 1500 characters. Used during document processing to guide memory extraction.
109
+ """
110
+
99
111
  filepath: str
100
112
  """Optional file path for the document (e.g., '/documents/reports/file.pdf').
101
113
 
@@ -39,22 +39,18 @@ class TestDocuments:
39
39
  def test_method_update_with_all_params(self, client: Supermemory) -> None:
40
40
  document = client.documents.update(
41
41
  id="id",
42
- container_tag="user_123",
43
- container_tags=["user_123", "project_123"],
44
- content="This is a detailed article about machine learning concepts...",
45
- custom_id="mem_abc123",
42
+ container_tag="user_alex",
43
+ container_tags=["_:_k--W2K_1V"],
44
+ content="Our API rate limits are 100 req/min on free and 1000 on pro. Clients should use exponential backoff on 429s.",
45
+ custom_id="doc-api-rate-limits",
46
46
  filepath="/documents/reports/file.pdf",
47
47
  filter_by_metadata={
48
48
  "department": "engineering",
49
49
  "region": "us",
50
50
  },
51
51
  metadata={
52
- "category": "technology",
53
- "isPublic": True,
54
- "readingTime": 5,
55
- "source": "web",
56
- "tag_1": "ai",
57
- "tag_2": "machine-learning",
52
+ "source": "upload",
53
+ "language": "en",
58
54
  },
59
55
  task_type="memory",
60
56
  )
@@ -104,8 +100,8 @@ class TestDocuments:
104
100
  @parametrize
105
101
  def test_method_list_with_all_params(self, client: Supermemory) -> None:
106
102
  document = client.documents.list(
107
- container_tags=["user_123", "project_123"],
108
- filepath="/docs/",
103
+ container_tags=["_:_k--W2K_1V"],
104
+ filepath="filepath",
109
105
  filters={
110
106
  "and_": [
111
107
  {
@@ -252,7 +248,11 @@ class TestDocuments:
252
248
  @parametrize
253
249
  def test_method_batch_add(self, client: Supermemory) -> None:
254
250
  document = client.documents.batch_add(
255
- documents=[{"content": "This is a detailed article about machine learning concepts..."}],
251
+ documents=[
252
+ {
253
+ "content": "Our API rate limits are 100 req/min on free and 1000 on pro. Clients should use exponential backoff on 429s."
254
+ }
255
+ ],
256
256
  )
257
257
  assert_matches_type(DocumentBatchAddResponse, document, path=["response"])
258
258
 
@@ -262,41 +262,35 @@ class TestDocuments:
262
262
  document = client.documents.batch_add(
263
263
  documents=[
264
264
  {
265
- "content": "This is a detailed article about machine learning concepts...",
266
- "container_tag": "user_123",
267
- "container_tags": ["user_123", "project_123"],
268
- "custom_id": "mem_abc123",
265
+ "content": "Our API rate limits are 100 req/min on free and 1000 on pro. Clients should use exponential backoff on 429s.",
266
+ "container_tag": "user_alex",
267
+ "container_tags": ["_:_k--W2K_1V"],
268
+ "custom_id": "doc-api-rate-limits",
269
+ "entity_context": "User's name is {XYZ}",
269
270
  "filepath": "/documents/reports/file.pdf",
270
271
  "filter_by_metadata": {
271
272
  "department": "engineering",
272
273
  "region": "us",
273
274
  },
274
275
  "metadata": {
275
- "category": "technology",
276
- "isPublic": True,
277
- "readingTime": 5,
278
- "source": "web",
279
- "tag_1": "ai",
280
- "tag_2": "machine-learning",
276
+ "source": "upload",
277
+ "language": "en",
281
278
  },
282
279
  "task_type": "memory",
283
280
  }
284
281
  ],
285
- container_tag="user_123",
286
- container_tags=["user_123", "project_123"],
282
+ container_tag="user_alex",
283
+ container_tags=["_:_k--W2K_1V"],
287
284
  content=None,
285
+ entity_context="User's name is {XYZ}",
288
286
  filepath="/documents/reports/file.pdf",
289
287
  filter_by_metadata={
290
288
  "department": "engineering",
291
289
  "region": "us",
292
290
  },
293
291
  metadata={
294
- "category": "technology",
295
- "isPublic": True,
296
- "readingTime": 5,
297
- "source": "web",
298
- "tag_1": "ai",
299
- "tag_2": "machine-learning",
292
+ "source": "upload",
293
+ "language": "en",
300
294
  },
301
295
  task_type="memory",
302
296
  )
@@ -306,7 +300,11 @@ class TestDocuments:
306
300
  @parametrize
307
301
  def test_raw_response_batch_add(self, client: Supermemory) -> None:
308
302
  response = client.documents.with_raw_response.batch_add(
309
- documents=[{"content": "This is a detailed article about machine learning concepts..."}],
303
+ documents=[
304
+ {
305
+ "content": "Our API rate limits are 100 req/min on free and 1000 on pro. Clients should use exponential backoff on 429s."
306
+ }
307
+ ],
310
308
  )
311
309
 
312
310
  assert response.is_closed is True
@@ -318,7 +316,11 @@ class TestDocuments:
318
316
  @parametrize
319
317
  def test_streaming_response_batch_add(self, client: Supermemory) -> None:
320
318
  with client.documents.with_streaming_response.batch_add(
321
- documents=[{"content": "This is a detailed article about machine learning concepts..."}],
319
+ documents=[
320
+ {
321
+ "content": "Our API rate limits are 100 req/min on free and 1000 on pro. Clients should use exponential backoff on 429s."
322
+ }
323
+ ],
322
324
  ) as response:
323
325
  assert not response.is_closed
324
326
  assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -338,8 +340,8 @@ class TestDocuments:
338
340
  @parametrize
339
341
  def test_method_delete_bulk_with_all_params(self, client: Supermemory) -> None:
340
342
  document = client.documents.delete_bulk(
341
- container_tags=["user_123", "project_123"],
342
- filepath="/docs/old/",
343
+ container_tags=["_:_k--W2K_1V"],
344
+ filepath="filepath",
343
345
  ids=["acxV5LHMEsG2hMSNb4umbn", "bxcV5LHMEsG2hMSNb4umbn"],
344
346
  )
345
347
  assert_matches_type(DocumentDeleteBulkResponse, document, path=["response"])
@@ -450,9 +452,9 @@ class TestDocuments:
450
452
  document = client.documents.upload_file(
451
453
  file=b"Example data",
452
454
  container_tag="user",
453
- container_tags='["user_123", "project_123"]',
455
+ container_tags="containerTags",
454
456
  custom_id="mem_abc123",
455
- entity_context="This user is a software engineer who prefers concise technical documentation.",
457
+ entity_context="User's name is {XYZ}",
456
458
  filepath="/documents/reports/file.pdf",
457
459
  file_type="image",
458
460
  filter_by_metadata='{"department": "engineering"}',
@@ -508,22 +510,18 @@ class TestAsyncDocuments:
508
510
  async def test_method_update_with_all_params(self, async_client: AsyncSupermemory) -> None:
509
511
  document = await async_client.documents.update(
510
512
  id="id",
511
- container_tag="user_123",
512
- container_tags=["user_123", "project_123"],
513
- content="This is a detailed article about machine learning concepts...",
514
- custom_id="mem_abc123",
513
+ container_tag="user_alex",
514
+ container_tags=["_:_k--W2K_1V"],
515
+ content="Our API rate limits are 100 req/min on free and 1000 on pro. Clients should use exponential backoff on 429s.",
516
+ custom_id="doc-api-rate-limits",
515
517
  filepath="/documents/reports/file.pdf",
516
518
  filter_by_metadata={
517
519
  "department": "engineering",
518
520
  "region": "us",
519
521
  },
520
522
  metadata={
521
- "category": "technology",
522
- "isPublic": True,
523
- "readingTime": 5,
524
- "source": "web",
525
- "tag_1": "ai",
526
- "tag_2": "machine-learning",
523
+ "source": "upload",
524
+ "language": "en",
527
525
  },
528
526
  task_type="memory",
529
527
  )
@@ -573,8 +571,8 @@ class TestAsyncDocuments:
573
571
  @parametrize
574
572
  async def test_method_list_with_all_params(self, async_client: AsyncSupermemory) -> None:
575
573
  document = await async_client.documents.list(
576
- container_tags=["user_123", "project_123"],
577
- filepath="/docs/",
574
+ container_tags=["_:_k--W2K_1V"],
575
+ filepath="filepath",
578
576
  filters={
579
577
  "and_": [
580
578
  {
@@ -721,7 +719,11 @@ class TestAsyncDocuments:
721
719
  @parametrize
722
720
  async def test_method_batch_add(self, async_client: AsyncSupermemory) -> None:
723
721
  document = await async_client.documents.batch_add(
724
- documents=[{"content": "This is a detailed article about machine learning concepts..."}],
722
+ documents=[
723
+ {
724
+ "content": "Our API rate limits are 100 req/min on free and 1000 on pro. Clients should use exponential backoff on 429s."
725
+ }
726
+ ],
725
727
  )
726
728
  assert_matches_type(DocumentBatchAddResponse, document, path=["response"])
727
729
 
@@ -731,41 +733,35 @@ class TestAsyncDocuments:
731
733
  document = await async_client.documents.batch_add(
732
734
  documents=[
733
735
  {
734
- "content": "This is a detailed article about machine learning concepts...",
735
- "container_tag": "user_123",
736
- "container_tags": ["user_123", "project_123"],
737
- "custom_id": "mem_abc123",
736
+ "content": "Our API rate limits are 100 req/min on free and 1000 on pro. Clients should use exponential backoff on 429s.",
737
+ "container_tag": "user_alex",
738
+ "container_tags": ["_:_k--W2K_1V"],
739
+ "custom_id": "doc-api-rate-limits",
740
+ "entity_context": "User's name is {XYZ}",
738
741
  "filepath": "/documents/reports/file.pdf",
739
742
  "filter_by_metadata": {
740
743
  "department": "engineering",
741
744
  "region": "us",
742
745
  },
743
746
  "metadata": {
744
- "category": "technology",
745
- "isPublic": True,
746
- "readingTime": 5,
747
- "source": "web",
748
- "tag_1": "ai",
749
- "tag_2": "machine-learning",
747
+ "source": "upload",
748
+ "language": "en",
750
749
  },
751
750
  "task_type": "memory",
752
751
  }
753
752
  ],
754
- container_tag="user_123",
755
- container_tags=["user_123", "project_123"],
753
+ container_tag="user_alex",
754
+ container_tags=["_:_k--W2K_1V"],
756
755
  content=None,
756
+ entity_context="User's name is {XYZ}",
757
757
  filepath="/documents/reports/file.pdf",
758
758
  filter_by_metadata={
759
759
  "department": "engineering",
760
760
  "region": "us",
761
761
  },
762
762
  metadata={
763
- "category": "technology",
764
- "isPublic": True,
765
- "readingTime": 5,
766
- "source": "web",
767
- "tag_1": "ai",
768
- "tag_2": "machine-learning",
763
+ "source": "upload",
764
+ "language": "en",
769
765
  },
770
766
  task_type="memory",
771
767
  )
@@ -775,7 +771,11 @@ class TestAsyncDocuments:
775
771
  @parametrize
776
772
  async def test_raw_response_batch_add(self, async_client: AsyncSupermemory) -> None:
777
773
  response = await async_client.documents.with_raw_response.batch_add(
778
- documents=[{"content": "This is a detailed article about machine learning concepts..."}],
774
+ documents=[
775
+ {
776
+ "content": "Our API rate limits are 100 req/min on free and 1000 on pro. Clients should use exponential backoff on 429s."
777
+ }
778
+ ],
779
779
  )
780
780
 
781
781
  assert response.is_closed is True
@@ -787,7 +787,11 @@ class TestAsyncDocuments:
787
787
  @parametrize
788
788
  async def test_streaming_response_batch_add(self, async_client: AsyncSupermemory) -> None:
789
789
  async with async_client.documents.with_streaming_response.batch_add(
790
- documents=[{"content": "This is a detailed article about machine learning concepts..."}],
790
+ documents=[
791
+ {
792
+ "content": "Our API rate limits are 100 req/min on free and 1000 on pro. Clients should use exponential backoff on 429s."
793
+ }
794
+ ],
791
795
  ) as response:
792
796
  assert not response.is_closed
793
797
  assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -807,8 +811,8 @@ class TestAsyncDocuments:
807
811
  @parametrize
808
812
  async def test_method_delete_bulk_with_all_params(self, async_client: AsyncSupermemory) -> None:
809
813
  document = await async_client.documents.delete_bulk(
810
- container_tags=["user_123", "project_123"],
811
- filepath="/docs/old/",
814
+ container_tags=["_:_k--W2K_1V"],
815
+ filepath="filepath",
812
816
  ids=["acxV5LHMEsG2hMSNb4umbn", "bxcV5LHMEsG2hMSNb4umbn"],
813
817
  )
814
818
  assert_matches_type(DocumentDeleteBulkResponse, document, path=["response"])
@@ -919,9 +923,9 @@ class TestAsyncDocuments:
919
923
  document = await async_client.documents.upload_file(
920
924
  file=b"Example data",
921
925
  container_tag="user",
922
- container_tags='["user_123", "project_123"]',
926
+ container_tags="containerTags",
923
927
  custom_id="mem_abc123",
924
- entity_context="This user is a software engineer who prefers concise technical documentation.",
928
+ entity_context="User's name is {XYZ}",
925
929
  filepath="/documents/reports/file.pdf",
926
930
  file_type="image",
927
931
  filter_by_metadata='{"department": "engineering"}',