vellum-ai 0.13.1__py3-none-any.whl → 0.13.3__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.
Files changed (20) hide show
  1. vellum/client/core/client_wrapper.py +1 -1
  2. vellum/workflows/nodes/core/templating_node/node.py +27 -1
  3. vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py +30 -0
  4. {vellum_ai-0.13.1.dist-info → vellum_ai-0.13.3.dist-info}/METADATA +2 -2
  5. {vellum_ai-0.13.1.dist-info → vellum_ai-0.13.3.dist-info}/RECORD +20 -19
  6. vellum_cli/__init__.py +14 -0
  7. vellum_cli/push.py +62 -12
  8. vellum_cli/tests/test_push.py +76 -0
  9. vellum_ee/workflows/display/nodes/vellum/base_node.py +37 -2
  10. vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +48 -0
  11. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +238 -18
  12. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_outputs_serialization.py +177 -0
  13. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +30 -38
  14. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +7 -8
  15. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +35 -2
  16. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +29 -2
  17. vellum_ee/workflows/display/workflows/vellum_workflow_display.py +3 -1
  18. {vellum_ai-0.13.1.dist-info → vellum_ai-0.13.3.dist-info}/LICENSE +0 -0
  19. {vellum_ai-0.13.1.dist-info → vellum_ai-0.13.3.dist-info}/WHEEL +0 -0
  20. {vellum_ai-0.13.1.dist-info → vellum_ai-0.13.3.dist-info}/entry_points.txt +0 -0
@@ -1,34 +1,39 @@
1
- import pytest
1
+ from uuid import uuid4
2
2
 
3
3
  from deepdiff import DeepDiff
4
4
 
5
5
  from vellum.workflows.inputs.base import BaseInputs
6
6
  from vellum.workflows.nodes.bases.base import BaseNode
7
+ from vellum.workflows.references.vellum_secret import VellumSecretReference
8
+ from vellum_ee.workflows.display.base import WorkflowInputsDisplay
9
+ from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay
10
+ from vellum_ee.workflows.display.nodes.vellum.base_node import BaseNodeDisplay
7
11
 
8
12
 
9
13
  class Inputs(BaseInputs):
10
14
  input: str
11
15
 
12
16
 
13
- class BasicGenericNode(BaseNode):
17
+ class ConstantValueGenericNode(BaseNode):
14
18
  attr: str = "hello"
15
19
 
16
- class Outputs(BaseNode.Outputs):
17
- output = Inputs.input
18
20
 
21
+ def test_serialize_node__constant_value(serialize_node):
22
+ input_id = uuid4()
23
+ serialized_node = serialize_node(
24
+ node_class=ConstantValueGenericNode,
25
+ global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)},
26
+ )
19
27
 
