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.
- vellum/client/README.md +0 -55
- vellum/client/__init__.py +159 -873
- vellum/client/core/__init__.py +3 -0
- vellum/client/core/client_wrapper.py +2 -2
- vellum/client/core/http_response.py +47 -0
- vellum/client/raw_client.py +1561 -0
- vellum/client/reference.md +20 -693
- vellum/client/resources/ad_hoc/client.py +55 -161
- vellum/client/resources/ad_hoc/raw_client.py +278 -0
- vellum/client/resources/container_images/client.py +62 -172
- vellum/client/resources/container_images/raw_client.py +400 -0
- vellum/client/resources/deployments/client.py +112 -437
- vellum/client/resources/deployments/raw_client.py +995 -0
- vellum/client/resources/document_indexes/client.py +108 -317
- vellum/client/resources/document_indexes/raw_client.py +847 -0
- vellum/client/resources/documents/client.py +88 -285
- vellum/client/resources/documents/raw_client.py +655 -0
- vellum/client/resources/folder_entities/client.py +54 -92
- vellum/client/resources/folder_entities/raw_client.py +277 -0
- vellum/client/resources/metric_definitions/client.py +48 -95
- vellum/client/resources/metric_definitions/raw_client.py +225 -0
- vellum/client/resources/ml_models/client.py +36 -40
- vellum/client/resources/ml_models/raw_client.py +103 -0
- vellum/client/resources/organizations/client.py +34 -39
- vellum/client/resources/organizations/raw_client.py +96 -0
- vellum/client/resources/prompts/client.py +50 -193
- vellum/client/resources/prompts/raw_client.py +346 -0
- vellum/client/resources/sandboxes/client.py +68 -141
- vellum/client/resources/sandboxes/raw_client.py +393 -0
- vellum/client/resources/test_suite_runs/client.py +58 -141
- vellum/client/resources/test_suite_runs/raw_client.py +355 -0
- vellum/client/resources/test_suites/client.py +73 -141
- vellum/client/resources/test_suites/raw_client.py +379 -0
- vellum/client/resources/workflow_deployments/client.py +118 -362
- vellum/client/resources/workflow_deployments/raw_client.py +931 -0
- vellum/client/resources/workflow_executions/client.py +36 -40
- vellum/client/resources/workflow_executions/raw_client.py +97 -0
- vellum/client/resources/workflow_sandboxes/client.py +60 -108
- vellum/client/resources/workflow_sandboxes/raw_client.py +300 -0
- vellum/client/resources/workflows/client.py +68 -133
- vellum/client/resources/workflows/raw_client.py +307 -0
- vellum/client/resources/workspace_secrets/client.py +46 -90
- vellum/client/resources/workspace_secrets/raw_client.py +220 -0
- vellum/client/resources/workspaces/client.py +34 -39
- vellum/client/resources/workspaces/raw_client.py +96 -0
- vellum/core/http_response.py +3 -0
- vellum/raw_client.py +3 -0
- vellum/resources/ad_hoc/raw_client.py +3 -0
- vellum/resources/container_images/raw_client.py +3 -0
- vellum/resources/deployments/raw_client.py +3 -0
- vellum/resources/document_indexes/raw_client.py +3 -0
- vellum/resources/documents/raw_client.py +3 -0
- vellum/resources/folder_entities/raw_client.py +3 -0
- vellum/resources/metric_definitions/raw_client.py +3 -0
- vellum/resources/ml_models/raw_client.py +3 -0
- vellum/resources/organizations/raw_client.py +3 -0
- vellum/resources/prompts/raw_client.py +3 -0
- vellum/resources/sandboxes/raw_client.py +3 -0
- vellum/resources/test_suite_runs/raw_client.py +3 -0
- vellum/resources/test_suites/raw_client.py +3 -0
- vellum/resources/workflow_deployments/raw_client.py +3 -0
- vellum/resources/workflow_executions/raw_client.py +3 -0
- vellum/resources/workflow_sandboxes/raw_client.py +3 -0
- vellum/resources/workflows/raw_client.py +3 -0
- vellum/resources/workspace_secrets/raw_client.py +3 -0
- vellum/resources/workspaces/raw_client.py +3 -0
- {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/METADATA +1 -1
- {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/RECORD +75 -32
- vellum_ee/workflows/display/exceptions.py +7 -0
- vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +2 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +53 -2
- vellum_ee/workflows/display/workflows/base_workflow_display.py +2 -1
- {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/LICENSE +0 -0
- {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/WHEEL +0 -0
- {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/entry_points.txt +0 -0
@@ -2,19 +2,21 @@
|
|
2
2
|
|
3
3
|
import typing
|
4
4
|
from ...core.client_wrapper import SyncClientWrapper
|
5
|
+
from .raw_client import RawTestSuitesClient
|
5
6
|
from ...core.request_options import RequestOptions
|
6
7
|
from ...types.paginated_test_suite_test_case_list import PaginatedTestSuiteTestCaseList
|
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_test_case_variable_value_request import NamedTestCaseVariableValueRequest
|
12
9
|
from ...types.test_suite_test_case import TestSuiteTestCase
|
13
|
-
from ...core.serialization import convert_and_respect_annotation_metadata
|
14
10
|
from ...types.test_suite_test_case_bulk_operation_request import TestSuiteTestCaseBulkOperationRequest
|
15
11
|
from ...types.test_suite_test_case_bulk_result import TestSuiteTestCaseBulkResult
|
12
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
13
|
+
from ...core.serialization import convert_and_respect_annotation_metadata
|
14
|
+
from ...core.pydantic_utilities import parse_obj_as
|
16
15
|
import json
|
16
|
+
from json.decoder import JSONDecodeError
|
17
|
+
from ...core.api_error import ApiError
|
17
18
|
from ...core.client_wrapper import AsyncClientWrapper
|
19
|
+
from .raw_client import AsyncRawTestSuitesClient
|
18
20
|
|
19
21
|
# this is used as the default value for optional parameters
|
20
22
|
OMIT = typing.cast(typing.Any, ...)
|
@@ -22,7 +24,22 @@ OMIT = typing.cast(typing.Any, ...)
|
|
22
24
|
|
23
25
|
class TestSuitesClient:
|
24
26
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
25
|
-
self.
|
27
|
+
self._raw_client = RawTestSuitesClient(client_wrapper=client_wrapper)
|
28
|
+
|
29
|
+
@property
|
30
|
+
def _client_wrapper(self) -> SyncClientWrapper:
|
31
|
+
return self._raw_client._client_wrapper
|
32
|
+
|
33
|
+
@property
|
34
|
+
def with_raw_response(self) -> RawTestSuitesClient:
|
35
|
+
"""
|
36
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
37
|
+
|
38
|
+
Returns
|
39
|
+
-------
|
40
|
+
RawTestSuitesClient
|
41
|
+
"""
|
42
|
+
return self._raw_client
|
26
43
|
|
27
44
|
def list_test_suite_test_cases(
|
28
45
|
self,
|
@@ -66,29 +83,13 @@ class TestSuitesClient:
|
|
66
83
|
id="id",
|
67
84
|
)
|
68
85
|
"""
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
params={
|
74
|
-
"limit": limit,
|
75
|
-
"offset": offset,
|
76
|
-
},
|
86
|
+
response = self._raw_client.list_test_suite_test_cases(
|
87
|
+
id,
|
88
|
+
limit=limit,
|
89
|
+
offset=offset,
|
77
90
|
request_options=request_options,
|
78
91
|
)
|
79
|
-
|
80
|
-
if 200 <= _response.status_code < 300:
|
81
|
-
return typing.cast(
|
82
|
-
PaginatedTestSuiteTestCaseList,
|
83
|
-
parse_obj_as(
|
84
|
-
type_=PaginatedTestSuiteTestCaseList, # type: ignore
|
85
|
-
object_=_response.json(),
|
86
|
-
),
|
87
|
-
)
|
88
|
-
_response_json = _response.json()
|
89
|
-
except JSONDecodeError:
|
90
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
91
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
92
|
+
return response.data
|
92
93
|
|
93
94
|
def upsert_test_suite_test_case(
|
94
95
|
self,
|
@@ -166,41 +167,16 @@ class TestSuitesClient:
|
|
166
167
|
],
|
167
168
|
)
|
168
169
|
"""
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
"label": label,
|
177
|
-
"input_values": convert_and_respect_annotation_metadata(
|
178
|
-
object_=input_values,
|
179
|
-
annotation=typing.Sequence[NamedTestCaseVariableValueRequest],
|
180
|
-
direction="write",
|
181
|
-
),
|
182
|
-
"evaluation_values": convert_and_respect_annotation_metadata(
|
183
|
-
object_=evaluation_values,
|
184
|
-
annotation=typing.Sequence[NamedTestCaseVariableValueRequest],
|
185
|
-
direction="write",
|
186
|
-
),
|
187
|
-
},
|
170
|
+
response = self._raw_client.upsert_test_suite_test_case(
|
171
|
+
id_,
|
172
|
+
input_values=input_values,
|
173
|
+
evaluation_values=evaluation_values,
|
174
|
+
id=id,
|
175
|
+
external_id=external_id,
|
176
|
+
label=label,
|
188
177
|
request_options=request_options,
|
189
|
-
omit=OMIT,
|
190
178
|
)
|
191
|
-
|
192
|
-
if 200 <= _response.status_code < 300:
|
193
|
-
return typing.cast(
|
194
|
-
TestSuiteTestCase,
|
195
|
-
parse_obj_as(
|
196
|
-
type_=TestSuiteTestCase, # type: ignore
|
197
|
-
object_=_response.json(),
|
198
|
-
),
|
199
|
-
)
|
200
|
-
_response_json = _response.json()
|
201
|
-
except JSONDecodeError:
|
202
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
203
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
179
|
+
return response.data
|
204
180
|
|
205
181
|
def test_suite_test_cases_bulk(
|
206
182
|
self,
|
@@ -290,9 +266,9 @@ class TestSuitesClient:
|
|
290
266
|
for chunk in response:
|
291
267
|
yield chunk
|
292
268
|
"""
|
293
|
-
with self._client_wrapper.httpx_client.stream(
|
269
|
+
with self._raw_client._client_wrapper.httpx_client.stream(
|
294
270
|
f"v1/test-suites/{jsonable_encoder(id)}/test-cases-bulk",
|
295
|
-
base_url=self._client_wrapper.get_environment().default,
|
271
|
+
base_url=self._raw_client._client_wrapper.get_environment().default,
|
296
272
|
method="POST",
|
297
273
|
json=convert_and_respect_annotation_metadata(
|
298
274
|
object_=request, annotation=typing.Sequence[TestSuiteTestCaseBulkOperationRequest], direction="write"
|
@@ -356,24 +332,28 @@ class TestSuitesClient:
|
|
356
332
|
test_case_id="test_case_id",
|
357
333
|
)
|
358
334
|
"""
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
method="DELETE",
|
335
|
+
response = self._raw_client.delete_test_suite_test_case(
|
336
|
+
id,
|
337
|
+
test_case_id,
|
363
338
|
request_options=request_options,
|
364
339
|
)
|
365
|
-
|
366
|
-
if 200 <= _response.status_code < 300:
|
367
|
-
return
|
368
|
-
_response_json = _response.json()
|
369
|
-
except JSONDecodeError:
|
370
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
371
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
340
|
+
return response.data
|
372
341
|
|
373
342
|
|
374
343
|
class AsyncTestSuitesClient:
|
375
344
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
376
|
-
self.
|
345
|
+
self._raw_client = AsyncRawTestSuitesClient(client_wrapper=client_wrapper)
|
346
|
+
|
347
|
+
@property
|
348
|
+
def with_raw_response(self) -> AsyncRawTestSuitesClient:
|
349
|
+
"""
|
350
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
351
|
+
|
352
|
+
Returns
|
353
|
+
-------
|
354
|
+
AsyncRawTestSuitesClient
|
355
|
+
"""
|
356
|
+
return self._raw_client
|
377
357
|
|
378
358
|
async def list_test_suite_test_cases(
|
379
359
|
self,
|
@@ -425,29 +405,13 @@ class AsyncTestSuitesClient:
|
|
425
405
|
|
426
406
|
asyncio.run(main())
|
427
407
|
"""
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
params={
|
433
|
-
"limit": limit,
|
434
|
-
"offset": offset,
|
435
|
-
},
|
408
|
+
response = await self._raw_client.list_test_suite_test_cases(
|
409
|
+
id,
|
410
|
+
limit=limit,
|
411
|
+
offset=offset,
|
436
412
|
request_options=request_options,
|
437
413
|
)
|
438
|
-
|
439
|
-
if 200 <= _response.status_code < 300:
|
440
|
-
return typing.cast(
|
441
|
-
PaginatedTestSuiteTestCaseList,
|
442
|
-
parse_obj_as(
|
443
|
-
type_=PaginatedTestSuiteTestCaseList, # type: ignore
|
444
|
-
object_=_response.json(),
|
445
|
-
),
|
446
|
-
)
|
447
|
-
_response_json = _response.json()
|
448
|
-
except JSONDecodeError:
|
449
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
450
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
414
|
+
return response.data
|
451
415
|
|
452
416
|
async def upsert_test_suite_test_case(
|
453
417
|
self,
|
@@ -533,41 +497,16 @@ class AsyncTestSuitesClient:
|
|
533
497
|
|
534
498
|
asyncio.run(main())
|
535
499
|
"""
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
"label": label,
|
544
|
-
"input_values": convert_and_respect_annotation_metadata(
|
545
|
-
object_=input_values,
|
546
|
-
annotation=typing.Sequence[NamedTestCaseVariableValueRequest],
|
547
|
-
direction="write",
|
548
|
-
),
|
549
|
-
"evaluation_values": convert_and_respect_annotation_metadata(
|
550
|
-
object_=evaluation_values,
|
551
|
-
annotation=typing.Sequence[NamedTestCaseVariableValueRequest],
|
552
|
-
direction="write",
|
553
|
-
),
|
554
|
-
},
|
500
|
+
response = await self._raw_client.upsert_test_suite_test_case(
|
501
|
+
id_,
|
502
|
+
input_values=input_values,
|
503
|
+
evaluation_values=evaluation_values,
|
504
|
+
id=id,
|
505
|
+
external_id=external_id,
|
506
|
+
label=label,
|
555
507
|
request_options=request_options,
|
556
|
-
omit=OMIT,
|
557
508
|
)
|
558
|
-
|
559
|
-
if 200 <= _response.status_code < 300:
|
560
|
-
return typing.cast(
|
561
|
-
TestSuiteTestCase,
|
562
|
-
parse_obj_as(
|
563
|
-
type_=TestSuiteTestCase, # type: ignore
|
564
|
-
object_=_response.json(),
|
565
|
-
),
|
566
|
-
)
|
567
|
-
_response_json = _response.json()
|
568
|
-
except JSONDecodeError:
|
569
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
570
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
509
|
+
return response.data
|
571
510
|
|
572
511
|
async def test_suite_test_cases_bulk(
|
573
512
|
self,
|
@@ -665,9 +604,9 @@ class AsyncTestSuitesClient:
|
|
665
604
|
|
666
605
|
asyncio.run(main())
|
667
606
|
"""
|
668
|
-
async with self._client_wrapper.httpx_client.stream(
|
607
|
+
async with self._raw_client._client_wrapper.httpx_client.stream(
|
669
608
|
f"v1/test-suites/{jsonable_encoder(id)}/test-cases-bulk",
|
670
|
-
base_url=self._client_wrapper.get_environment().default,
|
609
|
+
base_url=self._raw_client._client_wrapper.get_environment().default,
|
671
610
|
method="POST",
|
672
611
|
json=convert_and_respect_annotation_metadata(
|
673
612
|
object_=request, annotation=typing.Sequence[TestSuiteTestCaseBulkOperationRequest], direction="write"
|
@@ -739,16 +678,9 @@ class AsyncTestSuitesClient:
|
|
739
678
|
|
740
679
|
asyncio.run(main())
|
741
680
|
"""
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
method="DELETE",
|
681
|
+
response = await self._raw_client.delete_test_suite_test_case(
|
682
|
+
id,
|
683
|
+
test_case_id,
|
746
684
|
request_options=request_options,
|
747
685
|
)
|
748
|
-
|
749
|
-
if 200 <= _response.status_code < 300:
|
750
|
-
return
|
751
|
-
_response_json = _response.json()
|
752
|
-
except JSONDecodeError:
|
753
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
754
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
686
|
+
return response.data
|
@@ -0,0 +1,379 @@
|
|
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.paginated_test_suite_test_case_list import PaginatedTestSuiteTestCaseList
|
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_test_case_variable_value_request import NamedTestCaseVariableValueRequest
|
13
|
+
from ...types.test_suite_test_case import TestSuiteTestCase
|
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 RawTestSuitesClient:
|
23
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
24
|
+
self._client_wrapper = client_wrapper
|
25
|
+
|
26
|
+
def list_test_suite_test_cases(
|
27
|
+
self,
|
28
|
+
id: str,
|
29
|
+
*,
|
30
|
+
limit: typing.Optional[int] = None,
|
31
|
+
offset: typing.Optional[int] = None,
|
32
|
+
request_options: typing.Optional[RequestOptions] = None,
|
33
|
+
) -> HttpResponse[PaginatedTestSuiteTestCaseList]:
|
34
|
+
"""
|
35
|
+
List the Test Cases associated with a Test Suite
|
36
|
+
|
37
|
+
Parameters
|
38
|
+
----------
|
39
|
+
id : str
|
40
|
+
Either the Test Suites' ID or its unique name
|
41
|
+
|
42
|
+
limit : typing.Optional[int]
|
43
|
+
Number of results to return per page.
|
44
|
+
|
45
|
+
offset : typing.Optional[int]
|
46
|
+
The initial index from which to return the results.
|
47
|
+
|
48
|
+
request_options : typing.Optional[RequestOptions]
|
49
|
+
Request-specific configuration.
|
50
|
+
|
51
|
+
Returns
|
52
|
+
-------
|
53
|
+
HttpResponse[PaginatedTestSuiteTestCaseList]
|
54
|
+
|
55
|
+
"""
|
56
|
+
_response = self._client_wrapper.httpx_client.request(
|
57
|
+
f"v1/test-suites/{jsonable_encoder(id)}/test-cases",
|
58
|
+
base_url=self._client_wrapper.get_environment().default,
|
59
|
+
method="GET",
|
60
|
+
params={
|
61
|
+
"limit": limit,
|
62
|
+
"offset": offset,
|
63
|
+
},
|
64
|
+
request_options=request_options,
|
65
|
+
)
|
66
|
+
try:
|
67
|
+
if 200 <= _response.status_code < 300:
|
68
|
+
_data = typing.cast(
|
69
|
+
PaginatedTestSuiteTestCaseList,
|
70
|
+
parse_obj_as(
|
71
|
+
type_=PaginatedTestSuiteTestCaseList, # type: ignore
|
72
|
+
object_=_response.json(),
|
73
|
+
),
|
74
|
+
)
|
75
|
+
return HttpResponse(response=_response, data=_data)
|
76
|
+
_response_json = _response.json()
|
77
|
+
except JSONDecodeError:
|
78
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
79
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
80
|
+
|
81
|
+
def upsert_test_suite_test_case(
|
82
|
+
self,
|
83
|
+
id_: str,
|
84
|
+
*,
|
85
|
+
input_values: typing.Sequence[NamedTestCaseVariableValueRequest],
|
86
|
+
evaluation_values: typing.Sequence[NamedTestCaseVariableValueRequest],
|
87
|
+
id: typing.Optional[str] = OMIT,
|
88
|
+
external_id: typing.Optional[str] = OMIT,
|
89
|
+
label: typing.Optional[str] = OMIT,
|
90
|
+
request_options: typing.Optional[RequestOptions] = None,
|
91
|
+
) -> HttpResponse[TestSuiteTestCase]:
|
92
|
+
"""
|
93
|
+
Upserts a new test case for a test suite, keying off of the optionally provided test case id.
|
94
|
+
|
95
|
+
If an id is provided and has a match, the test case will be updated. If no id is provided or no match
|
96
|
+
is found, a new test case will be appended to the end.
|
97
|
+
|
98
|
+
Note that a full replacement of the test case is performed, so any fields not provided will be removed
|
99
|
+
or overwritten with default values.
|
100
|
+
|
101
|
+
Parameters
|
102
|
+
----------
|
103
|
+
id_ : str
|
104
|
+
Either the Test Suites' ID or its unique name
|
105
|
+
|
106
|
+
input_values : typing.Sequence[NamedTestCaseVariableValueRequest]
|
107
|
+
Values for each of the Test Case's input variables
|
108
|
+
|
109
|
+
evaluation_values : typing.Sequence[NamedTestCaseVariableValueRequest]
|
110
|
+
Values for each of the Test Case's evaluation variables
|
111
|
+
|
112
|
+
id : typing.Optional[str]
|
113
|
+
The Vellum-generated ID of an existing Test Case whose data you'd like to replace. If specified and no Test Case exists with this ID, a 404 will be returned.
|
114
|
+
|
115
|
+
external_id : typing.Optional[str]
|
116
|
+
An ID external to Vellum that uniquely identifies the Test Case that you'd like to create/update. If there's a match on a Test Case that was previously created with the same external_id, it will be updated. Otherwise, a new Test Case will be created with this value as its external_id. If no external_id is specified, then a new Test Case will always be created.
|
117
|
+
|
118
|
+
label : typing.Optional[str]
|
119
|
+
A human-readable label used to convey the intention of this Test Case
|
120
|
+
|
121
|
+
request_options : typing.Optional[RequestOptions]
|
122
|
+
Request-specific configuration.
|
123
|
+
|
124
|
+
Returns
|
125
|
+
-------
|
126
|
+
HttpResponse[TestSuiteTestCase]
|
127
|
+
|
128
|
+
"""
|
129
|
+
_response = self._client_wrapper.httpx_client.request(
|
130
|
+
f"v1/test-suites/{jsonable_encoder(id_)}/test-cases",
|
131
|
+
base_url=self._client_wrapper.get_environment().default,
|
132
|
+
method="POST",
|
133
|
+
json={
|
134
|
+
"id": id,
|
135
|
+
"external_id": external_id,
|
136
|
+
"label": label,
|
137
|
+
"input_values": convert_and_respect_annotation_metadata(
|
138
|
+
object_=input_values,
|
139
|
+
annotation=typing.Sequence[NamedTestCaseVariableValueRequest],
|
140
|
+
direction="write",
|
141
|
+
),
|
142
|
+
"evaluation_values": convert_and_respect_annotation_metadata(
|
143
|
+
object_=evaluation_values,
|
144
|
+
annotation=typing.Sequence[NamedTestCaseVariableValueRequest],
|
145
|
+
direction="write",
|
146
|
+
),
|
147
|
+
},
|
148
|
+
request_options=request_options,
|
149
|
+
omit=OMIT,
|
150
|
+
)
|
151
|
+
try:
|
152
|
+
if 200 <= _response.status_code < 300:
|
153
|
+
_data = typing.cast(
|
154
|
+
TestSuiteTestCase,
|
155
|
+
parse_obj_as(
|
156
|
+
type_=TestSuiteTestCase, # type: ignore
|
157
|
+
object_=_response.json(),
|
158
|
+
),
|
159
|
+
)
|
160
|
+
return HttpResponse(response=_response, data=_data)
|
161
|
+
_response_json = _response.json()
|
162
|
+
except JSONDecodeError:
|
163
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
164
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
165
|
+
|
166
|
+
def delete_test_suite_test_case(
|
167
|
+
self, id: str, test_case_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
168
|
+
) -> HttpResponse[None]:
|
169
|
+
"""
|
170
|
+
Deletes an existing test case for a test suite, keying off of the test case id.
|
171
|
+
|
172
|
+
Parameters
|
173
|
+
----------
|
174
|
+
id : str
|
175
|
+
Either the Test Suites' ID or its unique name
|
176
|
+
|
177
|
+
test_case_id : str
|
178
|
+
An id identifying the test case that you'd like to delete
|
179
|
+
|
180
|
+
request_options : typing.Optional[RequestOptions]
|
181
|
+
Request-specific configuration.
|
182
|
+
|
183
|
+
Returns
|
184
|
+
-------
|
185
|
+
HttpResponse[None]
|
186
|
+
"""
|
187
|
+
_response = self._client_wrapper.httpx_client.request(
|
188
|
+
f"v1/test-suites/{jsonable_encoder(id)}/test-cases/{jsonable_encoder(test_case_id)}",
|
189
|
+
base_url=self._client_wrapper.get_environment().default,
|
190
|
+
method="DELETE",
|
191
|
+
request_options=request_options,
|
192
|
+
)
|
193
|
+
try:
|
194
|
+
if 200 <= _response.status_code < 300:
|
195
|
+
return HttpResponse(response=_response, data=None)
|
196
|
+
_response_json = _response.json()
|
197
|
+
except JSONDecodeError:
|
198
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
199
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
200
|
+
|
201
|
+
|
202
|
+
class AsyncRawTestSuitesClient:
|
203
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
204
|
+
self._client_wrapper = client_wrapper
|
205
|
+
|
206
|
+
async def list_test_suite_test_cases(
|
207
|
+
self,
|
208
|
+
id: str,
|
209
|
+
*,
|
210
|
+
limit: typing.Optional[int] = None,
|
211
|
+
offset: typing.Optional[int] = None,
|
212
|
+
request_options: typing.Optional[RequestOptions] = None,
|
213
|
+
) -> AsyncHttpResponse[PaginatedTestSuiteTestCaseList]:
|
214
|
+
"""
|
215
|
+
List the Test Cases associated with a Test Suite
|
216
|
+
|
217
|
+
Parameters
|
218
|
+
----------
|
219
|
+
id : str
|
220
|
+
Either the Test Suites' ID or its unique name
|
221
|
+
|
222
|
+
limit : typing.Optional[int]
|
223
|
+
Number of results to return per page.
|
224
|
+
|
225
|
+
offset : typing.Optional[int]
|
226
|
+
The initial index from which to return the results.
|
227
|
+
|
228
|
+
request_options : typing.Optional[RequestOptions]
|
229
|
+
Request-specific configuration.
|
230
|
+
|
231
|
+
Returns
|
232
|
+
-------
|
233
|
+
AsyncHttpResponse[PaginatedTestSuiteTestCaseList]
|
234
|
+
|
235
|
+
"""
|
236
|
+
_response = await self._client_wrapper.httpx_client.request(
|
237
|
+
f"v1/test-suites/{jsonable_encoder(id)}/test-cases",
|
238
|
+
base_url=self._client_wrapper.get_environment().default,
|
239
|
+
method="GET",
|
240
|
+
params={
|
241
|
+
"limit": limit,
|
242
|
+
"offset": offset,
|
243
|
+
},
|
244
|
+
request_options=request_options,
|
245
|
+
)
|
246
|
+
try:
|
247
|
+
if 200 <= _response.status_code < 300:
|
248
|
+
_data = typing.cast(
|
249
|
+
PaginatedTestSuiteTestCaseList,
|
250
|
+
parse_obj_as(
|
251
|
+
type_=PaginatedTestSuiteTestCaseList, # type: ignore
|
252
|
+
object_=_response.json(),
|
253
|
+
),
|
254
|
+
)
|
255
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
256
|
+
_response_json = _response.json()
|
257
|
+
except JSONDecodeError:
|
258
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
259
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
260
|
+
|
261
|
+
async def upsert_test_suite_test_case(
|
262
|
+
self,
|
263
|
+
id_: str,
|
264
|
+
*,
|
265
|
+
input_values: typing.Sequence[NamedTestCaseVariableValueRequest],
|
266
|
+
evaluation_values: typing.Sequence[NamedTestCaseVariableValueRequest],
|
267
|
+
id: typing.Optional[str] = OMIT,
|
268
|
+
external_id: typing.Optional[str] = OMIT,
|
269
|
+
label: typing.Optional[str] = OMIT,
|
270
|
+
request_options: typing.Optional[RequestOptions] = None,
|
271
|
+
) -> AsyncHttpResponse[TestSuiteTestCase]:
|
272
|
+
"""
|
273
|
+
Upserts a new test case for a test suite, keying off of the optionally provided test case id.
|
274
|
+
|
275
|
+
If an id is provided and has a match, the test case will be updated. If no id is provided or no match
|
276
|
+
is found, a new test case will be appended to the end.
|
277
|
+
|
278
|
+
Note that a full replacement of the test case is performed, so any fields not provided will be removed
|
279
|
+
or overwritten with default values.
|
280
|
+
|
281
|
+
Parameters
|
282
|
+
----------
|
283
|
+
id_ : str
|
284
|
+
Either the Test Suites' ID or its unique name
|
285
|
+
|
286
|
+
input_values : typing.Sequence[NamedTestCaseVariableValueRequest]
|
287
|
+
Values for each of the Test Case's input variables
|
288
|
+
|
289
|
+
evaluation_values : typing.Sequence[NamedTestCaseVariableValueRequest]
|
290
|
+
Values for each of the Test Case's evaluation variables
|
291
|
+
|
292
|
+
id : typing.Optional[str]
|
293
|
+
The Vellum-generated ID of an existing Test Case whose data you'd like to replace. If specified and no Test Case exists with this ID, a 404 will be returned.
|
294
|
+
|
295
|
+
external_id : typing.Optional[str]
|
296
|
+
An ID external to Vellum that uniquely identifies the Test Case that you'd like to create/update. If there's a match on a Test Case that was previously created with the same external_id, it will be updated. Otherwise, a new Test Case will be created with this value as its external_id. If no external_id is specified, then a new Test Case will always be created.
|
297
|
+
|
298
|
+
label : typing.Optional[str]
|
299
|
+
A human-readable label used to convey the intention of this Test Case
|
300
|
+
|
301
|
+
request_options : typing.Optional[RequestOptions]
|
302
|
+
Request-specific configuration.
|
303
|
+
|
304
|
+
Returns
|
305
|
+
-------
|
306
|
+
AsyncHttpResponse[TestSuiteTestCase]
|
307
|
+
|
308
|
+
"""
|
309
|
+
_response = await self._client_wrapper.httpx_client.request(
|
310
|
+
f"v1/test-suites/{jsonable_encoder(id_)}/test-cases",
|
311
|
+
base_url=self._client_wrapper.get_environment().default,
|
312
|
+
method="POST",
|
313
|
+
json={
|
314
|
+
"id": id,
|
315
|
+
"external_id": external_id,
|
316
|
+
"label": label,
|
317
|
+
"input_values": convert_and_respect_annotation_metadata(
|
318
|
+
object_=input_values,
|
319
|
+
annotation=typing.Sequence[NamedTestCaseVariableValueRequest],
|
320
|
+
direction="write",
|
321
|
+
),
|
322
|
+
"evaluation_values": convert_and_respect_annotation_metadata(
|
323
|
+
object_=evaluation_values,
|
324
|
+
annotation=typing.Sequence[NamedTestCaseVariableValueRequest],
|
325
|
+
direction="write",
|
326
|
+
),
|
327
|
+
},
|
328
|
+
request_options=request_options,
|
329
|
+
omit=OMIT,
|
330
|
+
)
|
331
|
+
try:
|
332
|
+
if 200 <= _response.status_code < 300:
|
333
|
+
_data = typing.cast(
|
334
|
+
TestSuiteTestCase,
|
335
|
+
parse_obj_as(
|
336
|
+
type_=TestSuiteTestCase, # type: ignore
|
337
|
+
object_=_response.json(),
|
338
|
+
),
|
339
|
+
)
|
340
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
341
|
+
_response_json = _response.json()
|
342
|
+
except JSONDecodeError:
|
343
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
344
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
345
|
+
|
346
|
+
async def delete_test_suite_test_case(
|
347
|
+
self, id: str, test_case_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
348
|
+
) -> AsyncHttpResponse[None]:
|
349
|
+
"""
|
350
|
+
Deletes an existing test case for a test suite, keying off of the test case id.
|
351
|
+
|
352
|
+
Parameters
|
353
|
+
----------
|
354
|
+
id : str
|
355
|
+
Either the Test Suites' ID or its unique name
|
356
|
+
|
357
|
+
test_case_id : str
|
358
|
+
An id identifying the test case that you'd like to delete
|
359
|
+
|
360
|
+
request_options : typing.Optional[RequestOptions]
|
361
|
+
Request-specific configuration.
|
362
|
+
|
363
|
+
Returns
|
364
|
+
-------
|
365
|
+
AsyncHttpResponse[None]
|
366
|
+
"""
|
367
|
+
_response = await self._client_wrapper.httpx_client.request(
|
368
|
+
f"v1/test-suites/{jsonable_encoder(id)}/test-cases/{jsonable_encoder(test_case_id)}",
|
369
|
+
base_url=self._client_wrapper.get_environment().default,
|
370
|
+
method="DELETE",
|
371
|
+
request_options=request_options,
|
372
|
+
)
|
373
|
+
try:
|
374
|
+
if 200 <= _response.status_code < 300:
|
375
|
+
return AsyncHttpResponse(response=_response, data=None)
|
376
|
+
_response_json = _response.json()
|
377
|
+
except JSONDecodeError:
|
378
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
379
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|