Skip to content

Commit 5b0c810

Browse files
feat(api): manual updates
1 parent af34c01 commit 5b0c810

File tree

11 files changed

+676
-88
lines changed

11 files changed

+676
-88
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: 9
1+
configured_endpoints: 10
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-a280bf0a406a709c156d5e3fe7c8ae93ebe607d937af8d725d0a2997cab07a7d.yml
33
openapi_spec_hash: 15c602571db9cbcce4703c929b994d82
4-
config_hash: b9c958a39a94966479e516e9061818be
4+
config_hash: 1c771b2d30afc18bf405a425ea1c327a

README.md

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ client = Supermemory(
3131
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
3232
)
3333

34-
memory = client.memories.update(
35-
path_id="id",
36-
body_id="acxV5LHMEsG2hMSNb4umbn",
37-
content="This is a detailed article about machine learning concepts...",
34+
response = client.search.execute(
35+
q="documents related to python",
3836
)
39-
print(memory.id)
37+
print(response.results)
4038
```
4139

4240
While you can provide an `api_key` keyword argument,
@@ -59,12 +57,10 @@ client = AsyncSupermemory(
5957

6058

6159
async def main() -> None:
62-
memory = await client.memories.update(
63-
path_id="id",
64-
body_id="acxV5LHMEsG2hMSNb4umbn",
65-
content="This is a detailed article about machine learning concepts...",
60+
response = await client.search.execute(
61+
q="documents related to python",
6662
)
67-
print(memory.id)
63+
print(response.results)
6864

6965

7066
asyncio.run(main())
@@ -97,9 +93,7 @@ from supermemory import Supermemory
9793
client = Supermemory()
9894

9995
try:
100-
client.memories.update(
101-
path_id="id",
102-
body_id="acxV5LHMEsG2hMSNb4umbn",
96+
client.memories.add(
10397
content="This is a detailed article about machine learning concepts...",
10498
)
10599
except supermemory.APIConnectionError as e:
@@ -144,9 +138,7 @@ client = Supermemory(
144138
)
145139

146140
# Or, configure per-request:
147-
client.with_options(max_retries=5).memories.update(
148-
path_id="id",
149-
body_id="acxV5LHMEsG2hMSNb4umbn",
141+
client.with_options(max_retries=5).memories.add(
150142
content="This is a detailed article about machine learning concepts...",
151143
)
152144
```
@@ -171,9 +163,7 @@ client = Supermemory(
171163
)
172164

173165
# Override per-request:
174-
client.with_options(timeout=5.0).memories.update(
175-
path_id="id",
176-
body_id="acxV5LHMEsG2hMSNb4umbn",
166+
client.with_options(timeout=5.0).memories.add(
177167
content="This is a detailed article about machine learning concepts...",
178168
)
179169
```
@@ -216,14 +206,12 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
216206
from supermemory import Supermemory
217207

218208
client = Supermemory()
219-
response = client.memories.with_raw_response.update(
220-
path_id="id",
221-
body_id="acxV5LHMEsG2hMSNb4umbn",
209+
response = client.memories.with_raw_response.add(
222210
content="This is a detailed article about machine learning concepts...",
223211
)
224212
print(response.headers.get('X-My-Header'))
225213

226-
memory = response.parse() # get the object that `memories.update()` would have returned
214+
memory = response.parse() # get the object that `memories.add()` would have returned
227215
print(memory.id)
228216
```
229217

@@ -238,9 +226,7 @@ The above interface eagerly reads the full response body when you make the reque
238226
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
239227

240228
```python
241-
with client.memories.with_streaming_response.update(
242-
path_id="id",
243-
body_id="acxV5LHMEsG2hMSNb4umbn",
229+
with client.memories.with_streaming_response.add(
244230
content="This is a detailed article about machine learning concepts...",
245231
) as response:
246232
print(response.headers.get("X-My-Header"))

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ Methods:
2020
- <code title="post /v3/memories">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>
2121
- <code title="get /v3/memories/{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>
2222

23+
# Search
24+
25+
Types:
26+
27+
```python
28+
from supermemory.types import SearchExecuteResponse
29+
```
30+
31+
Methods:
32+
33+
- <code title="get /v3/search">client.search.<a href="./src/supermemory/resources/search.py">execute</a>(\*\*<a href="src/supermemory/types/search_execute_params.py">params</a>) -> <a href="./src/supermemory/types/search_execute_response.py">SearchExecuteResponse</a></code>
34+
2335
# Settings
2436

2537
Types:

src/supermemory/_client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
)
2222
from ._utils import is_given, get_async_library
2323
from ._version import __version__
24-
from .resources import memories, settings, connections
24+
from .resources import search, memories, settings, connections
2525
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
2626
from ._exceptions import APIStatusError, SupermemoryError
2727
from ._base_client import (
@@ -44,6 +44,7 @@
4444

4545
class Supermemory(SyncAPIClient):
4646
memories: memories.MemoriesResource
47+
search: search.SearchResource
4748
settings: settings.SettingsResource
4849
connections: connections.ConnectionsResource
4950
with_raw_response: SupermemoryWithRawResponse
@@ -104,6 +105,7 @@ def __init__(
104105
)
105106

106107
self.memories = memories.MemoriesResource(self)
108+
self.search = search.SearchResource(self)
107109
self.settings = settings.SettingsResource(self)
108110
self.connections = connections.ConnectionsResource(self)
109111
self.with_raw_response = SupermemoryWithRawResponse(self)
@@ -216,6 +218,7 @@ def _make_status_error(
216218

217219
class AsyncSupermemory(AsyncAPIClient):
218220
memories: memories.AsyncMemoriesResource
221+
search: search.AsyncSearchResource
219222
settings: settings.AsyncSettingsResource
220223
connections: connections.AsyncConnectionsResource
221224
with_raw_response: AsyncSupermemoryWithRawResponse
@@ -276,6 +279,7 @@ def __init__(
276279
)
277280

278281
self.memories = memories.AsyncMemoriesResource(self)
282+
self.search = search.AsyncSearchResource(self)
279283
self.settings = settings.AsyncSettingsResource(self)
280284
self.connections = connections.AsyncConnectionsResource(self)
281285
self.with_raw_response = AsyncSupermemoryWithRawResponse(self)
@@ -389,27 +393,31 @@ def _make_status_error(
389393
class SupermemoryWithRawResponse:
390394
def __init__(self, client: Supermemory) -> None:
391395
self.memories = memories.MemoriesResourceWithRawResponse(client.memories)
396+
self.search = search.SearchResourceWithRawResponse(client.search)
392397
self.settings = settings.SettingsResourceWithRawResponse(client.settings)
393398
self.connections = connections.ConnectionsResourceWithRawResponse(client.connections)
394399

395400

396401
class AsyncSupermemoryWithRawResponse:
397402
def __init__(self, client: AsyncSupermemory) -> None:
398403
self.memories = memories.AsyncMemoriesResourceWithRawResponse(client.memories)
404+
self.search = search.AsyncSearchResourceWithRawResponse(client.search)
399405
self.settings = settings.AsyncSettingsResourceWithRawResponse(client.settings)
400406
self.connections = connections.AsyncConnectionsResourceWithRawResponse(client.connections)
401407

402408

403409
class SupermemoryWithStreamedResponse:
404410
def __init__(self, client: Supermemory) -> None:
405411
self.memories = memories.MemoriesResourceWithStreamingResponse(client.memories)
412+
self.search = search.SearchResourceWithStreamingResponse(client.search)
406413
self.settings = settings.SettingsResourceWithStreamingResponse(client.settings)
407414
self.connections = connections.ConnectionsResourceWithStreamingResponse(client.connections)
408415

409416

410417
class AsyncSupermemoryWithStreamedResponse:
411418
def __init__(self, client: AsyncSupermemory) -> None:
412419
self.memories = memories.AsyncMemoriesResourceWithStreamingResponse(client.memories)
420+
self.search = search.AsyncSearchResourceWithStreamingResponse(client.search)
413421
self.settings = settings.AsyncSettingsResourceWithStreamingResponse(client.settings)
414422
self.connections = connections.AsyncConnectionsResourceWithStreamingResponse(client.connections)
415423

src/supermemory/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from .search import (
4+
SearchResource,
5+
AsyncSearchResource,
6+
SearchResourceWithRawResponse,
7+
AsyncSearchResourceWithRawResponse,
8+
SearchResourceWithStreamingResponse,
9+
AsyncSearchResourceWithStreamingResponse,
10+
)
311
from .memories import (
412
MemoriesResource,
513
AsyncMemoriesResource,
@@ -32,6 +40,12 @@
3240
"AsyncMemoriesResourceWithRawResponse",
3341
"MemoriesResourceWithStreamingResponse",
3442
"AsyncMemoriesResourceWithStreamingResponse",
43+
"SearchResource",
44+
"AsyncSearchResource",
45+
"SearchResourceWithRawResponse",
46+
"AsyncSearchResourceWithRawResponse",
47+
"SearchResourceWithStreamingResponse",
48+
"AsyncSearchResourceWithStreamingResponse",
3549
"SettingsResource",
3650
"AsyncSettingsResource",
3751
"SettingsResourceWithRawResponse",

0 commit comments

Comments
 (0)