vellum-ai 1.0.11__py3-none-any.whl → 1.1.1__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.
- vellum/__init__.py +2 -2
- vellum/client/README.md +0 -55
- vellum/client/__init__.py +159 -877
- vellum/client/core/__init__.py +3 -0
- vellum/client/core/client_wrapper.py +2 -2
- vellum/client/core/http_response.py +47 -0
- vellum/client/raw_client.py +1561 -0
- vellum/client/reference.md +22 -696
- vellum/client/resources/__init__.py +0 -2
- vellum/client/resources/ad_hoc/client.py +55 -161
- vellum/client/resources/ad_hoc/raw_client.py +278 -0
- vellum/client/resources/container_images/client.py +62 -172
- vellum/client/resources/container_images/raw_client.py +400 -0
- vellum/client/resources/deployments/client.py +112 -437
- vellum/client/resources/deployments/raw_client.py +995 -0
- vellum/client/resources/document_indexes/client.py +108 -317
- vellum/client/resources/document_indexes/raw_client.py +847 -0
- vellum/client/resources/documents/client.py +88 -285
- vellum/client/resources/documents/raw_client.py +655 -0
- vellum/client/resources/folder_entities/client.py +54 -92
- vellum/client/resources/folder_entities/raw_client.py +277 -0
- vellum/client/resources/metric_definitions/client.py +48 -95
- vellum/client/resources/metric_definitions/raw_client.py +225 -0
- vellum/client/resources/ml_models/client.py +36 -40
- vellum/client/resources/ml_models/raw_client.py +103 -0
- vellum/client/resources/organizations/client.py +34 -39
- vellum/client/resources/organizations/raw_client.py +96 -0
- vellum/client/resources/prompts/client.py +50 -193
- vellum/client/resources/prompts/raw_client.py +346 -0
- vellum/client/resources/sandboxes/client.py +68 -141
- vellum/client/resources/sandboxes/raw_client.py +393 -0
- vellum/client/resources/test_suite_runs/client.py +58 -141
- vellum/client/resources/test_suite_runs/raw_client.py +355 -0
- vellum/client/resources/test_suites/client.py +73 -141
- vellum/client/resources/test_suites/raw_client.py +379 -0
- vellum/client/resources/workflow_deployments/client.py +203 -328
- vellum/client/resources/workflow_deployments/raw_client.py +931 -0
- vellum/client/resources/workflow_executions/client.py +36 -40
- vellum/client/resources/workflow_executions/raw_client.py +97 -0
- vellum/client/resources/workflow_sandboxes/client.py +60 -108
- vellum/client/resources/workflow_sandboxes/raw_client.py +300 -0
- vellum/client/resources/workflows/client.py +68 -133
- vellum/client/resources/workflows/raw_client.py +307 -0
- vellum/client/resources/workspace_secrets/client.py +46 -90
- vellum/client/resources/workspace_secrets/raw_client.py +220 -0
- vellum/client/resources/workspaces/client.py +34 -39
- vellum/client/resources/workspaces/raw_client.py +96 -0
- vellum/client/types/__init__.py +2 -0
- vellum/client/types/api_request_parent_context.py +1 -0
- vellum/client/types/external_parent_context.py +36 -0
- vellum/client/types/node_execution_fulfilled_event.py +1 -0
- vellum/client/types/node_execution_initiated_event.py +1 -0
- vellum/client/types/node_execution_paused_event.py +1 -0
- vellum/client/types/node_execution_rejected_event.py +1 -0
- vellum/client/types/node_execution_resumed_event.py +1 -0
- vellum/client/types/node_execution_span.py +1 -0
- vellum/client/types/node_execution_span_attributes.py +1 -0
- vellum/client/types/node_execution_streaming_event.py +1 -0
- vellum/client/types/node_parent_context.py +1 -0
- vellum/client/types/parent_context.py +2 -0
- vellum/client/types/prompt_deployment_parent_context.py +1 -0
- vellum/client/types/slim_workflow_execution_read.py +1 -0
- vellum/client/types/span_link.py +1 -0
- vellum/client/types/workflow_deployment_event_executions_response.py +1 -0
- vellum/client/types/workflow_deployment_parent_context.py +1 -0
- vellum/client/types/workflow_event_execution_read.py +1 -0
- vellum/client/types/workflow_execution_detail.py +1 -0
- vellum/client/types/workflow_execution_fulfilled_event.py +1 -0
- vellum/client/types/workflow_execution_initiated_event.py +1 -0
- vellum/client/types/workflow_execution_paused_event.py +1 -0
- vellum/client/types/workflow_execution_rejected_event.py +1 -0
- vellum/client/types/workflow_execution_resumed_event.py +1 -0
- vellum/client/types/workflow_execution_snapshotted_event.py +1 -0
- vellum/client/types/workflow_execution_span.py +1 -0
- vellum/client/types/workflow_execution_span_attributes.py +1 -0
- vellum/client/types/workflow_execution_streaming_event.py +1 -0
- vellum/client/types/workflow_parent_context.py +1 -0
- vellum/client/types/workflow_sandbox_parent_context.py +1 -0
- vellum/{resources/release_reviews/__init__.py → core/http_response.py} +1 -1
- vellum/{resources/release_reviews/client.py → raw_client.py} +1 -1
- vellum/resources/ad_hoc/raw_client.py +3 -0
- vellum/resources/container_images/raw_client.py +3 -0
- vellum/resources/deployments/raw_client.py +3 -0
- vellum/resources/document_indexes/raw_client.py +3 -0
- vellum/resources/documents/raw_client.py +3 -0
- vellum/resources/folder_entities/raw_client.py +3 -0
- vellum/resources/metric_definitions/raw_client.py +3 -0
- vellum/resources/ml_models/raw_client.py +3 -0
- vellum/resources/organizations/raw_client.py +3 -0
- vellum/resources/prompts/raw_client.py +3 -0
- vellum/resources/sandboxes/raw_client.py +3 -0
- vellum/resources/test_suite_runs/raw_client.py +3 -0
- vellum/resources/test_suites/raw_client.py +3 -0
- vellum/resources/workflow_deployments/raw_client.py +3 -0
- vellum/resources/workflow_executions/raw_client.py +3 -0
- vellum/resources/workflow_sandboxes/raw_client.py +3 -0
- vellum/resources/workflows/raw_client.py +3 -0
- vellum/resources/workspace_secrets/raw_client.py +3 -0
- vellum/resources/workspaces/raw_client.py +3 -0
- vellum/types/external_parent_context.py +3 -0
- vellum/workflows/emitters/vellum_emitter.py +3 -2
- vellum/workflows/events/types.py +6 -0
- vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +5 -15
- vellum/workflows/nodes/displayable/tool_calling_node/node.py +6 -0
- vellum/workflows/nodes/displayable/tool_calling_node/utils.py +75 -0
- vellum/workflows/state/context.py +13 -2
- vellum/workflows/types/definition.py +2 -2
- vellum/workflows/types/tests/test_definition.py +2 -3
- vellum/workflows/utils/functions.py +1 -1
- vellum/workflows/utils/tests/test_functions.py +3 -3
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/METADATA +1 -1
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/RECORD +123 -81
- vellum_ee/workflows/display/exceptions.py +7 -0
- vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +2 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +53 -2
- vellum_ee/workflows/display/nodes/vellum/tests/test_tool_calling_node.py +93 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_mcp_serialization.py +98 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_workflow_deployment_serialization.py +1 -1
- vellum_ee/workflows/display/utils/expressions.py +1 -1
- vellum_ee/workflows/display/workflows/base_workflow_display.py +2 -1
- vellum/client/resources/release_reviews/__init__.py +0 -2
- vellum/client/resources/release_reviews/client.py +0 -139
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/LICENSE +0 -0
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/WHEEL +0 -0
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/entry_points.txt +0 -0
@@ -2,20 +2,15 @@
|
|
2
2
|
|
3
3
|
import typing
|
4
4
|
from ...core.client_wrapper import SyncClientWrapper
|
5
|
+
from .raw_client import RawDocumentsClient
|
5
6
|
from ...core.request_options import RequestOptions
|
6
7
|
from ...types.paginated_slim_document_list import PaginatedSlimDocumentList
|
7
|
-
from ...core.pydantic_utilities import parse_obj_as
|
8
|
-
from json.decoder import JSONDecodeError
|
9
|
-
from ...core.api_error import ApiError
|
10
8
|
from ...types.document_read import DocumentRead
|
11
|
-
from ...core.jsonable_encoder import jsonable_encoder
|
12
9
|
from ...types.document_status import DocumentStatus
|
13
10
|
from ... import core
|
14
11
|
from ...types.upload_document_response import UploadDocumentResponse
|
15
|
-
from ...errors.bad_request_error import BadRequestError
|
16
|
-
from ...errors.not_found_error import NotFoundError
|
17
|
-
from ...errors.internal_server_error import InternalServerError
|
18
12
|
from ...core.client_wrapper import AsyncClientWrapper
|
13
|
+
from .raw_client import AsyncRawDocumentsClient
|
19
14
|
|
20
15
|
# this is used as the default value for optional parameters
|
21
16
|
OMIT = typing.cast(typing.Any, ...)
|
@@ -23,9 +18,24 @@ OMIT = typing.cast(typing.Any, ...)
|
|
23
18
|
|
24
19
|
class DocumentsClient:
|
25
20
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
26
|
-
self.
|
21
|
+
self._raw_client = RawDocumentsClient(client_wrapper=client_wrapper)
|
27
22
|
|
28
|
-
|
23
|
+
@property
|
24
|
+
def _client_wrapper(self) -> SyncClientWrapper:
|
25
|
+
return self._raw_client._client_wrapper
|
26
|
+
|
27
|
+
@property
|
28
|
+
def with_raw_response(self) -> RawDocumentsClient:
|
29
|
+
"""
|
30
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
31
|
+
|
32
|
+
Returns
|
33
|
+
-------
|
34
|
+
RawDocumentsClient
|
35
|
+
"""
|
36
|
+
return self._raw_client
|
37
|
+
|
38
|
+
def list_(
|
29
39
|
self,
|
30
40
|
*,
|
31
41
|
document_index_id: typing.Optional[str] = None,
|
@@ -73,32 +83,15 @@ class DocumentsClient:
|
|
73
83
|
)
|
74
84
|
client.documents.list()
|
75
85
|
"""
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
"limit": limit,
|
83
|
-
"offset": offset,
|
84
|
-
"ordering": ordering,
|
85
|
-
"search": search,
|
86
|
-
},
|
86
|
+
response = self._raw_client.list(
|
87
|
+
document_index_id=document_index_id,
|
88
|
+
limit=limit,
|
89
|
+
offset=offset,
|
90
|
+
ordering=ordering,
|
91
|
+
search=search,
|
87
92
|
request_options=request_options,
|
88
93
|
)
|
89
|
-
|
90
|
-
if 200 <= _response.status_code < 300:
|
91
|
-
return typing.cast(
|
92
|
-
PaginatedSlimDocumentList,
|
93
|
-
parse_obj_as(
|
94
|
-
type_=PaginatedSlimDocumentList, # type: ignore
|
95
|
-
object_=_response.json(),
|
96
|
-
),
|
97
|
-
)
|
98
|
-
_response_json = _response.json()
|
99
|
-
except JSONDecodeError:
|
100
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
101
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
94
|
+
return response.data
|
102
95
|
|
103
96
|
def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DocumentRead:
|
104
97
|
"""
|
@@ -128,25 +121,11 @@ class DocumentsClient:
|
|
128
121
|
id="id",
|
129
122
|
)
|
130
123
|
"""
|
131
|
-
|
132
|
-
|
133
|
-
base_url=self._client_wrapper.get_environment().default,
|
134
|
-
method="GET",
|
124
|
+
response = self._raw_client.retrieve(
|
125
|
+
id,
|
135
126
|
request_options=request_options,
|
136
127
|
)
|
137
|
-
|
138
|
-
if 200 <= _response.status_code < 300:
|
139
|
-
return typing.cast(
|
140
|
-
DocumentRead,
|
141
|
-
parse_obj_as(
|
142
|
-
type_=DocumentRead, # type: ignore
|
143
|
-
object_=_response.json(),
|
144
|
-
),
|
145
|
-
)
|
146
|
-
_response_json = _response.json()
|
147
|
-
except JSONDecodeError:
|
148
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
149
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
128
|
+
return response.data
|
150
129
|
|
151
130
|
def destroy(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
152
131
|
"""
|
@@ -175,19 +154,11 @@ class DocumentsClient:
|
|
175
154
|
id="id",
|
176
155
|
)
|
177
156
|
"""
|
178
|
-
|
179
|
-
|
180
|
-
base_url=self._client_wrapper.get_environment().documents,
|
181
|
-
method="DELETE",
|
157
|
+
response = self._raw_client.destroy(
|
158
|
+
id,
|
182
159
|
request_options=request_options,
|
183
160
|
)
|
184
|
-
|
185
|
-
if 200 <= _response.status_code < 300:
|
186
|
-
return
|
187
|
-
_response_json = _response.json()
|
188
|
-
except JSONDecodeError:
|
189
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
190
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
161
|
+
return response.data
|
191
162
|
|
192
163
|
def partial_update(
|
193
164
|
self,
|
@@ -240,35 +211,15 @@ class DocumentsClient:
|
|
240
211
|
id="id",
|
241
212
|
)
|
242
213
|
"""
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
"status": status,
|
250
|
-
"keywords": keywords,
|
251
|
-
"metadata": metadata,
|
252
|
-
},
|
253
|
-
headers={
|
254
|
-
"content-type": "application/json",
|
255
|
-
},
|
214
|
+
response = self._raw_client.partial_update(
|
215
|
+
id,
|
216
|
+
label=label,
|
217
|
+
status=status,
|
218
|
+
keywords=keywords,
|
219
|
+
metadata=metadata,
|
256
220
|
request_options=request_options,
|
257
|
-
omit=OMIT,
|
258
221
|
)
|
259
|
-
|
260
|
-
if 200 <= _response.status_code < 300:
|
261
|
-
return typing.cast(
|
262
|
-
DocumentRead,
|
263
|
-
parse_obj_as(
|
264
|
-
type_=DocumentRead, # type: ignore
|
265
|
-
object_=_response.json(),
|
266
|
-
),
|
267
|
-
)
|
268
|
-
_response_json = _response.json()
|
269
|
-
except JSONDecodeError:
|
270
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
271
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
222
|
+
return response.data
|
272
223
|
|
273
224
|
def upload(
|
274
225
|
self,
|
@@ -314,73 +265,34 @@ class DocumentsClient:
|
|
314
265
|
UploadDocumentResponse
|
315
266
|
|
316
267
|
"""
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
"label": label,
|
325
|
-
"keywords": keywords,
|
326
|
-
"metadata": metadata,
|
327
|
-
},
|
328
|
-
files={
|
329
|
-
"contents": contents,
|
330
|
-
},
|
268
|
+
response = self._raw_client.upload(
|
269
|
+
label=label,
|
270
|
+
contents=contents,
|
271
|
+
add_to_index_names=add_to_index_names,
|
272
|
+
external_id=external_id,
|
273
|
+
keywords=keywords,
|
274
|
+
metadata=metadata,
|
331
275
|
request_options=request_options,
|
332
|
-
omit=OMIT,
|
333
276
|
)
|
334
|
-
|
335
|
-
if 200 <= _response.status_code < 300:
|
336
|
-
return typing.cast(
|
337
|
-
UploadDocumentResponse,
|
338
|
-
parse_obj_as(
|
339
|
-
type_=UploadDocumentResponse, # type: ignore
|
340
|
-
object_=_response.json(),
|
341
|
-
),
|
342
|
-
)
|
343
|
-
if _response.status_code == 400:
|
344
|
-
raise BadRequestError(
|
345
|
-
typing.cast(
|
346
|
-
typing.Optional[typing.Any],
|
347
|
-
parse_obj_as(
|
348
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
349
|
-
object_=_response.json(),
|
350
|
-
),
|
351
|
-
)
|
352
|
-
)
|
353
|
-
if _response.status_code == 404:
|
354
|
-
raise NotFoundError(
|
355
|
-
typing.cast(
|
356
|
-
typing.Optional[typing.Any],
|
357
|
-
parse_obj_as(
|
358
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
359
|
-
object_=_response.json(),
|
360
|
-
),
|
361
|
-
)
|
362
|
-
)
|
363
|
-
if _response.status_code == 500:
|
364
|
-
raise InternalServerError(
|
365
|
-
typing.cast(
|
366
|
-
typing.Optional[typing.Any],
|
367
|
-
parse_obj_as(
|
368
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
369
|
-
object_=_response.json(),
|
370
|
-
),
|
371
|
-
)
|
372
|
-
)
|
373
|
-
_response_json = _response.json()
|
374
|
-
except JSONDecodeError:
|
375
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
376
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
277
|
+
return response.data
|
377
278
|
|
378
279
|
|
379
280
|
class AsyncDocumentsClient:
|
380
281
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
381
|
-
self.
|
282
|
+
self._raw_client = AsyncRawDocumentsClient(client_wrapper=client_wrapper)
|
283
|
+
|
284
|
+
@property
|
285
|
+
def with_raw_response(self) -> AsyncRawDocumentsClient:
|
286
|
+
"""
|
287
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
288
|
+
|
289
|
+
Returns
|
290
|
+
-------
|
291
|
+
AsyncRawDocumentsClient
|
292
|
+
"""
|
293
|
+
return self._raw_client
|
382
294
|
|
383
|
-
async def
|
295
|
+
async def list_(
|
384
296
|
self,
|
385
297
|
*,
|
386
298
|
document_index_id: typing.Optional[str] = None,
|
@@ -436,32 +348,15 @@ class AsyncDocumentsClient:
|
|
436
348
|
|
437
349
|
asyncio.run(main())
|
438
350
|
"""
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
"limit": limit,
|
446
|
-
"offset": offset,
|
447
|
-
"ordering": ordering,
|
448
|
-
"search": search,
|
449
|
-
},
|
351
|
+
response = await self._raw_client.list(
|
352
|
+
document_index_id=document_index_id,
|
353
|
+
limit=limit,
|
354
|
+
offset=offset,
|
355
|
+
ordering=ordering,
|
356
|
+
search=search,
|
450
357
|
request_options=request_options,
|
451
358
|
)
|
452
|
-
|
453
|
-
if 200 <= _response.status_code < 300:
|
454
|
-
return typing.cast(
|
455
|
-
PaginatedSlimDocumentList,
|
456
|
-
parse_obj_as(
|
457
|
-
type_=PaginatedSlimDocumentList, # type: ignore
|
458
|
-
object_=_response.json(),
|
459
|
-
),
|
460
|
-
)
|
461
|
-
_response_json = _response.json()
|
462
|
-
except JSONDecodeError:
|
463
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
464
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
359
|
+
return response.data
|
465
360
|
|
466
361
|
async def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DocumentRead:
|
467
362
|
"""
|
@@ -499,25 +394,11 @@ class AsyncDocumentsClient:
|
|
499
394
|
|
500
395
|
asyncio.run(main())
|
501
396
|
"""
|
502
|
-
|
503
|
-
|
504
|
-
base_url=self._client_wrapper.get_environment().default,
|
505
|
-
method="GET",
|
397
|
+
response = await self._raw_client.retrieve(
|
398
|
+
id,
|
506
399
|
request_options=request_options,
|
507
400
|
)
|
508
|
-
|
509
|
-
if 200 <= _response.status_code < 300:
|
510
|
-
return typing.cast(
|
511
|
-
DocumentRead,
|
512
|
-
parse_obj_as(
|
513
|
-
type_=DocumentRead, # type: ignore
|
514
|
-
object_=_response.json(),
|
515
|
-
),
|
516
|
-
)
|
517
|
-
_response_json = _response.json()
|
518
|
-
except JSONDecodeError:
|
519
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
520
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
401
|
+
return response.data
|
521
402
|
|
522
403
|
async def destroy(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
523
404
|
"""
|
@@ -554,19 +435,11 @@ class AsyncDocumentsClient:
|
|
554
435
|
|
555
436
|
asyncio.run(main())
|
556
437
|
"""
|
557
|
-
|
558
|
-
|
559
|
-
base_url=self._client_wrapper.get_environment().documents,
|
560
|
-
method="DELETE",
|
438
|
+
response = await self._raw_client.destroy(
|
439
|
+
id,
|
561
440
|
request_options=request_options,
|
562
441
|
)
|
563
|
-
|
564
|
-
if 200 <= _response.status_code < 300:
|
565
|
-
return
|
566
|
-
_response_json = _response.json()
|
567
|
-
except JSONDecodeError:
|
568
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
569
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
442
|
+
return response.data
|
570
443
|
|
571
444
|
async def partial_update(
|
572
445
|
self,
|
@@ -627,35 +500,15 @@ class AsyncDocumentsClient:
|
|
627
500
|
|
628
501
|
asyncio.run(main())
|
629
502
|
"""
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
"status": status,
|
637
|
-
"keywords": keywords,
|
638
|
-
"metadata": metadata,
|
639
|
-
},
|
640
|
-
headers={
|
641
|
-
"content-type": "application/json",
|
642
|
-
},
|
503
|
+
response = await self._raw_client.partial_update(
|
504
|
+
id,
|
505
|
+
label=label,
|
506
|
+
status=status,
|
507
|
+
keywords=keywords,
|
508
|
+
metadata=metadata,
|
643
509
|
request_options=request_options,
|
644
|
-
omit=OMIT,
|
645
510
|
)
|
646
|
-
|
647
|
-
if 200 <= _response.status_code < 300:
|
648
|
-
return typing.cast(
|
649
|
-
DocumentRead,
|
650
|
-
parse_obj_as(
|
651
|
-
type_=DocumentRead, # type: ignore
|
652
|
-
object_=_response.json(),
|
653
|
-
),
|
654
|
-
)
|
655
|
-
_response_json = _response.json()
|
656
|
-
except JSONDecodeError:
|
657
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
658
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
511
|
+
return response.data
|
659
512
|
|
660
513
|
async def upload(
|
661
514
|
self,
|
@@ -701,63 +554,13 @@ class AsyncDocumentsClient:
|
|
701
554
|
UploadDocumentResponse
|
702
555
|
|
703
556
|
"""
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
"label": label,
|
712
|
-
"keywords": keywords,
|
713
|
-
"metadata": metadata,
|
714
|
-
},
|
715
|
-
files={
|
716
|
-
"contents": contents,
|
717
|
-
},
|
557
|
+
response = await self._raw_client.upload(
|
558
|
+
label=label,
|
559
|
+
contents=contents,
|
560
|
+
add_to_index_names=add_to_index_names,
|
561
|
+
external_id=external_id,
|
562
|
+
keywords=keywords,
|
563
|
+
metadata=metadata,
|
718
564
|
request_options=request_options,
|
719
|
-
omit=OMIT,
|
720
565
|
)
|
721
|
-
|
722
|
-
if 200 <= _response.status_code < 300:
|
723
|
-
return typing.cast(
|
724
|
-
UploadDocumentResponse,
|
725
|
-
parse_obj_as(
|
726
|
-
type_=UploadDocumentResponse, # type: ignore
|
727
|
-
object_=_response.json(),
|
728
|
-
),
|
729
|
-
)
|
730
|
-
if _response.status_code == 400:
|
731
|
-
raise BadRequestError(
|
732
|
-
typing.cast(
|
733
|
-
typing.Optional[typing.Any],
|
734
|
-
parse_obj_as(
|
735
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
736
|
-
object_=_response.json(),
|
737
|
-
),
|
738
|
-
)
|
739
|
-
)
|
740
|
-
if _response.status_code == 404:
|
741
|
-
raise NotFoundError(
|
742
|
-
typing.cast(
|
743
|
-
typing.Optional[typing.Any],
|
744
|
-
parse_obj_as(
|
745
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
746
|
-
object_=_response.json(),
|
747
|
-
),
|
748
|
-
)
|
749
|
-
)
|
750
|
-
if _response.status_code == 500:
|
751
|
-
raise InternalServerError(
|
752
|
-
typing.cast(
|
753
|
-
typing.Optional[typing.Any],
|
754
|
-
parse_obj_as(
|
755
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
756
|
-
object_=_response.json(),
|
757
|
-
),
|
758
|
-
)
|
759
|
-
)
|
760
|
-
_response_json = _response.json()
|
761
|
-
except JSONDecodeError:
|
762
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
763
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
566
|
+
return response.data
|