vellum-ai 1.0.11__py3-none-any.whl → 1.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. vellum/__init__.py +2 -2
  2. vellum/client/README.md +0 -55
  3. vellum/client/__init__.py +159 -877
  4. vellum/client/core/__init__.py +3 -0
  5. vellum/client/core/client_wrapper.py +2 -2
  6. vellum/client/core/http_response.py +47 -0
  7. vellum/client/raw_client.py +1561 -0
  8. vellum/client/reference.md +22 -696
  9. vellum/client/resources/__init__.py +0 -2
  10. vellum/client/resources/ad_hoc/client.py +55 -161
  11. vellum/client/resources/ad_hoc/raw_client.py +278 -0
  12. vellum/client/resources/container_images/client.py +62 -172
  13. vellum/client/resources/container_images/raw_client.py +400 -0
  14. vellum/client/resources/deployments/client.py +112 -437
  15. vellum/client/resources/deployments/raw_client.py +995 -0
  16. vellum/client/resources/document_indexes/client.py +108 -317
  17. vellum/client/resources/document_indexes/raw_client.py +847 -0
  18. vellum/client/resources/documents/client.py +88 -285
  19. vellum/client/resources/documents/raw_client.py +655 -0
  20. vellum/client/resources/folder_entities/client.py +54 -92
  21. vellum/client/resources/folder_entities/raw_client.py +277 -0
  22. vellum/client/resources/metric_definitions/client.py +48 -95
  23. vellum/client/resources/metric_definitions/raw_client.py +225 -0
  24. vellum/client/resources/ml_models/client.py +36 -40
  25. vellum/client/resources/ml_models/raw_client.py +103 -0
  26. vellum/client/resources/organizations/client.py +34 -39
  27. vellum/client/resources/organizations/raw_client.py +96 -0
  28. vellum/client/resources/prompts/client.py +50 -193
  29. vellum/client/resources/prompts/raw_client.py +346 -0
  30. vellum/client/resources/sandboxes/client.py +68 -141
  31. vellum/client/resources/sandboxes/raw_client.py +393 -0
  32. vellum/client/resources/test_suite_runs/client.py +58 -141
  33. vellum/client/resources/test_suite_runs/raw_client.py +355 -0
  34. vellum/client/resources/test_suites/client.py +73 -141
  35. vellum/client/resources/test_suites/raw_client.py +379 -0
  36. vellum/client/resources/workflow_deployments/client.py +203 -328
  37. vellum/client/resources/workflow_deployments/raw_client.py +931 -0
  38. vellum/client/resources/workflow_executions/client.py +36 -40
  39. vellum/client/resources/workflow_executions/raw_client.py +97 -0
  40. vellum/client/resources/workflow_sandboxes/client.py +60 -108
  41. vellum/client/resources/workflow_sandboxes/raw_client.py +300 -0
  42. vellum/client/resources/workflows/client.py +68 -133
  43. vellum/client/resources/workflows/raw_client.py +307 -0
  44. vellum/client/resources/workspace_secrets/client.py +46 -90
  45. vellum/client/resources/workspace_secrets/raw_client.py +220 -0
  46. vellum/client/resources/workspaces/client.py +34 -39
  47. vellum/client/resources/workspaces/raw_client.py +96 -0
  48. vellum/client/types/__init__.py +2 -0
  49. vellum/client/types/api_request_parent_context.py +1 -0
  50. vellum/client/types/external_parent_context.py +36 -0
  51. vellum/client/types/node_execution_fulfilled_event.py +1 -0
  52. vellum/client/types/node_execution_initiated_event.py +1 -0
  53. vellum/client/types/node_execution_paused_event.py +1 -0
  54. vellum/client/types/node_execution_rejected_event.py +1 -0
  55. vellum/client/types/node_execution_resumed_event.py +1 -0
  56. vellum/client/types/node_execution_span.py +1 -0
  57. vellum/client/types/node_execution_span_attributes.py +1 -0
  58. vellum/client/types/node_execution_streaming_event.py +1 -0
  59. vellum/client/types/node_parent_context.py +1 -0
  60. vellum/client/types/parent_context.py +2 -0
  61. vellum/client/types/prompt_deployment_parent_context.py +1 -0
  62. vellum/client/types/slim_workflow_execution_read.py +1 -0
  63. vellum/client/types/span_link.py +1 -0
  64. vellum/client/types/workflow_deployment_event_executions_response.py +1 -0
  65. vellum/client/types/workflow_deployment_parent_context.py +1 -0
  66. vellum/client/types/workflow_event_execution_read.py +1 -0
  67. vellum/client/types/workflow_execution_detail.py +1 -0
  68. vellum/client/types/workflow_execution_fulfilled_event.py +1 -0
  69. vellum/client/types/workflow_execution_initiated_event.py +1 -0
  70. vellum/client/types/workflow_execution_paused_event.py +1 -0
  71. vellum/client/types/workflow_execution_rejected_event.py +1 -0
  72. vellum/client/types/workflow_execution_resumed_event.py +1 -0
  73. vellum/client/types/workflow_execution_snapshotted_event.py +1 -0
  74. vellum/client/types/workflow_execution_span.py +1 -0
  75. vellum/client/types/workflow_execution_span_attributes.py +1 -0
  76. vellum/client/types/workflow_execution_streaming_event.py +1 -0
  77. vellum/client/types/workflow_parent_context.py +1 -0
  78. vellum/client/types/workflow_sandbox_parent_context.py +1 -0
  79. vellum/{resources/release_reviews/__init__.py → core/http_response.py} +1 -1
  80. vellum/{resources/release_reviews/client.py → raw_client.py} +1 -1
  81. vellum/resources/ad_hoc/raw_client.py +3 -0
  82. vellum/resources/container_images/raw_client.py +3 -0
  83. vellum/resources/deployments/raw_client.py +3 -0
  84. vellum/resources/document_indexes/raw_client.py +3 -0
  85. vellum/resources/documents/raw_client.py +3 -0
  86. vellum/resources/folder_entities/raw_client.py +3 -0
  87. vellum/resources/metric_definitions/raw_client.py +3 -0
  88. vellum/resources/ml_models/raw_client.py +3 -0
  89. vellum/resources/organizations/raw_client.py +3 -0
  90. vellum/resources/prompts/raw_client.py +3 -0
  91. vellum/resources/sandboxes/raw_client.py +3 -0
  92. vellum/resources/test_suite_runs/raw_client.py +3 -0
  93. vellum/resources/test_suites/raw_client.py +3 -0
  94. vellum/resources/workflow_deployments/raw_client.py +3 -0
  95. vellum/resources/workflow_executions/raw_client.py +3 -0
  96. vellum/resources/workflow_sandboxes/raw_client.py +3 -0
  97. vellum/resources/workflows/raw_client.py +3 -0
  98. vellum/resources/workspace_secrets/raw_client.py +3 -0
  99. vellum/resources/workspaces/raw_client.py +3 -0
  100. vellum/types/external_parent_context.py +3 -0
  101. vellum/workflows/emitters/vellum_emitter.py +3 -2
  102. vellum/workflows/events/types.py +6 -0
  103. vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +5 -15
  104. vellum/workflows/nodes/displayable/tool_calling_node/node.py +6 -0
  105. vellum/workflows/nodes/displayable/tool_calling_node/utils.py +75 -0
  106. vellum/workflows/state/context.py +13 -2
  107. vellum/workflows/types/definition.py +2 -2
  108. vellum/workflows/types/tests/test_definition.py +2 -3
  109. vellum/workflows/utils/functions.py +1 -1
  110. vellum/workflows/utils/tests/test_functions.py +3 -3
  111. {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/METADATA +1 -1
  112. {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/RECORD +123 -81
  113. vellum_ee/workflows/display/exceptions.py +7 -0
  114. vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +2 -1
  115. vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +53 -2
  116. vellum_ee/workflows/display/nodes/vellum/tests/test_tool_calling_node.py +93 -0
  117. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_mcp_serialization.py +98 -0
  118. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_workflow_deployment_serialization.py +1 -1
  119. vellum_ee/workflows/display/utils/expressions.py +1 -1
  120. vellum_ee/workflows/display/workflows/base_workflow_display.py +2 -1
  121. vellum/client/resources/release_reviews/__init__.py +0 -2
  122. vellum/client/resources/release_reviews/client.py +0 -139
  123. {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/LICENSE +0 -0
  124. {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/WHEEL +0 -0
  125. {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/entry_points.txt +0 -0
@@ -2,16 +2,13 @@
2
2
 
3
3
  import typing
4
4
  from ...core.client_wrapper import SyncClientWrapper
5
+ from .raw_client import RawSandboxesClient
5
6
  from ...core.request_options import RequestOptions
6
7
  from ...types.deployment_read import DeploymentRead
7
- from ...core.jsonable_encoder import jsonable_encoder
8
- from ...core.pydantic_utilities import parse_obj_as
9
- from json.decoder import JSONDecodeError
10
- from ...core.api_error import ApiError
11
8
  from ...types.named_scenario_input_request import NamedScenarioInputRequest
12
9
  from ...types.sandbox_scenario import SandboxScenario
13
- from ...core.serialization import convert_and_respect_annotation_metadata
14
10
  from ...core.client_wrapper import AsyncClientWrapper
11
+ from .raw_client import AsyncRawSandboxesClient
15
12
 
16
13
  # this is used as the default value for optional parameters
17
14
  OMIT = typing.cast(typing.Any, ...)
@@ -19,7 +16,22 @@ OMIT = typing.cast(typing.Any, ...)
19
16
 
20
17
  class SandboxesClient:
21
18
  def __init__(self, *, client_wrapper: SyncClientWrapper):
22
- self._client_wrapper = client_wrapper
19
+ self._raw_client = RawSandboxesClient(client_wrapper=client_wrapper)
20
+
21
+ @property
22
+ def _client_wrapper(self) -> SyncClientWrapper:
23
+ return self._raw_client._client_wrapper
24
+
25
+ @property
26
+ def with_raw_response(self) -> RawSandboxesClient:
27
+ """
28
+ Retrieves a raw implementation of this client that returns raw responses.
29
+
30
+ Returns
31
+ -------
32
+ RawSandboxesClient
33
+ """
34
+ return self._raw_client
23
35
 
24
36
  def deploy_prompt(
25
37
  self,
@@ -78,36 +90,17 @@ class SandboxesClient:
78
90
  prompt_variant_id="prompt_variant_id",
79
91
  )
80
92
  """
81
- _response = self._client_wrapper.httpx_client.request(
82
- f"v1/sandboxes/{jsonable_encoder(id)}/prompts/{jsonable_encoder(prompt_variant_id)}/deploy",
83
- base_url=self._client_wrapper.get_environment().default,
84
- method="POST",
85
- json={
86
- "prompt_deployment_id": prompt_deployment_id,
87
- "prompt_deployment_name": prompt_deployment_name,
88
- "label": label,
89
- "release_tags": release_tags,
90
- "release_description": release_description,
91
- },
92
- headers={
93
- "content-type": "application/json",
94
- },
93
+ response = self._raw_client.deploy_prompt(
94
+ id,
95
+ prompt_variant_id,
96
+ prompt_deployment_id=prompt_deployment_id,
97
+ prompt_deployment_name=prompt_deployment_name,
98
+ label=label,
99
+ release_tags=release_tags,
100
+ release_description=release_description,
95
101
  request_options=request_options,
96
- omit=OMIT,
97
102
  )
98
- try:
99
- if 200 <= _response.status_code < 300:
100
- return typing.cast(
101
- DeploymentRead,
102
- parse_obj_as(
103
- type_=DeploymentRead, # type: ignore
104
- object_=_response.json(),
105
- ),
106
- )
107
- _response_json = _response.json()
108
- except JSONDecodeError:
109
- raise ApiError(status_code=_response.status_code, body=_response.text)
110
- raise ApiError(status_code=_response.status_code, body=_response_json)
103
+ return response.data
111
104
 
112
105
  def upsert_sandbox_scenario(
113
106
  self,
@@ -168,36 +161,14 @@ class SandboxesClient:
168
161
  ],
169
162
  )
170
163
  """
171
- _response = self._client_wrapper.httpx_client.request(
172
- f"v1/sandboxes/{jsonable_encoder(id)}/scenarios",
173
- base_url=self._client_wrapper.get_environment().default,
174
- method="POST",
175
- json={
176
- "label": label,
177
- "inputs": convert_and_respect_annotation_metadata(
178
- object_=inputs, annotation=typing.Sequence[NamedScenarioInputRequest], direction="write"
179
- ),
180
- "scenario_id": scenario_id,
181
- },
182
- headers={
183
- "content-type": "application/json",
184
- },
164
+ response = self._raw_client.upsert_sandbox_scenario(
165
+ id,
166
+ inputs=inputs,
167
+ label=label,
168
+ scenario_id=scenario_id,
185
169
  request_options=request_options,
186
- omit=OMIT,
187
170
  )
188
- try:
189
- if 200 <= _response.status_code < 300:
190
- return typing.cast(
191
- SandboxScenario,
192
- parse_obj_as(
193
- type_=SandboxScenario, # type: ignore
194
- object_=_response.json(),
195
- ),
196
- )
197
- _response_json = _response.json()
198
- except JSONDecodeError:
199
- raise ApiError(status_code=_response.status_code, body=_response.text)
200
- raise ApiError(status_code=_response.status_code, body=_response_json)
171
+ return response.data
201
172
 
202
173
  def delete_sandbox_scenario(
203
174
  self, id: str, scenario_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -233,24 +204,28 @@ class SandboxesClient:
233
204
  scenario_id="scenario_id",
234
205
  )
235
206
  """
236
- _response = self._client_wrapper.httpx_client.request(
237
- f"v1/sandboxes/{jsonable_encoder(id)}/scenarios/{jsonable_encoder(scenario_id)}",
238
- base_url=self._client_wrapper.get_environment().default,
239
- method="DELETE",
207
+ response = self._raw_client.delete_sandbox_scenario(
208
+ id,
209
+ scenario_id,
240
210
  request_options=request_options,
241
211
  )
242
- try:
243
- if 200 <= _response.status_code < 300:
244
- return
245
- _response_json = _response.json()
246
- except JSONDecodeError:
247
- raise ApiError(status_code=_response.status_code, body=_response.text)
248
- raise ApiError(status_code=_response.status_code, body=_response_json)
212
+ return response.data
249
213
 
250
214
 
251
215
  class AsyncSandboxesClient:
252
216
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
253
- self._client_wrapper = client_wrapper
217
+ self._raw_client = AsyncRawSandboxesClient(client_wrapper=client_wrapper)
218
+
219
+ @property
220
+ def with_raw_response(self) -> AsyncRawSandboxesClient:
221
+ """
222
+ Retrieves a raw implementation of this client that returns raw responses.
223
+
224
+ Returns
225
+ -------
226
+ AsyncRawSandboxesClient
227
+ """
228
+ return self._raw_client
254
229
 
255
230
  async def deploy_prompt(
256
231
  self,
@@ -317,36 +292,17 @@ class AsyncSandboxesClient:
317
292
 
318
293
  asyncio.run(main())
319
294
  """
320
- _response = await self._client_wrapper.httpx_client.request(
321
- f"v1/sandboxes/{jsonable_encoder(id)}/prompts/{jsonable_encoder(prompt_variant_id)}/deploy",
322
- base_url=self._client_wrapper.get_environment().default,
323
- method="POST",
324
- json={
325
- "prompt_deployment_id": prompt_deployment_id,
326
- "prompt_deployment_name": prompt_deployment_name,
327
- "label": label,
328
- "release_tags": release_tags,
329
- "release_description": release_description,
330
- },
331
- headers={
332
- "content-type": "application/json",
333
- },
295
+ response = await self._raw_client.deploy_prompt(
296
+ id,
297
+ prompt_variant_id,
298
+ prompt_deployment_id=prompt_deployment_id,
299
+ prompt_deployment_name=prompt_deployment_name,
300
+ label=label,
301
+ release_tags=release_tags,
302
+ release_description=release_description,
334
303
  request_options=request_options,
335
- omit=OMIT,
336
304
  )
337
- try:
338
- if 200 <= _response.status_code < 300:
339
- return typing.cast(
340
- DeploymentRead,
341
- parse_obj_as(
342
- type_=DeploymentRead, # type: ignore
343
- object_=_response.json(),
344
- ),
345
- )
346
- _response_json = _response.json()
347
- except JSONDecodeError:
348
- raise ApiError(status_code=_response.status_code, body=_response.text)
349
- raise ApiError(status_code=_response.status_code, body=_response_json)
305
+ return response.data
350
306
 
351
307
  async def upsert_sandbox_scenario(
352
308
  self,
@@ -415,36 +371,14 @@ class AsyncSandboxesClient:
415
371
 
416
372
  asyncio.run(main())
417
373
  """
418
- _response = await self._client_wrapper.httpx_client.request(
419
- f"v1/sandboxes/{jsonable_encoder(id)}/scenarios",
420
- base_url=self._client_wrapper.get_environment().default,
421
- method="POST",
422
- json={
423
- "label": label,
424
- "inputs": convert_and_respect_annotation_metadata(
425
- object_=inputs, annotation=typing.Sequence[NamedScenarioInputRequest], direction="write"
426
- ),
427
- "scenario_id": scenario_id,
428
- },
429
- headers={
430
- "content-type": "application/json",
431
- },
374
+ response = await self._raw_client.upsert_sandbox_scenario(
375
+ id,
376
+ inputs=inputs,
377
+ label=label,
378
+ scenario_id=scenario_id,
432
379
  request_options=request_options,
433
- omit=OMIT,
434
380
  )
435
- try:
436
- if 200 <= _response.status_code < 300:
437
- return typing.cast(
438
- SandboxScenario,
439
- parse_obj_as(
440
- type_=SandboxScenario, # type: ignore
441
- object_=_response.json(),
442
- ),
443
- )
444
- _response_json = _response.json()
445
- except JSONDecodeError:
446
- raise ApiError(status_code=_response.status_code, body=_response.text)
447
- raise ApiError(status_code=_response.status_code, body=_response_json)
381
+ return response.data
448
382
 
449
383
  async def delete_sandbox_scenario(
450
384
  self, id: str, scenario_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -488,16 +422,9 @@ class AsyncSandboxesClient:
488
422
 
489
423
  asyncio.run(main())
490
424
  """
491
- _response = await self._client_wrapper.httpx_client.request(
492
- f"v1/sandboxes/{jsonable_encoder(id)}/scenarios/{jsonable_encoder(scenario_id)}",
493
- base_url=self._client_wrapper.get_environment().default,
494
- method="DELETE",
425
+ response = await self._raw_client.delete_sandbox_scenario(
426
+ id,
427
+ scenario_id,
495
428
  request_options=request_options,
496
429
  )
497
- try:
498
- if 200 <= _response.status_code < 300:
499
- return
500
- _response_json = _response.json()
501
- except JSONDecodeError:
502
- raise ApiError(status_code=_response.status_code, body=_response.text)
503
- raise ApiError(status_code=_response.status_code, body=_response_json)
430
+ return response.data
@@ -0,0 +1,393 @@
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 ...core.request_options import RequestOptions
6
+ from ...core.http_response import HttpResponse
7
+ from ...types.deployment_read import DeploymentRead
8
+ from ...core.jsonable_encoder import jsonable_encoder
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.named_scenario_input_request import NamedScenarioInputRequest
13
+ from ...types.sandbox_scenario import SandboxScenario
14
+ from ...core.serialization import convert_and_respect_annotation_metadata
15
+ from ...core.client_wrapper import AsyncClientWrapper
16
+ from ...core.http_response import AsyncHttpResponse
17
+
18
+ # this is used as the default value for optional parameters
19
+ OMIT = typing.cast(typing.Any, ...)
20
+
21
+
22
+ class RawSandboxesClient:
23
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
24
+ self._client_wrapper = client_wrapper
25
+
26
+ def deploy_prompt(
27
+ self,
28
+ id: str,
29
+ prompt_variant_id: str,
30
+ *,
31
+ prompt_deployment_id: typing.Optional[str] = OMIT,
32
+ prompt_deployment_name: typing.Optional[str] = OMIT,
33
+ label: typing.Optional[str] = OMIT,
34
+ release_tags: typing.Optional[typing.Sequence[str]] = OMIT,
35
+ release_description: typing.Optional[str] = OMIT,
36
+ request_options: typing.Optional[RequestOptions] = None,
37
+ ) -> HttpResponse[DeploymentRead]:
38
+ """
39
+ Parameters
40
+ ----------
41
+ id : str
42
+ A UUID string identifying this sandbox.
43
+
44
+ prompt_variant_id : str
45
+ An ID identifying the Prompt you'd like to deploy.
46
+
47
+ prompt_deployment_id : typing.Optional[str]
48
+ The Vellum-generated ID of the Prompt Deployment you'd like to update. Cannot specify both this and prompt_deployment_name. Leave null to create a new Prompt Deployment.
49
+
50
+ prompt_deployment_name : typing.Optional[str]
51
+ The unique name of the Prompt Deployment you'd like to either create or update. Cannot specify both this and prompt_deployment_id. If provided and matches an existing Prompt Deployment, that Prompt Deployment will be updated. Otherwise, a new Prompt Deployment will be created.
52
+
53
+ label : typing.Optional[str]
54
+ In the event that a new Prompt Deployment is created, this will be the label it's given.
55
+
56
+ release_tags : typing.Optional[typing.Sequence[str]]
57
+ Optionally provide the release tags that you'd like to be associated with the latest release of the created/updated Prompt Deployment.
58
+
59
+ release_description : typing.Optional[str]
60
+ Optionally provide a description that details what's new in this Release.
61
+
62
+ request_options : typing.Optional[RequestOptions]
63
+ Request-specific configuration.
64
+
65
+ Returns
66
+ -------
67
+ HttpResponse[DeploymentRead]
68
+
69
+ """
70
+ _response = self._client_wrapper.httpx_client.request(
71
+ f"v1/sandboxes/{jsonable_encoder(id)}/prompts/{jsonable_encoder(prompt_variant_id)}/deploy",
72
+ base_url=self._client_wrapper.get_environment().default,
73
+ method="POST",
74
+ json={
75
+ "prompt_deployment_id": prompt_deployment_id,
76
+ "prompt_deployment_name": prompt_deployment_name,
77
+ "label": label,
78
+ "release_tags": release_tags,
79
+ "release_description": release_description,
80
+ },
81
+ headers={
82
+ "content-type": "application/json",
83
+ },
84
+ request_options=request_options,
85
+ omit=OMIT,
86
+ )
87
+ try:
88
+ if 200 <= _response.status_code < 300:
89
+ _data = typing.cast(
90
+ DeploymentRead,
91
+ parse_obj_as(
92
+ type_=DeploymentRead, # type: ignore
93
+ object_=_response.json(),
94
+ ),
95
+ )
96
+ return HttpResponse(response=_response, data=_data)
97
+ _response_json = _response.json()
98
+ except JSONDecodeError:
99
+ raise ApiError(status_code=_response.status_code, body=_response.text)
100
+ raise ApiError(status_code=_response.status_code, body=_response_json)
101
+
102
+ def upsert_sandbox_scenario(
103
+ self,
104
+ id: str,
105
+ *,
106
+ inputs: typing.Sequence[NamedScenarioInputRequest],
107
+ label: typing.Optional[str] = OMIT,
108
+ scenario_id: typing.Optional[str] = OMIT,
109
+ request_options: typing.Optional[RequestOptions] = None,
110
+ ) -> HttpResponse[SandboxScenario]:
111
+ """
112
+ Upserts a new scenario for a sandbox, keying off of the optionally provided scenario id.
113
+
114
+ If an id is provided and has a match, the scenario will be updated. If no id is provided or no match
115
+ is found, a new scenario will be appended to the end.
116
+
117
+ Note that a full replacement of the scenario is performed, so any fields not provided will be removed
118
+ or overwritten with default values.
119
+
120
+ Parameters
121
+ ----------
122
+ id : str
123
+ A UUID string identifying this sandbox.
124
+
125
+ inputs : typing.Sequence[NamedScenarioInputRequest]
126
+ The inputs for the scenario
127
+
128
+ label : typing.Optional[str]
129
+
130
+ scenario_id : typing.Optional[str]
131
+ The id of the scenario to update. If none is provided, an id will be generated and a new scenario will be appended.
132
+
133
+ request_options : typing.Optional[RequestOptions]
134
+ Request-specific configuration.
135
+
136
+ Returns
137
+ -------
138
+ HttpResponse[SandboxScenario]
139
+
140
+ """
141
+ _response = self._client_wrapper.httpx_client.request(
142
+ f"v1/sandboxes/{jsonable_encoder(id)}/scenarios",
143
+ base_url=self._client_wrapper.get_environment().default,
144
+ method="POST",
145
+ json={
146
+ "label": label,
147
+ "inputs": convert_and_respect_annotation_metadata(
148
+ object_=inputs, annotation=typing.Sequence[NamedScenarioInputRequest], direction="write"
149
+ ),
150
+ "scenario_id": scenario_id,
151
+ },
152
+ headers={
153
+ "content-type": "application/json",
154
+ },
155
+ request_options=request_options,
156
+ omit=OMIT,
157
+ )
158
+ try:
159
+ if 200 <= _response.status_code < 300:
160
+ _data = typing.cast(
161
+ SandboxScenario,
162
+ parse_obj_as(
163
+ type_=SandboxScenario, # type: ignore
164
+ object_=_response.json(),
165
+ ),
166
+ )
167
+ return HttpResponse(response=_response, data=_data)
168
+ _response_json = _response.json()
169
+ except JSONDecodeError:
170
+ raise ApiError(status_code=_response.status_code, body=_response.text)
171
+ raise ApiError(status_code=_response.status_code, body=_response_json)
172
+
173
+ def delete_sandbox_scenario(
174
+ self, id: str, scenario_id: str, *, request_options: typing.Optional[RequestOptions] = None
175
+ ) -> HttpResponse[None]:
176
+ """
177
+ Deletes an existing scenario from a sandbox, keying off of the provided scenario id.
178
+
179
+ Parameters
180
+ ----------
181
+ id : str
182
+ A UUID string identifying this sandbox.
183
+
184
+ scenario_id : str
185
+ An id identifying the scenario that you'd like to delete
186
+
187
+ request_options : typing.Optional[RequestOptions]
188
+ Request-specific configuration.
189
+
190
+ Returns
191
+ -------
192
+ HttpResponse[None]
193
+ """
194
+ _response = self._client_wrapper.httpx_client.request(
195
+ f"v1/sandboxes/{jsonable_encoder(id)}/scenarios/{jsonable_encoder(scenario_id)}",
196
+ base_url=self._client_wrapper.get_environment().default,
197
+ method="DELETE",
198
+ request_options=request_options,
199
+ )
200
+ try:
201
+ if 200 <= _response.status_code < 300:
202
+ return HttpResponse(response=_response, data=None)
203
+ _response_json = _response.json()
204
+ except JSONDecodeError:
205
+ raise ApiError(status_code=_response.status_code, body=_response.text)
206
+ raise ApiError(status_code=_response.status_code, body=_response_json)
207
+
208
+
209
+ class AsyncRawSandboxesClient:
210
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
211
+ self._client_wrapper = client_wrapper
212
+
213
+ async def deploy_prompt(
214
+ self,
215
+ id: str,
216
+ prompt_variant_id: str,
217
+ *,
218
+ prompt_deployment_id: typing.Optional[str] = OMIT,
219
+ prompt_deployment_name: typing.Optional[str] = OMIT,
220
+ label: typing.Optional[str] = OMIT,
221
+ release_tags: typing.Optional[typing.Sequence[str]] = OMIT,
222
+ release_description: typing.Optional[str] = OMIT,
223
+ request_options: typing.Optional[RequestOptions] = None,
224
+ ) -> AsyncHttpResponse[DeploymentRead]:
225
+ """
226
+ Parameters
227
+ ----------
228
+ id : str
229
+ A UUID string identifying this sandbox.
230
+
231
+ prompt_variant_id : str
232
+ An ID identifying the Prompt you'd like to deploy.
233
+
234
+ prompt_deployment_id : typing.Optional[str]
235
+ The Vellum-generated ID of the Prompt Deployment you'd like to update. Cannot specify both this and prompt_deployment_name. Leave null to create a new Prompt Deployment.
236
+
237
+ prompt_deployment_name : typing.Optional[str]
238
+ The unique name of the Prompt Deployment you'd like to either create or update. Cannot specify both this and prompt_deployment_id. If provided and matches an existing Prompt Deployment, that Prompt Deployment will be updated. Otherwise, a new Prompt Deployment will be created.
239
+
240
+ label : typing.Optional[str]
241
+ In the event that a new Prompt Deployment is created, this will be the label it's given.
242
+
243
+ release_tags : typing.Optional[typing.Sequence[str]]
244
+ Optionally provide the release tags that you'd like to be associated with the latest release of the created/updated Prompt Deployment.
245
+
246
+ release_description : typing.Optional[str]
247
+ Optionally provide a description that details what's new in this Release.
248
+
249
+ request_options : typing.Optional[RequestOptions]
250
+ Request-specific configuration.
251
+
252
+ Returns
253
+ -------
254
+ AsyncHttpResponse[DeploymentRead]
255
+
256
+ """
257
+ _response = await self._client_wrapper.httpx_client.request(
258
+ f"v1/sandboxes/{jsonable_encoder(id)}/prompts/{jsonable_encoder(prompt_variant_id)}/deploy",
259
+ base_url=self._client_wrapper.get_environment().default,
260
+ method="POST",
261
+ json={
262
+ "prompt_deployment_id": prompt_deployment_id,
263
+ "prompt_deployment_name": prompt_deployment_name,
264
+ "label": label,
265
+ "release_tags": release_tags,
266
+ "release_description": release_description,
267
+ },
268
+ headers={
269
+ "content-type": "application/json",
270
+ },
271
+ request_options=request_options,
272
+ omit=OMIT,
273
+ )
274
+ try:
275
+ if 200 <= _response.status_code < 300:
276
+ _data = typing.cast(
277
+ DeploymentRead,
278
+ parse_obj_as(
279
+ type_=DeploymentRead, # type: ignore
280
+ object_=_response.json(),
281
+ ),
282
+ )
283
+ return AsyncHttpResponse(response=_response, data=_data)
284
+ _response_json = _response.json()
285
+ except JSONDecodeError:
286
+ raise ApiError(status_code=_response.status_code, body=_response.text)
287
+ raise ApiError(status_code=_response.status_code, body=_response_json)
288
+
289
+ async def upsert_sandbox_scenario(
290
+ self,
291
+ id: str,
292
+ *,
293
+ inputs: typing.Sequence[NamedScenarioInputRequest],
294
+ label: typing.Optional[str] = OMIT,
295
+ scenario_id: typing.Optional[str] = OMIT,
296
+ request_options: typing.Optional[RequestOptions] = None,
297
+ ) -> AsyncHttpResponse[SandboxScenario]:
298
+ """
299
+ Upserts a new scenario for a sandbox, keying off of the optionally provided scenario id.
300
+
301
+ If an id is provided and has a match, the scenario will be updated. If no id is provided or no match
302
+ is found, a new scenario will be appended to the end.
303
+
304
+ Note that a full replacement of the scenario is performed, so any fields not provided will be removed
305
+ or overwritten with default values.
306
+
307
+ Parameters
308
+ ----------
309
+ id : str
310
+ A UUID string identifying this sandbox.
311
+
312
+ inputs : typing.Sequence[NamedScenarioInputRequest]
313
+ The inputs for the scenario
314
+
315
+ label : typing.Optional[str]
316
+
317
+ scenario_id : typing.Optional[str]
318
+ The id of the scenario to update. If none is provided, an id will be generated and a new scenario will be appended.
319
+
320
+ request_options : typing.Optional[RequestOptions]
321
+ Request-specific configuration.
322
+
323
+ Returns
324
+ -------
325
+ AsyncHttpResponse[SandboxScenario]
326
+
327
+ """
328
+ _response = await self._client_wrapper.httpx_client.request(
329
+ f"v1/sandboxes/{jsonable_encoder(id)}/scenarios",
330
+ base_url=self._client_wrapper.get_environment().default,
331
+ method="POST",
332
+ json={
333
+ "label": label,
334
+ "inputs": convert_and_respect_annotation_metadata(
335
+ object_=inputs, annotation=typing.Sequence[NamedScenarioInputRequest], direction="write"
336
+ ),
337
+ "scenario_id": scenario_id,
338
+ },
339
+ headers={
340
+ "content-type": "application/json",
341
+ },
342
+ request_options=request_options,
343
+ omit=OMIT,
344
+ )
345
+ try:
346
+ if 200 <= _response.status_code < 300:
347
+ _data = typing.cast(
348
+ SandboxScenario,
349
+ parse_obj_as(
350
+ type_=SandboxScenario, # type: ignore
351
+ object_=_response.json(),
352
+ ),
353
+ )
354
+ return AsyncHttpResponse(response=_response, data=_data)
355
+ _response_json = _response.json()
356
+ except JSONDecodeError:
357
+ raise ApiError(status_code=_response.status_code, body=_response.text)
358
+ raise ApiError(status_code=_response.status_code, body=_response_json)
359
+
360
+ async def delete_sandbox_scenario(
361
+ self, id: str, scenario_id: str, *, request_options: typing.Optional[RequestOptions] = None
362
+ ) -> AsyncHttpResponse[None]:
363
+ """
364
+ Deletes an existing scenario from a sandbox, keying off of the provided scenario id.
365
+
366
+ Parameters
367
+ ----------
368
+ id : str
369
+ A UUID string identifying this sandbox.
370
+
371
+ scenario_id : str
372
+ An id identifying the scenario that you'd like to delete
373
+
374
+ request_options : typing.Optional[RequestOptions]
375
+ Request-specific configuration.
376
+
377
+ Returns
378
+ -------
379
+ AsyncHttpResponse[None]
380
+ """
381
+ _response = await self._client_wrapper.httpx_client.request(
382
+ f"v1/sandboxes/{jsonable_encoder(id)}/scenarios/{jsonable_encoder(scenario_id)}",
383
+ base_url=self._client_wrapper.get_environment().default,
384
+ method="DELETE",
385
+ request_options=request_options,
386
+ )
387
+ try:
388
+ if 200 <= _response.status_code < 300:
389
+ return AsyncHttpResponse(response=_response, data=None)
390
+ _response_json = _response.json()
391
+ except JSONDecodeError:
392
+ raise ApiError(status_code=_response.status_code, body=_response.text)
393
+ raise ApiError(status_code=_response.status_code, body=_response_json)