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.
Files changed (76) hide show
  1. vellum/client/README.md +0 -55
  2. vellum/client/__init__.py +159 -873
  3. vellum/client/core/__init__.py +3 -0
  4. vellum/client/core/client_wrapper.py +2 -2
  5. vellum/client/core/http_response.py +47 -0
  6. vellum/client/core/pydantic_utilities.py +10 -3
  7. vellum/client/raw_client.py +1561 -0
  8. vellum/client/reference.md +20 -693
  9. vellum/client/resources/ad_hoc/client.py +55 -161
  10. vellum/client/resources/ad_hoc/raw_client.py +278 -0
  11. vellum/client/resources/container_images/client.py +62 -172
  12. vellum/client/resources/container_images/raw_client.py +400 -0
  13. vellum/client/resources/deployments/client.py +112 -437
  14. vellum/client/resources/deployments/raw_client.py +995 -0
  15. vellum/client/resources/document_indexes/client.py +108 -317
  16. vellum/client/resources/document_indexes/raw_client.py +847 -0
  17. vellum/client/resources/documents/client.py +88 -285
  18. vellum/client/resources/documents/raw_client.py +655 -0
  19. vellum/client/resources/folder_entities/client.py +54 -92
  20. vellum/client/resources/folder_entities/raw_client.py +277 -0
  21. vellum/client/resources/metric_definitions/client.py +48 -95
  22. vellum/client/resources/metric_definitions/raw_client.py +225 -0
  23. vellum/client/resources/ml_models/client.py +36 -40
  24. vellum/client/resources/ml_models/raw_client.py +103 -0
  25. vellum/client/resources/organizations/client.py +34 -39
  26. vellum/client/resources/organizations/raw_client.py +96 -0
  27. vellum/client/resources/prompts/client.py +50 -193
  28. vellum/client/resources/prompts/raw_client.py +346 -0
  29. vellum/client/resources/sandboxes/client.py +68 -141
  30. vellum/client/resources/sandboxes/raw_client.py +393 -0
  31. vellum/client/resources/test_suite_runs/client.py +58 -141
  32. vellum/client/resources/test_suite_runs/raw_client.py +355 -0
  33. vellum/client/resources/test_suites/client.py +73 -141
  34. vellum/client/resources/test_suites/raw_client.py +379 -0
  35. vellum/client/resources/workflow_deployments/client.py +118 -362
  36. vellum/client/resources/workflow_deployments/raw_client.py +931 -0
  37. vellum/client/resources/workflow_executions/client.py +36 -40
  38. vellum/client/resources/workflow_executions/raw_client.py +97 -0
  39. vellum/client/resources/workflow_sandboxes/client.py +60 -108
  40. vellum/client/resources/workflow_sandboxes/raw_client.py +300 -0
  41. vellum/client/resources/workflows/client.py +68 -133
  42. vellum/client/resources/workflows/raw_client.py +307 -0
  43. vellum/client/resources/workspace_secrets/client.py +46 -90
  44. vellum/client/resources/workspace_secrets/raw_client.py +220 -0
  45. vellum/client/resources/workspaces/client.py +34 -39
  46. vellum/client/resources/workspaces/raw_client.py +96 -0
  47. vellum/core/http_response.py +3 -0
  48. vellum/raw_client.py +3 -0
  49. vellum/resources/ad_hoc/raw_client.py +3 -0
  50. vellum/resources/container_images/raw_client.py +3 -0
  51. vellum/resources/deployments/raw_client.py +3 -0
  52. vellum/resources/document_indexes/raw_client.py +3 -0
  53. vellum/resources/documents/raw_client.py +3 -0
  54. vellum/resources/folder_entities/raw_client.py +3 -0
  55. vellum/resources/metric_definitions/raw_client.py +3 -0
  56. vellum/resources/ml_models/raw_client.py +3 -0
  57. vellum/resources/organizations/raw_client.py +3 -0
  58. vellum/resources/prompts/raw_client.py +3 -0
  59. vellum/resources/sandboxes/raw_client.py +3 -0
  60. vellum/resources/test_suite_runs/raw_client.py +3 -0
  61. vellum/resources/test_suites/raw_client.py +3 -0
  62. vellum/resources/workflow_deployments/raw_client.py +3 -0
  63. vellum/resources/workflow_executions/raw_client.py +3 -0
  64. vellum/resources/workflow_sandboxes/raw_client.py +3 -0
  65. vellum/resources/workflows/raw_client.py +3 -0
  66. vellum/resources/workspace_secrets/raw_client.py +3 -0
  67. vellum/resources/workspaces/raw_client.py +3 -0
  68. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/METADATA +1 -1
  69. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/RECORD +76 -33
  70. vellum_ee/workflows/display/exceptions.py +7 -0
  71. vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +2 -1
  72. vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +53 -2
  73. vellum_ee/workflows/display/workflows/base_workflow_display.py +2 -1
  74. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/LICENSE +0 -0
  75. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/WHEEL +0 -0
  76. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.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._client_wrapper = client_wrapper
21
+ self._raw_client = RawDocumentsClient(client_wrapper=client_wrapper)
27
22
 
28
- def list(
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
- _response = self._client_wrapper.httpx_client.request(
77
- "v1/documents",
78
- base_url=self._client_wrapper.get_environment().default,
79
- method="GET",
80
- params={
81
- "document_index_id": document_index_id,
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
- try:
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
- _response = self._client_wrapper.httpx_client.request(
132
- f"v1/documents/{jsonable_encoder(id)}",
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
- try:
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
- _response = self._client_wrapper.httpx_client.request(
179
- f"v1/documents/{jsonable_encoder(id)}",
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
- try:
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
- _response = self._client_wrapper.httpx_client.request(
244
- f"v1/documents/{jsonable_encoder(id)}",
245
- base_url=self._client_wrapper.get_environment().default,
246
- method="PATCH",
247
- json={
248
- "label": label,
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
- try:
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
- _response = self._client_wrapper.httpx_client.request(
318
- "v1/upload-document",
319
- base_url=self._client_wrapper.get_environment().documents,
320
- method="POST",
321
- data={
322
- "add_to_index_names": add_to_index_names,
323
- "external_id": external_id,
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
- try:
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._client_wrapper = client_wrapper
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 list(
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
- _response = await self._client_wrapper.httpx_client.request(
440
- "v1/documents",
441
- base_url=self._client_wrapper.get_environment().default,
442
- method="GET",
443
- params={
444
- "document_index_id": document_index_id,
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
- try:
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
- _response = await self._client_wrapper.httpx_client.request(
503
- f"v1/documents/{jsonable_encoder(id)}",
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
- try:
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
- _response = await self._client_wrapper.httpx_client.request(
558
- f"v1/documents/{jsonable_encoder(id)}",
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
- try:
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
- _response = await self._client_wrapper.httpx_client.request(
631
- f"v1/documents/{jsonable_encoder(id)}",
632
- base_url=self._client_wrapper.get_environment().default,
633
- method="PATCH",
634
- json={
635
- "label": label,
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
- try:
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
- _response = await self._client_wrapper.httpx_client.request(
705
- "v1/upload-document",
706
- base_url=self._client_wrapper.get_environment().documents,
707
- method="POST",
708
- data={
709
- "add_to_index_names": add_to_index_names,
710
- "external_id": external_id,
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
- try:
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