Skip to content

Commit 1788d47

Browse files
feat(api): api update
1 parent 5bc5a86 commit 1788d47

File tree

6 files changed

+59
-104
lines changed

6 files changed

+59
-104
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: 12
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-302f75c936837c3e1163b7455cbec192cbf57f5769541258debfc1573c8597e2.yml
3-
openapi_spec_hash: a36f25703f8a1ead0c95b7a7219096d5
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-51f7b8cdabb689a8e8fa328e5c3b82906a2db418d486ef019bd0b2656e3a38aa.yml
3+
openapi_spec_hash: cddc9d0c5e419657929408a3de9228db
44
config_hash: 8477e3ee6fd596ab6ac911d052e4de79

src/supermemory/resources/search.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
from __future__ import annotations
44

5-
from typing import List
6-
from typing_extensions import Literal
7-
85
import httpx
96

107
from ..types import search_execute_params
@@ -48,11 +45,9 @@ def execute(
4845
self,
4946
*,
5047
q: str,
51-
categories_filter: List[Literal["technology", "science", "business", "health"]] | NotGiven = NOT_GIVEN,
5248
chunk_threshold: float | NotGiven = NOT_GIVEN,
5349
doc_id: str | NotGiven = NOT_GIVEN,
5450
document_threshold: float | NotGiven = NOT_GIVEN,
55-
filters: search_execute_params.Filters | NotGiven = NOT_GIVEN,
5651
include_summary: bool | NotGiven = NOT_GIVEN,
5752
limit: int | NotGiven = NOT_GIVEN,
5853
only_matching_chunks: bool | NotGiven = NOT_GIVEN,
@@ -67,13 +62,11 @@ def execute(
6762
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
6863
) -> SearchExecuteResponse:
6964
"""
70-
Search memories with filtering
65+
Search memories with basic filtering (simple query parameters only)
7166
7267
Args:
7368
q: Search query string
7469
75-
categories_filter: Optional category filters
76-
7770
chunk_threshold: Threshold / sensitivity for chunk selection. 0 is least sensitive (returns most
7871
chunks, more results), 1 is most sensitive (returns lesser chunks, accurate
7972
results)
@@ -85,8 +78,6 @@ def execute(
8578
most documents, more results), 1 is most sensitive (returns lesser documents,
8679
accurate results)
8780
88-
filters: Optional filters to apply to the search
89-
9081
include_summary: If true, include document summary in the response. This is helpful if you want a
9182
chatbot to know the full context of the document.
9283
@@ -123,11 +114,9 @@ def execute(
123114
query=maybe_transform(
124115
{
125116
"q": q,
126-
"categories_filter": categories_filter,
127117
"chunk_threshold": chunk_threshold,
128118
"doc_id": doc_id,
129119
"document_threshold": document_threshold,
130-
"filters": filters,
131120
"include_summary": include_summary,
132121
"limit": limit,
133122
"only_matching_chunks": only_matching_chunks,
@@ -166,11 +155,9 @@ async def execute(
166155
self,
167156
*,
168157
q: str,
169-
categories_filter: List[Literal["technology", "science", "business", "health"]] | NotGiven = NOT_GIVEN,
170158
chunk_threshold: float | NotGiven = NOT_GIVEN,
171159
doc_id: str | NotGiven = NOT_GIVEN,
172160
document_threshold: float | NotGiven = NOT_GIVEN,
173-
filters: search_execute_params.Filters | NotGiven = NOT_GIVEN,
174161
include_summary: bool | NotGiven = NOT_GIVEN,
175162
limit: int | NotGiven = NOT_GIVEN,
176163
only_matching_chunks: bool | NotGiven = NOT_GIVEN,
@@ -185,13 +172,11 @@ async def execute(
185172
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
186173
) -> SearchExecuteResponse:
187174
"""
188-
Search memories with filtering
175+
Search memories with basic filtering (simple query parameters only)
189176
190177
Args:
191178
q: Search query string
192179
193-
categories_filter: Optional category filters
194-
195180
chunk_threshold: Threshold / sensitivity for chunk selection. 0 is least sensitive (returns most
196181
chunks, more results), 1 is most sensitive (returns lesser chunks, accurate
197182
results)
@@ -203,8 +188,6 @@ async def execute(
203188
most documents, more results), 1 is most sensitive (returns lesser documents,
204189
accurate results)
205190
206-
filters: Optional filters to apply to the search
207-
208191
include_summary: If true, include document summary in the response. This is helpful if you want a
209192
chatbot to know the full context of the document.
210193
@@ -241,11 +224,9 @@ async def execute(
241224
query=await async_maybe_transform(
242225
{
243226
"q": q,
244-
"categories_filter": categories_filter,
245227
"chunk_threshold": chunk_threshold,
246228
"doc_id": doc_id,
247229
"document_threshold": document_threshold,
248-
"filters": filters,
249230
"include_summary": include_summary,
250231
"limit": limit,
251232
"only_matching_chunks": only_matching_chunks,
Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,62 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from typing import Dict, List, Union, Optional
4+
from datetime import datetime
5+
from typing_extensions import Literal
6+
7+
from pydantic import Field as FieldInfo
8+
39
from .._models import BaseModel
410

5-
__all__ = ["MemoryGetResponse"]
11+
__all__ = ["MemoryGetResponse", "Doc"]
612

713

8-
class MemoryGetResponse(BaseModel):
14+
class Doc(BaseModel):
915
id: str
16+
"""Unique identifier of the memory."""
17+
18+
content: Optional[str] = None
19+
"""The content to extract and process into a memory.
20+
21+
This can be a URL to a website, a PDF, an image, or a video.
22+
23+
Plaintext: Any plaintext format
24+
25+
URL: A URL to a website, PDF, image, or video
26+
27+
We automatically detect the content type from the url's response format.
28+
"""
29+
30+
created_at: datetime = FieldInfo(alias="createdAt")
31+
"""Creation timestamp"""
32+
33+
metadata: Union[str, float, bool, Dict[str, object], List[object], None] = None
34+
"""Optional metadata for the memory.
35+
36+
This is used to store additional information about the memory. You can use this
37+
to store any additional information you need about the memory. Metadata can be
38+
filtered through. Keys must be strings and are case sensitive. Values can be
39+
strings, numbers, or booleans. You cannot nest objects.
40+
"""
41+
42+
status: Literal["unknown", "queued", "extracting", "chunking", "embedding", "indexing", "done", "failed"]
43+
"""Status of the memory"""
44+
45+
summary: Optional[str] = None
46+
"""Summary of the memory content"""
47+
48+
title: Optional[str] = None
49+
"""Title of the memory"""
50+
51+
updated_at: datetime = FieldInfo(alias="updatedAt")
52+
"""Last update timestamp"""
53+
54+
url: Optional[str] = None
55+
"""URL of the memory"""
56+
57+
58+
class MemoryGetResponse(BaseModel):
59+
doc: Doc
60+
"""Memory object"""
1061

1162
status: str

src/supermemory/types/memory_list_response.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ class Memory(BaseModel):
3030
created_at: datetime = FieldInfo(alias="createdAt")
3131
"""Creation timestamp"""
3232

33-
custom_id: Optional[str] = FieldInfo(alias="customId", default=None)
34-
"""Optional custom ID of the memory.
35-
36-
This could be an ID from your database that will uniquely identify this memory.
37-
"""
38-
3933
metadata: Union[str, float, bool, Dict[str, object], List[object], None] = None
4034
"""Optional metadata for the memory.
4135
@@ -45,10 +39,6 @@ class Memory(BaseModel):
4539
strings, numbers, or booleans. You cannot nest objects.
4640
"""
4741

48-
og_image: Optional[str] = FieldInfo(alias="ogImage", default=None)
49-
50-
source: Optional[str] = None
51-
5242
status: Literal["unknown", "queued", "extracting", "chunking", "embedding", "indexing", "done", "failed"]
5343
"""Status of the memory"""
5444

@@ -58,25 +48,12 @@ class Memory(BaseModel):
5848
title: Optional[str] = None
5949
"""Title of the memory"""
6050

61-
type: Literal["text", "pdf", "tweet", "google_doc", "image", "video", "notion_doc", "webpage"]
62-
"""Type of the memory"""
63-
6451
updated_at: datetime = FieldInfo(alias="updatedAt")
6552
"""Last update timestamp"""
6653

6754
url: Optional[str] = None
6855
"""URL of the memory"""
6956

70-
container_tags: Optional[List[str]] = FieldInfo(alias="containerTags", default=None)
71-
"""Optional tags this memory should be containerized by.
72-
73-
This can be an ID for your user, a project ID, or any other identifier you wish
74-
to use to group memories.
75-
"""
76-
77-
raw: None = None
78-
"""Raw content of the memory"""
79-
8057

8158
class Pagination(BaseModel):
8259
current_page: float = FieldInfo(alias="currentPage")

src/supermemory/types/search_execute_params.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,17 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, List, Union, Iterable
6-
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
5+
from typing_extensions import Required, Annotated, TypedDict
76

87
from .._utils import PropertyInfo
98

10-
__all__ = ["SearchExecuteParams", "Filters", "FiltersUnionMember0"]
9+
__all__ = ["SearchExecuteParams"]
1110

1211

1312
class SearchExecuteParams(TypedDict, total=False):
1413
q: Required[str]
1514
"""Search query string"""
1615

17-
categories_filter: Annotated[
18-
List[Literal["technology", "science", "business", "health"]], PropertyInfo(alias="categoriesFilter")
19-
]
20-
"""Optional category filters"""
21-
2216
chunk_threshold: Annotated[float, PropertyInfo(alias="chunkThreshold")]
2317
"""Threshold / sensitivity for chunk selection.
2418
@@ -39,9 +33,6 @@ class SearchExecuteParams(TypedDict, total=False):
3933
(returns lesser documents, accurate results)
4034
"""
4135

42-
filters: Filters
43-
"""Optional filters to apply to the search"""
44-
4536
include_summary: Annotated[bool, PropertyInfo(alias="includeSummary")]
4637
"""If true, include document summary in the response.
4738
@@ -75,12 +66,3 @@ class SearchExecuteParams(TypedDict, total=False):
7566
7667
NOTE: This also acts as a filter for the search.
7768
"""
78-
79-
80-
class FiltersUnionMember0(TypedDict, total=False):
81-
and_: Annotated[Iterable[object], PropertyInfo(alias="AND")]
82-
83-
or_: Annotated[Iterable[object], PropertyInfo(alias="OR")]
84-
85-
86-
Filters: TypeAlias = Union[FiltersUnionMember0, Dict[str, object]]

tests/api_resources/test_search.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,9 @@ def test_method_execute(self, client: Supermemory) -> None:
3030
def test_method_execute_with_all_params(self, client: Supermemory) -> None:
3131
search = client.search.execute(
3232
q="machine learning concepts",
33-
categories_filter=["technology", "science"],
3433
chunk_threshold=0.5,
3534
doc_id="doc_xyz789",
3635
document_threshold=0.5,
37-
filters={
38-
"and_": [
39-
{
40-
"key": "group",
41-
"value": "jira_users",
42-
"negate": False,
43-
},
44-
{
45-
"filterType": "numeric",
46-
"key": "timestamp",
47-
"value": "1742745777",
48-
"negate": False,
49-
"numericOperator": ">",
50-
},
51-
],
52-
"or_": [{}],
53-
},
5436
include_summary=False,
5537
limit=10,
5638
only_matching_chunks=False,
@@ -103,27 +85,9 @@ async def test_method_execute(self, async_client: AsyncSupermemory) -> None:
10385
async def test_method_execute_with_all_params(self, async_client: AsyncSupermemory) -> None:
10486
search = await async_client.search.execute(
10587
q="machine learning concepts",
106-
categories_filter=["technology", "science"],
10788
chunk_threshold=0.5,
10889
doc_id="doc_xyz789",
10990
document_threshold=0.5,
110-
filters={
111-
"and_": [
112-
{
113-
"key": "group",
114-
"value": "jira_users",
115-
"negate": False,
116-
},
117-
{
118-
"filterType": "numeric",
119-
"key": "timestamp",
120-
"value": "1742745777",
121-
"negate": False,
122-
"numericOperator": ">",
123-
},
124-
],
125-
"or_": [{}],
126-
},
12791
include_summary=False,
12892
limit=10,
12993
only_matching_chunks=False,

0 commit comments

Comments
 (0)