vellum-ai 0.14.14__py3-none-any.whl → 0.14.16__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/client/core/pydantic_utilities.py +4 -5
- vellum/client/resources/document_indexes/client.py +0 -55
- vellum/client/types/document_index_read.py +0 -10
- vellum/client/types/logical_operator.py +1 -0
- vellum/plugins/pydantic.py +14 -4
- vellum/workflows/nodes/core/retry_node/tests/test_node.py +23 -0
- vellum/workflows/nodes/displayable/api_node/tests/test_api_node.py +29 -0
- vellum/workflows/nodes/displayable/bases/api_node/node.py +2 -2
- vellum/workflows/vellum_client.py +9 -5
- {vellum_ai-0.14.14.dist-info → vellum_ai-0.14.16.dist-info}/METADATA +2 -2
- {vellum_ai-0.14.14.dist-info → vellum_ai-0.14.16.dist-info}/RECORD +33 -32
- vellum_cli/image_push.py +76 -42
- vellum_cli/tests/test_image_push.py +56 -0
- vellum_ee/workflows/display/nodes/base_node_display.py +8 -5
- vellum_ee/workflows/display/nodes/base_node_vellum_display.py +1 -4
- vellum_ee/workflows/display/nodes/get_node_display_class.py +34 -8
- vellum_ee/workflows/display/nodes/vellum/base_adornment_node.py +55 -1
- vellum_ee/workflows/display/nodes/vellum/retry_node.py +1 -54
- vellum_ee/workflows/display/nodes/vellum/templating_node.py +1 -8
- vellum_ee/workflows/display/nodes/vellum/try_node.py +1 -42
- vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +47 -10
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +29 -33
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +91 -106
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_outputs_serialization.py +33 -38
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +197 -145
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +23 -26
- vellum_ee/workflows/display/utils/vellum.py +3 -0
- vellum_ee/workflows/display/workflows/base_workflow_display.py +3 -6
- vellum_ee/workflows/display/workflows/tests/test_workflow_display.py +52 -0
- {vellum_ai-0.14.14.dist-info → vellum_ai-0.14.16.dist-info}/LICENSE +0 -0
- {vellum_ai-0.14.14.dist-info → vellum_ai-0.14.16.dist-info}/WHEEL +0 -0
- {vellum_ai-0.14.14.dist-info → vellum_ai-0.14.16.dist-info}/entry_points.txt +0 -0
vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py
CHANGED
@@ -15,16 +15,16 @@ class Inputs(BaseInputs):
|
|
15
15
|
input: str
|
16
16
|
|
17
17
|
|
18
|
-
class BasicGenericNode(BaseNode):
|
19
|
-
pass
|
20
|
-
|
21
|
-
|
22
18
|
def test_serialize_node__basic(serialize_node):
|
19
|
+
class BasicGenericNode(BaseNode):
|
20
|
+
pass
|
21
|
+
|
23
22
|
serialized_node = serialize_node(BasicGenericNode)
|
23
|
+
|
24
24
|
assert not DeepDiff(
|
25
25
|
{
|
26
|
-
"id": "
|
27
|
-
"label": "BasicGenericNode",
|
26
|
+
"id": "8d7cbfe4-72ca-4367-a401-8d28723d2f00",
|
27
|
+
"label": "test_serialize_node__basic.<locals>.BasicGenericNode",
|
28
28
|
"type": "GENERIC",
|
29
29
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
30
30
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
@@ -40,10 +40,10 @@ def test_serialize_node__basic(serialize_node):
|
|
40
40
|
"test_ports_serialization",
|
41
41
|
],
|
42
42
|
},
|
43
|
-
"trigger": {"id": "
|
43
|
+
"trigger": {"id": "be19c63b-3492-46b1-be9d-16f8d2e6410b", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
44
44
|
"ports": [
|
45
45
|
{
|
46
|
-
"id": "
|
46
|
+
"id": "8bec8d0c-113f-4110-afcb-4a6e566e7236",
|
47
47
|
"name": "default",
|
48
48
|
"type": "DEFAULT",
|
49
49
|
}
|
@@ -57,12 +57,11 @@ def test_serialize_node__basic(serialize_node):
|
|
57
57
|
)
|
58
58
|
|
59
59
|
|
60
|
-
class IfGenericNode(BaseNode):
|
61
|
-
class Ports(BaseNode.Ports):
|
62
|
-
if_branch = Port.on_if(Inputs.input.equals("hello"))
|
63
|
-
|
64
|
-
|
65
60
|
def test_serialize_node__if(serialize_node):
|
61
|
+
class IfGenericNode(BaseNode):
|
62
|
+
class Ports(BaseNode.Ports):
|
63
|
+
if_branch = Port.on_if(Inputs.input.equals("hello"))
|
64
|
+
|
66
65
|
input_id = uuid4()
|
67
66
|
serialized_node = serialize_node(
|
68
67
|
node_class=IfGenericNode, global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)}
|
@@ -70,8 +69,8 @@ def test_serialize_node__if(serialize_node):
|
|
70
69
|
|
71
70
|
assert not DeepDiff(
|
72
71
|
{
|
73
|
-
"id": "
|
74
|
-
"label": "IfGenericNode",
|
72
|
+
"id": "bba4b15a-dea0-48c9-a79b-4e12e99db00f",
|
73
|
+
"label": "test_serialize_node__if.<locals>.IfGenericNode",
|
75
74
|
"type": "GENERIC",
|
76
75
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
77
76
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
@@ -87,10 +86,10 @@ def test_serialize_node__if(serialize_node):
|
|
87
86
|
"test_ports_serialization",
|
88
87
|
],
|
89
88
|
},
|
90
|
-
"trigger": {"id": "
|
89
|
+
"trigger": {"id": "abe5abf8-9678-4606-be71-3104efc25c74", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
91
90
|
"ports": [
|
92
91
|
{
|
93
|
-
"id": "
|
92
|
+
"id": "9889fe69-62f8-4bb3-aac6-425b75700bea",
|
94
93
|
"type": "IF",
|
95
94
|
"name": "if_branch",
|
96
95
|
"expression": {
|
@@ -119,13 +118,12 @@ def test_serialize_node__if(serialize_node):
|
|
119
118
|
)
|
120
119
|
|
121
120
|
|
122
|
-
class IfElseGenericNode(BaseNode):
|
123
|
-
class Ports(BaseNode.Ports):
|
124
|
-
if_branch = Port.on_if(Inputs.input.equals("hello"))
|
125
|
-
else_branch = Port.on_else()
|
126
|
-
|
127
|
-
|
128
121
|
def test_serialize_node__if_else(serialize_node):
|
122
|
+
class IfElseGenericNode(BaseNode):
|
123
|
+
class Ports(BaseNode.Ports):
|
124
|
+
if_branch = Port.on_if(Inputs.input.equals("hello"))
|
125
|
+
else_branch = Port.on_else()
|
126
|
+
|
129
127
|
input_id = uuid4()
|
130
128
|
serialized_node = serialize_node(
|
131
129
|
node_class=IfElseGenericNode, global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)}
|
@@ -133,8 +131,8 @@ def test_serialize_node__if_else(serialize_node):
|
|
133
131
|
|
134
132
|
assert not DeepDiff(
|
135
133
|
{
|
136
|
-
"id": "
|
137
|
-
"label": "IfElseGenericNode",
|
134
|
+
"id": "25c9c3f1-4014-47ac-90cf-5216de10d05c",
|
135
|
+
"label": "test_serialize_node__if_else.<locals>.IfElseGenericNode",
|
138
136
|
"type": "GENERIC",
|
139
137
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
140
138
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
@@ -150,10 +148,10 @@ def test_serialize_node__if_else(serialize_node):
|
|
150
148
|
"test_ports_serialization",
|
151
149
|
],
|
152
150
|
},
|
153
|
-
"trigger": {"id": "
|
151
|
+
"trigger": {"id": "b5ef0133-0605-495f-a229-169d7490cd07", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
154
152
|
"ports": [
|
155
153
|
{
|
156
|
-
"id": "
|
154
|
+
"id": "6fd9edea-9c1f-4463-aeb9-bfdde3231ee0",
|
157
155
|
"type": "IF",
|
158
156
|
"name": "if_branch",
|
159
157
|
"expression": {
|
@@ -173,7 +171,7 @@ def test_serialize_node__if_else(serialize_node):
|
|
173
171
|
},
|
174
172
|
},
|
175
173
|
{
|
176
|
-
"id": "
|
174
|
+
"id": "7f9ea016-22da-49b3-be46-b80fb96beedf",
|
177
175
|
"type": "ELSE",
|
178
176
|
"name": "else_branch",
|
179
177
|
"expression": None,
|
@@ -187,23 +185,23 @@ def test_serialize_node__if_else(serialize_node):
|
|
187
185
|
)
|
188
186
|
|
189
187
|
|
190
|
-
class IfElifElseGenericNode(BaseNode):
|
191
|
-
class Ports(BaseNode.Ports):
|
192
|
-
if_branch = Port.on_if(Inputs.input.equals("hello"))
|
193
|
-
elif_branch = Port.on_elif(Inputs.input.equals("world"))
|
194
|
-
else_branch = Port.on_else()
|
195
|
-
|
196
|
-
|
197
188
|
def test_serialize_node__if_elif_else(serialize_node):
|
189
|
+
class IfElifElseGenericNode(BaseNode):
|
190
|
+
class Ports(BaseNode.Ports):
|
191
|
+
if_branch = Port.on_if(Inputs.input.equals("hello"))
|
192
|
+
elif_branch = Port.on_elif(Inputs.input.equals("world"))
|
193
|
+
else_branch = Port.on_else()
|
194
|
+
|
198
195
|
input_id = uuid4()
|
199
196
|
serialized_node = serialize_node(
|
200
197
|
node_class=IfElifElseGenericNode,
|
201
198
|
global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)},
|
202
199
|
)
|
200
|
+
|
203
201
|
assert not DeepDiff(
|
204
202
|
{
|
205
|
-
"id": "
|
206
|
-
"label": "IfElifElseGenericNode",
|
203
|
+
"id": "7b2b9cfc-12aa-432c-940d-cbe53e71de9c",
|
204
|
+
"label": "test_serialize_node__if_elif_else.<locals>.IfElifElseGenericNode",
|
207
205
|
"type": "GENERIC",
|
208
206
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
209
207
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
@@ -219,10 +217,10 @@ def test_serialize_node__if_elif_else(serialize_node):
|
|
219
217
|
"test_ports_serialization",
|
220
218
|
],
|
221
219
|
},
|
222
|
-
"trigger": {"id": "
|
220
|
+
"trigger": {"id": "d41d03f1-36f3-4cfe-ac9f-0f79a918a810", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
223
221
|
"ports": [
|
224
222
|
{
|
225
|
-
"id": "
|
223
|
+
"id": "19a1cc62-1f18-49b0-8026-7c82709e34db",
|
226
224
|
"type": "IF",
|
227
225
|
"name": "if_branch",
|
228
226
|
"expression": {
|
@@ -242,7 +240,7 @@ def test_serialize_node__if_elif_else(serialize_node):
|
|
242
240
|
},
|
243
241
|
},
|
244
242
|
{
|
245
|
-
"id": "
|
243
|
+
"id": "dc0b680e-d7b3-4a44-a37d-df22b310bda3",
|
246
244
|
"type": "ELIF",
|
247
245
|
"name": "elif_branch",
|
248
246
|
"expression": {
|
@@ -262,7 +260,7 @@ def test_serialize_node__if_elif_else(serialize_node):
|
|
262
260
|
},
|
263
261
|
},
|
264
262
|
{
|
265
|
-
"id": "
|
263
|
+
"id": "16d0b698-1353-4eb3-9768-4a6e5ed4b1da",
|
266
264
|
"type": "ELSE",
|
267
265
|
"expression": None,
|
268
266
|
"name": "else_branch",
|
@@ -276,21 +274,18 @@ def test_serialize_node__if_elif_else(serialize_node):
|
|
276
274
|
)
|
277
275
|
|
278
276
|
|
279
|
-
|
280
|
-
class
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
class NodeWithOutputDisplay(BaseNodeDisplay[NodeWithOutput]):
|
285
|
-
pass
|
286
|
-
|
277
|
+
def test_serialize_node__node_output_reference(serialize_node):
|
278
|
+
class NodeWithOutput(BaseNode):
|
279
|
+
class Outputs(BaseNode.Outputs):
|
280
|
+
output = Inputs.input
|
287
281
|
|
288
|
-
class
|
289
|
-
|
290
|
-
if_branch = Port.on_if(NodeWithOutput.Outputs.output.equals("hello"))
|
282
|
+
class NodeWithOutputDisplay(BaseNodeDisplay[NodeWithOutput]):
|
283
|
+
pass
|
291
284
|
|
285
|
+
class GenericNodeReferencingOutput(BaseNode):
|
286
|
+
class Ports(BaseNode.Ports):
|
287
|
+
if_branch = Port.on_if(NodeWithOutput.Outputs.output.equals("hello"))
|
292
288
|
|
293
|
-
def test_serialize_node__node_output_reference(serialize_node):
|
294
289
|
workflow_input_id = uuid4()
|
295
290
|
node_output_id = uuid4()
|
296
291
|
serialized_node = serialize_node(
|
@@ -304,8 +299,8 @@ def test_serialize_node__node_output_reference(serialize_node):
|
|
304
299
|
|
305
300
|
assert not DeepDiff(
|
306
301
|
{
|
307
|
-
"id": "
|
308
|
-
"label": "GenericNodeReferencingOutput",
|
302
|
+
"id": "ac067acc-6a6f-44b1-ae84-428e965ce691",
|
303
|
+
"label": "test_serialize_node__node_output_reference.<locals>.GenericNodeReferencingOutput",
|
309
304
|
"type": "GENERIC",
|
310
305
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
311
306
|
"definition": {
|
@@ -321,17 +316,17 @@ def test_serialize_node__node_output_reference(serialize_node):
|
|
321
316
|
],
|
322
317
|
},
|
323
318
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
324
|
-
"trigger": {"id": "
|
319
|
+
"trigger": {"id": "e949426f-9f3c-425e-a4de-8c0c5f6a8945", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
325
320
|
"ports": [
|
326
321
|
{
|
327
|
-
"id": "
|
322
|
+
"id": "500075dc-fc65-428a-b3c0-a410f8c7f8cf",
|
328
323
|
"type": "IF",
|
329
324
|
"name": "if_branch",
|
330
325
|
"expression": {
|
331
326
|
"type": "BINARY_EXPRESSION",
|
332
327
|
"lhs": {
|
333
328
|
"type": "NODE_OUTPUT",
|
334
|
-
"node_id": "
|
329
|
+
"node_id": "21213d1e-991c-405a-b4fa-a1e01c4dd088",
|
335
330
|
"node_output_id": str(node_output_id),
|
336
331
|
},
|
337
332
|
"operator": "=",
|
@@ -354,12 +349,11 @@ def test_serialize_node__node_output_reference(serialize_node):
|
|
354
349
|
)
|
355
350
|
|
356
351
|
|
357
|
-
class GenericNodeReferencingSecret(BaseNode):
|
358
|
-
class Ports(BaseNode.Ports):
|
359
|
-
if_branch = Port.on_if(VellumSecretReference(name="hello").equals("hello"))
|
360
|
-
|
361
|
-
|
362
352
|
def test_serialize_node__vellum_secret_reference(serialize_node):
|
353
|
+
class GenericNodeReferencingSecret(BaseNode):
|
354
|
+
class Ports(BaseNode.Ports):
|
355
|
+
if_branch = Port.on_if(VellumSecretReference(name="hello").equals("hello"))
|
356
|
+
|
363
357
|
workflow_input_id = uuid4()
|
364
358
|
serialized_node = serialize_node(
|
365
359
|
node_class=GenericNodeReferencingSecret,
|
@@ -368,8 +362,8 @@ def test_serialize_node__vellum_secret_reference(serialize_node):
|
|
368
362
|
|
369
363
|
assert not DeepDiff(
|
370
364
|
{
|
371
|
-
"id": "
|
372
|
-
"label": "GenericNodeReferencingSecret",
|
365
|
+
"id": "feb4b331-e25f-4a5c-9840-c5575b1efd5c",
|
366
|
+
"label": "test_serialize_node__vellum_secret_reference.<locals>.GenericNodeReferencingSecret",
|
373
367
|
"type": "GENERIC",
|
374
368
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
375
369
|
"definition": {
|
@@ -385,10 +379,10 @@ def test_serialize_node__vellum_secret_reference(serialize_node):
|
|
385
379
|
],
|
386
380
|
},
|
387
381
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
388
|
-
"trigger": {"id": "
|
382
|
+
"trigger": {"id": "d762741b-c137-4df4-ade6-65f31ea5a624", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
389
383
|
"ports": [
|
390
384
|
{
|
391
|
-
"id": "
|
385
|
+
"id": "3b6b4048-8622-446d-9772-2766357d7b18",
|
392
386
|
"type": "IF",
|
393
387
|
"name": "if_branch",
|
394
388
|
"expression": {
|
@@ -414,20 +408,17 @@ def test_serialize_node__vellum_secret_reference(serialize_node):
|
|
414
408
|
)
|
415
409
|
|
416
410
|
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
class NodeWithExecutionsDisplay(BaseNodeDisplay[NodeWithExecutions]):
|
422
|
-
pass
|
423
|
-
|
411
|
+
def test_serialize_node__execution_count_reference(serialize_node):
|
412
|
+
class NodeWithExecutions(BaseNode):
|
413
|
+
pass
|
424
414
|
|
425
|
-
class
|
426
|
-
|
427
|
-
if_branch = Port.on_if(NodeWithExecutions.Execution.count.equals(5))
|
415
|
+
class NodeWithExecutionsDisplay(BaseNodeDisplay[NodeWithExecutions]):
|
416
|
+
pass
|
428
417
|
|
418
|
+
class GenericNodeReferencingExecutions(BaseNode):
|
419
|
+
class Ports(BaseNode.Ports):
|
420
|
+
if_branch = Port.on_if(NodeWithExecutions.Execution.count.equals(5))
|
429
421
|
|
430
|
-
def test_serialize_node__execution_count_reference(serialize_node):
|
431
422
|
workflow_input_id = uuid4()
|
432
423
|
serialized_node = serialize_node(
|
433
424
|
node_class=GenericNodeReferencingExecutions,
|
@@ -437,8 +428,8 @@ def test_serialize_node__execution_count_reference(serialize_node):
|
|
437
428
|
|
438
429
|
assert not DeepDiff(
|
439
430
|
{
|
440
|
-
"id": "
|
441
|
-
"label": "GenericNodeReferencingExecutions",
|
431
|
+
"id": "0b4fe8a6-6d0c-464e-9372-10110e2b0e13",
|
432
|
+
"label": "test_serialize_node__execution_count_reference.<locals>.GenericNodeReferencingExecutions",
|
442
433
|
"type": "GENERIC",
|
443
434
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
444
435
|
"definition": {
|
@@ -454,17 +445,17 @@ def test_serialize_node__execution_count_reference(serialize_node):
|
|
454
445
|
],
|
455
446
|
},
|
456
447
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
457
|
-
"trigger": {"id": "
|
448
|
+
"trigger": {"id": "d6aa7eec-6f01-41c5-9f5c-d50c53259527", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
458
449
|
"ports": [
|
459
450
|
{
|
460
|
-
"id": "
|
451
|
+
"id": "79d0cfa3-c8f9-4434-a2f8-5e416d66437a",
|
461
452
|
"type": "IF",
|
462
453
|
"name": "if_branch",
|
463
454
|
"expression": {
|
464
455
|
"type": "BINARY_EXPRESSION",
|
465
456
|
"lhs": {
|
466
457
|
"type": "EXECUTION_COUNTER",
|
467
|
-
"node_id": "
|
458
|
+
"node_id": "235c66f9-c76b-4df0-9bff-cfba2ef1ad18",
|
468
459
|
},
|
469
460
|
"operator": "=",
|
470
461
|
"rhs": {
|
@@ -486,12 +477,11 @@ def test_serialize_node__execution_count_reference(serialize_node):
|
|
486
477
|
)
|
487
478
|
|
488
479
|
|
489
|
-
class NullGenericNode(BaseNode):
|
490
|
-
class Ports(BaseNode.Ports):
|
491
|
-
if_branch = Port.on_if(Inputs.input.is_null())
|
492
|
-
|
493
|
-
|
494
480
|
def test_serialize_node__null(serialize_node):
|
481
|
+
class NullGenericNode(BaseNode):
|
482
|
+
class Ports(BaseNode.Ports):
|
483
|
+
if_branch = Port.on_if(Inputs.input.is_null())
|
484
|
+
|
495
485
|
input_id = uuid4()
|
496
486
|
serialized_node = serialize_node(
|
497
487
|
node_class=NullGenericNode, global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)}
|
@@ -499,8 +489,8 @@ def test_serialize_node__null(serialize_node):
|
|
499
489
|
|
500
490
|
assert not DeepDiff(
|
501
491
|
{
|
502
|
-
"id": "
|
503
|
-
"label": "NullGenericNode",
|
492
|
+
"id": "1838ce1f-9c07-4fd0-9fd4-2a3a841ea402",
|
493
|
+
"label": "test_serialize_node__null.<locals>.NullGenericNode",
|
504
494
|
"type": "GENERIC",
|
505
495
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
506
496
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
@@ -516,10 +506,10 @@ def test_serialize_node__null(serialize_node):
|
|
516
506
|
"test_ports_serialization",
|
517
507
|
],
|
518
508
|
},
|
519
|
-
"trigger": {"id": "
|
509
|
+
"trigger": {"id": "f4dcf8a3-692c-4b7c-8625-1a54eaa16ff2", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
520
510
|
"ports": [
|
521
511
|
{
|
522
|
-
"id": "
|
512
|
+
"id": "7f1fb75d-0c8b-4ebc-8c59-4ae68f1a68e1",
|
523
513
|
"type": "IF",
|
524
514
|
"name": "if_branch",
|
525
515
|
"expression": {
|
@@ -541,16 +531,14 @@ def test_serialize_node__null(serialize_node):
|
|
541
531
|
)
|
542
532
|
|
543
533
|
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
class BetweenGenericNode(BaseNode):
|
549
|
-
class Ports(BaseNode.Ports):
|
550
|
-
if_branch = Port.on_if(IntegerInputs.input.between(1, 10))
|
534
|
+
def test_serialize_node__between(serialize_node):
|
535
|
+
class IntegerInputs(BaseInputs):
|
536
|
+
input: int
|
551
537
|
|
538
|
+
class BetweenGenericNode(BaseNode):
|
539
|
+
class Ports(BaseNode.Ports):
|
540
|
+
if_branch = Port.on_if(IntegerInputs.input.between(1, 10))
|
552
541
|
|
553
|
-
def test_serialize_node__between(serialize_node):
|
554
542
|
input_id = uuid4()
|
555
543
|
serialized_node = serialize_node(
|
556
544
|
node_class=BetweenGenericNode,
|
@@ -559,8 +547,8 @@ def test_serialize_node__between(serialize_node):
|
|
559
547
|
|
560
548
|
assert not DeepDiff(
|
561
549
|
{
|
562
|
-
"id": "
|
563
|
-
"label": "BetweenGenericNode",
|
550
|
+
"id": "f2f5a1f2-a12d-4ce0-bfe9-42190ffe5328",
|
551
|
+
"label": "test_serialize_node__between.<locals>.BetweenGenericNode",
|
564
552
|
"type": "GENERIC",
|
565
553
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
566
554
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
@@ -576,10 +564,10 @@ def test_serialize_node__between(serialize_node):
|
|
576
564
|
"test_ports_serialization",
|
577
565
|
],
|
578
566
|
},
|
579
|
-
"trigger": {"id": "
|
567
|
+
"trigger": {"id": "12f79444-890b-4e5e-93b6-6c0efaee40db", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
580
568
|
"ports": [
|
581
569
|
{
|
582
|
-
"id": "
|
570
|
+
"id": "b745c089-1023-46dc-b2b6-ba75ac37563a",
|
583
571
|
"type": "IF",
|
584
572
|
"name": "if_branch",
|
585
573
|
"expression": {
|
@@ -615,12 +603,12 @@ def test_serialize_node__between(serialize_node):
|
|
615
603
|
)
|
616
604
|
|
617
605
|
|
618
|
-
|
619
|
-
class Ports(BaseNode.Ports):
|
620
|
-
if_branch = Port.on_if(Inputs.input.equals("hello") | Inputs.input.equals("world"))
|
606
|
+
def test_serialize_node__or(serialize_node):
|
621
607
|
|
608
|
+
class OrGenericNode(BaseNode):
|
609
|
+
class Ports(BaseNode.Ports):
|
610
|
+
if_branch = Port.on_if(Inputs.input.equals("hello") | Inputs.input.equals("world"))
|
622
611
|
|
623
|
-
def test_serialize_node__or(serialize_node):
|
624
612
|
input_id = uuid4()
|
625
613
|
serialized_node = serialize_node(
|
626
614
|
node_class=OrGenericNode, global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)}
|
@@ -628,8 +616,8 @@ def test_serialize_node__or(serialize_node):
|
|
628
616
|
|
629
617
|
assert not DeepDiff(
|
630
618
|
{
|
631
|
-
"id": "
|
632
|
-
"label": "OrGenericNode",
|
619
|
+
"id": "5386abad-3378-4378-b3a8-831b4b77dc23",
|
620
|
+
"label": "test_serialize_node__or.<locals>.OrGenericNode",
|
633
621
|
"type": "GENERIC",
|
634
622
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
635
623
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
@@ -645,10 +633,10 @@ def test_serialize_node__or(serialize_node):
|
|
645
633
|
"test_ports_serialization",
|
646
634
|
],
|
647
635
|
},
|
648
|
-
"trigger": {"id": "
|
636
|
+
"trigger": {"id": "fb39e80b-4032-4538-83e4-59480b1ef7ff", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
649
637
|
"ports": [
|
650
638
|
{
|
651
|
-
"id": "
|
639
|
+
"id": "0bd64819-b866-4333-82e0-8ac672c09b79",
|
652
640
|
"type": "IF",
|
653
641
|
"name": "if_branch",
|
654
642
|
"expression": {
|
@@ -696,14 +684,13 @@ def test_serialize_node__or(serialize_node):
|
|
696
684
|
)
|
697
685
|
|
698
686
|
|
699
|
-
class AndThenOrGenericNode(BaseNode):
|
700
|
-
class Ports(BaseNode.Ports):
|
701
|
-
if_branch = Port.on_if(
|
702
|
-
Inputs.input.equals("hello") & Inputs.input.equals("then") | Inputs.input.equals("world")
|
703
|
-
)
|
704
|
-
|
705
|
-
|
706
687
|
def test_serialize_node__and_then_or(serialize_node):
|
688
|
+
class AndThenOrGenericNode(BaseNode):
|
689
|
+
class Ports(BaseNode.Ports):
|
690
|
+
if_branch = Port.on_if(
|
691
|
+
Inputs.input.equals("hello") & Inputs.input.equals("then") | Inputs.input.equals("world")
|
692
|
+
)
|
693
|
+
|
707
694
|
input_id = uuid4()
|
708
695
|
serialized_node = serialize_node(
|
709
696
|
node_class=AndThenOrGenericNode,
|
@@ -712,8 +699,8 @@ def test_serialize_node__and_then_or(serialize_node):
|
|
712
699
|
|
713
700
|
assert not DeepDiff(
|
714
701
|
{
|
715
|
-
"id": "
|
716
|
-
"label": "AndThenOrGenericNode",
|
702
|
+
"id": "4d3995b1-437b-48d9-8878-9f57a8b725f1",
|
703
|
+
"label": "test_serialize_node__and_then_or.<locals>.AndThenOrGenericNode",
|
717
704
|
"type": "GENERIC",
|
718
705
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
719
706
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
@@ -729,10 +716,10 @@ def test_serialize_node__and_then_or(serialize_node):
|
|
729
716
|
"test_ports_serialization",
|
730
717
|
],
|
731
718
|
},
|
732
|
-
"trigger": {"id": "
|
719
|
+
"trigger": {"id": "b2b040de-9fba-4204-a6a5-e17f6ab321b1", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
733
720
|
"ports": [
|
734
721
|
{
|
735
|
-
"id": "
|
722
|
+
"id": "8bb89da2-a752-4541-8f90-1276c44910a8",
|
736
723
|
"type": "IF",
|
737
724
|
"name": "if_branch",
|
738
725
|
"expression": {
|
@@ -799,14 +786,13 @@ def test_serialize_node__and_then_or(serialize_node):
|
|
799
786
|
)
|
800
787
|
|
801
788
|
|
802
|
-
class ParenthesizedAndThenOrGenericNode(BaseNode):
|
803
|
-
class Ports(BaseNode.Ports):
|
804
|
-
if_branch = Port.on_if(
|
805
|
-
Inputs.input.equals("hello") & (Inputs.input.equals("then") | Inputs.input.equals("world"))
|
806
|
-
)
|
807
|
-
|
808
|
-
|
809
789
|
def test_serialize_node__parenthesized_and_then_or(serialize_node):
|
790
|
+
class ParenthesizedAndThenOrGenericNode(BaseNode):
|
791
|
+
class Ports(BaseNode.Ports):
|
792
|
+
if_branch = Port.on_if(
|
793
|
+
Inputs.input.equals("hello") & (Inputs.input.equals("then") | Inputs.input.equals("world"))
|
794
|
+
)
|
795
|
+
|
810
796
|
input_id = uuid4()
|
811
797
|
serialized_node = serialize_node(
|
812
798
|
node_class=ParenthesizedAndThenOrGenericNode,
|
@@ -815,8 +801,8 @@ def test_serialize_node__parenthesized_and_then_or(serialize_node):
|
|
815
801
|
|
816
802
|
assert not DeepDiff(
|
817
803
|
{
|
818
|
-
"id": "
|
819
|
-
"label": "ParenthesizedAndThenOrGenericNode",
|
804
|
+
"id": "223864c9-0088-4c05-9b7d-e5b1c9ec936d",
|
805
|
+
"label": "test_serialize_node__parenthesized_and_then_or.<locals>.ParenthesizedAndThenOrGenericNode",
|
820
806
|
"type": "GENERIC",
|
821
807
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
822
808
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
@@ -832,10 +818,10 @@ def test_serialize_node__parenthesized_and_then_or(serialize_node):
|
|
832
818
|
"test_ports_serialization",
|
833
819
|
],
|
834
820
|
},
|
835
|
-
"trigger": {"id": "
|
821
|
+
"trigger": {"id": "bfd1504d-f642-431d-a900-28b0709bd65c", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
836
822
|
"ports": [
|
837
823
|
{
|
838
|
-
"id": "
|
824
|
+
"id": "30478083-924d-469e-ad55-df28bc282cdb",
|
839
825
|
"type": "IF",
|
840
826
|
"name": "if_branch",
|
841
827
|
"expression": {
|
@@ -902,14 +888,13 @@ def test_serialize_node__parenthesized_and_then_or(serialize_node):
|
|
902
888
|
)
|
903
889
|
|
904
890
|
|
905
|
-
class OrThenAndGenericNode(BaseNode):
|
906
|
-
class Ports(BaseNode.Ports):
|
907
|
-
if_branch = Port.on_if(
|
908
|
-
Inputs.input.equals("hello") | Inputs.input.equals("then") & Inputs.input.equals("world")
|
909
|
-
)
|
910
|
-
|
911
|
-
|
912
891
|
def test_serialize_node__or_then_and(serialize_node):
|
892
|
+
class OrThenAndGenericNode(BaseNode):
|
893
|
+
class Ports(BaseNode.Ports):
|
894
|
+
if_branch = Port.on_if(
|
895
|
+
Inputs.input.equals("hello") | Inputs.input.equals("then") & Inputs.input.equals("world")
|
896
|
+
)
|
897
|
+
|
913
898
|
input_id = uuid4()
|
914
899
|
serialized_node = serialize_node(
|
915
900
|
node_class=OrThenAndGenericNode,
|
@@ -918,8 +903,8 @@ def test_serialize_node__or_then_and(serialize_node):
|
|
918
903
|
|
919
904
|
assert not DeepDiff(
|
920
905
|
{
|
921
|
-
"id": "
|
922
|
-
"label": "OrThenAndGenericNode",
|
906
|
+
"id": "a946342e-4ede-4e96-8e3d-f396748d9f7c",
|
907
|
+
"label": "test_serialize_node__or_then_and.<locals>.OrThenAndGenericNode",
|
923
908
|
"type": "GENERIC",
|
924
909
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
925
910
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
@@ -935,10 +920,10 @@ def test_serialize_node__or_then_and(serialize_node):
|
|
935
920
|
"test_ports_serialization",
|
936
921
|
],
|
937
922
|
},
|
938
|
-
"trigger": {"id": "
|
923
|
+
"trigger": {"id": "9c59699a-edf9-4618-b6bc-1074f3bfae78", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
939
924
|
"ports": [
|
940
925
|
{
|
941
|
-
"id": "
|
926
|
+
"id": "7f442cce-0b99-482c-aec8-8eed6ccadde2",
|
942
927
|
"type": "IF",
|
943
928
|
"name": "if_branch",
|
944
929
|
"expression": {
|
@@ -1003,3 +988,70 @@ def test_serialize_node__or_then_and(serialize_node):
|
|
1003
988
|
serialized_node,
|
1004
989
|
ignore_order=True,
|
1005
990
|
)
|
991
|
+
|
992
|
+
|
993
|
+
def test_serialize_node__parse_json(serialize_node):
|
994
|
+
|
995
|
+
class ParseJsonGenericNode(BaseNode):
|
996
|
+
class Ports(BaseNode.Ports):
|
997
|
+
if_branch = Port.on_if(Inputs.input.parse_json().equals({"key": "value"}))
|
998
|
+
|
999
|
+
input_id = uuid4()
|
1000
|
+
serialized_node = serialize_node(
|
1001
|
+
node_class=ParseJsonGenericNode,
|
1002
|
+
global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)},
|
1003
|
+
)
|
1004
|
+
|
1005
|
+
assert not DeepDiff(
|
1006
|
+
{
|
1007
|
+
"id": "bfc3f81b-242a-4f43-9e1c-648223d77768",
|
1008
|
+
"label": "test_serialize_node__parse_json.<locals>.ParseJsonGenericNode",
|
1009
|
+
"type": "GENERIC",
|
1010
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
1011
|
+
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
1012
|
+
"definition": {
|
1013
|
+
"name": "ParseJsonGenericNode",
|
1014
|
+
"module": [
|
1015
|
+
"vellum_ee",
|
1016
|
+
"workflows",
|
1017
|
+
"display",
|
1018
|
+
"tests",
|
1019
|
+
"workflow_serialization",
|
1020
|
+
"generic_nodes",
|
1021
|
+
"test_ports_serialization",
|
1022
|
+
],
|
1023
|
+
},
|
1024
|
+
"trigger": {"id": "1d3287e2-cc05-49d2-be99-150320264f24", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
1025
|
+
"ports": [
|
1026
|
+
{
|
1027
|
+
"id": "5a88bac8-89b3-4d81-b539-2f977a36a9c0",
|
1028
|
+
"type": "IF",
|
1029
|
+
"name": "if_branch",
|
1030
|
+
"expression": {
|
1031
|
+
"type": "BINARY_EXPRESSION",
|
1032
|
+
"lhs": {
|
1033
|
+
"type": "UNARY_EXPRESSION",
|
1034
|
+
"lhs": {
|
1035
|
+
"type": "WORKFLOW_INPUT",
|
1036
|
+
"input_variable_id": str(input_id),
|
1037
|
+
},
|
1038
|
+
"operator": "parseJson",
|
1039
|
+
},
|
1040
|
+
"operator": "=",
|
1041
|
+
"rhs": {
|
1042
|
+
"type": "CONSTANT_VALUE",
|
1043
|
+
"value": {
|
1044
|
+
"type": "JSON",
|
1045
|
+
"value": {"key": "value"},
|
1046
|
+
},
|
1047
|
+
},
|
1048
|
+
},
|
1049
|
+
}
|
1050
|
+
],
|
1051
|
+
"adornments": None,
|
1052
|
+
"attributes": [],
|
1053
|
+
"outputs": [],
|
1054
|
+
},
|
1055
|
+
serialized_node,
|
1056
|
+
ignore_order=True,
|
1057
|
+
)
|