Skip to content

Commit ad235ec

Browse files
feat(api): api update
1 parent 8cea6eb commit ad235ec

10 files changed

Lines changed: 145 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 26
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc/supermemory-new-83479ec87ce6fcd387134dbd2c041fc4eae89d7c1be81c9da394c4eda82290bb.yml
3-
openapi_spec_hash: 072b266cb6d477f1ac2ea4b1e6004fb7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc/supermemory-new-cc0ff5a1831707e8733abeeaa245215c4ba276f8f485ed36beeeaa4f0580a203.yml
3+
openapi_spec_hash: d49d49625c82142babe4a6ac4d2cd8d4
44
config_hash: cde97ef3188581c5f4924c633ec33ddb

src/supermemory/_client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ def add(
256256
custom_id: str | Omit = omit,
257257
entity_context: str | Omit = omit,
258258
filepath: str | Omit = omit,
259+
filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
259260
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
260261
task_type: Literal["memory", "superrag"] | Omit = omit,
261262
# 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(
284285
filepath: Optional file path for the document. Used by supermemoryfs to store the full
285286
path of the file.
286287
288+
filter_by_metadata: Optional metadata filter to apply when pulling related memories and profile
289+
during ingestion. Only memories matching these filters will be used as context.
290+
287291
metadata: Optional metadata for the document.
288292
289293
task_type: Task type: "memory" (default) for full context layer with SuperRAG built in,
@@ -307,6 +311,7 @@ def add(
307311
"custom_id": custom_id,
308312
"entity_context": entity_context,
309313
"filepath": filepath,
314+
"filter_by_metadata": filter_by_metadata,
310315
"metadata": metadata,
311316
"task_type": task_type,
312317
},
@@ -591,6 +596,7 @@ async def add(
591596
custom_id: str | Omit = omit,
592597
entity_context: str | Omit = omit,
593598
filepath: str | Omit = omit,
599+
filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
594600
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
595601
task_type: Literal["memory", "superrag"] | Omit = omit,
596602
# 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(
619625
filepath: Optional file path for the document. Used by supermemoryfs to store the full
620626
path of the file.
621627
628+
filter_by_metadata: Optional metadata filter to apply when pulling related memories and profile
629+
during ingestion. Only memories matching these filters will be used as context.
630+
622631
metadata: Optional metadata for the document.
623632
624633
task_type: Task type: "memory" (default) for full context layer with SuperRAG built in,
@@ -642,6 +651,7 @@ async def add(
642651
"custom_id": custom_id,
643652
"entity_context": entity_context,
644653
"filepath": filepath,
654+
"filter_by_metadata": filter_by_metadata,
645655
"metadata": metadata,
646656
"task_type": task_type,
647657
},

src/supermemory/resources/documents.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def update(
6868
content: str | Omit = omit,
6969
custom_id: str | Omit = omit,
7070
filepath: str | Omit = omit,
71+
filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
7172
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
7273
task_type: Literal["memory", "superrag"] | Omit = omit,
7374
# 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(
104105
filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used
105106
by supermemoryfs to map documents to filesystem paths.
106107
108+
filter_by_metadata: Optional metadata filter scoping which existing memories are pulled as context
109+
during ingestion. Scalar values match exactly (AND across keys); array values
110+
match ANY (OR within key). Only memories whose source documents match this
111+
filter are used as context.
112+
107113
metadata: Optional metadata for the document. This is used to store additional information
108114
about the document. You can use this to store any additional information you
109115
need about the document. Metadata can be filtered through. Keys must be strings
@@ -132,6 +138,7 @@ def update(
132138
"content": content,
133139
"custom_id": custom_id,
134140
"filepath": filepath,
141+
"filter_by_metadata": filter_by_metadata,
135142
"metadata": metadata,
136143
"task_type": task_type,
137144
},
@@ -257,6 +264,7 @@ def add(
257264
custom_id: str | Omit = omit,
258265
entity_context: str | Omit = omit,
259266
filepath: str | Omit = omit,
267+
filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
260268
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
261269
task_type: Literal["memory", "superrag"] | Omit = omit,
262270
# 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(
285293
filepath: Optional file path for the document. Used by supermemoryfs to store the full
286294
path of the file.
287295
296+
filter_by_metadata: Optional metadata filter to apply when pulling related memories and profile
297+
during ingestion. Only memories matching these filters will be used as context.
298+
288299
metadata: Optional metadata for the document.
289300
290301
task_type: Task type: "memory" (default) for full context layer with SuperRAG built in,
@@ -308,6 +319,7 @@ def add(
308319
"custom_id": custom_id,
309320
"entity_context": entity_context,
310321
"filepath": filepath,
322+
"filter_by_metadata": filter_by_metadata,
311323
"metadata": metadata,
312324
"task_type": task_type,
313325
},
@@ -327,6 +339,7 @@ def batch_add(
327339
container_tags: SequenceNotStr[str] | Omit = omit,
328340
content: None | Omit = omit,
329341
filepath: str | Omit = omit,
342+
filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
330343
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
331344
task_type: Literal["memory", "superrag"] | Omit = omit,
332345
# 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(
353366
filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used
354367
by supermemoryfs to map documents to filesystem paths.
355368
369+
filter_by_metadata: Optional metadata filter scoping which existing memories are pulled as context
370+
during ingestion. Scalar values match exactly (AND across keys); array values
371+
match ANY (OR within key). Only memories whose source documents match this
372+
filter are used as context.
373+
356374
metadata: Optional metadata for the document. This is used to store additional information
357375
about the document. You can use this to store any additional information you
358376
need about the document. Metadata can be filtered through. Keys must be strings
@@ -379,6 +397,7 @@ def batch_add(
379397
"container_tags": container_tags,
380398
"content": content,
381399
"filepath": filepath,
400+
"filter_by_metadata": filter_by_metadata,
382401
"metadata": metadata,
383402
"task_type": task_type,
384403
},
@@ -500,6 +519,7 @@ def upload_file(
500519
entity_context: str | Omit = omit,
501520
filepath: str | Omit = omit,
502521
file_type: str | Omit = omit,
522+
filter_by_metadata: str | Omit = omit,
503523
metadata: str | Omit = omit,
504524
mime_type: str | Omit = omit,
505525
task_type: Literal["memory", "superrag"] | Omit = omit,
@@ -537,6 +557,10 @@ def upload_file(
537557
text, pdf, tweet, google_doc, google_slide, google_sheet, image, video,
538558
notion_doc, webpage, onedrive
539559
560+
filter_by_metadata: Optional metadata filter as a JSON string. Scopes which existing memories are
561+
pulled as context during ingestion. Scalar values match exactly (AND across
562+
keys); array values match ANY (OR within key).
563+
540564
metadata: Optional metadata for the document as a JSON string. This is used to store
541565
additional information about the document. Keys must be strings and values can
542566
be strings, numbers, or booleans.
@@ -568,6 +592,7 @@ def upload_file(
568592
"entity_context": entity_context,
569593
"filepath": filepath,
570594
"file_type": file_type,
595+
"filter_by_metadata": filter_by_metadata,
571596
"metadata": metadata,
572597
"mime_type": mime_type,
573598
"task_type": task_type,
@@ -620,6 +645,7 @@ async def update(
620645
content: str | Omit = omit,
621646
custom_id: str | Omit = omit,
622647
filepath: str | Omit = omit,
648+
filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
623649
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
624650
task_type: Literal["memory", "superrag"] | Omit = omit,
625651
# 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(
656682
filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used
657683
by supermemoryfs to map documents to filesystem paths.
658684
685+
filter_by_metadata: Optional metadata filter scoping which existing memories are pulled as context
686+
during ingestion. Scalar values match exactly (AND across keys); array values
687+
match ANY (OR within key). Only memories whose source documents match this
688+
filter are used as context.
689+
659690
metadata: Optional metadata for the document. This is used to store additional information
660691
about the document. You can use this to store any additional information you
661692
need about the document. Metadata can be filtered through. Keys must be strings
@@ -684,6 +715,7 @@ async def update(
684715
"content": content,
685716
"custom_id": custom_id,
686717
"filepath": filepath,
718+
"filter_by_metadata": filter_by_metadata,
687719
"metadata": metadata,
688720
"task_type": task_type,
689721
},
@@ -809,6 +841,7 @@ async def add(
809841
custom_id: str | Omit = omit,
810842
entity_context: str | Omit = omit,
811843
filepath: str | Omit = omit,
844+
filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
812845
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
813846
task_type: Literal["memory", "superrag"] | Omit = omit,
814847
# 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(
837870
filepath: Optional file path for the document. Used by supermemoryfs to store the full
838871
path of the file.
839872
873+
filter_by_metadata: Optional metadata filter to apply when pulling related memories and profile
874+
during ingestion. Only memories matching these filters will be used as context.
875+
840876
metadata: Optional metadata for the document.
841877
842878
task_type: Task type: "memory" (default) for full context layer with SuperRAG built in,
@@ -860,6 +896,7 @@ async def add(
860896
"custom_id": custom_id,
861897
"entity_context": entity_context,
862898
"filepath": filepath,
899+
"filter_by_metadata": filter_by_metadata,
863900
"metadata": metadata,
864901
"task_type": task_type,
865902
},
@@ -879,6 +916,7 @@ async def batch_add(
879916
container_tags: SequenceNotStr[str] | Omit = omit,
880917
content: None | Omit = omit,
881918
filepath: str | Omit = omit,
919+
filter_by_metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
882920
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
883921
task_type: Literal["memory", "superrag"] | Omit = omit,
884922
# 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(
905943
filepath: Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used
906944
by supermemoryfs to map documents to filesystem paths.
907945
946+
filter_by_metadata: Optional metadata filter scoping which existing memories are pulled as context
947+
during ingestion. Scalar values match exactly (AND across keys); array values
948+
match ANY (OR within key). Only memories whose source documents match this
949+
filter are used as context.
950+
908951
metadata: Optional metadata for the document. This is used to store additional information
909952
about the document. You can use this to store any additional information you
910953
need about the document. Metadata can be filtered through. Keys must be strings
@@ -931,6 +974,7 @@ async def batch_add(
931974
"container_tags": container_tags,
932975
"content": content,
933976
"filepath": filepath,
977+
"filter_by_metadata": filter_by_metadata,
934978
"metadata": metadata,
935979
"task_type": task_type,
936980
},
@@ -1052,6 +1096,7 @@ async def upload_file(
10521096
entity_context: str | Omit = omit,
10531097
filepath: str | Omit = omit,
10541098
file_type: str | Omit = omit,
1099+
filter_by_metadata: str | Omit = omit,
10551100
metadata: str | Omit = omit,
10561101
mime_type: str | Omit = omit,
10571102
task_type: Literal["memory", "superrag"] | Omit = omit,
@@ -1089,6 +1134,10 @@ async def upload_file(
10891134
text, pdf, tweet, google_doc, google_slide, google_sheet, image, video,
10901135
notion_doc, webpage, onedrive
10911136
1137+
filter_by_metadata: Optional metadata filter as a JSON string. Scopes which existing memories are
1138+
pulled as context during ingestion. Scalar values match exactly (AND across
1139+
keys); array values match ANY (OR within key).
1140+
10921141
metadata: Optional metadata for the document as a JSON string. This is used to store
10931142
additional information about the document. Keys must be strings and values can
10941143
be strings, numbers, or booleans.
@@ -1120,6 +1169,7 @@ async def upload_file(
11201169
"entity_context": entity_context,
11211170
"filepath": filepath,
11221171
"file_type": file_type,
1172+
"filter_by_metadata": filter_by_metadata,
11231173
"metadata": metadata,
11241174
"mime_type": mime_type,
11251175
"task_type": task_type,

src/supermemory/types/client_add_params.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ class ClientAddParams(TypedDict, total=False):
4444
Used by supermemoryfs to store the full path of the file.
4545
"""
4646

47+
filter_by_metadata: Annotated[
48+
Dict[str, Union[str, float, bool, SequenceNotStr[str]]], PropertyInfo(alias="filterByMetadata")
49+
]
50+
"""
51+
Optional metadata filter to apply when pulling related memories and profile
52+
during ingestion. Only memories matching these filters will be used as context.
53+
"""
54+
4755
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]]
4856
"""Optional metadata for the document."""
4957

src/supermemory/types/document_add_params.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ class DocumentAddParams(TypedDict, total=False):
4444
Used by supermemoryfs to store the full path of the file.
4545
"""
4646

47+
filter_by_metadata: Annotated[
48+
Dict[str, Union[str, float, bool, SequenceNotStr[str]]], PropertyInfo(alias="filterByMetadata")
49+
]
50+
"""
51+
Optional metadata filter to apply when pulling related memories and profile
52+
during ingestion. Only memories matching these filters will be used as context.
53+
"""
54+
4755
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]]
4856
"""Optional metadata for the document."""
4957

src/supermemory/types/document_batch_add_params.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ class DocumentBatchAddParams(TypedDict, total=False):
3636
Used by supermemoryfs to map documents to filesystem paths.
3737
"""
3838

39+
filter_by_metadata: Annotated[
40+
Dict[str, Union[str, float, bool, SequenceNotStr[str]]], PropertyInfo(alias="filterByMetadata")
41+
]
42+
"""
43+
Optional metadata filter scoping which existing memories are pulled as context
44+
during ingestion. Scalar values match exactly (AND across keys); array values
45+
match ANY (OR within key). Only memories whose source documents match this
46+
filter are used as context.
47+
"""
48+
3949
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]]
4050
"""Optional metadata for the document.
4151
@@ -92,6 +102,16 @@ class DocumentsUnionMember0(TypedDict, total=False):
92102
Used by supermemoryfs to map documents to filesystem paths.
93103
"""
94104

105+
filter_by_metadata: Annotated[
106+
Dict[str, Union[str, float, bool, SequenceNotStr[str]]], PropertyInfo(alias="filterByMetadata")
107+
]
108+
"""
109+
Optional metadata filter scoping which existing memories are pulled as context
110+
during ingestion. Scalar values match exactly (AND across keys); array values
111+
match ANY (OR within key). Only memories whose source documents match this
112+
filter are used as context.
113+
"""
114+
95115
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]]
96116
"""Optional metadata for the document.
97117

src/supermemory/types/document_update_params.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ class DocumentUpdateParams(TypedDict, total=False):
5151
Used by supermemoryfs to map documents to filesystem paths.
5252
"""
5353

54+
filter_by_metadata: Annotated[
55+
Dict[str, Union[str, float, bool, SequenceNotStr[str]]], PropertyInfo(alias="filterByMetadata")
56+
]
57+
"""
58+
Optional metadata filter scoping which existing memories are pulled as context
59+
during ingestion. Scalar values match exactly (AND across keys); array values
60+
match ANY (OR within key). Only memories whose source documents match this
61+
filter are used as context.
62+
"""
63+
5464
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]]
5565
"""Optional metadata for the document.
5666

src/supermemory/types/document_upload_file_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ class DocumentUploadFileParams(TypedDict, total=False):
5050
video, notion_doc, webpage, onedrive
5151
"""
5252

53+
filter_by_metadata: Annotated[str, PropertyInfo(alias="filterByMetadata")]
54+
"""Optional metadata filter as a JSON string.
55+
56+
Scopes which existing memories are pulled as context during ingestion. Scalar
57+
values match exactly (AND across keys); array values match ANY (OR within key).
58+
"""
59+
5360
metadata: str
5461
"""Optional metadata for the document as a JSON string.
5562

tests/api_resources/test_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def test_method_add_with_all_params(self, client: Supermemory) -> None:
3535
custom_id="customId",
3636
entity_context="entityContext",
3737
filepath="filepath",
38+
filter_by_metadata={"foo": "string"},
3839
metadata={"foo": "string"},
3940
task_type="memory",
4041
)
@@ -146,6 +147,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncSupermemory)
146147
custom_id="customId",
147148
entity_context="entityContext",
148149
filepath="filepath",
150+
filter_by_metadata={"foo": "string"},
149151
metadata={"foo": "string"},
150152
task_type="memory",
151153
)

0 commit comments

Comments
 (0)