Skip to content

Commit ed787b1

Browse files
feat(api): api update
1 parent 7c0db70 commit ed787b1

5 files changed

Lines changed: 29 additions & 31 deletions

File tree

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

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ client = Supermemory(
8989

9090
try:
9191
client.memory.create(
92-
content="This is a detailed article about machine learning concepts...",
92+
content="This is a detailed article about machine learning concepts..",
9393
)
9494
except supermemory.APIConnectionError as e:
9595
print("The server could not be reached")
@@ -135,7 +135,7 @@ client = Supermemory(
135135

136136
# Or, configure per-request:
137137
client.with_options(max_retries=5).memory.create(
138-
content="This is a detailed article about machine learning concepts...",
138+
content="This is a detailed article about machine learning concepts..",
139139
)
140140
```
141141

@@ -162,7 +162,7 @@ client = Supermemory(
162162

163163
# Override per-request:
164164
client.with_options(timeout=5.0).memory.create(
165-
content="This is a detailed article about machine learning concepts...",
165+
content="This is a detailed article about machine learning concepts..",
166166
)
167167
```
168168

@@ -207,7 +207,7 @@ client = Supermemory(
207207
api_key="My API Key",
208208
)
209209
response = client.memory.with_raw_response.create(
210-
content="This is a detailed article about machine learning concepts...",
210+
content="This is a detailed article about machine learning concepts..",
211211
)
212212
print(response.headers.get('X-My-Header'))
213213

@@ -227,7 +227,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
227227

228228
```python
229229
with client.memory.with_streaming_response.create(
230-
content="This is a detailed article about machine learning concepts...",
230+
content="This is a detailed article about machine learning concepts..",
231231
) as response:
232232
print(response.headers.get("X-My-Header"))
233233

src/supermemory/resources/memory.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def create(
6262
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
6363
) -> MemoryCreateResponse:
6464
"""
65-
Add a new memory with content and metadata
65+
Add or update a memory with any content type (text, url, file, etc.) with
66+
metadata
6667
6768
Args:
6869
content: Content of the memory
@@ -256,7 +257,8 @@ async def create(
256257
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
257258
) -> MemoryCreateResponse:
258259
"""
259-
Add a new memory with content and metadata
260+
Add or update a memory with any content type (text, url, file, etc.) with
261+
metadata
260262
261263
Args:
262264
content: Content of the memory

tests/api_resources/test_memory.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ class TestMemory:
2626
@parametrize
2727
def test_method_create(self, client: Supermemory) -> None:
2828
memory = client.memory.create(
29-
content="This is a detailed article about machine learning concepts...",
29+
content="This is a detailed article about machine learning concepts..",
3030
)
3131
assert_matches_type(MemoryCreateResponse, memory, path=["response"])
3232

3333
@pytest.mark.skip()
3434
@parametrize
3535
def test_method_create_with_all_params(self, client: Supermemory) -> None:
3636
memory = client.memory.create(
37-
content="This is a detailed article about machine learning concepts...",
37+
content="This is a detailed article about machine learning concepts..",
3838
id="id",
3939
metadata={
4040
"source": "web",
@@ -52,7 +52,7 @@ def test_method_create_with_all_params(self, client: Supermemory) -> None:
5252
@parametrize
5353
def test_raw_response_create(self, client: Supermemory) -> None:
5454
response = client.memory.with_raw_response.create(
55-
content="This is a detailed article about machine learning concepts...",
55+
content="This is a detailed article about machine learning concepts..",
5656
)
5757

5858
assert response.is_closed is True
@@ -64,7 +64,7 @@ def test_raw_response_create(self, client: Supermemory) -> None:
6464
@parametrize
6565
def test_streaming_response_create(self, client: Supermemory) -> None:
6666
with client.memory.with_streaming_response.create(
67-
content="This is a detailed article about machine learning concepts...",
67+
content="This is a detailed article about machine learning concepts..",
6868
) as response:
6969
assert not response.is_closed
7070
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -206,15 +206,15 @@ class TestAsyncMemory:
206206
@parametrize
207207
async def test_method_create(self, async_client: AsyncSupermemory) -> None:
208208
memory = await async_client.memory.create(
209-
content="This is a detailed article about machine learning concepts...",
209+
content="This is a detailed article about machine learning concepts..",
210210
)
211211
assert_matches_type(MemoryCreateResponse, memory, path=["response"])
212212

213213
@pytest.mark.skip()
214214
@parametrize
215215
async def test_method_create_with_all_params(self, async_client: AsyncSupermemory) -> None:
216216
memory = await async_client.memory.create(
217-
content="This is a detailed article about machine learning concepts...",
217+
content="This is a detailed article about machine learning concepts..",
218218
id="id",
219219
metadata={
220220
"source": "web",
@@ -232,7 +232,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncSupermemor
232232
@parametrize
233233
async def test_raw_response_create(self, async_client: AsyncSupermemory) -> None:
234234
response = await async_client.memory.with_raw_response.create(
235-
content="This is a detailed article about machine learning concepts...",
235+
content="This is a detailed article about machine learning concepts..",
236236
)
237237

238238
assert response.is_closed is True
@@ -244,7 +244,7 @@ async def test_raw_response_create(self, async_client: AsyncSupermemory) -> None
244244
@parametrize
245245
async def test_streaming_response_create(self, async_client: AsyncSupermemory) -> None:
246246
async with async_client.memory.with_streaming_response.create(
247-
content="This is a detailed article about machine learning concepts...",
247+
content="This is a detailed article about machine learning concepts..",
248248
) as response:
249249
assert not response.is_closed
250250
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

tests/test_client.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
722722
body=cast(
723723
object,
724724
maybe_transform(
725-
dict(content="This is a detailed article about machine learning concepts..."),
726-
MemoryCreateParams,
725+
dict(content="This is a detailed article about machine learning concepts.."), MemoryCreateParams
727726
),
728727
),
729728
cast_to=httpx.Response,
@@ -743,8 +742,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
743742
body=cast(
744743
object,
745744
maybe_transform(
746-
dict(content="This is a detailed article about machine learning concepts..."),
747-
MemoryCreateParams,
745+
dict(content="This is a detailed article about machine learning concepts.."), MemoryCreateParams
748746
),
749747
),
750748
cast_to=httpx.Response,
@@ -780,7 +778,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
780778
respx_mock.post("/add").mock(side_effect=retry_handler)
781779

782780
response = client.memory.with_raw_response.create(
783-
content="This is a detailed article about machine learning concepts..."
781+
content="This is a detailed article about machine learning concepts.."
784782
)
785783

786784
assert response.retries_taken == failures_before_success
@@ -806,7 +804,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
806804
respx_mock.post("/add").mock(side_effect=retry_handler)
807805

808806
response = client.memory.with_raw_response.create(
809-
content="This is a detailed article about machine learning concepts...",
807+
content="This is a detailed article about machine learning concepts..",
810808
extra_headers={"x-stainless-retry-count": Omit()},
811809
)
812810

@@ -832,7 +830,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
832830
respx_mock.post("/add").mock(side_effect=retry_handler)
833831

834832
response = client.memory.with_raw_response.create(
835-
content="This is a detailed article about machine learning concepts...",
833+
content="This is a detailed article about machine learning concepts..",
836834
extra_headers={"x-stainless-retry-count": "42"},
837835
)
838836

@@ -1508,8 +1506,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
15081506
body=cast(
15091507
object,
15101508
maybe_transform(
1511-
dict(content="This is a detailed article about machine learning concepts..."),
1512-
MemoryCreateParams,
1509+
dict(content="This is a detailed article about machine learning concepts.."), MemoryCreateParams
15131510
),
15141511
),
15151512
cast_to=httpx.Response,
@@ -1529,8 +1526,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
15291526
body=cast(
15301527
object,
15311528
maybe_transform(
1532-
dict(content="This is a detailed article about machine learning concepts..."),
1533-
MemoryCreateParams,
1529+
dict(content="This is a detailed article about machine learning concepts.."), MemoryCreateParams
15341530
),
15351531
),
15361532
cast_to=httpx.Response,
@@ -1567,7 +1563,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
15671563
respx_mock.post("/add").mock(side_effect=retry_handler)
15681564

15691565
response = await client.memory.with_raw_response.create(
1570-
content="This is a detailed article about machine learning concepts..."
1566+
content="This is a detailed article about machine learning concepts.."
15711567
)
15721568

15731569
assert response.retries_taken == failures_before_success
@@ -1594,7 +1590,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
15941590
respx_mock.post("/add").mock(side_effect=retry_handler)
15951591

15961592
response = await client.memory.with_raw_response.create(
1597-
content="This is a detailed article about machine learning concepts...",
1593+
content="This is a detailed article about machine learning concepts..",
15981594
extra_headers={"x-stainless-retry-count": Omit()},
15991595
)
16001596

@@ -1621,7 +1617,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
16211617
respx_mock.post("/add").mock(side_effect=retry_handler)
16221618

16231619
response = await client.memory.with_raw_response.create(
1624-
content="This is a detailed article about machine learning concepts...",
1620+
content="This is a detailed article about machine learning concepts..",
16251621
extra_headers={"x-stainless-retry-count": "42"},
16261622
)
16271623

0 commit comments

Comments
 (0)