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,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._client_wrapper = client_wrapper
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
- _response = self._client_wrapper.httpx_client.request(
70
- f"v1/test-suites/{jsonable_encoder(id)}/test-cases",
71
- base_url=self._client_wrapper.get_environment().default,
72
- method="GET",
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
- try:
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
- _response = self._client_wrapper.httpx_client.request(
170
- f"v1/test-suites/{jsonable_encoder(id_)}/test-cases",
171
- base_url=self._client_wrapper.get_environment().default,
172
- method="POST",
173
- json={
174
- "id": id,
175
- "external_id": external_id,
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
- try:
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
- _response = self._client_wrapper.httpx_client.request(
360
- f"v1/test-suites/{jsonable_encoder(id)}/test-cases/{jsonable_encoder(test_case_id)}",
361
- base_url=self._client_wrapper.get_environment().default,
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
- try:
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._client_wrapper = client_wrapper
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
- _response = await self._client_wrapper.httpx_client.request(
429
- f"v1/test-suites/{jsonable_encoder(id)}/test-cases",
430
- base_url=self._client_wrapper.get_environment().default,
431
- method="GET",
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
- try:
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
- _response = await self._client_wrapper.httpx_client.request(
537
- f"v1/test-suites/{jsonable_encoder(id_)}/test-cases",
538
- base_url=self._client_wrapper.get_environment().default,
539
- method="POST",
540
- json={
541
- "id": id,
542
- "external_id": external_id,
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
- try:
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
- _response = await self._client_wrapper.httpx_client.request(
743
- f"v1/test-suites/{jsonable_encoder(id)}/test-cases/{jsonable_encoder(test_case_id)}",
744
- base_url=self._client_wrapper.get_environment().default,
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
- try:
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)