vellum-ai 0.14.24__py3-none-any.whl → 0.14.25__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/types/vellum_sdk_error.py +1 -1
- vellum/client/types/workflow_execution_event_error_code.py +1 -0
- vellum/workflows/nodes/displayable/guardrail_node/node.py +13 -1
- {vellum_ai-0.14.24.dist-info → vellum_ai-0.14.25.dist-info}/METADATA +1 -1
- {vellum_ai-0.14.24.dist-info → vellum_ai-0.14.25.dist-info}/RECORD +15 -15
- vellum_ee/workflows/display/base.py +3 -10
- vellum_ee/workflows/display/nodes/base_node_display.py +2 -1
- vellum_ee/workflows/display/types.py +3 -3
- vellum_ee/workflows/display/vellum.py +11 -5
- vellum_ee/workflows/display/workflows/base_workflow_display.py +45 -17
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +2 -54
- {vellum_ai-0.14.24.dist-info → vellum_ai-0.14.25.dist-info}/LICENSE +0 -0
- {vellum_ai-0.14.24.dist-info → vellum_ai-0.14.25.dist-info}/WHEEL +0 -0
- {vellum_ai-0.14.24.dist-info → vellum_ai-0.14.25.dist-info}/entry_points.txt +0 -0
@@ -18,7 +18,7 @@ class BaseClientWrapper:
|
|
18
18
|
headers: typing.Dict[str, str] = {
|
19
19
|
"X-Fern-Language": "Python",
|
20
20
|
"X-Fern-SDK-Name": "vellum-ai",
|
21
|
-
"X-Fern-SDK-Version": "0.14.
|
21
|
+
"X-Fern-SDK-Version": "0.14.25",
|
22
22
|
}
|
23
23
|
headers["X_API_KEY"] = self.api_key
|
24
24
|
return headers
|
@@ -8,8 +8,8 @@ import pydantic
|
|
8
8
|
|
9
9
|
|
10
10
|
class VellumSdkError(UniversalBaseModel):
|
11
|
-
code: VellumSdkErrorCodeEnum
|
12
11
|
message: str
|
12
|
+
code: VellumSdkErrorCodeEnum
|
13
13
|
|
14
14
|
if IS_PYDANTIC_V2:
|
15
15
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
@@ -34,6 +34,7 @@ class GuardrailNode(BaseNode[StateType], Generic[StateType]):
|
|
34
34
|
|
35
35
|
class Outputs(BaseOutputs):
|
36
36
|
score: float
|
37
|
+
log: Optional[str]
|
37
38
|
|
38
39
|
def run(self) -> Outputs:
|
39
40
|
metric_execution = self._context.vellum_client.metric_definitions.execute_metric_definition(
|
@@ -52,8 +53,19 @@ class GuardrailNode(BaseNode[StateType], Generic[StateType]):
|
|
52
53
|
code=WorkflowErrorCode.INVALID_OUTPUTS,
|
53
54
|
)
|
54
55
|
|
56
|
+
log = metric_outputs.get("log")
|
57
|
+
|
58
|
+
if log is not None and not isinstance(log, str):
|
59
|
+
raise NodeException(
|
60
|
+
message="Metric execution log output must be of type 'str'",
|
61
|
+
code=WorkflowErrorCode.INVALID_OUTPUTS,
|
62
|
+
)
|
63
|
+
if log:
|
64
|
+
metric_outputs.pop("log")
|
65
|
+
|
55
66
|
metric_outputs.pop("score")
|
56
|
-
|
67
|
+
|
68
|
+
return self.Outputs(score=score, log=log, **metric_outputs)
|
57
69
|
|
58
70
|
def _compile_metric_inputs(self) -> List[MetricDefinitionInput]:
|
59
71
|
# TODO: We may want to consolidate with prompt deployment input compilation
|
@@ -22,11 +22,11 @@ vellum_ee/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
vellum_ee/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
23
|
vellum_ee/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
24
|
vellum_ee/workflows/display/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
|
-
vellum_ee/workflows/display/base.py,sha256=
|
25
|
+
vellum_ee/workflows/display/base.py,sha256=_Hr-ie3P7Ww1rPtLF7bJuHvgBh7Tj-w6A_IWlT7WAC4,2256
|
26
26
|
vellum_ee/workflows/display/editor/__init__.py,sha256=MSAgY91xCEg2neH5d8jXx5wRdR962ftZVa6vO9BGq9k,167
|
27
27
|
vellum_ee/workflows/display/editor/types.py,sha256=x-tOOCJ6CF4HmiKDfCmcc3bOVfc1EBlP5o6u5WEfLoY,567
|
28
28
|
vellum_ee/workflows/display/nodes/__init__.py,sha256=436iSAh_Ex5tC68oEYvNgPu05ZVIAVXnS4PKGrQeZ0Y,321
|
29
|
-
vellum_ee/workflows/display/nodes/base_node_display.py,sha256=
|
29
|
+
vellum_ee/workflows/display/nodes/base_node_display.py,sha256=cHK2OxeM2gWOshMHjaDHxWbRxvjkNHxOXbajjkrgk1w,19094
|
30
30
|
vellum_ee/workflows/display/nodes/base_node_vellum_display.py,sha256=WXbfVoGHTfl_owas2WKHwcRhfLeu0cAI4qLmKxfxjOs,1707
|
31
31
|
vellum_ee/workflows/display/nodes/get_node_display_class.py,sha256=59Nht1XAxMcNESFV1VmECrF01lZMnGkB_9JWaTAFnv0,2214
|
32
32
|
vellum_ee/workflows/display/nodes/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -89,16 +89,16 @@ vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_n
|
|
89
89
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py,sha256=UrueKI15Ez-DRfZpZH82o127v0LRXLP-s308kjDTPMI,4084
|
90
90
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py,sha256=eD5686C9nWC5s6t08vbAnm9qf9t53gYQM-E1FwAa75c,3035
|
91
91
|
vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py,sha256=zXTjfjUdji0WBu6ZhocvM4UiXEWFJIpds24sxV9TZT0,7714
|
92
|
-
vellum_ee/workflows/display/types.py,sha256=
|
92
|
+
vellum_ee/workflows/display/types.py,sha256=LOPqMVElveazfn2hIFQkpjtir-21W2MJohmwGcQ0Ab0,2544
|
93
93
|
vellum_ee/workflows/display/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
94
94
|
vellum_ee/workflows/display/utils/expressions.py,sha256=2u2o8Fqr-2C45FII01ej5rt6i8n2EEGiliXugK7buVw,1210
|
95
95
|
vellum_ee/workflows/display/utils/vellum.py,sha256=Pzmg9Xiq-hRaYxbOSDaJhIAQ4A0apQN6dURn_h5DnWI,9364
|
96
|
-
vellum_ee/workflows/display/vellum.py,sha256=
|
96
|
+
vellum_ee/workflows/display/vellum.py,sha256=Y41ZHHQfJfxxkIakHPEhuaSmlPJk7HdVfyKZTJJDzI0,3626
|
97
97
|
vellum_ee/workflows/display/workflows/__init__.py,sha256=kapXsC67VJcgSuiBMa86FdePG5A9kMB5Pi4Uy1O2ob4,207
|
98
|
-
vellum_ee/workflows/display/workflows/base_workflow_display.py,sha256=
|
98
|
+
vellum_ee/workflows/display/workflows/base_workflow_display.py,sha256=AyfrB1MZLWOF8OumihxJT6hwfjWCceh6jrzXfxiAkfw,20850
|
99
99
|
vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py,sha256=kp0u8LN_2IwshLrhMImhpZx1hRyAcD5gXY-kDuuaGMQ,1269
|
100
100
|
vellum_ee/workflows/display/workflows/tests/test_workflow_display.py,sha256=nD6_lZnNp56siVJwhlWzSEHdMaSKjvWlsJa31SqfQAE,10623
|
101
|
-
vellum_ee/workflows/display/workflows/vellum_workflow_display.py,sha256=
|
101
|
+
vellum_ee/workflows/display/workflows/vellum_workflow_display.py,sha256=fTp-fF4IeYJTgwC-WNrtda5O_ksp5h4JnD65zefrJ4o,14395
|
102
102
|
vellum_ee/workflows/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
103
103
|
vellum_ee/workflows/server/virtual_file_loader.py,sha256=ET-Q83W5Cgqzqz3qtFNwtS2nJEIcm3VtvR5kffsT3VY,2262
|
104
104
|
vellum_ee/workflows/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -128,7 +128,7 @@ vellum/client/README.md,sha256=JkCJjmMZl4jrPj46pkmL9dpK4gSzQQmP5I7z4aME4LY,4749
|
|
128
128
|
vellum/client/__init__.py,sha256=tKtdM1_GqmGq1gpi9ydWD_T-MM7fPn8QdHh8ww19cNI,117564
|
129
129
|
vellum/client/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
|
130
130
|
vellum/client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
131
|
-
vellum/client/core/client_wrapper.py,sha256=
|
131
|
+
vellum/client/core/client_wrapper.py,sha256=zFlsIV2xy7hRtKCi3BonxHsEUNqbr50eG39idgiPy_M,1869
|
132
132
|
vellum/client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
133
133
|
vellum/client/core/file.py,sha256=X9IbmkZmB2bB_DpmZAO3crWdXagOakAyn6UCOCImCPg,2322
|
134
134
|
vellum/client/core/http_client.py,sha256=R0pQpCppnEtxccGvXl4uJ76s7ro_65Fo_erlNNLp_AI,19228
|
@@ -672,7 +672,7 @@ vellum/client/types/vellum_error_request.py,sha256=RacXJoIgR8MeXXWDMI76pkxLBhCRg
|
|
672
672
|
vellum/client/types/vellum_image.py,sha256=wkFRgxOkxFPrmRdWTO58_41_vk0HYn5k4xsc-5ywxEs,637
|
673
673
|
vellum/client/types/vellum_image_request.py,sha256=_Gr4L7PSY8PNQINyTy04hPdwLc8_bR1RTUWZ73RQRYM,644
|
674
674
|
vellum/client/types/vellum_node_execution_event.py,sha256=64a6Gw9pGD5andcz1VOXI3fRjpoA_xiwv2T9GK6HLpA,735
|
675
|
-
vellum/client/types/vellum_sdk_error.py,sha256=
|
675
|
+
vellum/client/types/vellum_sdk_error.py,sha256=1AyCu_sUa8gx5wUJg5EtDYbvs9uQPhZfHjns1X3n8gI,656
|
676
676
|
vellum/client/types/vellum_sdk_error_code_enum.py,sha256=9lqUnPRvUW9tk5GASIE57FO3bc1RJoBTGcuFk5mGMA8,460
|
677
677
|
vellum/client/types/vellum_secret.py,sha256=jru3nBCquZHZ3wEdpgKZNmy2WFh26PVKrTNaXeVSsZQ,555
|
678
678
|
vellum/client/types/vellum_span.py,sha256=V5P1z-OFqgQQAZjek2toYudlh-fCu0NTt5uKuKm9hd0,258
|
@@ -697,7 +697,7 @@ vellum/client/types/workflow_execution_actual.py,sha256=8-eGI91UTAw2g3EpSC-axH_O
|
|
697
697
|
vellum/client/types/workflow_execution_actual_chat_history_request.py,sha256=L6U8tgM7SiU4qGJMZChFzj6HfHgO-YAlTXfbT7ZIaE4,1993
|
698
698
|
vellum/client/types/workflow_execution_actual_json_request.py,sha256=5QYaPCSOwFnjH_kTrB2bTznTMFExSZdBhTkmelf1h4Q,1931
|
699
699
|
vellum/client/types/workflow_execution_actual_string_request.py,sha256=1optEDv090iVev1l0Z9cgZ1NfNrHp2VRiNjmS7f7jtc,1895
|
700
|
-
vellum/client/types/workflow_execution_event_error_code.py,sha256=
|
700
|
+
vellum/client/types/workflow_execution_event_error_code.py,sha256=UQihvr26uUXt1UU6ngIOmYAk3QepeUVTymla5ulCNn8,451
|
701
701
|
vellum/client/types/workflow_execution_event_type.py,sha256=ESKqV3ItoAlqBooruf-i0AnmEh_GvCySZ0Co3r9Bvt0,170
|
702
702
|
vellum/client/types/workflow_execution_fulfilled_body.py,sha256=4M9fQdJy7nH5Y1HLq9VVlfTNW4F9jlj4k5SWty9fFqQ,746
|
703
703
|
vellum/client/types/workflow_execution_fulfilled_event.py,sha256=ud3jxSpoo3D85vyEewsf4Eqv1AdBfwclOGmJu9lfOv8,2412
|
@@ -1554,7 +1554,7 @@ vellum/workflows/nodes/displayable/final_output_node/node.py,sha256=PuQ0RvtAmoSI
|
|
1554
1554
|
vellum/workflows/nodes/displayable/final_output_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1555
1555
|
vellum/workflows/nodes/displayable/final_output_node/tests/test_node.py,sha256=E6LQ74qZjY4Xi4avx2qdOCgGhF8pEcNLBh8cqYRkzMI,709
|
1556
1556
|
vellum/workflows/nodes/displayable/guardrail_node/__init__.py,sha256=Ab5eXmOoBhyV4dMWdzh32HLUmnPIBEK_zFCT38C4Fng,68
|
1557
|
-
vellum/workflows/nodes/displayable/guardrail_node/node.py,sha256=
|
1557
|
+
vellum/workflows/nodes/displayable/guardrail_node/node.py,sha256=g6xG2-fEKGxYtJwbex1X5IodP3cJ7DqSthi80d2-Lo4,4395
|
1558
1558
|
vellum/workflows/nodes/displayable/inline_prompt_node/__init__.py,sha256=gSUOoEZLlrx35-tQhSAd3An8WDwBqyiQh-sIebLU9wU,74
|
1559
1559
|
vellum/workflows/nodes/displayable/inline_prompt_node/node.py,sha256=8RXZqWMzViUjFfbpmcy1gkSsKnEpci8BGwsuPYv4xMQ,3380
|
1560
1560
|
vellum/workflows/nodes/displayable/inline_prompt_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -1646,8 +1646,8 @@ vellum/workflows/workflows/event_filters.py,sha256=GSxIgwrX26a1Smfd-6yss2abGCnad
|
|
1646
1646
|
vellum/workflows/workflows/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1647
1647
|
vellum/workflows/workflows/tests/test_base_workflow.py,sha256=tCxrV3QBHL8wfdEO3bvKteDdw32xBlUl1_WxkAwaONw,8344
|
1648
1648
|
vellum/workflows/workflows/tests/test_context.py,sha256=VJBUcyWVtMa_lE5KxdhgMu0WYNYnUQUDvTF7qm89hJ0,2333
|
1649
|
-
vellum_ai-0.14.
|
1650
|
-
vellum_ai-0.14.
|
1651
|
-
vellum_ai-0.14.
|
1652
|
-
vellum_ai-0.14.
|
1653
|
-
vellum_ai-0.14.
|
1649
|
+
vellum_ai-0.14.25.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
|
1650
|
+
vellum_ai-0.14.25.dist-info/METADATA,sha256=X3sUFpricDkxi-Wt9aftPV-nGbncI-e1hW3vAXHRyLY,5484
|
1651
|
+
vellum_ai-0.14.25.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
1652
|
+
vellum_ai-0.14.25.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
|
1653
|
+
vellum_ai-0.14.25.dist-info/RECORD,,
|
@@ -35,10 +35,6 @@ class WorkflowMetaDisplayOverrides(WorkflowMetaDisplay):
|
|
35
35
|
pass
|
36
36
|
|
37
37
|
|
38
|
-
WorkflowMetaDisplayType = TypeVar("WorkflowMetaDisplayType", bound=WorkflowMetaDisplay)
|
39
|
-
WorkflowMetaDisplayOverridesType = TypeVar("WorkflowMetaDisplayOverridesType", bound=WorkflowMetaDisplayOverrides)
|
40
|
-
|
41
|
-
|
42
38
|
@dataclass
|
43
39
|
class WorkflowInputsDisplayOverrides:
|
44
40
|
id: UUID
|
@@ -82,19 +78,16 @@ class EdgeDisplayOverrides(EdgeDisplay):
|
|
82
78
|
|
83
79
|
|
84
80
|
@dataclass
|
85
|
-
class
|
81
|
+
class EntrypointDisplay:
|
86
82
|
id: UUID
|
83
|
+
edge_display: EdgeDisplay
|
87
84
|
|
88
85
|
|
89
86
|
@dataclass
|
90
|
-
class EntrypointDisplay
|
87
|
+
class EntrypointDisplayOverrides(EntrypointDisplay):
|
91
88
|
pass
|
92
89
|
|
93
90
|
|
94
|
-
EntrypointDisplayType = TypeVar("EntrypointDisplayType", bound=EntrypointDisplay)
|
95
|
-
EntrypointDisplayOverridesType = TypeVar("EntrypointDisplayOverridesType", bound=EntrypointDisplayOverrides)
|
96
|
-
|
97
|
-
|
98
91
|
@dataclass
|
99
92
|
class WorkflowOutputDisplay:
|
100
93
|
id: UUID
|
@@ -31,6 +31,7 @@ from vellum.workflows.expressions.is_undefined import IsUndefinedExpression
|
|
31
31
|
from vellum.workflows.expressions.not_between import NotBetweenExpression
|
32
32
|
from vellum.workflows.expressions.parse_json import ParseJsonExpression
|
33
33
|
from vellum.workflows.nodes.bases.base import BaseNode
|
34
|
+
from vellum.workflows.nodes.displayable.bases.utils import primitive_to_vellum_value
|
34
35
|
from vellum.workflows.nodes.utils import get_wrapped_node
|
35
36
|
from vellum.workflows.ports import Port
|
36
37
|
from vellum.workflows.references import OutputReference
|
@@ -50,7 +51,7 @@ from vellum_ee.workflows.display.editor.types import NodeDisplayData
|
|
50
51
|
from vellum_ee.workflows.display.nodes.get_node_display_class import get_node_display_class
|
51
52
|
from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay, PortDisplay, PortDisplayOverrides
|
52
53
|
from vellum_ee.workflows.display.utils.expressions import get_child_descriptor
|
53
|
-
from vellum_ee.workflows.display.utils.vellum import convert_descriptor_to_operator
|
54
|
+
from vellum_ee.workflows.display.utils.vellum import convert_descriptor_to_operator
|
54
55
|
|
55
56
|
if TYPE_CHECKING:
|
56
57
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
@@ -8,7 +8,7 @@ from vellum.workflows.ports import Port
|
|
8
8
|
from vellum.workflows.references import OutputReference, StateValueReference, WorkflowInputReference
|
9
9
|
from vellum_ee.workflows.display.base import (
|
10
10
|
EdgeDisplay,
|
11
|
-
|
11
|
+
EntrypointDisplay,
|
12
12
|
StateValueDisplayType,
|
13
13
|
WorkflowInputsDisplayType,
|
14
14
|
WorkflowMetaDisplay,
|
@@ -24,6 +24,7 @@ WorkflowDisplayType = TypeVar("WorkflowDisplayType", bound="BaseWorkflowDisplay"
|
|
24
24
|
|
25
25
|
NodeDisplays = Dict[Type[BaseNode], BaseNodeDisplay]
|
26
26
|
NodeOutputDisplays = Dict[OutputReference, Tuple[Type[BaseNode], NodeOutputDisplay]]
|
27
|
+
EntrypointDisplays = Dict[Type[BaseNode], EntrypointDisplay]
|
27
28
|
WorkflowOutputDisplays = Dict[BaseDescriptor, WorkflowOutputDisplay]
|
28
29
|
EdgeDisplays = Dict[Tuple[Port, Type[BaseNode]], EdgeDisplay]
|
29
30
|
PortDisplays = Dict[Port, PortDisplay]
|
@@ -34,7 +35,6 @@ class WorkflowDisplayContext(
|
|
34
35
|
Generic[
|
35
36
|
WorkflowInputsDisplayType,
|
36
37
|
StateValueDisplayType,
|
37
|
-
EntrypointDisplayType,
|
38
38
|
]
|
39
39
|
):
|
40
40
|
workflow_display_class: Type["BaseWorkflowDisplay"]
|
@@ -48,7 +48,7 @@ class WorkflowDisplayContext(
|
|
48
48
|
node_displays: NodeDisplays = field(default_factory=dict)
|
49
49
|
global_node_displays: NodeDisplays = field(default_factory=dict)
|
50
50
|
global_node_output_displays: NodeOutputDisplays = field(default_factory=dict)
|
51
|
-
entrypoint_displays:
|
51
|
+
entrypoint_displays: EntrypointDisplays = field(default_factory=dict)
|
52
52
|
workflow_output_displays: WorkflowOutputDisplays = field(default_factory=dict)
|
53
53
|
edge_displays: EdgeDisplays = field(default_factory=dict)
|
54
54
|
port_displays: PortDisplays = field(default_factory=dict)
|
@@ -4,9 +4,7 @@ from typing import List, Literal, Optional
|
|
4
4
|
|
5
5
|
from vellum.core import UniversalBaseModel
|
6
6
|
from vellum_ee.workflows.display.base import (
|
7
|
-
EdgeDisplay,
|
8
7
|
EdgeDisplayOverrides,
|
9
|
-
EntrypointDisplay,
|
10
8
|
EntrypointDisplayOverrides,
|
11
9
|
StateValueDisplay,
|
12
10
|
StateValueDisplayOverrides,
|
@@ -93,13 +91,21 @@ class EdgeVellumDisplay(EdgeVellumDisplayOverrides):
|
|
93
91
|
|
94
92
|
|
95
93
|
@dataclass
|
96
|
-
class EntrypointVellumDisplayOverrides(
|
97
|
-
|
94
|
+
class EntrypointVellumDisplayOverrides(EntrypointDisplayOverrides):
|
95
|
+
"""
|
96
|
+
DEPRECATED: Use EntrypointDisplay instead. Will be removed in 0.15.0
|
97
|
+
"""
|
98
|
+
|
99
|
+
pass
|
98
100
|
|
99
101
|
|
100
102
|
@dataclass
|
101
103
|
class EntrypointVellumDisplay(EntrypointVellumDisplayOverrides):
|
102
|
-
|
104
|
+
"""
|
105
|
+
DEPRECATED: Use EntrypointDisplay instead. Will be removed in 0.15.0
|
106
|
+
"""
|
107
|
+
|
108
|
+
pass
|
103
109
|
|
104
110
|
|
105
111
|
@dataclass
|
@@ -19,8 +19,7 @@ from vellum.workflows.types.generics import WorkflowType
|
|
19
19
|
from vellum.workflows.utils.uuids import uuid4_from_hash
|
20
20
|
from vellum_ee.workflows.display.base import (
|
21
21
|
EdgeDisplay,
|
22
|
-
|
23
|
-
EntrypointDisplayType,
|
22
|
+
EntrypointDisplay,
|
24
23
|
StateValueDisplayOverridesType,
|
25
24
|
StateValueDisplayType,
|
26
25
|
WorkflowInputsDisplayOverridesType,
|
@@ -28,6 +27,7 @@ from vellum_ee.workflows.display.base import (
|
|
28
27
|
WorkflowMetaDisplay,
|
29
28
|
WorkflowOutputDisplay,
|
30
29
|
)
|
30
|
+
from vellum_ee.workflows.display.editor.types import NodeDisplayData
|
31
31
|
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
32
32
|
from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
|
33
33
|
from vellum_ee.workflows.display.nodes.get_node_display_class import get_node_display_class
|
@@ -35,6 +35,7 @@ from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay, PortDispl
|
|
35
35
|
from vellum_ee.workflows.display.nodes.utils import raise_if_descriptor
|
36
36
|
from vellum_ee.workflows.display.types import (
|
37
37
|
EdgeDisplays,
|
38
|
+
EntrypointDisplays,
|
38
39
|
NodeDisplays,
|
39
40
|
NodeOutputDisplays,
|
40
41
|
PortDisplays,
|
@@ -53,8 +54,6 @@ class BaseWorkflowDisplay(
|
|
53
54
|
WorkflowInputsDisplayOverridesType,
|
54
55
|
StateValueDisplayType,
|
55
56
|
StateValueDisplayOverridesType,
|
56
|
-
EntrypointDisplayType,
|
57
|
-
EntrypointDisplayOverridesType,
|
58
57
|
]
|
59
58
|
):
|
60
59
|
# Used to specify the display data for a workflow.
|
@@ -67,7 +66,7 @@ class BaseWorkflowDisplay(
|
|
67
66
|
state_value_displays: Dict[StateValueReference, StateValueDisplayOverridesType] = {}
|
68
67
|
|
69
68
|
# Used to explicitly specify display data for a workflow's entrypoints.
|
70
|
-
entrypoint_displays:
|
69
|
+
entrypoint_displays: EntrypointDisplays = {}
|
71
70
|
|
72
71
|
# Used to explicitly specify display data for a workflow's outputs.
|
73
72
|
output_displays: WorkflowOutputDisplays = {}
|
@@ -93,7 +92,6 @@ class BaseWorkflowDisplay(
|
|
93
92
|
WorkflowDisplayContext[
|
94
93
|
WorkflowInputsDisplayType,
|
95
94
|
StateValueDisplayType,
|
96
|
-
EntrypointDisplayType,
|
97
95
|
]
|
98
96
|
] = None,
|
99
97
|
dry_run: bool = False,
|
@@ -188,9 +186,8 @@ class BaseWorkflowDisplay(
|
|
188
186
|
) -> WorkflowDisplayContext[
|
189
187
|
WorkflowInputsDisplayType,
|
190
188
|
StateValueDisplayType,
|
191
|
-
EntrypointDisplayType,
|
192
189
|
]:
|
193
|
-
|
190
|
+
workflow_meta_display = self._generate_workflow_meta_display()
|
194
191
|
|
195
192
|
global_node_output_displays: NodeOutputDisplays = (
|
196
193
|
copy(self._parent_display_context.global_node_output_displays) if self._parent_display_context else {}
|
@@ -247,14 +244,14 @@ class BaseWorkflowDisplay(
|
|
247
244
|
state_value_displays[state_value] = state_value_display
|
248
245
|
global_state_value_displays[state_value] = state_value_display
|
249
246
|
|
250
|
-
entrypoint_displays:
|
247
|
+
entrypoint_displays: EntrypointDisplays = {}
|
251
248
|
for entrypoint in self._workflow.get_entrypoints():
|
252
249
|
if entrypoint in entrypoint_displays:
|
253
250
|
continue
|
254
251
|
|
255
252
|
entrypoint_display_overrides = self.entrypoint_displays.get(entrypoint)
|
256
253
|
entrypoint_displays[entrypoint] = self._generate_entrypoint_display(
|
257
|
-
entrypoint,
|
254
|
+
entrypoint, workflow_meta_display, node_displays, overrides=entrypoint_display_overrides
|
258
255
|
)
|
259
256
|
|
260
257
|
edge_displays: Dict[Tuple[Port, Type[BaseNode]], EdgeDisplay] = {}
|
@@ -290,7 +287,7 @@ class BaseWorkflowDisplay(
|
|
290
287
|
)
|
291
288
|
|
292
289
|
return WorkflowDisplayContext(
|
293
|
-
workflow_display=
|
290
|
+
workflow_display=workflow_meta_display,
|
294
291
|
workflow_input_displays=workflow_input_displays,
|
295
292
|
global_workflow_input_displays=global_workflow_input_displays,
|
296
293
|
state_value_displays=state_value_displays,
|
@@ -305,9 +302,24 @@ class BaseWorkflowDisplay(
|
|
305
302
|
workflow_display_class=self.__class__,
|
306
303
|
)
|
307
304
|
|
308
|
-
@abstractmethod
|
309
305
|
def _generate_workflow_meta_display(self) -> WorkflowMetaDisplay:
|
310
|
-
|
306
|
+
overrides = self.workflow_display
|
307
|
+
if overrides:
|
308
|
+
return WorkflowMetaDisplay(
|
309
|
+
entrypoint_node_id=overrides.entrypoint_node_id,
|
310
|
+
entrypoint_node_source_handle_id=overrides.entrypoint_node_source_handle_id,
|
311
|
+
entrypoint_node_display=overrides.entrypoint_node_display,
|
312
|
+
display_data=overrides.display_data,
|
313
|
+
)
|
314
|
+
|
315
|
+
entrypoint_node_id = uuid4_from_hash(f"{self.workflow_id}|entrypoint_node_id")
|
316
|
+
entrypoint_node_source_handle_id = uuid4_from_hash(f"{self.workflow_id}|entrypoint_node_source_handle_id")
|
317
|
+
|
318
|
+
return WorkflowMetaDisplay(
|
319
|
+
entrypoint_node_id=entrypoint_node_id,
|
320
|
+
entrypoint_node_source_handle_id=entrypoint_node_source_handle_id,
|
321
|
+
entrypoint_node_display=NodeDisplayData(),
|
322
|
+
)
|
311
323
|
|
312
324
|
@abstractmethod
|
313
325
|
def _generate_workflow_input_display(
|
@@ -321,15 +333,31 @@ class BaseWorkflowDisplay(
|
|
321
333
|
) -> StateValueDisplayType:
|
322
334
|
pass
|
323
335
|
|
324
|
-
@abstractmethod
|
325
336
|
def _generate_entrypoint_display(
|
326
337
|
self,
|
327
338
|
entrypoint: Type[BaseNode],
|
328
339
|
workflow_display: WorkflowMetaDisplay,
|
329
340
|
node_displays: Dict[Type[BaseNode], BaseNodeDisplay],
|
330
|
-
overrides: Optional[
|
331
|
-
) ->
|
332
|
-
|
341
|
+
overrides: Optional[EntrypointDisplay] = None,
|
342
|
+
) -> EntrypointDisplay:
|
343
|
+
entrypoint_node_id = workflow_display.entrypoint_node_id
|
344
|
+
|
345
|
+
edge_display_overrides = overrides.edge_display if overrides else None
|
346
|
+
entrypoint_id = (
|
347
|
+
edge_display_overrides.id
|
348
|
+
if edge_display_overrides
|
349
|
+
else uuid4_from_hash(f"{self.workflow_id}|id|{entrypoint_node_id}")
|
350
|
+
)
|
351
|
+
|
352
|
+
entrypoint_target = get_unadorned_node(entrypoint)
|
353
|
+
target_node_display = node_displays[entrypoint_target]
|
354
|
+
target_node_id = target_node_display.node_id
|
355
|
+
|
356
|
+
edge_display = edge_display_overrides or self._generate_edge_display_from_source(
|
357
|
+
entrypoint_node_id, target_node_id
|
358
|
+
)
|
359
|
+
|
360
|
+
return EntrypointDisplay(id=entrypoint_id, edge_display=edge_display)
|
333
361
|
|
334
362
|
def _generate_workflow_output_display(self, output: BaseDescriptor) -> WorkflowOutputDisplay:
|
335
363
|
output_id = uuid4_from_hash(f"{self.workflow_id}|id|{output.name}")
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import logging
|
2
2
|
from uuid import UUID
|
3
|
-
from typing import
|
3
|
+
from typing import Optional, cast
|
4
4
|
|
5
5
|
from vellum.workflows.descriptors.base import BaseDescriptor
|
6
|
-
from vellum.workflows.nodes.bases import BaseNode
|
7
6
|
from vellum.workflows.nodes.displayable.bases.utils import primitive_to_vellum_value
|
8
7
|
from vellum.workflows.nodes.displayable.final_output_node import FinalOutputNode
|
9
8
|
from vellum.workflows.nodes.utils import get_unadorned_node, get_unadorned_port
|
@@ -12,20 +11,16 @@ from vellum.workflows.references.output import OutputReference
|
|
12
11
|
from vellum.workflows.types.core import JsonArray, JsonObject
|
13
12
|
from vellum.workflows.types.generics import WorkflowType
|
14
13
|
from vellum.workflows.utils.uuids import uuid4_from_hash
|
15
|
-
from vellum_ee.workflows.display.
|
14
|
+
from vellum_ee.workflows.display.editor.types import NodeDisplayData
|
16
15
|
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
17
16
|
from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
|
18
17
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
|
19
18
|
from vellum_ee.workflows.display.utils.vellum import infer_vellum_variable_type
|
20
19
|
from vellum_ee.workflows.display.vellum import (
|
21
|
-
EntrypointVellumDisplay,
|
22
|
-
EntrypointVellumDisplayOverrides,
|
23
|
-
NodeDisplayData,
|
24
20
|
StateValueVellumDisplay,
|
25
21
|
StateValueVellumDisplayOverrides,
|
26
22
|
WorkflowInputsVellumDisplay,
|
27
23
|
WorkflowInputsVellumDisplayOverrides,
|
28
|
-
WorkflowMetaVellumDisplay,
|
29
24
|
)
|
30
25
|
from vellum_ee.workflows.display.workflows.base_workflow_display import BaseWorkflowDisplay
|
31
26
|
|
@@ -39,8 +34,6 @@ class VellumWorkflowDisplay(
|
|
39
34
|
WorkflowInputsVellumDisplayOverrides,
|
40
35
|
StateValueVellumDisplay,
|
41
36
|
StateValueVellumDisplayOverrides,
|
42
|
-
EntrypointVellumDisplay,
|
43
|
-
EntrypointVellumDisplayOverrides,
|
44
37
|
]
|
45
38
|
):
|
46
39
|
node_display_base_class = BaseNodeDisplay
|
@@ -288,25 +281,6 @@ class VellumWorkflowDisplay(
|
|
288
281
|
"output_variables": output_variables,
|
289
282
|
}
|
290
283
|
|
291
|
-
def _generate_workflow_meta_display(self) -> WorkflowMetaVellumDisplay:
|
292
|
-
overrides = self.workflow_display
|
293
|
-
if overrides:
|
294
|
-
return WorkflowMetaVellumDisplay(
|
295
|
-
entrypoint_node_id=overrides.entrypoint_node_id,
|
296
|
-
entrypoint_node_source_handle_id=overrides.entrypoint_node_source_handle_id,
|
297
|
-
entrypoint_node_display=overrides.entrypoint_node_display,
|
298
|
-
display_data=overrides.display_data,
|
299
|
-
)
|
300
|
-
|
301
|
-
entrypoint_node_id = uuid4_from_hash(f"{self.workflow_id}|entrypoint_node_id")
|
302
|
-
entrypoint_node_source_handle_id = uuid4_from_hash(f"{self.workflow_id}|entrypoint_node_source_handle_id")
|
303
|
-
|
304
|
-
return WorkflowMetaVellumDisplay(
|
305
|
-
entrypoint_node_id=entrypoint_node_id,
|
306
|
-
entrypoint_node_source_handle_id=entrypoint_node_source_handle_id,
|
307
|
-
entrypoint_node_display=NodeDisplayData(),
|
308
|
-
)
|
309
|
-
|
310
284
|
def _generate_workflow_input_display(
|
311
285
|
self, workflow_input: WorkflowInputReference, overrides: Optional[WorkflowInputsVellumDisplayOverrides] = None
|
312
286
|
) -> WorkflowInputsVellumDisplay:
|
@@ -340,29 +314,3 @@ class VellumWorkflowDisplay(
|
|
340
314
|
state_value_id = uuid4_from_hash(f"{self.workflow_id}|state_values|id|{state_value.name}")
|
341
315
|
|
342
316
|
return StateValueVellumDisplay(id=state_value_id, name=name, required=required, color=color)
|
343
|
-
|
344
|
-
def _generate_entrypoint_display(
|
345
|
-
self,
|
346
|
-
entrypoint: Type[BaseNode],
|
347
|
-
workflow_display: WorkflowMetaDisplay,
|
348
|
-
node_displays: Dict[Type[BaseNode], BaseNodeDisplay],
|
349
|
-
overrides: Optional[EntrypointVellumDisplayOverrides] = None,
|
350
|
-
) -> EntrypointVellumDisplay:
|
351
|
-
entrypoint_node_id = workflow_display.entrypoint_node_id
|
352
|
-
|
353
|
-
edge_display_overrides = overrides.edge_display if overrides else None
|
354
|
-
entrypoint_id = (
|
355
|
-
edge_display_overrides.id
|
356
|
-
if edge_display_overrides
|
357
|
-
else uuid4_from_hash(f"{self.workflow_id}|id|{entrypoint_node_id}")
|
358
|
-
)
|
359
|
-
|
360
|
-
entrypoint_target = get_unadorned_node(entrypoint)
|
361
|
-
target_node_display = node_displays[entrypoint_target]
|
362
|
-
target_node_id = target_node_display.node_id
|
363
|
-
|
364
|
-
edge_display = edge_display_overrides or self._generate_edge_display_from_source(
|
365
|
-
entrypoint_node_id, target_node_id
|
366
|
-
)
|
367
|
-
|
368
|
-
return EntrypointVellumDisplay(id=entrypoint_id, edge_display=edge_display)
|
File without changes
|
File without changes
|
File without changes
|