vellum-ai 0.14.40__py3-none-any.whl → 0.14.42__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 +2 -4
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/reference.md +141 -4
- vellum/client/resources/ad_hoc/client.py +311 -1
- vellum/client/resources/deployments/client.py +2 -2
- vellum/client/resources/documents/client.py +0 -6
- vellum/client/types/__init__.py +2 -4
- vellum/client/types/execute_api_response.py +3 -4
- vellum/client/types/execute_api_response_json.py +7 -0
- vellum/client/types/prompt_settings.py +1 -0
- vellum/client/types/workflow_event_execution_read.py +0 -4
- vellum/client/types/workflow_execution_initiated_body.py +0 -9
- vellum/client/types/workflow_execution_initiated_event.py +0 -4
- vellum/client/types/workflow_execution_span.py +0 -4
- vellum/types/{node_event_display_context.py → execute_api_response_json.py} +1 -1
- vellum/workflows/inputs/base.py +26 -3
- vellum/workflows/inputs/tests/test_inputs.py +15 -0
- vellum/workflows/nodes/bases/base_adornment_node.py +9 -0
- vellum/workflows/nodes/core/map_node/node.py +3 -2
- vellum/workflows/nodes/core/map_node/tests/test_node.py +56 -0
- vellum/workflows/nodes/core/retry_node/node.py +2 -1
- vellum/workflows/nodes/experimental/tool_calling_node/node.py +6 -28
- vellum/workflows/nodes/experimental/tool_calling_node/utils.py +6 -10
- vellum/workflows/nodes/utils.py +14 -1
- vellum/workflows/references/workflow_input.py +5 -1
- vellum/workflows/runner/runner.py +2 -0
- vellum/workflows/workflows/base.py +5 -0
- {vellum_ai-0.14.40.dist-info → vellum_ai-0.14.42.dist-info}/METADATA +1 -1
- {vellum_ai-0.14.40.dist-info → vellum_ai-0.14.42.dist-info}/RECORD +65 -68
- vellum_ee/workflows/display/nodes/base_node_display.py +67 -28
- vellum_ee/workflows/display/nodes/tests/test_base_node_display.py +18 -0
- vellum_ee/workflows/display/nodes/vellum/api_node.py +3 -2
- vellum_ee/workflows/display/nodes/vellum/base_adornment_node.py +1 -2
- vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +3 -2
- vellum_ee/workflows/display/nodes/vellum/conditional_node.py +3 -2
- vellum_ee/workflows/display/nodes/vellum/error_node.py +2 -2
- vellum_ee/workflows/display/nodes/vellum/final_output_node.py +8 -8
- vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +3 -2
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +3 -2
- vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +3 -2
- vellum_ee/workflows/display/nodes/vellum/map_node.py +15 -12
- vellum_ee/workflows/display/nodes/vellum/merge_node.py +3 -2
- vellum_ee/workflows/display/nodes/vellum/note_node.py +2 -2
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +3 -4
- vellum_ee/workflows/display/nodes/vellum/search_node.py +3 -2
- vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +3 -2
- vellum_ee/workflows/display/nodes/vellum/templating_node.py +3 -2
- vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +1 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +3 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +138 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +1 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +1 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +3 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +1 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +1 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py +1 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +1 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py +1 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +2 -2
- vellum_ee/workflows/display/workflows/base_workflow_display.py +4 -12
- vellum/client/types/node_event_display_context.py +0 -30
- vellum/client/types/workflow_event_display_context.py +0 -28
- vellum/types/workflow_event_display_context.py +0 -3
- vellum_ee/workflows/display/nodes/base_node_vellum_display.py +0 -40
- {vellum_ai-0.14.40.dist-info → vellum_ai-0.14.42.dist-info}/LICENSE +0 -0
- {vellum_ai-0.14.40.dist-info → vellum_ai-0.14.42.dist-info}/WHEEL +0 -0
- {vellum_ai-0.14.40.dist-info → vellum_ai-0.14.42.dist-info}/entry_points.txt +0 -0
@@ -3,7 +3,7 @@ from typing import ClassVar, Generic, Optional, TypeVar
|
|
3
3
|
|
4
4
|
from vellum.workflows.nodes import ErrorNode
|
5
5
|
from vellum.workflows.types.core import JsonObject
|
6
|
-
from vellum_ee.workflows.display.nodes.
|
6
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
7
7
|
from vellum_ee.workflows.display.nodes.utils import raise_if_descriptor
|
8
8
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
|
9
9
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
@@ -11,7 +11,7 @@ from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
|
11
11
|
_ErrorNodeType = TypeVar("_ErrorNodeType", bound=ErrorNode)
|
12
12
|
|
13
13
|
|
14
|
-
class BaseErrorNodeDisplay(
|
14
|
+
class BaseErrorNodeDisplay(BaseNodeDisplay[_ErrorNodeType], Generic[_ErrorNodeType]):
|
15
15
|
error_output_id: ClassVar[Optional[UUID]] = None
|
16
16
|
|
17
17
|
name: ClassVar[str] = "error-node"
|
@@ -4,7 +4,7 @@ from typing import Any, ClassVar, Generic, Optional, TypeVar
|
|
4
4
|
from vellum.workflows.nodes.displayable.final_output_node import FinalOutputNode
|
5
5
|
from vellum.workflows.types.core import JsonObject
|
6
6
|
from vellum.workflows.utils.uuids import uuid4_from_hash
|
7
|
-
from vellum_ee.workflows.display.nodes.
|
7
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
8
8
|
from vellum_ee.workflows.display.nodes.utils import to_kebab_case
|
9
9
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
|
10
10
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
@@ -12,11 +12,11 @@ from vellum_ee.workflows.display.utils.vellum import infer_vellum_variable_type
|
|
12
12
|
|
13
13
|
_FinalOutputNodeType = TypeVar("_FinalOutputNodeType", bound=FinalOutputNode)
|
14
14
|
|
15
|
+
NODE_INPUT_KEY = "node_input"
|
15
16
|
|
16
|
-
|
17
|
-
|
17
|
+
|
18
|
+
class BaseFinalOutputNodeDisplay(BaseNodeDisplay[_FinalOutputNodeType], Generic[_FinalOutputNodeType]):
|
18
19
|
output_name: ClassVar[Optional[str]] = None
|
19
|
-
node_input_id: ClassVar[Optional[UUID]] = None
|
20
20
|
|
21
21
|
def serialize(self, display_context: WorkflowDisplayContext, **kwargs: Any) -> JsonObject:
|
22
22
|
node = self._node
|
@@ -24,7 +24,7 @@ class BaseFinalOutputNodeDisplay(BaseNodeVellumDisplay[_FinalOutputNodeType], Ge
|
|
24
24
|
|
25
25
|
node_input = create_node_input(
|
26
26
|
node_id,
|
27
|
-
|
27
|
+
NODE_INPUT_KEY,
|
28
28
|
# Get the pointer that the Terminal Node's output is referencing
|
29
29
|
node.Outputs.value.instance,
|
30
30
|
display_context,
|
@@ -58,13 +58,13 @@ class BaseFinalOutputNodeDisplay(BaseNodeVellumDisplay[_FinalOutputNodeType], Ge
|
|
58
58
|
}
|
59
59
|
|
60
60
|
def _get_output_id(self) -> UUID:
|
61
|
-
explicit_value = self.
|
62
|
-
return explicit_value if explicit_value else uuid4_from_hash(f"{self.node_id}|output_id")
|
61
|
+
explicit_value = self.output_display.get(self._node.Outputs.value)
|
62
|
+
return explicit_value.id if explicit_value else uuid4_from_hash(f"{self.node_id}|output_id")
|
63
63
|
|
64
64
|
def _get_output_name(self) -> str:
|
65
65
|
explicit_value = self._get_explicit_node_display_attr("output_name", str)
|
66
66
|
return explicit_value if explicit_value else to_kebab_case(self._node.__name__)
|
67
67
|
|
68
68
|
def _get_node_input_id(self) -> UUID:
|
69
|
-
explicit_value = self.
|
69
|
+
explicit_value = self.node_input_ids_by_name.get(NODE_INPUT_KEY)
|
70
70
|
return explicit_value if explicit_value else uuid4_from_hash(f"{self.node_id}|node_input_id")
|
@@ -3,7 +3,7 @@ from typing import Generic, Optional, TypeVar
|
|
3
3
|
|
4
4
|
from vellum.workflows.nodes import GuardrailNode
|
5
5
|
from vellum.workflows.types.core import JsonObject
|
6
|
-
from vellum_ee.workflows.display.nodes.
|
6
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
7
7
|
from vellum_ee.workflows.display.nodes.utils import raise_if_descriptor
|
8
8
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
|
9
9
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
@@ -11,7 +11,7 @@ from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
|
11
11
|
_GuardrailNodeType = TypeVar("_GuardrailNodeType", bound=GuardrailNode)
|
12
12
|
|
13
13
|
|
14
|
-
class BaseGuardrailNodeDisplay(
|
14
|
+
class BaseGuardrailNodeDisplay(BaseNodeDisplay[_GuardrailNodeType], Generic[_GuardrailNodeType]):
|
15
15
|
def serialize(
|
16
16
|
self, display_context: WorkflowDisplayContext, error_output_id: Optional[UUID] = None, **kwargs
|
17
17
|
) -> JsonObject:
|
@@ -46,4 +46,5 @@ class BaseGuardrailNodeDisplay(BaseNodeVellumDisplay[_GuardrailNodeType], Generi
|
|
46
46
|
"display_data": self.get_display_data().dict(),
|
47
47
|
"base": self.get_base().dict(),
|
48
48
|
"definition": self.get_definition().dict(),
|
49
|
+
"ports": self.serialize_ports(display_context),
|
49
50
|
}
|
@@ -6,7 +6,7 @@ from vellum.workflows.nodes import InlinePromptNode
|
|
6
6
|
from vellum.workflows.types.core import JsonObject
|
7
7
|
from vellum.workflows.utils.functions import compile_function_definition
|
8
8
|
from vellum.workflows.utils.uuids import uuid4_from_hash
|
9
|
-
from vellum_ee.workflows.display.nodes.
|
9
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
10
10
|
from vellum_ee.workflows.display.nodes.utils import raise_if_descriptor
|
11
11
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
|
12
12
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
@@ -16,7 +16,7 @@ from vellum_ee.workflows.display.vellum import NodeInput
|
|
16
16
|
_InlinePromptNodeType = TypeVar("_InlinePromptNodeType", bound=InlinePromptNode)
|
17
17
|
|
18
18
|
|
19
|
-
class BaseInlinePromptNodeDisplay(
|
19
|
+
class BaseInlinePromptNodeDisplay(BaseNodeDisplay[_InlinePromptNodeType], Generic[_InlinePromptNodeType]):
|
20
20
|
def serialize(
|
21
21
|
self, display_context: WorkflowDisplayContext, error_output_id: Optional[UUID] = None, **kwargs
|
22
22
|
) -> JsonObject:
|
@@ -72,6 +72,7 @@ class BaseInlinePromptNodeDisplay(BaseNodeVellumDisplay[_InlinePromptNodeType],
|
|
72
72
|
{"id": str(output_display.id), "name": "text", "type": "STRING", "value": None},
|
73
73
|
{"id": str(array_display.id), "name": "results", "type": "ARRAY", "value": None},
|
74
74
|
],
|
75
|
+
"ports": self.serialize_ports(display_context),
|
75
76
|
}
|
76
77
|
|
77
78
|
def _generate_node_and_prompt_inputs(
|
@@ -5,7 +5,7 @@ from vellum import VellumVariable
|
|
5
5
|
from vellum.workflows.inputs.base import BaseInputs
|
6
6
|
from vellum.workflows.nodes import InlineSubworkflowNode
|
7
7
|
from vellum.workflows.types.core import JsonObject
|
8
|
-
from vellum_ee.workflows.display.nodes.
|
8
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
9
9
|
from vellum_ee.workflows.display.nodes.utils import raise_if_descriptor
|
10
10
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
|
11
11
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
@@ -17,7 +17,7 @@ _InlineSubworkflowNodeType = TypeVar("_InlineSubworkflowNodeType", bound=InlineS
|
|
17
17
|
|
18
18
|
|
19
19
|
class BaseInlineSubworkflowNodeDisplay(
|
20
|
-
|
20
|
+
BaseNodeDisplay[_InlineSubworkflowNodeType], Generic[_InlineSubworkflowNodeType]
|
21
21
|
):
|
22
22
|
workflow_input_ids_by_name: ClassVar[Dict[str, UUID]] = {}
|
23
23
|
|
@@ -54,6 +54,7 @@ class BaseInlineSubworkflowNodeDisplay(
|
|
54
54
|
"display_data": self.get_display_data().dict(),
|
55
55
|
"base": self.get_base().dict(),
|
56
56
|
"definition": self.get_definition().dict(),
|
57
|
+
"ports": self.serialize_ports(display_context),
|
57
58
|
}
|
58
59
|
|
59
60
|
def _generate_node_and_workflow_inputs(
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from uuid import UUID
|
2
|
-
from typing import
|
2
|
+
from typing import Generic, Optional, TypeVar, cast
|
3
3
|
|
4
4
|
from vellum.workflows.nodes import MapNode
|
5
5
|
from vellum.workflows.types.core import JsonObject
|
@@ -36,24 +36,26 @@ class BaseMapNodeDisplay(BaseAdornmentNodeDisplay[_MapNodeType], Generic[_MapNod
|
|
36
36
|
parent_display_context=display_context,
|
37
37
|
)
|
38
38
|
serialized_subworkflow = subworkflow_display.serialize()
|
39
|
+
if not isinstance(serialized_subworkflow["input_variables"], list):
|
40
|
+
raise ValueError("input_variables must be a list")
|
39
41
|
|
40
|
-
|
41
|
-
for input_variable in cast(List[Dict[str, str]], serialized_subworkflow["input_variables"]):
|
42
|
-
if input_variable["key"] == "all_items":
|
43
|
-
renamed_item = {**input_variable, "key": "items"}
|
44
|
-
renamed_input_variables.append(renamed_item)
|
45
|
-
else:
|
46
|
-
renamed_input_variables.append(input_variable)
|
42
|
+
input_variables = serialized_subworkflow["input_variables"]
|
47
43
|
|
48
44
|
# Note: This must match the items input ID for the map node's node input
|
49
45
|
items_workflow_input_id = next(
|
50
|
-
input_variable["id"]
|
46
|
+
input_variable["id"]
|
47
|
+
for input_variable in input_variables
|
48
|
+
if isinstance(input_variable, dict) and input_variable["key"] == "items"
|
51
49
|
)
|
52
50
|
item_workflow_input_id = next(
|
53
|
-
input_variable["id"]
|
51
|
+
input_variable["id"]
|
52
|
+
for input_variable in input_variables
|
53
|
+
if isinstance(input_variable, dict) and input_variable["key"] == "item"
|
54
54
|
)
|
55
55
|
index_workflow_input_id = next(
|
56
|
-
input_variable["id"]
|
56
|
+
input_variable["id"]
|
57
|
+
for input_variable in input_variables
|
58
|
+
if isinstance(input_variable, dict) and input_variable["key"] == "index"
|
57
59
|
)
|
58
60
|
|
59
61
|
return {
|
@@ -67,7 +69,7 @@ class BaseMapNodeDisplay(BaseAdornmentNodeDisplay[_MapNodeType], Generic[_MapNod
|
|
67
69
|
"target_handle_id": str(self.get_target_handle_id()),
|
68
70
|
"variant": "INLINE",
|
69
71
|
"workflow_raw_data": serialized_subworkflow["workflow_raw_data"],
|
70
|
-
"input_variables": cast(JsonObject,
|
72
|
+
"input_variables": cast(JsonObject, input_variables),
|
71
73
|
"output_variables": serialized_subworkflow["output_variables"],
|
72
74
|
"concurrency": raise_if_descriptor(node.max_concurrency),
|
73
75
|
"items_input_id": items_workflow_input_id,
|
@@ -77,4 +79,5 @@ class BaseMapNodeDisplay(BaseAdornmentNodeDisplay[_MapNodeType], Generic[_MapNod
|
|
77
79
|
"display_data": self.get_display_data().dict(),
|
78
80
|
"base": self.get_base().dict(),
|
79
81
|
"definition": self.get_definition().dict(),
|
82
|
+
"ports": self.serialize_ports(display_context),
|
80
83
|
}
|
@@ -4,13 +4,13 @@ from typing import Any, ClassVar, Generic, List, Optional, TypeVar
|
|
4
4
|
from vellum.workflows.nodes.displayable import MergeNode
|
5
5
|
from vellum.workflows.types.core import JsonObject
|
6
6
|
from vellum.workflows.utils.uuids import uuid4_from_hash
|
7
|
-
from vellum_ee.workflows.display.nodes.
|
7
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
8
8
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
9
9
|
|
10
10
|
_MergeNodeType = TypeVar("_MergeNodeType", bound=MergeNode)
|
11
11
|
|
12
12
|
|
13
|
-
class BaseMergeNodeDisplay(
|
13
|
+
class BaseMergeNodeDisplay(BaseNodeDisplay[_MergeNodeType], Generic[_MergeNodeType]):
|
14
14
|
target_handle_ids: ClassVar[List[UUID]]
|
15
15
|
|
16
16
|
def __init__(self):
|
@@ -50,6 +50,7 @@ class BaseMergeNodeDisplay(BaseNodeVellumDisplay[_MergeNodeType], Generic[_Merge
|
|
50
50
|
"display_data": self.get_display_data().dict(),
|
51
51
|
"base": self.get_base().dict(),
|
52
52
|
"definition": self.get_definition().dict(),
|
53
|
+
"ports": self.serialize_ports(display_context),
|
53
54
|
}
|
54
55
|
|
55
56
|
def get_target_handle_ids(self) -> Optional[List[UUID]]:
|
@@ -2,13 +2,13 @@ from typing import Any, ClassVar, Dict, Generic, TypeVar, Union
|
|
2
2
|
|
3
3
|
from vellum.workflows.nodes import NoteNode
|
4
4
|
from vellum.workflows.types.core import JsonObject
|
5
|
-
from vellum_ee.workflows.display.nodes.
|
5
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
6
6
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
7
7
|
|
8
8
|
_NoteNodeType = TypeVar("_NoteNodeType", bound=NoteNode)
|
9
9
|
|
10
10
|
|
11
|
-
class BaseNoteNodeDisplay(
|
11
|
+
class BaseNoteNodeDisplay(BaseNodeDisplay[_NoteNodeType], Generic[_NoteNodeType]):
|
12
12
|
text: ClassVar[str] = ""
|
13
13
|
style: ClassVar[Union[Dict[str, Any], None]] = None
|
14
14
|
|
@@ -5,7 +5,7 @@ from vellum.workflows.nodes.displayable.prompt_deployment_node import PromptDepl
|
|
5
5
|
from vellum.workflows.references import OutputReference
|
6
6
|
from vellum.workflows.types.core import JsonObject
|
7
7
|
from vellum.workflows.vellum_client import create_vellum_client
|
8
|
-
from vellum_ee.workflows.display.nodes.
|
8
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
9
9
|
from vellum_ee.workflows.display.nodes.utils import raise_if_descriptor
|
10
10
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
|
11
11
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
@@ -13,9 +13,7 @@ from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
|
13
13
|
_PromptDeploymentNodeType = TypeVar("_PromptDeploymentNodeType", bound=PromptDeploymentNode)
|
14
14
|
|
15
15
|
|
16
|
-
class BasePromptDeploymentNodeDisplay(
|
17
|
-
BaseNodeVellumDisplay[_PromptDeploymentNodeType], Generic[_PromptDeploymentNodeType]
|
18
|
-
):
|
16
|
+
class BasePromptDeploymentNodeDisplay(BaseNodeDisplay[_PromptDeploymentNodeType], Generic[_PromptDeploymentNodeType]):
|
19
17
|
def serialize(
|
20
18
|
self, display_context: WorkflowDisplayContext, error_output_id: Optional[UUID] = None, **kwargs
|
21
19
|
) -> JsonObject:
|
@@ -68,4 +66,5 @@ class BasePromptDeploymentNodeDisplay(
|
|
68
66
|
"display_data": self.get_display_data().dict(),
|
69
67
|
"base": self.get_base().dict(),
|
70
68
|
"definition": self.get_definition().dict(),
|
69
|
+
"ports": self.serialize_ports(display_context),
|
71
70
|
}
|
@@ -11,7 +11,7 @@ from vellum.workflows.nodes.displayable.search_node import SearchNode
|
|
11
11
|
from vellum.workflows.references import OutputReference
|
12
12
|
from vellum.workflows.types.core import JsonArray, JsonObject
|
13
13
|
from vellum.workflows.utils.uuids import uuid4_from_hash
|
14
|
-
from vellum_ee.workflows.display.nodes.
|
14
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
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
|
@@ -28,7 +28,7 @@ class VariableIdMap:
|
|
28
28
|
rhs: Optional["VariableIdMap"]
|
29
29
|
|
30
30
|
|
31
|
-
class BaseSearchNodeDisplay(
|
31
|
+
class BaseSearchNodeDisplay(BaseNodeDisplay[_SearchNodeType], Generic[_SearchNodeType]):
|
32
32
|
# A mapping between the id of the operand (e.g. "lhs_variable_id" or "rhs_variable_id") and the id of the node input
|
33
33
|
# that the operand is pointing to.
|
34
34
|
metadata_filter_input_id_by_operand_id: Dict[UUID, UUID] = {}
|
@@ -68,6 +68,7 @@ class BaseSearchNodeDisplay(BaseNodeVellumDisplay[_SearchNodeType], Generic[_Sea
|
|
68
68
|
"display_data": self.get_display_data().dict(),
|
69
69
|
"base": self.get_base().dict(),
|
70
70
|
"definition": self.get_definition().dict(),
|
71
|
+
"ports": self.serialize_ports(display_context),
|
71
72
|
}
|
72
73
|
|
73
74
|
def _generate_search_node_inputs(
|
@@ -4,7 +4,7 @@ from typing import Generic, Optional, TypeVar
|
|
4
4
|
from vellum.workflows.nodes import SubworkflowDeploymentNode
|
5
5
|
from vellum.workflows.types.core import JsonObject
|
6
6
|
from vellum.workflows.vellum_client import create_vellum_client
|
7
|
-
from vellum_ee.workflows.display.nodes.
|
7
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
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
|
@@ -13,7 +13,7 @@ _SubworkflowDeploymentNodeType = TypeVar("_SubworkflowDeploymentNodeType", bound
|
|
13
13
|
|
14
14
|
|
15
15
|
class BaseSubworkflowDeploymentNodeDisplay(
|
16
|
-
|
16
|
+
BaseNodeDisplay[_SubworkflowDeploymentNodeType], Generic[_SubworkflowDeploymentNodeType]
|
17
17
|
):
|
18
18
|
|
19
19
|
def serialize(
|
@@ -57,4 +57,5 @@ class BaseSubworkflowDeploymentNodeDisplay(
|
|
57
57
|
"display_data": self.get_display_data().dict(),
|
58
58
|
"base": self.get_base().dict(),
|
59
59
|
"definition": self.get_definition().dict(),
|
60
|
+
"ports": self.serialize_ports(display_context),
|
60
61
|
}
|
@@ -4,7 +4,7 @@ from typing import Generic, Optional, TypeVar
|
|
4
4
|
from vellum.workflows.nodes.core.templating_node import TemplatingNode
|
5
5
|
from vellum.workflows.types.core import JsonObject
|
6
6
|
from vellum.workflows.utils.vellum_variables import primitive_type_to_vellum_variable_type
|
7
|
-
from vellum_ee.workflows.display.nodes.
|
7
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
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
|
@@ -14,7 +14,7 @@ _TemplatingNodeType = TypeVar("_TemplatingNodeType", bound=TemplatingNode)
|
|
14
14
|
TEMPLATE_INPUT_NAME = TemplatingNode.template.name
|
15
15
|
|
16
16
|
|
17
|
-
class BaseTemplatingNodeDisplay(
|
17
|
+
class BaseTemplatingNodeDisplay(BaseNodeDisplay[_TemplatingNodeType], Generic[_TemplatingNodeType]):
|
18
18
|
def serialize(
|
19
19
|
self, display_context: WorkflowDisplayContext, error_output_id: Optional[UUID] = None, **kwargs
|
20
20
|
) -> JsonObject:
|
@@ -67,4 +67,5 @@ class BaseTemplatingNodeDisplay(BaseNodeVellumDisplay[_TemplatingNodeType], Gene
|
|
67
67
|
"display_data": self.get_display_data().dict(),
|
68
68
|
"base": self.get_base().dict(),
|
69
69
|
"definition": self.get_definition().dict(),
|
70
|
+
"ports": self.serialize_ports(display_context),
|
70
71
|
}
|
@@ -9,7 +9,7 @@ from vellum.workflows.nodes.bases import BaseNode
|
|
9
9
|
from vellum.workflows.outputs import BaseOutputs
|
10
10
|
from vellum.workflows.references import LazyReference
|
11
11
|
from vellum_ee.workflows.display.editor.types import NodeDisplayData
|
12
|
-
from vellum_ee.workflows.display.nodes.
|
12
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
13
13
|
from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay
|
14
14
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input_value_pointer_rules
|
15
15
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
@@ -36,7 +36,7 @@ class MyNodeA(BaseNode):
|
|
36
36
|
output: str
|
37
37
|
|
38
38
|
|
39
|
-
class MyNodeADisplay(
|
39
|
+
class MyNodeADisplay(BaseNodeDisplay[MyNodeA]):
|
40
40
|
pass
|
41
41
|
|
42
42
|
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py
CHANGED
@@ -194,6 +194,7 @@ def test_serialize_workflow(vellum_client):
|
|
194
194
|
"name": "SimpleAPINode",
|
195
195
|
"module": ["tests", "workflows", "basic_api_node", "workflow"],
|
196
196
|
},
|
197
|
+
"ports": [{"id": "7c33b4d3-9204-4bd5-9371-80ee34f83073", "name": "default", "type": "DEFAULT"}],
|
197
198
|
},
|
198
199
|
api_node,
|
199
200
|
)
|
@@ -111,6 +111,7 @@ def test_serialize_workflow_with_filepath():
|
|
111
111
|
"module": ["tests", "workflows", "basic_code_execution_node", "workflow"],
|
112
112
|
"name": "SimpleCodeExecutionNode",
|
113
113
|
},
|
114
|
+
"ports": [{"id": "832f81ec-427b-42a8-825c-e62c43c1f961", "name": "default", "type": "DEFAULT"}],
|
114
115
|
}
|
115
116
|
assert not DeepDiff(
|
116
117
|
[
|
@@ -343,6 +344,7 @@ def test_serialize_workflow_with_code():
|
|
343
344
|
"name": "SimpleCodeExecutionNode",
|
344
345
|
"module": ["tests", "workflows", "basic_code_execution_node", "workflow_with_code"],
|
345
346
|
},
|
347
|
+
"ports": [{"id": "832f81ec-427b-42a8-825c-e62c43c1f961", "name": "default", "type": "DEFAULT"}],
|
346
348
|
}
|
347
349
|
assert not DeepDiff(
|
348
350
|
[
|
@@ -603,6 +605,7 @@ def test_serialize_workflow__try_wrapped():
|
|
603
605
|
],
|
604
606
|
}
|
605
607
|
],
|
608
|
+
"ports": [{"id": "832f81ec-427b-42a8-825c-e62c43c1f961", "name": "default", "type": "DEFAULT"}],
|
606
609
|
}
|
607
610
|
|
608
611
|
final_output_nodes = workflow_raw_data["nodes"][2:]
|
@@ -425,6 +425,87 @@ def test_serialize_workflow():
|
|
425
425
|
"name": "CategoryConditionalNode",
|
426
426
|
"module": ["tests", "workflows", "basic_conditional_node", "workflow"],
|
427
427
|
},
|
428
|
+
"ports": [
|
429
|
+
{
|
430
|
+
"id": "3a45b81f-95e4-4cbd-8997-bfdbe30251e8",
|
431
|
+
"name": "category_question",
|
432
|
+
"type": "IF",
|
433
|
+
"expression": {
|
434
|
+
"type": "BINARY_EXPRESSION",
|
435
|
+
"lhs": {"type": "WORKFLOW_INPUT", "input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
436
|
+
"operator": "=",
|
437
|
+
"rhs": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "question"}},
|
438
|
+
},
|
439
|
+
},
|
440
|
+
{
|
441
|
+
"id": "7202f702-1ebc-4067-ab1e-ec67e49158ee",
|
442
|
+
"name": "category_complaint",
|
443
|
+
"type": "ELIF",
|
444
|
+
"expression": {
|
445
|
+
"type": "BINARY_EXPRESSION",
|
446
|
+
"lhs": {"type": "WORKFLOW_INPUT", "input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
447
|
+
"operator": "=",
|
448
|
+
"rhs": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "complaint"}},
|
449
|
+
},
|
450
|
+
},
|
451
|
+
{
|
452
|
+
"id": "cf45705d-1a47-43a6-9d24-a7fdf78baae0",
|
453
|
+
"name": "category_compliment",
|
454
|
+
"type": "ELIF",
|
455
|
+
"expression": {
|
456
|
+
"type": "BINARY_EXPRESSION",
|
457
|
+
"lhs": {"type": "WORKFLOW_INPUT", "input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
458
|
+
"operator": "=",
|
459
|
+
"rhs": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "compliment"}},
|
460
|
+
},
|
461
|
+
},
|
462
|
+
{
|
463
|
+
"id": "f04610dd-61cf-41b0-b337-2235e101cdb0",
|
464
|
+
"name": "category_statement",
|
465
|
+
"type": "ELIF",
|
466
|
+
"expression": {
|
467
|
+
"type": "BINARY_EXPRESSION",
|
468
|
+
"lhs": {
|
469
|
+
"type": "BINARY_EXPRESSION",
|
470
|
+
"lhs": {
|
471
|
+
"type": "WORKFLOW_INPUT",
|
472
|
+
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf",
|
473
|
+
},
|
474
|
+
"operator": "=",
|
475
|
+
"rhs": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "statement"}},
|
476
|
+
},
|
477
|
+
"operator": "and",
|
478
|
+
"rhs": {
|
479
|
+
"type": "BINARY_EXPRESSION",
|
480
|
+
"lhs": {
|
481
|
+
"type": "BINARY_EXPRESSION",
|
482
|
+
"lhs": {
|
483
|
+
"type": "WORKFLOW_INPUT",
|
484
|
+
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf",
|
485
|
+
},
|
486
|
+
"operator": "=",
|
487
|
+
"rhs": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "statement"}},
|
488
|
+
},
|
489
|
+
"operator": "and",
|
490
|
+
"rhs": {
|
491
|
+
"type": "BINARY_EXPRESSION",
|
492
|
+
"lhs": {
|
493
|
+
"type": "WORKFLOW_INPUT",
|
494
|
+
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf",
|
495
|
+
},
|
496
|
+
"operator": "=",
|
497
|
+
"rhs": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "statement"}},
|
498
|
+
},
|
499
|
+
},
|
500
|
+
},
|
501
|
+
},
|
502
|
+
{
|
503
|
+
"id": "f9dde637-ea90-465f-a871-caf8380ae377",
|
504
|
+
"name": "category_fallthrough",
|
505
|
+
"type": "ELSE",
|
506
|
+
"expression": None,
|
507
|
+
},
|
508
|
+
],
|
428
509
|
},
|
429
510
|
conditional_node,
|
430
511
|
ignore_order=True,
|
@@ -873,6 +954,25 @@ def test_conditional_node_serialize_all_operators_with_lhs_and_rhs(descriptor, o
|
|
873
954
|
"name": "SimpleConditionalNode",
|
874
955
|
"module": ["tests", "workflows", "basic_conditional_node", "workflow_with_only_one_conditional_node"],
|
875
956
|
},
|
957
|
+
"ports": [
|
958
|
+
{
|
959
|
+
"id": "2ff87aa6-37cf-43dd-af9d-13b9198ab70a",
|
960
|
+
"name": "text_str",
|
961
|
+
"type": "IF",
|
962
|
+
"expression": {
|
963
|
+
"type": "BINARY_EXPRESSION",
|
964
|
+
"lhs": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "123"}},
|
965
|
+
"operator": f"{operator}",
|
966
|
+
"rhs": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "123"}},
|
967
|
+
},
|
968
|
+
},
|
969
|
+
{
|
970
|
+
"id": "9a7e8c2e-0228-4321-8f74-61cb5778f3df",
|
971
|
+
"name": "text_fallthrough",
|
972
|
+
"type": "ELSE",
|
973
|
+
"expression": None,
|
974
|
+
},
|
975
|
+
],
|
876
976
|
},
|
877
977
|
conditional_node,
|
878
978
|
ignore_order=True,
|
@@ -966,6 +1066,24 @@ def test_conditional_node_serialize_all_operators_with_expression(descriptor, op
|
|
966
1066
|
"name": "SimpleConditionalNode",
|
967
1067
|
"module": ["tests", "workflows", "basic_conditional_node", "workflow_with_only_one_conditional_node"],
|
968
1068
|
},
|
1069
|
+
"ports": [
|
1070
|
+
{
|
1071
|
+
"id": "2ff87aa6-37cf-43dd-af9d-13b9198ab70a",
|
1072
|
+
"name": "text_str",
|
1073
|
+
"type": "IF",
|
1074
|
+
"expression": {
|
1075
|
+
"type": "UNARY_EXPRESSION",
|
1076
|
+
"lhs": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "123"}},
|
1077
|
+
"operator": f"{operator}",
|
1078
|
+
},
|
1079
|
+
},
|
1080
|
+
{
|
1081
|
+
"id": "9a7e8c2e-0228-4321-8f74-61cb5778f3df",
|
1082
|
+
"name": "text_fallthrough",
|
1083
|
+
"type": "ELSE",
|
1084
|
+
"expression": None,
|
1085
|
+
},
|
1086
|
+
],
|
969
1087
|
},
|
970
1088
|
conditional_node,
|
971
1089
|
ignore_order=True,
|
@@ -1072,6 +1190,26 @@ def test_conditional_node_serialize_all_operators_with_value_and_start_and_end(d
|
|
1072
1190
|
"name": "SimpleConditionalNode",
|
1073
1191
|
"module": ["tests", "workflows", "basic_conditional_node", "workflow_with_only_one_conditional_node"],
|
1074
1192
|
},
|
1193
|
+
"ports": [
|
1194
|
+
{
|
1195
|
+
"id": "2ff87aa6-37cf-43dd-af9d-13b9198ab70a",
|
1196
|
+
"name": "text_str",
|
1197
|
+
"type": "IF",
|
1198
|
+
"expression": {
|
1199
|
+
"type": "TERNARY_EXPRESSION",
|
1200
|
+
"base": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "123"}},
|
1201
|
+
"operator": f"{operator}",
|
1202
|
+
"lhs": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "123"}},
|
1203
|
+
"rhs": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "123"}},
|
1204
|
+
},
|
1205
|
+
},
|
1206
|
+
{
|
1207
|
+
"id": "9a7e8c2e-0228-4321-8f74-61cb5778f3df",
|
1208
|
+
"name": "text_fallthrough",
|
1209
|
+
"type": "ELSE",
|
1210
|
+
"expression": None,
|
1211
|
+
},
|
1212
|
+
],
|
1075
1213
|
},
|
1076
1214
|
conditional_node,
|
1077
1215
|
ignore_order=True,
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py
CHANGED
@@ -118,6 +118,7 @@ def test_serialize_workflow():
|
|
118
118
|
"module": ["tests", "workflows", "basic_guardrail_node", "workflow"],
|
119
119
|
"name": "ExampleGuardrailNode",
|
120
120
|
},
|
121
|
+
"ports": [{"id": "0ed87407-697e-4ae9-ab9b-6c5cc2e57cf7", "name": "default", "type": "DEFAULT"}],
|
121
122
|
}
|
122
123
|
|
123
124
|
final_output_node = workflow_raw_data["nodes"][2]
|
@@ -299,6 +299,7 @@ def test_serialize_workflow():
|
|
299
299
|
"name": "ExampleInlineSubworkflowNode",
|
300
300
|
"module": ["tests", "workflows", "basic_inline_subworkflow", "workflow"],
|
301
301
|
},
|
302
|
+
"ports": [{"id": "cfd831bc-ee7f-44d0-8d76-0ba0cd0277dc", "name": "default", "type": "DEFAULT"}],
|
302
303
|
},
|
303
304
|
subworkflow_node,
|
304
305
|
ignore_order=True,
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py
CHANGED
@@ -254,7 +254,7 @@ def test_serialize_workflow():
|
|
254
254
|
"extensions": {"color": None},
|
255
255
|
},
|
256
256
|
{
|
257
|
-
"id": "
|
257
|
+
"id": "0acef1e7-caa1-4d9f-bb69-6981729af18d",
|
258
258
|
"key": "items",
|
259
259
|
"type": "JSON",
|
260
260
|
"required": True,
|
@@ -264,7 +264,7 @@ def test_serialize_workflow():
|
|
264
264
|
],
|
265
265
|
"output_variables": [{"id": "2a957315-fae0-4366-8a35-f0b315c5eade", "key": "count", "type": "NUMBER"}],
|
266
266
|
"concurrency": None,
|
267
|
-
"items_input_id": "
|
267
|
+
"items_input_id": "0acef1e7-caa1-4d9f-bb69-6981729af18d",
|
268
268
|
"item_input_id": "b29bb546-9bc8-4136-857d-8c7a464ba9d4",
|
269
269
|
"index_input_id": "17e7ca49-668f-450d-a792-e1f97d13db67",
|
270
270
|
},
|
@@ -277,6 +277,7 @@ def test_serialize_workflow():
|
|
277
277
|
"name": "MapFruitsNode",
|
278
278
|
"module": ["tests", "workflows", "basic_map_node", "workflow"],
|
279
279
|
},
|
280
|
+
"ports": [{"id": "a2171a61-0657-43ad-b6d9-cf93ce3270d0", "name": "default", "type": "DEFAULT"}],
|
280
281
|
},
|
281
282
|
map_node,
|
282
283
|
ignore_order=True,
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py
CHANGED
@@ -84,6 +84,7 @@ def test_serialize_workflow__await_all():
|
|
84
84
|
"module": ["tests", "workflows", "basic_merge_node", "await_all_workflow"],
|
85
85
|
"name": "AwaitAllMergeNode",
|
86
86
|
},
|
87
|
+
"ports": [{"id": "3bbc469f-0fb0-4b3d-a28b-746fefec2818", "name": "default", "type": "DEFAULT"}],
|
87
88
|
},
|
88
89
|
merge_node,
|
89
90
|
ignore_order_func=lambda x: x.path() == "root['data']['target_handles']",
|
@@ -157,6 +157,7 @@ def test_serialize_workflow(vellum_client):
|
|
157
157
|
"module": ["tests", "workflows", "basic_text_prompt_deployment", "workflow"],
|
158
158
|
"name": "ExamplePromptDeploymentNode",
|
159
159
|
},
|
160
|
+
"ports": [{"id": "2f26c7e0-283d-4f04-b639-adebb56bc679", "name": "default", "type": "DEFAULT"}],
|
160
161
|
}
|
161
162
|
|
162
163
|
final_output_node = workflow_raw_data["nodes"][2]
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py
CHANGED
@@ -239,6 +239,7 @@ def test_serialize_workflow():
|
|
239
239
|
"name": "SimpleSearchNode",
|
240
240
|
"module": ["tests", "workflows", "basic_search_node", "workflow"],
|
241
241
|
},
|
242
|
+
"ports": [{"id": "00ae06b3-f8d9-4ae6-9fbf-e4ff4d520e9b", "name": "default", "type": "DEFAULT"}],
|
242
243
|
}
|
243
244
|
|
244
245
|
final_output_node = workflow_raw_data["nodes"][2]
|