Skip to content

Commit 96b34d0

Browse files
feat(api): manual updates
1 parent bdb32bc commit 96b34d0

26 files changed

+1800
-54
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 19
1+
configured_endpoints: 24
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-3856961a8959b60dbf0b6912d69c23390fbbca1c5e31028dd0decc85234dd285.yml
33
openapi_spec_hash: 988a7d6d7cef81ceb4acda3ef9f8c21e
4-
config_hash: ec08a36e60458b4d83e71798a8043484
4+
config_hash: 7dd9730225e87663fd62814dcfe62ba7

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ from supermemory import Supermemory
121121

122122
client = Supermemory()
123123

124-
response = client.search.memories(
124+
response = client.search(
125125
q="machine learning concepts",
126126
include={},
127127
)

api.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
Types:
44

55
```python
6-
from supermemory.types import AddResponse, ProfileResponse
6+
from supermemory.types import AddResponse, ProfileResponse, SearchResponse
77
```
88

99
Methods:
1010

1111
- <code title="post /v3/documents">client.<a href="./src/supermemory/_client.py">add</a>(\*\*<a href="src/supermemory/types/client_add_params.py">params</a>) -> <a href="./src/supermemory/types/add_response.py">AddResponse</a></code>
1212
- <code title="post /v4/profile">client.<a href="./src/supermemory/_client.py">profile</a>(\*\*<a href="src/supermemory/types/client_profile_params.py">params</a>) -> <a href="./src/supermemory/types/profile_response.py">ProfileResponse</a></code>
13+
- <code title="post /v4/search">client.<a href="./src/supermemory/_client.py">search</a>(\*\*<a href="src/supermemory/types/client_search_params.py">params</a>) -> <a href="./src/supermemory/types/search_response.py">SearchResponse</a></code>
1314

1415
# Memories
1516

@@ -20,7 +21,9 @@ from supermemory.types import (
2021
MemoryUpdateResponse,
2122
MemoryListResponse,
2223
MemoryAddResponse,
24+
MemoryForgetResponse,
2325
MemoryGetResponse,
26+
MemoryUpdateMemoryResponse,
2427
MemoryUploadFileResponse,
2528
)
2629
```
@@ -31,7 +34,9 @@ Methods:
3134
- <code title="post /v3/documents/list">client.memories.<a href="./src/supermemory/resources/memories.py">list</a>(\*\*<a href="src/supermemory/types/memory_list_params.py">params</a>) -> <a href="./src/supermemory/types/memory_list_response.py">MemoryListResponse</a></code>
3235
- <code title="delete /v3/documents/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">delete</a>(id) -> None</code>
3336
- <code title="post /v3/documents">client.memories.<a href="./src/supermemory/resources/memories.py">add</a>(\*\*<a href="src/supermemory/types/memory_add_params.py">params</a>) -> <a href="./src/supermemory/types/memory_add_response.py">MemoryAddResponse</a></code>
37+
- <code title="delete /v4/memories">client.memories.<a href="./src/supermemory/resources/memories.py">forget</a>(\*\*<a href="src/supermemory/types/memory_forget_params.py">params</a>) -> <a href="./src/supermemory/types/memory_forget_response.py">MemoryForgetResponse</a></code>
3438
- <code title="get /v3/documents/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">get</a>(id) -> <a href="./src/supermemory/types/memory_get_response.py">MemoryGetResponse</a></code>
39+
- <code title="patch /v4/memories">client.memories.<a href="./src/supermemory/resources/memories.py">update_memory</a>(\*\*<a href="src/supermemory/types/memory_update_memory_params.py">params</a>) -> <a href="./src/supermemory/types/memory_update_memory_response.py">MemoryUpdateMemoryResponse</a></code>
3540
- <code title="post /v3/documents/file">client.memories.<a href="./src/supermemory/resources/memories.py">upload_file</a>(\*\*<a href="src/supermemory/types/memory_upload_file_params.py">params</a>) -> <a href="./src/supermemory/types/memory_upload_file_response.py">MemoryUploadFileResponse</a></code>
3641

3742
# Documents
@@ -43,6 +48,7 @@ from supermemory.types import (
4348
DocumentUpdateResponse,
4449
DocumentListResponse,
4550
DocumentAddResponse,
51+
DocumentDeleteBulkResponse,
4652
DocumentGetResponse,
4753
DocumentUploadFileResponse,
4854
)
@@ -54,6 +60,7 @@ Methods:
5460
- <code title="post /v3/documents/list">client.documents.<a href="./src/supermemory/resources/documents.py">list</a>(\*\*<a href="src/supermemory/types/document_list_params.py">params</a>) -> <a href="./src/supermemory/types/document_list_response.py">DocumentListResponse</a></code>
5561
- <code title="delete /v3/documents/{id}">client.documents.<a href="./src/supermemory/resources/documents.py">delete</a>(id) -> None</code>
5662
- <code title="post /v3/documents">client.documents.<a href="./src/supermemory/resources/documents.py">add</a>(\*\*<a href="src/supermemory/types/document_add_params.py">params</a>) -> <a href="./src/supermemory/types/document_add_response.py">DocumentAddResponse</a></code>
63+
- <code title="delete /v3/documents/bulk">client.documents.<a href="./src/supermemory/resources/documents.py">delete_bulk</a>(\*\*<a href="src/supermemory/types/document_delete_bulk_params.py">params</a>) -> <a href="./src/supermemory/types/document_delete_bulk_response.py">DocumentDeleteBulkResponse</a></code>
5764
- <code title="get /v3/documents/{id}">client.documents.<a href="./src/supermemory/resources/documents.py">get</a>(id) -> <a href="./src/supermemory/types/document_get_response.py">DocumentGetResponse</a></code>
5865
- <code title="post /v3/documents/file">client.documents.<a href="./src/supermemory/resources/documents.py">upload_file</a>(\*\*<a href="src/supermemory/types/document_upload_file_params.py">params</a>) -> <a href="./src/supermemory/types/document_upload_file_response.py">DocumentUploadFileResponse</a></code>
5966

@@ -92,22 +99,26 @@ Types:
9299
from supermemory.types import (
93100
ConnectionCreateResponse,
94101
ConnectionListResponse,
102+
ConnectionConfigureResponse,
95103
ConnectionDeleteByIDResponse,
96104
ConnectionDeleteByProviderResponse,
97105
ConnectionGetByIDResponse,
98-
ConnectionGetByTagsResponse,
106+
ConnectionGetByTagResponse,
99107
ConnectionImportResponse,
100108
ConnectionListDocumentsResponse,
109+
ConnectionResourcesResponse,
101110
)
102111
```
103112

104113
Methods:
105114

106115
- <code title="post /v3/connections/{provider}">client.connections.<a href="./src/supermemory/resources/connections.py">create</a>(provider, \*\*<a href="src/supermemory/types/connection_create_params.py">params</a>) -> <a href="./src/supermemory/types/connection_create_response.py">ConnectionCreateResponse</a></code>
107116
- <code title="post /v3/connections/list">client.connections.<a href="./src/supermemory/resources/connections.py">list</a>(\*\*<a href="src/supermemory/types/connection_list_params.py">params</a>) -> <a href="./src/supermemory/types/connection_list_response.py">ConnectionListResponse</a></code>
117+
- <code title="post /v3/connections/{connectionId}/configure">client.connections.<a href="./src/supermemory/resources/connections.py">configure</a>(connection_id, \*\*<a href="src/supermemory/types/connection_configure_params.py">params</a>) -> <a href="./src/supermemory/types/connection_configure_response.py">ConnectionConfigureResponse</a></code>
108118
- <code title="delete /v3/connections/{connectionId}">client.connections.<a href="./src/supermemory/resources/connections.py">delete_by_id</a>(connection_id) -> <a href="./src/supermemory/types/connection_delete_by_id_response.py">ConnectionDeleteByIDResponse</a></code>
109119
- <code title="delete /v3/connections/{provider}">client.connections.<a href="./src/supermemory/resources/connections.py">delete_by_provider</a>(provider, \*\*<a href="src/supermemory/types/connection_delete_by_provider_params.py">params</a>) -> <a href="./src/supermemory/types/connection_delete_by_provider_response.py">ConnectionDeleteByProviderResponse</a></code>
110120
- <code title="get /v3/connections/{connectionId}">client.connections.<a href="./src/supermemory/resources/connections.py">get_by_id</a>(connection_id) -> <a href="./src/supermemory/types/connection_get_by_id_response.py">ConnectionGetByIDResponse</a></code>
111-
- <code title="post /v3/connections/{provider}/connection">client.connections.<a href="./src/supermemory/resources/connections.py">get_by_tags</a>(provider, \*\*<a href="src/supermemory/types/connection_get_by_tags_params.py">params</a>) -> <a href="./src/supermemory/types/connection_get_by_tags_response.py">ConnectionGetByTagsResponse</a></code>
121+
- <code title="post /v3/connections/{provider}/connection">client.connections.<a href="./src/supermemory/resources/connections.py">get_by_tag</a>(provider, \*\*<a href="src/supermemory/types/connection_get_by_tag_params.py">params</a>) -> <a href="./src/supermemory/types/connection_get_by_tag_response.py">ConnectionGetByTagResponse</a></code>
112122
- <code title="post /v3/connections/{provider}/import">client.connections.<a href="./src/supermemory/resources/connections.py">import\_</a>(provider, \*\*<a href="src/supermemory/types/connection_import_params.py">params</a>) -> str</code>
113123
- <code title="post /v3/connections/{provider}/documents">client.connections.<a href="./src/supermemory/resources/connections.py">list_documents</a>(provider, \*\*<a href="src/supermemory/types/connection_list_documents_params.py">params</a>) -> <a href="./src/supermemory/types/connection_list_documents_response.py">ConnectionListDocumentsResponse</a></code>
124+
- <code title="get /v3/connections/{connectionId}/resources">client.connections.<a href="./src/supermemory/resources/connections.py">resources</a>(connection_id, \*\*<a href="src/supermemory/types/connection_resources_params.py">params</a>) -> <a href="./src/supermemory/types/connection_resources_response.py">ConnectionResourcesResponse</a></code>

src/supermemory/_client.py

Lines changed: 154 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from . import _exceptions
1212
from ._qs import Querystring
13-
from .types import client_add_params, client_profile_params
13+
from .types import client_add_params, client_search_params, client_profile_params
1414
from ._types import (
1515
Body,
1616
Omit,
@@ -48,6 +48,7 @@
4848
make_request_options,
4949
)
5050
from .types.add_response import AddResponse
51+
from .types.search_response import SearchResponse
5152
from .types.profile_response import ProfileResponse
5253

5354
__all__ = [
@@ -304,6 +305,76 @@ def profile(
304305
cast_to=ProfileResponse,
305306
)
306307

308+
def search(
309+
self,
310+
*,
311+
q: str,
312+
container_tag: str | Omit = omit,
313+
filters: client_search_params.Filters | Omit = omit,
314+
include: client_search_params.Include | Omit = omit,
315+
limit: int | Omit = omit,
316+
rerank: bool | Omit = omit,
317+
rewrite_query: bool | Omit = omit,
318+
threshold: float | Omit = omit,
319+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
320+
# The extra values given here take precedence over values defined on the client or passed to this method.
321+
extra_headers: Headers | None = None,
322+
extra_query: Query | None = None,
323+
extra_body: Body | None = None,
324+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
325+
) -> SearchResponse:
326+
"""
327+
Search memory entries - Low latency for conversational
328+
329+
Args:
330+
q: Search query string
331+
332+
container_tag: Optional tag this search should be containerized by. This can be an ID for your
333+
user, a project ID, or any other identifier you wish to use to filter memories.
334+
335+
filters: Optional filters to apply to the search. Can be a JSON string or Query object.
336+
337+
limit: Maximum number of results to return
338+
339+
rerank: If true, rerank the results based on the query. This is helpful if you want to
340+
ensure the most relevant results are returned.
341+
342+
rewrite_query: If true, rewrites the query to make it easier to find documents. This increases
343+
the latency by about 400ms
344+
345+
threshold: Threshold / sensitivity for memories selection. 0 is least sensitive (returns
346+
most memories, more results), 1 is most sensitive (returns lesser memories,
347+
accurate results)
348+
349+
extra_headers: Send extra headers
350+
351+
extra_query: Add additional query parameters to the request
352+
353+
extra_body: Add additional JSON properties to the request
354+
355+
timeout: Override the client-level default timeout for this request, in seconds
356+
"""
357+
return self.post(
358+
"/v4/search",
359+
body=maybe_transform(
360+
{
361+
"q": q,
362+
"container_tag": container_tag,
363+
"filters": filters,
364+
"include": include,
365+
"limit": limit,
366+
"rerank": rerank,
367+
"rewrite_query": rewrite_query,
368+
"threshold": threshold,
369+
},
370+
client_search_params.ClientSearchParams,
371+
),
372+
options=make_request_options(
373+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
374+
),
375+
cast_to=SearchResponse,
376+
)
377+
307378
@override
308379
def _make_status_error(
309380
self,
@@ -580,6 +651,76 @@ async def profile(
580651
cast_to=ProfileResponse,
581652
)
582653

654+
async def search(
655+
self,
656+
*,
657+
q: str,
658+
container_tag: str | Omit = omit,
659+
filters: client_search_params.Filters | Omit = omit,
660+
include: client_search_params.Include | Omit = omit,
661+
limit: int | Omit = omit,
662+
rerank: bool | Omit = omit,
663+
rewrite_query: bool | Omit = omit,
664+
threshold: float | Omit = omit,
665+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
666+
# The extra values given here take precedence over values defined on the client or passed to this method.
667+
extra_headers: Headers | None = None,
668+
extra_query: Query | None = None,
669+
extra_body: Body | None = None,
670+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
671+
) -> SearchResponse:
672+
"""
673+
Search memory entries - Low latency for conversational
674+
675+
Args:
676+
q: Search query string
677+
678+
container_tag: Optional tag this search should be containerized by. This can be an ID for your
679+
user, a project ID, or any other identifier you wish to use to filter memories.
680+
681+
filters: Optional filters to apply to the search. Can be a JSON string or Query object.
682+
683+
limit: Maximum number of results to return
684+
685+
rerank: If true, rerank the results based on the query. This is helpful if you want to
686+
ensure the most relevant results are returned.
687+
688+
rewrite_query: If true, rewrites the query to make it easier to find documents. This increases
689+
the latency by about 400ms
690+
691+
threshold: Threshold / sensitivity for memories selection. 0 is least sensitive (returns
692+
most memories, more results), 1 is most sensitive (returns lesser memories,
693+
accurate results)
694+
695+
extra_headers: Send extra headers
696+
697+
extra_query: Add additional query parameters to the request
698+
699+
extra_body: Add additional JSON properties to the request
700+
701+
timeout: Override the client-level default timeout for this request, in seconds
702+
"""
703+
return await self.post(
704+
"/v4/search",
705+
body=await async_maybe_transform(
706+
{
707+
"q": q,
708+
"container_tag": container_tag,
709+
"filters": filters,
710+
"include": include,
711+
"limit": limit,
712+
"rerank": rerank,
713+
"rewrite_query": rewrite_query,
714+
"threshold": threshold,
715+
},
716+
client_search_params.ClientSearchParams,
717+
),
718+
options=make_request_options(
719+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
720+
),
721+
cast_to=SearchResponse,
722+
)
723+
583724
@override
584725
def _make_status_error(
585726
self,
@@ -628,6 +769,9 @@ def __init__(self, client: Supermemory) -> None:
628769
self.profile = to_raw_response_wrapper(
629770
client.profile,
630771
)
772+
self.search = to_raw_response_wrapper(
773+
client.search,
774+
)
631775

632776

633777
class AsyncSupermemoryWithRawResponse:
@@ -644,6 +788,9 @@ def __init__(self, client: AsyncSupermemory) -> None:
644788
self.profile = async_to_raw_response_wrapper(
645789
client.profile,
646790
)
791+
self.search = async_to_raw_response_wrapper(
792+
client.search,
793+
)
647794

648795

649796
class SupermemoryWithStreamedResponse:
@@ -660,6 +807,9 @@ def __init__(self, client: Supermemory) -> None:
660807
self.profile = to_streamed_response_wrapper(
661808
client.profile,
662809
)
810+
self.search = to_streamed_response_wrapper(
811+
client.search,
812+
)
663813

664814

665815
class AsyncSupermemoryWithStreamedResponse:
@@ -676,6 +826,9 @@ def __init__(self, client: AsyncSupermemory) -> None:
676826
self.profile = async_to_streamed_response_wrapper(
677827
client.profile,
678828
)
829+
self.search = async_to_streamed_response_wrapper(
830+
client.search,
831+
)
679832

680833

681834
Client = Supermemory

0 commit comments

Comments
 (0)