supermemory 3.0.0a30__py3-none-any.whl → 3.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of supermemory might be problematic. Click here for more details.
- supermemory/__init__.py +3 -1
- supermemory/_base_client.py +9 -9
- supermemory/_client.py +25 -9
- supermemory/_files.py +1 -1
- supermemory/_models.py +10 -4
- supermemory/_qs.py +7 -7
- supermemory/_types.py +18 -11
- supermemory/_utils/_transform.py +2 -2
- supermemory/_utils/_utils.py +4 -4
- supermemory/_version.py +1 -1
- supermemory/resources/__init__.py +28 -0
- supermemory/resources/connections.py +31 -31
- supermemory/resources/documents.py +894 -0
- supermemory/resources/memories.py +894 -0
- supermemory/resources/search.py +75 -75
- supermemory/resources/settings.py +31 -31
- supermemory/types/__init__.py +18 -0
- supermemory/types/document_add_params.py +69 -0
- supermemory/types/document_add_response.py +11 -0
- supermemory/types/document_get_response.py +104 -0
- supermemory/types/document_list_params.py +111 -0
- supermemory/types/document_list_response.py +95 -0
- supermemory/types/document_update_params.py +69 -0
- supermemory/types/document_update_response.py +11 -0
- supermemory/types/document_upload_file_params.py +36 -0
- supermemory/types/document_upload_file_response.py +11 -0
- supermemory/types/memory_add_params.py +69 -0
- supermemory/types/memory_add_response.py +11 -0
- supermemory/types/memory_get_response.py +104 -0
- supermemory/types/memory_list_params.py +111 -0
- supermemory/types/memory_list_response.py +95 -0
- supermemory/types/memory_update_params.py +69 -0
- supermemory/types/memory_update_response.py +11 -0
- supermemory/types/memory_upload_file_params.py +36 -0
- supermemory/types/memory_upload_file_response.py +11 -0
- supermemory/types/search_documents_params.py +68 -7
- supermemory/types/search_execute_params.py +68 -7
- supermemory/types/search_memories_params.py +77 -8
- {supermemory-3.0.0a30.dist-info → supermemory-3.1.0.dist-info}/METADATA +32 -15
- supermemory-3.1.0.dist-info/RECORD +80 -0
- supermemory-3.0.0a30.dist-info/RECORD +0 -60
- {supermemory-3.0.0a30.dist-info → supermemory-3.1.0.dist-info}/WHEEL +0 -0
- {supermemory-3.0.0a30.dist-info → supermemory-3.1.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,894 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Dict, Union, Mapping, cast
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import document_add_params, document_list_params, document_update_params, document_upload_file_params
|
|
11
|
+
from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, FileTypes, SequenceNotStr, omit, not_given
|
|
12
|
+
from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
|
|
13
|
+
from .._compat import cached_property
|
|
14
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from .._response import (
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
)
|
|
21
|
+
from .._base_client import make_request_options
|
|
22
|
+
from ..types.document_add_response import DocumentAddResponse
|
|
23
|
+
from ..types.document_get_response import DocumentGetResponse
|
|
24
|
+
from ..types.document_list_response import DocumentListResponse
|
|
25
|
+
from ..types.document_update_response import DocumentUpdateResponse
|
|
26
|
+
from ..types.document_upload_file_response import DocumentUploadFileResponse
|
|
27
|
+
|
|
28
|
+
__all__ = ["DocumentsResource", "AsyncDocumentsResource"]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class DocumentsResource(SyncAPIResource):
|
|
32
|
+
@cached_property
|
|
33
|
+
def with_raw_response(self) -> DocumentsResourceWithRawResponse:
|
|
34
|
+
"""
|
|
35
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
36
|
+
the raw response object instead of the parsed content.
|
|
37
|
+
|
|
38
|
+
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
|
39
|
+
"""
|
|
40
|
+
return DocumentsResourceWithRawResponse(self)
|
|
41
|
+
|
|
42
|
+
@cached_property
|
|
43
|
+
def with_streaming_response(self) -> DocumentsResourceWithStreamingResponse:
|
|
44
|
+
"""
|
|
45
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
46
|
+
|
|
47
|
+
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
|
48
|
+
"""
|
|
49
|
+
return DocumentsResourceWithStreamingResponse(self)
|
|
50
|
+
|
|
51
|
+
def update(
|
|
52
|
+
self,
|
|
53
|
+
id: str,
|
|
54
|
+
*,
|
|
55
|
+
container_tag: str | Omit = omit,
|
|
56
|
+
container_tags: SequenceNotStr[str] | Omit = omit,
|
|
57
|
+
content: str | Omit = omit,
|
|
58
|
+
custom_id: str | Omit = omit,
|
|
59
|
+
file_type: str | Omit = omit,
|
|
60
|
+
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
|
|
61
|
+
mime_type: str | Omit = omit,
|
|
62
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
63
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
64
|
+
extra_headers: Headers | None = None,
|
|
65
|
+
extra_query: Query | None = None,
|
|
66
|
+
extra_body: Body | None = None,
|
|
67
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
68
|
+
) -> DocumentUpdateResponse:
|
|
69
|
+
"""
|
|
70
|
+
Update a document with any content type (text, url, file, etc.) and metadata
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
container_tag: Optional tag this document should be containerized by. This can be an ID for
|
|
74
|
+
your user, a project ID, or any other identifier you wish to use to group
|
|
75
|
+
documents.
|
|
76
|
+
|
|
77
|
+
container_tags: (DEPRECATED: Use containerTag instead) Optional tags this document should be
|
|
78
|
+
containerized by. This can be an ID for your user, a project ID, or any other
|
|
79
|
+
identifier you wish to use to group documents.
|
|
80
|
+
|
|
81
|
+
content: The content to extract and process into a document. This can be a URL to a
|
|
82
|
+
website, a PDF, an image, or a video.
|
|
83
|
+
|
|
84
|
+
Plaintext: Any plaintext format
|
|
85
|
+
|
|
86
|
+
URL: A URL to a website, PDF, image, or video
|
|
87
|
+
|
|
88
|
+
We automatically detect the content type from the url's response format.
|
|
89
|
+
|
|
90
|
+
custom_id: Optional custom ID of the document. This could be an ID from your database that
|
|
91
|
+
will uniquely identify this document.
|
|
92
|
+
|
|
93
|
+
file_type:
|
|
94
|
+
Optional file type override to force specific processing behavior. Valid values:
|
|
95
|
+
text, pdf, tweet, google_doc, google_slide, google_sheet, image, video,
|
|
96
|
+
notion_doc, webpage, onedrive
|
|
97
|
+
|
|
98
|
+
metadata: Optional metadata for the document. This is used to store additional information
|
|
99
|
+
about the document. You can use this to store any additional information you
|
|
100
|
+
need about the document. Metadata can be filtered through. Keys must be strings
|
|
101
|
+
and are case sensitive. Values can be strings, numbers, or booleans. You cannot
|
|
102
|
+
nest objects.
|
|
103
|
+
|
|
104
|
+
mime_type: Required when fileType is 'image' or 'video'. Specifies the exact MIME type to
|
|
105
|
+
use (e.g., 'image/png', 'image/jpeg', 'video/mp4', 'video/webm')
|
|
106
|
+
|
|
107
|
+
extra_headers: Send extra headers
|
|
108
|
+
|
|
109
|
+
extra_query: Add additional query parameters to the request
|
|
110
|
+
|
|
111
|
+
extra_body: Add additional JSON properties to the request
|
|
112
|
+
|
|
113
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
114
|
+
"""
|
|
115
|
+
if not id:
|
|
116
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
117
|
+
return self._patch(
|
|
118
|
+
f"/v3/documents/{id}",
|
|
119
|
+
body=maybe_transform(
|
|
120
|
+
{
|
|
121
|
+
"container_tag": container_tag,
|
|
122
|
+
"container_tags": container_tags,
|
|
123
|
+
"content": content,
|
|
124
|
+
"custom_id": custom_id,
|
|
125
|
+
"file_type": file_type,
|
|
126
|
+
"metadata": metadata,
|
|
127
|
+
"mime_type": mime_type,
|
|
128
|
+
},
|
|
129
|
+
document_update_params.DocumentUpdateParams,
|
|
130
|
+
),
|
|
131
|
+
options=make_request_options(
|
|
132
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
133
|
+
),
|
|
134
|
+
cast_to=DocumentUpdateResponse,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
def list(
|
|
138
|
+
self,
|
|
139
|
+
*,
|
|
140
|
+
container_tags: SequenceNotStr[str] | Omit = omit,
|
|
141
|
+
filters: document_list_params.Filters | Omit = omit,
|
|
142
|
+
include_content: bool | Omit = omit,
|
|
143
|
+
limit: Union[str, float] | Omit = omit,
|
|
144
|
+
order: Literal["asc", "desc"] | Omit = omit,
|
|
145
|
+
page: Union[str, float] | Omit = omit,
|
|
146
|
+
sort: Literal["createdAt", "updatedAt"] | Omit = omit,
|
|
147
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
148
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
149
|
+
extra_headers: Headers | None = None,
|
|
150
|
+
extra_query: Query | None = None,
|
|
151
|
+
extra_body: Body | None = None,
|
|
152
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
153
|
+
) -> DocumentListResponse:
|
|
154
|
+
"""
|
|
155
|
+
Retrieves a paginated list of documents with their metadata and workflow status
|
|
156
|
+
|
|
157
|
+
Args:
|
|
158
|
+
container_tags: Optional tags this document should be containerized by. This can be an ID for
|
|
159
|
+
your user, a project ID, or any other identifier you wish to use to group
|
|
160
|
+
documents.
|
|
161
|
+
|
|
162
|
+
filters: Optional filters to apply to the search. Can be a JSON string or Query object.
|
|
163
|
+
|
|
164
|
+
include_content: Whether to include the content field in the response. Warning: This can make
|
|
165
|
+
responses significantly larger.
|
|
166
|
+
|
|
167
|
+
limit: Number of items per page
|
|
168
|
+
|
|
169
|
+
order: Sort order
|
|
170
|
+
|
|
171
|
+
page: Page number to fetch
|
|
172
|
+
|
|
173
|
+
sort: Field to sort by
|
|
174
|
+
|
|
175
|
+
extra_headers: Send extra headers
|
|
176
|
+
|
|
177
|
+
extra_query: Add additional query parameters to the request
|
|
178
|
+
|
|
179
|
+
extra_body: Add additional JSON properties to the request
|
|
180
|
+
|
|
181
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
182
|
+
"""
|
|
183
|
+
return self._post(
|
|
184
|
+
"/v3/documents/list",
|
|
185
|
+
body=maybe_transform(
|
|
186
|
+
{
|
|
187
|
+
"container_tags": container_tags,
|
|
188
|
+
"filters": filters,
|
|
189
|
+
"include_content": include_content,
|
|
190
|
+
"limit": limit,
|
|
191
|
+
"order": order,
|
|
192
|
+
"page": page,
|
|
193
|
+
"sort": sort,
|
|
194
|
+
},
|
|
195
|
+
document_list_params.DocumentListParams,
|
|
196
|
+
),
|
|
197
|
+
options=make_request_options(
|
|
198
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
199
|
+
),
|
|
200
|
+
cast_to=DocumentListResponse,
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
def delete(
|
|
204
|
+
self,
|
|
205
|
+
id: str,
|
|
206
|
+
*,
|
|
207
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
208
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
209
|
+
extra_headers: Headers | None = None,
|
|
210
|
+
extra_query: Query | None = None,
|
|
211
|
+
extra_body: Body | None = None,
|
|
212
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
213
|
+
) -> None:
|
|
214
|
+
"""
|
|
215
|
+
Delete a document by ID or customId
|
|
216
|
+
|
|
217
|
+
Args:
|
|
218
|
+
extra_headers: Send extra headers
|
|
219
|
+
|
|
220
|
+
extra_query: Add additional query parameters to the request
|
|
221
|
+
|
|
222
|
+
extra_body: Add additional JSON properties to the request
|
|
223
|
+
|
|
224
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
225
|
+
"""
|
|
226
|
+
if not id:
|
|
227
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
228
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
229
|
+
return self._delete(
|
|
230
|
+
f"/v3/documents/{id}",
|
|
231
|
+
options=make_request_options(
|
|
232
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
233
|
+
),
|
|
234
|
+
cast_to=NoneType,
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
def add(
|
|
238
|
+
self,
|
|
239
|
+
*,
|
|
240
|
+
content: str,
|
|
241
|
+
container_tag: str | Omit = omit,
|
|
242
|
+
container_tags: SequenceNotStr[str] | Omit = omit,
|
|
243
|
+
custom_id: str | Omit = omit,
|
|
244
|
+
file_type: str | Omit = omit,
|
|
245
|
+
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
|
|
246
|
+
mime_type: str | Omit = omit,
|
|
247
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
248
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
249
|
+
extra_headers: Headers | None = None,
|
|
250
|
+
extra_query: Query | None = None,
|
|
251
|
+
extra_body: Body | None = None,
|
|
252
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
253
|
+
) -> DocumentAddResponse:
|
|
254
|
+
"""
|
|
255
|
+
Add a document with any content type (text, url, file, etc.) and metadata
|
|
256
|
+
|
|
257
|
+
Args:
|
|
258
|
+
content: The content to extract and process into a document. This can be a URL to a
|
|
259
|
+
website, a PDF, an image, or a video.
|
|
260
|
+
|
|
261
|
+
Plaintext: Any plaintext format
|
|
262
|
+
|
|
263
|
+
URL: A URL to a website, PDF, image, or video
|
|
264
|
+
|
|
265
|
+
We automatically detect the content type from the url's response format.
|
|
266
|
+
|
|
267
|
+
container_tag: Optional tag this document should be containerized by. This can be an ID for
|
|
268
|
+
your user, a project ID, or any other identifier you wish to use to group
|
|
269
|
+
documents.
|
|
270
|
+
|
|
271
|
+
container_tags: (DEPRECATED: Use containerTag instead) Optional tags this document should be
|
|
272
|
+
containerized by. This can be an ID for your user, a project ID, or any other
|
|
273
|
+
identifier you wish to use to group documents.
|
|
274
|
+
|
|
275
|
+
custom_id: Optional custom ID of the document. This could be an ID from your database that
|
|
276
|
+
will uniquely identify this document.
|
|
277
|
+
|
|
278
|
+
file_type:
|
|
279
|
+
Optional file type override to force specific processing behavior. Valid values:
|
|
280
|
+
text, pdf, tweet, google_doc, google_slide, google_sheet, image, video,
|
|
281
|
+
notion_doc, webpage, onedrive
|
|
282
|
+
|
|
283
|
+
metadata: Optional metadata for the document. This is used to store additional information
|
|
284
|
+
about the document. You can use this to store any additional information you
|
|
285
|
+
need about the document. Metadata can be filtered through. Keys must be strings
|
|
286
|
+
and are case sensitive. Values can be strings, numbers, or booleans. You cannot
|
|
287
|
+
nest objects.
|
|
288
|
+
|
|
289
|
+
mime_type: Required when fileType is 'image' or 'video'. Specifies the exact MIME type to
|
|
290
|
+
use (e.g., 'image/png', 'image/jpeg', 'video/mp4', 'video/webm')
|
|
291
|
+
|
|
292
|
+
extra_headers: Send extra headers
|
|
293
|
+
|
|
294
|
+
extra_query: Add additional query parameters to the request
|
|
295
|
+
|
|
296
|
+
extra_body: Add additional JSON properties to the request
|
|
297
|
+
|
|
298
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
299
|
+
"""
|
|
300
|
+
return self._post(
|
|
301
|
+
"/v3/documents",
|
|
302
|
+
body=maybe_transform(
|
|
303
|
+
{
|
|
304
|
+
"content": content,
|
|
305
|
+
"container_tag": container_tag,
|
|
306
|
+
"container_tags": container_tags,
|
|
307
|
+
"custom_id": custom_id,
|
|
308
|
+
"file_type": file_type,
|
|
309
|
+
"metadata": metadata,
|
|
310
|
+
"mime_type": mime_type,
|
|
311
|
+
},
|
|
312
|
+
document_add_params.DocumentAddParams,
|
|
313
|
+
),
|
|
314
|
+
options=make_request_options(
|
|
315
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
316
|
+
),
|
|
317
|
+
cast_to=DocumentAddResponse,
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
def get(
|
|
321
|
+
self,
|
|
322
|
+
id: str,
|
|
323
|
+
*,
|
|
324
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
325
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
326
|
+
extra_headers: Headers | None = None,
|
|
327
|
+
extra_query: Query | None = None,
|
|
328
|
+
extra_body: Body | None = None,
|
|
329
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
330
|
+
) -> DocumentGetResponse:
|
|
331
|
+
"""
|
|
332
|
+
Get a document by ID
|
|
333
|
+
|
|
334
|
+
Args:
|
|
335
|
+
extra_headers: Send extra headers
|
|
336
|
+
|
|
337
|
+
extra_query: Add additional query parameters to the request
|
|
338
|
+
|
|
339
|
+
extra_body: Add additional JSON properties to the request
|
|
340
|
+
|
|
341
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
342
|
+
"""
|
|
343
|
+
if not id:
|
|
344
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
345
|
+
return self._get(
|
|
346
|
+
f"/v3/documents/{id}",
|
|
347
|
+
options=make_request_options(
|
|
348
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
349
|
+
),
|
|
350
|
+
cast_to=DocumentGetResponse,
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
def upload_file(
|
|
354
|
+
self,
|
|
355
|
+
*,
|
|
356
|
+
file: FileTypes,
|
|
357
|
+
container_tags: str | Omit = omit,
|
|
358
|
+
file_type: str | Omit = omit,
|
|
359
|
+
mime_type: str | Omit = omit,
|
|
360
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
361
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
362
|
+
extra_headers: Headers | None = None,
|
|
363
|
+
extra_query: Query | None = None,
|
|
364
|
+
extra_body: Body | None = None,
|
|
365
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
366
|
+
) -> DocumentUploadFileResponse:
|
|
367
|
+
"""
|
|
368
|
+
Upload a file to be processed
|
|
369
|
+
|
|
370
|
+
Args:
|
|
371
|
+
file: File to upload and process
|
|
372
|
+
|
|
373
|
+
container_tags: Optional JSON string of container tags array. This can be an ID for your user, a
|
|
374
|
+
project ID, or any other identifier you wish to use to group documents.
|
|
375
|
+
|
|
376
|
+
file_type:
|
|
377
|
+
Optional file type override to force specific processing behavior. Valid values:
|
|
378
|
+
text, pdf, tweet, google_doc, google_slide, google_sheet, image, video,
|
|
379
|
+
notion_doc, webpage, onedrive
|
|
380
|
+
|
|
381
|
+
mime_type: Required when fileType is 'image' or 'video'. Specifies the exact MIME type to
|
|
382
|
+
use (e.g., 'image/png', 'image/jpeg', 'video/mp4', 'video/webm')
|
|
383
|
+
|
|
384
|
+
extra_headers: Send extra headers
|
|
385
|
+
|
|
386
|
+
extra_query: Add additional query parameters to the request
|
|
387
|
+
|
|
388
|
+
extra_body: Add additional JSON properties to the request
|
|
389
|
+
|
|
390
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
391
|
+
"""
|
|
392
|
+
body = deepcopy_minimal(
|
|
393
|
+
{
|
|
394
|
+
"file": file,
|
|
395
|
+
"container_tags": container_tags,
|
|
396
|
+
"file_type": file_type,
|
|
397
|
+
"mime_type": mime_type,
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
|
401
|
+
# It should be noted that the actual Content-Type header that will be
|
|
402
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
403
|
+
# multipart/form-data; boundary=---abc--
|
|
404
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
405
|
+
return self._post(
|
|
406
|
+
"/v3/documents/file",
|
|
407
|
+
body=maybe_transform(body, document_upload_file_params.DocumentUploadFileParams),
|
|
408
|
+
files=files,
|
|
409
|
+
options=make_request_options(
|
|
410
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
411
|
+
),
|
|
412
|
+
cast_to=DocumentUploadFileResponse,
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
class AsyncDocumentsResource(AsyncAPIResource):
|
|
417
|
+
@cached_property
|
|
418
|
+
def with_raw_response(self) -> AsyncDocumentsResourceWithRawResponse:
|
|
419
|
+
"""
|
|
420
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
421
|
+
the raw response object instead of the parsed content.
|
|
422
|
+
|
|
423
|
+
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
|
424
|
+
"""
|
|
425
|
+
return AsyncDocumentsResourceWithRawResponse(self)
|
|
426
|
+
|
|
427
|
+
@cached_property
|
|
428
|
+
def with_streaming_response(self) -> AsyncDocumentsResourceWithStreamingResponse:
|
|
429
|
+
"""
|
|
430
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
431
|
+
|
|
432
|
+
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
|
433
|
+
"""
|
|
434
|
+
return AsyncDocumentsResourceWithStreamingResponse(self)
|
|
435
|
+
|
|
436
|
+
async def update(
|
|
437
|
+
self,
|
|
438
|
+
id: str,
|
|
439
|
+
*,
|
|
440
|
+
container_tag: str | Omit = omit,
|
|
441
|
+
container_tags: SequenceNotStr[str] | Omit = omit,
|
|
442
|
+
content: str | Omit = omit,
|
|
443
|
+
custom_id: str | Omit = omit,
|
|
444
|
+
file_type: str | Omit = omit,
|
|
445
|
+
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
|
|
446
|
+
mime_type: str | Omit = omit,
|
|
447
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
448
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
449
|
+
extra_headers: Headers | None = None,
|
|
450
|
+
extra_query: Query | None = None,
|
|
451
|
+
extra_body: Body | None = None,
|
|
452
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
453
|
+
) -> DocumentUpdateResponse:
|
|
454
|
+
"""
|
|
455
|
+
Update a document with any content type (text, url, file, etc.) and metadata
|
|
456
|
+
|
|
457
|
+
Args:
|
|
458
|
+
container_tag: Optional tag this document should be containerized by. This can be an ID for
|
|
459
|
+
your user, a project ID, or any other identifier you wish to use to group
|
|
460
|
+
documents.
|
|
461
|
+
|
|
462
|
+
container_tags: (DEPRECATED: Use containerTag instead) Optional tags this document should be
|
|
463
|
+
containerized by. This can be an ID for your user, a project ID, or any other
|
|
464
|
+
identifier you wish to use to group documents.
|
|
465
|
+
|
|
466
|
+
content: The content to extract and process into a document. This can be a URL to a
|
|
467
|
+
website, a PDF, an image, or a video.
|
|
468
|
+
|
|
469
|
+
Plaintext: Any plaintext format
|
|
470
|
+
|
|
471
|
+
URL: A URL to a website, PDF, image, or video
|
|
472
|
+
|
|
473
|
+
We automatically detect the content type from the url's response format.
|
|
474
|
+
|
|
475
|
+
custom_id: Optional custom ID of the document. This could be an ID from your database that
|
|
476
|
+
will uniquely identify this document.
|
|
477
|
+
|
|
478
|
+
file_type:
|
|
479
|
+
Optional file type override to force specific processing behavior. Valid values:
|
|
480
|
+
text, pdf, tweet, google_doc, google_slide, google_sheet, image, video,
|
|
481
|
+
notion_doc, webpage, onedrive
|
|
482
|
+
|
|
483
|
+
metadata: Optional metadata for the document. This is used to store additional information
|
|
484
|
+
about the document. You can use this to store any additional information you
|
|
485
|
+
need about the document. Metadata can be filtered through. Keys must be strings
|
|
486
|
+
and are case sensitive. Values can be strings, numbers, or booleans. You cannot
|
|
487
|
+
nest objects.
|
|
488
|
+
|
|
489
|
+
mime_type: Required when fileType is 'image' or 'video'. Specifies the exact MIME type to
|
|
490
|
+
use (e.g., 'image/png', 'image/jpeg', 'video/mp4', 'video/webm')
|
|
491
|
+
|
|
492
|
+
extra_headers: Send extra headers
|
|
493
|
+
|
|
494
|
+
extra_query: Add additional query parameters to the request
|
|
495
|
+
|
|
496
|
+
extra_body: Add additional JSON properties to the request
|
|
497
|
+
|
|
498
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
499
|
+
"""
|
|
500
|
+
if not id:
|
|
501
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
502
|
+
return await self._patch(
|
|
503
|
+
f"/v3/documents/{id}",
|
|
504
|
+
body=await async_maybe_transform(
|
|
505
|
+
{
|
|
506
|
+
"container_tag": container_tag,
|
|
507
|
+
"container_tags": container_tags,
|
|
508
|
+
"content": content,
|
|
509
|
+
"custom_id": custom_id,
|
|
510
|
+
"file_type": file_type,
|
|
511
|
+
"metadata": metadata,
|
|
512
|
+
"mime_type": mime_type,
|
|
513
|
+
},
|
|
514
|
+
document_update_params.DocumentUpdateParams,
|
|
515
|
+
),
|
|
516
|
+
options=make_request_options(
|
|
517
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
518
|
+
),
|
|
519
|
+
cast_to=DocumentUpdateResponse,
|
|
520
|
+
)
|
|
521
|
+
|
|
522
|
+
async def list(
|
|
523
|
+
self,
|
|
524
|
+
*,
|
|
525
|
+
container_tags: SequenceNotStr[str] | Omit = omit,
|
|
526
|
+
filters: document_list_params.Filters | Omit = omit,
|
|
527
|
+
include_content: bool | Omit = omit,
|
|
528
|
+
limit: Union[str, float] | Omit = omit,
|
|
529
|
+
order: Literal["asc", "desc"] | Omit = omit,
|
|
530
|
+
page: Union[str, float] | Omit = omit,
|
|
531
|
+
sort: Literal["createdAt", "updatedAt"] | Omit = omit,
|
|
532
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
533
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
534
|
+
extra_headers: Headers | None = None,
|
|
535
|
+
extra_query: Query | None = None,
|
|
536
|
+
extra_body: Body | None = None,
|
|
537
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
538
|
+
) -> DocumentListResponse:
|
|
539
|
+
"""
|
|
540
|
+
Retrieves a paginated list of documents with their metadata and workflow status
|
|
541
|
+
|
|
542
|
+
Args:
|
|
543
|
+
container_tags: Optional tags this document should be containerized by. This can be an ID for
|
|
544
|
+
your user, a project ID, or any other identifier you wish to use to group
|
|
545
|
+
documents.
|
|
546
|
+
|
|
547
|
+
filters: Optional filters to apply to the search. Can be a JSON string or Query object.
|
|
548
|
+
|
|
549
|
+
include_content: Whether to include the content field in the response. Warning: This can make
|
|
550
|
+
responses significantly larger.
|
|
551
|
+
|
|
552
|
+
limit: Number of items per page
|
|
553
|
+
|
|
554
|
+
order: Sort order
|
|
555
|
+
|
|
556
|
+
page: Page number to fetch
|
|
557
|
+
|
|
558
|
+
sort: Field to sort by
|
|
559
|
+
|
|
560
|
+
extra_headers: Send extra headers
|
|
561
|
+
|
|
562
|
+
extra_query: Add additional query parameters to the request
|
|
563
|
+
|
|
564
|
+
extra_body: Add additional JSON properties to the request
|
|
565
|
+
|
|
566
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
567
|
+
"""
|
|
568
|
+
return await self._post(
|
|
569
|
+
"/v3/documents/list",
|
|
570
|
+
body=await async_maybe_transform(
|
|
571
|
+
{
|
|
572
|
+
"container_tags": container_tags,
|
|
573
|
+
"filters": filters,
|
|
574
|
+
"include_content": include_content,
|
|
575
|
+
"limit": limit,
|
|
576
|
+
"order": order,
|
|
577
|
+
"page": page,
|
|
578
|
+
"sort": sort,
|
|
579
|
+
},
|
|
580
|
+
document_list_params.DocumentListParams,
|
|
581
|
+
),
|
|
582
|
+
options=make_request_options(
|
|
583
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
584
|
+
),
|
|
585
|
+
cast_to=DocumentListResponse,
|
|
586
|
+
)
|
|
587
|
+
|
|
588
|
+
async def delete(
|
|
589
|
+
self,
|
|
590
|
+
id: str,
|
|
591
|
+
*,
|
|
592
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
593
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
594
|
+
extra_headers: Headers | None = None,
|
|
595
|
+
extra_query: Query | None = None,
|
|
596
|
+
extra_body: Body | None = None,
|
|
597
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
598
|
+
) -> None:
|
|
599
|
+
"""
|
|
600
|
+
Delete a document by ID or customId
|
|
601
|
+
|
|
602
|
+
Args:
|
|
603
|
+
extra_headers: Send extra headers
|
|
604
|
+
|
|
605
|
+
extra_query: Add additional query parameters to the request
|
|
606
|
+
|
|
607
|
+
extra_body: Add additional JSON properties to the request
|
|
608
|
+
|
|
609
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
610
|
+
"""
|
|
611
|
+
if not id:
|
|
612
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
613
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
614
|
+
return await self._delete(
|
|
615
|
+
f"/v3/documents/{id}",
|
|
616
|
+
options=make_request_options(
|
|
617
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
618
|
+
),
|
|
619
|
+
cast_to=NoneType,
|
|
620
|
+
)
|
|
621
|
+
|
|
622
|
+
async def add(
|
|
623
|
+
self,
|
|
624
|
+
*,
|
|
625
|
+
content: str,
|
|
626
|
+
container_tag: str | Omit = omit,
|
|
627
|
+
container_tags: SequenceNotStr[str] | Omit = omit,
|
|
628
|
+
custom_id: str | Omit = omit,
|
|
629
|
+
file_type: str | Omit = omit,
|
|
630
|
+
metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]] | Omit = omit,
|
|
631
|
+
mime_type: str | Omit = omit,
|
|
632
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
633
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
634
|
+
extra_headers: Headers | None = None,
|
|
635
|
+
extra_query: Query | None = None,
|
|
636
|
+
extra_body: Body | None = None,
|
|
637
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
638
|
+
) -> DocumentAddResponse:
|
|
639
|
+
"""
|
|
640
|
+
Add a document with any content type (text, url, file, etc.) and metadata
|
|
641
|
+
|
|
642
|
+
Args:
|
|
643
|
+
content: The content to extract and process into a document. This can be a URL to a
|
|
644
|
+
website, a PDF, an image, or a video.
|
|
645
|
+
|
|
646
|
+
Plaintext: Any plaintext format
|
|
647
|
+
|
|
648
|
+
URL: A URL to a website, PDF, image, or video
|
|
649
|
+
|
|
650
|
+
We automatically detect the content type from the url's response format.
|
|
651
|
+
|
|
652
|
+
container_tag: Optional tag this document should be containerized by. This can be an ID for
|
|
653
|
+
your user, a project ID, or any other identifier you wish to use to group
|
|
654
|
+
documents.
|
|
655
|
+
|
|
656
|
+
container_tags: (DEPRECATED: Use containerTag instead) Optional tags this document should be
|
|
657
|
+
containerized by. This can be an ID for your user, a project ID, or any other
|
|
658
|
+
identifier you wish to use to group documents.
|
|
659
|
+
|
|
660
|
+
custom_id: Optional custom ID of the document. This could be an ID from your database that
|
|
661
|
+
will uniquely identify this document.
|
|
662
|
+
|
|
663
|
+
file_type:
|
|
664
|
+
Optional file type override to force specific processing behavior. Valid values:
|
|
665
|
+
text, pdf, tweet, google_doc, google_slide, google_sheet, image, video,
|
|
666
|
+
notion_doc, webpage, onedrive
|
|
667
|
+
|
|
668
|
+
metadata: Optional metadata for the document. This is used to store additional information
|
|
669
|
+
about the document. You can use this to store any additional information you
|
|
670
|
+
need about the document. Metadata can be filtered through. Keys must be strings
|
|
671
|
+
and are case sensitive. Values can be strings, numbers, or booleans. You cannot
|
|
672
|
+
nest objects.
|
|
673
|
+
|
|
674
|
+
mime_type: Required when fileType is 'image' or 'video'. Specifies the exact MIME type to
|
|
675
|
+
use (e.g., 'image/png', 'image/jpeg', 'video/mp4', 'video/webm')
|
|
676
|
+
|
|
677
|
+
extra_headers: Send extra headers
|
|
678
|
+
|
|
679
|
+
extra_query: Add additional query parameters to the request
|
|
680
|
+
|
|
681
|
+
extra_body: Add additional JSON properties to the request
|
|
682
|
+
|
|
683
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
684
|
+
"""
|
|
685
|
+
return await self._post(
|
|
686
|
+
"/v3/documents",
|
|
687
|
+
body=await async_maybe_transform(
|
|
688
|
+
{
|
|
689
|
+
"content": content,
|
|
690
|
+
"container_tag": container_tag,
|
|
691
|
+
"container_tags": container_tags,
|
|
692
|
+
"custom_id": custom_id,
|
|
693
|
+
"file_type": file_type,
|
|
694
|
+
"metadata": metadata,
|
|
695
|
+
"mime_type": mime_type,
|
|
696
|
+
},
|
|
697
|
+
document_add_params.DocumentAddParams,
|
|
698
|
+
),
|
|
699
|
+
options=make_request_options(
|
|
700
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
701
|
+
),
|
|
702
|
+
cast_to=DocumentAddResponse,
|
|
703
|
+
)
|
|
704
|
+
|
|
705
|
+
async def get(
|
|
706
|
+
self,
|
|
707
|
+
id: str,
|
|
708
|
+
*,
|
|
709
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
710
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
711
|
+
extra_headers: Headers | None = None,
|
|
712
|
+
extra_query: Query | None = None,
|
|
713
|
+
extra_body: Body | None = None,
|
|
714
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
715
|
+
) -> DocumentGetResponse:
|
|
716
|
+
"""
|
|
717
|
+
Get a document by ID
|
|
718
|
+
|
|
719
|
+
Args:
|
|
720
|
+
extra_headers: Send extra headers
|
|
721
|
+
|
|
722
|
+
extra_query: Add additional query parameters to the request
|
|
723
|
+
|
|
724
|
+
extra_body: Add additional JSON properties to the request
|
|
725
|
+
|
|
726
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
727
|
+
"""
|
|
728
|
+
if not id:
|
|
729
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
730
|
+
return await self._get(
|
|
731
|
+
f"/v3/documents/{id}",
|
|
732
|
+
options=make_request_options(
|
|
733
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
734
|
+
),
|
|
735
|
+
cast_to=DocumentGetResponse,
|
|
736
|
+
)
|
|
737
|
+
|
|
738
|
+
async def upload_file(
|
|
739
|
+
self,
|
|
740
|
+
*,
|
|
741
|
+
file: FileTypes,
|
|
742
|
+
container_tags: str | Omit = omit,
|
|
743
|
+
file_type: str | Omit = omit,
|
|
744
|
+
mime_type: str | Omit = omit,
|
|
745
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
746
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
747
|
+
extra_headers: Headers | None = None,
|
|
748
|
+
extra_query: Query | None = None,
|
|
749
|
+
extra_body: Body | None = None,
|
|
750
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
751
|
+
) -> DocumentUploadFileResponse:
|
|
752
|
+
"""
|
|
753
|
+
Upload a file to be processed
|
|
754
|
+
|
|
755
|
+
Args:
|
|
756
|
+
file: File to upload and process
|
|
757
|
+
|
|
758
|
+
container_tags: Optional JSON string of container tags array. This can be an ID for your user, a
|
|
759
|
+
project ID, or any other identifier you wish to use to group documents.
|
|
760
|
+
|
|
761
|
+
file_type:
|
|
762
|
+
Optional file type override to force specific processing behavior. Valid values:
|
|
763
|
+
text, pdf, tweet, google_doc, google_slide, google_sheet, image, video,
|
|
764
|
+
notion_doc, webpage, onedrive
|
|
765
|
+
|
|
766
|
+
mime_type: Required when fileType is 'image' or 'video'. Specifies the exact MIME type to
|
|
767
|
+
use (e.g., 'image/png', 'image/jpeg', 'video/mp4', 'video/webm')
|
|
768
|
+
|
|
769
|
+
extra_headers: Send extra headers
|
|
770
|
+
|
|
771
|
+
extra_query: Add additional query parameters to the request
|
|
772
|
+
|
|
773
|
+
extra_body: Add additional JSON properties to the request
|
|
774
|
+
|
|
775
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
776
|
+
"""
|
|
777
|
+
body = deepcopy_minimal(
|
|
778
|
+
{
|
|
779
|
+
"file": file,
|
|
780
|
+
"container_tags": container_tags,
|
|
781
|
+
"file_type": file_type,
|
|
782
|
+
"mime_type": mime_type,
|
|
783
|
+
}
|
|
784
|
+
)
|
|
785
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
|
786
|
+
# It should be noted that the actual Content-Type header that will be
|
|
787
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
788
|
+
# multipart/form-data; boundary=---abc--
|
|
789
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
790
|
+
return await self._post(
|
|
791
|
+
"/v3/documents/file",
|
|
792
|
+
body=await async_maybe_transform(body, document_upload_file_params.DocumentUploadFileParams),
|
|
793
|
+
files=files,
|
|
794
|
+
options=make_request_options(
|
|
795
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
796
|
+
),
|
|
797
|
+
cast_to=DocumentUploadFileResponse,
|
|
798
|
+
)
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
class DocumentsResourceWithRawResponse:
|
|
802
|
+
def __init__(self, documents: DocumentsResource) -> None:
|
|
803
|
+
self._documents = documents
|
|
804
|
+
|
|
805
|
+
self.update = to_raw_response_wrapper(
|
|
806
|
+
documents.update,
|
|
807
|
+
)
|
|
808
|
+
self.list = to_raw_response_wrapper(
|
|
809
|
+
documents.list,
|
|
810
|
+
)
|
|
811
|
+
self.delete = to_raw_response_wrapper(
|
|
812
|
+
documents.delete,
|
|
813
|
+
)
|
|
814
|
+
self.add = to_raw_response_wrapper(
|
|
815
|
+
documents.add,
|
|
816
|
+
)
|
|
817
|
+
self.get = to_raw_response_wrapper(
|
|
818
|
+
documents.get,
|
|
819
|
+
)
|
|
820
|
+
self.upload_file = to_raw_response_wrapper(
|
|
821
|
+
documents.upload_file,
|
|
822
|
+
)
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
class AsyncDocumentsResourceWithRawResponse:
|
|
826
|
+
def __init__(self, documents: AsyncDocumentsResource) -> None:
|
|
827
|
+
self._documents = documents
|
|
828
|
+
|
|
829
|
+
self.update = async_to_raw_response_wrapper(
|
|
830
|
+
documents.update,
|
|
831
|
+
)
|
|
832
|
+
self.list = async_to_raw_response_wrapper(
|
|
833
|
+
documents.list,
|
|
834
|
+
)
|
|
835
|
+
self.delete = async_to_raw_response_wrapper(
|
|
836
|
+
documents.delete,
|
|
837
|
+
)
|
|
838
|
+
self.add = async_to_raw_response_wrapper(
|
|
839
|
+
documents.add,
|
|
840
|
+
)
|
|
841
|
+
self.get = async_to_raw_response_wrapper(
|
|
842
|
+
documents.get,
|
|
843
|
+
)
|
|
844
|
+
self.upload_file = async_to_raw_response_wrapper(
|
|
845
|
+
documents.upload_file,
|
|
846
|
+
)
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
class DocumentsResourceWithStreamingResponse:
|
|
850
|
+
def __init__(self, documents: DocumentsResource) -> None:
|
|
851
|
+
self._documents = documents
|
|
852
|
+
|
|
853
|
+
self.update = to_streamed_response_wrapper(
|
|
854
|
+
documents.update,
|
|
855
|
+
)
|
|
856
|
+
self.list = to_streamed_response_wrapper(
|
|
857
|
+
documents.list,
|
|
858
|
+
)
|
|
859
|
+
self.delete = to_streamed_response_wrapper(
|
|
860
|
+
documents.delete,
|
|
861
|
+
)
|
|
862
|
+
self.add = to_streamed_response_wrapper(
|
|
863
|
+
documents.add,
|
|
864
|
+
)
|
|
865
|
+
self.get = to_streamed_response_wrapper(
|
|
866
|
+
documents.get,
|
|
867
|
+
)
|
|
868
|
+
self.upload_file = to_streamed_response_wrapper(
|
|
869
|
+
documents.upload_file,
|
|
870
|
+
)
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
class AsyncDocumentsResourceWithStreamingResponse:
|
|
874
|
+
def __init__(self, documents: AsyncDocumentsResource) -> None:
|
|
875
|
+
self._documents = documents
|
|
876
|
+
|
|
877
|
+
self.update = async_to_streamed_response_wrapper(
|
|
878
|
+
documents.update,
|
|
879
|
+
)
|
|
880
|
+
self.list = async_to_streamed_response_wrapper(
|
|
881
|
+
documents.list,
|
|
882
|
+
)
|
|
883
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
884
|
+
documents.delete,
|
|
885
|
+
)
|
|
886
|
+
self.add = async_to_streamed_response_wrapper(
|
|
887
|
+
documents.add,
|
|
888
|
+
)
|
|
889
|
+
self.get = async_to_streamed_response_wrapper(
|
|
890
|
+
documents.get,
|
|
891
|
+
)
|
|
892
|
+
self.upload_file = async_to_streamed_response_wrapper(
|
|
893
|
+
documents.upload_file,
|
|
894
|
+
)
|