vellum-ai 1.1.0__py3-none-any.whl → 1.1.2__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/client/README.md +0 -55
- vellum/client/__init__.py +159 -873
- 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/core/pydantic_utilities.py +10 -3
- vellum/client/raw_client.py +1561 -0
- vellum/client/reference.md +20 -693
- 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 +118 -362
- 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/core/http_response.py +3 -0
- vellum/raw_client.py +3 -0
- 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_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/METADATA +1 -1
- {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/RECORD +76 -33
- 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/workflows/base_workflow_display.py +2 -1
- {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/LICENSE +0 -0
- {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/WHEEL +0 -0
- {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,847 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
from ...core.client_wrapper import SyncClientWrapper
|
5
|
+
from .types.document_indexes_list_request_status import DocumentIndexesListRequestStatus
|
6
|
+
from ...core.request_options import RequestOptions
|
7
|
+
from ...core.http_response import HttpResponse
|
8
|
+
from ...types.paginated_document_index_read_list import PaginatedDocumentIndexReadList
|
9
|
+
from ...core.pydantic_utilities import parse_obj_as
|
10
|
+
from json.decoder import JSONDecodeError
|
11
|
+
from ...core.api_error import ApiError
|
12
|
+
from ...types.document_index_indexing_config_request import DocumentIndexIndexingConfigRequest
|
13
|
+
from ...types.entity_status import EntityStatus
|
14
|
+
from ...types.document_index_read import DocumentIndexRead
|
15
|
+
from ...core.serialization import convert_and_respect_annotation_metadata
|
16
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
17
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
18
|
+
from ...core.http_response import AsyncHttpResponse
|
19
|
+
|
20
|
+
# this is used as the default value for optional parameters
|
21
|
+
OMIT = typing.cast(typing.Any, ...)
|
22
|
+
|
23
|
+
|
24
|
+
class RawDocumentIndexesClient:
|
25
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
26
|
+
self._client_wrapper = client_wrapper
|
27
|
+
|
28
|
+
def list(
|
29
|
+
self,
|
30
|
+
*,
|
31
|
+
limit: typing.Optional[int] = None,
|
32
|
+
offset: typing.Optional[int] = None,
|
33
|
+
ordering: typing.Optional[str] = None,
|
34
|
+
search: typing.Optional[str] = None,
|
35
|
+
status: typing.Optional[DocumentIndexesListRequestStatus] = None,
|
36
|
+
request_options: typing.Optional[RequestOptions] = None,
|
37
|
+
) -> HttpResponse[PaginatedDocumentIndexReadList]:
|
38
|
+
"""
|
39
|
+
Used to retrieve a list of Document Indexes.
|
40
|
+
|
41
|
+
Parameters
|
42
|
+
----------
|
43
|
+
limit : typing.Optional[int]
|
44
|
+
Number of results to return per page.
|
45
|
+
|
46
|
+
offset : typing.Optional[int]
|
47
|
+
The initial index from which to return the results.
|
48
|
+
|
49
|
+
ordering : typing.Optional[str]
|
50
|
+
Which field to use when ordering the results.
|
51
|
+
|
52
|
+
search : typing.Optional[str]
|
53
|
+
Search for document indices by name or label
|
54
|
+
|
55
|
+
status : typing.Optional[DocumentIndexesListRequestStatus]
|
56
|
+
Filter down to only document indices that have a status matching the status specified
|
57
|
+
|
58
|
+
* `ACTIVE` - Active
|
59
|
+
* `ARCHIVED` - Archived
|
60
|
+
|
61
|
+
request_options : typing.Optional[RequestOptions]
|
62
|
+
Request-specific configuration.
|
63
|
+
|
64
|
+
Returns
|
65
|
+
-------
|
66
|
+
HttpResponse[PaginatedDocumentIndexReadList]
|
67
|
+
|
68
|
+
"""
|
69
|
+
_response = self._client_wrapper.httpx_client.request(
|
70
|
+
"v1/document-indexes",
|
71
|
+
base_url=self._client_wrapper.get_environment().default,
|
72
|
+
method="GET",
|
73
|
+
params={
|
74
|
+
"limit": limit,
|
75
|
+
"offset": offset,
|
76
|
+
"ordering": ordering,
|
77
|
+
"search": search,
|
78
|
+
"status": status,
|
79
|
+
},
|
80
|
+
request_options=request_options,
|
81
|
+
)
|
82
|
+
try:
|
83
|
+
if 200 <= _response.status_code < 300:
|
84
|
+
_data = typing.cast(
|
85
|
+
PaginatedDocumentIndexReadList,
|
86
|
+
parse_obj_as(
|
87
|
+
type_=PaginatedDocumentIndexReadList, # type: ignore
|
88
|
+
object_=_response.json(),
|
89
|
+
),
|
90
|
+
)
|
91
|
+
return HttpResponse(response=_response, data=_data)
|
92
|
+
_response_json = _response.json()
|
93
|
+
except JSONDecodeError:
|
94
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
95
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
96
|
+
|
97
|
+
def create(
|
98
|
+
self,
|
99
|
+
*,
|
100
|
+
label: str,
|
101
|
+
name: str,
|
102
|
+
indexing_config: DocumentIndexIndexingConfigRequest,
|
103
|
+
status: typing.Optional[EntityStatus] = OMIT,
|
104
|
+
copy_documents_from_index_id: typing.Optional[str] = OMIT,
|
105
|
+
request_options: typing.Optional[RequestOptions] = None,
|
106
|
+
) -> HttpResponse[DocumentIndexRead]:
|
107
|
+
"""
|
108
|
+
Creates a new document index.
|
109
|
+
|
110
|
+
Parameters
|
111
|
+
----------
|
112
|
+
label : str
|
113
|
+
A human-readable label for the document index
|
114
|
+
|
115
|
+
name : str
|
116
|
+
A name that uniquely identifies this index within its workspace
|
117
|
+
|
118
|
+
indexing_config : DocumentIndexIndexingConfigRequest
|
119
|
+
|
120
|
+
status : typing.Optional[EntityStatus]
|
121
|
+
The current status of the document index
|
122
|
+
|
123
|
+
* `ACTIVE` - Active
|
124
|
+
* `ARCHIVED` - Archived
|
125
|
+
|
126
|
+
copy_documents_from_index_id : typing.Optional[str]
|
127
|
+
Optionally specify the id of a document index from which you'd like to copy and re-index its documents into this newly created index
|
128
|
+
|
129
|
+
request_options : typing.Optional[RequestOptions]
|
130
|
+
Request-specific configuration.
|
131
|
+
|
132
|
+
Returns
|
133
|
+
-------
|
134
|
+
HttpResponse[DocumentIndexRead]
|
135
|
+
|
136
|
+
"""
|
137
|
+
_response = self._client_wrapper.httpx_client.request(
|
138
|
+
"v1/document-indexes",
|
139
|
+
base_url=self._client_wrapper.get_environment().default,
|
140
|
+
method="POST",
|
141
|
+
json={
|
142
|
+
"label": label,
|
143
|
+
"name": name,
|
144
|
+
"status": status,
|
145
|
+
"indexing_config": convert_and_respect_annotation_metadata(
|
146
|
+
object_=indexing_config, annotation=DocumentIndexIndexingConfigRequest, direction="write"
|
147
|
+
),
|
148
|
+
"copy_documents_from_index_id": copy_documents_from_index_id,
|
149
|
+
},
|
150
|
+
headers={
|
151
|
+
"content-type": "application/json",
|
152
|
+
},
|
153
|
+
request_options=request_options,
|
154
|
+
omit=OMIT,
|
155
|
+
)
|
156
|
+
try:
|
157
|
+
if 200 <= _response.status_code < 300:
|
158
|
+
_data = typing.cast(
|
159
|
+
DocumentIndexRead,
|
160
|
+
parse_obj_as(
|
161
|
+
type_=DocumentIndexRead, # type: ignore
|
162
|
+
object_=_response.json(),
|
163
|
+
),
|
164
|
+
)
|
165
|
+
return HttpResponse(response=_response, data=_data)
|
166
|
+
_response_json = _response.json()
|
167
|
+
except JSONDecodeError:
|
168
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
169
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
170
|
+
|
171
|
+
def retrieve(
|
172
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
173
|
+
) -> HttpResponse[DocumentIndexRead]:
|
174
|
+
"""
|
175
|
+
Used to retrieve a Document Index given its ID or name.
|
176
|
+
|
177
|
+
Parameters
|
178
|
+
----------
|
179
|
+
id : str
|
180
|
+
Either the Document Index's ID or its unique name
|
181
|
+
|
182
|
+
request_options : typing.Optional[RequestOptions]
|
183
|
+
Request-specific configuration.
|
184
|
+
|
185
|
+
Returns
|
186
|
+
-------
|
187
|
+
HttpResponse[DocumentIndexRead]
|
188
|
+
|
189
|
+
"""
|
190
|
+
_response = self._client_wrapper.httpx_client.request(
|
191
|
+
f"v1/document-indexes/{jsonable_encoder(id)}",
|
192
|
+
base_url=self._client_wrapper.get_environment().default,
|
193
|
+
method="GET",
|
194
|
+
request_options=request_options,
|
195
|
+
)
|
196
|
+
try:
|
197
|
+
if 200 <= _response.status_code < 300:
|
198
|
+
_data = typing.cast(
|
199
|
+
DocumentIndexRead,
|
200
|
+
parse_obj_as(
|
201
|
+
type_=DocumentIndexRead, # type: ignore
|
202
|
+
object_=_response.json(),
|
203
|
+
),
|
204
|
+
)
|
205
|
+
return HttpResponse(response=_response, data=_data)
|
206
|
+
_response_json = _response.json()
|
207
|
+
except JSONDecodeError:
|
208
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
209
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
210
|
+
|
211
|
+
def update(
|
212
|
+
self,
|
213
|
+
id: str,
|
214
|
+
*,
|
215
|
+
label: str,
|
216
|
+
status: typing.Optional[EntityStatus] = OMIT,
|
217
|
+
request_options: typing.Optional[RequestOptions] = None,
|
218
|
+
) -> HttpResponse[DocumentIndexRead]:
|
219
|
+
"""
|
220
|
+
Used to fully update a Document Index given its ID or name.
|
221
|
+
|
222
|
+
Parameters
|
223
|
+
----------
|
224
|
+
id : str
|
225
|
+
Either the Document Index's ID or its unique name
|
226
|
+
|
227
|
+
label : str
|
228
|
+
A human-readable label for the document index
|
229
|
+
|
230
|
+
status : typing.Optional[EntityStatus]
|
231
|
+
The current status of the document index
|
232
|
+
|
233
|
+
* `ACTIVE` - Active
|
234
|
+
* `ARCHIVED` - Archived
|
235
|
+
|
236
|
+
request_options : typing.Optional[RequestOptions]
|
237
|
+
Request-specific configuration.
|
238
|
+
|
239
|
+
Returns
|
240
|
+
-------
|
241
|
+
HttpResponse[DocumentIndexRead]
|
242
|
+
|
243
|
+
"""
|
244
|
+
_response = self._client_wrapper.httpx_client.request(
|
245
|
+
f"v1/document-indexes/{jsonable_encoder(id)}",
|
246
|
+
base_url=self._client_wrapper.get_environment().default,
|
247
|
+
method="PUT",
|
248
|
+
json={
|
249
|
+
"label": label,
|
250
|
+
"status": status,
|
251
|
+
},
|
252
|
+
headers={
|
253
|
+
"content-type": "application/json",
|
254
|
+
},
|
255
|
+
request_options=request_options,
|
256
|
+
omit=OMIT,
|
257
|
+
)
|
258
|
+
try:
|
259
|
+
if 200 <= _response.status_code < 300:
|
260
|
+
_data = typing.cast(
|
261
|
+
DocumentIndexRead,
|
262
|
+
parse_obj_as(
|
263
|
+
type_=DocumentIndexRead, # type: ignore
|
264
|
+
object_=_response.json(),
|
265
|
+
),
|
266
|
+
)
|
267
|
+
return HttpResponse(response=_response, data=_data)
|
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)
|
272
|
+
|
273
|
+
def destroy(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
|
274
|
+
"""
|
275
|
+
Used to delete a Document Index given its ID or name.
|
276
|
+
|
277
|
+
Parameters
|
278
|
+
----------
|
279
|
+
id : str
|
280
|
+
Either the Document Index's ID or its unique name
|
281
|
+
|
282
|
+
request_options : typing.Optional[RequestOptions]
|
283
|
+
Request-specific configuration.
|
284
|
+
|
285
|
+
Returns
|
286
|
+
-------
|
287
|
+
HttpResponse[None]
|
288
|
+
"""
|
289
|
+
_response = self._client_wrapper.httpx_client.request(
|
290
|
+
f"v1/document-indexes/{jsonable_encoder(id)}",
|
291
|
+
base_url=self._client_wrapper.get_environment().documents,
|
292
|
+
method="DELETE",
|
293
|
+
request_options=request_options,
|
294
|
+
)
|
295
|
+
try:
|
296
|
+
if 200 <= _response.status_code < 300:
|
297
|
+
return HttpResponse(response=_response, data=None)
|
298
|
+
_response_json = _response.json()
|
299
|
+
except JSONDecodeError:
|
300
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
301
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
302
|
+
|
303
|
+
def partial_update(
|
304
|
+
self,
|
305
|
+
id: str,
|
306
|
+
*,
|
307
|
+
label: typing.Optional[str] = OMIT,
|
308
|
+
status: typing.Optional[EntityStatus] = OMIT,
|
309
|
+
request_options: typing.Optional[RequestOptions] = None,
|
310
|
+
) -> HttpResponse[DocumentIndexRead]:
|
311
|
+
"""
|
312
|
+
Used to partial update a Document Index given its ID or name.
|
313
|
+
|
314
|
+
Parameters
|
315
|
+
----------
|
316
|
+
id : str
|
317
|
+
Either the Document Index's ID or its unique name
|
318
|
+
|
319
|
+
label : typing.Optional[str]
|
320
|
+
A human-readable label for the document index
|
321
|
+
|
322
|
+
status : typing.Optional[EntityStatus]
|
323
|
+
The current status of the document index
|
324
|
+
|
325
|
+
* `ACTIVE` - Active
|
326
|
+
* `ARCHIVED` - Archived
|
327
|
+
|
328
|
+
request_options : typing.Optional[RequestOptions]
|
329
|
+
Request-specific configuration.
|
330
|
+
|
331
|
+
Returns
|
332
|
+
-------
|
333
|
+
HttpResponse[DocumentIndexRead]
|
334
|
+
|
335
|
+
"""
|
336
|
+
_response = self._client_wrapper.httpx_client.request(
|
337
|
+
f"v1/document-indexes/{jsonable_encoder(id)}",
|
338
|
+
base_url=self._client_wrapper.get_environment().default,
|
339
|
+
method="PATCH",
|
340
|
+
json={
|
341
|
+
"label": label,
|
342
|
+
"status": status,
|
343
|
+
},
|
344
|
+
headers={
|
345
|
+
"content-type": "application/json",
|
346
|
+
},
|
347
|
+
request_options=request_options,
|
348
|
+
omit=OMIT,
|
349
|
+
)
|
350
|
+
try:
|
351
|
+
if 200 <= _response.status_code < 300:
|
352
|
+
_data = typing.cast(
|
353
|
+
DocumentIndexRead,
|
354
|
+
parse_obj_as(
|
355
|
+
type_=DocumentIndexRead, # type: ignore
|
356
|
+
object_=_response.json(),
|
357
|
+
),
|
358
|
+
)
|
359
|
+
return HttpResponse(response=_response, data=_data)
|
360
|
+
_response_json = _response.json()
|
361
|
+
except JSONDecodeError:
|
362
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
363
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
364
|
+
|
365
|
+
def add_document(
|
366
|
+
self, document_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
367
|
+
) -> HttpResponse[None]:
|
368
|
+
"""
|
369
|
+
Adds a previously uploaded Document to the specified Document Index.
|
370
|
+
|
371
|
+
Parameters
|
372
|
+
----------
|
373
|
+
document_id : str
|
374
|
+
Either the Vellum-generated ID or the originally supplied external_id that uniquely identifies the Document you'd like to add.
|
375
|
+
|
376
|
+
id : str
|
377
|
+
Either the Vellum-generated ID or the originally specified name that uniquely identifies the Document Index to which you'd like to add the Document.
|
378
|
+
|
379
|
+
request_options : typing.Optional[RequestOptions]
|
380
|
+
Request-specific configuration.
|
381
|
+
|
382
|
+
Returns
|
383
|
+
-------
|
384
|
+
HttpResponse[None]
|
385
|
+
"""
|
386
|
+
_response = self._client_wrapper.httpx_client.request(
|
387
|
+
f"v1/document-indexes/{jsonable_encoder(id)}/documents/{jsonable_encoder(document_id)}",
|
388
|
+
base_url=self._client_wrapper.get_environment().default,
|
389
|
+
method="POST",
|
390
|
+
request_options=request_options,
|
391
|
+
)
|
392
|
+
try:
|
393
|
+
if 200 <= _response.status_code < 300:
|
394
|
+
return HttpResponse(response=_response, data=None)
|
395
|
+
_response_json = _response.json()
|
396
|
+
except JSONDecodeError:
|
397
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
398
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
399
|
+
|
400
|
+
def remove_document(
|
401
|
+
self, document_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
402
|
+
) -> HttpResponse[None]:
|
403
|
+
"""
|
404
|
+
Removes a Document from a Document Index without deleting the Document itself.
|
405
|
+
|
406
|
+
Parameters
|
407
|
+
----------
|
408
|
+
document_id : str
|
409
|
+
Either the Vellum-generated ID or the originally supplied external_id that uniquely identifies the Document you'd like to remove.
|
410
|
+
|
411
|
+
id : str
|
412
|
+
Either the Vellum-generated ID or the originally specified name that uniquely identifies the Document Index from which you'd like to remove a Document.
|
413
|
+
|
414
|
+
request_options : typing.Optional[RequestOptions]
|
415
|
+
Request-specific configuration.
|
416
|
+
|
417
|
+
Returns
|
418
|
+
-------
|
419
|
+
HttpResponse[None]
|
420
|
+
"""
|
421
|
+
_response = self._client_wrapper.httpx_client.request(
|
422
|
+
f"v1/document-indexes/{jsonable_encoder(id)}/documents/{jsonable_encoder(document_id)}",
|
423
|
+
base_url=self._client_wrapper.get_environment().documents,
|
424
|
+
method="DELETE",
|
425
|
+
request_options=request_options,
|
426
|
+
)
|
427
|
+
try:
|
428
|
+
if 200 <= _response.status_code < 300:
|
429
|
+
return HttpResponse(response=_response, data=None)
|
430
|
+
_response_json = _response.json()
|
431
|
+
except JSONDecodeError:
|
432
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
433
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
434
|
+
|
435
|
+
|
436
|
+
class AsyncRawDocumentIndexesClient:
|
437
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
438
|
+
self._client_wrapper = client_wrapper
|
439
|
+
|
440
|
+
async def list(
|
441
|
+
self,
|
442
|
+
*,
|
443
|
+
limit: typing.Optional[int] = None,
|
444
|
+
offset: typing.Optional[int] = None,
|
445
|
+
ordering: typing.Optional[str] = None,
|
446
|
+
search: typing.Optional[str] = None,
|
447
|
+
status: typing.Optional[DocumentIndexesListRequestStatus] = None,
|
448
|
+
request_options: typing.Optional[RequestOptions] = None,
|
449
|
+
) -> AsyncHttpResponse[PaginatedDocumentIndexReadList]:
|
450
|
+
"""
|
451
|
+
Used to retrieve a list of Document Indexes.
|
452
|
+
|
453
|
+
Parameters
|
454
|
+
----------
|
455
|
+
limit : typing.Optional[int]
|
456
|
+
Number of results to return per page.
|
457
|
+
|
458
|
+
offset : typing.Optional[int]
|
459
|
+
The initial index from which to return the results.
|
460
|
+
|
461
|
+
ordering : typing.Optional[str]
|
462
|
+
Which field to use when ordering the results.
|
463
|
+
|
464
|
+
search : typing.Optional[str]
|
465
|
+
Search for document indices by name or label
|
466
|
+
|
467
|
+
status : typing.Optional[DocumentIndexesListRequestStatus]
|
468
|
+
Filter down to only document indices that have a status matching the status specified
|
469
|
+
|
470
|
+
* `ACTIVE` - Active
|
471
|
+
* `ARCHIVED` - Archived
|
472
|
+
|
473
|
+
request_options : typing.Optional[RequestOptions]
|
474
|
+
Request-specific configuration.
|
475
|
+
|
476
|
+
Returns
|
477
|
+
-------
|
478
|
+
AsyncHttpResponse[PaginatedDocumentIndexReadList]
|
479
|
+
|
480
|
+
"""
|
481
|
+
_response = await self._client_wrapper.httpx_client.request(
|
482
|
+
"v1/document-indexes",
|
483
|
+
base_url=self._client_wrapper.get_environment().default,
|
484
|
+
method="GET",
|
485
|
+
params={
|
486
|
+
"limit": limit,
|
487
|
+
"offset": offset,
|
488
|
+
"ordering": ordering,
|
489
|
+
"search": search,
|
490
|
+
"status": status,
|
491
|
+
},
|
492
|
+
request_options=request_options,
|
493
|
+
)
|
494
|
+
try:
|
495
|
+
if 200 <= _response.status_code < 300:
|
496
|
+
_data = typing.cast(
|
497
|
+
PaginatedDocumentIndexReadList,
|
498
|
+
parse_obj_as(
|
499
|
+
type_=PaginatedDocumentIndexReadList, # type: ignore
|
500
|
+
object_=_response.json(),
|
501
|
+
),
|
502
|
+
)
|
503
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
504
|
+
_response_json = _response.json()
|
505
|
+
except JSONDecodeError:
|
506
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
507
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
508
|
+
|
509
|
+
async def create(
|
510
|
+
self,
|
511
|
+
*,
|
512
|
+
label: str,
|
513
|
+
name: str,
|
514
|
+
indexing_config: DocumentIndexIndexingConfigRequest,
|
515
|
+
status: typing.Optional[EntityStatus] = OMIT,
|
516
|
+
copy_documents_from_index_id: typing.Optional[str] = OMIT,
|
517
|
+
request_options: typing.Optional[RequestOptions] = None,
|
518
|
+
) -> AsyncHttpResponse[DocumentIndexRead]:
|
519
|
+
"""
|
520
|
+
Creates a new document index.
|
521
|
+
|
522
|
+
Parameters
|
523
|
+
----------
|
524
|
+
label : str
|
525
|
+
A human-readable label for the document index
|
526
|
+
|
527
|
+
name : str
|
528
|
+
A name that uniquely identifies this index within its workspace
|
529
|
+
|
530
|
+
indexing_config : DocumentIndexIndexingConfigRequest
|
531
|
+
|
532
|
+
status : typing.Optional[EntityStatus]
|
533
|
+
The current status of the document index
|
534
|
+
|
535
|
+
* `ACTIVE` - Active
|
536
|
+
* `ARCHIVED` - Archived
|
537
|
+
|
538
|
+
copy_documents_from_index_id : typing.Optional[str]
|
539
|
+
Optionally specify the id of a document index from which you'd like to copy and re-index its documents into this newly created index
|
540
|
+
|
541
|
+
request_options : typing.Optional[RequestOptions]
|
542
|
+
Request-specific configuration.
|
543
|
+
|
544
|
+
Returns
|
545
|
+
-------
|
546
|
+
AsyncHttpResponse[DocumentIndexRead]
|
547
|
+
|
548
|
+
"""
|
549
|
+
_response = await self._client_wrapper.httpx_client.request(
|
550
|
+
"v1/document-indexes",
|
551
|
+
base_url=self._client_wrapper.get_environment().default,
|
552
|
+
method="POST",
|
553
|
+
json={
|
554
|
+
"label": label,
|
555
|
+
"name": name,
|
556
|
+
"status": status,
|
557
|
+
"indexing_config": convert_and_respect_annotation_metadata(
|
558
|
+
object_=indexing_config, annotation=DocumentIndexIndexingConfigRequest, direction="write"
|
559
|
+
),
|
560
|
+
"copy_documents_from_index_id": copy_documents_from_index_id,
|
561
|
+
},
|
562
|
+
headers={
|
563
|
+
"content-type": "application/json",
|
564
|
+
},
|
565
|
+
request_options=request_options,
|
566
|
+
omit=OMIT,
|
567
|
+
)
|
568
|
+
try:
|
569
|
+
if 200 <= _response.status_code < 300:
|
570
|
+
_data = typing.cast(
|
571
|
+
DocumentIndexRead,
|
572
|
+
parse_obj_as(
|
573
|
+
type_=DocumentIndexRead, # type: ignore
|
574
|
+
object_=_response.json(),
|
575
|
+
),
|
576
|
+
)
|
577
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
578
|
+
_response_json = _response.json()
|
579
|
+
except JSONDecodeError:
|
580
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
581
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
582
|
+
|
583
|
+
async def retrieve(
|
584
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
585
|
+
) -> AsyncHttpResponse[DocumentIndexRead]:
|
586
|
+
"""
|
587
|
+
Used to retrieve a Document Index given its ID or name.
|
588
|
+
|
589
|
+
Parameters
|
590
|
+
----------
|
591
|
+
id : str
|
592
|
+
Either the Document Index's ID or its unique name
|
593
|
+
|
594
|
+
request_options : typing.Optional[RequestOptions]
|
595
|
+
Request-specific configuration.
|
596
|
+
|
597
|
+
Returns
|
598
|
+
-------
|
599
|
+
AsyncHttpResponse[DocumentIndexRead]
|
600
|
+
|
601
|
+
"""
|
602
|
+
_response = await self._client_wrapper.httpx_client.request(
|
603
|
+
f"v1/document-indexes/{jsonable_encoder(id)}",
|
604
|
+
base_url=self._client_wrapper.get_environment().default,
|
605
|
+
method="GET",
|
606
|
+
request_options=request_options,
|
607
|
+
)
|
608
|
+
try:
|
609
|
+
if 200 <= _response.status_code < 300:
|
610
|
+
_data = typing.cast(
|
611
|
+
DocumentIndexRead,
|
612
|
+
parse_obj_as(
|
613
|
+
type_=DocumentIndexRead, # type: ignore
|
614
|
+
object_=_response.json(),
|
615
|
+
),
|
616
|
+
)
|
617
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
618
|
+
_response_json = _response.json()
|
619
|
+
except JSONDecodeError:
|
620
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
621
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
622
|
+
|
623
|
+
async def update(
|
624
|
+
self,
|
625
|
+
id: str,
|
626
|
+
*,
|
627
|
+
label: str,
|
628
|
+
status: typing.Optional[EntityStatus] = OMIT,
|
629
|
+
request_options: typing.Optional[RequestOptions] = None,
|
630
|
+
) -> AsyncHttpResponse[DocumentIndexRead]:
|
631
|
+
"""
|
632
|
+
Used to fully update a Document Index given its ID or name.
|
633
|
+
|
634
|
+
Parameters
|
635
|
+
----------
|
636
|
+
id : str
|
637
|
+
Either the Document Index's ID or its unique name
|
638
|
+
|
639
|
+
label : str
|
640
|
+
A human-readable label for the document index
|
641
|
+
|
642
|
+
status : typing.Optional[EntityStatus]
|
643
|
+
The current status of the document index
|
644
|
+
|
645
|
+
* `ACTIVE` - Active
|
646
|
+
* `ARCHIVED` - Archived
|
647
|
+
|
648
|
+
request_options : typing.Optional[RequestOptions]
|
649
|
+
Request-specific configuration.
|
650
|
+
|
651
|
+
Returns
|
652
|
+
-------
|
653
|
+
AsyncHttpResponse[DocumentIndexRead]
|
654
|
+
|
655
|
+
"""
|
656
|
+
_response = await self._client_wrapper.httpx_client.request(
|
657
|
+
f"v1/document-indexes/{jsonable_encoder(id)}",
|
658
|
+
base_url=self._client_wrapper.get_environment().default,
|
659
|
+
method="PUT",
|
660
|
+
json={
|
661
|
+
"label": label,
|
662
|
+
"status": status,
|
663
|
+
},
|
664
|
+
headers={
|
665
|
+
"content-type": "application/json",
|
666
|
+
},
|
667
|
+
request_options=request_options,
|
668
|
+
omit=OMIT,
|
669
|
+
)
|
670
|
+
try:
|
671
|
+
if 200 <= _response.status_code < 300:
|
672
|
+
_data = typing.cast(
|
673
|
+
DocumentIndexRead,
|
674
|
+
parse_obj_as(
|
675
|
+
type_=DocumentIndexRead, # type: ignore
|
676
|
+
object_=_response.json(),
|
677
|
+
),
|
678
|
+
)
|
679
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
680
|
+
_response_json = _response.json()
|
681
|
+
except JSONDecodeError:
|
682
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
683
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
684
|
+
|
685
|
+
async def destroy(
|
686
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
687
|
+
) -> AsyncHttpResponse[None]:
|
688
|
+
"""
|
689
|
+
Used to delete a Document Index given its ID or name.
|
690
|
+
|
691
|
+
Parameters
|
692
|
+
----------
|
693
|
+
id : str
|
694
|
+
Either the Document Index's ID or its unique name
|
695
|
+
|
696
|
+
request_options : typing.Optional[RequestOptions]
|
697
|
+
Request-specific configuration.
|
698
|
+
|
699
|
+
Returns
|
700
|
+
-------
|
701
|
+
AsyncHttpResponse[None]
|
702
|
+
"""
|
703
|
+
_response = await self._client_wrapper.httpx_client.request(
|
704
|
+
f"v1/document-indexes/{jsonable_encoder(id)}",
|
705
|
+
base_url=self._client_wrapper.get_environment().documents,
|
706
|
+
method="DELETE",
|
707
|
+
request_options=request_options,
|
708
|
+
)
|
709
|
+
try:
|
710
|
+
if 200 <= _response.status_code < 300:
|
711
|
+
return AsyncHttpResponse(response=_response, data=None)
|
712
|
+
_response_json = _response.json()
|
713
|
+
except JSONDecodeError:
|
714
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
715
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
716
|
+
|
717
|
+
async def partial_update(
|
718
|
+
self,
|
719
|
+
id: str,
|
720
|
+
*,
|
721
|
+
label: typing.Optional[str] = OMIT,
|
722
|
+
status: typing.Optional[EntityStatus] = OMIT,
|
723
|
+
request_options: typing.Optional[RequestOptions] = None,
|
724
|
+
) -> AsyncHttpResponse[DocumentIndexRead]:
|
725
|
+
"""
|
726
|
+
Used to partial update a Document Index given its ID or name.
|
727
|
+
|
728
|
+
Parameters
|
729
|
+
----------
|
730
|
+
id : str
|
731
|
+
Either the Document Index's ID or its unique name
|
732
|
+
|
733
|
+
label : typing.Optional[str]
|
734
|
+
A human-readable label for the document index
|
735
|
+
|
736
|
+
status : typing.Optional[EntityStatus]
|
737
|
+
The current status of the document index
|
738
|
+
|
739
|
+
* `ACTIVE` - Active
|
740
|
+
* `ARCHIVED` - Archived
|
741
|
+
|
742
|
+
request_options : typing.Optional[RequestOptions]
|
743
|
+
Request-specific configuration.
|
744
|
+
|
745
|
+
Returns
|
746
|
+
-------
|
747
|
+
AsyncHttpResponse[DocumentIndexRead]
|
748
|
+
|
749
|
+
"""
|
750
|
+
_response = await self._client_wrapper.httpx_client.request(
|
751
|
+
f"v1/document-indexes/{jsonable_encoder(id)}",
|
752
|
+
base_url=self._client_wrapper.get_environment().default,
|
753
|
+
method="PATCH",
|
754
|
+
json={
|
755
|
+
"label": label,
|
756
|
+
"status": status,
|
757
|
+
},
|
758
|
+
headers={
|
759
|
+
"content-type": "application/json",
|
760
|
+
},
|
761
|
+
request_options=request_options,
|
762
|
+
omit=OMIT,
|
763
|
+
)
|
764
|
+
try:
|
765
|
+
if 200 <= _response.status_code < 300:
|
766
|
+
_data = typing.cast(
|
767
|
+
DocumentIndexRead,
|
768
|
+
parse_obj_as(
|
769
|
+
type_=DocumentIndexRead, # type: ignore
|
770
|
+
object_=_response.json(),
|
771
|
+
),
|
772
|
+
)
|
773
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
774
|
+
_response_json = _response.json()
|
775
|
+
except JSONDecodeError:
|
776
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
777
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
778
|
+
|
779
|
+
async def add_document(
|
780
|
+
self, document_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
781
|
+
) -> AsyncHttpResponse[None]:
|
782
|
+
"""
|
783
|
+
Adds a previously uploaded Document to the specified Document Index.
|
784
|
+
|
785
|
+
Parameters
|
786
|
+
----------
|
787
|
+
document_id : str
|
788
|
+
Either the Vellum-generated ID or the originally supplied external_id that uniquely identifies the Document you'd like to add.
|
789
|
+
|
790
|
+
id : str
|
791
|
+
Either the Vellum-generated ID or the originally specified name that uniquely identifies the Document Index to which you'd like to add the Document.
|
792
|
+
|
793
|
+
request_options : typing.Optional[RequestOptions]
|
794
|
+
Request-specific configuration.
|
795
|
+
|
796
|
+
Returns
|
797
|
+
-------
|
798
|
+
AsyncHttpResponse[None]
|
799
|
+
"""
|
800
|
+
_response = await self._client_wrapper.httpx_client.request(
|
801
|
+
f"v1/document-indexes/{jsonable_encoder(id)}/documents/{jsonable_encoder(document_id)}",
|
802
|
+
base_url=self._client_wrapper.get_environment().default,
|
803
|
+
method="POST",
|
804
|
+
request_options=request_options,
|
805
|
+
)
|
806
|
+
try:
|
807
|
+
if 200 <= _response.status_code < 300:
|
808
|
+
return AsyncHttpResponse(response=_response, data=None)
|
809
|
+
_response_json = _response.json()
|
810
|
+
except JSONDecodeError:
|
811
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
812
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
813
|
+
|
814
|
+
async def remove_document(
|
815
|
+
self, document_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
816
|
+
) -> AsyncHttpResponse[None]:
|
817
|
+
"""
|
818
|
+
Removes a Document from a Document Index without deleting the Document itself.
|
819
|
+
|
820
|
+
Parameters
|
821
|
+
----------
|
822
|
+
document_id : str
|
823
|
+
Either the Vellum-generated ID or the originally supplied external_id that uniquely identifies the Document you'd like to remove.
|
824
|
+
|
825
|
+
id : str
|
826
|
+
Either the Vellum-generated ID or the originally specified name that uniquely identifies the Document Index from which you'd like to remove a Document.
|
827
|
+
|
828
|
+
request_options : typing.Optional[RequestOptions]
|
829
|
+
Request-specific configuration.
|
830
|
+
|
831
|
+
Returns
|
832
|
+
-------
|
833
|
+
AsyncHttpResponse[None]
|
834
|
+
"""
|
835
|
+
_response = await self._client_wrapper.httpx_client.request(
|
836
|
+
f"v1/document-indexes/{jsonable_encoder(id)}/documents/{jsonable_encoder(document_id)}",
|
837
|
+
base_url=self._client_wrapper.get_environment().documents,
|
838
|
+
method="DELETE",
|
839
|
+
request_options=request_options,
|
840
|
+
)
|
841
|
+
try:
|
842
|
+
if 200 <= _response.status_code < 300:
|
843
|
+
return AsyncHttpResponse(response=_response, data=None)
|
844
|
+
_response_json = _response.json()
|
845
|
+
except JSONDecodeError:
|
846
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
847
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|