Skip to content

Commit cfade2f

Browse files
stainless-app[bot]Dhravya
authored andcommitted
feat(api): api update
1 parent ac1c054 commit cfade2f

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 19
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-ebd5e757d0e76cb83013e01a1e0bb3dba62beb83b2a2ffa28d148ea032e96fd0.yml
3-
openapi_spec_hash: f930474a6ad230545154244045cc602e
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-8f3109ed6b4537d66c1d430e552cb6d90323c2b495487132f5c5fc7fb0f91478.yml
3+
openapi_spec_hash: e2f06a2c0e73fb52262924ecd4027a6c
44
config_hash: ec08a36e60458b4d83e71798a8043484

src/supermemory/types/search_memories_params.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ class FiltersAnd(TypedDict, total=False):
6161

6262

6363
class Include(TypedDict, total=False):
64+
chunks: bool
65+
"""
66+
If true, fetch and return chunks from documents associated with the found
67+
memories. Performs vector search on chunks within those documents.
68+
"""
69+
6470
documents: bool
6571

6672
forgotten_memories: Annotated[bool, PropertyInfo(alias="forgottenMemories")]

src/supermemory/types/search_memories_response.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,28 @@
1010
__all__ = [
1111
"SearchMemoriesResponse",
1212
"Result",
13+
"ResultChunk",
1314
"ResultContext",
1415
"ResultContextChild",
1516
"ResultContextParent",
1617
"ResultDocument",
1718
]
1819

1920

21+
class ResultChunk(BaseModel):
22+
content: str
23+
"""Content of the chunk"""
24+
25+
document_id: str = FieldInfo(alias="documentId")
26+
"""ID of the document this chunk belongs to"""
27+
28+
position: float
29+
"""Position of chunk in the document (0-indexed)"""
30+
31+
score: float
32+
"""Similarity score between the query and chunk"""
33+
34+
2035
class ResultContextChild(BaseModel):
2136
memory: str
2237
"""The contextual memory content"""
@@ -102,6 +117,9 @@ class Result(BaseModel):
102117
updated_at: str = FieldInfo(alias="updatedAt")
103118
"""Memory last update date"""
104119

120+
chunks: Optional[List[ResultChunk]] = None
121+
"""Relevant chunks from associated documents (only included when chunks=true)"""
122+
105123
context: Optional[ResultContext] = None
106124
"""Object containing arrays of parent and child contextual memories"""
107125

tests/api_resources/test_search.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def test_method_memories_with_all_params(self, client: Supermemory) -> None:
145145
container_tag="user_123",
146146
filters={"or_": [{}]},
147147
include={
148+
"chunks": False,
148149
"documents": True,
149150
"forgotten_memories": False,
150151
"related_memories": True,
@@ -313,6 +314,7 @@ async def test_method_memories_with_all_params(self, async_client: AsyncSupermem
313314
container_tag="user_123",
314315
filters={"or_": [{}]},
315316
include={
317+
"chunks": False,
316318
"documents": True,
317319
"forgotten_memories": False,
318320
"related_memories": True,

0 commit comments

Comments
 (0)