From 0950bae08a126b09a2844839db673e99cfc13f75 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 16 Apr 2026 17:25:21 +0000 Subject: [PATCH 1/6] feat(api): api update --- .stats.yml | 4 +- src/supermemory/_client.py | 12 +++++- src/supermemory/resources/documents.py | 40 +++++++++++++++++++ src/supermemory/types/client_add_params.py | 8 +++- src/supermemory/types/document_add_params.py | 8 +++- .../types/document_batch_add_params.py | 14 ++++++- .../types/document_get_response.py | 6 +++ .../types/document_update_params.py | 8 +++- .../types/document_upload_file_params.py | 8 +++- tests/api_resources/test_client.py | 2 + tests/api_resources/test_documents.py | 10 +++++ 11 files changed, 112 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index b9789754..8e813d4e 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%2Fsupermemory-new-3d1ed08ae874eafef0c275748f38e21c1e6a245ecad05db24dee27f4166f18db.yml -openapi_spec_hash: fa7ccfe7d4574c280f3189d020401032 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-10c98134d24013fd174c40fd595c7986b984cffa71cad4d3ef9fe199e7f565ab.yml +openapi_spec_hash: b5ee093b1cbbf9c32277d92c0222ff62 config_hash: f3eb5ca71172780678106f6d46f15dda diff --git a/src/supermemory/_client.py b/src/supermemory/_client.py index 67a574cb..4effcb84 100644 --- a/src/supermemory/_client.py +++ b/src/supermemory/_client.py @@ -4,7 +4,7 @@ import os from typing import TYPE_CHECKING, Any, Dict, Union, Mapping -from typing_extensions import Self, override +from typing_extensions import Self, Literal, override import httpx @@ -246,6 +246,7 @@ def add( custom_id: str | Omit = omit, entity_context: 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. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -271,6 +272,9 @@ def add( metadata: Optional metadata for the document. + task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -289,6 +293,7 @@ def add( "custom_id": custom_id, "entity_context": entity_context, "metadata": metadata, + "task_type": task_type, }, client_add_params.ClientAddParams, ), @@ -562,6 +567,7 @@ async def add( custom_id: str | Omit = omit, entity_context: 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. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -587,6 +593,9 @@ async def add( metadata: Optional metadata for the document. + task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -605,6 +614,7 @@ async def add( "custom_id": custom_id, "entity_context": entity_context, "metadata": metadata, + "task_type": task_type, }, client_add_params.ClientAddParams, ), diff --git a/src/supermemory/resources/documents.py b/src/supermemory/resources/documents.py index 44688ff9..22a23cf1 100644 --- a/src/supermemory/resources/documents.py +++ b/src/supermemory/resources/documents.py @@ -67,6 +67,7 @@ def update( content: str | Omit = omit, custom_id: 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. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -104,6 +105,9 @@ def update( and are case sensitive. Values can be strings, numbers, or booleans. You cannot nest objects. + task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -123,6 +127,7 @@ def update( "content": content, "custom_id": custom_id, "metadata": metadata, + "task_type": task_type, }, document_update_params.DocumentUpdateParams, ), @@ -241,6 +246,7 @@ def add( custom_id: str | Omit = omit, entity_context: 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. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -266,6 +272,9 @@ def add( metadata: Optional metadata for the document. + task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -284,6 +293,7 @@ def add( "custom_id": custom_id, "entity_context": entity_context, "metadata": metadata, + "task_type": task_type, }, document_add_params.DocumentAddParams, ), @@ -301,6 +311,7 @@ def batch_add( container_tags: SequenceNotStr[str] | Omit = omit, content: None | 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. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -328,6 +339,9 @@ def batch_add( and are case sensitive. Values can be strings, numbers, or booleans. You cannot nest objects. + task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -345,6 +359,7 @@ def batch_add( "container_tags": container_tags, "content": content, "metadata": metadata, + "task_type": task_type, }, document_batch_add_params.DocumentBatchAddParams, ), @@ -458,6 +473,7 @@ def upload_file( file_type: str | Omit = omit, metadata: str | Omit = omit, mime_type: str | Omit = omit, + task_type: Literal["memory", "superrag"] | Omit = omit, use_advanced_processing: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -490,6 +506,9 @@ def upload_file( mime_type: Required when fileType is 'image' or 'video'. Specifies the exact MIME type to use (e.g., 'image/png', 'image/jpeg', 'video/mp4', 'video/webm') + task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + use_advanced_processing: DEPRECATED: This field is no longer used. Advanced PDF processing is now automatic with our hybrid Mistral OCR + Gemini pipeline. This parameter will be accepted but ignored for backwards compatibility. @@ -510,6 +529,7 @@ def upload_file( "file_type": file_type, "metadata": metadata, "mime_type": mime_type, + "task_type": task_type, "use_advanced_processing": use_advanced_processing, } ) @@ -558,6 +578,7 @@ async def update( content: str | Omit = omit, custom_id: 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. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -595,6 +616,9 @@ async def update( and are case sensitive. Values can be strings, numbers, or booleans. You cannot nest objects. + task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -614,6 +638,7 @@ async def update( "content": content, "custom_id": custom_id, "metadata": metadata, + "task_type": task_type, }, document_update_params.DocumentUpdateParams, ), @@ -732,6 +757,7 @@ async def add( custom_id: str | Omit = omit, entity_context: 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. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -757,6 +783,9 @@ async def add( metadata: Optional metadata for the document. + task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -775,6 +804,7 @@ async def add( "custom_id": custom_id, "entity_context": entity_context, "metadata": metadata, + "task_type": task_type, }, document_add_params.DocumentAddParams, ), @@ -792,6 +822,7 @@ async def batch_add( container_tags: SequenceNotStr[str] | Omit = omit, content: None | 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. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -819,6 +850,9 @@ async def batch_add( and are case sensitive. Values can be strings, numbers, or booleans. You cannot nest objects. + task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -836,6 +870,7 @@ async def batch_add( "container_tags": container_tags, "content": content, "metadata": metadata, + "task_type": task_type, }, document_batch_add_params.DocumentBatchAddParams, ), @@ -949,6 +984,7 @@ async def upload_file( file_type: str | Omit = omit, metadata: str | Omit = omit, mime_type: str | Omit = omit, + task_type: Literal["memory", "superrag"] | Omit = omit, use_advanced_processing: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -981,6 +1017,9 @@ async def upload_file( mime_type: Required when fileType is 'image' or 'video'. Specifies the exact MIME type to use (e.g., 'image/png', 'image/jpeg', 'video/mp4', 'video/webm') + task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + use_advanced_processing: DEPRECATED: This field is no longer used. Advanced PDF processing is now automatic with our hybrid Mistral OCR + Gemini pipeline. This parameter will be accepted but ignored for backwards compatibility. @@ -1001,6 +1040,7 @@ async def upload_file( "file_type": file_type, "metadata": metadata, "mime_type": mime_type, + "task_type": task_type, "use_advanced_processing": use_advanced_processing, } ) diff --git a/src/supermemory/types/client_add_params.py b/src/supermemory/types/client_add_params.py index 77b21d6d..ff764f17 100644 --- a/src/supermemory/types/client_add_params.py +++ b/src/supermemory/types/client_add_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, Union -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from .._types import SequenceNotStr from .._utils import PropertyInfo @@ -40,3 +40,9 @@ class ClientAddParams(TypedDict, total=False): metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] """Optional metadata for the document.""" + + task_type: Annotated[Literal["memory", "superrag"], PropertyInfo(alias="taskType")] + """ + Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + """ diff --git a/src/supermemory/types/document_add_params.py b/src/supermemory/types/document_add_params.py index 71d9fbdb..fa12f338 100644 --- a/src/supermemory/types/document_add_params.py +++ b/src/supermemory/types/document_add_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, Union -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from .._types import SequenceNotStr from .._utils import PropertyInfo @@ -40,3 +40,9 @@ class DocumentAddParams(TypedDict, total=False): metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] """Optional metadata for the document.""" + + task_type: Annotated[Literal["memory", "superrag"], PropertyInfo(alias="taskType")] + """ + Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + """ diff --git a/src/supermemory/types/document_batch_add_params.py b/src/supermemory/types/document_batch_add_params.py index 4a35fe85..cc132e46 100644 --- a/src/supermemory/types/document_batch_add_params.py +++ b/src/supermemory/types/document_batch_add_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, Union, Iterable -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from .._types import SequenceNotStr from .._utils import PropertyInfo @@ -39,6 +39,12 @@ class DocumentBatchAddParams(TypedDict, total=False): be strings, numbers, or booleans. You cannot nest objects. """ + task_type: Annotated[Literal["memory", "superrag"], PropertyInfo(alias="taskType")] + """ + Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + """ + class DocumentsUnionMember0(TypedDict, total=False): content: Required[str] @@ -82,3 +88,9 @@ class DocumentsUnionMember0(TypedDict, total=False): can be filtered through. Keys must be strings and are case sensitive. Values can be strings, numbers, or booleans. You cannot nest objects. """ + + task_type: Annotated[Literal["memory", "superrag"], PropertyInfo(alias="taskType")] + """ + Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + """ diff --git a/src/supermemory/types/document_get_response.py b/src/supermemory/types/document_get_response.py index 5bba5490..4f07afc1 100644 --- a/src/supermemory/types/document_get_response.py +++ b/src/supermemory/types/document_get_response.py @@ -69,6 +69,12 @@ class DocumentGetResponse(BaseModel): summary: Optional[str] = None """Summary of the document content""" + task_type: Literal["memory", "superrag"] = FieldInfo(alias="taskType") + """ + Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + """ + title: Optional[str] = None """Title of the document""" diff --git a/src/supermemory/types/document_update_params.py b/src/supermemory/types/document_update_params.py index 1727666c..ade57db4 100644 --- a/src/supermemory/types/document_update_params.py +++ b/src/supermemory/types/document_update_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, Union -from typing_extensions import Annotated, TypedDict +from typing_extensions import Literal, Annotated, TypedDict from .._types import SequenceNotStr from .._utils import PropertyInfo @@ -53,3 +53,9 @@ class DocumentUpdateParams(TypedDict, total=False): can be filtered through. Keys must be strings and are case sensitive. Values can be strings, numbers, or booleans. You cannot nest objects. """ + + task_type: Annotated[Literal["memory", "superrag"], PropertyInfo(alias="taskType")] + """ + Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + """ diff --git a/src/supermemory/types/document_upload_file_params.py b/src/supermemory/types/document_upload_file_params.py index f7c9526a..3c11e02e 100644 --- a/src/supermemory/types/document_upload_file_params.py +++ b/src/supermemory/types/document_upload_file_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from .._types import FileTypes from .._utils import PropertyInfo @@ -46,6 +46,12 @@ class DocumentUploadFileParams(TypedDict, total=False): 'video/mp4', 'video/webm') """ + task_type: Annotated[Literal["memory", "superrag"], PropertyInfo(alias="taskType")] + """ + Task type: "memory" (default) for full context layer with SuperRAG built in, + "superrag" for managed RAG as a service. + """ + use_advanced_processing: Annotated[str, PropertyInfo(alias="useAdvancedProcessing")] """DEPRECATED: This field is no longer used. diff --git a/tests/api_resources/test_client.py b/tests/api_resources/test_client.py index 9d5c3a63..79ae807b 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", metadata={"foo": "string"}, + task_type="memory", ) assert_matches_type(AddResponse, client_, path=["response"]) @@ -144,6 +145,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncSupermemory) custom_id="customId", entity_context="entityContext", metadata={"foo": "string"}, + task_type="memory", ) assert_matches_type(AddResponse, client, path=["response"]) diff --git a/tests/api_resources/test_documents.py b/tests/api_resources/test_documents.py index 75b82b80..7a86ae7e 100644 --- a/tests/api_resources/test_documents.py +++ b/tests/api_resources/test_documents.py @@ -51,6 +51,7 @@ def test_method_update_with_all_params(self, client: Supermemory) -> None: "tag_1": "ai", "tag_2": "machine-learning", }, + task_type="memory", ) assert_matches_type(DocumentUpdateResponse, document, path=["response"]) @@ -209,6 +210,7 @@ def test_method_add_with_all_params(self, client: Supermemory) -> None: custom_id="customId", entity_context="entityContext", metadata={"foo": "string"}, + task_type="memory", ) assert_matches_type(DocumentAddResponse, document, path=["response"]) @@ -264,6 +266,7 @@ def test_method_batch_add_with_all_params(self, client: Supermemory) -> None: "tag_1": "ai", "tag_2": "machine-learning", }, + "task_type": "memory", } ], container_tag="user_123", @@ -277,6 +280,7 @@ def test_method_batch_add_with_all_params(self, client: Supermemory) -> None: "tag_1": "ai", "tag_2": "machine-learning", }, + task_type="memory", ) assert_matches_type(DocumentBatchAddResponse, document, path=["response"]) @@ -431,6 +435,7 @@ def test_method_upload_file_with_all_params(self, client: Supermemory) -> None: file_type="image", metadata='{"category": "technology", "isPublic": true, "readingTime": 5}', mime_type="mimeType", + task_type="memory", use_advanced_processing="true", ) assert_matches_type(DocumentUploadFileResponse, document, path=["response"]) @@ -492,6 +497,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncSupermemor "tag_1": "ai", "tag_2": "machine-learning", }, + task_type="memory", ) assert_matches_type(DocumentUpdateResponse, document, path=["response"]) @@ -650,6 +656,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncSupermemory) custom_id="customId", entity_context="entityContext", metadata={"foo": "string"}, + task_type="memory", ) assert_matches_type(DocumentAddResponse, document, path=["response"]) @@ -705,6 +712,7 @@ async def test_method_batch_add_with_all_params(self, async_client: AsyncSuperme "tag_1": "ai", "tag_2": "machine-learning", }, + "task_type": "memory", } ], container_tag="user_123", @@ -718,6 +726,7 @@ async def test_method_batch_add_with_all_params(self, async_client: AsyncSuperme "tag_1": "ai", "tag_2": "machine-learning", }, + task_type="memory", ) assert_matches_type(DocumentBatchAddResponse, document, path=["response"]) @@ -872,6 +881,7 @@ async def test_method_upload_file_with_all_params(self, async_client: AsyncSuper file_type="image", metadata='{"category": "technology", "isPublic": true, "readingTime": 5}', mime_type="mimeType", + task_type="memory", use_advanced_processing="true", ) assert_matches_type(DocumentUploadFileResponse, document, path=["response"]) From ab60a7657699fc974c8648adcb74a0dba9a4fe5b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 16 Apr 2026 19:25:21 +0000 Subject: [PATCH 2/6] feat(api): api update --- .stats.yml | 4 ++-- src/supermemory/resources/connections.py | 4 ++++ src/supermemory/types/connection_resources_params.py | 2 ++ tests/api_resources/test_connections.py | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8e813d4e..06c3a5ec 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%2Fsupermemory-new-10c98134d24013fd174c40fd595c7986b984cffa71cad4d3ef9fe199e7f565ab.yml -openapi_spec_hash: b5ee093b1cbbf9c32277d92c0222ff62 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-5d883c307659b317ca9a27ffd4e98855210c7030167bc79f4727412266c8e53b.yml +openapi_spec_hash: 4e5b35c97838082939b19a24d9472ffd config_hash: f3eb5ca71172780678106f6d46f15dda diff --git a/src/supermemory/resources/connections.py b/src/supermemory/resources/connections.py index 6ebc71a2..56e25c88 100644 --- a/src/supermemory/resources/connections.py +++ b/src/supermemory/resources/connections.py @@ -417,6 +417,7 @@ def resources( connection_id: str, *, page: float | Omit = omit, + parent_id: str | Omit = omit, per_page: float | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -449,6 +450,7 @@ def resources( query=maybe_transform( { "page": page, + "parent_id": parent_id, "per_page": per_page, }, connection_resources_params.ConnectionResourcesParams, @@ -839,6 +841,7 @@ async def resources( connection_id: str, *, page: float | Omit = omit, + parent_id: str | Omit = omit, per_page: float | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -871,6 +874,7 @@ async def resources( query=await async_maybe_transform( { "page": page, + "parent_id": parent_id, "per_page": per_page, }, connection_resources_params.ConnectionResourcesParams, diff --git a/src/supermemory/types/connection_resources_params.py b/src/supermemory/types/connection_resources_params.py index 97ba168a..ff39796d 100644 --- a/src/supermemory/types/connection_resources_params.py +++ b/src/supermemory/types/connection_resources_params.py @@ -10,4 +10,6 @@ class ConnectionResourcesParams(TypedDict, total=False): page: float + parent_id: str + per_page: float diff --git a/tests/api_resources/test_connections.py b/tests/api_resources/test_connections.py index 8a1ba03a..3eb33fcb 100644 --- a/tests/api_resources/test_connections.py +++ b/tests/api_resources/test_connections.py @@ -423,6 +423,7 @@ def test_method_resources_with_all_params(self, client: Supermemory) -> None: connection = client.connections.resources( connection_id="connectionId", page=0, + parent_id="parent_id", per_page=0, ) assert_matches_type(ConnectionResourcesResponse, connection, path=["response"]) @@ -863,6 +864,7 @@ async def test_method_resources_with_all_params(self, async_client: AsyncSuperme connection = await async_client.connections.resources( connection_id="connectionId", page=0, + parent_id="parent_id", per_page=0, ) assert_matches_type(ConnectionResourcesResponse, connection, path=["response"]) From aa83e3b17bf8d1508647e7d8b798e03624a6daaa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 01:15:35 +0000 Subject: [PATCH 3/6] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 06c3a5ec..96d8c061 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%2Fsupermemory-new-5d883c307659b317ca9a27ffd4e98855210c7030167bc79f4727412266c8e53b.yml openapi_spec_hash: 4e5b35c97838082939b19a24d9472ffd -config_hash: f3eb5ca71172780678106f6d46f15dda +config_hash: cde97ef3188581c5f4924c633ec33ddb From 5b9260335ff2514491b0c41f6544872ee58485fb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 23:25:33 +0000 Subject: [PATCH 4/6] feat(api): api update --- .stats.yml | 4 +- src/supermemory/_client.py | 10 ++++ src/supermemory/resources/documents.py | 60 +++++++++++++++++++ src/supermemory/resources/search.py | 30 ++++++++++ src/supermemory/types/client_add_params.py | 6 ++ src/supermemory/types/document_add_params.py | 6 ++ .../types/document_batch_add_params.py | 12 ++++ .../types/document_delete_bulk_params.py | 6 ++ .../types/document_get_response.py | 2 + src/supermemory/types/document_list_params.py | 6 ++ .../types/document_list_response.py | 2 + .../types/document_update_params.py | 6 ++ .../types/document_upload_file_params.py | 6 ++ .../types/search_documents_params.py | 6 ++ .../types/search_execute_params.py | 6 ++ .../types/search_memories_params.py | 6 ++ .../types/search_memories_response.py | 3 + tests/api_resources/test_client.py | 2 + tests/api_resources/test_documents.py | 14 +++++ tests/api_resources/test_search.py | 6 ++ 20 files changed, 197 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 96d8c061..2b69c4ba 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%2Fsupermemory-new-5d883c307659b317ca9a27ffd4e98855210c7030167bc79f4727412266c8e53b.yml -openapi_spec_hash: 4e5b35c97838082939b19a24d9472ffd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-f09b91ede978d3fd05810d3750fcc837f8baa6430fa1be9208ba3088ecaef7f4.yml +openapi_spec_hash: 957d1e254f2f5933d0c22f3b310122e9 config_hash: cde97ef3188581c5f4924c633ec33ddb diff --git a/src/supermemory/_client.py b/src/supermemory/_client.py index 4effcb84..2e7309e9 100644 --- a/src/supermemory/_client.py +++ b/src/supermemory/_client.py @@ -245,6 +245,7 @@ def add( container_tags: SequenceNotStr[str] | Omit = omit, custom_id: str | Omit = omit, entity_context: str | Omit = omit, + filepath: 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. @@ -270,6 +271,9 @@ def add( entity_context: Optional entity context for this container tag. Max 1500 characters. Used during document processing to guide memory extraction. + filepath: Optional file path for the document. Used by supermemoryfs to store the full + path of the file. + metadata: Optional metadata for the document. task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, @@ -292,6 +296,7 @@ def add( "container_tags": container_tags, "custom_id": custom_id, "entity_context": entity_context, + "filepath": filepath, "metadata": metadata, "task_type": task_type, }, @@ -566,6 +571,7 @@ async def add( container_tags: SequenceNotStr[str] | Omit = omit, custom_id: str | Omit = omit, entity_context: str | Omit = omit, + filepath: 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. @@ -591,6 +597,9 @@ async def add( entity_context: Optional entity context for this container tag. Max 1500 characters. Used during document processing to guide memory extraction. + filepath: Optional file path for the document. Used by supermemoryfs to store the full + path of the file. + metadata: Optional metadata for the document. task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, @@ -613,6 +622,7 @@ async def add( "container_tags": container_tags, "custom_id": custom_id, "entity_context": entity_context, + "filepath": filepath, "metadata": metadata, "task_type": task_type, }, diff --git a/src/supermemory/resources/documents.py b/src/supermemory/resources/documents.py index 22a23cf1..38a6d1f6 100644 --- a/src/supermemory/resources/documents.py +++ b/src/supermemory/resources/documents.py @@ -66,6 +66,7 @@ def update( container_tags: SequenceNotStr[str] | Omit = omit, content: str | Omit = omit, custom_id: str | Omit = omit, + filepath: 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. @@ -99,6 +100,9 @@ def update( custom_id: Optional custom ID of the document. This could be an ID from your database that will uniquely identify this document. + filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used + by supermemoryfs to map documents to filesystem paths. + 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 @@ -126,6 +130,7 @@ def update( "container_tags": container_tags, "content": content, "custom_id": custom_id, + "filepath": filepath, "metadata": metadata, "task_type": task_type, }, @@ -141,6 +146,7 @@ def list( self, *, container_tags: SequenceNotStr[str] | Omit = omit, + filepath: str | Omit = omit, filters: document_list_params.Filters | Omit = omit, include_content: bool | Omit = omit, limit: Union[str, float] | Omit = omit, @@ -162,6 +168,9 @@ def list( your user, a project ID, or any other identifier you wish to use to group documents. + filepath: Filter documents by filepath. Exact match for full paths, prefix match if ending + with / + filters: Optional filters to apply to the search. Can be a JSON string or Query object. include_content: Whether to include the content field in the response. Warning: This can make @@ -188,6 +197,7 @@ def list( body=maybe_transform( { "container_tags": container_tags, + "filepath": filepath, "filters": filters, "include_content": include_content, "limit": limit, @@ -245,6 +255,7 @@ def add( container_tags: SequenceNotStr[str] | Omit = omit, custom_id: str | Omit = omit, entity_context: str | Omit = omit, + filepath: 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. @@ -270,6 +281,9 @@ def add( entity_context: Optional entity context for this container tag. Max 1500 characters. Used during document processing to guide memory extraction. + filepath: Optional file path for the document. Used by supermemoryfs to store the full + path of the file. + metadata: Optional metadata for the document. task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, @@ -292,6 +306,7 @@ def add( "container_tags": container_tags, "custom_id": custom_id, "entity_context": entity_context, + "filepath": filepath, "metadata": metadata, "task_type": task_type, }, @@ -310,6 +325,7 @@ def batch_add( container_tag: str | Omit = omit, container_tags: SequenceNotStr[str] | Omit = omit, content: None | Omit = omit, + filepath: 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. @@ -333,6 +349,9 @@ def batch_add( containerized by. This can be an ID for your user, a project ID, or any other identifier you wish to use to group documents. + filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used + by supermemoryfs to map documents to filesystem paths. + 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 @@ -358,6 +377,7 @@ def batch_add( "container_tag": container_tag, "container_tags": container_tags, "content": content, + "filepath": filepath, "metadata": metadata, "task_type": task_type, }, @@ -373,6 +393,7 @@ def delete_bulk( self, *, container_tags: SequenceNotStr[str] | Omit = omit, + filepath: str | Omit = omit, ids: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -387,6 +408,9 @@ def delete_bulk( Args: container_tags: Array of container tags - all documents in these containers will be deleted + filepath: Delete documents matching this filepath. Exact match for full paths, prefix + match if ending with / + ids: Array of document IDs to delete (max 100 at once) extra_headers: Send extra headers @@ -402,6 +426,7 @@ def delete_bulk( body=maybe_transform( { "container_tags": container_tags, + "filepath": filepath, "ids": ids, }, document_delete_bulk_params.DocumentDeleteBulkParams, @@ -470,6 +495,7 @@ def upload_file( file: FileTypes, container_tag: str | Omit = omit, container_tags: str | Omit = omit, + filepath: str | Omit = omit, file_type: str | Omit = omit, metadata: str | Omit = omit, mime_type: str | Omit = omit, @@ -494,6 +520,9 @@ def upload_file( '["user_123", "project_123"]') or a single string (e.g., 'user_123'). Single strings will be automatically converted to an array. + filepath: Optional file path for the uploaded file (e.g., '/documents/reports/file.pdf'). + Used by supermemoryfs to map documents to filesystem paths. + file_type: Optional file type override to force specific processing behavior. Valid values: text, pdf, tweet, google_doc, google_slide, google_sheet, image, video, @@ -526,6 +555,7 @@ def upload_file( "file": file, "container_tag": container_tag, "container_tags": container_tags, + "filepath": filepath, "file_type": file_type, "metadata": metadata, "mime_type": mime_type, @@ -577,6 +607,7 @@ async def update( container_tags: SequenceNotStr[str] | Omit = omit, content: str | Omit = omit, custom_id: str | Omit = omit, + filepath: 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. @@ -610,6 +641,9 @@ async def update( custom_id: Optional custom ID of the document. This could be an ID from your database that will uniquely identify this document. + filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used + by supermemoryfs to map documents to filesystem paths. + 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 @@ -637,6 +671,7 @@ async def update( "container_tags": container_tags, "content": content, "custom_id": custom_id, + "filepath": filepath, "metadata": metadata, "task_type": task_type, }, @@ -652,6 +687,7 @@ async def list( self, *, container_tags: SequenceNotStr[str] | Omit = omit, + filepath: str | Omit = omit, filters: document_list_params.Filters | Omit = omit, include_content: bool | Omit = omit, limit: Union[str, float] | Omit = omit, @@ -673,6 +709,9 @@ async def list( your user, a project ID, or any other identifier you wish to use to group documents. + filepath: Filter documents by filepath. Exact match for full paths, prefix match if ending + with / + filters: Optional filters to apply to the search. Can be a JSON string or Query object. include_content: Whether to include the content field in the response. Warning: This can make @@ -699,6 +738,7 @@ async def list( body=await async_maybe_transform( { "container_tags": container_tags, + "filepath": filepath, "filters": filters, "include_content": include_content, "limit": limit, @@ -756,6 +796,7 @@ async def add( container_tags: SequenceNotStr[str] | Omit = omit, custom_id: str | Omit = omit, entity_context: str | Omit = omit, + filepath: 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. @@ -781,6 +822,9 @@ async def add( entity_context: Optional entity context for this container tag. Max 1500 characters. Used during document processing to guide memory extraction. + filepath: Optional file path for the document. Used by supermemoryfs to store the full + path of the file. + metadata: Optional metadata for the document. task_type: Task type: "memory" (default) for full context layer with SuperRAG built in, @@ -803,6 +847,7 @@ async def add( "container_tags": container_tags, "custom_id": custom_id, "entity_context": entity_context, + "filepath": filepath, "metadata": metadata, "task_type": task_type, }, @@ -821,6 +866,7 @@ async def batch_add( container_tag: str | Omit = omit, container_tags: SequenceNotStr[str] | Omit = omit, content: None | Omit = omit, + filepath: 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. @@ -844,6 +890,9 @@ async def batch_add( containerized by. This can be an ID for your user, a project ID, or any other identifier you wish to use to group documents. + filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used + by supermemoryfs to map documents to filesystem paths. + 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 @@ -869,6 +918,7 @@ async def batch_add( "container_tag": container_tag, "container_tags": container_tags, "content": content, + "filepath": filepath, "metadata": metadata, "task_type": task_type, }, @@ -884,6 +934,7 @@ async def delete_bulk( self, *, container_tags: SequenceNotStr[str] | Omit = omit, + filepath: str | Omit = omit, ids: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -898,6 +949,9 @@ async def delete_bulk( Args: container_tags: Array of container tags - all documents in these containers will be deleted + filepath: Delete documents matching this filepath. Exact match for full paths, prefix + match if ending with / + ids: Array of document IDs to delete (max 100 at once) extra_headers: Send extra headers @@ -913,6 +967,7 @@ async def delete_bulk( body=await async_maybe_transform( { "container_tags": container_tags, + "filepath": filepath, "ids": ids, }, document_delete_bulk_params.DocumentDeleteBulkParams, @@ -981,6 +1036,7 @@ async def upload_file( file: FileTypes, container_tag: str | Omit = omit, container_tags: str | Omit = omit, + filepath: str | Omit = omit, file_type: str | Omit = omit, metadata: str | Omit = omit, mime_type: str | Omit = omit, @@ -1005,6 +1061,9 @@ async def upload_file( '["user_123", "project_123"]') or a single string (e.g., 'user_123'). Single strings will be automatically converted to an array. + filepath: Optional file path for the uploaded file (e.g., '/documents/reports/file.pdf'). + Used by supermemoryfs to map documents to filesystem paths. + file_type: Optional file type override to force specific processing behavior. Valid values: text, pdf, tweet, google_doc, google_slide, google_sheet, image, video, @@ -1037,6 +1096,7 @@ async def upload_file( "file": file, "container_tag": container_tag, "container_tags": container_tags, + "filepath": filepath, "file_type": file_type, "metadata": metadata, "mime_type": mime_type, diff --git a/src/supermemory/resources/search.py b/src/supermemory/resources/search.py index 821725e2..c02d83cf 100644 --- a/src/supermemory/resources/search.py +++ b/src/supermemory/resources/search.py @@ -55,6 +55,7 @@ def documents( container_tags: SequenceNotStr[str] | Omit = omit, doc_id: str | Omit = omit, document_threshold: float | Omit = omit, + filepath: str | Omit = omit, filters: search_documents_params.Filters | Omit = omit, include_full_docs: bool | Omit = omit, include_summary: bool | Omit = omit, @@ -92,6 +93,9 @@ def documents( document_threshold: DEPRECATED: This field is no longer used in v3 search. The search now uses chunkThreshold only. This parameter will be ignored. + filepath: Filter search results by filepath. Exact match for full paths, prefix match if + ending with / + filters: Optional filters to apply to the search. Can be a JSON string or Query object. include_full_docs: If true, include full document in the response. This is helpful if you want a @@ -131,6 +135,7 @@ def documents( "container_tags": container_tags, "doc_id": doc_id, "document_threshold": document_threshold, + "filepath": filepath, "filters": filters, "include_full_docs": include_full_docs, "include_summary": include_summary, @@ -157,6 +162,7 @@ def execute( container_tags: SequenceNotStr[str] | Omit = omit, doc_id: str | Omit = omit, document_threshold: float | Omit = omit, + filepath: str | Omit = omit, filters: search_execute_params.Filters | Omit = omit, include_full_docs: bool | Omit = omit, include_summary: bool | Omit = omit, @@ -194,6 +200,9 @@ def execute( document_threshold: DEPRECATED: This field is no longer used in v3 search. The search now uses chunkThreshold only. This parameter will be ignored. + filepath: Filter search results by filepath. Exact match for full paths, prefix match if + ending with / + filters: Optional filters to apply to the search. Can be a JSON string or Query object. include_full_docs: If true, include full document in the response. This is helpful if you want a @@ -233,6 +242,7 @@ def execute( "container_tags": container_tags, "doc_id": doc_id, "document_threshold": document_threshold, + "filepath": filepath, "filters": filters, "include_full_docs": include_full_docs, "include_summary": include_summary, @@ -255,6 +265,7 @@ def memories( q: str, aggregate: bool | Omit = omit, container_tag: str | Omit = omit, + filepath: str | Omit = omit, filters: search_memories_params.Filters | Omit = omit, include: search_memories_params.Include | Omit = omit, limit: int | Omit = omit, @@ -282,6 +293,9 @@ def memories( container_tag: Optional tag this search should be containerized by. This can be an ID for your user, a project ID, or any other identifier you wish to use to filter memories. + filepath: Filter search results by filepath. Exact match for full paths, prefix match if + ending with / + filters: Optional filters to apply to the search. Can be a JSON string or Query object. limit: Maximum number of results to return @@ -315,6 +329,7 @@ def memories( "q": q, "aggregate": aggregate, "container_tag": container_tag, + "filepath": filepath, "filters": filters, "include": include, "limit": limit, @@ -362,6 +377,7 @@ async def documents( container_tags: SequenceNotStr[str] | Omit = omit, doc_id: str | Omit = omit, document_threshold: float | Omit = omit, + filepath: str | Omit = omit, filters: search_documents_params.Filters | Omit = omit, include_full_docs: bool | Omit = omit, include_summary: bool | Omit = omit, @@ -399,6 +415,9 @@ async def documents( document_threshold: DEPRECATED: This field is no longer used in v3 search. The search now uses chunkThreshold only. This parameter will be ignored. + filepath: Filter search results by filepath. Exact match for full paths, prefix match if + ending with / + filters: Optional filters to apply to the search. Can be a JSON string or Query object. include_full_docs: If true, include full document in the response. This is helpful if you want a @@ -438,6 +457,7 @@ async def documents( "container_tags": container_tags, "doc_id": doc_id, "document_threshold": document_threshold, + "filepath": filepath, "filters": filters, "include_full_docs": include_full_docs, "include_summary": include_summary, @@ -464,6 +484,7 @@ async def execute( container_tags: SequenceNotStr[str] | Omit = omit, doc_id: str | Omit = omit, document_threshold: float | Omit = omit, + filepath: str | Omit = omit, filters: search_execute_params.Filters | Omit = omit, include_full_docs: bool | Omit = omit, include_summary: bool | Omit = omit, @@ -501,6 +522,9 @@ async def execute( document_threshold: DEPRECATED: This field is no longer used in v3 search. The search now uses chunkThreshold only. This parameter will be ignored. + filepath: Filter search results by filepath. Exact match for full paths, prefix match if + ending with / + filters: Optional filters to apply to the search. Can be a JSON string or Query object. include_full_docs: If true, include full document in the response. This is helpful if you want a @@ -540,6 +564,7 @@ async def execute( "container_tags": container_tags, "doc_id": doc_id, "document_threshold": document_threshold, + "filepath": filepath, "filters": filters, "include_full_docs": include_full_docs, "include_summary": include_summary, @@ -562,6 +587,7 @@ async def memories( q: str, aggregate: bool | Omit = omit, container_tag: str | Omit = omit, + filepath: str | Omit = omit, filters: search_memories_params.Filters | Omit = omit, include: search_memories_params.Include | Omit = omit, limit: int | Omit = omit, @@ -589,6 +615,9 @@ async def memories( container_tag: Optional tag this search should be containerized by. This can be an ID for your user, a project ID, or any other identifier you wish to use to filter memories. + filepath: Filter search results by filepath. Exact match for full paths, prefix match if + ending with / + filters: Optional filters to apply to the search. Can be a JSON string or Query object. limit: Maximum number of results to return @@ -622,6 +651,7 @@ async def memories( "q": q, "aggregate": aggregate, "container_tag": container_tag, + "filepath": filepath, "filters": filters, "include": include, "limit": limit, diff --git a/src/supermemory/types/client_add_params.py b/src/supermemory/types/client_add_params.py index ff764f17..2b7aaed4 100644 --- a/src/supermemory/types/client_add_params.py +++ b/src/supermemory/types/client_add_params.py @@ -38,6 +38,12 @@ class ClientAddParams(TypedDict, total=False): Max 1500 characters. Used during document processing to guide memory extraction. """ + filepath: str + """Optional file path for the document. + + Used by supermemoryfs to store the full path of the file. + """ + 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 fa12f338..07ea0756 100644 --- a/src/supermemory/types/document_add_params.py +++ b/src/supermemory/types/document_add_params.py @@ -38,6 +38,12 @@ class DocumentAddParams(TypedDict, total=False): Max 1500 characters. Used during document processing to guide memory extraction. """ + filepath: str + """Optional file path for the document. + + Used by supermemoryfs to store the full path of the file. + """ + 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 cc132e46..8c5daf96 100644 --- a/src/supermemory/types/document_batch_add_params.py +++ b/src/supermemory/types/document_batch_add_params.py @@ -30,6 +30,12 @@ class DocumentBatchAddParams(TypedDict, total=False): content: None + filepath: str + """Optional file path for the document (e.g., '/documents/reports/file.pdf'). + + Used by supermemoryfs to map documents to filesystem paths. + """ + metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] """Optional metadata for the document. @@ -80,6 +86,12 @@ class DocumentsUnionMember0(TypedDict, total=False): document. """ + filepath: str + """Optional file path for the document (e.g., '/documents/reports/file.pdf'). + + Used by supermemoryfs to map documents to filesystem paths. + """ + metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] """Optional metadata for the document. diff --git a/src/supermemory/types/document_delete_bulk_params.py b/src/supermemory/types/document_delete_bulk_params.py index 047f7d67..3dd221a2 100644 --- a/src/supermemory/types/document_delete_bulk_params.py +++ b/src/supermemory/types/document_delete_bulk_params.py @@ -14,5 +14,11 @@ class DocumentDeleteBulkParams(TypedDict, total=False): container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")] """Array of container tags - all documents in these containers will be deleted""" + filepath: str + """Delete documents matching this filepath. + + Exact match for full paths, prefix match if ending with / + """ + ids: SequenceNotStr[str] """Array of document IDs to delete (max 100 at once)""" diff --git a/src/supermemory/types/document_get_response.py b/src/supermemory/types/document_get_response.py index 4f07afc1..411f1793 100644 --- a/src/supermemory/types/document_get_response.py +++ b/src/supermemory/types/document_get_response.py @@ -44,6 +44,8 @@ class DocumentGetResponse(BaseModel): document. """ + filepath: Optional[str] = None + metadata: Union[str, float, bool, Dict[str, object], List[object], None] = None """Optional metadata for the document. diff --git a/src/supermemory/types/document_list_params.py b/src/supermemory/types/document_list_params.py index d37a0e39..11bd9579 100644 --- a/src/supermemory/types/document_list_params.py +++ b/src/supermemory/types/document_list_params.py @@ -336,6 +336,12 @@ class DocumentListParams(TypedDict, total=False): to use to group documents. """ + filepath: str + """Filter documents by filepath. + + Exact match for full paths, prefix match if ending with / + """ + filters: Filters """Optional filters to apply to the search. Can be a JSON string or Query object.""" diff --git a/src/supermemory/types/document_list_response.py b/src/supermemory/types/document_list_response.py index c5cb1b14..d6679650 100644 --- a/src/supermemory/types/document_list_response.py +++ b/src/supermemory/types/document_list_response.py @@ -30,6 +30,8 @@ class Memory(BaseModel): document. """ + filepath: Optional[str] = None + metadata: Union[str, float, bool, Dict[str, object], List[object], None] = None """Optional metadata for the document. diff --git a/src/supermemory/types/document_update_params.py b/src/supermemory/types/document_update_params.py index ade57db4..3164b5b5 100644 --- a/src/supermemory/types/document_update_params.py +++ b/src/supermemory/types/document_update_params.py @@ -45,6 +45,12 @@ class DocumentUpdateParams(TypedDict, total=False): document. """ + filepath: str + """Optional file path for the document (e.g., '/documents/reports/file.pdf'). + + Used by supermemoryfs to map documents to filesystem paths. + """ + 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 3c11e02e..507fc876 100644 --- a/src/supermemory/types/document_upload_file_params.py +++ b/src/supermemory/types/document_upload_file_params.py @@ -25,6 +25,12 @@ class DocumentUploadFileParams(TypedDict, total=False): converted to an array. """ + filepath: str + """Optional file path for the uploaded file (e.g., '/documents/reports/file.pdf'). + + Used by supermemoryfs to map documents to filesystem paths. + """ + file_type: Annotated[str, PropertyInfo(alias="fileType")] """Optional file type override to force specific processing behavior. diff --git a/src/supermemory/types/search_documents_params.py b/src/supermemory/types/search_documents_params.py index 8f77d226..2f688052 100644 --- a/src/supermemory/types/search_documents_params.py +++ b/src/supermemory/types/search_documents_params.py @@ -364,6 +364,12 @@ class SearchDocumentsParams(TypedDict, total=False): The search now uses chunkThreshold only. This parameter will be ignored. """ + filepath: str + """Filter search results by filepath. + + Exact match for full paths, prefix match if ending with / + """ + filters: Filters """Optional filters to apply to the search. Can be a JSON string or Query object.""" diff --git a/src/supermemory/types/search_execute_params.py b/src/supermemory/types/search_execute_params.py index 2102f87e..9660a3f1 100644 --- a/src/supermemory/types/search_execute_params.py +++ b/src/supermemory/types/search_execute_params.py @@ -364,6 +364,12 @@ class SearchExecuteParams(TypedDict, total=False): The search now uses chunkThreshold only. This parameter will be ignored. """ + filepath: str + """Filter search results by filepath. + + Exact match for full paths, prefix match if ending with / + """ + filters: Filters """Optional filters to apply to the search. Can be a JSON string or Query object.""" diff --git a/src/supermemory/types/search_memories_params.py b/src/supermemory/types/search_memories_params.py index a6d3aed2..12aa6655 100644 --- a/src/supermemory/types/search_memories_params.py +++ b/src/supermemory/types/search_memories_params.py @@ -346,6 +346,12 @@ class SearchMemoriesParams(TypedDict, total=False): to use to filter memories. """ + filepath: str + """Filter search results by filepath. + + Exact match for full paths, prefix match if ending with / + """ + filters: Filters """Optional filters to apply to the search. Can be a JSON string or Query object.""" diff --git a/src/supermemory/types/search_memories_response.py b/src/supermemory/types/search_memories_response.py index 16d6ad48..3395f88b 100644 --- a/src/supermemory/types/search_memories_response.py +++ b/src/supermemory/types/search_memories_response.py @@ -128,6 +128,9 @@ class Result(BaseModel): documents: Optional[List[ResultDocument]] = None """Associated documents for this memory entry""" + filepath: Optional[str] = None + """Filepath of the source document this memory or chunk came from""" + is_aggregated: Optional[bool] = FieldInfo(alias="isAggregated", default=None) """Indicates if this memory was created by aggregating multiple source memories""" diff --git a/tests/api_resources/test_client.py b/tests/api_resources/test_client.py index 79ae807b..ca8cfa46 100644 --- a/tests/api_resources/test_client.py +++ b/tests/api_resources/test_client.py @@ -34,6 +34,7 @@ def test_method_add_with_all_params(self, client: Supermemory) -> None: container_tags=["string"], custom_id="customId", entity_context="entityContext", + filepath="filepath", metadata={"foo": "string"}, task_type="memory", ) @@ -144,6 +145,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncSupermemory) container_tags=["string"], custom_id="customId", entity_context="entityContext", + filepath="filepath", metadata={"foo": "string"}, task_type="memory", ) diff --git a/tests/api_resources/test_documents.py b/tests/api_resources/test_documents.py index 7a86ae7e..684058aa 100644 --- a/tests/api_resources/test_documents.py +++ b/tests/api_resources/test_documents.py @@ -43,6 +43,7 @@ def test_method_update_with_all_params(self, client: Supermemory) -> None: container_tags=["user_123", "project_123"], content="This is a detailed article about machine learning concepts...", custom_id="mem_abc123", + filepath="/documents/reports/file.pdf", metadata={ "category": "technology", "isPublic": True, @@ -100,6 +101,7 @@ def test_method_list(self, client: Supermemory) -> None: def test_method_list_with_all_params(self, client: Supermemory) -> None: document = client.documents.list( container_tags=["user_123", "project_123"], + filepath="/docs/", filters={ "and_": [ { @@ -209,6 +211,7 @@ def test_method_add_with_all_params(self, client: Supermemory) -> None: container_tags=["string"], custom_id="customId", entity_context="entityContext", + filepath="filepath", metadata={"foo": "string"}, task_type="memory", ) @@ -258,6 +261,7 @@ def test_method_batch_add_with_all_params(self, client: Supermemory) -> None: "container_tag": "user_123", "container_tags": ["user_123", "project_123"], "custom_id": "mem_abc123", + "filepath": "/documents/reports/file.pdf", "metadata": { "category": "technology", "isPublic": True, @@ -272,6 +276,7 @@ def test_method_batch_add_with_all_params(self, client: Supermemory) -> None: container_tag="user_123", container_tags=["user_123", "project_123"], content=None, + filepath="/documents/reports/file.pdf", metadata={ "category": "technology", "isPublic": True, @@ -321,6 +326,7 @@ def test_method_delete_bulk(self, client: Supermemory) -> None: def test_method_delete_bulk_with_all_params(self, client: Supermemory) -> None: document = client.documents.delete_bulk( container_tags=["user_123", "project_123"], + filepath="/docs/old/", ids=["acxV5LHMEsG2hMSNb4umbn", "bxcV5LHMEsG2hMSNb4umbn"], ) assert_matches_type(DocumentDeleteBulkResponse, document, path=["response"]) @@ -432,6 +438,7 @@ def test_method_upload_file_with_all_params(self, client: Supermemory) -> None: file=b"Example data", container_tag="user", container_tags='["user_123", "project_123"]', + filepath="/documents/reports/file.pdf", file_type="image", metadata='{"category": "technology", "isPublic": true, "readingTime": 5}', mime_type="mimeType", @@ -489,6 +496,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncSupermemor container_tags=["user_123", "project_123"], content="This is a detailed article about machine learning concepts...", custom_id="mem_abc123", + filepath="/documents/reports/file.pdf", metadata={ "category": "technology", "isPublic": True, @@ -546,6 +554,7 @@ async def test_method_list(self, async_client: AsyncSupermemory) -> None: async def test_method_list_with_all_params(self, async_client: AsyncSupermemory) -> None: document = await async_client.documents.list( container_tags=["user_123", "project_123"], + filepath="/docs/", filters={ "and_": [ { @@ -655,6 +664,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncSupermemory) container_tags=["string"], custom_id="customId", entity_context="entityContext", + filepath="filepath", metadata={"foo": "string"}, task_type="memory", ) @@ -704,6 +714,7 @@ async def test_method_batch_add_with_all_params(self, async_client: AsyncSuperme "container_tag": "user_123", "container_tags": ["user_123", "project_123"], "custom_id": "mem_abc123", + "filepath": "/documents/reports/file.pdf", "metadata": { "category": "technology", "isPublic": True, @@ -718,6 +729,7 @@ async def test_method_batch_add_with_all_params(self, async_client: AsyncSuperme container_tag="user_123", container_tags=["user_123", "project_123"], content=None, + filepath="/documents/reports/file.pdf", metadata={ "category": "technology", "isPublic": True, @@ -767,6 +779,7 @@ async def test_method_delete_bulk(self, async_client: AsyncSupermemory) -> None: async def test_method_delete_bulk_with_all_params(self, async_client: AsyncSupermemory) -> None: document = await async_client.documents.delete_bulk( container_tags=["user_123", "project_123"], + filepath="/docs/old/", ids=["acxV5LHMEsG2hMSNb4umbn", "bxcV5LHMEsG2hMSNb4umbn"], ) assert_matches_type(DocumentDeleteBulkResponse, document, path=["response"]) @@ -878,6 +891,7 @@ async def test_method_upload_file_with_all_params(self, async_client: AsyncSuper file=b"Example data", container_tag="user", container_tags='["user_123", "project_123"]', + filepath="/documents/reports/file.pdf", file_type="image", metadata='{"category": "technology", "isPublic": true, "readingTime": 5}', mime_type="mimeType", diff --git a/tests/api_resources/test_search.py b/tests/api_resources/test_search.py index 265f091d..eaabbaf5 100644 --- a/tests/api_resources/test_search.py +++ b/tests/api_resources/test_search.py @@ -40,6 +40,7 @@ def test_method_documents_with_all_params(self, client: Supermemory) -> None: container_tags=["user_123"], doc_id="docId", document_threshold=0, + filepath="/docs/", filters={ "or_": [ { @@ -106,6 +107,7 @@ def test_method_execute_with_all_params(self, client: Supermemory) -> None: container_tags=["user_123"], doc_id="docId", document_threshold=0, + filepath="/docs/", filters={ "or_": [ { @@ -168,6 +170,7 @@ def test_method_memories_with_all_params(self, client: Supermemory) -> None: q="machine learning concepts", aggregate=False, container_tag="user_123", + filepath="/docs/", filters={ "or_": [ { @@ -246,6 +249,7 @@ async def test_method_documents_with_all_params(self, async_client: AsyncSuperme container_tags=["user_123"], doc_id="docId", document_threshold=0, + filepath="/docs/", filters={ "or_": [ { @@ -312,6 +316,7 @@ async def test_method_execute_with_all_params(self, async_client: AsyncSupermemo container_tags=["user_123"], doc_id="docId", document_threshold=0, + filepath="/docs/", filters={ "or_": [ { @@ -374,6 +379,7 @@ async def test_method_memories_with_all_params(self, async_client: AsyncSupermem q="machine learning concepts", aggregate=False, container_tag="user_123", + filepath="/docs/", filters={ "or_": [ { From 421e80e55548a1ea7b348683e841060c350b56e7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 07:15:15 +0000 Subject: [PATCH 5/6] perf(client): optimize file structure copying in multipart requests --- src/supermemory/_files.py | 56 ++++++++++++++- src/supermemory/_utils/__init__.py | 1 - src/supermemory/_utils/_utils.py | 15 ---- src/supermemory/resources/documents.py | 13 ++-- tests/test_deepcopy.py | 58 --------------- tests/test_files.py | 99 +++++++++++++++++++++++++- 6 files changed, 159 insertions(+), 83 deletions(-) delete mode 100644 tests/test_deepcopy.py diff --git a/src/supermemory/_files.py b/src/supermemory/_files.py index ae7c4650..23783586 100644 --- a/src/supermemory/_files.py +++ b/src/supermemory/_files.py @@ -3,8 +3,8 @@ import io import os import pathlib -from typing import overload -from typing_extensions import TypeGuard +from typing import Sequence, cast, overload +from typing_extensions import TypeVar, TypeGuard import anyio @@ -17,7 +17,9 @@ HttpxFileContent, HttpxRequestFiles, ) -from ._utils import is_tuple_t, is_mapping_t, is_sequence_t +from ._utils import is_list, is_mapping, is_tuple_t, is_mapping_t, is_sequence_t + +_T = TypeVar("_T") def is_base64_file_input(obj: object) -> TypeGuard[Base64FileInput]: @@ -121,3 +123,51 @@ async def async_read_file_content(file: FileContent) -> HttpxFileContent: return await anyio.Path(file).read_bytes() return file + + +def deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]]) -> _T: + """Copy only the containers along the given paths. + + Used to guard against mutation by extract_files without copying the entire structure. + Only dicts and lists that lie on a path are copied; everything else + is returned by reference. + + For example, given paths=[["foo", "files", "file"]] and the structure: + { + "foo": { + "bar": {"baz": {}}, + "files": {"file": } + } + } + The root dict, "foo", and "files" are copied (they lie on the path). + "bar" and "baz" are returned by reference (off the path). + """ + return _deepcopy_with_paths(item, paths, 0) + + +def _deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]], index: int) -> _T: + if not paths: + return item + if is_mapping(item): + key_to_paths: dict[str, list[Sequence[str]]] = {} + for path in paths: + if index < len(path): + key_to_paths.setdefault(path[index], []).append(path) + + # if no path continues through this mapping, it won't be mutated and copying it is redundant + if not key_to_paths: + return item + + result = dict(item) + for key, subpaths in key_to_paths.items(): + if key in result: + result[key] = _deepcopy_with_paths(result[key], subpaths, index + 1) + return cast(_T, result) + if is_list(item): + array_paths = [path for path in paths if index < len(path) and path[index] == ""] + + # if no path expects a list here, nothing will be mutated inside it - return by reference + if not array_paths: + return cast(_T, item) + return cast(_T, [_deepcopy_with_paths(entry, array_paths, index + 1) for entry in item]) + return item diff --git a/src/supermemory/_utils/__init__.py b/src/supermemory/_utils/__init__.py index 10cb66d2..1c090e51 100644 --- a/src/supermemory/_utils/__init__.py +++ b/src/supermemory/_utils/__init__.py @@ -24,7 +24,6 @@ coerce_integer as coerce_integer, file_from_path as file_from_path, strip_not_given as strip_not_given, - deepcopy_minimal as deepcopy_minimal, get_async_library as get_async_library, maybe_coerce_float as maybe_coerce_float, get_required_header as get_required_header, diff --git a/src/supermemory/_utils/_utils.py b/src/supermemory/_utils/_utils.py index 63b8cd60..771859f5 100644 --- a/src/supermemory/_utils/_utils.py +++ b/src/supermemory/_utils/_utils.py @@ -177,21 +177,6 @@ def is_iterable(obj: object) -> TypeGuard[Iterable[object]]: return isinstance(obj, Iterable) -def deepcopy_minimal(item: _T) -> _T: - """Minimal reimplementation of copy.deepcopy() that will only copy certain object types: - - - mappings, e.g. `dict` - - list - - This is done for performance reasons. - """ - if is_mapping(item): - return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()}) - if is_list(item): - return cast(_T, [deepcopy_minimal(entry) for entry in item]) - return item - - # copied from https://github.com/Rapptz/RoboDanny def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str: size = len(seq) diff --git a/src/supermemory/resources/documents.py b/src/supermemory/resources/documents.py index 38a6d1f6..c193aafb 100644 --- a/src/supermemory/resources/documents.py +++ b/src/supermemory/resources/documents.py @@ -15,8 +15,9 @@ document_delete_bulk_params, document_upload_file_params, ) +from .._files import deepcopy_with_paths from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, FileTypes, SequenceNotStr, omit, not_given -from .._utils import extract_files, path_template, maybe_transform, deepcopy_minimal, async_maybe_transform +from .._utils import extract_files, path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -550,7 +551,7 @@ def upload_file( timeout: Override the client-level default timeout for this request, in seconds """ - body = deepcopy_minimal( + body = deepcopy_with_paths( { "file": file, "container_tag": container_tag, @@ -561,7 +562,8 @@ def upload_file( "mime_type": mime_type, "task_type": task_type, "use_advanced_processing": use_advanced_processing, - } + }, + [["file"]], ) files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) # It should be noted that the actual Content-Type header that will be @@ -1091,7 +1093,7 @@ async def upload_file( timeout: Override the client-level default timeout for this request, in seconds """ - body = deepcopy_minimal( + body = deepcopy_with_paths( { "file": file, "container_tag": container_tag, @@ -1102,7 +1104,8 @@ async def upload_file( "mime_type": mime_type, "task_type": task_type, "use_advanced_processing": use_advanced_processing, - } + }, + [["file"]], ) files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) # It should be noted that the actual Content-Type header that will be diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py deleted file mode 100644 index c464e633..00000000 --- a/tests/test_deepcopy.py +++ /dev/null @@ -1,58 +0,0 @@ -from supermemory._utils import deepcopy_minimal - - -def assert_different_identities(obj1: object, obj2: object) -> None: - assert obj1 == obj2 - assert id(obj1) != id(obj2) - - -def test_simple_dict() -> None: - obj1 = {"foo": "bar"} - obj2 = deepcopy_minimal(obj1) - assert_different_identities(obj1, obj2) - - -def test_nested_dict() -> None: - obj1 = {"foo": {"bar": True}} - obj2 = deepcopy_minimal(obj1) - assert_different_identities(obj1, obj2) - assert_different_identities(obj1["foo"], obj2["foo"]) - - -def test_complex_nested_dict() -> None: - obj1 = {"foo": {"bar": [{"hello": "world"}]}} - obj2 = deepcopy_minimal(obj1) - assert_different_identities(obj1, obj2) - assert_different_identities(obj1["foo"], obj2["foo"]) - assert_different_identities(obj1["foo"]["bar"], obj2["foo"]["bar"]) - assert_different_identities(obj1["foo"]["bar"][0], obj2["foo"]["bar"][0]) - - -def test_simple_list() -> None: - obj1 = ["a", "b", "c"] - obj2 = deepcopy_minimal(obj1) - assert_different_identities(obj1, obj2) - - -def test_nested_list() -> None: - obj1 = ["a", [1, 2, 3]] - obj2 = deepcopy_minimal(obj1) - assert_different_identities(obj1, obj2) - assert_different_identities(obj1[1], obj2[1]) - - -class MyObject: ... - - -def test_ignores_other_types() -> None: - # custom classes - my_obj = MyObject() - obj1 = {"foo": my_obj} - obj2 = deepcopy_minimal(obj1) - assert_different_identities(obj1, obj2) - assert obj1["foo"] is my_obj - - # tuples - obj3 = ("a", "b") - obj4 = deepcopy_minimal(obj3) - assert obj3 is obj4 diff --git a/tests/test_files.py b/tests/test_files.py index fe8388cc..2c10e6bd 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -4,7 +4,8 @@ import pytest from dirty_equals import IsDict, IsList, IsBytes, IsTuple -from supermemory._files import to_httpx_files, async_to_httpx_files +from supermemory._files import to_httpx_files, deepcopy_with_paths, async_to_httpx_files +from supermemory._utils import extract_files readme_path = Path(__file__).parent.parent.joinpath("README.md") @@ -49,3 +50,99 @@ def test_string_not_allowed() -> None: "file": "foo", # type: ignore } ) + + +def assert_different_identities(obj1: object, obj2: object) -> None: + assert obj1 == obj2 + assert obj1 is not obj2 + + +class TestDeepcopyWithPaths: + def test_copies_top_level_dict(self) -> None: + original = {"file": b"data", "other": "value"} + result = deepcopy_with_paths(original, [["file"]]) + assert_different_identities(result, original) + + def test_file_value_is_same_reference(self) -> None: + file_bytes = b"contents" + original = {"file": file_bytes} + result = deepcopy_with_paths(original, [["file"]]) + assert_different_identities(result, original) + assert result["file"] is file_bytes + + def test_list_popped_wholesale(self) -> None: + files = [b"f1", b"f2"] + original = {"files": files, "title": "t"} + result = deepcopy_with_paths(original, [["files", ""]]) + assert_different_identities(result, original) + result_files = result["files"] + assert isinstance(result_files, list) + assert_different_identities(result_files, files) + + def test_nested_array_path_copies_list_and_elements(self) -> None: + elem1 = {"file": b"f1", "extra": 1} + elem2 = {"file": b"f2", "extra": 2} + original = {"items": [elem1, elem2]} + result = deepcopy_with_paths(original, [["items", "", "file"]]) + assert_different_identities(result, original) + result_items = result["items"] + assert isinstance(result_items, list) + assert_different_identities(result_items, original["items"]) + assert_different_identities(result_items[0], elem1) + assert_different_identities(result_items[1], elem2) + + def test_empty_paths_returns_same_object(self) -> None: + original = {"foo": "bar"} + result = deepcopy_with_paths(original, []) + assert result is original + + def test_multiple_paths(self) -> None: + f1 = b"file1" + f2 = b"file2" + original = {"a": f1, "b": f2, "c": "unchanged"} + result = deepcopy_with_paths(original, [["a"], ["b"]]) + assert_different_identities(result, original) + assert result["a"] is f1 + assert result["b"] is f2 + assert result["c"] is original["c"] + + def test_extract_files_does_not_mutate_original_top_level(self) -> None: + file_bytes = b"contents" + original = {"file": file_bytes, "other": "value"} + + copied = deepcopy_with_paths(original, [["file"]]) + extracted = extract_files(copied, paths=[["file"]]) + + assert extracted == [("file", file_bytes)] + assert original == {"file": file_bytes, "other": "value"} + assert copied == {"other": "value"} + + def test_extract_files_does_not_mutate_original_nested_array_path(self) -> None: + file1 = b"f1" + file2 = b"f2" + original = { + "items": [ + {"file": file1, "extra": 1}, + {"file": file2, "extra": 2}, + ], + "title": "example", + } + + copied = deepcopy_with_paths(original, [["items", "", "file"]]) + extracted = extract_files(copied, paths=[["items", "", "file"]]) + + assert extracted == [("items[][file]", file1), ("items[][file]", file2)] + assert original == { + "items": [ + {"file": file1, "extra": 1}, + {"file": file2, "extra": 2}, + ], + "title": "example", + } + assert copied == { + "items": [ + {"extra": 1}, + {"extra": 2}, + ], + "title": "example", + } From afed1ceef0bf4b7f6e1546a2fb59b8204b46d16f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 07:15:32 +0000 Subject: [PATCH 6/6] release: 3.34.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ pyproject.toml | 2 +- src/supermemory/_version.py | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b7ab6b59..3b93d2a9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.33.1" + ".": "3.34.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e64a56d2..3e2658fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 3.34.0 (2026-04-18) + +Full Changelog: [v3.33.1...v3.34.0](https://github.com/supermemoryai/python-sdk/compare/v3.33.1...v3.34.0) + +### Features + +* **api:** api update ([5b92603](https://github.com/supermemoryai/python-sdk/commit/5b9260335ff2514491b0c41f6544872ee58485fb)) +* **api:** api update ([ab60a76](https://github.com/supermemoryai/python-sdk/commit/ab60a7657699fc974c8648adcb74a0dba9a4fe5b)) +* **api:** api update ([0950bae](https://github.com/supermemoryai/python-sdk/commit/0950bae08a126b09a2844839db673e99cfc13f75)) + + +### Performance Improvements + +* **client:** optimize file structure copying in multipart requests ([421e80e](https://github.com/supermemoryai/python-sdk/commit/421e80e55548a1ea7b348683e841060c350b56e7)) + ## 3.33.1 (2026-04-11) Full Changelog: [v3.33.0...v3.33.1](https://github.com/supermemoryai/python-sdk/compare/v3.33.0...v3.33.1) diff --git a/pyproject.toml b/pyproject.toml index 5959589b..8e5b0064 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "supermemory" -version = "3.33.1" +version = "3.34.0" description = "The official Python library for the supermemory API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/supermemory/_version.py b/src/supermemory/_version.py index d3646482..b36d0d79 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.33.1" # x-release-please-version +__version__ = "3.34.0" # x-release-please-version