vellum-ai 1.0.11__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vellum/__init__.py +2 -2
- vellum/client/README.md +0 -55
- vellum/client/__init__.py +159 -877
- vellum/client/core/__init__.py +3 -0
- vellum/client/core/client_wrapper.py +2 -2
- vellum/client/core/http_response.py +47 -0
- vellum/client/raw_client.py +1561 -0
- vellum/client/reference.md +22 -696
- vellum/client/resources/__init__.py +0 -2
- vellum/client/resources/ad_hoc/client.py +55 -161
- vellum/client/resources/ad_hoc/raw_client.py +278 -0
- vellum/client/resources/container_images/client.py +62 -172
- vellum/client/resources/container_images/raw_client.py +400 -0
- vellum/client/resources/deployments/client.py +112 -437
- vellum/client/resources/deployments/raw_client.py +995 -0
- vellum/client/resources/document_indexes/client.py +108 -317
- vellum/client/resources/document_indexes/raw_client.py +847 -0
- vellum/client/resources/documents/client.py +88 -285
- vellum/client/resources/documents/raw_client.py +655 -0
- vellum/client/resources/folder_entities/client.py +54 -92
- vellum/client/resources/folder_entities/raw_client.py +277 -0
- vellum/client/resources/metric_definitions/client.py +48 -95
- vellum/client/resources/metric_definitions/raw_client.py +225 -0
- vellum/client/resources/ml_models/client.py +36 -40
- vellum/client/resources/ml_models/raw_client.py +103 -0
- vellum/client/resources/organizations/client.py +34 -39
- vellum/client/resources/organizations/raw_client.py +96 -0
- vellum/client/resources/prompts/client.py +50 -193
- vellum/client/resources/prompts/raw_client.py +346 -0
- vellum/client/resources/sandboxes/client.py +68 -141
- vellum/client/resources/sandboxes/raw_client.py +393 -0
- vellum/client/resources/test_suite_runs/client.py +58 -141
- vellum/client/resources/test_suite_runs/raw_client.py +355 -0
- vellum/client/resources/test_suites/client.py +73 -141
- vellum/client/resources/test_suites/raw_client.py +379 -0
- vellum/client/resources/workflow_deployments/client.py +203 -328
- vellum/client/resources/workflow_deployments/raw_client.py +931 -0
- vellum/client/resources/workflow_executions/client.py +36 -40
- vellum/client/resources/workflow_executions/raw_client.py +97 -0
- vellum/client/resources/workflow_sandboxes/client.py +60 -108
- vellum/client/resources/workflow_sandboxes/raw_client.py +300 -0
- vellum/client/resources/workflows/client.py +68 -133
- vellum/client/resources/workflows/raw_client.py +307 -0
- vellum/client/resources/workspace_secrets/client.py +46 -90
- vellum/client/resources/workspace_secrets/raw_client.py +220 -0
- vellum/client/resources/workspaces/client.py +34 -39
- vellum/client/resources/workspaces/raw_client.py +96 -0
- vellum/client/types/__init__.py +2 -0
- vellum/client/types/api_request_parent_context.py +1 -0
- vellum/client/types/external_parent_context.py +36 -0
- vellum/client/types/node_execution_fulfilled_event.py +1 -0
- vellum/client/types/node_execution_initiated_event.py +1 -0
- vellum/client/types/node_execution_paused_event.py +1 -0
- vellum/client/types/node_execution_rejected_event.py +1 -0
- vellum/client/types/node_execution_resumed_event.py +1 -0
- vellum/client/types/node_execution_span.py +1 -0
- vellum/client/types/node_execution_span_attributes.py +1 -0
- vellum/client/types/node_execution_streaming_event.py +1 -0
- vellum/client/types/node_parent_context.py +1 -0
- vellum/client/types/parent_context.py +2 -0
- vellum/client/types/prompt_deployment_parent_context.py +1 -0
- vellum/client/types/slim_workflow_execution_read.py +1 -0
- vellum/client/types/span_link.py +1 -0
- vellum/client/types/workflow_deployment_event_executions_response.py +1 -0
- vellum/client/types/workflow_deployment_parent_context.py +1 -0
- vellum/client/types/workflow_event_execution_read.py +1 -0
- vellum/client/types/workflow_execution_detail.py +1 -0
- vellum/client/types/workflow_execution_fulfilled_event.py +1 -0
- vellum/client/types/workflow_execution_initiated_event.py +1 -0
- vellum/client/types/workflow_execution_paused_event.py +1 -0
- vellum/client/types/workflow_execution_rejected_event.py +1 -0
- vellum/client/types/workflow_execution_resumed_event.py +1 -0
- vellum/client/types/workflow_execution_snapshotted_event.py +1 -0
- vellum/client/types/workflow_execution_span.py +1 -0
- vellum/client/types/workflow_execution_span_attributes.py +1 -0
- vellum/client/types/workflow_execution_streaming_event.py +1 -0
- vellum/client/types/workflow_parent_context.py +1 -0
- vellum/client/types/workflow_sandbox_parent_context.py +1 -0
- vellum/{resources/release_reviews/__init__.py → core/http_response.py} +1 -1
- vellum/{resources/release_reviews/client.py → raw_client.py} +1 -1
- vellum/resources/ad_hoc/raw_client.py +3 -0
- vellum/resources/container_images/raw_client.py +3 -0
- vellum/resources/deployments/raw_client.py +3 -0
- vellum/resources/document_indexes/raw_client.py +3 -0
- vellum/resources/documents/raw_client.py +3 -0
- vellum/resources/folder_entities/raw_client.py +3 -0
- vellum/resources/metric_definitions/raw_client.py +3 -0
- vellum/resources/ml_models/raw_client.py +3 -0
- vellum/resources/organizations/raw_client.py +3 -0
- vellum/resources/prompts/raw_client.py +3 -0
- vellum/resources/sandboxes/raw_client.py +3 -0
- vellum/resources/test_suite_runs/raw_client.py +3 -0
- vellum/resources/test_suites/raw_client.py +3 -0
- vellum/resources/workflow_deployments/raw_client.py +3 -0
- vellum/resources/workflow_executions/raw_client.py +3 -0
- vellum/resources/workflow_sandboxes/raw_client.py +3 -0
- vellum/resources/workflows/raw_client.py +3 -0
- vellum/resources/workspace_secrets/raw_client.py +3 -0
- vellum/resources/workspaces/raw_client.py +3 -0
- vellum/types/external_parent_context.py +3 -0
- vellum/workflows/emitters/vellum_emitter.py +3 -2
- vellum/workflows/events/types.py +6 -0
- vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +5 -15
- vellum/workflows/nodes/displayable/tool_calling_node/node.py +6 -0
- vellum/workflows/nodes/displayable/tool_calling_node/utils.py +75 -0
- vellum/workflows/state/context.py +13 -2
- vellum/workflows/types/definition.py +2 -2
- vellum/workflows/types/tests/test_definition.py +2 -3
- vellum/workflows/utils/functions.py +1 -1
- vellum/workflows/utils/tests/test_functions.py +3 -3
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/METADATA +1 -1
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/RECORD +123 -81
- vellum_ee/workflows/display/exceptions.py +7 -0
- vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +2 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +53 -2
- vellum_ee/workflows/display/nodes/vellum/tests/test_tool_calling_node.py +93 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_mcp_serialization.py +98 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_workflow_deployment_serialization.py +1 -1
- vellum_ee/workflows/display/utils/expressions.py +1 -1
- vellum_ee/workflows/display/workflows/base_workflow_display.py +2 -1
- vellum/client/resources/release_reviews/__init__.py +0 -2
- vellum/client/resources/release_reviews/client.py +0 -139
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/LICENSE +0 -0
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/WHEEL +0 -0
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/entry_points.txt +0 -0
@@ -2,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.
|
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
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|
-
|
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
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
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
|
-
|
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
|
-
|
237
|
-
|
238
|
-
|
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
|
-
|
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.
|
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
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
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
|
-
|
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
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
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
|
-
|
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
|
-
|
492
|
-
|
493
|
-
|
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
|
-
|
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)
|