vellum-ai 0.11.0__py3-none-any.whl → 0.11.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vellum/__init__.py +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/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/nodes/core/inline_subworkflow_node/node.py +13 -7
- vellum/workflows/nodes/displayable/api_node/node.py +3 -2
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +9 -0
- vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +10 -1
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +10 -1
- vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +1 -1
- vellum/workflows/runner/runner.py +74 -70
- vellum/workflows/workflows/event_filters.py +4 -1
- {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.1.dist-info}/METADATA +1 -1
- {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.1.dist-info}/RECORD +43 -26
- vellum_cli/pull.py +3 -1
- vellum_cli/tests/test_pull.py +18 -0
- vellum_ee/workflows/display/base.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/api_node.py +53 -54
- vellum_ee/workflows/display/nodes/vellum/utils.py +26 -6
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +29 -1
- vellum_ee/workflows/display/vellum.py +1 -1
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +10 -7
- {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.1.dist-info}/LICENSE +0 -0
- {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.1.dist-info}/WHEEL +0 -0
- {vellum_ai-0.11.0.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.11.
|
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
|
@@ -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,10 +1,12 @@
|
|
1
1
|
from typing import TYPE_CHECKING, Generic, Iterator, Optional, Set, Type, TypeVar
|
2
2
|
|
3
|
+
from vellum.workflows.context import execution_context, get_parent_context
|
3
4
|
from vellum.workflows.errors.types import VellumErrorCode
|
4
5
|
from vellum.workflows.exceptions import NodeException
|
5
6
|
from vellum.workflows.nodes.bases.base_subworkflow_node import BaseSubworkflowNode
|
6
7
|
from vellum.workflows.outputs.base import BaseOutput, BaseOutputs
|
7
8
|
from vellum.workflows.state.base import BaseState
|
9
|
+
from vellum.workflows.state.context import WorkflowContext
|
8
10
|
from vellum.workflows.types.generics import StateType, WorkflowInputsType
|
9
11
|
|
10
12
|
if TYPE_CHECKING:
|
@@ -24,18 +26,22 @@ class InlineSubworkflowNode(BaseSubworkflowNode[StateType], Generic[StateType, W
|
|
24
26
|
subworkflow: Type["BaseWorkflow[WorkflowInputsType, InnerStateType]"]
|
25
27
|
|
26
28
|
def run(self) -> Iterator[BaseOutput]:
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
with execution_context(parent_context=get_parent_context() or self._context.parent_context):
|
30
|
+
subworkflow = self.subworkflow(
|
31
|
+
parent_state=self.state,
|
32
|
+
context=WorkflowContext(
|
33
|
+
_vellum_client=self._context._vellum_client,
|
34
|
+
),
|
35
|
+
)
|
36
|
+
subworkflow_stream = subworkflow.stream(
|
37
|
+
inputs=self._compile_subworkflow_inputs(),
|
38
|
+
)
|
34
39
|
|
35
40
|
outputs: Optional[BaseOutputs] = None
|
36
41
|
fulfilled_output_names: Set[str] = set()
|
37
42
|
|
38
43
|
for event in subworkflow_stream:
|
44
|
+
self._context._emit_subworkflow_event(event)
|
39
45
|
if event.name == "workflow.execution.streaming":
|
40
46
|
if event.output.is_fulfilled:
|
41
47
|
fulfilled_output_names.add(event.output.name)
|
@@ -18,13 +18,14 @@ class APINode(BaseAPINode):
|
|
18
18
|
|
19
19
|
authorization_type: Optional[AuthorizationType] = None - The type of authorization to use for the API call.
|
20
20
|
api_key_header_key: Optional[str] = None - The header key to use for the API key authorization.
|
21
|
-
bearer_token_value: Optional[str] = None - The bearer token value to use
|
21
|
+
bearer_token_value: Optional[Union[str, VellumSecretReference]] = None - The bearer token value to use
|
22
|
+
for the bearer token authorization.
|
22
23
|
"""
|
23
24
|
|
24
25
|
authorization_type: Optional[AuthorizationType] = None
|
25
26
|
api_key_header_key: Optional[str] = None
|
26
27
|
api_key_header_value: Optional[Union[str, VellumSecretReference]] = None
|
27
|
-
bearer_token_value: Optional[str] = None
|
28
|
+
bearer_token_value: Optional[Union[str, VellumSecretReference]] = None
|
28
29
|
|
29
30
|
def run(self) -> BaseAPINode.Outputs:
|
30
31
|
headers = self.headers or {}
|
@@ -14,7 +14,9 @@ from vellum import (
|
|
14
14
|
PromptRequestStringInput,
|
15
15
|
VellumVariable,
|
16
16
|
)
|
17
|
+
from vellum.client import RequestOptions
|
17
18
|
from vellum.workflows.constants import OMIT
|
19
|
+
from vellum.workflows.context import get_parent_context
|
18
20
|
from vellum.workflows.errors import VellumErrorCode
|
19
21
|
from vellum.workflows.exceptions import NodeException
|
20
22
|
from vellum.workflows.nodes.displayable.bases.base_prompt_node import BasePromptNode
|
@@ -48,6 +50,13 @@ class BaseInlinePromptNode(BasePromptNode, Generic[StateType]):
|
|
48
50
|
|
49
51
|
def _get_prompt_event_stream(self) -> Iterator[AdHocExecutePromptEvent]:
|
50
52
|
input_variables, input_values = self._compile_prompt_inputs()
|
53
|
+
current_parent_context = get_parent_context()
|
54
|
+
parent_context = current_parent_context.model_dump_json() if current_parent_context else None
|
55
|
+
request_options = self.request_options or RequestOptions()
|
56
|
+
request_options["additional_body_parameters"] = {
|
57
|
+
"execution_context": {"parent_context": parent_context},
|
58
|
+
**request_options.get("additional_body_parameters", {}),
|
59
|
+
}
|
51
60
|
|
52
61
|
return self._context.vellum_client.ad_hoc.adhoc_execute_prompt_stream(
|
53
62
|
ml_model=self.ml_model,
|
@@ -11,7 +11,9 @@ from vellum import (
|
|
11
11
|
RawPromptExecutionOverridesRequest,
|
12
12
|
StringInputRequest,
|
13
13
|
)
|
14
|
+
from vellum.client import RequestOptions
|
14
15
|
from vellum.workflows.constants import LATEST_RELEASE_TAG, OMIT
|
16
|
+
from vellum.workflows.context import get_parent_context
|
15
17
|
from vellum.workflows.errors import VellumErrorCode
|
16
18
|
from vellum.workflows.exceptions import NodeException
|
17
19
|
from vellum.workflows.nodes.displayable.bases.base_prompt_node import BasePromptNode
|
@@ -46,6 +48,13 @@ class BasePromptDeploymentNode(BasePromptNode, Generic[StateType]):
|
|
46
48
|
metadata: Optional[Dict[str, Optional[Any]]] = OMIT
|
47
49
|
|
48
50
|
def _get_prompt_event_stream(self) -> Iterator[ExecutePromptEvent]:
|
51
|
+
current_parent_context = get_parent_context()
|
52
|
+
parent_context = current_parent_context.model_dump() if current_parent_context else None
|
53
|
+
request_options = self.request_options or RequestOptions()
|
54
|
+
request_options["additional_body_parameters"] = {
|
55
|
+
"execution_context": {"parent_context": parent_context},
|
56
|
+
**request_options.get("additional_body_parameters", {}),
|
57
|
+
}
|
49
58
|
return self._context.vellum_client.execute_prompt_stream(
|
50
59
|
inputs=self._compile_prompt_inputs(),
|
51
60
|
prompt_deployment_id=str(self.deployment) if isinstance(self.deployment, UUID) else None,
|
@@ -56,7 +65,7 @@ class BasePromptDeploymentNode(BasePromptNode, Generic[StateType]):
|
|
56
65
|
raw_overrides=self.raw_overrides,
|
57
66
|
expand_raw=self.expand_raw,
|
58
67
|
metadata=self.metadata,
|
59
|
-
request_options=
|
68
|
+
request_options=request_options,
|
60
69
|
)
|
61
70
|
|
62
71
|
def _compile_prompt_inputs(self) -> List[PromptDeploymentInputRequest]:
|
@@ -13,6 +13,7 @@ from vellum import (
|
|
13
13
|
)
|
14
14
|
from vellum.core import RequestOptions
|
15
15
|
from vellum.workflows.constants import LATEST_RELEASE_TAG, OMIT
|
16
|
+
from vellum.workflows.context import get_parent_context
|
16
17
|
from vellum.workflows.errors import VellumErrorCode
|
17
18
|
from vellum.workflows.exceptions import NodeException
|
18
19
|
from vellum.workflows.nodes.bases.base_subworkflow_node.node import BaseSubworkflowNode
|
@@ -89,6 +90,13 @@ class SubworkflowDeploymentNode(BaseSubworkflowNode[StateType], Generic[StateTyp
|
|
89
90
|
return compiled_inputs
|
90
91
|
|
91
92
|
def run(self) -> Iterator[BaseOutput]:
|
93
|
+
current_parent_context = get_parent_context()
|
94
|
+
parent_context = current_parent_context.model_dump(mode="json") if current_parent_context else None
|
95
|
+
request_options = self.request_options or RequestOptions()
|
96
|
+
request_options["additional_body_parameters"] = {
|
97
|
+
"execution_context": {"parent_context": parent_context},
|
98
|
+
**request_options.get("additional_body_parameters", {}),
|
99
|
+
}
|
92
100
|
subworkflow_stream = self._context.vellum_client.execute_workflow_stream(
|
93
101
|
inputs=self._compile_subworkflow_inputs(),
|
94
102
|
workflow_deployment_id=str(self.deployment) if isinstance(self.deployment, UUID) else None,
|
@@ -97,8 +105,9 @@ class SubworkflowDeploymentNode(BaseSubworkflowNode[StateType], Generic[StateTyp
|
|
97
105
|
external_id=self.external_id,
|
98
106
|
event_types=["WORKFLOW"],
|
99
107
|
metadata=self.metadata,
|
100
|
-
request_options=
|
108
|
+
request_options=request_options,
|
101
109
|
)
|
110
|
+
# for some reason execution context isn't showing as an option? ^ failing mypy
|
102
111
|
|
103
112
|
outputs: Optional[List[WorkflowOutput]] = None
|
104
113
|
fulfilled_output_names: Set[str] = set()
|
@@ -75,5 +75,5 @@ def test_text_prompt_deployment_node__basic(vellum_client):
|
|
75
75
|
prompt_deployment_name="my-deployment",
|
76
76
|
raw_overrides=OMIT,
|
77
77
|
release_tag="LATEST",
|
78
|
-
request_options=None,
|
78
|
+
request_options={"additional_body_parameters": {"execution_context": {"parent_context": None}}},
|
79
79
|
)
|