20
- @pytest.mark.skip(reason="not implemented")
21
- def test_serialize_node__try(serialize_node):
22
- serialized_node = serialize_node(BasicGenericNode)
23
28
  assert not DeepDiff(
24
29
  {
25
- "id": "c2ed23f7-f6cb-4a56-a91c-2e5f9d8fda7f",
26
- "label": "BasicGenericNode",
30
+ "id": "be892bc8-e4de-47ef-ab89-dc9d869af1fe",
31
+ "label": "ConstantValueGenericNode",
27
32
  "type": "GENERIC",
28
33
  "display_data": {"position": {"x": 0.0, "y": 0.0}},
29
34
  "base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
30
35
  "definition": {
31
- "name": "BasicGenericNode",
36
+ "name": "ConstantValueGenericNode",
32
37
  "module": [
33
38
  "vellum_ee",
34
39
  "workflows",
@@ -39,17 +44,12 @@ def test_serialize_node__try(serialize_node):
39
44
  "test_attributes_serialization",
40
45
  ],
41
46
  },
42
- "trigger": {"id": "9d3a1b3d-4a38-4f2e-bbf1-dd8be152bce8", "merge_behavior": "AWAIT_ANY"},
43
- "ports": [
44
- {
45
- "id": "4fbf0fff-a42e-4410-852a-238b5059198e",
46
- "type": "DEFAULT",
47
- }
48
- ],
47
+ "trigger": {"id": "279e8228-9b82-43a3-8c31-affc036e3a0b", "merge_behavior": "AWAIT_ANY"},
48
+ "ports": [{"id": "e6cf13b0-5590-421c-84f2-5a0b169677e1", "type": "DEFAULT", "name": "default"}],
49
49
  "adornments": None,
50
50
  "attributes": [
51
51
  {
52
- "id": "e3c8b6e4-4b7d-4e3c-8a5c-6e5f4e3c8b6e",
52
+ "id": "4cbbfd98-9ab6-41a8-bf4e-ae65f0eafe47",
53
53
  "name": "attr",
54
54
  "value": {
55
55
  "type": "CONSTANT_VALUE",
@@ -60,6 +60,226 @@ def test_serialize_node__try(serialize_node):
60
60
  },
61
61
  }
62
62
  ],
63
+ "outputs": [],
64
+ },
65
+ serialized_node,
66
+ ignore_order=True,
67
+ )
68
+
69
+
70
+ class WorkflowInputGenericNode(BaseNode):
71
+ attr: str = Inputs.input
72
+
73
+
74
+ def test_serialize_node__workflow_input(serialize_node):
75
+ input_id = uuid4()
76
+ serialized_node = serialize_node(
77
+ node_class=WorkflowInputGenericNode,
78
+ global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)},
79
+ )
80
+ assert not DeepDiff(
81
+ {
82
+ "id": "ddfa947f-0830-476b-b07e-ac573968f9a7",
83
+ "label": "WorkflowInputGenericNode",
84
+ "type": "GENERIC",
85
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
86
+ "base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
87
+ "definition": {
88
+ "name": "WorkflowInputGenericNode",
89
+ "module": [
90
+ "vellum_ee",
91
+ "workflows",
92
+ "display",
93
+ "tests",
94
+ "workflow_serialization",
95
+ "generic_nodes",
96
+ "test_attributes_serialization",
97
+ ],
98
+ },
99
+ "trigger": {"id": "b1a5d749-bac0-4f11-8427-191febb2198e", "merge_behavior": "AWAIT_ANY"},
100
+ "ports": [{"id": "f013bf3f-49f6-41cd-ac13-7439b71a304a", "type": "DEFAULT", "name": "default"}],
101
+ "adornments": None,
102
+ "attributes": [
103
+ {
104
+ "id": "56d44313-cfdd-4d75-9b19-0beb94e59c4e",
105
+ "name": "attr",
106
+ "value": {
107
+ "type": "WORKFLOW_INPUT",
108
+ "input_variable_id": str(input_id),
109
+ },
110
+ }
111
+ ],
112
+ "outputs": [],
113
+ },
114
+ serialized_node,
115
+ ignore_order=True,
116
+ )
117
+
118
+
119
+ class NodeWithOutput(BaseNode):
120
+ class Outputs(BaseNode.Outputs):
121
+ output = Inputs.input
122
+
123
+
124
+ class NodeWithOutputDisplay(BaseNodeDisplay[NodeWithOutput]):
125
+ pass
126
+
127
+
128
+ class GenericNodeReferencingOutput(BaseNode):
129
+ attr = NodeWithOutput.Outputs.output
130
+
131
+
132
+ def test_serialize_node__node_output(serialize_node):
133
+ workflow_input_id = uuid4()
134
+ node_output_id = uuid4()
135
+ serialized_node = serialize_node(
136
+ node_class=GenericNodeReferencingOutput,
137
+ global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=workflow_input_id)},
138
+ global_node_displays={NodeWithOutput: NodeWithOutputDisplay()},
139
+ global_node_output_displays={
140
+ NodeWithOutput.Outputs.output: (NodeWithOutput, NodeOutputDisplay(id=node_output_id, name="output"))
141
+ },
142
+ )
143
+
144
+ assert not DeepDiff(
145
+ {
146
+ "id": "c1e2ce60-ac3a-4b17-915e-abe861734e03",
147
+ "label": "GenericNodeReferencingOutput",
148
+ "type": "GENERIC",
149
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
150
+ "base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
151
+ "definition": {
152
+ "name": "GenericNodeReferencingOutput",
153
+ "module": [
154
+ "vellum_ee",
155
+ "workflows",
156
+ "display",
157
+ "tests",
158
+ "workflow_serialization",
159
+ "generic_nodes",
160
+ "test_attributes_serialization",
161
+ ],
162
+ },
163
+ "trigger": {"id": "449072ba-f7b6-4314-ac96-682123f225e5", "merge_behavior": "AWAIT_ANY"},
164
+ "ports": [{"id": "ec9a79b8-65c3-4de8-bd29-42c914d72d4f", "type": "DEFAULT", "name": "default"}],
165
+ "adornments": None,
166
+ "attributes": [
167
+ {
168
+ "id": "73e6a103-1339-41ec-a245-42d43b0637c1",
169
+ "name": "attr",
170
+ "value": {
171
+ "type": "NODE_OUTPUT",
172
+ "node_id": "cd954d76-0b0a-4d9b-9bdf-347179c38cb6",
173
+ "node_output_id": str(node_output_id),
174
+ },
175
+ }
176
+ ],
177
+ "outputs": [],
178
+ },
179
+ serialized_node,
180
+ ignore_order=True,
181
+ )
182
+
183
+
184
+ class VellumSecretGenericNode(BaseNode):
185
+ attr = VellumSecretReference(name="hello")
186
+
187
+
188
+ def test_serialize_node__vellum_secret(serialize_node):
189
+ input_id = uuid4()
190
+ serialized_node = serialize_node(
191
+ node_class=VellumSecretGenericNode,
192
+ global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)},
193
+ )
194
+ assert not DeepDiff(
195
+ {
196
+ "id": "89aa6faa-b533-4179-8912-70a048bf0712",
197
+ "label": "VellumSecretGenericNode",
198
+ "type": "GENERIC",
199
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
200
+ "base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
201
+ "definition": {
202
+ "name": "VellumSecretGenericNode",
203
+ "module": [
204
+ "vellum_ee",
205
+ "workflows",
206
+ "display",
207
+ "tests",
208
+ "workflow_serialization",
209
+ "generic_nodes",
210
+ "test_attributes_serialization",
211
+ ],
212
+ },
213
+ "trigger": {"id": "3ea0305d-d8ea-45fe-8cf1-f6c1c85e6979", "merge_behavior": "AWAIT_ANY"},
214
+ "ports": [{"id": "69e49322-8f8a-42d2-b36f-3fbe53dad616", "type": "DEFAULT", "name": "default"}],
215
+ "adornments": None,
216
+ "attributes": [
217
+ {
218
+ "id": "8edd27da-eec1-4539-8bec-629b5ef7a9f9",
219
+ "name": "attr",
220
+ "value": {"type": "VELLUM_SECRET", "vellum_secret_name": "hello"},
221
+ }
222
+ ],
223
+ "outputs": [],
224
+ },
225
+ serialized_node,
226
+ ignore_order=True,
227
+ )
228
+
229
+
230
+ class NodeWithExecutions(BaseNode):
231
+ pass
232
+
233
+
234
+ class NodeWithExecutionsDisplay(BaseNodeDisplay[NodeWithExecutions]):
235
+ pass
236
+
237
+
238
+ class GenericNodeReferencingExecutions(BaseNode):
239
+ attr: int = NodeWithExecutions.Execution.count
240
+
241
+
242
+ def test_serialize_node__node_execution(serialize_node):
243
+ workflow_input_id = uuid4()
244
+ serialized_node = serialize_node(
245
+ node_class=GenericNodeReferencingExecutions,
246
+ global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=workflow_input_id)},
247
+ global_node_displays={NodeWithExecutions: NodeWithExecutionsDisplay()},
248
+ )
249
+
250
+ assert not DeepDiff(
251
+ {
252
+ "id": "6e4d2fb7-891e-492e-97a1-adf44693f518",
253
+ "label": "GenericNodeReferencingExecutions",
254
+ "type": "GENERIC",
255
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
256
+ "base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
257
+ "definition": {
258
+ "name": "GenericNodeReferencingExecutions",
259
+ "module": [
260
+ "vellum_ee",
261
+ "workflows",
262
+ "display",
263
+ "tests",
264
+ "workflow_serialization",
265
+ "generic_nodes",
266
+ "test_attributes_serialization",
267
+ ],
268
+ },
269
+ "trigger": {"id": "68a91426-4c30-4194-a4c0-cff224d3c0f3", "merge_behavior": "AWAIT_ANY"},
270
+ "ports": [{"id": "1794c2eb-5cab-49fe-9354-dfc29f11b374", "type": "DEFAULT", "name": "default"}],
271
+ "adornments": None,
272
+ "attributes": [
273
+ {
274
+ "id": "090e18d7-d5b9-4d5f-9aec-0f562e4b33a8",
275
+ "name": "attr",
276
+ "value": {
277
+ "type": "EXECUTION_COUNTER",
278
+ "node_id": "c09bd5a6-dc04-4036-90d4-580acd43c71f",
279
+ },
280
+ }
281
+ ],
282
+ "outputs": [],
63
283
  },
64
284
  serialized_node,
65
285
  ignore_order=True,
@@ -0,0 +1,177 @@
1
+ from uuid import uuid4
2
+
3
+ from deepdiff import DeepDiff
4
+
5
+ from vellum.workflows.inputs.base import BaseInputs
6
+ from vellum.workflows.nodes.bases.base import BaseNode
7
+ from vellum_ee.workflows.display.base import WorkflowInputsDisplay
8
+ from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay
9
+ from vellum_ee.workflows.display.nodes.vellum.base_node import BaseNodeDisplay
10
+
11
+
12
+ class Inputs(BaseInputs):
13
+ input: str
14
+
15
+
16
+ class AnnotatedOutputGenericNode(BaseNode):
17
+ class Outputs(BaseNode.Outputs):
18
+ output: int
19
+
20
+
21
+ def test_serialize_node__annotated_output(serialize_node):
22
+ serialized_node = serialize_node(AnnotatedOutputGenericNode)
23
+
24
+ assert not DeepDiff(
25
+ {
26
+ "id": "c0b71cfa-0d9e-4329-bde0-967c44be5c3c",
27
+ "label": "AnnotatedOutputGenericNode",
28
+ "type": "GENERIC",
29
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
30
+ "base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
31
+ "definition": {
32
+ "name": "AnnotatedOutputGenericNode",
33
+ "module": [
34
+ "vellum_ee",
35
+ "workflows",
36
+ "display",
37
+ "tests",
38
+ "workflow_serialization",
39
+ "generic_nodes",
40
+ "test_outputs_serialization",
41
+ ],
42
+ },
43
+ "trigger": {"id": "256ef76c-39a6-4a8f-8bda-922f5972a1d4", "merge_behavior": "AWAIT_ANY"},
44
+ "ports": [{"id": "378d8939-7a0f-4c87-a849-7fd00067cd2d", "type": "DEFAULT", "name": "default"}],
45
+ "adornments": None,
46
+ "attributes": [],
47
+ "outputs": [
48
+ {
49
+ "id": "8c3c9aff-e1d5-49f4-af75-3ec2fcbb4af2",
50
+ "name": "output",
51
+ "type": "NUMBER",
52
+ "value": None,
53
+ }
54
+ ],
55
+ },
56
+ serialized_node,
57
+ ignore_order=True,
58
+ )
59
+
60
+
61
+ class WorkflowInputGenericNode(BaseNode):
62
+ class Outputs(BaseNode.Outputs):
63
+ output = Inputs.input
64
+
65
+
66
+ def test_serialize_node__workflow_input(serialize_node):
67
+ input_id = uuid4()
68
+ serialized_node = serialize_node(
69
+ node_class=WorkflowInputGenericNode,
70
+ global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)},
71
+ )
72
+
73
+ assert not DeepDiff(
74
+ {
75
+ "id": "ddfa947f-0830-476b-b07e-ac573968f9a7",
76
+ "label": "WorkflowInputGenericNode",
77
+ "type": "GENERIC",
78
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
79
+ "base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
80
+ "definition": {
81
+ "name": "WorkflowInputGenericNode",
82
+ "module": [
83
+ "vellum_ee",
84
+ "workflows",
85
+ "display",
86
+ "tests",
87
+ "workflow_serialization",
88
+ "generic_nodes",
89
+ "test_outputs_serialization",
90
+ ],
91
+ },
92
+ "trigger": {"id": "b1a5d749-bac0-4f11-8427-191febb2198e", "merge_behavior": "AWAIT_ANY"},
93
+ "ports": [{"id": "f013bf3f-49f6-41cd-ac13-7439b71a304a", "type": "DEFAULT", "name": "default"}],
94
+ "adornments": None,
95
+ "attributes": [],
96
+ "outputs": [
97
+ {
98
+ "id": "2c4a85c0-b017-4cea-a261-e8e8498570c9",
99
+ "name": "output",
100
+ "type": "STRING",
101
+ "value": {
102
+ "type": "WORKFLOW_INPUT",
103
+ "input_variable_id": str(input_id),
104
+ },
105
+ }
106
+ ],
107
+ },
108
+ serialized_node,
109
+ ignore_order=True,
110
+ )
111
+
112
+
113
+ class NodeWithOutput(BaseNode):
114
+ class Outputs(BaseNode.Outputs):
115
+ output = Inputs.input
116
+
117
+
118
+ class NodeWithOutputDisplay(BaseNodeDisplay[NodeWithOutput]):
119
+ pass
120
+
121
+
122
+ class GenericNodeReferencingOutput(BaseNode):
123
+ class Outputs(BaseNode.Outputs):
124
+ output = NodeWithOutput.Outputs.output
125
+
126
+
127
+ def test_serialize_node__node_output_reference(serialize_node):
128
+ workflow_input_id = uuid4()
129
+ node_output_id = uuid4()
130
+ serialized_node = serialize_node(
131
+ node_class=GenericNodeReferencingOutput,
132
+ global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=workflow_input_id)},
133
+ global_node_displays={NodeWithOutput: NodeWithOutputDisplay()},
134
+ global_node_output_displays={
135
+ NodeWithOutput.Outputs.output: (NodeWithOutput, NodeOutputDisplay(id=node_output_id, name="output"))
136
+ },
137
+ )
138
+
139
+ assert not DeepDiff(
140
+ {
141
+ "id": "c1e2ce60-ac3a-4b17-915e-abe861734e03",
142
+ "label": "GenericNodeReferencingOutput",
143
+ "type": "GENERIC",
144
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
145
+ "base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
146
+ "definition": {
147
+ "name": "GenericNodeReferencingOutput",
148
+ "module": [
149
+ "vellum_ee",
150
+ "workflows",
151
+ "display",
152
+ "tests",
153
+ "workflow_serialization",
154
+ "generic_nodes",
155
+ "test_outputs_serialization",
156
+ ],
157
+ },
158
+ "trigger": {"id": "449072ba-f7b6-4314-ac96-682123f225e5", "merge_behavior": "AWAIT_ANY"},
159
+ "ports": [{"id": "ec9a79b8-65c3-4de8-bd29-42c914d72d4f", "type": "DEFAULT", "name": "default"}],
160
+ "adornments": None,
161
+ "attributes": [],
162
+ "outputs": [
163
+ {
164
+ "id": "db010db3-7076-4df9-ae1b-069caa16fa20",
165
+ "name": "output",
166
+ "type": "STRING",
167
+ "value": {
168
+ "type": "NODE_OUTPUT",
169
+ "node_id": "cd954d76-0b0a-4d9b-9bdf-347179c38cb6",
170
+ "node_output_id": str(node_output_id),
171
+ },
172
+ }
173
+ ],
174
+ },
175
+ serialized_node,
176
+ ignore_order=True,
177
+ )