You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***ci:** upload sdks to package manager ([a327d7d](https://github.com/supermemoryai/python-sdk/commit/a327d7ddd1836e1a15b30eb5fb33388fe2580229))
37
+
***internal:** avoid errors for isinstance checks on proxies ([be6c667](https://github.com/supermemoryai/python-sdk/commit/be6c667dbff65c00fc7f3bd22e541b477c19ca08))
38
+
***internal:** codegen related update ([c0d13e2](https://github.com/supermemoryai/python-sdk/commit/c0d13e254d08d459edc35def2c38774ce11fcd0d))
39
+
3
40
## 0.1.0-alpha.1 (2025-04-29)
4
41
5
42
Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/supermemoryai/python-sdk/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
Copy file name to clipboardExpand all lines: README.md
+23-6Lines changed: 23 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,23 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
77
77
78
78
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
79
79
80
+
## File uploads
81
+
82
+
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
83
+
84
+
```python
85
+
from pathlib import Path
86
+
from supermemory import Supermemory
87
+
88
+
client = Supermemory()
89
+
90
+
client.memories.upload_file(
91
+
file=Path("/path/to/file"),
92
+
)
93
+
```
94
+
95
+
The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
96
+
80
97
## Handling errors
81
98
82
99
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `supermemory.APIConnectionError` is raised.
@@ -93,7 +110,7 @@ from supermemory import Supermemory
93
110
client = Supermemory()
94
111
95
112
try:
96
-
client.memory.create(
113
+
client.memories.add(
97
114
content="This is a detailed article about machine learning concepts...",
98
115
)
99
116
except supermemory.APIConnectionError as e:
@@ -138,7 +155,7 @@ client = Supermemory(
138
155
)
139
156
140
157
# Or, configure per-request:
141
-
client.with_options(max_retries=5).memory.create(
158
+
client.with_options(max_retries=5).memories.add(
142
159
content="This is a detailed article about machine learning concepts...",
143
160
)
144
161
```
@@ -163,7 +180,7 @@ client = Supermemory(
163
180
)
164
181
165
182
# Override per-request:
166
-
client.with_options(timeout=5.0).memory.create(
183
+
client.with_options(timeout=5.0).memories.add(
167
184
content="This is a detailed article about machine learning concepts...",
168
185
)
169
186
```
@@ -206,12 +223,12 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
content="This is a detailed article about machine learning concepts...",
211
228
)
212
229
print(response.headers.get('X-My-Header'))
213
230
214
-
memory = response.parse() # get the object that `memory.create()` would have returned
231
+
memory = response.parse() # get the object that `memories.add()` would have returned
215
232
print(memory.id)
216
233
```
217
234
@@ -226,7 +243,7 @@ The above interface eagerly reads the full response body when you make the reque
226
243
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.
227
244
228
245
```python
229
-
with client.memory.with_streaming_response.create(
246
+
with client.memories.with_streaming_response.add(
230
247
content="This is a detailed article about machine learning concepts...",
0 commit comments