vellum-ai 0.12.16__py3-none-any.whl → 0.13.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/__init__.py +10 -22
- vellum/client/__init__.py +8 -0
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/resources/__init__.py +4 -0
- vellum/client/resources/organizations/__init__.py +2 -0
- vellum/client/resources/organizations/client.py +116 -0
- vellum/client/resources/workspaces/__init__.py +2 -0
- vellum/client/resources/workspaces/client.py +114 -0
- vellum/client/types/__init__.py +6 -22
- vellum/client/types/new_member_join_behavior_enum.py +8 -0
- vellum/client/types/{function_call_variable_value.py → organization_read.py} +6 -4
- vellum/client/types/workflow_execution_workflow_result_event.py +0 -2
- vellum/client/types/workflow_result_event.py +0 -2
- vellum/client/types/workflow_result_event_output_data_array.py +4 -4
- vellum/client/types/{string_variable_value.py → workspace_read.py} +12 -5
- vellum/plugins/vellum_mypy.py +80 -11
- vellum/{types/json_variable_value.py → resources/organizations/__init__.py} +1 -1
- vellum/resources/organizations/client.py +3 -0
- vellum/{types/image_variable_value.py → resources/workspaces/__init__.py} +1 -1
- vellum/{types/array_variable_value.py → resources/workspaces/client.py} +1 -1
- vellum/types/{array_variable_value_item.py → new_member_join_behavior_enum.py} +1 -1
- vellum/types/{audio_variable_value.py → organization_read.py} +1 -1
- vellum/types/{error_variable_value.py → workspace_read.py} +1 -1
- vellum/utils/templating/render.py +3 -0
- vellum/workflows/nodes/bases/base.py +4 -0
- vellum/workflows/nodes/core/retry_node/node.py +24 -3
- vellum/workflows/nodes/core/retry_node/tests/test_node.py +40 -0
- vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py +20 -1
- vellum/workflows/nodes/displayable/api_node/node.py +3 -3
- vellum/workflows/workflows/base.py +0 -32
- {vellum_ai-0.12.16.dist-info → vellum_ai-0.13.0.dist-info}/METADATA +1 -1
- {vellum_ai-0.12.16.dist-info → vellum_ai-0.13.0.dist-info}/RECORD +79 -86
- vellum_cli/pull.py +7 -4
- vellum_cli/tests/conftest.py +4 -2
- vellum_cli/tests/test_push.py +13 -5
- vellum_ee/workflows/display/nodes/base_node_display.py +17 -10
- vellum_ee/workflows/display/nodes/vellum/api_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/base_node.py +97 -2
- vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/conditional_node.py +5 -62
- vellum_ee/workflows/display/nodes/vellum/error_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/final_output_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/map_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/merge_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/note_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/search_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/templating_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/utils.py +63 -0
- vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +2 -5
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/conftest.py +18 -2
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +355 -0
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +37 -22
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +12 -56
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +43 -93
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +31 -151
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py +8 -26
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py +4 -15
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +9 -44
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +19 -101
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +19 -73
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +9 -44
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +9 -44
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py +8 -6
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +11 -58
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py +8 -11
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +7 -30
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +2 -11
- vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +9 -44
- vellum_ee/workflows/display/vellum.py +2 -7
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +5 -9
- vellum_ee/workflows/server/virtual_file_loader.py +3 -3
- vellum/client/types/array_variable_value.py +0 -27
- vellum/client/types/array_variable_value_item.py +0 -29
- vellum/client/types/audio_variable_value.py +0 -25
- vellum/client/types/chat_history_variable_value.py +0 -21
- vellum/client/types/error_variable_value.py +0 -21
- vellum/client/types/image_variable_value.py +0 -25
- vellum/client/types/json_variable_value.py +0 -20
- vellum/client/types/number_variable_value.py +0 -20
- vellum/client/types/search_results_variable_value.py +0 -21
- vellum/types/chat_history_variable_value.py +0 -3
- vellum/types/function_call_variable_value.py +0 -3
- vellum/types/number_variable_value.py +0 -3
- vellum/types/search_results_variable_value.py +0 -3
- vellum/types/string_variable_value.py +0 -3
- {vellum_ai-0.12.16.dist-info → vellum_ai-0.13.0.dist-info}/LICENSE +0 -0
- {vellum_ai-0.12.16.dist-info → vellum_ai-0.13.0.dist-info}/WHEEL +0 -0
- {vellum_ai-0.12.16.dist-info → vellum_ai-0.13.0.dist-info}/entry_points.txt +0 -0
vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py
ADDED
@@ -0,0 +1,355 @@
|
|
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.workflows.ports.port import Port
|
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
|
11
|
+
|
12
|
+
|
13
|
+
class Inputs(BaseInputs):
|
14
|
+
input: str
|
15
|
+
|
16
|
+
|
17
|
+
class BasicGenericNode(BaseNode):
|
18
|
+
class Outputs(BaseNode.Outputs):
|
19
|
+
output = Inputs.input
|
20
|
+
|
21
|
+
|
22
|
+
def test_serialize_node__basic(serialize_node):
|
23
|
+
serialized_node = serialize_node(BasicGenericNode)
|
24
|
+
assert not DeepDiff(
|
25
|
+
{
|
26
|
+
"id": "c2ed23f7-f6cb-4a56-a91c-2e5f9d8fda7f",
|
27
|
+
"label": "BasicGenericNode",
|
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": "BasicGenericNode",
|
33
|
+
"module": [
|
34
|
+
"vellum_ee",
|
35
|
+
"workflows",
|
36
|
+
"display",
|
37
|
+
"tests",
|
38
|
+
"workflow_serialization",
|
39
|
+
"generic_nodes",
|
40
|
+
"test_ports_serialization",
|
41
|
+
],
|
42
|
+
},
|
43
|
+
"trigger": {"id": "9d3a1b3d-4a38-4f2e-bbf1-dd8be152bce8", "merge_behavior": "AWAIT_ANY"},
|
44
|
+
"ports": [
|
45
|
+
{
|
46
|
+
"id": "4fbf0fff-a42e-4410-852a-238b5059198e",
|
47
|
+
"type": "DEFAULT",
|
48
|
+
}
|
49
|
+
],
|
50
|
+
"adornments": None,
|
51
|
+
"attributes": [],
|
52
|
+
},
|
53
|
+
serialized_node,
|
54
|
+
ignore_order=True,
|
55
|
+
)
|
56
|
+
|
57
|
+
|
58
|
+
class IfGenericNode(BaseNode):
|
59
|
+
class Outputs(BaseNode.Outputs):
|
60
|
+
output = Inputs.input
|
61
|
+
|
62
|
+
class Ports(BaseNode.Ports):
|
63
|
+
if_branch = Port.on_if(Inputs.input.equals("hello"))
|
64
|
+
|
65
|
+
|
66
|
+
def test_serialize_node__if(serialize_node):
|
67
|
+
input_id = uuid4()
|
68
|
+
serialized_node = serialize_node(
|
69
|
+
node_class=IfGenericNode, global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)}
|
70
|
+
)
|
71
|
+
|
72
|
+
assert not DeepDiff(
|
73
|
+
{
|
74
|
+
"id": "31da54ae-1abb-4e9e-8a7d-6f4f30a78c72",
|
75
|
+
"label": "IfGenericNode",
|
76
|
+
"type": "GENERIC",
|
77
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
78
|
+
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
79
|
+
"definition": {
|
80
|
+
"name": "IfGenericNode",
|
81
|
+
"module": [
|
82
|
+
"vellum_ee",
|
83
|
+
"workflows",
|
84
|
+
"display",
|
85
|
+
"tests",
|
86
|
+
"workflow_serialization",
|
87
|
+
"generic_nodes",
|
88
|
+
"test_ports_serialization",
|
89
|
+
],
|
90
|
+
},
|
91
|
+
"trigger": {"id": "a8afaebc-7333-4e3f-b221-24452b4a1d47", "merge_behavior": "AWAIT_ANY"},
|
92
|
+
"ports": [
|
93
|
+
{
|
94
|
+
"id": "7605b4c0-a432-4517-b759-5858045a5146",
|
95
|
+
"type": "IF",
|
96
|
+
"expression": {
|
97
|
+
"type": "BINARY_EXPRESSION",
|
98
|
+
"lhs": {
|
99
|
+
"type": "WORKFLOW_INPUT",
|
100
|
+
"input_variable_id": str(input_id),
|
101
|
+
},
|
102
|
+
"operator": "=",
|
103
|
+
"rhs": {
|
104
|
+
"type": "CONSTANT_VALUE",
|
105
|
+
"value": {
|
106
|
+
"type": "STRING",
|
107
|
+
"value": "hello",
|
108
|
+
},
|
109
|
+
},
|
110
|
+
},
|
111
|
+
}
|
112
|
+
],
|
113
|
+
"adornments": None,
|
114
|
+
"attributes": [],
|
115
|
+
},
|
116
|
+
serialized_node,
|
117
|
+
ignore_order=True,
|
118
|
+
)
|
119
|
+
|
120
|
+
|
121
|
+
class IfElseGenericNode(BaseNode):
|
122
|
+
class Outputs(BaseNode.Outputs):
|
123
|
+
output = Inputs.input
|
124
|
+
|
125
|
+
class Ports(BaseNode.Ports):
|
126
|
+
if_branch = Port.on_if(Inputs.input.equals("hello"))
|
127
|
+
else_branch = Port.on_else()
|
128
|
+
|
129
|
+
|
130
|
+
def test_serialize_node__if_else(serialize_node):
|
131
|
+
input_id = uuid4()
|
132
|
+
serialized_node = serialize_node(
|
133
|
+
node_class=IfElseGenericNode, global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)}
|
134
|
+
)
|
135
|
+
|
136
|
+
assert not DeepDiff(
|
137
|
+
{
|
138
|
+
"id": "1f499f82-8cc0-4060-bf4d-d20ac409d4aa",
|
139
|
+
"label": "IfElseGenericNode",
|
140
|
+
"type": "GENERIC",
|
141
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
142
|
+
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
143
|
+
"definition": {
|
144
|
+
"name": "IfElseGenericNode",
|
145
|
+
"module": [
|
146
|
+
"vellum_ee",
|
147
|
+
"workflows",
|
148
|
+
"display",
|
149
|
+
"tests",
|
150
|
+
"workflow_serialization",
|
151
|
+
"generic_nodes",
|
152
|
+
"test_ports_serialization",
|
153
|
+
],
|
154
|
+
},
|
155
|
+
"trigger": {"id": "5b4f6553-69ca-4844-bbe4-9e5594bc8cae", "merge_behavior": "AWAIT_ANY"},
|
156
|
+
"ports": [
|
157
|
+
{
|
158
|
+
"id": "3eeb7f03-7d65-45aa-b0e5-c7a453f5cbdf",
|
159
|
+
"type": "IF",
|
160
|
+
"expression": {
|
161
|
+
"type": "BINARY_EXPRESSION",
|
162
|
+
"lhs": {
|
163
|
+
"type": "WORKFLOW_INPUT",
|
164
|
+
"input_variable_id": str(input_id),
|
165
|
+
},
|
166
|
+
"operator": "=",
|
167
|
+
"rhs": {
|
168
|
+
"type": "CONSTANT_VALUE",
|
169
|
+
"value": {
|
170
|
+
"type": "STRING",
|
171
|
+
"value": "hello",
|
172
|
+
},
|
173
|
+
},
|
174
|
+
},
|
175
|
+
},
|
176
|
+
{
|
177
|
+
"id": "b8472c77-74d5-4432-bf8b-6cd65d3dde06",
|
178
|
+
"type": "ELSE",
|
179
|
+
"expression": None,
|
180
|
+
},
|
181
|
+
],
|
182
|
+
"adornments": None,
|
183
|
+
"attributes": [],
|
184
|
+
},
|
185
|
+
serialized_node,
|
186
|
+
ignore_order=True,
|
187
|
+
)
|
188
|
+
|
189
|
+
|
190
|
+
class IfElifElseGenericNode(BaseNode):
|
191
|
+
class Outputs(BaseNode.Outputs):
|
192
|
+
output = Inputs.input
|
193
|
+
|
194
|
+
class Ports(BaseNode.Ports):
|
195
|
+
if_branch = Port.on_if(Inputs.input.equals("hello"))
|
196
|
+
elif_branch = Port.on_elif(Inputs.input.equals("world"))
|
197
|
+
else_branch = Port.on_else()
|
198
|
+
|
199
|
+
|
200
|
+
def test_serialize_node__if_elif_else(serialize_node):
|
201
|
+
input_id = uuid4()
|
202
|
+
serialized_node = serialize_node(
|
203
|
+
node_class=IfElifElseGenericNode,
|
204
|
+
global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)},
|
205
|
+
)
|
206
|
+
assert not DeepDiff(
|
207
|
+
{
|
208
|
+
"id": "21c49bfb-a90c-4565-a4e6-8eb5187e81ca",
|
209
|
+
"label": "IfElifElseGenericNode",
|
210
|
+
"type": "GENERIC",
|
211
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
212
|
+
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
213
|
+
"definition": {
|
214
|
+
"name": "IfElifElseGenericNode",
|
215
|
+
"module": [
|
216
|
+
"vellum_ee",
|
217
|
+
"workflows",
|
218
|
+
"display",
|
219
|
+
"tests",
|
220
|
+
"workflow_serialization",
|
221
|
+
"generic_nodes",
|
222
|
+
"test_ports_serialization",
|
223
|
+
],
|
224
|
+
},
|
225
|
+
"trigger": {"id": "22d55b5b-3545-4498-8658-9d0464202e78", "merge_behavior": "AWAIT_ANY"},
|
226
|
+
"ports": [
|
227
|
+
{
|
228
|
+
"id": "f6e0a2c0-192d-452f-bde4-32fb938e91bc",
|
229
|
+
"type": "IF",
|
230
|
+
"expression": {
|
231
|
+
"type": "BINARY_EXPRESSION",
|
232
|
+
"lhs": {
|
233
|
+
"type": "WORKFLOW_INPUT",
|
234
|
+
"input_variable_id": str(input_id),
|
235
|
+
},
|
236
|
+
"operator": "=",
|
237
|
+
"rhs": {
|
238
|
+
"type": "CONSTANT_VALUE",
|
239
|
+
"value": {
|
240
|
+
"type": "STRING",
|
241
|
+
"value": "hello",
|
242
|
+
},
|
243
|
+
},
|
244
|
+
},
|
245
|
+
},
|
246
|
+
{
|
247
|
+
"id": "7e44de04-e816-4da8-9251-cf389442a5d6",
|
248
|
+
"type": "ELIF",
|
249
|
+
"expression": {
|
250
|
+
"type": "BINARY_EXPRESSION",
|
251
|
+
"lhs": {
|
252
|
+
"type": "WORKFLOW_INPUT",
|
253
|
+
"input_variable_id": str(input_id),
|
254
|
+
},
|
255
|
+
"operator": "=",
|
256
|
+
"rhs": {
|
257
|
+
"type": "CONSTANT_VALUE",
|
258
|
+
"value": {
|
259
|
+
"type": "STRING",
|
260
|
+
"value": "world",
|
261
|
+
},
|
262
|
+
},
|
263
|
+
},
|
264
|
+
},
|
265
|
+
{
|
266
|
+
"id": "00db3698-ddf5-413b-8408-fff664c212d7",
|
267
|
+
"type": "ELSE",
|
268
|
+
"expression": None,
|
269
|
+
},
|
270
|
+
],
|
271
|
+
"adornments": None,
|
272
|
+
"attributes": [],
|
273
|
+
},
|
274
|
+
serialized_node,
|
275
|
+
ignore_order=True,
|
276
|
+
)
|
277
|
+
|
278
|
+
|
279
|
+
class NodeWithOutput(BaseNode):
|
280
|
+
class Outputs(BaseNode.Outputs):
|
281
|
+
output = Inputs.input
|
282
|
+
|
283
|
+
|
284
|
+
class NodeWithOutputDisplay(BaseNodeDisplay[NodeWithOutput]):
|
285
|
+
pass
|
286
|
+
|
287
|
+
|
288
|
+
class GenericNodeReferencingOutput(BaseNode):
|
289
|
+
class Outputs(BaseNode.Outputs):
|
290
|
+
output = NodeWithOutput.Outputs.output
|
291
|
+
|
292
|
+
class Ports(BaseNode.Ports):
|
293
|
+
if_branch = Port.on_if(NodeWithOutput.Outputs.output.equals("hello"))
|
294
|
+
|
295
|
+
|
296
|
+
def test_serialize_node__node_output_reference(serialize_node):
|
297
|
+
workflow_input_id = uuid4()
|
298
|
+
node_output_id = uuid4()
|
299
|
+
serialized_node = serialize_node(
|
300
|
+
node_class=GenericNodeReferencingOutput,
|
301
|
+
global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=workflow_input_id)},
|
302
|
+
global_node_displays={NodeWithOutput: NodeWithOutputDisplay()},
|
303
|
+
global_node_output_displays={
|
304
|
+
NodeWithOutput.Outputs.output: (NodeWithOutput, NodeOutputDisplay(id=node_output_id, name="output"))
|
305
|
+
},
|
306
|
+
)
|
307
|
+
|
308
|
+
assert not DeepDiff(
|
309
|
+
{
|
310
|
+
"id": "c1e2ce60-ac3a-4b17-915e-abe861734e03",
|
311
|
+
"label": "GenericNodeReferencingOutput",
|
312
|
+
"type": "GENERIC",
|
313
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
314
|
+
"definition": {
|
315
|
+
"name": "GenericNodeReferencingOutput",
|
316
|
+
"module": [
|
317
|
+
"vellum_ee",
|
318
|
+
"workflows",
|
319
|
+
"display",
|
320
|
+
"tests",
|
321
|
+
"workflow_serialization",
|
322
|
+
"generic_nodes",
|
323
|
+
"test_ports_serialization",
|
324
|
+
],
|
325
|
+
},
|
326
|
+
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
327
|
+
"trigger": {"id": "449072ba-f7b6-4314-ac96-682123f225e5", "merge_behavior": "AWAIT_ANY"},
|
328
|
+
"ports": [
|
329
|
+
{
|
330
|
+
"id": "ec9a79b8-65c3-4de8-bd29-42c914d72d4f",
|
331
|
+
"type": "IF",
|
332
|
+
"expression": {
|
333
|
+
"type": "BINARY_EXPRESSION",
|
334
|
+
"lhs": {
|
335
|
+
"type": "NODE_OUTPUT",
|
336
|
+
"node_id": "cd954d76-0b0a-4d9b-9bdf-347179c38cb6",
|
337
|
+
"node_output_id": str(node_output_id),
|
338
|
+
},
|
339
|
+
"operator": "=",
|
340
|
+
"rhs": {
|
341
|
+
"type": "CONSTANT_VALUE",
|
342
|
+
"value": {
|
343
|
+
"type": "STRING",
|
344
|
+
"value": "hello",
|
345
|
+
},
|
346
|
+
},
|
347
|
+
},
|
348
|
+
}
|
349
|
+
],
|
350
|
+
"adornments": None,
|
351
|
+
"attributes": [],
|
352
|
+
},
|
353
|
+
serialized_node,
|
354
|
+
ignore_order=True,
|
355
|
+
)
|
vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py
CHANGED
@@ -14,22 +14,6 @@ class BasicGenericNode(BaseNode):
|
|
14
14
|
output = Inputs.input
|
15
15
|
|
16
16
|
|
17
|
-
class AwaitAnyGenericNode(BaseNode):
|
18
|
-
class Outputs(BaseNode.Outputs):
|
19
|
-
output = Inputs.input
|
20
|
-
|
21
|
-
class Trigger(BaseNode.Trigger):
|
22
|
-
merge_behavior = MergeBehavior.AWAIT_ANY
|
23
|
-
|
24
|
-
|
25
|
-
class AwaitAllGenericNode(BaseNode):
|
26
|
-
class Outputs(BaseNode.Outputs):
|
27
|
-
output = Inputs.input
|
28
|
-
|
29
|
-
class Trigger(BaseNode.Trigger):
|
30
|
-
merge_behavior = MergeBehavior.AWAIT_ALL
|
31
|
-
|
32
|
-
|
33
17
|
def test_serialize_node__basic(serialize_node):
|
34
18
|
serialized_node = serialize_node(BasicGenericNode)
|
35
19
|
assert not DeepDiff(
|
@@ -38,6 +22,7 @@ def test_serialize_node__basic(serialize_node):
|
|
38
22
|
"label": "BasicGenericNode",
|
39
23
|
"type": "GENERIC",
|
40
24
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
25
|
+
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
41
26
|
"definition": {
|
42
27
|
"name": "BasicGenericNode",
|
43
28
|
"module": [
|
@@ -49,10 +34,14 @@ def test_serialize_node__basic(serialize_node):
|
|
49
34
|
"generic_nodes",
|
50
35
|
"test_trigger_serialization",
|
51
36
|
],
|
52
|
-
"bases": [{"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]}],
|
53
37
|
},
|
54
38
|
"trigger": {"id": "9d3a1b3d-4a38-4f2e-bbf1-dd8be152bce8", "merge_behavior": "AWAIT_ANY"},
|
55
|
-
"ports": [
|
39
|
+
"ports": [
|
40
|
+
{
|
41
|
+
"id": "4fbf0fff-a42e-4410-852a-238b5059198e",
|
42
|
+
"type": "DEFAULT",
|
43
|
+
}
|
44
|
+
],
|
56
45
|
"adornments": None,
|
57
46
|
"attributes": [],
|
58
47
|
},
|
@@ -61,6 +50,14 @@ def test_serialize_node__basic(serialize_node):
|
|
61
50
|
)
|
62
51
|
|
63
52
|
|
53
|
+
class AwaitAnyGenericNode(BaseNode):
|
54
|
+
class Outputs(BaseNode.Outputs):
|
55
|
+
output = Inputs.input
|
56
|
+
|
57
|
+
class Trigger(BaseNode.Trigger):
|
58
|
+
merge_behavior = MergeBehavior.AWAIT_ANY
|
59
|
+
|
60
|
+
|
64
61
|
def test_serialize_node__await_any(serialize_node):
|
65
62
|
serialized_node = serialize_node(AwaitAnyGenericNode)
|
66
63
|
assert not DeepDiff(
|
@@ -69,6 +66,7 @@ def test_serialize_node__await_any(serialize_node):
|
|
69
66
|
"label": "AwaitAnyGenericNode",
|
70
67
|
"type": "GENERIC",
|
71
68
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
69
|
+
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
72
70
|
"definition": {
|
73
71
|
"name": "AwaitAnyGenericNode",
|
74
72
|
"module": [
|
@@ -80,10 +78,14 @@ def test_serialize_node__await_any(serialize_node):
|
|
80
78
|
"generic_nodes",
|
81
79
|
"test_trigger_serialization",
|
82
80
|
],
|
83
|
-
"bases": [{"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]}],
|
84
81
|
},
|
85
82
|
"trigger": {"id": "ffa72187-9a18-453f-ae55-b77aad332630", "merge_behavior": "AWAIT_ANY"},
|
86
|
-
"ports": [
|
83
|
+
"ports": [
|
84
|
+
{
|
85
|
+
"id": "3e219c0a-e5f8-443a-ac78-1a458b189009",
|
86
|
+
"type": "DEFAULT",
|
87
|
+
}
|
88
|
+
],
|
87
89
|
"adornments": None,
|
88
90
|
"attributes": [],
|
89
91
|
},
|
@@ -92,6 +94,14 @@ def test_serialize_node__await_any(serialize_node):
|
|
92
94
|
)
|
93
95
|
|
94
96
|
|
97
|
+
class AwaitAllGenericNode(BaseNode):
|
98
|
+
class Outputs(BaseNode.Outputs):
|
99
|
+
output = Inputs.input
|
100
|
+
|
101
|
+
class Trigger(BaseNode.Trigger):
|
102
|
+
merge_behavior = MergeBehavior.AWAIT_ALL
|
103
|
+
|
104
|
+
|
95
105
|
def test_serialize_node__await_all(serialize_node):
|
96
106
|
serialized_node = serialize_node(AwaitAllGenericNode)
|
97
107
|
assert not DeepDiff(
|
@@ -100,6 +110,7 @@ def test_serialize_node__await_all(serialize_node):
|
|
100
110
|
"label": "AwaitAllGenericNode",
|
101
111
|
"type": "GENERIC",
|
102
112
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
113
|
+
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
103
114
|
"definition": {
|
104
115
|
"name": "AwaitAllGenericNode",
|
105
116
|
"module": [
|
@@ -111,10 +122,14 @@ def test_serialize_node__await_all(serialize_node):
|
|
111
122
|
"generic_nodes",
|
112
123
|
"test_trigger_serialization",
|
113
124
|
],
|
114
|
-
"bases": [{"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]}],
|
115
125
|
},
|
116
126
|
"trigger": {"id": "62074276-c817-476d-b59d-da523ae3f218", "merge_behavior": "AWAIT_ALL"},
|
117
|
-
"ports": [
|
127
|
+
"ports": [
|
128
|
+
{
|
129
|
+
"id": "9797e93f-9fe6-48b2-a48e-476abbd20e32",
|
130
|
+
"type": "DEFAULT",
|
131
|
+
}
|
132
|
+
],
|
118
133
|
"adornments": None,
|
119
134
|
"attributes": [],
|
120
135
|
},
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py
CHANGED
@@ -66,17 +66,8 @@ def test_serialize_workflow(vellum_client):
|
|
66
66
|
"inputs": [],
|
67
67
|
"data": {"label": "Entrypoint Node", "source_handle_id": "8eaa7f02-25ff-4a00-9b0a-5185718d89b3"},
|
68
68
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
69
|
-
"
|
70
|
-
|
71
|
-
"module": [
|
72
|
-
"vellum",
|
73
|
-
"workflows",
|
74
|
-
"nodes",
|
75
|
-
"bases",
|
76
|
-
"base",
|
77
|
-
],
|
78
|
-
"bases": [],
|
79
|
-
},
|
69
|
+
"base": None,
|
70
|
+
"definition": None,
|
80
71
|
}
|
81
72
|
|
82
73
|
api_node = workflow_raw_data["nodes"][1]
|
@@ -195,12 +186,13 @@ def test_serialize_workflow(vellum_client):
|
|
195
186
|
"status_code_output_id": "fecc16c3-400e-4fd3-8223-08366070e3b1",
|
196
187
|
},
|
197
188
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
189
|
+
"base": {
|
190
|
+
"name": "APINode",
|
191
|
+
"module": ["vellum", "workflows", "nodes", "displayable", "api_node", "node"],
|
192
|
+
},
|
198
193
|
"definition": {
|
199
194
|
"name": "SimpleAPINode",
|
200
195
|
"module": ["tests", "workflows", "basic_vellum_api_node", "workflow"],
|
201
|
-
"bases": [
|
202
|
-
{"name": "APINode", "module": ["vellum", "workflows", "nodes", "displayable", "api_node", "node"]}
|
203
|
-
],
|
204
196
|
},
|
205
197
|
},
|
206
198
|
api_node,
|
@@ -239,7 +231,7 @@ def test_serialize_workflow(vellum_client):
|
|
239
231
|
}
|
240
232
|
],
|
241
233
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
242
|
-
"
|
234
|
+
"base": {
|
243
235
|
"name": "FinalOutputNode",
|
244
236
|
"module": [
|
245
237
|
"vellum",
|
@@ -249,20 +241,8 @@ def test_serialize_workflow(vellum_client):
|
|
249
241
|
"final_output_node",
|
250
242
|
"node",
|
251
243
|
],
|
252
|
-
"bases": [
|
253
|
-
{
|
254
|
-
"name": "BaseNode",
|
255
|
-
"module": [
|
256
|
-
"vellum",
|
257
|
-
"workflows",
|
258
|
-
"nodes",
|
259
|
-
"bases",
|
260
|
-
"base",
|
261
|
-
],
|
262
|
-
"bases": [],
|
263
|
-
}
|
264
|
-
],
|
265
244
|
},
|
245
|
+
"definition": None,
|
266
246
|
},
|
267
247
|
{
|
268
248
|
"id": "736f9bd0-f487-42af-bdb3-780b4941c61c",
|
@@ -294,7 +274,7 @@ def test_serialize_workflow(vellum_client):
|
|
294
274
|
}
|
295
275
|
],
|
296
276
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
297
|
-
"
|
277
|
+
"base": {
|
298
278
|
"name": "FinalOutputNode",
|
299
279
|
"module": [
|
300
280
|
"vellum",
|
@@ -304,20 +284,8 @@ def test_serialize_workflow(vellum_client):
|
|
304
284
|
"final_output_node",
|
305
285
|
"node",
|
306
286
|
],
|
307
|
-
"bases": [
|
308
|
-
{
|
309
|
-
"name": "BaseNode",
|
310
|
-
"module": [
|
311
|
-
"vellum",
|
312
|
-
"workflows",
|
313
|
-
"nodes",
|
314
|
-
"bases",
|
315
|
-
"base",
|
316
|
-
],
|
317
|
-
"bases": [],
|
318
|
-
}
|
319
|
-
],
|
320
287
|
},
|
288
|
+
"definition": None,
|
321
289
|
},
|
322
290
|
{
|
323
291
|
"id": "3f3ffc50-b156-48ac-b5f3-f68cb05c2b90",
|
@@ -349,7 +317,7 @@ def test_serialize_workflow(vellum_client):
|
|
349
317
|
}
|
350
318
|
],
|
351
319
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
352
|
-
"
|
320
|
+
"base": {
|
353
321
|
"name": "FinalOutputNode",
|
354
322
|
"module": [
|
355
323
|
"vellum",
|
@@ -359,20 +327,8 @@ def test_serialize_workflow(vellum_client):
|
|
359
327
|
"final_output_node",
|
360
328
|
"node",
|
361
329
|
],
|
362
|
-
"bases": [
|
363
|
-
{
|
364
|
-
"name": "BaseNode",
|
365
|
-
"module": [
|
366
|
-
"vellum",
|
367
|
-
"workflows",
|
368
|
-
"nodes",
|
369
|
-
"bases",
|
370
|
-
"base",
|
371
|
-
],
|
372
|
-
"bases": [],
|
373
|
-
}
|
374
|
-
],
|
375
330
|
},
|
331
|
+
"definition": None,
|
376
332
|
},
|
377
333
|
],
|
378
334
|
final_output_nodes,
|