diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b6bbe1c..a00871b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.39.0" + ".": "3.40.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 7018f7c..44ea2c0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 26 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc/supermemory-new-14eac4a927f8fb858cd4f2ae84cebdcf28f9639b4ec76e47c33fb5f3bf62632d.yml -openapi_spec_hash: c8e892b3a65c51e15145b79781347f5e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc/supermemory-new-cc0ff5a1831707e8733abeeaa245215c4ba276f8f485ed36beeeaa4f0580a203.yml +openapi_spec_hash: d49d49625c82142babe4a6ac4d2cd8d4 config_hash: cde97ef3188581c5f4924c633ec33ddb diff --git a/CHANGELOG.md b/CHANGELOG.md index f742e1a..6af21c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 3.40.0 (2026-05-11) + +Full Changelog: [v3.39.0...v3.40.0](https://github.com/supermemoryai/python-sdk/compare/v3.39.0...v3.40.0) + +### Features + +* **api:** api update ([855936a](https://github.com/supermemoryai/python-sdk/commit/855936a27f9de29cae51681e30e275fe05574607)) + ## 3.39.0 (2026-05-09) Full Changelog: [v3.38.1...v3.39.0](https://github.com/supermemoryai/python-sdk/compare/v3.38.1...v3.39.0) diff --git a/pyproject.toml b/pyproject.toml index f8db4cd..c9811ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "supermemory" -version = "3.39.0" +version = "3.40.0" description = "The official Python library for the supermemory API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/supermemory/_client.py b/src/supermemory/_client.py index 651eb85..74a5f8d 100644 --- a/src/supermemory/_client.py +++ b/src/supermemory/_client.py @@ -256,6 +256,7 @@ def add( custom_id: str | Omit = omit, entity_context: str | Omit = omit, filepath: str | Omit = omit, + filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, task_type: Literal["memory", "superrag"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -284,6 +285,9 @@ def add( filepath: Optional file path for the document. Used by supermemoryfs to store the full path of the file. + filter_by_metadata: Optional metadata filter to apply when pulling related memories and profile + during ingestion. Only memories matching these filters will be used as context. + metadata: Optional metadata for the document. task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, @@ -307,6 +311,7 @@ def add( "custom_id": custom_id, "entity_context": entity_context, "filepath": filepath, + "filter_by_metadata": filter_by_metadata, "metadata": metadata, "task_type": task_type, }, @@ -591,6 +596,7 @@ async def add( custom_id: str | Omit = omit, entity_context: str | Omit = omit, filepath: str | Omit = omit, + filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, task_type: Literal["memory", "superrag"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -619,6 +625,9 @@ async def add( filepath: Optional file path for the document. Used by supermemoryfs to store the full path of the file. + filter_by_metadata: Optional metadata filter to apply when pulling related memories and profile + during ingestion. Only memories matching these filters will be used as context. + metadata: Optional metadata for the document. task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, @@ -642,6 +651,7 @@ async def add( "custom_id": custom_id, "entity_context": entity_context, "filepath": filepath, + "filter_by_metadata": filter_by_metadata, "metadata": metadata, "task_type": task_type, }, diff --git a/src/supermemory/_version.py b/src/supermemory/_version.py index 7b05186..ca67ff6 100644 --- a/src/supermemory/_version.py +++ b/src/supermemory/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "supermemory" -__version__ = "3.39.0" # x-release-please-version +__version__ = "3.40.0" # x-release-please-version diff --git a/src/supermemory/resources/documents.py b/src/supermemory/resources/documents.py index 74ba6a4..5b52c23 100644 --- a/src/supermemory/resources/documents.py +++ b/src/supermemory/resources/documents.py @@ -68,6 +68,7 @@ def update( content: str | Omit = omit, custom_id: str | Omit = omit, filepath: str | Omit = omit, + filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, task_type: Literal["memory", "superrag"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -104,6 +105,11 @@ def update( filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used by supermemoryfs to map documents to filesystem paths. + filter_by_metadata: Optional metadata filter scoping which existing memories are pulled as context + during ingestion. Scalar values match exactly (AND across keys); array values + match ANY (OR within key). Only memories whose source documents match this + filter are used as context. + metadata: Optional metadata for the document. This is used to store additional information about the document. You can use this to store any additional information you need about the document. Metadata can be filtered through. Keys must be strings @@ -132,6 +138,7 @@ def update( "content": content, "custom_id": custom_id, "filepath": filepath, + "filter_by_metadata": filter_by_metadata, "metadata": metadata, "task_type": task_type, }, @@ -257,6 +264,7 @@ def add( custom_id: str | Omit = omit, entity_context: str | Omit = omit, filepath: str | Omit = omit, + filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, task_type: Literal["memory", "superrag"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -285,6 +293,9 @@ def add( filepath: Optional file path for the document. Used by supermemoryfs to store the full path of the file. + filter_by_metadata: Optional metadata filter to apply when pulling related memories and profile + during ingestion. Only memories matching these filters will be used as context. + metadata: Optional metadata for the document. task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, @@ -308,6 +319,7 @@ def add( "custom_id": custom_id, "entity_context": entity_context, "filepath": filepath, + "filter_by_metadata": filter_by_metadata, "metadata": metadata, "task_type": task_type, }, @@ -327,6 +339,7 @@ def batch_add( container_tags: SequenceNotStr[str] | Omit = omit, content: None | Omit = omit, filepath: str | Omit = omit, + filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, task_type: Literal["memory", "superrag"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -353,6 +366,11 @@ def batch_add( filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used by supermemoryfs to map documents to filesystem paths. + filter_by_metadata: Optional metadata filter scoping which existing memories are pulled as context + during ingestion. Scalar values match exactly (AND across keys); array values + match ANY (OR within key). Only memories whose source documents match this + filter are used as context. + metadata: Optional metadata for the document. This is used to store additional information about the document. You can use this to store any additional information you need about the document. Metadata can be filtered through. Keys must be strings @@ -379,6 +397,7 @@ def batch_add( "container_tags": container_tags, "content": content, "filepath": filepath, + "filter_by_metadata": filter_by_metadata, "metadata": metadata, "task_type": task_type, }, @@ -500,6 +519,7 @@ def upload_file( entity_context: str | Omit = omit, filepath: str | Omit = omit, file_type: str | Omit = omit, + filter_by_metadata: str | Omit = omit, metadata: str | Omit = omit, mime_type: str | Omit = omit, task_type: Literal["memory", "superrag"] | Omit = omit, @@ -537,6 +557,10 @@ def upload_file( text, pdf, tweet, google_doc, google_slide, google_sheet, image, video, notion_doc, webpage, onedrive + filter_by_metadata: Optional metadata filter as a JSON string. Scopes which existing memories are + pulled as context during ingestion. Scalar values match exactly (AND across + keys); array values match ANY (OR within key). + metadata: Optional metadata for the document as a JSON string. This is used to store additional information about the document. Keys must be strings and values can be strings, numbers, or booleans. @@ -568,6 +592,7 @@ def upload_file( "entity_context": entity_context, "filepath": filepath, "file_type": file_type, + "filter_by_metadata": filter_by_metadata, "metadata": metadata, "mime_type": mime_type, "task_type": task_type, @@ -620,6 +645,7 @@ async def update( content: str | Omit = omit, custom_id: str | Omit = omit, filepath: str | Omit = omit, + filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, task_type: Literal["memory", "superrag"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -656,6 +682,11 @@ async def update( filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used by supermemoryfs to map documents to filesystem paths. + filter_by_metadata: Optional metadata filter scoping which existing memories are pulled as context + during ingestion. Scalar values match exactly (AND across keys); array values + match ANY (OR within key). Only memories whose source documents match this + filter are used as context. + metadata: Optional metadata for the document. This is used to store additional information about the document. You can use this to store any additional information you need about the document. Metadata can be filtered through. Keys must be strings @@ -684,6 +715,7 @@ async def update( "content": content, "custom_id": custom_id, "filepath": filepath, + "filter_by_metadata": filter_by_metadata, "metadata": metadata, "task_type": task_type, }, @@ -809,6 +841,7 @@ async def add( custom_id: str | Omit = omit, entity_context: str | Omit = omit, filepath: str | Omit = omit, + filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, task_type: Literal["memory", "superrag"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -837,6 +870,9 @@ async def add( filepath: Optional file path for the document. Used by supermemoryfs to store the full path of the file. + filter_by_metadata: Optional metadata filter to apply when pulling related memories and profile + during ingestion. Only memories matching these filters will be used as context. + metadata: Optional metadata for the document. task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, @@ -860,6 +896,7 @@ async def add( "custom_id": custom_id, "entity_context": entity_context, "filepath": filepath, + "filter_by_metadata": filter_by_metadata, "metadata": metadata, "task_type": task_type, }, @@ -879,6 +916,7 @@ async def batch_add( container_tags: SequenceNotStr[str] | Omit = omit, content: None | Omit = omit, filepath: str | Omit = omit, + filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit, task_type: Literal["memory", "superrag"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -905,6 +943,11 @@ async def batch_add( filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used by supermemoryfs to map documents to filesystem paths. + filter_by_metadata: Optional metadata filter scoping which existing memories are pulled as context + during ingestion. Scalar values match exactly (AND across keys); array values + match ANY (OR within key). Only memories whose source documents match this + filter are used as context. + metadata: Optional metadata for the document. This is used to store additional information about the document. You can use this to store any additional information you need about the document. Metadata can be filtered through. Keys must be strings @@ -931,6 +974,7 @@ async def batch_add( "container_tags": container_tags, "content": content, "filepath": filepath, + "filter_by_metadata": filter_by_metadata, "metadata": metadata, "task_type": task_type, }, @@ -1052,6 +1096,7 @@ async def upload_file( entity_context: str | Omit = omit, filepath: str | Omit = omit, file_type: str | Omit = omit, + filter_by_metadata: str | Omit = omit, metadata: str | Omit = omit, mime_type: str | Omit = omit, task_type: Literal["memory", "superrag"] | Omit = omit, @@ -1089,6 +1134,10 @@ async def upload_file( text, pdf, tweet, google_doc, google_slide, google_sheet, image, video, notion_doc, webpage, onedrive + filter_by_metadata: Optional metadata filter as a JSON string. Scopes which existing memories are + pulled as context during ingestion. Scalar values match exactly (AND across + keys); array values match ANY (OR within key). + metadata: Optional metadata for the document as a JSON string. This is used to store additional information about the document. Keys must be strings and values can be strings, numbers, or booleans. @@ -1120,6 +1169,7 @@ async def upload_file( "entity_context": entity_context, "filepath": filepath, "file_type": file_type, + "filter_by_metadata": filter_by_metadata, "metadata": metadata, "mime_type": mime_type, "task_type": task_type, diff --git a/src/supermemory/types/client_add_params.py b/src/supermemory/types/client_add_params.py index 2b7aaed..9c2deb6 100644 --- a/src/supermemory/types/client_add_params.py +++ b/src/supermemory/types/client_add_params.py @@ -44,6 +44,14 @@ class ClientAddParams(TypedDict, total=False): Used by supermemoryfs to store the full path of the file. """ + filter_by_metadata: Annotated[ + Dict[str, Union[str, float, bool, SequenceNotStr[str]]], PropertyInfo(alias="filterByMetadata") + ] + """ + Optional metadata filter to apply when pulling related memories and profile + during ingestion. Only memories matching these filters will be used as context. + """ + metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] """Optional metadata for the document.""" diff --git a/src/supermemory/types/document_add_params.py b/src/supermemory/types/document_add_params.py index 07ea075..72fbc81 100644 --- a/src/supermemory/types/document_add_params.py +++ b/src/supermemory/types/document_add_params.py @@ -44,6 +44,14 @@ class DocumentAddParams(TypedDict, total=False): Used by supermemoryfs to store the full path of the file. """ + filter_by_metadata: Annotated[ + Dict[str, Union[str, float, bool, SequenceNotStr[str]]], PropertyInfo(alias="filterByMetadata") + ] + """ + Optional metadata filter to apply when pulling related memories and profile + during ingestion. Only memories matching these filters will be used as context. + """ + metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] """Optional metadata for the document.""" diff --git a/src/supermemory/types/document_batch_add_params.py b/src/supermemory/types/document_batch_add_params.py index 8c5daf9..d171d22 100644 --- a/src/supermemory/types/document_batch_add_params.py +++ b/src/supermemory/types/document_batch_add_params.py @@ -36,6 +36,16 @@ class DocumentBatchAddParams(TypedDict, total=False): Used by supermemoryfs to map documents to filesystem paths. """ + filter_by_metadata: Annotated[ + Dict[str, Union[str, float, bool, SequenceNotStr[str]]], PropertyInfo(alias="filterByMetadata") + ] + """ + Optional metadata filter scoping which existing memories are pulled as context + during ingestion. Scalar values match exactly (AND across keys); array values + match ANY (OR within key). Only memories whose source documents match this + filter are used as context. + """ + metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] """Optional metadata for the document. @@ -92,6 +102,16 @@ class DocumentsUnionMember0(TypedDict, total=False): Used by supermemoryfs to map documents to filesystem paths. """ + filter_by_metadata: Annotated[ + Dict[str, Union[str, float, bool, SequenceNotStr[str]]], PropertyInfo(alias="filterByMetadata") + ] + """ + Optional metadata filter scoping which existing memories are pulled as context + during ingestion. Scalar values match exactly (AND across keys); array values + match ANY (OR within key). Only memories whose source documents match this + filter are used as context. + """ + metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] """Optional metadata for the document. diff --git a/src/supermemory/types/document_update_params.py b/src/supermemory/types/document_update_params.py index 3164b5b..8437b2d 100644 --- a/src/supermemory/types/document_update_params.py +++ b/src/supermemory/types/document_update_params.py @@ -51,6 +51,16 @@ class DocumentUpdateParams(TypedDict, total=False): Used by supermemoryfs to map documents to filesystem paths. """ + filter_by_metadata: Annotated[ + Dict[str, Union[str, float, bool, SequenceNotStr[str]]], PropertyInfo(alias="filterByMetadata") + ] + """ + Optional metadata filter scoping which existing memories are pulled as context + during ingestion. Scalar values match exactly (AND across keys); array values + match ANY (OR within key). Only memories whose source documents match this + filter are used as context. + """ + metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] """Optional metadata for the document. diff --git a/src/supermemory/types/document_upload_file_params.py b/src/supermemory/types/document_upload_file_params.py index c23911f..0fbad1b 100644 --- a/src/supermemory/types/document_upload_file_params.py +++ b/src/supermemory/types/document_upload_file_params.py @@ -50,6 +50,13 @@ class DocumentUploadFileParams(TypedDict, total=False): video, notion_doc, webpage, onedrive """ + filter_by_metadata: Annotated[str, PropertyInfo(alias="filterByMetadata")] + """Optional metadata filter as a JSON string. + + Scopes which existing memories are pulled as context during ingestion. Scalar + values match exactly (AND across keys); array values match ANY (OR within key). + """ + metadata: str """Optional metadata for the document as a JSON string. diff --git a/tests/api_resources/test_client.py b/tests/api_resources/test_client.py index ca8cfa4..3cac91e 100644 --- a/tests/api_resources/test_client.py +++ b/tests/api_resources/test_client.py @@ -35,6 +35,7 @@ def test_method_add_with_all_params(self, client: Supermemory) -> None: custom_id="customId", entity_context="entityContext", filepath="filepath", + filter_by_metadata={"foo": "string"}, metadata={"foo": "string"}, task_type="memory", ) @@ -146,6 +147,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncSupermemory) custom_id="customId", entity_context="entityContext", filepath="filepath", + filter_by_metadata={"foo": "string"}, metadata={"foo": "string"}, task_type="memory", ) diff --git a/tests/api_resources/test_documents.py b/tests/api_resources/test_documents.py index 6abdf99..76e2ec4 100644 --- a/tests/api_resources/test_documents.py +++ b/tests/api_resources/test_documents.py @@ -44,6 +44,10 @@ def test_method_update_with_all_params(self, client: Supermemory) -> None: content="This is a detailed article about machine learning concepts...", custom_id="mem_abc123", filepath="/documents/reports/file.pdf", + filter_by_metadata={ + "department": "engineering", + "region": "us", + }, metadata={ "category": "technology", "isPublic": True, @@ -212,6 +216,7 @@ def test_method_add_with_all_params(self, client: Supermemory) -> None: custom_id="customId", entity_context="entityContext", filepath="filepath", + filter_by_metadata={"foo": "string"}, metadata={"foo": "string"}, task_type="memory", ) @@ -262,6 +267,10 @@ def test_method_batch_add_with_all_params(self, client: Supermemory) -> None: "container_tags": ["user_123", "project_123"], "custom_id": "mem_abc123", "filepath": "/documents/reports/file.pdf", + "filter_by_metadata": { + "department": "engineering", + "region": "us", + }, "metadata": { "category": "technology", "isPublic": True, @@ -277,6 +286,10 @@ def test_method_batch_add_with_all_params(self, client: Supermemory) -> None: container_tags=["user_123", "project_123"], content=None, filepath="/documents/reports/file.pdf", + filter_by_metadata={ + "department": "engineering", + "region": "us", + }, metadata={ "category": "technology", "isPublic": True, @@ -442,6 +455,7 @@ def test_method_upload_file_with_all_params(self, client: Supermemory) -> None: entity_context="This user is a software engineer who prefers concise technical documentation.", filepath="/documents/reports/file.pdf", file_type="image", + filter_by_metadata='{"department": "engineering"}', metadata='{"category": "technology", "isPublic": true, "readingTime": 5}', mime_type="mimeType", task_type="memory", @@ -499,6 +513,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncSupermemor content="This is a detailed article about machine learning concepts...", custom_id="mem_abc123", filepath="/documents/reports/file.pdf", + filter_by_metadata={ + "department": "engineering", + "region": "us", + }, metadata={ "category": "technology", "isPublic": True, @@ -667,6 +685,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncSupermemory) custom_id="customId", entity_context="entityContext", filepath="filepath", + filter_by_metadata={"foo": "string"}, metadata={"foo": "string"}, task_type="memory", ) @@ -717,6 +736,10 @@ async def test_method_batch_add_with_all_params(self, async_client: AsyncSuperme "container_tags": ["user_123", "project_123"], "custom_id": "mem_abc123", "filepath": "/documents/reports/file.pdf", + "filter_by_metadata": { + "department": "engineering", + "region": "us", + }, "metadata": { "category": "technology", "isPublic": True, @@ -732,6 +755,10 @@ async def test_method_batch_add_with_all_params(self, async_client: AsyncSuperme container_tags=["user_123", "project_123"], content=None, filepath="/documents/reports/file.pdf", + filter_by_metadata={ + "department": "engineering", + "region": "us", + }, metadata={ "category": "technology", "isPublic": True, @@ -897,6 +924,7 @@ async def test_method_upload_file_with_all_params(self, async_client: AsyncSuper entity_context="This user is a software engineer who prefers concise technical documentation.", filepath="/documents/reports/file.pdf", file_type="image", + filter_by_metadata='{"department": "engineering"}', metadata='{"category": "technology", "isPublic": true, "readingTime": 5}', mime_type="mimeType", task_type="memory",