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.
- vellum/__init__.py +16 -0
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/types/__init__.py +28 -0
- vellum/client/types/test_suite_run_exec_config.py +7 -1
- vellum/client/types/test_suite_run_exec_config_request.py +8 -0
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config.py +31 -0
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data.py +27 -0
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data_request.py +27 -0
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_request.py +31 -0
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config.py +31 -0
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data.py +27 -0
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data_request.py +27 -0
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_request.py +31 -0
- vellum/evaluations/resources.py +7 -12
- vellum/evaluations/utils/env.py +1 -3
- vellum/evaluations/utils/paginator.py +0 -1
- vellum/evaluations/utils/typing.py +1 -1
- vellum/evaluations/utils/uuid.py +1 -1
- vellum/plugins/vellum_mypy.py +3 -1
- vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config.py +3 -0
- vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_data.py +3 -0
- vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_data_request.py +3 -0
- vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_request.py +3 -0
- vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config.py +3 -0
- vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_data.py +3 -0
- vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_data_request.py +3 -0
- vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_request.py +3 -0
- vellum/workflows/context.py +42 -0
- vellum/workflows/events/node.py +7 -6
- vellum/workflows/events/tests/test_event.py +0 -1
- vellum/workflows/events/types.py +0 -1
- vellum/workflows/events/workflow.py +19 -1
- vellum/workflows/nodes/bases/base.py +17 -56
- vellum/workflows/nodes/bases/tests/test_base_node.py +0 -1
- vellum/workflows/nodes/core/inline_subworkflow_node/node.py +13 -7
- vellum/workflows/nodes/core/templating_node/node.py +1 -0
- vellum/workflows/nodes/core/try_node/node.py +2 -2
- vellum/workflows/nodes/core/try_node/tests/test_node.py +1 -3
- vellum/workflows/nodes/displayable/api_node/node.py +3 -2
- vellum/workflows/nodes/displayable/bases/api_node/node.py +1 -1
- vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +0 -1
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +9 -1
- vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +12 -2
- vellum/workflows/nodes/displayable/bases/search_node.py +0 -1
- vellum/workflows/nodes/displayable/code_execution_node/tests/test_code_execution_node.py +0 -1
- vellum/workflows/nodes/displayable/code_execution_node/utils.py +3 -2
- vellum/workflows/nodes/displayable/conditional_node/node.py +1 -1
- vellum/workflows/nodes/displayable/guardrail_node/node.py +0 -1
- vellum/workflows/nodes/displayable/inline_prompt_node/node.py +1 -0
- vellum/workflows/nodes/displayable/prompt_deployment_node/node.py +3 -1
- vellum/workflows/nodes/displayable/search_node/node.py +1 -0
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +13 -3
- vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +10 -7
- vellum/workflows/nodes/displayable/tests/test_search_node_wth_text_output.py +0 -1
- vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +1 -1
- vellum/workflows/outputs/base.py +2 -4
- vellum/workflows/ports/node_ports.py +1 -1
- vellum/workflows/runner/runner.py +167 -202
- vellum/workflows/state/base.py +0 -2
- vellum/workflows/types/core.py +1 -0
- vellum/workflows/types/tests/test_utils.py +1 -0
- vellum/workflows/types/utils.py +0 -1
- vellum/workflows/utils/functions.py +74 -0
- vellum/workflows/utils/tests/test_functions.py +171 -0
- vellum/workflows/utils/tests/test_vellum_variables.py +0 -1
- vellum/workflows/utils/vellum_variables.py +2 -2
- vellum/workflows/workflows/base.py +74 -34
- vellum/workflows/workflows/event_filters.py +7 -12
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/METADATA +1 -1
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/RECORD +122 -99
- vellum_cli/__init__.py +147 -13
- vellum_cli/config.py +0 -1
- vellum_cli/image_push.py +1 -1
- vellum_cli/pull.py +31 -19
- vellum_cli/push.py +9 -10
- vellum_cli/tests/__init__.py +0 -0
- vellum_cli/tests/conftest.py +40 -0
- vellum_cli/tests/test_main.py +11 -0
- vellum_cli/tests/test_pull.py +143 -71
- vellum_cli/tests/test_push.py +173 -0
- vellum_ee/workflows/display/base.py +1 -0
- vellum_ee/workflows/display/nodes/base_node_display.py +3 -2
- vellum_ee/workflows/display/nodes/base_node_vellum_display.py +2 -2
- vellum_ee/workflows/display/nodes/get_node_display_class.py +1 -1
- vellum_ee/workflows/display/nodes/tests/test_base_node_display.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/__init__.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/api_node.py +54 -58
- vellum_ee/workflows/display/nodes/vellum/conditional_node.py +39 -22
- vellum_ee/workflows/display/nodes/vellum/error_node.py +3 -3
- vellum_ee/workflows/display/nodes/vellum/final_output_node.py +0 -2
- vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +4 -2
- vellum_ee/workflows/display/nodes/vellum/map_node.py +11 -5
- vellum_ee/workflows/display/nodes/vellum/merge_node.py +2 -2
- vellum_ee/workflows/display/nodes/vellum/note_node.py +1 -3
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/search_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/templating_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +5 -5
- vellum_ee/workflows/display/nodes/vellum/utils.py +30 -10
- vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +45 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +42 -25
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +13 -39
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +62 -58
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +25 -4
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +2 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +2 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +2 -2
- vellum_ee/workflows/display/types.py +4 -4
- vellum_ee/workflows/display/utils/vellum.py +2 -6
- vellum_ee/workflows/display/vellum.py +1 -1
- vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py +4 -1
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +12 -5
- vellum/workflows/runner/types.py +0 -16
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/LICENSE +0 -0
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/WHEEL +0 -0
- {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.
|
20
|
+
"X-Fern-SDK-Version": "0.11.1",
|
21
21
|
}
|
22
22
|
headers["X_API_KEY"] = self.api_key
|
23
23
|
return headers
|
vellum/client/types/__init__.py
CHANGED
@@ -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,
|
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
|
vellum/evaluations/resources.py
CHANGED
@@ -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
|
10
|
-
from vellum.client import
|
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."
|
vellum/evaluations/utils/env.py
CHANGED
@@ -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
|
vellum/evaluations/utils/uuid.py
CHANGED
vellum/plugins/vellum_mypy.py
CHANGED
@@ -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(
|
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,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)
|
vellum/workflows/events/node.py
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
from typing import Any, Dict, Generic,
|
1
|
+
from typing import TYPE_CHECKING, Any, Dict, Generic, List, Literal, Optional, Set, Type, Union
|
2
2
|
|
3
|
-
from pydantic import
|
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
|
|