vellum-ai 0.14.18__py3-none-any.whl → 0.14.20__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 -0
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/types/__init__.py +2 -0
- vellum/client/types/node_input_compiled_secret_value.py +23 -0
- vellum/client/types/node_input_variable_compiled_value.py +2 -0
- vellum/types/node_input_compiled_secret_value.py +3 -0
- vellum/workflows/nodes/core/inline_subworkflow_node/node.py +16 -14
- vellum/workflows/nodes/core/inline_subworkflow_node/tests/test_node.py +29 -0
- vellum/workflows/nodes/displayable/code_execution_node/node.py +1 -1
- vellum/workflows/nodes/displayable/code_execution_node/tests/test_code_execution_node.py +41 -0
- vellum/workflows/nodes/displayable/code_execution_node/utils.py +6 -1
- vellum/workflows/references/lazy.py +9 -1
- vellum/workflows/references/tests/test_lazy.py +30 -0
- {vellum_ai-0.14.18.dist-info → vellum_ai-0.14.20.dist-info}/METADATA +1 -1
- {vellum_ai-0.14.18.dist-info → vellum_ai-0.14.20.dist-info}/RECORD +44 -40
- vellum_ee/workflows/display/base.py +6 -2
- vellum_ee/workflows/display/nodes/base_node_display.py +41 -10
- vellum_ee/workflows/display/nodes/base_node_vellum_display.py +0 -20
- vellum_ee/workflows/display/nodes/get_node_display_class.py +3 -3
- vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +14 -10
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +2 -6
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +2 -6
- vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +113 -0
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/conftest.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +4 -4
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +39 -8
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_outputs_serialization.py +3 -3
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +14 -14
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +3 -3
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +5 -5
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_default_state_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +3 -3
- vellum_ee/workflows/display/types.py +4 -7
- vellum_ee/workflows/display/vellum.py +10 -2
- vellum_ee/workflows/display/workflows/base_workflow_display.py +60 -32
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +33 -78
- vellum_ee/workflows/server/virtual_file_loader.py +52 -22
- vellum_ee/workflows/tests/test_server.py +61 -0
- {vellum_ai-0.14.18.dist-info → vellum_ai-0.14.20.dist-info}/LICENSE +0 -0
- {vellum_ai-0.14.18.dist-info → vellum_ai-0.14.20.dist-info}/WHEEL +0 -0
- {vellum_ai-0.14.18.dist-info → vellum_ai-0.14.20.dist-info}/entry_points.txt +0 -0
vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py
CHANGED
@@ -40,7 +40,7 @@ def test_serialize_node__basic(serialize_node):
|
|
40
40
|
"test_ports_serialization",
|
41
41
|
],
|
42
42
|
},
|
43
|
-
"trigger": {"id": "
|
43
|
+
"trigger": {"id": "b95cca96-b570-42ac-ace8-51ca0f627881", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
44
44
|
"ports": [
|
45
45
|
{
|
46
46
|
"id": "8bec8d0c-113f-4110-afcb-4a6e566e7236",
|
@@ -86,7 +86,7 @@ def test_serialize_node__if(serialize_node):
|
|
86
86
|
"test_ports_serialization",
|
87
87
|
],
|
88
88
|
},
|
89
|
-
"trigger": {"id": "
|
89
|
+
"trigger": {"id": "46e21bcc-47e1-457f-8134-ead575253b74", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
90
90
|
"ports": [
|
91
91
|
{
|
92
92
|
"id": "9889fe69-62f8-4bb3-aac6-425b75700bea",
|
@@ -148,7 +148,7 @@ def test_serialize_node__if_else(serialize_node):
|
|
148
148
|
"test_ports_serialization",
|
149
149
|
],
|
150
150
|
},
|
151
|
-
"trigger": {"id": "
|
151
|
+
"trigger": {"id": "664c941c-275c-474c-9a5c-8501b934e86d", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
152
152
|
"ports": [
|
153
153
|
{
|
154
154
|
"id": "6fd9edea-9c1f-4463-aeb9-bfdde3231ee0",
|
@@ -217,7 +217,7 @@ def test_serialize_node__if_elif_else(serialize_node):
|
|
217
217
|
"test_ports_serialization",
|
218
218
|
],
|
219
219
|
},
|
220
|
-
"trigger": {"id": "
|
220
|
+
"trigger": {"id": "bba33909-beeb-4ebd-ad77-46b617ab07b0", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
221
221
|
"ports": [
|
222
222
|
{
|
223
223
|
"id": "19a1cc62-1f18-49b0-8026-7c82709e34db",
|
@@ -316,7 +316,7 @@ def test_serialize_node__node_output_reference(serialize_node):
|
|
316
316
|
],
|
317
317
|
},
|
318
318
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
319
|
-
"trigger": {"id": "
|
319
|
+
"trigger": {"id": "c8804b97-9f84-41b6-ade8-aa74544d6846", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
320
320
|
"ports": [
|
321
321
|
{
|
322
322
|
"id": "500075dc-fc65-428a-b3c0-a410f8c7f8cf",
|
@@ -379,7 +379,7 @@ def test_serialize_node__vellum_secret_reference(serialize_node):
|
|
379
379
|
],
|
380
380
|
},
|
381
381
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
382
|
-
"trigger": {"id": "
|
382
|
+
"trigger": {"id": "93cc612b-c020-420b-94ef-62d9687c212c", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
383
383
|
"ports": [
|
384
384
|
{
|
385
385
|
"id": "3b6b4048-8622-446d-9772-2766357d7b18",
|
@@ -445,7 +445,7 @@ def test_serialize_node__execution_count_reference(serialize_node):
|
|
445
445
|
],
|
446
446
|
},
|
447
447
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
448
|
-
"trigger": {"id": "
|
448
|
+
"trigger": {"id": "ccc61dda-a947-47ac-b484-78f971ae1148", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
449
449
|
"ports": [
|
450
450
|
{
|
451
451
|
"id": "79d0cfa3-c8f9-4434-a2f8-5e416d66437a",
|
@@ -506,7 +506,7 @@ def test_serialize_node__null(serialize_node):
|
|
506
506
|
"test_ports_serialization",
|
507
507
|
],
|
508
508
|
},
|
509
|
-
"trigger": {"id": "
|
509
|
+
"trigger": {"id": "ad543514-516f-47ac-a363-1bbfccb0dfa9", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
510
510
|
"ports": [
|
511
511
|
{
|
512
512
|
"id": "7f1fb75d-0c8b-4ebc-8c59-4ae68f1a68e1",
|
@@ -564,7 +564,7 @@ def test_serialize_node__between(serialize_node):
|
|
564
564
|
"test_ports_serialization",
|
565
565
|
],
|
566
566
|
},
|
567
|
-
"trigger": {"id": "
|
567
|
+
"trigger": {"id": "36799ad9-5c1a-4bb6-be13-aee5487c021b", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
568
568
|
"ports": [
|
569
569
|
{
|
570
570
|
"id": "b745c089-1023-46dc-b2b6-ba75ac37563a",
|
@@ -633,7 +633,7 @@ def test_serialize_node__or(serialize_node):
|
|
633
633
|
"test_ports_serialization",
|
634
634
|
],
|
635
635
|
},
|
636
|
-
"trigger": {"id": "
|
636
|
+
"trigger": {"id": "f2837ac2-2132-4af2-b8bb-30de9b0a2815", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
637
637
|
"ports": [
|
638
638
|
{
|
639
639
|
"id": "0bd64819-b866-4333-82e0-8ac672c09b79",
|
@@ -716,7 +716,7 @@ def test_serialize_node__and_then_or(serialize_node):
|
|
716
716
|
"test_ports_serialization",
|
717
717
|
],
|
718
718
|
},
|
719
|
-
"trigger": {"id": "
|
719
|
+
"trigger": {"id": "aa7747fe-4b59-4994-a5c4-0ccc8065f93d", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
720
720
|
"ports": [
|
721
721
|
{
|
722
722
|
"id": "8bb89da2-a752-4541-8f90-1276c44910a8",
|
@@ -818,7 +818,7 @@ def test_serialize_node__parenthesized_and_then_or(serialize_node):
|
|
818
818
|
"test_ports_serialization",
|
819
819
|
],
|
820
820
|
},
|
821
|
-
"trigger": {"id": "
|
821
|
+
"trigger": {"id": "71601746-3722-423c-8fc0-d15a6bb6ddd4", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
822
822
|
"ports": [
|
823
823
|
{
|
824
824
|
"id": "30478083-924d-469e-ad55-df28bc282cdb",
|
@@ -920,7 +920,7 @@ def test_serialize_node__or_then_and(serialize_node):
|
|
920
920
|
"test_ports_serialization",
|
921
921
|
],
|
922
922
|
},
|
923
|
-
"trigger": {"id": "
|
923
|
+
"trigger": {"id": "9c875b19-fce1-4eef-80ea-19651dec1a76", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
924
924
|
"ports": [
|
925
925
|
{
|
926
926
|
"id": "7f442cce-0b99-482c-aec8-8eed6ccadde2",
|
@@ -1021,7 +1021,7 @@ def test_serialize_node__parse_json(serialize_node):
|
|
1021
1021
|
"test_ports_serialization",
|
1022
1022
|
],
|
1023
1023
|
},
|
1024
|
-
"trigger": {"id": "
|
1024
|
+
"trigger": {"id": "ecff8eef-b928-48e7-ac26-841322ff2752", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
1025
1025
|
"ports": [
|
1026
1026
|
{
|
1027
1027
|
"id": "5a88bac8-89b3-4d81-b539-2f977a36a9c0",
|
vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py
CHANGED
@@ -33,7 +33,7 @@ def test_serialize_node__basic(serialize_node):
|
|
33
33
|
"test_trigger_serialization",
|
34
34
|
],
|
35
35
|
},
|
36
|
-
"trigger": {"id": "
|
36
|
+
"trigger": {"id": "b95cca96-b570-42ac-ace8-51ca0f627881", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
37
37
|
"ports": [
|
38
38
|
{
|
39
39
|
"id": "8bec8d0c-113f-4110-afcb-4a6e566e7236",
|
@@ -75,7 +75,7 @@ def test_serialize_node__await_any(serialize_node):
|
|
75
75
|
"test_trigger_serialization",
|
76
76
|
],
|
77
77
|
},
|
78
|
-
"trigger": {"id": "
|
78
|
+
"trigger": {"id": "c0db17e7-6766-4062-aaee-7404580d76e4", "merge_behavior": "AWAIT_ANY"},
|
79
79
|
"ports": [
|
80
80
|
{
|
81
81
|
"id": "d9a84db7-8bd6-4a15-9e3c-c2e898c26d16",
|
@@ -117,7 +117,7 @@ def test_serialize_node__await_all(serialize_node):
|
|
117
117
|
"test_trigger_serialization",
|
118
118
|
],
|
119
119
|
},
|
120
|
-
"trigger": {"id": "
|
120
|
+
"trigger": {"id": "1b22935e-0e79-485a-b274-a2f316c0983c", "merge_behavior": "AWAIT_ALL"},
|
121
121
|
"ports": [
|
122
122
|
{
|
123
123
|
"id": "fa73da35-0bf9-4f02-bf5b-0b0d1a6f1494",
|
@@ -638,7 +638,7 @@ def test_serialize_workflow():
|
|
638
638
|
"source_node_id": "9b619e4d-b0a7-4121-9060-100d457868cb",
|
639
639
|
"source_handle_id": "3a45b81f-95e4-4cbd-8997-bfdbe30251e8",
|
640
640
|
"target_node_id": "0d959311-c836-4641-a867-58f63df9dfea",
|
641
|
-
"target_handle_id": "
|
641
|
+
"target_handle_id": "7beba198-c452-4749-a38a-ea9420d84e14",
|
642
642
|
"type": "DEFAULT",
|
643
643
|
},
|
644
644
|
{
|
@@ -646,7 +646,7 @@ def test_serialize_workflow():
|
|
646
646
|
"source_node_id": "9b619e4d-b0a7-4121-9060-100d457868cb",
|
647
647
|
"source_handle_id": "7202f702-1ebc-4067-ab1e-ec67e49158ee",
|
648
648
|
"target_node_id": "68c02b7c-5077-4087-803d-841474a8081f",
|
649
|
-
"target_handle_id": "
|
649
|
+
"target_handle_id": "1dc4eebe-b6db-4229-96e5-115ff8cedb76",
|
650
650
|
"type": "DEFAULT",
|
651
651
|
},
|
652
652
|
{
|
@@ -654,7 +654,7 @@ def test_serialize_workflow():
|
|
654
654
|
"source_node_id": "9b619e4d-b0a7-4121-9060-100d457868cb",
|
655
655
|
"source_handle_id": "cf45705d-1a47-43a6-9d24-a7fdf78baae0",
|
656
656
|
"target_node_id": "8df781b1-ff28-48a5-98a2-d7d796b932b0",
|
657
|
-
"target_handle_id": "
|
657
|
+
"target_handle_id": "b73c39be-cbfe-4225-86e6-e6e4c161881e",
|
658
658
|
"type": "DEFAULT",
|
659
659
|
},
|
660
660
|
{
|
@@ -662,7 +662,7 @@ def test_serialize_workflow():
|
|
662
662
|
"source_node_id": "9b619e4d-b0a7-4121-9060-100d457868cb",
|
663
663
|
"source_handle_id": "f04610dd-61cf-41b0-b337-2235e101cdb0",
|
664
664
|
"target_node_id": "ed7caf01-9ae7-47a3-b15a-16697abaf486",
|
665
|
-
"target_handle_id": "
|
665
|
+
"target_handle_id": "76fe7aec-5cd4-4c1a-b386-cfe09ebe66e4",
|
666
666
|
"type": "DEFAULT",
|
667
667
|
},
|
668
668
|
{
|
@@ -670,7 +670,7 @@ def test_serialize_workflow():
|
|
670
670
|
"source_node_id": "9b619e4d-b0a7-4121-9060-100d457868cb",
|
671
671
|
"source_handle_id": "f9dde637-ea90-465f-a871-caf8380ae377",
|
672
672
|
"target_node_id": "148c61bd-e8b0-4d4b-8734-b043a72b90ed",
|
673
|
-
"target_handle_id": "
|
673
|
+
"target_handle_id": "c88839af-3a79-4310-abbd-e1553d981dce",
|
674
674
|
"type": "DEFAULT",
|
675
675
|
},
|
676
676
|
{
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_default_state_serialization.py
CHANGED
@@ -196,7 +196,7 @@ def test_serialize_workflow():
|
|
196
196
|
"source_node_id": "32684932-7c7c-4b1c-aed2-553de29bf3f7",
|
197
197
|
"source_handle_id": "e4136ee4-a51a-4ca3-9a3a-aa96f5de2347",
|
198
198
|
"target_node_id": "1381c078-efa2-4255-89a1-7b4cb742c7fc",
|
199
|
-
"target_handle_id": "
|
199
|
+
"target_handle_id": "6492efcf-4437-4af1-9ad7-269795ccb27a",
|
200
200
|
"type": "DEFAULT",
|
201
201
|
},
|
202
202
|
{
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py
CHANGED
@@ -124,7 +124,7 @@ def test_serialize_workflow(vellum_client):
|
|
124
124
|
"source_node_id": "f1e4678f-c470-400b-a40e-c8922cc99a86",
|
125
125
|
"source_handle_id": "40201804-8beb-43ad-8873-a027759512f1",
|
126
126
|
"target_node_id": "c2ed23f7-f6cb-4a56-a91c-2e5f9d8fda7f",
|
127
|
-
"target_handle_id": "
|
127
|
+
"target_handle_id": "b7bfb298-959a-4d2b-8b85-bbd0d2522703",
|
128
128
|
"type": "DEFAULT",
|
129
129
|
},
|
130
130
|
{
|
@@ -142,7 +142,7 @@ def test_serialize_workflow():
|
|
142
142
|
"module": ["tests", "workflows", "basic_inline_subworkflow", "workflow"],
|
143
143
|
},
|
144
144
|
"trigger": {
|
145
|
-
"id": "
|
145
|
+
"id": "6492efcf-4437-4af1-9ad7-269795ccb27a",
|
146
146
|
"merge_behavior": "AWAIT_ATTRIBUTES",
|
147
147
|
},
|
148
148
|
"ports": [
|
@@ -261,7 +261,7 @@ def test_serialize_workflow():
|
|
261
261
|
"source_node_id": "afa49a0f-db35-4552-9217-5b8f237e84bc",
|
262
262
|
"source_handle_id": "9914a6a0-9a99-430d-8ddd-f7c13847fe1a",
|
263
263
|
"target_node_id": "1381c078-efa2-4255-89a1-7b4cb742c7fc",
|
264
|
-
"target_handle_id": "
|
264
|
+
"target_handle_id": "6492efcf-4437-4af1-9ad7-269795ccb27a",
|
265
265
|
"type": "DEFAULT",
|
266
266
|
},
|
267
267
|
{
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py
CHANGED
@@ -131,7 +131,7 @@ def test_serialize_workflow():
|
|
131
131
|
"module": ["tests", "workflows", "basic_map_node", "workflow"],
|
132
132
|
},
|
133
133
|
"trigger": {
|
134
|
-
"id": "
|
134
|
+
"id": "551d5528-f4e1-42ea-bde0-9de4b4968253",
|
135
135
|
"merge_behavior": "AWAIT_ATTRIBUTES",
|
136
136
|
},
|
137
137
|
"ports": [
|
@@ -215,7 +215,7 @@ def test_serialize_workflow():
|
|
215
215
|
"source_node_id": "ff9bfe6e-839d-4d40-b8fc-313b3bbd0ab0",
|
216
216
|
"source_handle_id": "520d3616-8369-4e79-9da5-3febae299c2a",
|
217
217
|
"target_node_id": "baf6d316-dc75-41e8-96c0-015aede96309",
|
218
|
-
"target_handle_id": "
|
218
|
+
"target_handle_id": "551d5528-f4e1-42ea-bde0-9de4b4968253",
|
219
219
|
"type": "DEFAULT",
|
220
220
|
},
|
221
221
|
{
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py
CHANGED
@@ -146,7 +146,7 @@ def test_serialize_workflow__await_all():
|
|
146
146
|
"source_node_id": "dc8aecd0-49ba-4464-a45f-29d3bfd686e4",
|
147
147
|
"source_handle_id": "017d40f5-8326-4e42-a409-b08995defaa8",
|
148
148
|
"target_node_id": "59243c65-053f-4ea6-9157-3f3edb1477bf",
|
149
|
-
"target_handle_id": "
|
149
|
+
"target_handle_id": "e622fe61-3bca-4aff-86e1-25dad7bdf9d4",
|
150
150
|
"type": "DEFAULT",
|
151
151
|
},
|
152
152
|
{
|
@@ -154,7 +154,7 @@ def test_serialize_workflow__await_all():
|
|
154
154
|
"source_node_id": "dc8aecd0-49ba-4464-a45f-29d3bfd686e4",
|
155
155
|
"source_handle_id": "017d40f5-8326-4e42-a409-b08995defaa8",
|
156
156
|
"target_node_id": "127ef456-91bc-43c6-bd8b-1772db5e3cb5",
|
157
|
-
"target_handle_id": "
|
157
|
+
"target_handle_id": "e5cc41cb-71db-43ec-b3f0-c78706af3351",
|
158
158
|
"type": "DEFAULT",
|
159
159
|
},
|
160
160
|
{
|
@@ -178,7 +178,7 @@ def test_serialize_workflow__await_all():
|
|
178
178
|
"source_node_id": "37c10e8a-771b-432b-a767-31f5007851f0",
|
179
179
|
"source_handle_id": "3bbc469f-0fb0-4b3d-a28b-746fefec2818",
|
180
180
|
"target_node_id": "634f0202-9ea9-4c62-b152-1a58c595cffb",
|
181
|
-
"target_handle_id": "
|
181
|
+
"target_handle_id": "acd48f48-54fb-4b2b-ab37-96d336f6dfb3",
|
182
182
|
"type": "DEFAULT",
|
183
183
|
},
|
184
184
|
{
|
@@ -7,7 +7,6 @@ from vellum.workflows.nodes import BaseNode
|
|
7
7
|
from vellum.workflows.ports import Port
|
8
8
|
from vellum.workflows.references import OutputReference, StateValueReference, WorkflowInputReference
|
9
9
|
from vellum_ee.workflows.display.base import (
|
10
|
-
EdgeDisplayType,
|
11
10
|
EntrypointDisplayType,
|
12
11
|
StateValueDisplayType,
|
13
12
|
WorkflowInputsDisplayType,
|
@@ -18,9 +17,9 @@ from vellum_ee.workflows.display.base import (
|
|
18
17
|
if TYPE_CHECKING:
|
19
18
|
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
20
19
|
from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay, PortDisplay
|
20
|
+
from vellum_ee.workflows.display.vellum import EdgeVellumDisplay
|
21
21
|
from vellum_ee.workflows.display.workflows import BaseWorkflowDisplay
|
22
22
|
|
23
|
-
NodeDisplayType = TypeVar("NodeDisplayType", bound="BaseNodeDisplay")
|
24
23
|
WorkflowDisplayType = TypeVar("WorkflowDisplayType", bound="BaseWorkflowDisplay")
|
25
24
|
|
26
25
|
|
@@ -30,9 +29,7 @@ class WorkflowDisplayContext(
|
|
30
29
|
WorkflowMetaDisplayType,
|
31
30
|
WorkflowInputsDisplayType,
|
32
31
|
StateValueDisplayType,
|
33
|
-
NodeDisplayType,
|
34
32
|
EntrypointDisplayType,
|
35
|
-
EdgeDisplayType,
|
36
33
|
]
|
37
34
|
):
|
38
35
|
workflow_display_class: Type["BaseWorkflowDisplay"]
|
@@ -43,12 +40,12 @@ class WorkflowDisplayContext(
|
|
43
40
|
)
|
44
41
|
state_value_displays: Dict[StateValueReference, StateValueDisplayType] = field(default_factory=dict)
|
45
42
|
global_state_value_displays: Dict[StateValueReference, StateValueDisplayType] = field(default_factory=dict)
|
46
|
-
node_displays: Dict[Type[BaseNode], "
|
47
|
-
global_node_displays: Dict[Type[BaseNode],
|
43
|
+
node_displays: Dict[Type[BaseNode], "BaseNodeDisplay"] = field(default_factory=dict)
|
44
|
+
global_node_displays: Dict[Type[BaseNode], "BaseNodeDisplay"] = field(default_factory=dict)
|
48
45
|
global_node_output_displays: Dict[OutputReference, Tuple[Type[BaseNode], "NodeOutputDisplay"]] = field(
|
49
46
|
default_factory=dict
|
50
47
|
)
|
51
48
|
entrypoint_displays: Dict[Type[BaseNode], EntrypointDisplayType] = field(default_factory=dict)
|
52
49
|
workflow_output_displays: Dict[BaseDescriptor, WorkflowOutputDisplay] = field(default_factory=dict)
|
53
|
-
edge_displays: Dict[Tuple[Port, Type[BaseNode]],
|
50
|
+
edge_displays: Dict[Tuple[Port, Type[BaseNode]], "EdgeVellumDisplay"] = field(default_factory=dict)
|
54
51
|
port_displays: Dict[Port, "PortDisplay"] = field(default_factory=dict)
|
@@ -93,12 +93,20 @@ class StateValueVellumDisplay(StateValueVellumDisplayOverrides):
|
|
93
93
|
|
94
94
|
|
95
95
|
@dataclass
|
96
|
-
class EdgeVellumDisplayOverrides(
|
96
|
+
class EdgeVellumDisplayOverrides(EdgeDisplayOverrides):
|
97
|
+
"""
|
98
|
+
DEPRECATED: Use EdgeDisplay instead. Will be removed in 0.15.0
|
99
|
+
"""
|
100
|
+
|
97
101
|
pass
|
98
102
|
|
99
103
|
|
100
104
|
@dataclass
|
101
105
|
class EdgeVellumDisplay(EdgeVellumDisplayOverrides):
|
106
|
+
"""
|
107
|
+
DEPRECATED: Use EdgeDisplay instead. Will be removed in 0.15.0
|
108
|
+
"""
|
109
|
+
|
102
110
|
source_node_id: UUID
|
103
111
|
source_handle_id: UUID
|
104
112
|
target_node_id: UUID
|
@@ -108,7 +116,7 @@ class EdgeVellumDisplay(EdgeVellumDisplayOverrides):
|
|
108
116
|
|
109
117
|
@dataclass
|
110
118
|
class EntrypointVellumDisplayOverrides(EntrypointDisplay, EntrypointDisplayOverrides):
|
111
|
-
edge_display:
|
119
|
+
edge_display: EdgeDisplay
|
112
120
|
|
113
121
|
|
114
122
|
@dataclass
|
@@ -12,15 +12,14 @@ from vellum.workflows.edges import Edge
|
|
12
12
|
from vellum.workflows.events.workflow import NodeEventDisplayContext, WorkflowEventDisplayContext
|
13
13
|
from vellum.workflows.expressions.coalesce_expression import CoalesceExpression
|
14
14
|
from vellum.workflows.nodes.bases import BaseNode
|
15
|
-
from vellum.workflows.nodes.utils import get_wrapped_node
|
15
|
+
from vellum.workflows.nodes.utils import get_unadorned_node, get_unadorned_port, get_wrapped_node
|
16
16
|
from vellum.workflows.ports import Port
|
17
17
|
from vellum.workflows.references import OutputReference, StateValueReference, WorkflowInputReference
|
18
18
|
from vellum.workflows.types.core import JsonObject
|
19
19
|
from vellum.workflows.types.generics import WorkflowType
|
20
20
|
from vellum.workflows.utils.uuids import uuid4_from_hash
|
21
21
|
from vellum_ee.workflows.display.base import (
|
22
|
-
|
23
|
-
EdgeDisplayType,
|
22
|
+
EdgeDisplay,
|
24
23
|
EntrypointDisplayOverridesType,
|
25
24
|
EntrypointDisplayType,
|
26
25
|
StateValueDisplayOverridesType,
|
@@ -31,11 +30,13 @@ from vellum_ee.workflows.display.base import (
|
|
31
30
|
WorkflowMetaDisplayType,
|
32
31
|
WorkflowOutputDisplay,
|
33
32
|
)
|
33
|
+
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
34
34
|
from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
|
35
35
|
from vellum_ee.workflows.display.nodes.get_node_display_class import get_node_display_class
|
36
36
|
from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay, PortDisplay, PortDisplayOverrides
|
37
37
|
from vellum_ee.workflows.display.nodes.utils import raise_if_descriptor
|
38
|
-
from vellum_ee.workflows.display.types import
|
38
|
+
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
39
|
+
from vellum_ee.workflows.display.vellum import EdgeVellumDisplay
|
39
40
|
from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
|
40
41
|
|
41
42
|
logger = logging.getLogger(__name__)
|
@@ -50,11 +51,8 @@ class BaseWorkflowDisplay(
|
|
50
51
|
WorkflowInputsDisplayOverridesType,
|
51
52
|
StateValueDisplayType,
|
52
53
|
StateValueDisplayOverridesType,
|
53
|
-
NodeDisplayType,
|
54
54
|
EntrypointDisplayType,
|
55
55
|
EntrypointDisplayOverridesType,
|
56
|
-
EdgeDisplayType,
|
57
|
-
EdgeDisplayOverridesType,
|
58
56
|
]
|
59
57
|
):
|
60
58
|
# Used to specify the display data for a workflow.
|
@@ -73,7 +71,7 @@ class BaseWorkflowDisplay(
|
|
73
71
|
output_displays: Dict[BaseDescriptor, WorkflowOutputDisplay] = {}
|
74
72
|
|
75
73
|
# Used to explicitly specify display data for a workflow's edges.
|
76
|
-
edge_displays: Dict[Tuple[Port, Type[BaseNode]],
|
74
|
+
edge_displays: Dict[Tuple[Port, Type[BaseNode]], EdgeDisplay] = {}
|
77
75
|
|
78
76
|
# Used to explicitly specify display data for a workflow's ports.
|
79
77
|
port_displays: Dict[Port, PortDisplayOverrides] = {}
|
@@ -94,9 +92,7 @@ class BaseWorkflowDisplay(
|
|
94
92
|
WorkflowMetaDisplayType,
|
95
93
|
WorkflowInputsDisplayType,
|
96
94
|
StateValueDisplayType,
|
97
|
-
NodeDisplayType,
|
98
95
|
EntrypointDisplayType,
|
99
|
-
EdgeDisplayType,
|
100
96
|
]
|
101
97
|
] = None,
|
102
98
|
dry_run: bool = False,
|
@@ -124,7 +120,7 @@ class BaseWorkflowDisplay(
|
|
124
120
|
|
125
121
|
@property
|
126
122
|
@abstractmethod
|
127
|
-
def node_display_base_class(self) -> Type[
|
123
|
+
def node_display_base_class(self) -> Type[BaseNodeDisplay]:
|
128
124
|
pass
|
129
125
|
|
130
126
|
def add_error(self, error: Exception) -> None:
|
@@ -141,7 +137,7 @@ class BaseWorkflowDisplay(
|
|
141
137
|
def _enrich_global_node_output_displays(
|
142
138
|
self,
|
143
139
|
node: Type[BaseNode],
|
144
|
-
node_display:
|
140
|
+
node_display: BaseNodeDisplay,
|
145
141
|
node_output_displays: Dict[OutputReference, Tuple[Type[BaseNode], NodeOutputDisplay]],
|
146
142
|
):
|
147
143
|
"""This method recursively adds nodes wrapped in decorators to the node_output_displays dictionary."""
|
@@ -162,7 +158,7 @@ class BaseWorkflowDisplay(
|
|
162
158
|
def _enrich_node_port_displays(
|
163
159
|
self,
|
164
160
|
node: Type[BaseNode],
|
165
|
-
node_display:
|
161
|
+
node_display: BaseNodeDisplay,
|
166
162
|
port_displays: Dict[Port, PortDisplay],
|
167
163
|
):
|
168
164
|
"""This method recursively adds nodes wrapped in decorators to the port_displays dictionary."""
|
@@ -178,7 +174,7 @@ class BaseWorkflowDisplay(
|
|
178
174
|
|
179
175
|
port_displays[port] = node_display.get_node_port_display(port)
|
180
176
|
|
181
|
-
def _get_node_display(self, node: Type[BaseNode]) ->
|
177
|
+
def _get_node_display(self, node: Type[BaseNode]) -> BaseNodeDisplay:
|
182
178
|
node_display_class = get_node_display_class(self.node_display_base_class, node)
|
183
179
|
node_display = node_display_class()
|
184
180
|
|
@@ -194,9 +190,7 @@ class BaseWorkflowDisplay(
|
|
194
190
|
WorkflowMetaDisplayType,
|
195
191
|
WorkflowInputsDisplayType,
|
196
192
|
StateValueDisplayType,
|
197
|
-
NodeDisplayType,
|
198
193
|
EntrypointDisplayType,
|
199
|
-
EdgeDisplayType,
|
200
194
|
]:
|
201
195
|
workflow_display = self._generate_workflow_meta_display()
|
202
196
|
|
@@ -204,9 +198,9 @@ class BaseWorkflowDisplay(
|
|
204
198
|
copy(self._parent_display_context.global_node_output_displays) if self._parent_display_context else {}
|
205
199
|
)
|
206
200
|
|
207
|
-
node_displays: Dict[Type[BaseNode],
|
201
|
+
node_displays: Dict[Type[BaseNode], BaseNodeDisplay] = {}
|
208
202
|
|
209
|
-
global_node_displays: Dict[Type[BaseNode],
|
203
|
+
global_node_displays: Dict[Type[BaseNode], BaseNodeDisplay] = (
|
210
204
|
copy(self._parent_display_context.global_node_displays) if self._parent_display_context else {}
|
211
205
|
)
|
212
206
|
|
@@ -273,7 +267,7 @@ class BaseWorkflowDisplay(
|
|
273
267
|
entrypoint, workflow_display, node_displays, overrides=entrypoint_display_overrides
|
274
268
|
)
|
275
269
|
|
276
|
-
edge_displays: Dict[Tuple[Port, Type[BaseNode]],
|
270
|
+
edge_displays: Dict[Tuple[Port, Type[BaseNode]], EdgeVellumDisplay] = {}
|
277
271
|
for edge in self._workflow.get_edges():
|
278
272
|
if edge in edge_displays:
|
279
273
|
continue
|
@@ -347,7 +341,7 @@ class BaseWorkflowDisplay(
|
|
347
341
|
self,
|
348
342
|
entrypoint: Type[BaseNode],
|
349
343
|
workflow_display: WorkflowMetaDisplayType,
|
350
|
-
node_displays: Dict[Type[BaseNode],
|
344
|
+
node_displays: Dict[Type[BaseNode], BaseNodeDisplay],
|
351
345
|
overrides: Optional[EntrypointDisplayOverridesType] = None,
|
352
346
|
) -> EntrypointDisplayType:
|
353
347
|
pass
|
@@ -357,16 +351,6 @@ class BaseWorkflowDisplay(
|
|
357
351
|
|
358
352
|
return WorkflowOutputDisplay(id=output_id, name=output.name)
|
359
353
|
|
360
|
-
@abstractmethod
|
361
|
-
def _generate_edge_display(
|
362
|
-
self,
|
363
|
-
edge: Edge,
|
364
|
-
node_displays: Dict[Type[BaseNode], NodeDisplayType],
|
365
|
-
port_displays: Dict[Port, PortDisplay],
|
366
|
-
overrides: Optional[EdgeDisplayOverridesType] = None,
|
367
|
-
) -> EdgeDisplayType:
|
368
|
-
pass
|
369
|
-
|
370
354
|
def __init_subclass__(cls, **kwargs: Any) -> None:
|
371
355
|
super().__init_subclass__(**kwargs)
|
372
356
|
|
@@ -443,9 +427,9 @@ class BaseWorkflowDisplay(
|
|
443
427
|
)
|
444
428
|
return display_meta
|
445
429
|
|
446
|
-
def _extract_node_displays(self, node: Type[BaseNode]) -> Dict[Type[BaseNode],
|
430
|
+
def _extract_node_displays(self, node: Type[BaseNode]) -> Dict[Type[BaseNode], BaseNodeDisplay]:
|
447
431
|
node_display = self._get_node_display(node)
|
448
|
-
additional_node_displays: Dict[Type[BaseNode],
|
432
|
+
additional_node_displays: Dict[Type[BaseNode], BaseNodeDisplay] = {
|
449
433
|
node: node_display,
|
450
434
|
}
|
451
435
|
|
@@ -459,3 +443,47 @@ class BaseWorkflowDisplay(
|
|
459
443
|
additional_node_displays[node] = display
|
460
444
|
|
461
445
|
return additional_node_displays
|
446
|
+
|
447
|
+
def _generate_edge_display(
|
448
|
+
self,
|
449
|
+
edge: Edge,
|
450
|
+
node_displays: Dict[Type[BaseNode], BaseNodeDisplay],
|
451
|
+
port_displays: Dict[Port, PortDisplay],
|
452
|
+
overrides: Optional[EdgeDisplay] = None,
|
453
|
+
) -> EdgeVellumDisplay:
|
454
|
+
source_node = get_unadorned_node(edge.from_port.node_class)
|
455
|
+
target_node = get_unadorned_node(edge.to_node)
|
456
|
+
|
457
|
+
source_node_id = node_displays[source_node].node_id
|
458
|
+
from_port = get_unadorned_port(edge.from_port)
|
459
|
+
source_handle_id = port_displays[from_port].id
|
460
|
+
|
461
|
+
target_node_display = node_displays[target_node]
|
462
|
+
target_node_id = target_node_display.node_id
|
463
|
+
target_handle_id = target_node_display.get_target_handle_id_by_source_node_id(source_node_id)
|
464
|
+
|
465
|
+
return self._generate_edge_display_from_source(
|
466
|
+
source_node_id, source_handle_id, target_node_id, target_handle_id, overrides
|
467
|
+
)
|
468
|
+
|
469
|
+
def _generate_edge_display_from_source(
|
470
|
+
self,
|
471
|
+
source_node_id: UUID,
|
472
|
+
source_handle_id: UUID,
|
473
|
+
target_node_id: UUID,
|
474
|
+
target_handle_id: UUID,
|
475
|
+
overrides: Optional[EdgeDisplay] = None,
|
476
|
+
) -> EdgeVellumDisplay:
|
477
|
+
edge_id: UUID
|
478
|
+
if overrides:
|
479
|
+
edge_id = overrides.id
|
480
|
+
else:
|
481
|
+
edge_id = uuid4_from_hash(f"{self.workflow_id}|id|{source_node_id}|{target_node_id}")
|
482
|
+
|
483
|
+
return EdgeVellumDisplay(
|
484
|
+
id=edge_id,
|
485
|
+
source_node_id=source_node_id,
|
486
|
+
target_node_id=target_node_id,
|
487
|
+
source_handle_id=source_handle_id,
|
488
|
+
target_handle_id=target_handle_id,
|
489
|
+
)
|