vellum-ai 0.10.9__py3-none-any.whl → 0.11.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. vellum/__init__.py +16 -0
  2. vellum/client/core/client_wrapper.py +1 -1
  3. vellum/client/types/__init__.py +28 -0
  4. vellum/client/types/test_suite_run_exec_config.py +7 -1
  5. vellum/client/types/test_suite_run_exec_config_request.py +8 -0
  6. vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config.py +31 -0
  7. vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data.py +27 -0
  8. vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data_request.py +27 -0
  9. vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_request.py +31 -0
  10. vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config.py +31 -0
  11. vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data.py +27 -0
  12. vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data_request.py +27 -0
  13. vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_request.py +31 -0
  14. vellum/evaluations/resources.py +7 -12
  15. vellum/evaluations/utils/env.py +1 -3
  16. vellum/evaluations/utils/paginator.py +0 -1
  17. vellum/evaluations/utils/typing.py +1 -1
  18. vellum/evaluations/utils/uuid.py +1 -1
  19. vellum/plugins/vellum_mypy.py +3 -1
  20. vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config.py +3 -0
  21. vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_data.py +3 -0
  22. vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_data_request.py +3 -0
  23. vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_request.py +3 -0
  24. vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config.py +3 -0
  25. vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_data.py +3 -0
  26. vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_data_request.py +3 -0
  27. vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_request.py +3 -0
  28. vellum/workflows/context.py +42 -0
  29. vellum/workflows/events/node.py +7 -6
  30. vellum/workflows/events/tests/test_event.py +0 -1
  31. vellum/workflows/events/types.py +0 -1
  32. vellum/workflows/events/workflow.py +19 -1
  33. vellum/workflows/nodes/bases/base.py +17 -56
  34. vellum/workflows/nodes/bases/tests/test_base_node.py +0 -1
  35. vellum/workflows/nodes/core/inline_subworkflow_node/node.py +13 -7
  36. vellum/workflows/nodes/core/templating_node/node.py +1 -0
  37. vellum/workflows/nodes/core/try_node/node.py +2 -2
  38. vellum/workflows/nodes/core/try_node/tests/test_node.py +1 -3
  39. vellum/workflows/nodes/displayable/api_node/node.py +3 -2
  40. vellum/workflows/nodes/displayable/bases/api_node/node.py +1 -1
  41. vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +0 -1
  42. vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +9 -1
  43. vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +12 -2
  44. vellum/workflows/nodes/displayable/bases/search_node.py +0 -1
  45. vellum/workflows/nodes/displayable/code_execution_node/tests/test_code_execution_node.py +0 -1
  46. vellum/workflows/nodes/displayable/code_execution_node/utils.py +3 -2
  47. vellum/workflows/nodes/displayable/conditional_node/node.py +1 -1
  48. vellum/workflows/nodes/displayable/guardrail_node/node.py +0 -1
  49. vellum/workflows/nodes/displayable/inline_prompt_node/node.py +1 -0
  50. vellum/workflows/nodes/displayable/prompt_deployment_node/node.py +3 -1
  51. vellum/workflows/nodes/displayable/search_node/node.py +1 -0
  52. vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +13 -3
  53. vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +10 -7
  54. vellum/workflows/nodes/displayable/tests/test_search_node_wth_text_output.py +0 -1
  55. vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +1 -1
  56. vellum/workflows/outputs/base.py +2 -4
  57. vellum/workflows/ports/node_ports.py +1 -1
  58. vellum/workflows/runner/runner.py +167 -202
  59. vellum/workflows/state/base.py +0 -2
  60. vellum/workflows/types/core.py +1 -0
  61. vellum/workflows/types/tests/test_utils.py +1 -0
  62. vellum/workflows/types/utils.py +0 -1
  63. vellum/workflows/utils/functions.py +74 -0
  64. vellum/workflows/utils/tests/test_functions.py +171 -0
  65. vellum/workflows/utils/tests/test_vellum_variables.py +0 -1
  66. vellum/workflows/utils/vellum_variables.py +2 -2
  67. vellum/workflows/workflows/base.py +74 -34
  68. vellum/workflows/workflows/event_filters.py +7 -12
  69. {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/METADATA +1 -1
  70. {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/RECORD +122 -99
  71. vellum_cli/__init__.py +147 -13
  72. vellum_cli/config.py +0 -1
  73. vellum_cli/image_push.py +1 -1
  74. vellum_cli/pull.py +31 -19
  75. vellum_cli/push.py +9 -10
  76. vellum_cli/tests/__init__.py +0 -0
  77. vellum_cli/tests/conftest.py +40 -0
  78. vellum_cli/tests/test_main.py +11 -0
  79. vellum_cli/tests/test_pull.py +143 -71
  80. vellum_cli/tests/test_push.py +173 -0
  81. vellum_ee/workflows/display/base.py +1 -0
  82. vellum_ee/workflows/display/nodes/base_node_display.py +3 -2
  83. vellum_ee/workflows/display/nodes/base_node_vellum_display.py +2 -2
  84. vellum_ee/workflows/display/nodes/get_node_display_class.py +1 -1
  85. vellum_ee/workflows/display/nodes/tests/test_base_node_display.py +1 -1
  86. vellum_ee/workflows/display/nodes/vellum/__init__.py +1 -1
  87. vellum_ee/workflows/display/nodes/vellum/api_node.py +54 -58
  88. vellum_ee/workflows/display/nodes/vellum/conditional_node.py +39 -22
  89. vellum_ee/workflows/display/nodes/vellum/error_node.py +3 -3
  90. vellum_ee/workflows/display/nodes/vellum/final_output_node.py +0 -2
  91. vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +1 -1
  92. vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +1 -1
  93. vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +4 -2
  94. vellum_ee/workflows/display/nodes/vellum/map_node.py +11 -5
  95. vellum_ee/workflows/display/nodes/vellum/merge_node.py +2 -2
  96. vellum_ee/workflows/display/nodes/vellum/note_node.py +1 -3
  97. vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +1 -1
  98. vellum_ee/workflows/display/nodes/vellum/search_node.py +1 -1
  99. vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +1 -1
  100. vellum_ee/workflows/display/nodes/vellum/templating_node.py +1 -1
  101. vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +5 -5
  102. vellum_ee/workflows/display/nodes/vellum/utils.py +30 -10
  103. vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +45 -0
  104. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +42 -25
  105. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +13 -39
  106. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +2 -2
  107. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +62 -58
  108. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +25 -4
  109. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +2 -1
  110. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +2 -2
  111. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +2 -2
  112. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +1 -1
  113. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +2 -1
  114. vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +2 -2
  115. vellum_ee/workflows/display/types.py +4 -4
  116. vellum_ee/workflows/display/utils/vellum.py +2 -6
  117. vellum_ee/workflows/display/vellum.py +1 -1
  118. vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py +4 -1
  119. vellum_ee/workflows/display/workflows/vellum_workflow_display.py +12 -5
  120. vellum/workflows/runner/types.py +0 -16
  121. {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/LICENSE +0 -0
  122. {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/WHEEL +0 -0
  123. {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/entry_points.txt +0 -0
vellum/__init__.py CHANGED
@@ -393,6 +393,10 @@ from .types import (
393
393
  TestSuiteRunMetricNumberOutput,
394
394
  TestSuiteRunMetricOutput,
395
395
  TestSuiteRunMetricStringOutput,
396
+ TestSuiteRunPromptSandboxHistoryItemExecConfig,
397
+ TestSuiteRunPromptSandboxHistoryItemExecConfigData,
398
+ TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest,
399
+ TestSuiteRunPromptSandboxHistoryItemExecConfigRequest,
396
400
  TestSuiteRunRead,
397
401
  TestSuiteRunState,
398
402
  TestSuiteRunTestSuite,
@@ -400,6 +404,10 @@ from .types import (
400
404
  TestSuiteRunWorkflowReleaseTagExecConfigData,
401
405
  TestSuiteRunWorkflowReleaseTagExecConfigDataRequest,
402
406
  TestSuiteRunWorkflowReleaseTagExecConfigRequest,
407
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfig,
408
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigData,
409
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest,
410
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest,
403
411
  TestSuiteTestCase,
404
412
  TestSuiteTestCaseBulkOperationRequest,
405
413
  TestSuiteTestCaseBulkResult,
@@ -917,6 +925,10 @@ __all__ = [
917
925
  "TestSuiteRunMetricNumberOutput",
918
926
  "TestSuiteRunMetricOutput",
919
927
  "TestSuiteRunMetricStringOutput",
928
+ "TestSuiteRunPromptSandboxHistoryItemExecConfig",
929
+ "TestSuiteRunPromptSandboxHistoryItemExecConfigData",
930
+ "TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest",
931
+ "TestSuiteRunPromptSandboxHistoryItemExecConfigRequest",
920
932
  "TestSuiteRunRead",
921
933
  "TestSuiteRunState",
922
934
  "TestSuiteRunTestSuite",
@@ -924,6 +936,10 @@ __all__ = [
924
936
  "TestSuiteRunWorkflowReleaseTagExecConfigData",
925
937
  "TestSuiteRunWorkflowReleaseTagExecConfigDataRequest",
926
938
  "TestSuiteRunWorkflowReleaseTagExecConfigRequest",
939
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfig",
940
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfigData",
941
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest",
942
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest",
927
943
  "TestSuiteTestCase",
928
944
  "TestSuiteTestCaseBulkOperationRequest",
929
945
  "TestSuiteTestCaseBulkResult",
@@ -17,7 +17,7 @@ class BaseClientWrapper:
17
17
  headers: typing.Dict[str, str] = {
18
18
  "X-Fern-Language": "Python",
19
19
  "X-Fern-SDK-Name": "vellum-ai",
20
- "X-Fern-SDK-Version": "0.10.9",
20
+ "X-Fern-SDK-Version": "0.11.1",
21
21
  }
22
22
  headers["X_API_KEY"] = self.api_key
23
23
  return headers
@@ -406,6 +406,16 @@ from .test_suite_run_metric_json_output import TestSuiteRunMetricJsonOutput
406
406
  from .test_suite_run_metric_number_output import TestSuiteRunMetricNumberOutput
407
407
  from .test_suite_run_metric_output import TestSuiteRunMetricOutput
408
408
  from .test_suite_run_metric_string_output import TestSuiteRunMetricStringOutput
409
+ from .test_suite_run_prompt_sandbox_history_item_exec_config import TestSuiteRunPromptSandboxHistoryItemExecConfig
410
+ from .test_suite_run_prompt_sandbox_history_item_exec_config_data import (
411
+ TestSuiteRunPromptSandboxHistoryItemExecConfigData,
412
+ )
413
+ from .test_suite_run_prompt_sandbox_history_item_exec_config_data_request import (
414
+ TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest,
415
+ )
416
+ from .test_suite_run_prompt_sandbox_history_item_exec_config_request import (
417
+ TestSuiteRunPromptSandboxHistoryItemExecConfigRequest,
418
+ )
409
419
  from .test_suite_run_read import TestSuiteRunRead
410
420
  from .test_suite_run_state import TestSuiteRunState
411
421
  from .test_suite_run_test_suite import TestSuiteRunTestSuite
@@ -415,6 +425,16 @@ from .test_suite_run_workflow_release_tag_exec_config_data_request import (
415
425
  TestSuiteRunWorkflowReleaseTagExecConfigDataRequest,
416
426
  )
417
427
  from .test_suite_run_workflow_release_tag_exec_config_request import TestSuiteRunWorkflowReleaseTagExecConfigRequest
428
+ from .test_suite_run_workflow_sandbox_history_item_exec_config import TestSuiteRunWorkflowSandboxHistoryItemExecConfig
429
+ from .test_suite_run_workflow_sandbox_history_item_exec_config_data import (
430
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigData,
431
+ )
432
+ from .test_suite_run_workflow_sandbox_history_item_exec_config_data_request import (
433
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest,
434
+ )
435
+ from .test_suite_run_workflow_sandbox_history_item_exec_config_request import (
436
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest,
437
+ )
418
438
  from .test_suite_test_case import TestSuiteTestCase
419
439
  from .test_suite_test_case_bulk_operation_request import TestSuiteTestCaseBulkOperationRequest
420
440
  from .test_suite_test_case_bulk_result import TestSuiteTestCaseBulkResult
@@ -893,6 +913,10 @@ __all__ = [
893
913
  "TestSuiteRunMetricNumberOutput",
894
914
  "TestSuiteRunMetricOutput",
895
915
  "TestSuiteRunMetricStringOutput",
916
+ "TestSuiteRunPromptSandboxHistoryItemExecConfig",
917
+ "TestSuiteRunPromptSandboxHistoryItemExecConfigData",
918
+ "TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest",
919
+ "TestSuiteRunPromptSandboxHistoryItemExecConfigRequest",
896
920
  "TestSuiteRunRead",
897
921
  "TestSuiteRunState",
898
922
  "TestSuiteRunTestSuite",
@@ -900,6 +924,10 @@ __all__ = [
900
924
  "TestSuiteRunWorkflowReleaseTagExecConfigData",
901
925
  "TestSuiteRunWorkflowReleaseTagExecConfigDataRequest",
902
926
  "TestSuiteRunWorkflowReleaseTagExecConfigRequest",
927
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfig",
928
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfigData",
929
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest",
930
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest",
903
931
  "TestSuiteTestCase",
904
932
  "TestSuiteTestCaseBulkOperationRequest",
905
933
  "TestSuiteTestCaseBulkResult",
@@ -2,9 +2,15 @@
2
2
 
3
3
  import typing
4
4
  from .test_suite_run_deployment_release_tag_exec_config import TestSuiteRunDeploymentReleaseTagExecConfig
5
+ from .test_suite_run_prompt_sandbox_history_item_exec_config import TestSuiteRunPromptSandboxHistoryItemExecConfig
5
6
  from .test_suite_run_workflow_release_tag_exec_config import TestSuiteRunWorkflowReleaseTagExecConfig
7
+ from .test_suite_run_workflow_sandbox_history_item_exec_config import TestSuiteRunWorkflowSandboxHistoryItemExecConfig
6
8
  from .test_suite_run_external_exec_config import TestSuiteRunExternalExecConfig
7
9
 
8
10
  TestSuiteRunExecConfig = typing.Union[
9
- TestSuiteRunDeploymentReleaseTagExecConfig, TestSuiteRunWorkflowReleaseTagExecConfig, TestSuiteRunExternalExecConfig
11
+ TestSuiteRunDeploymentReleaseTagExecConfig,
12
+ TestSuiteRunPromptSandboxHistoryItemExecConfig,
13
+ TestSuiteRunWorkflowReleaseTagExecConfig,
14
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfig,
15
+ TestSuiteRunExternalExecConfig,
10
16
  ]
@@ -2,11 +2,19 @@
2
2
 
3
3
  import typing
4
4
  from .test_suite_run_deployment_release_tag_exec_config_request import TestSuiteRunDeploymentReleaseTagExecConfigRequest
5
+ from .test_suite_run_prompt_sandbox_history_item_exec_config_request import (
6
+ TestSuiteRunPromptSandboxHistoryItemExecConfigRequest,
7
+ )
5
8
  from .test_suite_run_workflow_release_tag_exec_config_request import TestSuiteRunWorkflowReleaseTagExecConfigRequest
9
+ from .test_suite_run_workflow_sandbox_history_item_exec_config_request import (
10
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest,
11
+ )
6
12
  from .test_suite_run_external_exec_config_request import TestSuiteRunExternalExecConfigRequest
7
13
 
8
14
  TestSuiteRunExecConfigRequest = typing.Union[
9
15
  TestSuiteRunDeploymentReleaseTagExecConfigRequest,
16
+ TestSuiteRunPromptSandboxHistoryItemExecConfigRequest,
10
17
  TestSuiteRunWorkflowReleaseTagExecConfigRequest,
18
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest,
11
19
  TestSuiteRunExternalExecConfigRequest,
12
20
  ]
@@ -0,0 +1,31 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from .test_suite_run_prompt_sandbox_history_item_exec_config_data import (
6
+ TestSuiteRunPromptSandboxHistoryItemExecConfigData,
7
+ )
8
+ import pydantic
9
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
10
+
11
+
12
+ class TestSuiteRunPromptSandboxHistoryItemExecConfig(UniversalBaseModel):
13
+ """
14
+ Execution configuration for running a Test Suite against a Prompt Sandbox History Item
15
+ """
16
+
17
+ type: typing.Literal["PROMPT_SANDBOX_HISTORY_ITEM"] = "PROMPT_SANDBOX_HISTORY_ITEM"
18
+ data: TestSuiteRunPromptSandboxHistoryItemExecConfigData
19
+ test_case_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
20
+ """
21
+ Optionally specify a subset of test case ids to run. If not provided, all test cases within the test suite will be run by default.
22
+ """
23
+
24
+ if IS_PYDANTIC_V2:
25
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
26
+ else:
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ extra = pydantic.Extra.allow
@@ -0,0 +1,27 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import typing
7
+
8
+
9
+ class TestSuiteRunPromptSandboxHistoryItemExecConfigData(UniversalBaseModel):
10
+ history_item_id: str = pydantic.Field()
11
+ """
12
+ The ID of the Prompt Sandbox History Item that the Test Suite will run against.
13
+ """
14
+
15
+ prompt_variant_id: str = pydantic.Field()
16
+ """
17
+ The ID of the Prompt Variant within the Prompt Sandbox History Item that you'd like to run the Test Suite against.
18
+ """
19
+
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
+ else:
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic.Extra.allow
@@ -0,0 +1,27 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import typing
7
+
8
+
9
+ class TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest(UniversalBaseModel):
10
+ history_item_id: str = pydantic.Field()
11
+ """
12
+ The ID of the Prompt Sandbox History Item that the Test Suite will run against.
13
+ """
14
+
15
+ prompt_variant_id: str = pydantic.Field()
16
+ """
17
+ The ID of the Prompt Variant within the Prompt Sandbox History Item that you'd like to run the Test Suite against.
18
+ """
19
+
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
+ else:
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic.Extra.allow
@@ -0,0 +1,31 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from .test_suite_run_prompt_sandbox_history_item_exec_config_data_request import (
6
+ TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest,
7
+ )
8
+ import pydantic
9
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
10
+
11
+
12
+ class TestSuiteRunPromptSandboxHistoryItemExecConfigRequest(UniversalBaseModel):
13
+ """
14
+ Execution configuration for running a Test Suite against a Prompt Sandbox History Item
15
+ """
16
+
17
+ type: typing.Literal["PROMPT_SANDBOX_HISTORY_ITEM"] = "PROMPT_SANDBOX_HISTORY_ITEM"
18
+ data: TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest
19
+ test_case_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
20
+ """
21
+ Optionally specify a subset of test case ids to run. If not provided, all test cases within the test suite will be run by default.
22
+ """
23
+
24
+ if IS_PYDANTIC_V2:
25
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
26
+ else:
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ extra = pydantic.Extra.allow
@@ -0,0 +1,31 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from .test_suite_run_workflow_sandbox_history_item_exec_config_data import (
6
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigData,
7
+ )
8
+ import pydantic
9
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
10
+
11
+
12
+ class TestSuiteRunWorkflowSandboxHistoryItemExecConfig(UniversalBaseModel):
13
+ """
14
+ Execution configuration for running a Test Suite against a Workflow Sandbox History Item
15
+ """
16
+
17
+ type: typing.Literal["WORKFLOW_SANDBOX_HISTORY_ITEM"] = "WORKFLOW_SANDBOX_HISTORY_ITEM"
18
+ data: TestSuiteRunWorkflowSandboxHistoryItemExecConfigData
19
+ test_case_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
20
+ """
21
+ Optionally specify a subset of test case ids to run. If not provided, all test cases within the test suite will be run by default.
22
+ """
23
+
24
+ if IS_PYDANTIC_V2:
25
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
26
+ else:
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ extra = pydantic.Extra.allow
@@ -0,0 +1,27 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import typing
7
+
8
+
9
+ class TestSuiteRunWorkflowSandboxHistoryItemExecConfigData(UniversalBaseModel):
10
+ history_item_id: str = pydantic.Field()
11
+ """
12
+ The ID of the Workflow Sandbox History Item that the Test Suite will run against.
13
+ """
14
+
15
+ workflow_variant_id: str = pydantic.Field()
16
+ """
17
+ The ID of the Workflow Variant within the Workflow Sandbox History Item that you'd like to run the Test Suite against.
18
+ """
19
+
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
+ else:
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic.Extra.allow
@@ -0,0 +1,27 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import typing
7
+
8
+
9
+ class TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest(UniversalBaseModel):
10
+ history_item_id: str = pydantic.Field()
11
+ """
12
+ The ID of the Workflow Sandbox History Item that the Test Suite will run against.
13
+ """
14
+
15
+ workflow_variant_id: str = pydantic.Field()
16
+ """
17
+ The ID of the Workflow Variant within the Workflow Sandbox History Item that you'd like to run the Test Suite against.
18
+ """
19
+
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
+ else:
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic.Extra.allow
@@ -0,0 +1,31 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from .test_suite_run_workflow_sandbox_history_item_exec_config_data_request import (
6
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest,
7
+ )
8
+ import pydantic
9
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
10
+
11
+
12
+ class TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest(UniversalBaseModel):
13
+ """
14
+ Execution configuration for running a Test Suite against a Workflow Sandbox History Item
15
+ """
16
+
17
+ type: typing.Literal["WORKFLOW_SANDBOX_HISTORY_ITEM"] = "WORKFLOW_SANDBOX_HISTORY_ITEM"
18
+ data: TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest
19
+ test_case_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
20
+ """
21
+ Optionally specify a subset of test case ids to run. If not provided, all test cases within the test suite will be run by default.
22
+ """
23
+
24
+ if IS_PYDANTIC_V2:
25
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
26
+ else:
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ extra = pydantic.Extra.allow
@@ -1,17 +1,14 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from functools import cached_property
3
4
  import logging
4
5
  import time
5
- from functools import cached_property
6
- from typing import Callable, Generator, List, cast, Iterable
7
6
  from uuid import UUID
7
+ from typing import Callable, Generator, Iterable, List, cast
8
8
 
9
- from vellum import TestSuiteRunRead, TestSuiteRunMetricNumberOutput
10
- from vellum.client import Vellum, OMIT
11
- from vellum.evaluations.constants import (
12
- DEFAULT_MAX_POLLING_DURATION_MS,
13
- DEFAULT_POLLING_INTERVAL_MS,
14
- )
9
+ from vellum import TestSuiteRunMetricNumberOutput, TestSuiteRunRead
10
+ from vellum.client import OMIT, Vellum
11
+ from vellum.evaluations.constants import DEFAULT_MAX_POLLING_DURATION_MS, DEFAULT_POLLING_INTERVAL_MS
15
12
  from vellum.evaluations.exceptions import TestSuiteRunResultsException
16
13
  from vellum.evaluations.utils.env import get_api_key
17
14
  from vellum.evaluations.utils.paginator import PaginatedResults, get_all_results
@@ -21,9 +18,9 @@ from vellum.types import (
21
18
  ExternalTestCaseExecutionRequest,
22
19
  NamedTestCaseVariableValueRequest,
23
20
  TestCaseVariableValue,
24
- TestSuiteRunExternalExecConfigRequest,
25
21
  TestSuiteRunExecution,
26
22
  TestSuiteRunExternalExecConfigDataRequest,
23
+ TestSuiteRunExternalExecConfigRequest,
27
24
  TestSuiteRunMetricOutput,
28
25
  TestSuiteRunState,
29
26
  )
@@ -161,9 +158,7 @@ class VellumTestSuiteRunResults:
161
158
 
162
159
  metric_outputs: list[TestSuiteRunMetricNumberOutput] = []
163
160
 
164
- for output in self.get_metric_outputs(
165
- metric_identifier=metric_identifier, output_identifier=output_identifier
166
- ):
161
+ for output in self.get_metric_outputs(metric_identifier=metric_identifier, output_identifier=output_identifier):
167
162
  if output.type != "NUMBER":
168
163
  raise TestSuiteRunResultsException(
169
164
  f"Expected a numeric metric output, but got a {output.type} output instead."
@@ -6,8 +6,6 @@ from .exceptions import VellumClientException
6
6
  def get_api_key() -> str:
7
7
  api_key = os.environ.get("VELLUM_API_KEY")
8
8
  if api_key is None:
9
- raise VellumClientException(
10
- "`VELLUM_API_KEY` environment variable is required to be set."
11
- )
9
+ raise VellumClientException("`VELLUM_API_KEY` environment variable is required to be set.")
12
10
 
13
11
  return api_key
@@ -1,7 +1,6 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import Callable, Generator, Generic, List, TypeVar, Union
3
3
 
4
-
5
4
  Result = TypeVar("Result")
6
5
 
7
6
 
@@ -1,4 +1,4 @@
1
- from typing import TypeVar, Optional
1
+ from typing import Optional, TypeVar
2
2
 
3
3
  _T = TypeVar("_T")
4
4
 
@@ -1,5 +1,5 @@
1
- from typing import Union
2
1
  import uuid
2
+ from typing import Union
3
3
 
4
4
 
5
5
  def is_valid_uuid(val: Union[str, uuid.UUID, None]) -> bool:
@@ -154,7 +154,9 @@ class VellumMypyPlugin(Plugin):
154
154
  def _base_class_hook(self, ctx: ClassDefContext) -> None:
155
155
  if _is_subclass(ctx.cls.info, "vellum.workflows.nodes.core.templating_node.node.TemplatingNode"):
156
156
  self._dynamic_output_node_class_hook(ctx, "result")
157
- elif _is_subclass(ctx.cls.info, "vellum.workflows.nodes.displayable.code_execution_node.node.CodeExecutionNode"):
157
+ elif _is_subclass(
158
+ ctx.cls.info, "vellum.workflows.nodes.displayable.code_execution_node.node.CodeExecutionNode"
159
+ ):
158
160
  self._dynamic_output_node_class_hook(ctx, "result")
159
161
  elif _is_subclass(ctx.cls.info, "vellum.workflows.nodes.displayable.final_output_node.node.FinalOutputNode"):
160
162
  self._dynamic_output_node_class_hook(ctx, "value")
@@ -0,0 +1,3 @@
1
+ # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
+
3
+ from vellum.client.types.test_suite_run_prompt_sandbox_history_item_exec_config import *
@@ -0,0 +1,3 @@
1
+ # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
+
3
+ from vellum.client.types.test_suite_run_prompt_sandbox_history_item_exec_config_data import *
@@ -0,0 +1,3 @@
1
+ # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
+
3
+ from vellum.client.types.test_suite_run_prompt_sandbox_history_item_exec_config_data_request import *
@@ -0,0 +1,3 @@
1
+ # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
+
3
+ from vellum.client.types.test_suite_run_prompt_sandbox_history_item_exec_config_request import *
@@ -0,0 +1,3 @@
1
+ # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
+
3
+ from vellum.client.types.test_suite_run_workflow_sandbox_history_item_exec_config import *
@@ -0,0 +1,3 @@
1
+ # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
+
3
+ from vellum.client.types.test_suite_run_workflow_sandbox_history_item_exec_config_data import *
@@ -0,0 +1,3 @@
1
+ # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
+
3
+ from vellum.client.types.test_suite_run_workflow_sandbox_history_item_exec_config_data_request import *
@@ -0,0 +1,3 @@
1
+ # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
+
3
+ from vellum.client.types.test_suite_run_workflow_sandbox_history_item_exec_config_request import *
@@ -0,0 +1,42 @@
1
+ from contextlib import contextmanager
2
+ import threading
3
+ from typing import Iterator, Optional, cast
4
+
5
+ from vellum.client.core import UniversalBaseModel
6
+ from vellum.workflows.events.types import ParentContext
7
+
8
+
9
+ class ExecutionContext(UniversalBaseModel):
10
+ parent_context: Optional[ParentContext] = None
11
+
12
+
13
+ _CONTEXT_KEY = "_execution_context"
14
+
15
+ local = threading.local()
16
+
17
+
18
+ def get_execution_context() -> ExecutionContext:
19
+ """Retrieve the current execution context."""
20
+ return getattr(local, _CONTEXT_KEY, ExecutionContext())
21
+
22
+
23
+ def set_execution_context(context: ExecutionContext) -> None:
24
+ """Set the current execution context."""
25
+ setattr(local, _CONTEXT_KEY, context)
26
+
27
+
28
+ def get_parent_context() -> ParentContext:
29
+ return cast(ParentContext, get_execution_context().parent_context)
30
+
31
+
32
+ @contextmanager
33
+ def execution_context(parent_context: Optional[ParentContext] = None) -> Iterator[None]:
34
+ """Context manager for handling execution context."""
35
+ prev_context = get_execution_context()
36
+ set_context = ExecutionContext(parent_context=parent_context) if parent_context else prev_context
37
+
38
+ try:
39
+ set_execution_context(set_context)
40
+ yield
41
+ finally:
42
+ set_execution_context(prev_context)
@@ -1,12 +1,10 @@
1
- from typing import Any, Dict, Generic, Iterable, List, Literal, Optional, Set, Type, Union
1
+ from typing import TYPE_CHECKING, Any, Dict, Generic, List, Literal, Optional, Set, Type, Union
2
2
 
3
- from pydantic import ConfigDict, SerializerFunctionWrapHandler, field_serializer, model_serializer
4
- from pydantic.main import IncEx
3
+ from pydantic import SerializerFunctionWrapHandler, field_serializer, model_serializer
5
4
 
6
5
  from vellum.core.pydantic_utilities import UniversalBaseModel
7
6
  from vellum.workflows.errors import VellumError
8
7
  from vellum.workflows.expressions.accessor import AccessorExpression
9
- from vellum.workflows.nodes.bases import BaseNode
10
8
  from vellum.workflows.outputs.base import BaseOutput
11
9
  from vellum.workflows.ports.port import Port
12
10
  from vellum.workflows.references.node import NodeReference
@@ -14,9 +12,12 @@ from vellum.workflows.types.generics import OutputsType
14
12
 
15
13
  from .types import BaseEvent, default_serializer, serialize_type_encoder
16
14
 
15
+ if TYPE_CHECKING:
16
+ from vellum.workflows.nodes.bases import BaseNode
17
+
17
18
 
18
19
  class _BaseNodeExecutionBody(UniversalBaseModel):
19
- node_definition: Type[BaseNode]
20
+ node_definition: Type["BaseNode"]
20
21
 
21
22
  @field_serializer("node_definition")
22
23
  def serialize_node_definition(self, node_definition: Type, _info: Any) -> Dict[str, Any]:
@@ -36,7 +37,7 @@ class _BaseNodeEvent(BaseEvent):
36
37
  body: _BaseNodeExecutionBody
37
38
 
38
39
  @property
39
- def node_definition(self) -> Type[BaseNode]:
40
+ def node_definition(self) -> Type["BaseNode"]:
40
41
  return self.body.node_definition
41
42
 
42
43
 
@@ -1,6 +1,5 @@
1
1
  import pytest
2
2
  from datetime import datetime
3
- import json
4
3
  from uuid import UUID
5
4
 
6
5
  from deepdiff import DeepDiff
@@ -1,5 +1,4 @@
1
1
  from datetime import datetime
2
- from enum import Enum
3
2
  import json
4
3
  from uuid import UUID, uuid4
5
4
  from typing import Annotated, Any, Dict, List, Literal, Optional, Union