Skip to content

Commit 4052bae

Browse files
feat(api): api update
1 parent ed787b1 commit 4052bae

File tree

6 files changed

+122
-34
lines changed

6 files changed

+122
-34
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: 8
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-9d4f071b79b2524fee219bcfb0eafb1070969bb809e2f3dbee89392bfb3eac53.yml
3-
openapi_spec_hash: 089ce871ebc7bda9d2974706373a989e
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-783134192ebb9f62b9a25815c143704ccec4466fb4c5ba611d60d854db976970.yml
3+
openapi_spec_hash: 2d0e081f9844f31ae00f95cff68ec29d
44
config_hash: eb32087403f958eead829e810f5a71b8

src/supermemory/resources/memory.py

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,24 @@ def create(
6666
metadata
6767
6868
Args:
69-
content: Content of the memory
69+
content: The content to extract and process into a memory. This can be a URL to a
70+
website, a PDF, an image, or a video.
7071
71-
metadata: Optional metadata for the memory
72+
Plaintext: Any plaintext format
7273
73-
user_id: Optional end user ID this memory belongs to
74+
URL: A URL to a website, PDF, image, or video
75+
76+
We automatically detect the content type from the url's response format.
77+
78+
metadata: Optional metadata for the memory. This is used to store additional information
79+
about the memory. You can use this to store any additional information you need
80+
about the memory. Metadata can be filtered through. Keys must be strings and are
81+
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
82+
objects.
83+
84+
user_id: Optional end user ID this memory belongs to. This is used to group memories by
85+
user. You should use the same ID stored in your external system where the user
86+
is stored
7487
7588
extra_headers: Send extra headers
7689
@@ -261,11 +274,24 @@ async def create(
261274
metadata
262275
263276
Args:
264-
content: Content of the memory
277+
content: The content to extract and process into a memory. This can be a URL to a
278+
website, a PDF, an image, or a video.
279+
280+
Plaintext: Any plaintext format
281+
282+
URL: A URL to a website, PDF, image, or video
283+
284+
We automatically detect the content type from the url's response format.
265285
266-
metadata: Optional metadata for the memory
286+
metadata: Optional metadata for the memory. This is used to store additional information
287+
about the memory. You can use this to store any additional information you need
288+
about the memory. Metadata can be filtered through. Keys must be strings and are
289+
case sensitive. Values can be strings, numbers, or booleans. You cannot nest
290+
objects.
267291
268-
user_id: Optional end user ID this memory belongs to
292+
user_id: Optional end user ID this memory belongs to. This is used to group memories by
293+
user. You should use the same ID stored in your external system where the user
294+
is stored
269295
270296
extra_headers: Send extra headers
271297

src/supermemory/resources/search.py

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,32 +66,40 @@ def execute(
6666
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
6767
) -> SearchExecuteResponse:
6868
"""
69-
Search through documents with metadata filtering
69+
Search through documents with filtering
7070
7171
Args:
7272
q: Search query string
7373
7474
categories_filter: Optional category filters
7575
76-
chunk_threshold: Maximum number of chunks to return
76+
chunk_threshold: Threshold / sensitivity for chunk selection. 0 is least sensitive (returns most
77+
chunks, more results), 1 is most sensitive (returns lesser chunks, accurate
78+
results)
7779
78-
doc_id: Optional document ID to search within
80+
doc_id: Optional document ID to search within. You can use this to find chunks in a very
81+
large document.
7982
80-
document_threshold: Maximum number of documents to return
83+
document_threshold: Threshold / sensitivity for document selection. 0 is least sensitive (returns
84+
most documents, more results), 1 is most sensitive (returns lesser documents,
85+
accurate results)
8186
8287
filters: Optional filters to apply to the search
8388
8489
include_summary: If true, include document summary in the response. This is helpful if you want a
85-
chatbot to know the context of the document.
90+
chatbot to know the full context of the document.
8691
8792
limit: Maximum number of results to return
8893
89-
only_matching_chunks: If true, only return matching chunks without context
94+
only_matching_chunks: If true, only return matching chunks without context. Normally, we send the
95+
previous and next chunk to provide more context for LLMs. If you only want the
96+
matching chunk, set this to true.
9097
9198
rewrite_query: If true, rewrites the query to make it easier to find documents. This increases
9299
the latency by about 400ms
93100
94-
user_id: End user ID this search is associated with
101+
user_id: End user ID this search is associated with. NOTE: This also acts as a filter for
102+
the search.
95103
96104
extra_headers: Send extra headers
97105
@@ -168,32 +176,40 @@ async def execute(
168176
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
169177
) -> SearchExecuteResponse:
170178
"""
171-
Search through documents with metadata filtering
179+
Search through documents with filtering
172180
173181
Args:
174182
q: Search query string
175183
176184
categories_filter: Optional category filters
177185
178-
chunk_threshold: Maximum number of chunks to return
186+
chunk_threshold: Threshold / sensitivity for chunk selection. 0 is least sensitive (returns most
187+
chunks, more results), 1 is most sensitive (returns lesser chunks, accurate
188+
results)
179189
180-
doc_id: Optional document ID to search within
190+
doc_id: Optional document ID to search within. You can use this to find chunks in a very
191+
large document.
181192
182-
document_threshold: Maximum number of documents to return
193+
document_threshold: Threshold / sensitivity for document selection. 0 is least sensitive (returns
194+
most documents, more results), 1 is most sensitive (returns lesser documents,
195+
accurate results)
183196
184197
filters: Optional filters to apply to the search
185198
186199
include_summary: If true, include document summary in the response. This is helpful if you want a
187-
chatbot to know the context of the document.
200+
chatbot to know the full context of the document.
188201
189202
limit: Maximum number of results to return
190203
191-
only_matching_chunks: If true, only return matching chunks without context
204+
only_matching_chunks: If true, only return matching chunks without context. Normally, we send the
205+
previous and next chunk to provide more context for LLMs. If you only want the
206+
matching chunk, set this to true.
192207
193208
rewrite_query: If true, rewrites the query to make it easier to find documents. This increases
194209
the latency by about 400ms
195210
196-
user_id: End user ID this search is associated with
211+
user_id: End user ID this search is associated with. NOTE: This also acts as a filter for
212+
the search.
197213
198214
extra_headers: Send extra headers
199215

src/supermemory/types/memory_create_params.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,31 @@
1212

1313
class MemoryCreateParams(TypedDict, total=False):
1414
content: Required[str]
15-
"""Content of the memory"""
15+
"""The content to extract and process into a memory.
16+
17+
This can be a URL to a website, a PDF, an image, or a video.
18+
19+
Plaintext: Any plaintext format
20+
21+
URL: A URL to a website, PDF, image, or video
22+
23+
We automatically detect the content type from the url's response format.
24+
"""
1625

1726
id: str
1827

1928
metadata: Dict[str, Union[str, float, bool]]
20-
"""Optional metadata for the memory"""
29+
"""Optional metadata for the memory.
30+
31+
This is used to store additional information about the memory. You can use this
32+
to store any additional information you need about the memory. Metadata can be
33+
filtered through. Keys must be strings and are case sensitive. Values can be
34+
strings, numbers, or booleans. You cannot nest objects.
35+
"""
2136

2237
user_id: Annotated[str, PropertyInfo(alias="userId")]
23-
"""Optional end user ID this memory belongs to"""
38+
"""Optional end user ID this memory belongs to.
39+
40+
This is used to group memories by user. You should use the same ID stored in
41+
your external system where the user is stored
42+
"""
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
from typing import Dict, Optional
4+
from datetime import datetime
5+
from typing_extensions import Literal
46

57
from pydantic import Field as FieldInfo
68

@@ -10,18 +12,25 @@
1012

1113

1214
class Doc(BaseModel):
13-
created_at: str = FieldInfo(alias="createdAt")
15+
created_at: datetime = FieldInfo(alias="createdAt")
16+
"""Timestamp when the memory was created"""
1417

15-
updated_at: str = FieldInfo(alias="updatedAt")
18+
updated_at: datetime = FieldInfo(alias="updatedAt")
19+
"""Timestamp when the memory was last updated"""
1620

1721
metadata: Optional[Dict[str, object]] = None
22+
"""Custom metadata associated with the memory"""
1823

1924
summary: Optional[str] = None
25+
"""Summary of the memory content"""
2026

2127
title: Optional[str] = None
28+
"""Title of the memory"""
2229

2330

2431
class MemoryGetResponse(BaseModel):
2532
doc: Doc
33+
"""Memory document details"""
2634

27-
status: Optional[str] = None
35+
status: Optional[Literal["queued", "extracting", "chunking", "embedding", "indexing", "done", "failed"]] = None
36+
"""Current processing status of the memory"""

src/supermemory/types/search_execute_params.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,43 @@ class SearchExecuteParams(TypedDict, total=False):
2020
"""Optional category filters"""
2121

2222
chunk_threshold: Annotated[float, PropertyInfo(alias="chunkThreshold")]
23-
"""Maximum number of chunks to return"""
23+
"""Threshold / sensitivity for chunk selection.
24+
25+
0 is least sensitive (returns most chunks, more results), 1 is most sensitive
26+
(returns lesser chunks, accurate results)
27+
"""
2428

2529
doc_id: Annotated[str, PropertyInfo(alias="docId")]
26-
"""Optional document ID to search within"""
30+
"""Optional document ID to search within.
31+
32+
You can use this to find chunks in a very large document.
33+
"""
2734

2835
document_threshold: Annotated[float, PropertyInfo(alias="documentThreshold")]
29-
"""Maximum number of documents to return"""
36+
"""Threshold / sensitivity for document selection.
37+
38+
0 is least sensitive (returns most documents, more results), 1 is most sensitive
39+
(returns lesser documents, accurate results)
40+
"""
3041

3142
filters: Filters
3243
"""Optional filters to apply to the search"""
3344

3445
include_summary: Annotated[bool, PropertyInfo(alias="includeSummary")]
3546
"""If true, include document summary in the response.
3647
37-
This is helpful if you want a chatbot to know the context of the document.
48+
This is helpful if you want a chatbot to know the full context of the document.
3849
"""
3950

4051
limit: int
4152
"""Maximum number of results to return"""
4253

4354
only_matching_chunks: Annotated[bool, PropertyInfo(alias="onlyMatchingChunks")]
44-
"""If true, only return matching chunks without context"""
55+
"""If true, only return matching chunks without context.
56+
57+
Normally, we send the previous and next chunk to provide more context for LLMs.
58+
If you only want the matching chunk, set this to true.
59+
"""
4560

4661
rewrite_query: Annotated[bool, PropertyInfo(alias="rewriteQuery")]
4762
"""If true, rewrites the query to make it easier to find documents.
@@ -50,7 +65,10 @@ class SearchExecuteParams(TypedDict, total=False):
5065
"""
5166

5267
user_id: Annotated[str, PropertyInfo(alias="userId")]
53-
"""End user ID this search is associated with"""
68+
"""End user ID this search is associated with.
69+
70+
NOTE: This also acts as a filter for the search.
71+
"""
5472

5573

5674
class FiltersUnionMember0(TypedDict, total=False):

0 commit comments

Comments
 (0)