vellum-ai 0.14.22__py3-none-any.whl → 0.14.24__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 +122 -0
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/resources/workflow_deployments/client.py +250 -0
- vellum/client/types/__init__.py +122 -0
- vellum/client/types/api_request_parent_context.py +41 -0
- vellum/client/types/api_version_enum.py +5 -0
- vellum/client/types/base_output.py +21 -0
- vellum/client/types/code_resource_definition.py +31 -0
- vellum/client/types/external_input_descriptor.py +23 -0
- vellum/client/types/invoked_port.py +19 -0
- vellum/client/types/ml_model_usage_wrapper.py +21 -0
- vellum/client/types/node_event_display_context.py +30 -0
- vellum/client/types/node_execution_fulfilled_body.py +24 -0
- vellum/client/types/node_execution_fulfilled_event.py +49 -0
- vellum/client/types/node_execution_initiated_body.py +21 -0
- vellum/client/types/node_execution_initiated_event.py +49 -0
- vellum/client/types/node_execution_paused_body.py +20 -0
- vellum/client/types/node_execution_paused_event.py +49 -0
- vellum/client/types/node_execution_rejected_body.py +22 -0
- vellum/client/types/node_execution_rejected_event.py +49 -0
- vellum/client/types/node_execution_resumed_body.py +20 -0
- vellum/client/types/node_execution_resumed_event.py +49 -0
- vellum/client/types/node_execution_span.py +46 -0
- vellum/client/types/node_execution_span_attributes.py +19 -0
- vellum/client/types/node_execution_streaming_body.py +22 -0
- vellum/client/types/node_execution_streaming_event.py +49 -0
- vellum/client/types/node_parent_context.py +43 -0
- vellum/client/types/parent_context.py +21 -0
- vellum/client/types/prompt_deployment_parent_context.py +49 -0
- vellum/client/types/slim_workflow_execution_read.py +54 -0
- vellum/client/types/span_link.py +41 -0
- vellum/client/types/span_link_type_enum.py +5 -0
- vellum/client/types/vellum_code_resource_definition.py +25 -0
- vellum/client/types/vellum_node_execution_event.py +18 -0
- vellum/client/types/vellum_sdk_error.py +21 -0
- vellum/client/types/vellum_sdk_error_code_enum.py +20 -0
- vellum/client/types/vellum_span.py +7 -0
- vellum/client/types/vellum_workflow_execution_event.py +20 -0
- vellum/client/types/workflow_deployment_event_executions_response.py +55 -0
- vellum/client/types/workflow_deployment_parent_context.py +49 -0
- vellum/client/types/workflow_error.py +7 -0
- vellum/client/types/workflow_event_display_context.py +28 -0
- vellum/client/types/workflow_event_execution_read.py +60 -0
- vellum/client/types/workflow_execution_actual.py +30 -0
- vellum/client/types/workflow_execution_fulfilled_body.py +21 -0
- vellum/client/types/workflow_execution_fulfilled_event.py +49 -0
- vellum/client/types/workflow_execution_initiated_body.py +30 -0
- vellum/client/types/workflow_execution_initiated_event.py +53 -0
- vellum/client/types/workflow_execution_paused_body.py +22 -0
- vellum/client/types/workflow_execution_paused_event.py +49 -0
- vellum/client/types/workflow_execution_rejected_body.py +22 -0
- vellum/client/types/workflow_execution_rejected_event.py +49 -0
- vellum/client/types/workflow_execution_resumed_body.py +20 -0
- vellum/client/types/workflow_execution_resumed_event.py +49 -0
- vellum/client/types/workflow_execution_snapshotted_body.py +21 -0
- vellum/client/types/workflow_execution_snapshotted_event.py +51 -0
- vellum/client/types/workflow_execution_span.py +50 -0
- vellum/client/types/workflow_execution_span_attributes.py +19 -0
- vellum/client/types/workflow_execution_streaming_body.py +22 -0
- vellum/client/types/workflow_execution_streaming_event.py +49 -0
- vellum/client/types/workflow_execution_usage_calculation_fulfilled_body.py +22 -0
- vellum/client/types/workflow_execution_view_online_eval_metric_result.py +30 -0
- vellum/client/types/workflow_initialization_error.py +24 -0
- vellum/client/types/workflow_parent_context.py +43 -0
- vellum/client/types/workflow_sandbox_parent_context.py +44 -0
- vellum/plugins/pydantic.py +2 -0
- vellum/types/api_request_parent_context.py +3 -0
- vellum/types/api_version_enum.py +3 -0
- vellum/types/base_output.py +3 -0
- vellum/types/code_resource_definition.py +3 -0
- vellum/types/external_input_descriptor.py +3 -0
- vellum/types/invoked_port.py +3 -0
- vellum/types/ml_model_usage_wrapper.py +3 -0
- vellum/types/node_event_display_context.py +3 -0
- vellum/types/node_execution_fulfilled_body.py +3 -0
- vellum/types/node_execution_fulfilled_event.py +3 -0
- vellum/types/node_execution_initiated_body.py +3 -0
- vellum/types/node_execution_initiated_event.py +3 -0
- vellum/types/node_execution_paused_body.py +3 -0
- vellum/types/node_execution_paused_event.py +3 -0
- vellum/types/node_execution_rejected_body.py +3 -0
- vellum/types/node_execution_rejected_event.py +3 -0
- vellum/types/node_execution_resumed_body.py +3 -0
- vellum/types/node_execution_resumed_event.py +3 -0
- vellum/types/node_execution_span.py +3 -0
- vellum/types/node_execution_span_attributes.py +3 -0
- vellum/types/node_execution_streaming_body.py +3 -0
- vellum/types/node_execution_streaming_event.py +3 -0
- vellum/types/node_parent_context.py +3 -0
- vellum/types/parent_context.py +3 -0
- vellum/types/prompt_deployment_parent_context.py +3 -0
- vellum/types/slim_workflow_execution_read.py +3 -0
- vellum/types/span_link.py +3 -0
- vellum/types/span_link_type_enum.py +3 -0
- vellum/types/vellum_code_resource_definition.py +3 -0
- vellum/types/vellum_node_execution_event.py +3 -0
- vellum/types/vellum_sdk_error.py +3 -0
- vellum/types/vellum_sdk_error_code_enum.py +3 -0
- vellum/types/vellum_span.py +3 -0
- vellum/types/vellum_workflow_execution_event.py +3 -0
- vellum/types/workflow_deployment_event_executions_response.py +3 -0
- vellum/types/workflow_deployment_parent_context.py +3 -0
- vellum/types/workflow_error.py +3 -0
- vellum/types/workflow_event_display_context.py +3 -0
- vellum/types/workflow_event_execution_read.py +3 -0
- vellum/types/workflow_execution_actual.py +3 -0
- vellum/types/workflow_execution_fulfilled_body.py +3 -0
- vellum/types/workflow_execution_fulfilled_event.py +3 -0
- vellum/types/workflow_execution_initiated_body.py +3 -0
- vellum/types/workflow_execution_initiated_event.py +3 -0
- vellum/types/workflow_execution_paused_body.py +3 -0
- vellum/types/workflow_execution_paused_event.py +3 -0
- vellum/types/workflow_execution_rejected_body.py +3 -0
- vellum/types/workflow_execution_rejected_event.py +3 -0
- vellum/types/workflow_execution_resumed_body.py +3 -0
- vellum/types/workflow_execution_resumed_event.py +3 -0
- vellum/types/workflow_execution_snapshotted_body.py +3 -0
- vellum/types/workflow_execution_snapshotted_event.py +3 -0
- vellum/types/workflow_execution_span.py +3 -0
- vellum/types/workflow_execution_span_attributes.py +3 -0
- vellum/types/workflow_execution_streaming_body.py +3 -0
- vellum/types/workflow_execution_streaming_event.py +3 -0
- vellum/types/workflow_execution_usage_calculation_fulfilled_body.py +3 -0
- vellum/types/workflow_execution_view_online_eval_metric_result.py +3 -0
- vellum/types/workflow_initialization_error.py +3 -0
- vellum/types/workflow_parent_context.py +3 -0
- vellum/types/workflow_sandbox_parent_context.py +3 -0
- vellum/workflows/nodes/core/inline_subworkflow_node/node.py +6 -0
- vellum/workflows/nodes/core/inline_subworkflow_node/tests/test_node.py +27 -0
- vellum/workflows/nodes/core/retry_node/tests/test_node.py +0 -23
- vellum/workflows/workflows/base.py +2 -2
- vellum/workflows/workflows/tests/test_base_workflow.py +10 -0
- {vellum_ai-0.14.22.dist-info → vellum_ai-0.14.24.dist-info}/METADATA +1 -1
- {vellum_ai-0.14.22.dist-info → vellum_ai-0.14.24.dist-info}/RECORD +157 -33
- vellum_ee/workflows/display/base.py +26 -4
- vellum_ee/workflows/display/editor/__init__.py +7 -0
- vellum_ee/workflows/display/editor/types.py +22 -0
- vellum_ee/workflows/display/nodes/base_node_display.py +2 -1
- vellum_ee/workflows/display/nodes/base_node_vellum_display.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/api_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/final_output_node.py +8 -0
- vellum_ee/workflows/display/nodes/vellum/search_node.py +2 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +5 -11
- vellum_ee/workflows/display/nodes/vellum/utils.py +3 -4
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/conftest.py +2 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +8 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +12 -8
- vellum_ee/workflows/display/types.py +16 -13
- vellum_ee/workflows/display/utils/expressions.py +6 -2
- vellum_ee/workflows/display/utils/vellum.py +59 -13
- vellum_ee/workflows/display/vellum.py +18 -95
- vellum_ee/workflows/display/workflows/base_workflow_display.py +54 -46
- vellum_ee/workflows/display/workflows/tests/test_workflow_display.py +15 -1
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +2 -4
- {vellum_ai-0.14.22.dist-info → vellum_ai-0.14.24.dist-info}/LICENSE +0 -0
- {vellum_ai-0.14.22.dist-info → vellum_ai-0.14.24.dist-info}/WHEEL +0 -0
- {vellum_ai-0.14.22.dist-info → vellum_ai-0.14.24.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
|
3
|
+
from pydantic import Field
|
4
|
+
|
5
|
+
from vellum.client.core.pydantic_utilities import UniversalBaseModel
|
6
|
+
|
7
|
+
|
8
|
+
class NodeDisplayPosition(UniversalBaseModel):
|
9
|
+
x: float = 0.0
|
10
|
+
y: float = 0.0
|
11
|
+
|
12
|
+
|
13
|
+
class NodeDisplayComment(UniversalBaseModel):
|
14
|
+
value: Optional[str] = None
|
15
|
+
expanded: Optional[bool] = None
|
16
|
+
|
17
|
+
|
18
|
+
class NodeDisplayData(UniversalBaseModel):
|
19
|
+
position: NodeDisplayPosition = Field(default_factory=NodeDisplayPosition)
|
20
|
+
width: Optional[int] = None
|
21
|
+
height: Optional[int] = None
|
22
|
+
comment: Optional[NodeDisplayComment] = None
|
@@ -17,6 +17,7 @@ from typing import (
|
|
17
17
|
get_origin,
|
18
18
|
)
|
19
19
|
|
20
|
+
from vellum.client.types.code_resource_definition import CodeResourceDefinition
|
20
21
|
from vellum.workflows import BaseWorkflow
|
21
22
|
from vellum.workflows.constants import undefined
|
22
23
|
from vellum.workflows.descriptors.base import BaseDescriptor
|
@@ -45,11 +46,11 @@ from vellum.workflows.types.utils import get_original_base
|
|
45
46
|
from vellum.workflows.utils.names import pascal_to_title_case
|
46
47
|
from vellum.workflows.utils.uuids import uuid4_from_hash
|
47
48
|
from vellum.workflows.utils.vellum_variables import primitive_type_to_vellum_variable_type
|
49
|
+
from vellum_ee.workflows.display.editor.types import NodeDisplayData
|
48
50
|
from vellum_ee.workflows.display.nodes.get_node_display_class import get_node_display_class
|
49
51
|
from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay, PortDisplay, PortDisplayOverrides
|
50
52
|
from vellum_ee.workflows.display.utils.expressions import get_child_descriptor
|
51
53
|
from vellum_ee.workflows.display.utils.vellum import convert_descriptor_to_operator, primitive_to_vellum_value
|
52
|
-
from vellum_ee.workflows.display.vellum import CodeResourceDefinition, NodeDisplayData
|
53
54
|
|
54
55
|
if TYPE_CHECKING:
|
55
56
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
@@ -4,9 +4,9 @@ from typing import ClassVar, Dict, Optional
|
|
4
4
|
from vellum.workflows.nodes.utils import get_unadorned_node
|
5
5
|
from vellum.workflows.ports import Port
|
6
6
|
from vellum.workflows.types.generics import NodeType
|
7
|
+
from vellum_ee.workflows.display.editor.types import NodeDisplayComment, NodeDisplayData
|
7
8
|
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
8
9
|
from vellum_ee.workflows.display.nodes.types import PortDisplay
|
9
|
-
from vellum_ee.workflows.display.vellum import NodeDisplayComment, NodeDisplayData
|
10
10
|
|
11
11
|
|
12
12
|
class BaseNodeVellumDisplay(BaseNodeDisplay[NodeType]):
|
@@ -8,7 +8,7 @@ from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeV
|
|
8
8
|
from vellum_ee.workflows.display.nodes.utils import raise_if_descriptor
|
9
9
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
|
10
10
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
11
|
-
from vellum_ee.workflows.display.vellum import WorkspaceSecretPointer
|
11
|
+
from vellum_ee.workflows.display.utils.vellum import WorkspaceSecretPointer
|
12
12
|
|
13
13
|
_APINodeType = TypeVar("_APINodeType", bound=APINode)
|
14
14
|
|
@@ -47,6 +47,14 @@ class BaseFinalOutputNodeDisplay(BaseNodeVellumDisplay[_FinalOutputNodeType], Ge
|
|
47
47
|
"display_data": self.get_display_data().dict(),
|
48
48
|
"base": self.get_base().dict(),
|
49
49
|
"definition": self.get_definition().dict(),
|
50
|
+
"outputs": [
|
51
|
+
{
|
52
|
+
"id": str(self._get_output_id()),
|
53
|
+
"name": node.Outputs.value.name,
|
54
|
+
"type": inferred_type,
|
55
|
+
"value": self.serialize_value(display_context, node.Outputs.value.instance),
|
56
|
+
}
|
57
|
+
],
|
50
58
|
}
|
51
59
|
|
52
60
|
def _get_output_id(self) -> UUID:
|
@@ -15,7 +15,8 @@ from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeV
|
|
15
15
|
from vellum_ee.workflows.display.nodes.utils import raise_if_descriptor
|
16
16
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
|
17
17
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
18
|
-
from vellum_ee.workflows.display.vellum import InputVariablePointer
|
18
|
+
from vellum_ee.workflows.display.utils.vellum import InputVariablePointer
|
19
|
+
from vellum_ee.workflows.display.vellum import NodeInput
|
19
20
|
|
20
21
|
_SearchNodeType = TypeVar("_SearchNodeType", bound=SearchNode)
|
21
22
|
|
@@ -8,21 +8,20 @@ from vellum.workflows.inputs import BaseInputs
|
|
8
8
|
from vellum.workflows.nodes.bases import BaseNode
|
9
9
|
from vellum.workflows.outputs import BaseOutputs
|
10
10
|
from vellum.workflows.references import LazyReference
|
11
|
+
from vellum_ee.workflows.display.editor.types import NodeDisplayData
|
11
12
|
from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
|
12
13
|
from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay
|
13
14
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input_value_pointer_rules
|
14
15
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
15
|
-
from vellum_ee.workflows.display.vellum import (
|
16
|
+
from vellum_ee.workflows.display.utils.vellum import (
|
16
17
|
ConstantValuePointer,
|
17
18
|
InputVariableData,
|
18
19
|
InputVariablePointer,
|
19
|
-
NodeDisplayData,
|
20
20
|
NodeInputValuePointerRule,
|
21
21
|
NodeOutputData,
|
22
22
|
NodeOutputPointer,
|
23
|
-
WorkflowInputsVellumDisplayOverrides,
|
24
|
-
WorkflowMetaVellumDisplay,
|
25
23
|
)
|
24
|
+
from vellum_ee.workflows.display.vellum import WorkflowInputsVellumDisplayOverrides, WorkflowMetaVellumDisplay
|
26
25
|
from vellum_ee.workflows.display.workflows.vellum_workflow_display import VellumWorkflowDisplay
|
27
26
|
|
28
27
|
|
@@ -68,41 +67,36 @@ class MyNodeB(BaseNode):
|
|
68
67
|
MyNodeB.fallback_example,
|
69
68
|
[
|
70
69
|
NodeOutputPointer(
|
71
|
-
type="NODE_OUTPUT",
|
72
70
|
data=NodeOutputData(
|
73
71
|
node_id="b48fa5e0-d7d3-4fe3-ae48-615415011cc5",
|
74
72
|
output_id="4b16a629-11a1-4b3f-a965-a57b872d13b8",
|
75
73
|
),
|
76
74
|
),
|
77
75
|
InputVariablePointer(
|
78
|
-
type="INPUT_VARIABLE",
|
79
76
|
data=InputVariableData(input_variable_id="a154c29d-fac0-4cd0-ba88-bc52034f5470"),
|
80
77
|
),
|
81
|
-
ConstantValuePointer(
|
78
|
+
ConstantValuePointer(data=StringVellumValue(value="fallback")),
|
82
79
|
],
|
83
80
|
),
|
84
81
|
(
|
85
82
|
MyNodeB.constant_coalesce,
|
86
83
|
[
|
87
84
|
InputVariablePointer(
|
88
|
-
type="INPUT_VARIABLE",
|
89
85
|
data=InputVariableData(input_variable_id="a154c29d-fac0-4cd0-ba88-bc52034f5470"),
|
90
86
|
),
|
91
|
-
ConstantValuePointer(
|
87
|
+
ConstantValuePointer(data=StringVellumValue(value="default_value")),
|
92
88
|
],
|
93
89
|
),
|
94
90
|
(
|
95
91
|
MyNodeB.lazy_coalesce,
|
96
92
|
[
|
97
93
|
NodeOutputPointer(
|
98
|
-
type="NODE_OUTPUT",
|
99
94
|
data=NodeOutputData(
|
100
95
|
node_id="b48fa5e0-d7d3-4fe3-ae48-615415011cc5",
|
101
96
|
output_id="4b16a629-11a1-4b3f-a965-a57b872d13b8",
|
102
97
|
),
|
103
98
|
),
|
104
99
|
InputVariablePointer(
|
105
|
-
type="INPUT_VARIABLE",
|
106
100
|
data=InputVariableData(input_variable_id="a154c29d-fac0-4cd0-ba88-bc52034f5470"),
|
107
101
|
),
|
108
102
|
],
|
@@ -9,19 +9,18 @@ from vellum.workflows.references.lazy import LazyReference
|
|
9
9
|
from vellum.workflows.utils.uuids import uuid4_from_hash
|
10
10
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
11
11
|
from vellum_ee.workflows.display.utils.expressions import get_child_descriptor
|
12
|
-
from vellum_ee.workflows.display.utils.vellum import
|
13
|
-
from vellum_ee.workflows.display.vellum import (
|
12
|
+
from vellum_ee.workflows.display.utils.vellum import (
|
14
13
|
ConstantValuePointer,
|
15
14
|
ExecutionCounterData,
|
16
15
|
ExecutionCounterPointer,
|
17
16
|
InputVariableData,
|
18
17
|
InputVariablePointer,
|
19
|
-
NodeInput,
|
20
|
-
NodeInputValuePointer,
|
21
18
|
NodeInputValuePointerRule,
|
22
19
|
WorkspaceSecretData,
|
23
20
|
WorkspaceSecretPointer,
|
21
|
+
create_node_input_value_pointer_rule,
|
24
22
|
)
|
23
|
+
from vellum_ee.workflows.display.vellum import NodeInput, NodeInputValuePointer
|
25
24
|
|
26
25
|
|
27
26
|
def create_node_input(
|
@@ -9,11 +9,12 @@ from vellum.workflows.references.workflow_input import WorkflowInputReference
|
|
9
9
|
from vellum.workflows.types.core import JsonObject
|
10
10
|
from vellum.workflows.types.generics import NodeType
|
11
11
|
from vellum_ee.workflows.display.base import StateValueDisplayType, WorkflowInputsDisplayType
|
12
|
+
from vellum_ee.workflows.display.editor.types import NodeDisplayData
|
12
13
|
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
13
14
|
from vellum_ee.workflows.display.nodes.get_node_display_class import get_node_display_class
|
14
15
|
from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay
|
15
16
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
16
|
-
from vellum_ee.workflows.display.vellum import
|
17
|
+
from vellum_ee.workflows.display.vellum import WorkflowMetaVellumDisplay
|
17
18
|
from vellum_ee.workflows.display.workflows.vellum_workflow_display import VellumWorkflowDisplay
|
18
19
|
|
19
20
|
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py
CHANGED
@@ -99,4 +99,12 @@ def test_serialize_workflow():
|
|
99
99
|
"name": "BasicFinalOutputNode",
|
100
100
|
"module": ["tests", "workflows", "basic_final_output_node", "workflow"],
|
101
101
|
},
|
102
|
+
"outputs": [
|
103
|
+
{
|
104
|
+
"id": "97349956-d228-4b51-a64b-1331f788373f",
|
105
|
+
"name": "value",
|
106
|
+
"type": "STRING",
|
107
|
+
"value": {"type": "WORKFLOW_INPUT", "input_variable_id": "e39a7b63-de15-490a-ae9b-8112c767aea0"},
|
108
|
+
}
|
109
|
+
],
|
102
110
|
}
|
vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py
CHANGED
@@ -123,6 +123,17 @@ def test_serialize_workflow__missing_final_output_node():
|
|
123
123
|
"name": "FirstFinalOutputNode",
|
124
124
|
"module": ["tests", "workflows", "complex_final_output_node", "missing_final_output_node"],
|
125
125
|
},
|
126
|
+
"outputs": [
|
127
|
+
{
|
128
|
+
"id": "5517e50d-7f40-4f7c-acb2-e329d79a25bf",
|
129
|
+
"name": "value",
|
130
|
+
"type": "STRING",
|
131
|
+
"value": {
|
132
|
+
"type": "WORKFLOW_INPUT",
|
133
|
+
"input_variable_id": "da086239-d743-4246-b666-5c91e22fb88c",
|
134
|
+
},
|
135
|
+
}
|
136
|
+
],
|
126
137
|
},
|
127
138
|
{
|
128
139
|
"id": "bb88768d-472e-4997-b7ea-de09163d1b4c",
|
@@ -156,14 +167,7 @@ def test_serialize_workflow__missing_final_output_node():
|
|
156
167
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
157
168
|
"base": {
|
158
169
|
"name": "FinalOutputNode",
|
159
|
-
"module": [
|
160
|
-
"vellum",
|
161
|
-
"workflows",
|
162
|
-
"nodes",
|
163
|
-
"displayable",
|
164
|
-
"final_output_node",
|
165
|
-
"node",
|
166
|
-
],
|
170
|
+
"module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
|
167
171
|
},
|
168
172
|
"definition": None,
|
169
173
|
},
|
@@ -11,41 +11,44 @@ from vellum_ee.workflows.display.base import (
|
|
11
11
|
EntrypointDisplayType,
|
12
12
|
StateValueDisplayType,
|
13
13
|
WorkflowInputsDisplayType,
|
14
|
-
|
14
|
+
WorkflowMetaDisplay,
|
15
15
|
WorkflowOutputDisplay,
|
16
16
|
)
|
17
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
18
|
+
from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay, PortDisplay
|
17
19
|
|
18
20
|
if TYPE_CHECKING:
|
19
|
-
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
20
|
-
from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay, PortDisplay
|
21
21
|
from vellum_ee.workflows.display.workflows import BaseWorkflowDisplay
|
22
22
|
|
23
23
|
WorkflowDisplayType = TypeVar("WorkflowDisplayType", bound="BaseWorkflowDisplay")
|
24
24
|
|
25
|
+
NodeDisplays = Dict[Type[BaseNode], BaseNodeDisplay]
|
26
|
+
NodeOutputDisplays = Dict[OutputReference, Tuple[Type[BaseNode], NodeOutputDisplay]]
|
27
|
+
WorkflowOutputDisplays = Dict[BaseDescriptor, WorkflowOutputDisplay]
|
28
|
+
EdgeDisplays = Dict[Tuple[Port, Type[BaseNode]], EdgeDisplay]
|
29
|
+
PortDisplays = Dict[Port, PortDisplay]
|
30
|
+
|
25
31
|
|
26
32
|
@dataclass
|
27
33
|
class WorkflowDisplayContext(
|
28
34
|
Generic[
|
29
|
-
WorkflowMetaDisplayType,
|
30
35
|
WorkflowInputsDisplayType,
|
31
36
|
StateValueDisplayType,
|
32
37
|
EntrypointDisplayType,
|
33
38
|
]
|
34
39
|
):
|
35
40
|
workflow_display_class: Type["BaseWorkflowDisplay"]
|
36
|
-
workflow_display:
|
41
|
+
workflow_display: WorkflowMetaDisplay
|
37
42
|
workflow_input_displays: Dict[WorkflowInputReference, WorkflowInputsDisplayType] = field(default_factory=dict)
|
38
43
|
global_workflow_input_displays: Dict[WorkflowInputReference, WorkflowInputsDisplayType] = field(
|
39
44
|
default_factory=dict
|
40
45
|
)
|
41
46
|
state_value_displays: Dict[StateValueReference, StateValueDisplayType] = field(default_factory=dict)
|
42
47
|
global_state_value_displays: Dict[StateValueReference, StateValueDisplayType] = field(default_factory=dict)
|
43
|
-
node_displays:
|
44
|
-
global_node_displays:
|
45
|
-
global_node_output_displays:
|
46
|
-
default_factory=dict
|
47
|
-
)
|
48
|
+
node_displays: NodeDisplays = field(default_factory=dict)
|
49
|
+
global_node_displays: NodeDisplays = field(default_factory=dict)
|
50
|
+
global_node_output_displays: NodeOutputDisplays = field(default_factory=dict)
|
48
51
|
entrypoint_displays: Dict[Type[BaseNode], EntrypointDisplayType] = field(default_factory=dict)
|
49
|
-
workflow_output_displays:
|
50
|
-
edge_displays:
|
51
|
-
port_displays:
|
52
|
+
workflow_output_displays: WorkflowOutputDisplays = field(default_factory=dict)
|
53
|
+
edge_displays: EdgeDisplays = field(default_factory=dict)
|
54
|
+
port_displays: PortDisplays = field(default_factory=dict)
|
@@ -1,9 +1,13 @@
|
|
1
|
+
from typing import TYPE_CHECKING
|
2
|
+
|
1
3
|
from vellum.workflows.descriptors.base import BaseDescriptor
|
2
4
|
from vellum.workflows.references.lazy import LazyReference
|
3
|
-
|
5
|
+
|
6
|
+
if TYPE_CHECKING:
|
7
|
+
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
4
8
|
|
5
9
|
|
6
|
-
def get_child_descriptor(value: LazyReference, display_context: WorkflowDisplayContext) -> BaseDescriptor:
|
10
|
+
def get_child_descriptor(value: LazyReference, display_context: "WorkflowDisplayContext") -> BaseDescriptor:
|
7
11
|
if isinstance(value._get, str):
|
8
12
|
reference_parts = value._get.split(".")
|
9
13
|
if len(reference_parts) < 3:
|
@@ -1,6 +1,9 @@
|
|
1
|
-
from typing import TYPE_CHECKING, Any
|
1
|
+
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
|
2
2
|
|
3
|
+
from vellum.client.core.pydantic_utilities import UniversalBaseModel
|
4
|
+
from vellum.client.types.array_vellum_value import ArrayVellumValue
|
3
5
|
from vellum.client.types.logical_operator import LogicalOperator
|
6
|
+
from vellum.client.types.vellum_value import VellumValue
|
4
7
|
from vellum.client.types.vellum_variable_type import VellumVariableType
|
5
8
|
from vellum.workflows.descriptors.base import BaseDescriptor
|
6
9
|
from vellum.workflows.expressions.and_ import AndExpression
|
@@ -39,23 +42,66 @@ from vellum.workflows.references.vellum_secret import VellumSecretReference
|
|
39
42
|
from vellum.workflows.utils.vellum_variables import primitive_type_to_vellum_variable_type
|
40
43
|
from vellum.workflows.vellum_client import create_vellum_client
|
41
44
|
from vellum_ee.workflows.display.utils.expressions import get_child_descriptor
|
42
|
-
from vellum_ee.workflows.display.vellum import (
|
43
|
-
ConstantValuePointer,
|
44
|
-
ExecutionCounterData,
|
45
|
-
ExecutionCounterPointer,
|
46
|
-
InputVariableData,
|
47
|
-
InputVariablePointer,
|
48
|
-
NodeInputValuePointerRule,
|
49
|
-
NodeOutputData,
|
50
|
-
NodeOutputPointer,
|
51
|
-
WorkspaceSecretData,
|
52
|
-
WorkspaceSecretPointer,
|
53
|
-
)
|
54
45
|
|
55
46
|
if TYPE_CHECKING:
|
56
47
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
57
48
|
|
58
49
|
|
50
|
+
class ConstantValuePointer(UniversalBaseModel):
|
51
|
+
type: Literal["CONSTANT_VALUE"] = "CONSTANT_VALUE"
|
52
|
+
data: VellumValue
|
53
|
+
|
54
|
+
|
55
|
+
ArrayVellumValue.model_rebuild()
|
56
|
+
|
57
|
+
|
58
|
+
class NodeOutputData(UniversalBaseModel):
|
59
|
+
node_id: str
|
60
|
+
output_id: str
|
61
|
+
|
62
|
+
|
63
|
+
class NodeOutputPointer(UniversalBaseModel):
|
64
|
+
type: Literal["NODE_OUTPUT"] = "NODE_OUTPUT"
|
65
|
+
data: NodeOutputData
|
66
|
+
|
67
|
+
|
68
|
+
class InputVariableData(UniversalBaseModel):
|
69
|
+
input_variable_id: str
|
70
|
+
|
71
|
+
|
72
|
+
class InputVariablePointer(UniversalBaseModel):
|
73
|
+
type: Literal["INPUT_VARIABLE"] = "INPUT_VARIABLE"
|
74
|
+
data: InputVariableData
|
75
|
+
|
76
|
+
|
77
|
+
class WorkspaceSecretData(UniversalBaseModel):
|
78
|
+
type: VellumVariableType
|
79
|
+
workspace_secret_id: Optional[str] = None
|
80
|
+
|
81
|
+
|
82
|
+
class WorkspaceSecretPointer(UniversalBaseModel):
|
83
|
+
type: Literal["WORKSPACE_SECRET"] = "WORKSPACE_SECRET"
|
84
|
+
data: WorkspaceSecretData
|
85
|
+
|
86
|
+
|
87
|
+
class ExecutionCounterData(UniversalBaseModel):
|
88
|
+
node_id: str
|
89
|
+
|
90
|
+
|
91
|
+
class ExecutionCounterPointer(UniversalBaseModel):
|
92
|
+
type: Literal["EXECUTION_COUNTER"] = "EXECUTION_COUNTER"
|
93
|
+
data: ExecutionCounterData
|
94
|
+
|
95
|
+
|
96
|
+
NodeInputValuePointerRule = Union[
|
97
|
+
NodeOutputPointer,
|
98
|
+
InputVariablePointer,
|
99
|
+
ConstantValuePointer,
|
100
|
+
WorkspaceSecretPointer,
|
101
|
+
ExecutionCounterPointer,
|
102
|
+
]
|
103
|
+
|
104
|
+
|
59
105
|
def infer_vellum_variable_type(value: Any) -> VellumVariableType:
|
60
106
|
inferred_type: VellumVariableType
|
61
107
|
|
@@ -1,12 +1,7 @@
|
|
1
|
-
from dataclasses import dataclass
|
1
|
+
from dataclasses import dataclass
|
2
2
|
from uuid import UUID
|
3
|
-
from typing import List, Literal, Optional
|
3
|
+
from typing import List, Literal, Optional
|
4
4
|
|
5
|
-
from pydantic import Field
|
6
|
-
|
7
|
-
from vellum import VellumVariableType
|
8
|
-
from vellum.client.types.array_vellum_value import ArrayVellumValue
|
9
|
-
from vellum.client.types.vellum_value import VellumValue
|
10
5
|
from vellum.core import UniversalBaseModel
|
11
6
|
from vellum_ee.workflows.display.base import (
|
12
7
|
EdgeDisplay,
|
@@ -17,27 +12,15 @@ from vellum_ee.workflows.display.base import (
|
|
17
12
|
StateValueDisplayOverrides,
|
18
13
|
WorkflowInputsDisplay,
|
19
14
|
WorkflowInputsDisplayOverrides,
|
20
|
-
WorkflowMetaDisplay,
|
21
15
|
WorkflowMetaDisplayOverrides,
|
22
16
|
WorkflowOutputDisplayOverrides,
|
23
17
|
)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
class NodeDisplayComment(UniversalBaseModel):
|
32
|
-
value: Optional[str] = None
|
33
|
-
expanded: Optional[bool] = None
|
34
|
-
|
35
|
-
|
36
|
-
class NodeDisplayData(UniversalBaseModel):
|
37
|
-
position: NodeDisplayPosition = Field(default_factory=NodeDisplayPosition)
|
38
|
-
width: Optional[int] = None
|
39
|
-
height: Optional[int] = None
|
40
|
-
comment: Optional[NodeDisplayComment] = None
|
18
|
+
from vellum_ee.workflows.display.base import WorkflowDisplayData # noqa: F401 - Remove in 0.15.0
|
19
|
+
from vellum_ee.workflows.display.base import WorkflowDisplayDataViewport # noqa: F401 - Remove in 0.15.0
|
20
|
+
from vellum_ee.workflows.display.editor.types import NodeDisplayComment # noqa: F401 - Remove in 0.15.0
|
21
|
+
from vellum_ee.workflows.display.editor.types import NodeDisplayData
|
22
|
+
from vellum_ee.workflows.display.editor.types import NodeDisplayPosition # noqa: F401 - Remove in 0.15.0
|
23
|
+
from vellum_ee.workflows.display.utils.vellum import NodeInputValuePointerRule
|
41
24
|
|
42
25
|
|
43
26
|
class CodeResourceDefinition(UniversalBaseModel):
|
@@ -45,26 +28,21 @@ class CodeResourceDefinition(UniversalBaseModel):
|
|
45
28
|
module: List[str]
|
46
29
|
|
47
30
|
|
48
|
-
class WorkflowDisplayDataViewport(UniversalBaseModel):
|
49
|
-
x: float = 0.0
|
50
|
-
y: float = 0.0
|
51
|
-
zoom: float = 1.0
|
52
|
-
|
53
|
-
|
54
|
-
class WorkflowDisplayData(UniversalBaseModel):
|
55
|
-
viewport: WorkflowDisplayDataViewport = Field(default_factory=WorkflowDisplayDataViewport)
|
56
|
-
|
57
|
-
|
58
31
|
@dataclass
|
59
|
-
class WorkflowMetaVellumDisplayOverrides(
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
32
|
+
class WorkflowMetaVellumDisplayOverrides(WorkflowMetaDisplayOverrides):
|
33
|
+
"""
|
34
|
+
DEPRECATED: Use WorkflowMetaDisplay instead. Will be removed in 0.15.0
|
35
|
+
"""
|
36
|
+
|
37
|
+
pass
|
64
38
|
|
65
39
|
|
66
40
|
@dataclass
|
67
41
|
class WorkflowMetaVellumDisplay(WorkflowMetaVellumDisplayOverrides):
|
42
|
+
"""
|
43
|
+
DEPRECATED: Use WorkflowMetaDisplay instead. Will be removed in 0.15.0
|
44
|
+
"""
|
45
|
+
|
68
46
|
pass
|
69
47
|
|
70
48
|
|
@@ -145,61 +123,6 @@ class WorkflowOutputVellumDisplay(WorkflowOutputVellumDisplayOverrides):
|
|
145
123
|
pass
|
146
124
|
|
147
125
|
|
148
|
-
class ConstantValuePointer(UniversalBaseModel):
|
149
|
-
type: Literal["CONSTANT_VALUE"] = "CONSTANT_VALUE"
|
150
|
-
data: VellumValue
|
151
|
-
|
152
|
-
|
153
|
-
ArrayVellumValue.model_rebuild()
|
154
|
-
|
155
|
-
|
156
|
-
class NodeOutputData(UniversalBaseModel):
|
157
|
-
node_id: str
|
158
|
-
output_id: str
|
159
|
-
|
160
|
-
|
161
|
-
class NodeOutputPointer(UniversalBaseModel):
|
162
|
-
type: Literal["NODE_OUTPUT"] = "NODE_OUTPUT"
|
163
|
-
data: NodeOutputData
|
164
|
-
|
165
|
-
|
166
|
-
class InputVariableData(UniversalBaseModel):
|
167
|
-
input_variable_id: str
|
168
|
-
|
169
|
-
|
170
|
-
class InputVariablePointer(UniversalBaseModel):
|
171
|
-
type: Literal["INPUT_VARIABLE"] = "INPUT_VARIABLE"
|
172
|
-
data: InputVariableData
|
173
|
-
|
174
|
-
|
175
|
-
class WorkspaceSecretData(UniversalBaseModel):
|
176
|
-
type: VellumVariableType
|
177
|
-
workspace_secret_id: Optional[str] = None
|
178
|
-
|
179
|
-
|
180
|
-
class WorkspaceSecretPointer(UniversalBaseModel):
|
181
|
-
type: Literal["WORKSPACE_SECRET"] = "WORKSPACE_SECRET"
|
182
|
-
data: WorkspaceSecretData
|
183
|
-
|
184
|
-
|
185
|
-
class ExecutionCounterData(UniversalBaseModel):
|
186
|
-
node_id: str
|
187
|
-
|
188
|
-
|
189
|
-
class ExecutionCounterPointer(UniversalBaseModel):
|
190
|
-
type: Literal["EXECUTION_COUNTER"] = "EXECUTION_COUNTER"
|
191
|
-
data: ExecutionCounterData
|
192
|
-
|
193
|
-
|
194
|
-
NodeInputValuePointerRule = Union[
|
195
|
-
NodeOutputPointer,
|
196
|
-
InputVariablePointer,
|
197
|
-
ConstantValuePointer,
|
198
|
-
WorkspaceSecretPointer,
|
199
|
-
ExecutionCounterPointer,
|
200
|
-
]
|
201
|
-
|
202
|
-
|
203
126
|
class NodeInputValuePointer(UniversalBaseModel):
|
204
127
|
rules: List[NodeInputValuePointerRule]
|
205
128
|
combinator: Literal["OR"] = "OR"
|