vellum-ai 0.13.10__py3-none-any.whl → 0.13.11__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/workflows/errors/types.py +21 -0
- vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +14 -1
- vellum/workflows/nodes/displayable/bases/tests/test_utils.py +18 -0
- vellum/workflows/nodes/displayable/bases/utils.py +8 -1
- vellum/workflows/nodes/displayable/inline_prompt_node/tests/test_node.py +55 -0
- {vellum_ai-0.13.10.dist-info → vellum_ai-0.13.11.dist-info}/METADATA +1 -1
- {vellum_ai-0.13.10.dist-info → vellum_ai-0.13.11.dist-info}/RECORD +31 -31
- vellum_cli/__init__.py +9 -1
- vellum_cli/config.py +29 -1
- vellum_cli/push.py +24 -3
- vellum_cli/tests/conftest.py +3 -0
- vellum_cli/tests/test_pull.py +6 -0
- vellum_cli/tests/test_push.py +88 -1
- vellum_ee/workflows/display/nodes/base_node_display.py +110 -6
- vellum_ee/workflows/display/nodes/base_node_vellum_display.py +16 -1
- vellum_ee/workflows/display/nodes/get_node_display_class.py +6 -4
- vellum_ee/workflows/display/nodes/vellum/__init__.py +0 -2
- vellum_ee/workflows/display/nodes/vellum/error_node.py +9 -3
- vellum_ee/workflows/display/nodes/vellum/tests/test_error_node.py +44 -0
- vellum_ee/workflows/display/nodes/vellum/try_node.py +3 -4
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/conftest.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +5 -2
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_outputs_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py +15 -1
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +27 -13
- vellum_ee/workflows/display/nodes/vellum/base_node.py +0 -121
- {vellum_ai-0.13.10.dist-info → vellum_ai-0.13.11.dist-info}/LICENSE +0 -0
- {vellum_ai-0.13.10.dist-info → vellum_ai-0.13.11.dist-info}/WHEEL +0 -0
- {vellum_ai-0.13.10.dist-info → vellum_ai-0.13.11.dist-info}/entry_points.txt +0 -0
@@ -1,121 +0,0 @@
|
|
1
|
-
import inspect
|
2
|
-
from uuid import UUID
|
3
|
-
from typing import Any, Generic, Optional, TypeVar, cast
|
4
|
-
|
5
|
-
from vellum.workflows.constants import UNDEF
|
6
|
-
from vellum.workflows.descriptors.base import BaseDescriptor
|
7
|
-
from vellum.workflows.nodes.bases.base import BaseNode
|
8
|
-
from vellum.workflows.nodes.utils import get_wrapped_node
|
9
|
-
from vellum.workflows.types.core import JsonArray, JsonObject
|
10
|
-
from vellum.workflows.utils.uuids import uuid4_from_hash
|
11
|
-
from vellum.workflows.utils.vellum_variables import primitive_type_to_vellum_variable_type
|
12
|
-
from vellum.workflows.workflows.base import BaseWorkflow
|
13
|
-
from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
|
14
|
-
from vellum_ee.workflows.display.nodes.get_node_display_class import get_node_display_class
|
15
|
-
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
16
|
-
from vellum_ee.workflows.display.vellum import GenericNodeDisplayData
|
17
|
-
|
18
|
-
_BaseNodeType = TypeVar("_BaseNodeType", bound=BaseNode)
|
19
|
-
|
20
|
-
|
21
|
-
class BaseNodeDisplay(BaseNodeVellumDisplay[_BaseNodeType], Generic[_BaseNodeType]):
|
22
|
-
def serialize(
|
23
|
-
self, display_context: WorkflowDisplayContext, adornments: Optional[JsonArray] = None, **kwargs: Any
|
24
|
-
) -> JsonObject:
|
25
|
-
node = self._node
|
26
|
-
node_id = self.node_id
|
27
|
-
|
28
|
-
attributes: JsonArray = []
|
29
|
-
for attribute in node:
|
30
|
-
if inspect.isclass(attribute.instance) and issubclass(attribute.instance, BaseWorkflow):
|
31
|
-
# We don't need to serialize generic node attributes containing a subworkflow
|
32
|
-
continue
|
33
|
-
|
34
|
-
id = str(uuid4_from_hash(f"{node_id}|{attribute.name}"))
|
35
|
-
attributes.append(
|
36
|
-
{
|
37
|
-
"id": id,
|
38
|
-
"name": attribute.name,
|
39
|
-
"value": self.serialize_value(display_context, cast(BaseDescriptor, attribute.instance)),
|
40
|
-
}
|
41
|
-
)
|
42
|
-
|
43
|
-
wrapped_node = get_wrapped_node(node)
|
44
|
-
if wrapped_node is not None:
|
45
|
-
display_class = get_node_display_class(BaseNodeDisplay, wrapped_node)
|
46
|
-
|
47
|
-
adornment: JsonObject = {
|
48
|
-
"id": str(node_id),
|
49
|
-
"label": node.__qualname__,
|
50
|
-
"base": self.get_base().dict(),
|
51
|
-
"attributes": attributes,
|
52
|
-
}
|
53
|
-
|
54
|
-
existing_adornments = adornments if adornments is not None else []
|
55
|
-
return display_class().serialize(display_context, adornments=existing_adornments + [adornment])
|
56
|
-
|
57
|
-
ports: JsonArray = []
|
58
|
-
for port in node.Ports:
|
59
|
-
id = str(self.get_node_port_display(port).id)
|
60
|
-
|
61
|
-
if port._condition_type:
|
62
|
-
ports.append(
|
63
|
-
{
|
64
|
-
"id": id,
|
65
|
-
"name": port.name,
|
66
|
-
"type": port._condition_type.value,
|
67
|
-
"expression": (
|
68
|
-
self.serialize_condition(display_context, port._condition) if port._condition else None
|
69
|
-
),
|
70
|
-
}
|
71
|
-
)
|
72
|
-
else:
|
73
|
-
ports.append(
|
74
|
-
{
|
75
|
-
"id": id,
|
76
|
-
"name": port.name,
|
77
|
-
"type": "DEFAULT",
|
78
|
-
}
|
79
|
-
)
|
80
|
-
|
81
|
-
outputs: JsonArray = []
|
82
|
-
for output in node.Outputs:
|
83
|
-
type = primitive_type_to_vellum_variable_type(output)
|
84
|
-
value = (
|
85
|
-
self.serialize_value(display_context, output.instance)
|
86
|
-
if output.instance is not None and output.instance != UNDEF
|
87
|
-
else None
|
88
|
-
)
|
89
|
-
|
90
|
-
outputs.append(
|
91
|
-
{
|
92
|
-
"id": str(uuid4_from_hash(f"{node_id}|{output.name}")),
|
93
|
-
"name": output.name,
|
94
|
-
"type": type,
|
95
|
-
"value": value,
|
96
|
-
}
|
97
|
-
)
|
98
|
-
|
99
|
-
return {
|
100
|
-
"id": str(node_id),
|
101
|
-
"label": node.__qualname__,
|
102
|
-
"type": "GENERIC",
|
103
|
-
"display_data": self.get_generic_node_display_data().dict(),
|
104
|
-
"base": self.get_base().dict(),
|
105
|
-
"definition": self.get_definition().dict(),
|
106
|
-
"trigger": {
|
107
|
-
"id": str(self.get_trigger_id()),
|
108
|
-
"merge_behavior": node.Trigger.merge_behavior.value,
|
109
|
-
},
|
110
|
-
"ports": ports,
|
111
|
-
"adornments": adornments,
|
112
|
-
"attributes": attributes,
|
113
|
-
"outputs": outputs,
|
114
|
-
}
|
115
|
-
|
116
|
-
def get_target_handle_id(self) -> UUID:
|
117
|
-
return self.get_trigger_id()
|
118
|
-
|
119
|
-
def get_generic_node_display_data(self) -> GenericNodeDisplayData:
|
120
|
-
explicit_value = self._get_explicit_node_display_attr("display_data", GenericNodeDisplayData)
|
121
|
-
return explicit_value if explicit_value else GenericNodeDisplayData()
|
File without changes
|
File without changes
|
File without changes
|