vellum-ai 0.10.9__py3-none-any.whl → 0.11.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/client/core/client_wrapper.py +1 -1
- vellum/evaluations/resources.py +7 -12
- vellum/evaluations/utils/env.py +1 -3
- vellum/evaluations/utils/paginator.py +0 -1
- vellum/evaluations/utils/typing.py +1 -1
- vellum/evaluations/utils/uuid.py +1 -1
- vellum/plugins/vellum_mypy.py +3 -1
- vellum/workflows/events/node.py +7 -6
- vellum/workflows/events/tests/test_event.py +0 -1
- vellum/workflows/events/types.py +0 -1
- vellum/workflows/events/workflow.py +19 -1
- vellum/workflows/nodes/bases/base.py +17 -56
- vellum/workflows/nodes/bases/tests/test_base_node.py +0 -1
- vellum/workflows/nodes/core/templating_node/node.py +1 -0
- vellum/workflows/nodes/core/try_node/node.py +2 -2
- vellum/workflows/nodes/core/try_node/tests/test_node.py +1 -3
- vellum/workflows/nodes/displayable/bases/api_node/node.py +1 -1
- vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +0 -1
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +0 -1
- vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +2 -1
- vellum/workflows/nodes/displayable/bases/search_node.py +0 -1
- vellum/workflows/nodes/displayable/code_execution_node/tests/test_code_execution_node.py +0 -1
- vellum/workflows/nodes/displayable/code_execution_node/utils.py +3 -2
- vellum/workflows/nodes/displayable/conditional_node/node.py +1 -1
- vellum/workflows/nodes/displayable/guardrail_node/node.py +0 -1
- vellum/workflows/nodes/displayable/inline_prompt_node/node.py +1 -0
- vellum/workflows/nodes/displayable/prompt_deployment_node/node.py +3 -1
- vellum/workflows/nodes/displayable/search_node/node.py +1 -0
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +3 -2
- vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +10 -7
- vellum/workflows/nodes/displayable/tests/test_search_node_wth_text_output.py +0 -1
- vellum/workflows/outputs/base.py +2 -4
- vellum/workflows/ports/node_ports.py +1 -1
- vellum/workflows/runner/runner.py +152 -191
- vellum/workflows/state/base.py +0 -2
- vellum/workflows/types/core.py +1 -0
- vellum/workflows/types/tests/test_utils.py +1 -0
- vellum/workflows/types/utils.py +0 -1
- vellum/workflows/utils/functions.py +74 -0
- vellum/workflows/utils/tests/test_functions.py +171 -0
- vellum/workflows/utils/tests/test_vellum_variables.py +0 -1
- vellum/workflows/utils/vellum_variables.py +2 -2
- vellum/workflows/workflows/base.py +74 -34
- vellum/workflows/workflows/event_filters.py +4 -12
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.0.dist-info}/METADATA +1 -1
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.0.dist-info}/RECORD +96 -90
- vellum_cli/__init__.py +147 -13
- vellum_cli/config.py +0 -1
- vellum_cli/image_push.py +1 -1
- vellum_cli/pull.py +29 -19
- vellum_cli/push.py +9 -10
- vellum_cli/tests/__init__.py +0 -0
- vellum_cli/tests/conftest.py +40 -0
- vellum_cli/tests/test_main.py +11 -0
- vellum_cli/tests/test_pull.py +125 -71
- vellum_cli/tests/test_push.py +173 -0
- vellum_ee/workflows/display/nodes/base_node_display.py +3 -2
- vellum_ee/workflows/display/nodes/base_node_vellum_display.py +2 -2
- vellum_ee/workflows/display/nodes/get_node_display_class.py +1 -1
- vellum_ee/workflows/display/nodes/tests/test_base_node_display.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/__init__.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/api_node.py +4 -7
- vellum_ee/workflows/display/nodes/vellum/conditional_node.py +39 -22
- vellum_ee/workflows/display/nodes/vellum/error_node.py +3 -3
- vellum_ee/workflows/display/nodes/vellum/final_output_node.py +0 -2
- vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +4 -2
- vellum_ee/workflows/display/nodes/vellum/map_node.py +11 -5
- vellum_ee/workflows/display/nodes/vellum/merge_node.py +2 -2
- vellum_ee/workflows/display/nodes/vellum/note_node.py +1 -3
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/search_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/templating_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +5 -5
- vellum_ee/workflows/display/nodes/vellum/utils.py +4 -4
- vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +45 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +13 -24
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +13 -39
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +62 -58
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +25 -4
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +2 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +2 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +2 -2
- vellum_ee/workflows/display/types.py +4 -4
- vellum_ee/workflows/display/utils/vellum.py +2 -6
- vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py +4 -1
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +6 -2
- vellum/workflows/runner/types.py +0 -16
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.0.dist-info}/LICENSE +0 -0
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.0.dist-info}/WHEEL +0 -0
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.0.dist-info}/entry_points.txt +0 -0
@@ -32,9 +32,7 @@ from tests.workflows.basic_conditional_node.workflow_with_only_one_conditional_n
|
|
32
32
|
def test_serialize_workflow():
|
33
33
|
# GIVEN a Workflow that uses a ConditionalNode
|
34
34
|
# WHEN we serialize it
|
35
|
-
workflow_display = get_workflow_display(
|
36
|
-
base_display_class=VellumWorkflowDisplay, workflow_class=CategoryWorkflow
|
37
|
-
)
|
35
|
+
workflow_display = get_workflow_display(base_display_class=VellumWorkflowDisplay, workflow_class=CategoryWorkflow)
|
38
36
|
|
39
37
|
# TODO: Support serialization of BaseNode
|
40
38
|
# https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
|
@@ -147,9 +145,7 @@ def test_serialize_workflow():
|
|
147
145
|
"rules": [
|
148
146
|
{
|
149
147
|
"type": "INPUT_VARIABLE",
|
150
|
-
"data": {
|
151
|
-
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
|
152
|
-
},
|
148
|
+
"data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
153
149
|
}
|
154
150
|
],
|
155
151
|
"combinator": "OR",
|
@@ -175,9 +171,7 @@ def test_serialize_workflow():
|
|
175
171
|
"rules": [
|
176
172
|
{
|
177
173
|
"type": "INPUT_VARIABLE",
|
178
|
-
"data": {
|
179
|
-
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
|
180
|
-
},
|
174
|
+
"data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
181
175
|
}
|
182
176
|
],
|
183
177
|
"combinator": "OR",
|
@@ -203,9 +197,7 @@ def test_serialize_workflow():
|
|
203
197
|
"rules": [
|
204
198
|
{
|
205
199
|
"type": "INPUT_VARIABLE",
|
206
|
-
"data": {
|
207
|
-
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
|
208
|
-
},
|
200
|
+
"data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
209
201
|
}
|
210
202
|
],
|
211
203
|
"combinator": "OR",
|
@@ -231,9 +223,7 @@ def test_serialize_workflow():
|
|
231
223
|
"rules": [
|
232
224
|
{
|
233
225
|
"type": "INPUT_VARIABLE",
|
234
|
-
"data": {
|
235
|
-
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
|
236
|
-
},
|
226
|
+
"data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
237
227
|
}
|
238
228
|
],
|
239
229
|
"combinator": "OR",
|
@@ -259,9 +249,7 @@ def test_serialize_workflow():
|
|
259
249
|
"rules": [
|
260
250
|
{
|
261
251
|
"type": "INPUT_VARIABLE",
|
262
|
-
"data": {
|
263
|
-
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
|
264
|
-
},
|
252
|
+
"data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
265
253
|
}
|
266
254
|
],
|
267
255
|
"combinator": "OR",
|
@@ -287,9 +275,7 @@ def test_serialize_workflow():
|
|
287
275
|
"rules": [
|
288
276
|
{
|
289
277
|
"type": "INPUT_VARIABLE",
|
290
|
-
"data": {
|
291
|
-
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
|
292
|
-
},
|
278
|
+
"data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
293
279
|
}
|
294
280
|
],
|
295
281
|
"combinator": "OR",
|
@@ -926,15 +912,11 @@ def descriptors_with_value_and_start_and_end():
|
|
926
912
|
|
927
913
|
|
928
914
|
@pytest.mark.parametrize("descriptor, operator", descriptors_with_lhs_and_rhs())
|
929
|
-
def test_conditional_node_serialize_all_operators_with_lhs_and_rhs(
|
930
|
-
descriptor, operator
|
931
|
-
):
|
915
|
+
def test_conditional_node_serialize_all_operators_with_lhs_and_rhs(descriptor, operator):
|
932
916
|
# GIVEN a simple workflow with one conditional node
|
933
917
|
workflow_cls = create_simple_workflow(descriptor)
|
934
918
|
|
935
|
-
workflow_display = get_workflow_display(
|
936
|
-
base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls
|
937
|
-
)
|
919
|
+
workflow_display = get_workflow_display(base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls)
|
938
920
|
|
939
921
|
# TODO: Support serialization of BaseNode
|
940
922
|
# https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
|
@@ -1058,9 +1040,7 @@ def test_conditional_node_serialize_all_operators_with_expression(descriptor, op
|
|
1058
1040
|
# GIVEN a simple workflow with one conditional node
|
1059
1041
|
workflow_cls = create_simple_workflow(descriptor)
|
1060
1042
|
|
1061
|
-
workflow_display = get_workflow_display(
|
1062
|
-
base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls
|
1063
|
-
)
|
1043
|
+
workflow_display = get_workflow_display(base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls)
|
1064
1044
|
|
1065
1045
|
# TODO: Support serialization of BaseNode
|
1066
1046
|
# https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
|
@@ -1166,18 +1146,12 @@ def test_conditional_node_serialize_all_operators_with_expression(descriptor, op
|
|
1166
1146
|
)
|
1167
1147
|
|
1168
1148
|
|
1169
|
-
@pytest.mark.parametrize(
|
1170
|
-
|
1171
|
-
)
|
1172
|
-
def test_conditional_node_serialize_all_operators_with_value_and_start_and_end(
|
1173
|
-
descriptor, operator
|
1174
|
-
):
|
1149
|
+
@pytest.mark.parametrize("descriptor, operator", descriptors_with_value_and_start_and_end())
|
1150
|
+
def test_conditional_node_serialize_all_operators_with_value_and_start_and_end(descriptor, operator):
|
1175
1151
|
# GIVEN a simple workflow with one conditional node
|
1176
1152
|
workflow_cls = create_simple_workflow(descriptor)
|
1177
1153
|
|
1178
|
-
workflow_display = get_workflow_display(
|
1179
|
-
base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls
|
1180
|
-
)
|
1154
|
+
workflow_display = get_workflow_display(base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls)
|
1181
1155
|
|
1182
1156
|
# TODO: Support serialization of BaseNode
|
1183
1157
|
# https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py
CHANGED
@@ -29,7 +29,7 @@ def test_serialize_workflow():
|
|
29
29
|
"type": "STRING",
|
30
30
|
"required": True,
|
31
31
|
"default": None,
|
32
|
-
"extensions": {
|
32
|
+
"extensions": {"color": None},
|
33
33
|
},
|
34
34
|
{
|
35
35
|
"id": "545ff95e-e86f-4d06-a991-602781e72605",
|
@@ -37,7 +37,7 @@ def test_serialize_workflow():
|
|
37
37
|
"type": "STRING",
|
38
38
|
"required": True,
|
39
39
|
"default": None,
|
40
|
-
"extensions": {
|
40
|
+
"extensions": {"color": None},
|
41
41
|
},
|
42
42
|
],
|
43
43
|
input_variables,
|
@@ -40,7 +40,7 @@ def test_serialize_workflow():
|
|
40
40
|
"type": "STRING",
|
41
41
|
"required": True,
|
42
42
|
"default": None,
|
43
|
-
"extensions": {
|
43
|
+
"extensions": {"color": None},
|
44
44
|
},
|
45
45
|
{
|
46
46
|
"id": "aba1e6e0-dfa7-4c15-a4e6-aec6feebfaca",
|
@@ -48,7 +48,7 @@ def test_serialize_workflow():
|
|
48
48
|
"type": "STRING",
|
49
49
|
"required": True,
|
50
50
|
"default": None,
|
51
|
-
"extensions": {
|
51
|
+
"extensions": {"color": None},
|
52
52
|
},
|
53
53
|
],
|
54
54
|
input_variables,
|
@@ -339,9 +339,13 @@ def test_serialize_workflow():
|
|
339
339
|
ignore_order=True,
|
340
340
|
)
|
341
341
|
|
342
|
-
temperature_terminal_node = next(
|
343
|
-
|
344
|
-
|
342
|
+
temperature_terminal_node = next(
|
343
|
+
node for node in workflow_raw_data["nodes"][2:] if node["data"]["name"] == "temperature"
|
344
|
+
)
|
345
|
+
reasoning_terminal_node = next(
|
346
|
+
node for node in workflow_raw_data["nodes"][2:] if node["data"]["name"] == "reasoning"
|
347
|
+
)
|
348
|
+
|
345
349
|
assert not DeepDiff(
|
346
350
|
{
|
347
351
|
"id": "31b74695-3f1c-47cf-8be8-a4d86cc589e8",
|
@@ -402,70 +406,70 @@ def test_serialize_workflow():
|
|
402
406
|
ignore_order=True,
|
403
407
|
# TODO: Make sure this output ID matches the workflow output ID of the subworkflow node's workflow
|
404
408
|
# https://app.shortcut.com/vellum/story/5660/fix-output-id-in-subworkflow-nodes
|
405
|
-
exclude_regex_paths=r"root\['inputs'\]\[0\]\['value'\]\['rules'\]\[0\]\['data'\]\['output_id'\]"
|
409
|
+
exclude_regex_paths=r"root\['inputs'\]\[0\]\['value'\]\['rules'\]\[0\]\['data'\]\['output_id'\]",
|
406
410
|
)
|
407
411
|
|
408
412
|
assert not DeepDiff(
|
409
413
|
{
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
{
|
415
|
-
"bases": [],
|
416
|
-
"module": [
|
417
|
-
"vellum",
|
418
|
-
"workflows",
|
419
|
-
"nodes",
|
420
|
-
"bases",
|
421
|
-
"base",
|
422
|
-
],
|
423
|
-
"name": "BaseNode",
|
424
|
-
},
|
425
|
-
],
|
426
|
-
"module": [
|
427
|
-
"vellum",
|
428
|
-
"workflows",
|
429
|
-
"nodes",
|
430
|
-
"displayable",
|
431
|
-
"final_output_node",
|
432
|
-
"node",
|
433
|
-
],
|
434
|
-
"name": "FinalOutputNode",
|
435
|
-
},
|
436
|
-
"data": {
|
437
|
-
"label": "Final Output",
|
438
|
-
"name": "temperature",
|
439
|
-
"target_handle_id": "9e077063-c394-4c7b-b0c6-e6686df67984",
|
440
|
-
"output_id": "99afb757-2782-465d-ab55-80ccf50552b9",
|
441
|
-
"output_type": "NUMBER",
|
442
|
-
"node_input_id": "df0d7e0c-2b37-4059-91c1-0419f950b7fe",
|
443
|
-
},
|
444
|
-
"inputs": [
|
414
|
+
"id": "0779b232-82ab-4dbe-a340-6a85e6ab3368",
|
415
|
+
"type": "TERMINAL",
|
416
|
+
"definition": {
|
417
|
+
"bases": [
|
445
418
|
{
|
446
|
-
"
|
447
|
-
"
|
448
|
-
|
449
|
-
"
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
419
|
+
"bases": [],
|
420
|
+
"module": [
|
421
|
+
"vellum",
|
422
|
+
"workflows",
|
423
|
+
"nodes",
|
424
|
+
"bases",
|
425
|
+
"base",
|
426
|
+
],
|
427
|
+
"name": "BaseNode",
|
428
|
+
},
|
429
|
+
],
|
430
|
+
"module": [
|
431
|
+
"vellum",
|
432
|
+
"workflows",
|
433
|
+
"nodes",
|
434
|
+
"displayable",
|
435
|
+
"final_output_node",
|
436
|
+
"node",
|
461
437
|
],
|
462
|
-
"
|
438
|
+
"name": "FinalOutputNode",
|
463
439
|
},
|
440
|
+
"data": {
|
441
|
+
"label": "Final Output",
|
442
|
+
"name": "temperature",
|
443
|
+
"target_handle_id": "9e077063-c394-4c7b-b0c6-e6686df67984",
|
444
|
+
"output_id": "99afb757-2782-465d-ab55-80ccf50552b9",
|
445
|
+
"output_type": "NUMBER",
|
446
|
+
"node_input_id": "df0d7e0c-2b37-4059-91c1-0419f950b7fe",
|
447
|
+
},
|
448
|
+
"inputs": [
|
449
|
+
{
|
450
|
+
"id": "df0d7e0c-2b37-4059-91c1-0419f950b7fe",
|
451
|
+
"key": "node_input",
|
452
|
+
"value": {
|
453
|
+
"rules": [
|
454
|
+
{
|
455
|
+
"type": "NODE_OUTPUT",
|
456
|
+
"data": {
|
457
|
+
"node_id": "080e4343-c7ce-4f82-b9dd-e94c8cc92239",
|
458
|
+
"output_id": "2fc57139-7420-49e5-96a6-dcbb3ff5d622",
|
459
|
+
},
|
460
|
+
}
|
461
|
+
],
|
462
|
+
"combinator": "OR",
|
463
|
+
},
|
464
|
+
}
|
465
|
+
],
|
466
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
467
|
+
},
|
464
468
|
temperature_terminal_node,
|
465
469
|
ignore_order=True,
|
466
470
|
# TODO: Make sure this output ID matches the workflow output ID of the subworkflow node's workflow
|
467
471
|
# https://app.shortcut.com/vellum/story/5660/fix-output-id-in-subworkflow-nodes
|
468
|
-
exclude_regex_paths=r"root\['inputs'\]\[0\]\['value'\]\['rules'\]\[0\]\['data'\]\['output_id'\]"
|
472
|
+
exclude_regex_paths=r"root\['inputs'\]\[0\]\['value'\]\['rules'\]\[0\]\['data'\]\['output_id'\]",
|
469
473
|
)
|
470
474
|
|
471
475
|
# AND each edge should be serialized correctly
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py
CHANGED
@@ -38,7 +38,7 @@ def test_serialize_workflow():
|
|
38
38
|
"type": "JSON",
|
39
39
|
"required": True,
|
40
40
|
"default": None,
|
41
|
-
"extensions": {
|
41
|
+
"extensions": {"color": None},
|
42
42
|
},
|
43
43
|
],
|
44
44
|
input_variables,
|
@@ -228,9 +228,30 @@ def test_serialize_workflow():
|
|
228
228
|
},
|
229
229
|
},
|
230
230
|
"input_variables": [
|
231
|
-
{
|
232
|
-
|
233
|
-
|
231
|
+
{
|
232
|
+
"id": "b29bb546-9bc8-4136-857d-8c7a464ba9d4",
|
233
|
+
"key": "item",
|
234
|
+
"type": "JSON",
|
235
|
+
"required": True,
|
236
|
+
"default": None,
|
237
|
+
"extensions": {"color": None},
|
238
|
+
},
|
239
|
+
{
|
240
|
+
"id": "17e7ca49-668f-450d-a792-e1f97d13db67",
|
241
|
+
"key": "index",
|
242
|
+
"type": "NUMBER",
|
243
|
+
"required": True,
|
244
|
+
"default": None,
|
245
|
+
"extensions": {"color": None},
|
246
|
+
},
|
247
|
+
{
|
248
|
+
"id": "d6fc6c7a-235f-4b98-86f3-e258d1198f93",
|
249
|
+
"key": "items",
|
250
|
+
"type": "JSON",
|
251
|
+
"required": True,
|
252
|
+
"default": None,
|
253
|
+
"extensions": {"color": None},
|
254
|
+
},
|
234
255
|
],
|
235
256
|
"output_variables": [{"id": "2a957315-fae0-4366-8a35-f0b315c5eade", "key": "count", "type": "NUMBER"}],
|
236
257
|
"concurrency": None,
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py
CHANGED
@@ -2,11 +2,12 @@ from unittest import mock
|
|
2
2
|
|
3
3
|
from deepdiff import DeepDiff
|
4
4
|
|
5
|
-
from tests.workflows.basic_merge_node.await_all_workflow import AwaitAllPassingWorkflow
|
6
5
|
from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
|
7
6
|
from vellum_ee.workflows.display.workflows import VellumWorkflowDisplay
|
8
7
|
from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
|
9
8
|
|
9
|
+
from tests.workflows.basic_merge_node.await_all_workflow import AwaitAllPassingWorkflow
|
10
|
+
|
10
11
|
|
11
12
|
def test_serialize_workflow__await_all():
|
12
13
|
# GIVEN a Workflow that uses an await all merge node
|
@@ -48,7 +48,7 @@ def test_serialize_workflow(vellum_client):
|
|
48
48
|
"type": "STRING",
|
49
49
|
"required": True,
|
50
50
|
"default": None,
|
51
|
-
"extensions": {
|
51
|
+
"extensions": {"color": None},
|
52
52
|
},
|
53
53
|
{
|
54
54
|
"id": "aa3ca842-250c-4a3f-853f-23928c28d0f8",
|
@@ -56,7 +56,7 @@ def test_serialize_workflow(vellum_client):
|
|
56
56
|
"type": "STRING",
|
57
57
|
"required": True,
|
58
58
|
"default": None,
|
59
|
-
"extensions": {
|
59
|
+
"extensions": {"color": None},
|
60
60
|
},
|
61
61
|
],
|
62
62
|
input_variables,
|
@@ -48,7 +48,7 @@ def test_serialize_workflow(vellum_client):
|
|
48
48
|
"type": "STRING",
|
49
49
|
"required": True,
|
50
50
|
"default": None,
|
51
|
-
"extensions": {
|
51
|
+
"extensions": {"color": None},
|
52
52
|
},
|
53
53
|
{
|
54
54
|
"id": "19a78824-9a98-4ae8-a1fc-61f81a422a17",
|
@@ -56,7 +56,7 @@ def test_serialize_workflow(vellum_client):
|
|
56
56
|
"type": "STRING",
|
57
57
|
"required": True,
|
58
58
|
"default": None,
|
59
|
-
"extensions": {
|
59
|
+
"extensions": {"color": None},
|
60
60
|
},
|
61
61
|
],
|
62
62
|
input_variables,
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py
CHANGED
@@ -2,11 +2,12 @@ from unittest import mock
|
|
2
2
|
|
3
3
|
from deepdiff import DeepDiff
|
4
4
|
|
5
|
-
from tests.workflows.basic_try_node.workflow import SimpleTryExample
|
6
5
|
from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
|
7
6
|
from vellum_ee.workflows.display.workflows import VellumWorkflowDisplay
|
8
7
|
from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
|
9
8
|
|
9
|
+
from tests.workflows.basic_try_node.workflow import SimpleTryExample
|
10
|
+
|
10
11
|
|
11
12
|
def test_serialize_workflow():
|
12
13
|
# GIVEN a Workflow with a TryNode
|
vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py
CHANGED
@@ -43,7 +43,7 @@ def test_serialize_workflow__missing_final_output_node():
|
|
43
43
|
"type": "STRING",
|
44
44
|
"required": True,
|
45
45
|
"default": None,
|
46
|
-
"extensions": {
|
46
|
+
"extensions": {"color": None},
|
47
47
|
},
|
48
48
|
{
|
49
49
|
"id": "a8b6c5d4-a0e9-4457-834b-46b633c466a6",
|
@@ -51,7 +51,7 @@ def test_serialize_workflow__missing_final_output_node():
|
|
51
51
|
"type": "STRING",
|
52
52
|
"required": True,
|
53
53
|
"default": None,
|
54
|
-
"extensions": {
|
54
|
+
"extensions": {"color": None},
|
55
55
|
},
|
56
56
|
],
|
57
57
|
input_variables,
|
@@ -1,6 +1,10 @@
|
|
1
1
|
from dataclasses import dataclass, field
|
2
2
|
from typing import TYPE_CHECKING, Dict, Generic, Tuple, Type, TypeVar
|
3
3
|
|
4
|
+
from vellum.workflows.descriptors.base import BaseDescriptor
|
5
|
+
from vellum.workflows.nodes import BaseNode
|
6
|
+
from vellum.workflows.ports import Port
|
7
|
+
from vellum.workflows.references import OutputReference, WorkflowInputReference
|
4
8
|
from vellum_ee.workflows.display.base import (
|
5
9
|
EdgeDisplayType,
|
6
10
|
EntrypointDisplayType,
|
@@ -9,10 +13,6 @@ from vellum_ee.workflows.display.base import (
|
|
9
13
|
WorkflowOutputDisplayType,
|
10
14
|
)
|
11
15
|
from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay, PortDisplay
|
12
|
-
from vellum.workflows.descriptors.base import BaseDescriptor
|
13
|
-
from vellum.workflows.nodes import BaseNode
|
14
|
-
from vellum.workflows.ports import Port
|
15
|
-
from vellum.workflows.references import OutputReference, WorkflowInputReference
|
16
16
|
|
17
17
|
if TYPE_CHECKING:
|
18
18
|
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
@@ -4,9 +4,7 @@ import typing
|
|
4
4
|
from typing import Any, List, Union, cast
|
5
5
|
|
6
6
|
from vellum import ChatMessage, SearchResult, SearchResultRequest, VellumVariableType
|
7
|
-
from vellum.client.types.array_vellum_value import ArrayVellumValue
|
8
7
|
from vellum.workflows.descriptors.base import BaseDescriptor
|
9
|
-
from vellum.workflows.nodes.core.map_node.node import MapNodeItemType
|
10
8
|
from vellum.workflows.references import OutputReference, WorkflowInputReference
|
11
9
|
from vellum.workflows.references.execution_count import ExecutionCountReference
|
12
10
|
from vellum.workflows.references.node import NodeReference
|
@@ -48,7 +46,7 @@ def infer_vellum_variable_type(value: Any) -> VellumVariableType:
|
|
48
46
|
f"Expected NodeReference {descriptor.name} to have an instance pointing to a descriptor"
|
49
47
|
)
|
50
48
|
descriptor = descriptor.instance
|
51
|
-
|
49
|
+
|
52
50
|
inferred_type = primitive_type_to_vellum_variable_type(descriptor)
|
53
51
|
else:
|
54
52
|
vellum_variable_value = primitive_to_vellum_value(value)
|
@@ -68,9 +66,7 @@ def create_node_input_value_pointer_rule(
|
|
68
66
|
)
|
69
67
|
if isinstance(value, WorkflowInputReference):
|
70
68
|
workflow_input_display = display_context.workflow_input_displays[value]
|
71
|
-
return InputVariablePointer(
|
72
|
-
data=InputVariableData(input_variable_id=str(workflow_input_display.id))
|
73
|
-
)
|
69
|
+
return InputVariablePointer(data=InputVariableData(input_variable_id=str(workflow_input_display.id)))
|
74
70
|
if isinstance(value, VellumSecretReference):
|
75
71
|
# TODO: Pass through the name instead of retrieving the ID
|
76
72
|
# https://app.shortcut.com/vellum/story/5072
|
@@ -24,4 +24,7 @@ def get_workflow_display(
|
|
24
24
|
except IndexError:
|
25
25
|
return base_display_class(workflow_class)
|
26
26
|
|
27
|
-
return workflow_display_class(
|
27
|
+
return workflow_display_class( # type: ignore[return-value]
|
28
|
+
workflow_class,
|
29
|
+
parent_display_context=parent_display_context,
|
30
|
+
)
|
@@ -57,7 +57,11 @@ class VellumWorkflowDisplay(
|
|
57
57
|
def serialize(self, raise_errors: bool = True) -> JsonObject:
|
58
58
|
input_variables: JsonArray = []
|
59
59
|
for workflow_input, workflow_input_display in self.display_context.workflow_input_displays.items():
|
60
|
-
default =
|
60
|
+
default = (
|
61
|
+
primitive_to_vellum_value(raise_if_descriptor(workflow_input.instance))
|
62
|
+
if workflow_input.instance
|
63
|
+
else None
|
64
|
+
)
|
61
65
|
required = type(None) not in workflow_input.types
|
62
66
|
|
63
67
|
input_variables.append(
|
@@ -67,7 +71,7 @@ class VellumWorkflowDisplay(
|
|
67
71
|
"type": infer_vellum_variable_type(workflow_input),
|
68
72
|
"default": default.dict() if default else None,
|
69
73
|
"required": required,
|
70
|
-
"extensions": {
|
74
|
+
"extensions": {"color": workflow_input_display.color},
|
71
75
|
}
|
72
76
|
)
|
73
77
|
|
vellum/workflows/runner/types.py
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
"""Only intenral types and enums for WorkflowRunner should be defined in this module."""
|
2
|
-
|
3
|
-
from dataclasses import dataclass
|
4
|
-
from typing import TYPE_CHECKING, Generic
|
5
|
-
|
6
|
-
from vellum.workflows.types.generics import StateType
|
7
|
-
|
8
|
-
if TYPE_CHECKING:
|
9
|
-
from vellum.workflows.events import NodeEvent
|
10
|
-
from vellum.workflows.nodes.bases import BaseNode
|
11
|
-
|
12
|
-
|
13
|
-
@dataclass(frozen=True)
|
14
|
-
class WorkItemEvent(Generic[StateType]):
|
15
|
-
node: "BaseNode[StateType]"
|
16
|
-
event: "NodeEvent"
|
File without changes
|
File without changes
|
File without changes
|