vellum-ai 1.1.0__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.
Files changed (75) 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/raw_client.py +1561 -0
  7. vellum/client/reference.md +20 -693
  8. vellum/client/resources/ad_hoc/client.py +55 -161
  9. vellum/client/resources/ad_hoc/raw_client.py +278 -0
  10. vellum/client/resources/container_images/client.py +62 -172
  11. vellum/client/resources/container_images/raw_client.py +400 -0
  12. vellum/client/resources/deployments/client.py +112 -437
  13. vellum/client/resources/deployments/raw_client.py +995 -0
  14. vellum/client/resources/document_indexes/client.py +108 -317
  15. vellum/client/resources/document_indexes/raw_client.py +847 -0
  16. vellum/client/resources/documents/client.py +88 -285
  17. vellum/client/resources/documents/raw_client.py +655 -0
  18. vellum/client/resources/folder_entities/client.py +54 -92
  19. vellum/client/resources/folder_entities/raw_client.py +277 -0
  20. vellum/client/resources/metric_definitions/client.py +48 -95
  21. vellum/client/resources/metric_definitions/raw_client.py +225 -0
  22. vellum/client/resources/ml_models/client.py +36 -40
  23. vellum/client/resources/ml_models/raw_client.py +103 -0
  24. vellum/client/resources/organizations/client.py +34 -39
  25. vellum/client/resources/organizations/raw_client.py +96 -0
  26. vellum/client/resources/prompts/client.py +50 -193
  27. vellum/client/resources/prompts/raw_client.py +346 -0
  28. vellum/client/resources/sandboxes/client.py +68 -141
  29. vellum/client/resources/sandboxes/raw_client.py +393 -0
  30. vellum/client/resources/test_suite_runs/client.py +58 -141
  31. vellum/client/resources/test_suite_runs/raw_client.py +355 -0
  32. vellum/client/resources/test_suites/client.py +73 -141
  33. vellum/client/resources/test_suites/raw_client.py +379 -0
  34. vellum/client/resources/workflow_deployments/client.py +118 -362
  35. vellum/client/resources/workflow_deployments/raw_client.py +931 -0
  36. vellum/client/resources/workflow_executions/client.py +36 -40
  37. vellum/client/resources/workflow_executions/raw_client.py +97 -0
  38. vellum/client/resources/workflow_sandboxes/client.py +60 -108
  39. vellum/client/resources/workflow_sandboxes/raw_client.py +300 -0
  40. vellum/client/resources/workflows/client.py +68 -133
  41. vellum/client/resources/workflows/raw_client.py +307 -0
  42. vellum/client/resources/workspace_secrets/client.py +46 -90
  43. vellum/client/resources/workspace_secrets/raw_client.py +220 -0
  44. vellum/client/resources/workspaces/client.py +34 -39
  45. vellum/client/resources/workspaces/raw_client.py +96 -0
  46. vellum/core/http_response.py +3 -0
  47. vellum/raw_client.py +3 -0
  48. vellum/resources/ad_hoc/raw_client.py +3 -0
  49. vellum/resources/container_images/raw_client.py +3 -0
  50. vellum/resources/deployments/raw_client.py +3 -0
  51. vellum/resources/document_indexes/raw_client.py +3 -0
  52. vellum/resources/documents/raw_client.py +3 -0
  53. vellum/resources/folder_entities/raw_client.py +3 -0
  54. vellum/resources/metric_definitions/raw_client.py +3 -0
  55. vellum/resources/ml_models/raw_client.py +3 -0
  56. vellum/resources/organizations/raw_client.py +3 -0
  57. vellum/resources/prompts/raw_client.py +3 -0
  58. vellum/resources/sandboxes/raw_client.py +3 -0
  59. vellum/resources/test_suite_runs/raw_client.py +3 -0
  60. vellum/resources/test_suites/raw_client.py +3 -0
  61. vellum/resources/workflow_deployments/raw_client.py +3 -0
  62. vellum/resources/workflow_executions/raw_client.py +3 -0
  63. vellum/resources/workflow_sandboxes/raw_client.py +3 -0
  64. vellum/resources/workflows/raw_client.py +3 -0
  65. vellum/resources/workspace_secrets/raw_client.py +3 -0
  66. vellum/resources/workspaces/raw_client.py +3 -0
  67. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/METADATA +1 -1
  68. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/RECORD +75 -32
  69. vellum_ee/workflows/display/exceptions.py +7 -0
  70. vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +2 -1
  71. vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +53 -2
  72. vellum_ee/workflows/display/workflows/base_workflow_display.py +2 -1
  73. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/LICENSE +0 -0
  74. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/WHEEL +0 -0
  75. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,995 @@
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.deployments_list_request_status import DeploymentsListRequestStatus
6
+ from ...core.request_options import RequestOptions
7
+ from ...core.http_response import HttpResponse
8
+ from ...types.paginated_slim_deployment_read_list import PaginatedSlimDeploymentReadList
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.deployment_read import DeploymentRead
13
+ from ...core.jsonable_encoder import jsonable_encoder
14
+ from ...types.deployment_history_item import DeploymentHistoryItem
15
+ from .types.list_deployment_release_tags_request_source import ListDeploymentReleaseTagsRequestSource
16
+ from ...types.paginated_deployment_release_tag_read_list import PaginatedDeploymentReleaseTagReadList
17
+ from ...types.deployment_release_tag_read import DeploymentReleaseTagRead
18
+ from ...types.prompt_deployment_release import PromptDeploymentRelease
19
+ from ...types.prompt_deployment_input_request import PromptDeploymentInputRequest
20
+ from ...types.compile_prompt_deployment_expand_meta_request import CompilePromptDeploymentExpandMetaRequest
21
+ from ...types.deployment_provider_payload_response import DeploymentProviderPayloadResponse
22
+ from ...core.serialization import convert_and_respect_annotation_metadata
23
+ from ...errors.bad_request_error import BadRequestError
24
+ from ...errors.forbidden_error import ForbiddenError
25
+ from ...errors.not_found_error import NotFoundError
26
+ from ...errors.internal_server_error import InternalServerError
27
+ from ...core.client_wrapper import AsyncClientWrapper
28
+ from ...core.http_response import AsyncHttpResponse
29
+
30
+ # this is used as the default value for optional parameters
31
+ OMIT = typing.cast(typing.Any, ...)
32
+
33
+
34
+ class RawDeploymentsClient:
35
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
36
+ self._client_wrapper = client_wrapper
37
+
38
+ def list(
39
+ self,
40
+ *,
41
+ limit: typing.Optional[int] = None,
42
+ offset: typing.Optional[int] = None,
43
+ ordering: typing.Optional[str] = None,
44
+ status: typing.Optional[DeploymentsListRequestStatus] = None,
45
+ request_options: typing.Optional[RequestOptions] = None,
46
+ ) -> HttpResponse[PaginatedSlimDeploymentReadList]:
47
+ """
48
+ Used to list all Prompt Deployments.
49
+
50
+ Parameters
51
+ ----------
52
+ limit : typing.Optional[int]
53
+ Number of results to return per page.
54
+
55
+ offset : typing.Optional[int]
56
+ The initial index from which to return the results.
57
+
58
+ ordering : typing.Optional[str]
59
+ Which field to use when ordering the results.
60
+
61
+ status : typing.Optional[DeploymentsListRequestStatus]
62
+ status
63
+
64
+ request_options : typing.Optional[RequestOptions]
65
+ Request-specific configuration.
66
+
67
+ Returns
68
+ -------
69
+ HttpResponse[PaginatedSlimDeploymentReadList]
70
+
71
+ """
72
+ _response = self._client_wrapper.httpx_client.request(
73
+ "v1/deployments",
74
+ base_url=self._client_wrapper.get_environment().default,
75
+ method="GET",
76
+ params={
77
+ "limit": limit,
78
+ "offset": offset,
79
+ "ordering": ordering,
80
+ "status": status,
81
+ },
82
+ request_options=request_options,
83
+ )
84
+ try:
85
+ if 200 <= _response.status_code < 300:
86
+ _data = typing.cast(
87
+ PaginatedSlimDeploymentReadList,
88
+ parse_obj_as(
89
+ type_=PaginatedSlimDeploymentReadList, # type: ignore
90
+ object_=_response.json(),
91
+ ),
92
+ )
93
+ return HttpResponse(response=_response, data=_data)
94
+ _response_json = _response.json()
95
+ except JSONDecodeError:
96
+ raise ApiError(status_code=_response.status_code, body=_response.text)
97
+ raise ApiError(status_code=_response.status_code, body=_response_json)
98
+
99
+ def retrieve(
100
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
101
+ ) -> HttpResponse[DeploymentRead]:
102
+ """
103
+ Used to retrieve a Prompt Deployment given its ID or name.
104
+
105
+ Parameters
106
+ ----------
107
+ id : str
108
+ Either the Prompt Deployment's ID or its unique name
109
+
110
+ request_options : typing.Optional[RequestOptions]
111
+ Request-specific configuration.
112
+
113
+ Returns
114
+ -------
115
+ HttpResponse[DeploymentRead]
116
+
117
+ """
118
+ _response = self._client_wrapper.httpx_client.request(
119
+ f"v1/deployments/{jsonable_encoder(id)}",
120
+ base_url=self._client_wrapper.get_environment().default,
121
+ method="GET",
122
+ request_options=request_options,
123
+ )
124
+ try:
125
+ if 200 <= _response.status_code < 300:
126
+ _data = typing.cast(
127
+ DeploymentRead,
128
+ parse_obj_as(
129
+ type_=DeploymentRead, # type: ignore
130
+ object_=_response.json(),
131
+ ),
132
+ )
133
+ return HttpResponse(response=_response, data=_data)
134
+ _response_json = _response.json()
135
+ except JSONDecodeError:
136
+ raise ApiError(status_code=_response.status_code, body=_response.text)
137
+ raise ApiError(status_code=_response.status_code, body=_response_json)
138
+
139
+ def deployment_history_item_retrieve(
140
+ self, history_id_or_release_tag: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
141
+ ) -> HttpResponse[DeploymentHistoryItem]:
142
+ """
143
+ DEPRECATED: This endpoint is deprecated and will be removed in a future release. Please use the
144
+ `retrieve_prompt_deployment_release` xendpoint instead.
145
+
146
+ Parameters
147
+ ----------
148
+ history_id_or_release_tag : str
149
+ Either the UUID of Deployment History Item you'd like to retrieve, or the name of a Release Tag that's pointing to the Deployment History Item you'd like to retrieve.
150
+
151
+ id : str
152
+ Either the Prompt Deployment's ID or its unique name
153
+
154
+ request_options : typing.Optional[RequestOptions]
155
+ Request-specific configuration.
156
+
157
+ Returns
158
+ -------
159
+ HttpResponse[DeploymentHistoryItem]
160
+
161
+ """
162
+ _response = self._client_wrapper.httpx_client.request(
163
+ f"v1/deployments/{jsonable_encoder(id)}/history/{jsonable_encoder(history_id_or_release_tag)}",
164
+ base_url=self._client_wrapper.get_environment().default,
165
+ method="GET",
166
+ request_options=request_options,
167
+ )
168
+ try:
169
+ if 200 <= _response.status_code < 300:
170
+ _data = typing.cast(
171
+ DeploymentHistoryItem,
172
+ parse_obj_as(
173
+ type_=DeploymentHistoryItem, # type: ignore
174
+ object_=_response.json(),
175
+ ),
176
+ )
177
+ return HttpResponse(response=_response, data=_data)
178
+ _response_json = _response.json()
179
+ except JSONDecodeError:
180
+ raise ApiError(status_code=_response.status_code, body=_response.text)
181
+ raise ApiError(status_code=_response.status_code, body=_response_json)
182
+
183
+ def list_deployment_release_tags(
184
+ self,
185
+ id: str,
186
+ *,
187
+ limit: typing.Optional[int] = None,
188
+ offset: typing.Optional[int] = None,
189
+ ordering: typing.Optional[str] = None,
190
+ source: typing.Optional[ListDeploymentReleaseTagsRequestSource] = None,
191
+ request_options: typing.Optional[RequestOptions] = None,
192
+ ) -> HttpResponse[PaginatedDeploymentReleaseTagReadList]:
193
+ """
194
+ List Release Tags associated with the specified Prompt Deployment
195
+
196
+ Parameters
197
+ ----------
198
+ id : str
199
+ Either the Prompt Deployment's ID or its unique name
200
+
201
+ limit : typing.Optional[int]
202
+ Number of results to return per page.
203
+
204
+ offset : typing.Optional[int]
205
+ The initial index from which to return the results.
206
+
207
+ ordering : typing.Optional[str]
208
+ Which field to use when ordering the results.
209
+
210
+ source : typing.Optional[ListDeploymentReleaseTagsRequestSource]
211
+
212
+ request_options : typing.Optional[RequestOptions]
213
+ Request-specific configuration.
214
+
215
+ Returns
216
+ -------
217
+ HttpResponse[PaginatedDeploymentReleaseTagReadList]
218
+
219
+ """
220
+ _response = self._client_wrapper.httpx_client.request(
221
+ f"v1/deployments/{jsonable_encoder(id)}/release-tags",
222
+ base_url=self._client_wrapper.get_environment().default,
223
+ method="GET",
224
+ params={
225
+ "limit": limit,
226
+ "offset": offset,
227
+ "ordering": ordering,
228
+ "source": source,
229
+ },
230
+ request_options=request_options,
231
+ )
232
+ try:
233
+ if 200 <= _response.status_code < 300:
234
+ _data = typing.cast(
235
+ PaginatedDeploymentReleaseTagReadList,
236
+ parse_obj_as(
237
+ type_=PaginatedDeploymentReleaseTagReadList, # type: ignore
238
+ object_=_response.json(),
239
+ ),
240
+ )
241
+ return HttpResponse(response=_response, data=_data)
242
+ _response_json = _response.json()
243
+ except JSONDecodeError:
244
+ raise ApiError(status_code=_response.status_code, body=_response.text)
245
+ raise ApiError(status_code=_response.status_code, body=_response_json)
246
+
247
+ def retrieve_deployment_release_tag(
248
+ self, id: str, name: str, *, request_options: typing.Optional[RequestOptions] = None
249
+ ) -> HttpResponse[DeploymentReleaseTagRead]:
250
+ """
251
+ Retrieve a Deployment Release Tag by tag name, associated with a specified Deployment.
252
+
253
+ Parameters
254
+ ----------
255
+ id : str
256
+ Either the Prompt Deployment's ID or its unique name
257
+
258
+ name : str
259
+ The name of the Release Tag associated with this Deployment that you'd like to retrieve.
260
+
261
+ request_options : typing.Optional[RequestOptions]
262
+ Request-specific configuration.
263
+
264
+ Returns
265
+ -------
266
+ HttpResponse[DeploymentReleaseTagRead]
267
+
268
+ """
269
+ _response = self._client_wrapper.httpx_client.request(
270
+ f"v1/deployments/{jsonable_encoder(id)}/release-tags/{jsonable_encoder(name)}",
271
+ base_url=self._client_wrapper.get_environment().default,
272
+ method="GET",
273
+ request_options=request_options,
274
+ )
275
+ try:
276
+ if 200 <= _response.status_code < 300:
277
+ _data = typing.cast(
278
+ DeploymentReleaseTagRead,
279
+ parse_obj_as(
280
+ type_=DeploymentReleaseTagRead, # type: ignore
281
+ object_=_response.json(),
282
+ ),
283
+ )
284
+ return HttpResponse(response=_response, data=_data)
285
+ _response_json = _response.json()
286
+ except JSONDecodeError:
287
+ raise ApiError(status_code=_response.status_code, body=_response.text)
288
+ raise ApiError(status_code=_response.status_code, body=_response_json)
289
+
290
+ def update_deployment_release_tag(
291
+ self,
292
+ id: str,
293
+ name: str,
294
+ *,
295
+ history_item_id: typing.Optional[str] = OMIT,
296
+ request_options: typing.Optional[RequestOptions] = None,
297
+ ) -> HttpResponse[DeploymentReleaseTagRead]:
298
+ """
299
+ Updates an existing Release Tag associated with the specified Prompt Deployment.
300
+
301
+ Parameters
302
+ ----------
303
+ id : str
304
+ Either the Prompt Deployment's ID or its unique name
305
+
306
+ name : str
307
+ The name of the Release Tag associated with this Deployment that you'd like to update.
308
+
309
+ history_item_id : typing.Optional[str]
310
+ The ID of the Release to tag
311
+
312
+ request_options : typing.Optional[RequestOptions]
313
+ Request-specific configuration.
314
+
315
+ Returns
316
+ -------
317
+ HttpResponse[DeploymentReleaseTagRead]
318
+
319
+ """
320
+ _response = self._client_wrapper.httpx_client.request(
321
+ f"v1/deployments/{jsonable_encoder(id)}/release-tags/{jsonable_encoder(name)}",
322
+ base_url=self._client_wrapper.get_environment().default,
323
+ method="PATCH",
324
+ json={
325
+ "history_item_id": history_item_id,
326
+ },
327
+ headers={
328
+ "content-type": "application/json",
329
+ },
330
+ request_options=request_options,
331
+ omit=OMIT,
332
+ )
333
+ try:
334
+ if 200 <= _response.status_code < 300:
335
+ _data = typing.cast(
336
+ DeploymentReleaseTagRead,
337
+ parse_obj_as(
338
+ type_=DeploymentReleaseTagRead, # type: ignore
339
+ object_=_response.json(),
340
+ ),
341
+ )
342
+ return HttpResponse(response=_response, data=_data)
343
+ _response_json = _response.json()
344
+ except JSONDecodeError:
345
+ raise ApiError(status_code=_response.status_code, body=_response.text)
346
+ raise ApiError(status_code=_response.status_code, body=_response_json)
347
+
348
+ def retrieve_prompt_deployment_release(
349
+ self, id: str, release_id_or_release_tag: str, *, request_options: typing.Optional[RequestOptions] = None
350
+ ) -> HttpResponse[PromptDeploymentRelease]:
351
+ """
352
+ Retrieve a specific Prompt Deployment Release by either its UUID or the name of a Release Tag that points to it.
353
+
354
+ Parameters
355
+ ----------
356
+ id : str
357
+ Either the Prompt Deployment's ID or its unique name
358
+
359
+ release_id_or_release_tag : str
360
+ Either the UUID of Prompt Deployment Release you'd like to retrieve, or the name of a Release Tag that's pointing to the Prompt Deployment Release you'd like to retrieve.
361
+
362
+ request_options : typing.Optional[RequestOptions]
363
+ Request-specific configuration.
364
+
365
+ Returns
366
+ -------
367
+ HttpResponse[PromptDeploymentRelease]
368
+
369
+ """
370
+ _response = self._client_wrapper.httpx_client.request(
371
+ f"v1/deployments/{jsonable_encoder(id)}/releases/{jsonable_encoder(release_id_or_release_tag)}",
372
+ base_url=self._client_wrapper.get_environment().default,
373
+ method="GET",
374
+ request_options=request_options,
375
+ )
376
+ try:
377
+ if 200 <= _response.status_code < 300:
378
+ _data = typing.cast(
379
+ PromptDeploymentRelease,
380
+ parse_obj_as(
381
+ type_=PromptDeploymentRelease, # type: ignore
382
+ object_=_response.json(),
383
+ ),
384
+ )
385
+ return HttpResponse(response=_response, data=_data)
386
+ _response_json = _response.json()
387
+ except JSONDecodeError:
388
+ raise ApiError(status_code=_response.status_code, body=_response.text)
389
+ raise ApiError(status_code=_response.status_code, body=_response_json)
390
+
391
+ def retrieve_provider_payload(
392
+ self,
393
+ *,
394
+ inputs: typing.Sequence[PromptDeploymentInputRequest],
395
+ deployment_id: typing.Optional[str] = OMIT,
396
+ deployment_name: typing.Optional[str] = OMIT,
397
+ release_tag: typing.Optional[str] = OMIT,
398
+ expand_meta: typing.Optional[CompilePromptDeploymentExpandMetaRequest] = OMIT,
399
+ request_options: typing.Optional[RequestOptions] = None,
400
+ ) -> HttpResponse[DeploymentProviderPayloadResponse]:
401
+ """
402
+ Given a set of input variable values, compile the exact payload that Vellum would send to the configured model provider
403
+ for execution if the execute-prompt endpoint had been invoked. Note that this endpoint does not actually execute the
404
+ prompt or make an API call to the model provider.
405
+
406
+ This endpoint is useful if you don't want to proxy LLM provider requests through Vellum and prefer to send them directly
407
+ to the provider yourself. Note that no guarantees are made on the format of this API's response schema, other than
408
+ that it will be a valid payload for the configured model provider. It's not recommended that you try to parse or
409
+ derive meaning from the response body and instead, should simply pass it directly to the model provider as is.
410
+
411
+ We encourage you to seek advise from Vellum Support before integrating with this API for production use.
412
+
413
+ Parameters
414
+ ----------
415
+ inputs : typing.Sequence[PromptDeploymentInputRequest]
416
+ The list of inputs defined in the Prompt's deployment with their corresponding values.
417
+
418
+ deployment_id : typing.Optional[str]
419
+ The ID of the deployment. Must provide either this or deployment_name.
420
+
421
+ deployment_name : typing.Optional[str]
422
+ The name of the deployment. Must provide either this or deployment_id.
423
+
424
+ release_tag : typing.Optional[str]
425
+ Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
426
+
427
+ expand_meta : typing.Optional[CompilePromptDeploymentExpandMetaRequest]
428
+
429
+ request_options : typing.Optional[RequestOptions]
430
+ Request-specific configuration.
431
+
432
+ Returns
433
+ -------
434
+ HttpResponse[DeploymentProviderPayloadResponse]
435
+
436
+ """
437
+ _response = self._client_wrapper.httpx_client.request(
438
+ "v1/deployments/provider-payload",
439
+ base_url=self._client_wrapper.get_environment().default,
440
+ method="POST",
441
+ json={
442
+ "deployment_id": deployment_id,
443
+ "deployment_name": deployment_name,
444
+ "inputs": convert_and_respect_annotation_metadata(
445
+ object_=inputs, annotation=typing.Sequence[PromptDeploymentInputRequest], direction="write"
446
+ ),
447
+ "release_tag": release_tag,
448
+ "expand_meta": convert_and_respect_annotation_metadata(
449
+ object_=expand_meta,
450
+ annotation=typing.Optional[CompilePromptDeploymentExpandMetaRequest],
451
+ direction="write",
452
+ ),
453
+ },
454
+ headers={
455
+ "content-type": "application/json",
456
+ },
457
+ request_options=request_options,
458
+ omit=OMIT,
459
+ )
460
+ try:
461
+ if 200 <= _response.status_code < 300:
462
+ _data = typing.cast(
463
+ DeploymentProviderPayloadResponse,
464
+ parse_obj_as(
465
+ type_=DeploymentProviderPayloadResponse, # type: ignore
466
+ object_=_response.json(),
467
+ ),
468
+ )
469
+ return HttpResponse(response=_response, data=_data)
470
+ if _response.status_code == 400:
471
+ raise BadRequestError(
472
+ typing.cast(
473
+ typing.Optional[typing.Any],
474
+ parse_obj_as(
475
+ type_=typing.Optional[typing.Any], # type: ignore
476
+ object_=_response.json(),
477
+ ),
478
+ )
479
+ )
480
+ if _response.status_code == 403:
481
+ raise ForbiddenError(
482
+ typing.cast(
483
+ typing.Optional[typing.Any],
484
+ parse_obj_as(
485
+ type_=typing.Optional[typing.Any], # type: ignore
486
+ object_=_response.json(),
487
+ ),
488
+ )
489
+ )
490
+ if _response.status_code == 404:
491
+ raise NotFoundError(
492
+ typing.cast(
493
+ typing.Optional[typing.Any],
494
+ parse_obj_as(
495
+ type_=typing.Optional[typing.Any], # type: ignore
496
+ object_=_response.json(),
497
+ ),
498
+ )
499
+ )
500
+ if _response.status_code == 500:
501
+ raise InternalServerError(
502
+ typing.cast(
503
+ typing.Optional[typing.Any],
504
+ parse_obj_as(
505
+ type_=typing.Optional[typing.Any], # type: ignore
506
+ object_=_response.json(),
507
+ ),
508
+ )
509
+ )
510
+ _response_json = _response.json()
511
+ except JSONDecodeError:
512
+ raise ApiError(status_code=_response.status_code, body=_response.text)
513
+ raise ApiError(status_code=_response.status_code, body=_response_json)
514
+
515
+
516
+ class AsyncRawDeploymentsClient:
517
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
518
+ self._client_wrapper = client_wrapper
519
+
520
+ async def list(
521
+ self,
522
+ *,
523
+ limit: typing.Optional[int] = None,
524
+ offset: typing.Optional[int] = None,
525
+ ordering: typing.Optional[str] = None,
526
+ status: typing.Optional[DeploymentsListRequestStatus] = None,
527
+ request_options: typing.Optional[RequestOptions] = None,
528
+ ) -> AsyncHttpResponse[PaginatedSlimDeploymentReadList]:
529
+ """
530
+ Used to list all Prompt Deployments.
531
+
532
+ Parameters
533
+ ----------
534
+ limit : typing.Optional[int]
535
+ Number of results to return per page.
536
+
537
+ offset : typing.Optional[int]
538
+ The initial index from which to return the results.
539
+
540
+ ordering : typing.Optional[str]
541
+ Which field to use when ordering the results.
542
+
543
+ status : typing.Optional[DeploymentsListRequestStatus]
544
+ status
545
+
546
+ request_options : typing.Optional[RequestOptions]
547
+ Request-specific configuration.
548
+
549
+ Returns
550
+ -------
551
+ AsyncHttpResponse[PaginatedSlimDeploymentReadList]
552
+
553
+ """
554
+ _response = await self._client_wrapper.httpx_client.request(
555
+ "v1/deployments",
556
+ base_url=self._client_wrapper.get_environment().default,
557
+ method="GET",
558
+ params={
559
+ "limit": limit,
560
+ "offset": offset,
561
+ "ordering": ordering,
562
+ "status": status,
563
+ },
564
+ request_options=request_options,
565
+ )
566
+ try:
567
+ if 200 <= _response.status_code < 300:
568
+ _data = typing.cast(
569
+ PaginatedSlimDeploymentReadList,
570
+ parse_obj_as(
571
+ type_=PaginatedSlimDeploymentReadList, # type: ignore
572
+ object_=_response.json(),
573
+ ),
574
+ )
575
+ return AsyncHttpResponse(response=_response, data=_data)
576
+ _response_json = _response.json()
577
+ except JSONDecodeError:
578
+ raise ApiError(status_code=_response.status_code, body=_response.text)
579
+ raise ApiError(status_code=_response.status_code, body=_response_json)
580
+
581
+ async def retrieve(
582
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
583
+ ) -> AsyncHttpResponse[DeploymentRead]:
584
+ """
585
+ Used to retrieve a Prompt Deployment given its ID or name.
586
+
587
+ Parameters
588
+ ----------
589
+ id : str
590
+ Either the Prompt Deployment's ID or its unique name
591
+
592
+ request_options : typing.Optional[RequestOptions]
593
+ Request-specific configuration.
594
+
595
+ Returns
596
+ -------
597
+ AsyncHttpResponse[DeploymentRead]
598
+
599
+ """
600
+ _response = await self._client_wrapper.httpx_client.request(
601
+ f"v1/deployments/{jsonable_encoder(id)}",
602
+ base_url=self._client_wrapper.get_environment().default,
603
+ method="GET",
604
+ request_options=request_options,
605
+ )
606
+ try:
607
+ if 200 <= _response.status_code < 300:
608
+ _data = typing.cast(
609
+ DeploymentRead,
610
+ parse_obj_as(
611
+ type_=DeploymentRead, # type: ignore
612
+ object_=_response.json(),
613
+ ),
614
+ )
615
+ return AsyncHttpResponse(response=_response, data=_data)
616
+ _response_json = _response.json()
617
+ except JSONDecodeError:
618
+ raise ApiError(status_code=_response.status_code, body=_response.text)
619
+ raise ApiError(status_code=_response.status_code, body=_response_json)
620
+
621
+ async def deployment_history_item_retrieve(
622
+ self, history_id_or_release_tag: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
623
+ ) -> AsyncHttpResponse[DeploymentHistoryItem]:
624
+ """
625
+ DEPRECATED: This endpoint is deprecated and will be removed in a future release. Please use the
626
+ `retrieve_prompt_deployment_release` xendpoint instead.
627
+
628
+ Parameters
629
+ ----------
630
+ history_id_or_release_tag : str
631
+ Either the UUID of Deployment History Item you'd like to retrieve, or the name of a Release Tag that's pointing to the Deployment History Item you'd like to retrieve.
632
+
633
+ id : str
634
+ Either the Prompt Deployment's ID or its unique name
635
+
636
+ request_options : typing.Optional[RequestOptions]
637
+ Request-specific configuration.
638
+
639
+ Returns
640
+ -------
641
+ AsyncHttpResponse[DeploymentHistoryItem]
642
+
643
+ """
644
+ _response = await self._client_wrapper.httpx_client.request(
645
+ f"v1/deployments/{jsonable_encoder(id)}/history/{jsonable_encoder(history_id_or_release_tag)}",
646
+ base_url=self._client_wrapper.get_environment().default,
647
+ method="GET",
648
+ request_options=request_options,
649
+ )
650
+ try:
651
+ if 200 <= _response.status_code < 300:
652
+ _data = typing.cast(
653
+ DeploymentHistoryItem,
654
+ parse_obj_as(
655
+ type_=DeploymentHistoryItem, # type: ignore
656
+ object_=_response.json(),
657
+ ),
658
+ )
659
+ return AsyncHttpResponse(response=_response, data=_data)
660
+ _response_json = _response.json()
661
+ except JSONDecodeError:
662
+ raise ApiError(status_code=_response.status_code, body=_response.text)
663
+ raise ApiError(status_code=_response.status_code, body=_response_json)
664
+
665
+ async def list_deployment_release_tags(
666
+ self,
667
+ id: str,
668
+ *,
669
+ limit: typing.Optional[int] = None,
670
+ offset: typing.Optional[int] = None,
671
+ ordering: typing.Optional[str] = None,
672
+ source: typing.Optional[ListDeploymentReleaseTagsRequestSource] = None,
673
+ request_options: typing.Optional[RequestOptions] = None,
674
+ ) -> AsyncHttpResponse[PaginatedDeploymentReleaseTagReadList]:
675
+ """
676
+ List Release Tags associated with the specified Prompt Deployment
677
+
678
+ Parameters
679
+ ----------
680
+ id : str
681
+ Either the Prompt Deployment's ID or its unique name
682
+
683
+ limit : typing.Optional[int]
684
+ Number of results to return per page.
685
+
686
+ offset : typing.Optional[int]
687
+ The initial index from which to return the results.
688
+
689
+ ordering : typing.Optional[str]
690
+ Which field to use when ordering the results.
691
+
692
+ source : typing.Optional[ListDeploymentReleaseTagsRequestSource]
693
+
694
+ request_options : typing.Optional[RequestOptions]
695
+ Request-specific configuration.
696
+
697
+ Returns
698
+ -------
699
+ AsyncHttpResponse[PaginatedDeploymentReleaseTagReadList]
700
+
701
+ """
702
+ _response = await self._client_wrapper.httpx_client.request(
703
+ f"v1/deployments/{jsonable_encoder(id)}/release-tags",
704
+ base_url=self._client_wrapper.get_environment().default,
705
+ method="GET",
706
+ params={
707
+ "limit": limit,
708
+ "offset": offset,
709
+ "ordering": ordering,
710
+ "source": source,
711
+ },
712
+ request_options=request_options,
713
+ )
714
+ try:
715
+ if 200 <= _response.status_code < 300:
716
+ _data = typing.cast(
717
+ PaginatedDeploymentReleaseTagReadList,
718
+ parse_obj_as(
719
+ type_=PaginatedDeploymentReleaseTagReadList, # type: ignore
720
+ object_=_response.json(),
721
+ ),
722
+ )
723
+ return AsyncHttpResponse(response=_response, data=_data)
724
+ _response_json = _response.json()
725
+ except JSONDecodeError:
726
+ raise ApiError(status_code=_response.status_code, body=_response.text)
727
+ raise ApiError(status_code=_response.status_code, body=_response_json)
728
+
729
+ async def retrieve_deployment_release_tag(
730
+ self, id: str, name: str, *, request_options: typing.Optional[RequestOptions] = None
731
+ ) -> AsyncHttpResponse[DeploymentReleaseTagRead]:
732
+ """
733
+ Retrieve a Deployment Release Tag by tag name, associated with a specified Deployment.
734
+
735
+ Parameters
736
+ ----------
737
+ id : str
738
+ Either the Prompt Deployment's ID or its unique name
739
+
740
+ name : str
741
+ The name of the Release Tag associated with this Deployment that you'd like to retrieve.
742
+
743
+ request_options : typing.Optional[RequestOptions]
744
+ Request-specific configuration.
745
+
746
+ Returns
747
+ -------
748
+ AsyncHttpResponse[DeploymentReleaseTagRead]
749
+
750
+ """
751
+ _response = await self._client_wrapper.httpx_client.request(
752
+ f"v1/deployments/{jsonable_encoder(id)}/release-tags/{jsonable_encoder(name)}",
753
+ base_url=self._client_wrapper.get_environment().default,
754
+ method="GET",
755
+ request_options=request_options,
756
+ )
757
+ try:
758
+ if 200 <= _response.status_code < 300:
759
+ _data = typing.cast(
760
+ DeploymentReleaseTagRead,
761
+ parse_obj_as(
762
+ type_=DeploymentReleaseTagRead, # type: ignore
763
+ object_=_response.json(),
764
+ ),
765
+ )
766
+ return AsyncHttpResponse(response=_response, data=_data)
767
+ _response_json = _response.json()
768
+ except JSONDecodeError:
769
+ raise ApiError(status_code=_response.status_code, body=_response.text)
770
+ raise ApiError(status_code=_response.status_code, body=_response_json)
771
+
772
+ async def update_deployment_release_tag(
773
+ self,
774
+ id: str,
775
+ name: str,
776
+ *,
777
+ history_item_id: typing.Optional[str] = OMIT,
778
+ request_options: typing.Optional[RequestOptions] = None,
779
+ ) -> AsyncHttpResponse[DeploymentReleaseTagRead]:
780
+ """
781
+ Updates an existing Release Tag associated with the specified Prompt Deployment.
782
+
783
+ Parameters
784
+ ----------
785
+ id : str
786
+ Either the Prompt Deployment's ID or its unique name
787
+
788
+ name : str
789
+ The name of the Release Tag associated with this Deployment that you'd like to update.
790
+
791
+ history_item_id : typing.Optional[str]
792
+ The ID of the Release to tag
793
+
794
+ request_options : typing.Optional[RequestOptions]
795
+ Request-specific configuration.
796
+
797
+ Returns
798
+ -------
799
+ AsyncHttpResponse[DeploymentReleaseTagRead]
800
+
801
+ """
802
+ _response = await self._client_wrapper.httpx_client.request(
803
+ f"v1/deployments/{jsonable_encoder(id)}/release-tags/{jsonable_encoder(name)}",
804
+ base_url=self._client_wrapper.get_environment().default,
805
+ method="PATCH",
806
+ json={
807
+ "history_item_id": history_item_id,
808
+ },
809
+ headers={
810
+ "content-type": "application/json",
811
+ },
812
+ request_options=request_options,
813
+ omit=OMIT,
814
+ )
815
+ try:
816
+ if 200 <= _response.status_code < 300:
817
+ _data = typing.cast(
818
+ DeploymentReleaseTagRead,
819
+ parse_obj_as(
820
+ type_=DeploymentReleaseTagRead, # type: ignore
821
+ object_=_response.json(),
822
+ ),
823
+ )
824
+ return AsyncHttpResponse(response=_response, data=_data)
825
+ _response_json = _response.json()
826
+ except JSONDecodeError:
827
+ raise ApiError(status_code=_response.status_code, body=_response.text)
828
+ raise ApiError(status_code=_response.status_code, body=_response_json)
829
+
830
+ async def retrieve_prompt_deployment_release(
831
+ self, id: str, release_id_or_release_tag: str, *, request_options: typing.Optional[RequestOptions] = None
832
+ ) -> AsyncHttpResponse[PromptDeploymentRelease]:
833
+ """
834
+ Retrieve a specific Prompt Deployment Release by either its UUID or the name of a Release Tag that points to it.
835
+
836
+ Parameters
837
+ ----------
838
+ id : str
839
+ Either the Prompt Deployment's ID or its unique name
840
+
841
+ release_id_or_release_tag : str
842
+ Either the UUID of Prompt Deployment Release you'd like to retrieve, or the name of a Release Tag that's pointing to the Prompt Deployment Release you'd like to retrieve.
843
+
844
+ request_options : typing.Optional[RequestOptions]
845
+ Request-specific configuration.
846
+
847
+ Returns
848
+ -------
849
+ AsyncHttpResponse[PromptDeploymentRelease]
850
+
851
+ """
852
+ _response = await self._client_wrapper.httpx_client.request(
853
+ f"v1/deployments/{jsonable_encoder(id)}/releases/{jsonable_encoder(release_id_or_release_tag)}",
854
+ base_url=self._client_wrapper.get_environment().default,
855
+ method="GET",
856
+ request_options=request_options,
857
+ )
858
+ try:
859
+ if 200 <= _response.status_code < 300:
860
+ _data = typing.cast(
861
+ PromptDeploymentRelease,
862
+ parse_obj_as(
863
+ type_=PromptDeploymentRelease, # type: ignore
864
+ object_=_response.json(),
865
+ ),
866
+ )
867
+ return AsyncHttpResponse(response=_response, data=_data)
868
+ _response_json = _response.json()
869
+ except JSONDecodeError:
870
+ raise ApiError(status_code=_response.status_code, body=_response.text)
871
+ raise ApiError(status_code=_response.status_code, body=_response_json)
872
+
873
+ async def retrieve_provider_payload(
874
+ self,
875
+ *,
876
+ inputs: typing.Sequence[PromptDeploymentInputRequest],
877
+ deployment_id: typing.Optional[str] = OMIT,
878
+ deployment_name: typing.Optional[str] = OMIT,
879
+ release_tag: typing.Optional[str] = OMIT,
880
+ expand_meta: typing.Optional[CompilePromptDeploymentExpandMetaRequest] = OMIT,
881
+ request_options: typing.Optional[RequestOptions] = None,
882
+ ) -> AsyncHttpResponse[DeploymentProviderPayloadResponse]:
883
+ """
884
+ Given a set of input variable values, compile the exact payload that Vellum would send to the configured model provider
885
+ for execution if the execute-prompt endpoint had been invoked. Note that this endpoint does not actually execute the
886
+ prompt or make an API call to the model provider.
887
+
888
+ This endpoint is useful if you don't want to proxy LLM provider requests through Vellum and prefer to send them directly
889
+ to the provider yourself. Note that no guarantees are made on the format of this API's response schema, other than
890
+ that it will be a valid payload for the configured model provider. It's not recommended that you try to parse or
891
+ derive meaning from the response body and instead, should simply pass it directly to the model provider as is.
892
+
893
+ We encourage you to seek advise from Vellum Support before integrating with this API for production use.
894
+
895
+ Parameters
896
+ ----------
897
+ inputs : typing.Sequence[PromptDeploymentInputRequest]
898
+ The list of inputs defined in the Prompt's deployment with their corresponding values.
899
+
900
+ deployment_id : typing.Optional[str]
901
+ The ID of the deployment. Must provide either this or deployment_name.
902
+
903
+ deployment_name : typing.Optional[str]
904
+ The name of the deployment. Must provide either this or deployment_id.
905
+
906
+ release_tag : typing.Optional[str]
907
+ Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
908
+
909
+ expand_meta : typing.Optional[CompilePromptDeploymentExpandMetaRequest]
910
+
911
+ request_options : typing.Optional[RequestOptions]
912
+ Request-specific configuration.
913
+
914
+ Returns
915
+ -------
916
+ AsyncHttpResponse[DeploymentProviderPayloadResponse]
917
+
918
+ """
919
+ _response = await self._client_wrapper.httpx_client.request(
920
+ "v1/deployments/provider-payload",
921
+ base_url=self._client_wrapper.get_environment().default,
922
+ method="POST",
923
+ json={
924
+ "deployment_id": deployment_id,
925
+ "deployment_name": deployment_name,
926
+ "inputs": convert_and_respect_annotation_metadata(
927
+ object_=inputs, annotation=typing.Sequence[PromptDeploymentInputRequest], direction="write"
928
+ ),
929
+ "release_tag": release_tag,
930
+ "expand_meta": convert_and_respect_annotation_metadata(
931
+ object_=expand_meta,
932
+ annotation=typing.Optional[CompilePromptDeploymentExpandMetaRequest],
933
+ direction="write",
934
+ ),
935
+ },
936
+ headers={
937
+ "content-type": "application/json",
938
+ },
939
+ request_options=request_options,
940
+ omit=OMIT,
941
+ )
942
+ try:
943
+ if 200 <= _response.status_code < 300:
944
+ _data = typing.cast(
945
+ DeploymentProviderPayloadResponse,
946
+ parse_obj_as(
947
+ type_=DeploymentProviderPayloadResponse, # type: ignore
948
+ object_=_response.json(),
949
+ ),
950
+ )
951
+ return AsyncHttpResponse(response=_response, data=_data)
952
+ if _response.status_code == 400:
953
+ raise BadRequestError(
954
+ typing.cast(
955
+ typing.Optional[typing.Any],
956
+ parse_obj_as(
957
+ type_=typing.Optional[typing.Any], # type: ignore
958
+ object_=_response.json(),
959
+ ),
960
+ )
961
+ )
962
+ if _response.status_code == 403:
963
+ raise ForbiddenError(
964
+ typing.cast(
965
+ typing.Optional[typing.Any],
966
+ parse_obj_as(
967
+ type_=typing.Optional[typing.Any], # type: ignore
968
+ object_=_response.json(),
969
+ ),
970
+ )
971
+ )
972
+ if _response.status_code == 404:
973
+ raise NotFoundError(
974
+ typing.cast(
975
+ typing.Optional[typing.Any],
976
+ parse_obj_as(
977
+ type_=typing.Optional[typing.Any], # type: ignore
978
+ object_=_response.json(),
979
+ ),
980
+ )
981
+ )
982
+ if _response.status_code == 500:
983
+ raise InternalServerError(
984
+ typing.cast(
985
+ typing.Optional[typing.Any],
986
+ parse_obj_as(
987
+ type_=typing.Optional[typing.Any], # type: ignore
988
+ object_=_response.json(),
989
+ ),
990
+ )
991
+ )
992
+ _response_json = _response.json()
993
+ except JSONDecodeError:
994
+ raise ApiError(status_code=_response.status_code, body=_response.text)
995
+ raise ApiError(status_code=_response.status_code, body=_response_json)