vellum-ai 0.14.72__py3-none-any.whl → 0.14.74__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 +8 -0
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/types/__init__.py +8 -0
- vellum/client/types/build_status_enum.py +5 -0
- vellum/client/types/container_image_build_config.py +20 -0
- vellum/client/types/container_image_read.py +4 -0
- vellum/client/types/execute_api_response.py +2 -2
- vellum/client/types/folder_entity.py +2 -0
- vellum/client/types/folder_entity_dataset.py +26 -0
- vellum/client/types/folder_entity_dataset_data.py +25 -0
- vellum/client/types/secret_type_enum.py +3 -1
- vellum/types/build_status_enum.py +3 -0
- vellum/types/container_image_build_config.py +3 -0
- vellum/types/folder_entity_dataset.py +3 -0
- vellum/types/folder_entity_dataset_data.py +3 -0
- vellum/workflows/nodes/core/retry_node/tests/test_node.py +1 -1
- vellum/workflows/nodes/displayable/api_node/node.py +2 -0
- vellum/workflows/nodes/displayable/api_node/tests/test_api_node.py +43 -0
- vellum/workflows/nodes/displayable/bases/api_node/node.py +6 -0
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +30 -4
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/tests/test_inline_prompt_node.py +43 -3
- vellum/workflows/nodes/displayable/bases/utils.py +2 -0
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +68 -58
- vellum/workflows/nodes/experimental/tool_calling_node/node.py +15 -11
- vellum/workflows/nodes/experimental/tool_calling_node/tests/__init__.py +0 -0
- vellum/workflows/nodes/experimental/tool_calling_node/tests/test_node.py +13 -0
- vellum/workflows/nodes/experimental/tool_calling_node/tests/test_utils.py +49 -0
- vellum/workflows/nodes/experimental/tool_calling_node/utils.py +78 -7
- vellum/workflows/ports/utils.py +26 -6
- vellum/workflows/runner/runner.py +35 -3
- vellum/workflows/state/encoder.py +2 -0
- vellum/workflows/types/core.py +12 -0
- vellum/workflows/types/definition.py +6 -0
- vellum/workflows/utils/functions.py +12 -12
- vellum/workflows/utils/pydantic_schema.py +38 -0
- vellum/workflows/utils/tests/test_functions.py +18 -18
- {vellum_ai-0.14.72.dist-info → vellum_ai-0.14.74.dist-info}/METADATA +1 -1
- {vellum_ai-0.14.72.dist-info → vellum_ai-0.14.74.dist-info}/RECORD +74 -61
- vellum_cli/push.py +6 -8
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +36 -7
- vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +8 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_prompt_node.py +102 -0
- vellum_ee/workflows/display/tests/test_base_workflow_display.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +91 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +5 -5
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +12 -12
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +10 -10
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_default_state_serialization.py +3 -3
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py +3 -3
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py +20 -9
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +3 -3
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_prompt_node_serialization.py +120 -3
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +8 -8
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +6 -6
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +3 -3
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +8 -8
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py +3 -3
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +4 -4
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py +3 -3
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_inline_workflow_serialization.py +12 -5
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_serialization.py +8 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_workflow_deployment_serialization.py +62 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +2 -2
- vellum_ee/workflows/display/utils/auto_layout.py +1 -1
- vellum_ee/workflows/display/utils/expressions.py +33 -2
- vellum_ee/workflows/display/workflows/base_workflow_display.py +199 -10
- vellum_ee/workflows/tests/test_display_meta.py +41 -0
- vellum_ee/workflows/tests/test_serialize_module.py +47 -0
- {vellum_ai-0.14.72.dist-info → vellum_ai-0.14.74.dist-info}/LICENSE +0 -0
- {vellum_ai-0.14.72.dist-info → vellum_ai-0.14.74.dist-info}/WHEEL +0 -0
- {vellum_ai-0.14.72.dist-info → vellum_ai-0.14.74.dist-info}/entry_points.txt +0 -0
@@ -63,7 +63,7 @@ def test_serialize_workflow():
|
|
63
63
|
"type": "ENTRYPOINT",
|
64
64
|
"inputs": [],
|
65
65
|
"data": {"label": "Entrypoint Node", "source_handle_id": "8294baa6-8bf4-4b54-a56b-407b64851b77"},
|
66
|
-
"display_data": {"position": {"x": 0.0, "y":
|
66
|
+
"display_data": {"position": {"x": 0.0, "y": -50.0}},
|
67
67
|
"base": None,
|
68
68
|
"definition": None,
|
69
69
|
}
|
@@ -153,7 +153,7 @@ def test_serialize_workflow():
|
|
153
153
|
},
|
154
154
|
"ml_model_name": "gpt-4o",
|
155
155
|
},
|
156
|
-
"display_data": {"position": {"x":
|
156
|
+
"display_data": {"position": {"x": 200.0, "y": -50.0}},
|
157
157
|
"base": {
|
158
158
|
"name": "InlinePromptNode",
|
159
159
|
"module": ["vellum", "workflows", "nodes", "displayable", "inline_prompt_node", "node"],
|
@@ -240,6 +240,27 @@ def test_serialize_workflow():
|
|
240
240
|
},
|
241
241
|
},
|
242
242
|
},
|
243
|
+
{
|
244
|
+
"id": "2b98319f-f43d-42d9-a8b0-b148d5de0a2c",
|
245
|
+
"name": "parameters",
|
246
|
+
"value": {
|
247
|
+
"type": "CONSTANT_VALUE",
|
248
|
+
"value": {
|
249
|
+
"type": "JSON",
|
250
|
+
"value": {
|
251
|
+
"stop": [],
|
252
|
+
"temperature": 0.0,
|
253
|
+
"max_tokens": 4096,
|
254
|
+
"top_p": 1.0,
|
255
|
+
"top_k": 0,
|
256
|
+
"frequency_penalty": 0.0,
|
257
|
+
"presence_penalty": 0.0,
|
258
|
+
"logit_bias": None,
|
259
|
+
"custom_parameters": None,
|
260
|
+
},
|
261
|
+
},
|
262
|
+
},
|
263
|
+
},
|
243
264
|
],
|
244
265
|
},
|
245
266
|
prompt_node,
|
@@ -277,7 +298,7 @@ def test_serialize_workflow():
|
|
277
298
|
},
|
278
299
|
}
|
279
300
|
],
|
280
|
-
"display_data": {"position": {"x":
|
301
|
+
"display_data": {"position": {"x": 400.0, "y": -50.0}},
|
281
302
|
"base": {
|
282
303
|
"name": "FinalOutputNode",
|
283
304
|
"module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
|
@@ -437,3 +458,99 @@ def test_serialize_workflow_with_descriptor_blocks():
|
|
437
458
|
},
|
438
459
|
}
|
439
460
|
]
|
461
|
+
|
462
|
+
|
463
|
+
def test_serialize_workflow_with_nested_descriptor_blocks():
|
464
|
+
"""Test that serialization handles BaseDescriptor instances nested in ChatMessageBlock.blocks."""
|
465
|
+
|
466
|
+
class TestInputs(BaseInputs):
|
467
|
+
noun: str
|
468
|
+
|
469
|
+
class UpstreamNode(BaseNode):
|
470
|
+
class Outputs(BaseNode.Outputs):
|
471
|
+
results: list
|
472
|
+
|
473
|
+
def run(self) -> Outputs:
|
474
|
+
return self.Outputs(results=["test"])
|
475
|
+
|
476
|
+
chat_block = ChatMessagePromptBlock(chat_role="SYSTEM", blocks=[JinjaPromptBlock(template="Hello")])
|
477
|
+
|
478
|
+
class TestInlinePromptNodeWithNestedDescriptorBlocks(InlinePromptNode):
|
479
|
+
ml_model = "gpt-4o"
|
480
|
+
blocks = [chat_block]
|
481
|
+
prompt_inputs = {"noun": TestInputs.noun}
|
482
|
+
|
483
|
+
object.__setattr__(chat_block, "blocks", [UpstreamNode.Outputs.results[0]])
|
484
|
+
|
485
|
+
class TestWorkflow(BaseWorkflow[TestInputs, BaseState]):
|
486
|
+
graph = UpstreamNode >> TestInlinePromptNodeWithNestedDescriptorBlocks
|
487
|
+
|
488
|
+
workflow_display = get_workflow_display(workflow_class=TestWorkflow)
|
489
|
+
serialized: dict = workflow_display.serialize()
|
490
|
+
|
491
|
+
prompt_nodes = [node for node in serialized["workflow_raw_data"]["nodes"] if node["type"] == "PROMPT"]
|
492
|
+
prompt_node = prompt_nodes[0]
|
493
|
+
|
494
|
+
blocks = prompt_node["data"]["exec_config"]["prompt_template_block_data"]["blocks"]
|
495
|
+
descriptor_blocks = [block for block in blocks if not isinstance(block, dict) or not block.get("block_type")]
|
496
|
+
assert len(descriptor_blocks) == 0, "BaseDescriptor blocks should not appear in serialized blocks"
|
497
|
+
|
498
|
+
blocks_attr = next((attr for attr in prompt_node["attributes"] if attr["name"] == "blocks"), None)
|
499
|
+
assert blocks_attr is not None, "blocks attribute should be present when blocks contain nested BaseDescriptor"
|
500
|
+
assert blocks_attr["value"]["type"] == "ARRAY_REFERENCE", "blocks attribute should be serialized as ARRAY_REFERENCE"
|
501
|
+
assert blocks_attr["value"]["items"] == [
|
502
|
+
{
|
503
|
+
"entries": [
|
504
|
+
{
|
505
|
+
"id": "24a203be-3cba-4b20-bc84-9993a476c120",
|
506
|
+
"key": "block_type",
|
507
|
+
"value": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "CHAT_MESSAGE"}},
|
508
|
+
},
|
509
|
+
{
|
510
|
+
"id": "c06269e6-f74c-4860-8fa5-22dcbdc89399",
|
511
|
+
"key": "state",
|
512
|
+
"value": {"type": "CONSTANT_VALUE", "value": {"type": "JSON", "value": None}},
|
513
|
+
},
|
514
|
+
{
|
515
|
+
"id": "dd9c0d43-b931-4dc8-8b3a-a7507ddff0c1",
|
516
|
+
"key": "cache_config",
|
517
|
+
"value": {"type": "CONSTANT_VALUE", "value": {"type": "JSON", "value": None}},
|
518
|
+
},
|
519
|
+
{
|
520
|
+
"id": "bef22f2b-0b6e-4910-88cc-6df736d2e20e",
|
521
|
+
"key": "chat_role",
|
522
|
+
"value": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "SYSTEM"}},
|
523
|
+
},
|
524
|
+
{
|
525
|
+
"id": "c0beec30-f85e-4a78-a3fb-baee54a692f8",
|
526
|
+
"key": "chat_source",
|
527
|
+
"value": {"type": "CONSTANT_VALUE", "value": {"type": "JSON", "value": None}},
|
528
|
+
},
|
529
|
+
{
|
530
|
+
"id": "f601f4f2-62fe-4697-9fe0-99ca8aa64500",
|
531
|
+
"key": "chat_message_unterminated",
|
532
|
+
"value": {"type": "CONSTANT_VALUE", "value": {"type": "JSON", "value": None}},
|
533
|
+
},
|
534
|
+
{
|
535
|
+
"id": "ad550008-64e3-44a3-a32a-84ec226db31c",
|
536
|
+
"key": "blocks",
|
537
|
+
"value": {
|
538
|
+
"items": [
|
539
|
+
{
|
540
|
+
"lhs": {
|
541
|
+
"node_id": "9fe5d3a3-7d26-4692-aa2d-e67c673b0c2b",
|
542
|
+
"node_output_id": "92f9a1b7-d33b-4f00-b4c2-e6f58150e166",
|
543
|
+
"type": "NODE_OUTPUT",
|
544
|
+
},
|
545
|
+
"operator": "accessField",
|
546
|
+
"rhs": {"type": "CONSTANT_VALUE", "value": {"type": "NUMBER", "value": 0.0}},
|
547
|
+
"type": "BINARY_EXPRESSION",
|
548
|
+
}
|
549
|
+
],
|
550
|
+
"type": "ARRAY_REFERENCE",
|
551
|
+
},
|
552
|
+
},
|
553
|
+
],
|
554
|
+
"type": "DICTIONARY_REFERENCE",
|
555
|
+
}
|
556
|
+
]
|
@@ -83,7 +83,7 @@ def test_serialize_workflow():
|
|
83
83
|
"source_handle_id": "c344fdee-282b-40c9-8c97-6dd08830948c",
|
84
84
|
},
|
85
85
|
"display_data": {
|
86
|
-
"position": {"x": 0.0, "y":
|
86
|
+
"position": {"x": 0.0, "y": -50.0},
|
87
87
|
},
|
88
88
|
}
|
89
89
|
|
@@ -123,7 +123,7 @@ def test_serialize_workflow():
|
|
123
123
|
"label": "Entrypoint Node",
|
124
124
|
"source_handle_id": "9914a6a0-9a99-430d-8ddd-f7c13847fe1a",
|
125
125
|
},
|
126
|
-
"display_data": {"position": {"x": 0.0, "y":
|
126
|
+
"display_data": {"position": {"x": 0.0, "y": -50.0}},
|
127
127
|
"base": None,
|
128
128
|
"definition": None,
|
129
129
|
},
|
@@ -131,7 +131,7 @@ def test_serialize_workflow():
|
|
131
131
|
"id": "1381c078-efa2-4255-89a1-7b4cb742c7fc",
|
132
132
|
"label": "StartNode",
|
133
133
|
"type": "GENERIC",
|
134
|
-
"display_data": {"position": {"x":
|
134
|
+
"display_data": {"position": {"x": 200.0, "y": -50.0}},
|
135
135
|
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
136
136
|
"definition": {
|
137
137
|
"name": "StartNode",
|
@@ -207,7 +207,7 @@ def test_serialize_workflow():
|
|
207
207
|
},
|
208
208
|
}
|
209
209
|
],
|
210
|
-
"display_data": {"position": {"x":
|
210
|
+
"display_data": {"position": {"x": 400.0, "y": 75.0}},
|
211
211
|
"base": {
|
212
212
|
"name": "FinalOutputNode",
|
213
213
|
"module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
|
@@ -243,7 +243,7 @@ def test_serialize_workflow():
|
|
243
243
|
},
|
244
244
|
}
|
245
245
|
],
|
246
|
-
"display_data": {"position": {"x":
|
246
|
+
"display_data": {"position": {"x": 400.0, "y": -175.0}},
|
247
247
|
"base": {
|
248
248
|
"name": "FinalOutputNode",
|
249
249
|
"module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
|
@@ -315,7 +315,7 @@ def test_serialize_workflow():
|
|
315
315
|
{"id": "fad5dd9f-3328-4e70-ad55-65a5325a4a82", "key": "reasoning", "type": "STRING"},
|
316
316
|
],
|
317
317
|
},
|
318
|
-
"display_data": {"position": {"x":
|
318
|
+
"display_data": {"position": {"x": 200.0, "y": -50.0}},
|
319
319
|
"base": {
|
320
320
|
"name": "InlineSubworkflowNode",
|
321
321
|
"module": ["vellum", "workflows", "nodes", "core", "inline_subworkflow_node", "node"],
|
@@ -366,7 +366,7 @@ def test_serialize_workflow():
|
|
366
366
|
},
|
367
367
|
}
|
368
368
|
],
|
369
|
-
"display_data": {"position": {"x":
|
369
|
+
"display_data": {"position": {"x": 400.0, "y": 75.0}},
|
370
370
|
"base": {
|
371
371
|
"name": "FinalOutputNode",
|
372
372
|
"module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
|
@@ -410,7 +410,7 @@ def test_serialize_workflow():
|
|
410
410
|
},
|
411
411
|
}
|
412
412
|
],
|
413
|
-
"display_data": {"position": {"x":
|
413
|
+
"display_data": {"position": {"x": 400.0, "y": -175.0}},
|
414
414
|
"base": {
|
415
415
|
"name": "FinalOutputNode",
|
416
416
|
"module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py
CHANGED
@@ -70,7 +70,7 @@ def test_serialize_workflow():
|
|
70
70
|
"base": None,
|
71
71
|
"definition": None,
|
72
72
|
"display_data": {
|
73
|
-
"position": {"x": 0.0, "y":
|
73
|
+
"position": {"x": 0.0, "y": -50.0},
|
74
74
|
},
|
75
75
|
}
|
76
76
|
|
@@ -110,7 +110,7 @@ def test_serialize_workflow():
|
|
110
110
|
"label": "Entrypoint Node",
|
111
111
|
"source_handle_id": "520d3616-8369-4e79-9da5-3febae299c2a",
|
112
112
|
},
|
113
|
-
"display_data": {"position": {"x": 0.0, "y":
|
113
|
+
"display_data": {"position": {"x": 0.0, "y": -50.0}},
|
114
114
|
"base": None,
|
115
115
|
"definition": None,
|
116
116
|
},
|
@@ -118,7 +118,7 @@ def test_serialize_workflow():
|
|
118
118
|
"id": "baf6d316-dc75-41e8-96c0-015aede96309",
|
119
119
|
"label": "Iteration",
|
120
120
|
"type": "GENERIC",
|
121
|
-
"display_data": {"position": {"x":
|
121
|
+
"display_data": {"position": {"x": 200.0, "y": -50.0}},
|
122
122
|
"base": {
|
123
123
|
"name": "BaseNode",
|
124
124
|
"module": ["vellum", "workflows", "nodes", "bases", "base"],
|
@@ -191,7 +191,7 @@ def test_serialize_workflow():
|
|
191
191
|
},
|
192
192
|
}
|
193
193
|
],
|
194
|
-
"display_data": {"position": {"x":
|
194
|
+
"display_data": {"position": {"x": 400.0, "y": -50.0}},
|
195
195
|
"base": {
|
196
196
|
"name": "FinalOutputNode",
|
197
197
|
"module": [
|
@@ -277,7 +277,7 @@ def test_serialize_workflow():
|
|
277
277
|
"item_input_id": "b29bb546-9bc8-4136-857d-8c7a464ba9d4",
|
278
278
|
"index_input_id": "17e7ca49-668f-450d-a792-e1f97d13db67",
|
279
279
|
},
|
280
|
-
"display_data": {"position": {"x":
|
280
|
+
"display_data": {"position": {"x": 200.0, "y": -50.0}},
|
281
281
|
"base": {
|
282
282
|
"name": "MapNode",
|
283
283
|
"module": ["vellum", "workflows", "nodes", "core", "map_node", "node"],
|
@@ -322,7 +322,7 @@ def test_serialize_workflow():
|
|
322
322
|
},
|
323
323
|
}
|
324
324
|
],
|
325
|
-
"display_data": {"position": {"x":
|
325
|
+
"display_data": {"position": {"x": 400.0, "y": -50.0}},
|
326
326
|
"base": {
|
327
327
|
"module": [
|
328
328
|
"vellum",
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py
CHANGED
@@ -52,7 +52,7 @@ def test_serialize_workflow__await_all():
|
|
52
52
|
"source_handle_id": "017d40f5-8326-4e42-a409-b08995defaa8",
|
53
53
|
},
|
54
54
|
"display_data": {
|
55
|
-
"position": {"x": 0.0, "y":
|
55
|
+
"position": {"x": 0.0, "y": -50.0},
|
56
56
|
},
|
57
57
|
}
|
58
58
|
|
@@ -74,7 +74,7 @@ def test_serialize_workflow__await_all():
|
|
74
74
|
],
|
75
75
|
"source_handle_id": "3bbc469f-0fb0-4b3d-a28b-746fefec2818",
|
76
76
|
},
|
77
|
-
"display_data": {"position": {"x":
|
77
|
+
"display_data": {"position": {"x": 400.0, "y": -50.0}},
|
78
78
|
"base": {
|
79
79
|
"module": ["vellum", "workflows", "nodes", "displayable", "merge_node", "node"],
|
80
80
|
"name": "MergeNode",
|
@@ -131,7 +131,7 @@ def test_serialize_workflow__await_all():
|
|
131
131
|
},
|
132
132
|
}
|
133
133
|
],
|
134
|
-
"display_data": {"position": {"x":
|
134
|
+
"display_data": {"position": {"x": 800.0, "y": -50.0}},
|
135
135
|
}
|
136
136
|
|
137
137
|
# AND each edge should be serialized correctly
|
@@ -93,7 +93,7 @@ def test_serialize_workflow(vellum_client):
|
|
93
93
|
"source_handle_id": "7065a943-1cab-4afd-9690-e678c5b74a2f",
|
94
94
|
},
|
95
95
|
"display_data": {
|
96
|
-
"position": {"x": 0.0, "y":
|
96
|
+
"position": {"x": 0.0, "y": -50.0},
|
97
97
|
},
|
98
98
|
}
|
99
99
|
|
@@ -141,7 +141,7 @@ def test_serialize_workflow(vellum_client):
|
|
141
141
|
"release_tag": "LATEST",
|
142
142
|
"ml_model_fallbacks": ["gpt-4o", "gemini-1.5-pro"],
|
143
143
|
},
|
144
|
-
"display_data": {"position": {"x":
|
144
|
+
"display_data": {"position": {"x": 200.0, "y": -50.0}},
|
145
145
|
"base": {
|
146
146
|
"name": "PromptDeploymentNode",
|
147
147
|
"module": ["vellum", "workflows", "nodes", "displayable", "prompt_deployment_node", "node"],
|
@@ -202,8 +202,8 @@ def test_serialize_workflow(vellum_client):
|
|
202
202
|
},
|
203
203
|
"display_data": {
|
204
204
|
"position": {
|
205
|
-
"x":
|
206
|
-
"y":
|
205
|
+
"x": 400.0,
|
206
|
+
"y": -50.0,
|
207
207
|
},
|
208
208
|
},
|
209
209
|
}
|
@@ -321,7 +321,7 @@ def test_serialize_workflow_with_prompt_and_templating(vellum_client):
|
|
321
321
|
"type": "ENTRYPOINT",
|
322
322
|
"inputs": [],
|
323
323
|
"data": {"label": "Entrypoint Node", "source_handle_id": "cc0f4028-1039-4063-971d-7dacbb01b379"},
|
324
|
-
"display_data": {"position": {"x": 0.0, "y":
|
324
|
+
"display_data": {"position": {"x": 0.0, "y": -50.0}},
|
325
325
|
"base": None,
|
326
326
|
"definition": None,
|
327
327
|
}
|
@@ -370,7 +370,7 @@ def test_serialize_workflow_with_prompt_and_templating(vellum_client):
|
|
370
370
|
"release_tag": "LATEST",
|
371
371
|
"ml_model_fallbacks": None,
|
372
372
|
},
|
373
|
-
"display_data": {"position": {"x":
|
373
|
+
"display_data": {"position": {"x": 200.0, "y": -50.0}},
|
374
374
|
"base": {
|
375
375
|
"name": "PromptDeploymentNode",
|
376
376
|
"module": ["vellum", "workflows", "nodes", "displayable", "prompt_deployment_node", "node"],
|
@@ -465,7 +465,7 @@ def test_serialize_workflow_with_prompt_and_templating(vellum_client):
|
|
465
465
|
"template_node_input_id": "7c775379-d589-4d79-b876-dcd224d72966",
|
466
466
|
"output_type": "STRING",
|
467
467
|
},
|
468
|
-
"display_data": {"position": {"x":
|
468
|
+
"display_data": {"position": {"x": 400.0, "y": -50.0}},
|
469
469
|
"base": {
|
470
470
|
"name": "TemplatingNode",
|
471
471
|
"module": ["vellum", "workflows", "nodes", "core", "templating_node", "node"],
|
@@ -512,7 +512,7 @@ def test_serialize_workflow_with_prompt_and_templating(vellum_client):
|
|
512
512
|
},
|
513
513
|
}
|
514
514
|
],
|
515
|
-
"display_data": {"position": {"x":
|
515
|
+
"display_data": {"position": {"x": 600.0, "y": -50.0}},
|
516
516
|
"base": {
|
517
517
|
"name": "FinalOutputNode",
|
518
518
|
"module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py
CHANGED
@@ -50,7 +50,7 @@ def test_serialize_workflow():
|
|
50
50
|
"type": "ENTRYPOINT",
|
51
51
|
"inputs": [],
|
52
52
|
"data": {"label": "Entrypoint Node", "source_handle_id": "df80b4aa-2ba1-49a2-8375-fb1f78eee31f"},
|
53
|
-
"display_data": {"position": {"x": 0.0, "y":
|
53
|
+
"display_data": {"position": {"x": 0.0, "y": -50.0}},
|
54
54
|
"base": None,
|
55
55
|
"definition": None,
|
56
56
|
}
|
@@ -229,7 +229,7 @@ def test_serialize_workflow():
|
|
229
229
|
"external_id_filters_node_input_id": "036dee8f-194a-4b92-9739-69c98a4aa1b9",
|
230
230
|
"metadata_filters_node_input_id": "855d3f57-e633-467e-a348-a394360247df",
|
231
231
|
},
|
232
|
-
"display_data": {"position": {"x":
|
232
|
+
"display_data": {"position": {"x": 200.0, "y": -50.0}},
|
233
233
|
"base": {
|
234
234
|
"name": "SearchNode",
|
235
235
|
"module": ["vellum", "workflows", "nodes", "displayable", "search_node", "node"],
|
@@ -271,7 +271,7 @@ def test_serialize_workflow():
|
|
271
271
|
},
|
272
272
|
}
|
273
273
|
],
|
274
|
-
"display_data": {"position": {"x":
|
274
|
+
"display_data": {"position": {"x": 400.0, "y": -50.0}},
|
275
275
|
"base": {
|
276
276
|
"name": "FinalOutputNode",
|
277
277
|
"module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
|
@@ -99,7 +99,7 @@ def test_serialize_workflow(vellum_client):
|
|
99
99
|
"source_handle_id": "13d9eb34-aecb-496d-9e57-d5e786b0bc7c",
|
100
100
|
},
|
101
101
|
"display_data": {
|
102
|
-
"position": {"x": 0.0, "y":
|
102
|
+
"position": {"x": 0.0, "y": -50.0},
|
103
103
|
},
|
104
104
|
}
|
105
105
|
|
@@ -144,7 +144,7 @@ def test_serialize_workflow(vellum_client):
|
|
144
144
|
"workflow_deployment_id": deployment.id,
|
145
145
|
"release_tag": "LATEST",
|
146
146
|
},
|
147
|
-
"display_data": {"position": {"x":
|
147
|
+
"display_data": {"position": {"x": 200.0, "y": -50.0}},
|
148
148
|
"base": {
|
149
149
|
"module": ["vellum", "workflows", "nodes", "displayable", "subworkflow_deployment_node", "node"],
|
150
150
|
"name": "SubworkflowDeploymentNode",
|
@@ -199,7 +199,7 @@ def test_serialize_workflow(vellum_client):
|
|
199
199
|
},
|
200
200
|
}
|
201
201
|
],
|
202
|
-
"display_data": {"position": {"x":
|
202
|
+
"display_data": {"position": {"x": 400.0, "y": -175.0}},
|
203
203
|
},
|
204
204
|
{
|
205
205
|
"id": "94afd0ac-1ec4-486b-a6fb-fa1ec7029d19",
|
@@ -242,7 +242,7 @@ def test_serialize_workflow(vellum_client):
|
|
242
242
|
},
|
243
243
|
}
|
244
244
|
],
|
245
|
-
"display_data": {"position": {"x":
|
245
|
+
"display_data": {"position": {"x": 400.0, "y": 75.0}},
|
246
246
|
},
|
247
247
|
],
|
248
248
|
workflow_raw_data["nodes"][2:],
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py
CHANGED
@@ -56,7 +56,7 @@ def test_serialize_workflow():
|
|
56
56
|
"type": "ENTRYPOINT",
|
57
57
|
"inputs": [],
|
58
58
|
"data": {"label": "Entrypoint Node", "source_handle_id": "34069190-0942-4e0c-8700-b33b9dea4ea0"},
|
59
|
-
"display_data": {"position": {"x": 0.0, "y":
|
59
|
+
"display_data": {"position": {"x": 0.0, "y": -50.0}},
|
60
60
|
"base": None,
|
61
61
|
"definition": None,
|
62
62
|
}
|
@@ -103,7 +103,7 @@ def test_serialize_workflow():
|
|
103
103
|
"template_node_input_id": "7c775379-d589-4d79-b876-dcd224d72966",
|
104
104
|
"output_type": "JSON",
|
105
105
|
},
|
106
|
-
"display_data": {"position": {"x":
|
106
|
+
"display_data": {"position": {"x": 200.0, "y": -50.0}},
|
107
107
|
"base": {
|
108
108
|
"name": "TemplatingNode",
|
109
109
|
"module": ["vellum", "workflows", "nodes", "core", "templating_node", "node"],
|
@@ -148,7 +148,7 @@ def test_serialize_workflow():
|
|
148
148
|
},
|
149
149
|
}
|
150
150
|
],
|
151
|
-
"display_data": {"position": {"x":
|
151
|
+
"display_data": {"position": {"x": 400.0, "y": -50.0}},
|
152
152
|
"base": {
|
153
153
|
"name": "FinalOutputNode",
|
154
154
|
"module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py
CHANGED
@@ -54,7 +54,7 @@ def test_serialize_workflow():
|
|
54
54
|
"type": "ENTRYPOINT",
|
55
55
|
"inputs": [],
|
56
56
|
"data": {"label": "Entrypoint Node", "source_handle_id": "8b8d52a2-844f-44fe-a6c4-142fa70d391b"},
|
57
|
-
"display_data": {"position": {"x": 0.0, "y":
|
57
|
+
"display_data": {"position": {"x": 0.0, "y": -50.0}},
|
58
58
|
"base": None,
|
59
59
|
"definition": None,
|
60
60
|
}
|
@@ -86,7 +86,7 @@ def test_serialize_workflow():
|
|
86
86
|
},
|
87
87
|
}
|
88
88
|
],
|
89
|
-
"display_data": {"position": {"x":
|
89
|
+
"display_data": {"position": {"x": 200.0, "y": -50.0}},
|
90
90
|
"base": {
|
91
91
|
"name": "FinalOutputNode",
|
92
92
|
"module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
|
@@ -43,7 +43,7 @@ def test_serialize_workflow():
|
|
43
43
|
"label": "GetCurrentWeatherNode",
|
44
44
|
"type": "GENERIC",
|
45
45
|
"display_data": {
|
46
|
-
"position": {"x":
|
46
|
+
"position": {"x": 200.0, "y": -50.0},
|
47
47
|
"comment": {"value": "\n A tool calling node that calls the get_current_weather function.\n "},
|
48
48
|
},
|
49
49
|
"base": {
|
@@ -131,6 +131,8 @@ def test_serialize_workflow():
|
|
131
131
|
"value": [
|
132
132
|
{
|
133
133
|
"type": "INLINE_WORKFLOW",
|
134
|
+
"name": "BasicInlineSubworkflowWorkflow",
|
135
|
+
"description": "\n A workflow that gets the weather for a given city and date.\n ", # noqa: E501
|
134
136
|
"exec_config": {
|
135
137
|
"workflow_raw_data": {
|
136
138
|
"nodes": [
|
@@ -142,7 +144,7 @@ def test_serialize_workflow():
|
|
142
144
|
"label": "Entrypoint Node",
|
143
145
|
"source_handle_id": "c344fdee-282b-40c9-8c97-6dd08830948c",
|
144
146
|
},
|
145
|
-
"display_data": {"position": {"x": 0.0, "y":
|
147
|
+
"display_data": {"position": {"x": 0.0, "y": -50.0}},
|
146
148
|
"base": None,
|
147
149
|
"definition": None,
|
148
150
|
},
|
@@ -150,7 +152,7 @@ def test_serialize_workflow():
|
|
150
152
|
"id": "1381c078-efa2-4255-89a1-7b4cb742c7fc",
|
151
153
|
"label": "StartNode",
|
152
154
|
"type": "GENERIC",
|
153
|
-
"display_data": {"position": {"x":
|
155
|
+
"display_data": {"position": {"x": 200.0, "y": -50.0}},
|
154
156
|
"base": {
|
155
157
|
"name": "BaseNode",
|
156
158
|
"module": ["vellum", "workflows", "nodes", "bases", "base"],
|
@@ -238,7 +240,7 @@ def test_serialize_workflow():
|
|
238
240
|
},
|
239
241
|
}
|
240
242
|
],
|
241
|
-
"display_data": {"position": {"x":
|
243
|
+
"display_data": {"position": {"x": 400.0, "y": -175.0}},
|
242
244
|
"base": {
|
243
245
|
"name": "FinalOutputNode",
|
244
246
|
"module": [
|
@@ -281,7 +283,7 @@ def test_serialize_workflow():
|
|
281
283
|
},
|
282
284
|
}
|
283
285
|
],
|
284
|
-
"display_data": {"position": {"x":
|
286
|
+
"display_data": {"position": {"x": 400.0, "y": 75.0}},
|
285
287
|
"base": {
|
286
288
|
"name": "FinalOutputNode",
|
287
289
|
"module": [
|
@@ -410,6 +412,11 @@ def test_serialize_workflow():
|
|
410
412
|
"name": "function_configs",
|
411
413
|
"value": {"type": "CONSTANT_VALUE", "value": {"type": "JSON", "value": None}},
|
412
414
|
},
|
415
|
+
{
|
416
|
+
"id": "1668419e-a193-43a5-8a97-3394e89bf278",
|
417
|
+
"name": "max_prompt_iterations",
|
418
|
+
"value": {"type": "CONSTANT_VALUE", "value": {"type": "NUMBER", "value": 5.0}},
|
419
|
+
},
|
413
420
|
],
|
414
421
|
"outputs": [
|
415
422
|
{"id": "e62bc785-a914-4066-b79e-8c89a5d0ec6c", "name": "text", "type": "STRING", "value": None},
|
@@ -43,7 +43,7 @@ def test_serialize_workflow():
|
|
43
43
|
"label": "GetCurrentWeatherNode",
|
44
44
|
"type": "GENERIC",
|
45
45
|
"display_data": {
|
46
|
-
"position": {"x":
|
46
|
+
"position": {"x": 200.0, "y": -50.0},
|
47
47
|
"comment": {"value": "\n A tool calling node that calls the get_current_weather function.\n "},
|
48
48
|
},
|
49
49
|
"base": {
|
@@ -131,6 +131,8 @@ def test_serialize_workflow():
|
|
131
131
|
"value": [
|
132
132
|
{
|
133
133
|
"type": "CODE_EXECUTION",
|
134
|
+
"name": "get_current_weather",
|
135
|
+
"description": "\n Get the current weather in a given location.\n ",
|
134
136
|
"definition": {
|
135
137
|
"state": None,
|
136
138
|
"cache_config": None,
|
@@ -183,6 +185,11 @@ def test_serialize_workflow():
|
|
183
185
|
],
|
184
186
|
},
|
185
187
|
},
|
188
|
+
{
|
189
|
+
"id": "1668419e-a193-43a5-8a97-3394e89bf278",
|
190
|
+
"name": "max_prompt_iterations",
|
191
|
+
"value": {"type": "CONSTANT_VALUE", "value": {"type": "NUMBER", "value": 5.0}},
|
192
|
+
},
|
186
193
|
],
|
187
194
|
"outputs": [
|
188
195
|
{"id": "e62bc785-a914-4066-b79e-8c89a5d0ec6c", "name": "text", "type": "STRING", "value": None},
|
@@ -0,0 +1,62 @@
|
|
1
|
+
from deepdiff import DeepDiff
|
2
|
+
|
3
|
+
from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
|
4
|
+
|
5
|
+
from tests.workflows.basic_tool_calling_node_workflow_deployment.workflow import (
|
6
|
+
BasicToolCallingNodeWorkflowDeploymentWorkflow,
|
7
|
+
)
|
8
|
+
|
9
|
+
|
10
|
+
def test_serialize_workflow():
|
11
|
+
# GIVEN a Workflow that uses a generic node
|
12
|
+
# WHEN we serialize it
|
13
|
+
workflow_display = get_workflow_display(workflow_class=BasicToolCallingNodeWorkflowDeploymentWorkflow)
|
14
|
+
|
15
|
+
serialized_workflow: dict = workflow_display.serialize()
|
16
|
+
# THEN we should get a serialized representation of the Workflow
|
17
|
+
assert serialized_workflow.keys() == {
|
18
|
+
"workflow_raw_data",
|
19
|
+
"input_variables",
|
20
|
+
"state_variables",
|
21
|
+
"output_variables",
|
22
|
+
}
|
23
|
+
|
24
|
+
# AND its input variables should be what we expect
|
25
|
+
input_variables = serialized_workflow["input_variables"]
|
26
|
+
assert len(input_variables) == 1
|
27
|
+
|
28
|
+
# AND its output variables should be what we expect
|
29
|
+
output_variables = serialized_workflow["output_variables"]
|
30
|
+
assert len(output_variables) == 2
|
31
|
+
assert not DeepDiff(
|
32
|
+
[
|
33
|
+
{"id": "3626cfa6-76f8-465e-b156-c809e3a2cee9", "key": "text", "type": "STRING"},
|
34
|
+
{"id": "cb82117a-d649-4c3e-9342-c552028fa2ad", "key": "chat_history", "type": "CHAT_HISTORY"},
|
35
|
+
],
|
36
|
+
output_variables,
|
37
|
+
ignore_order=True,
|
38
|
+
)
|
39
|
+
|
40
|
+
# AND its raw data should be what we expect
|
41
|
+
workflow_raw_data = serialized_workflow["workflow_raw_data"]
|
42
|
+
tool_calling_node = workflow_raw_data["nodes"][1]
|
43
|
+
function_attributes = next(attr for attr in tool_calling_node["attributes"] if attr["name"] == "functions")
|
44
|
+
assert function_attributes == {
|
45
|
+
"id": "73a94e3c-1935-4308-a68a-ecd5441804b7",
|
46
|
+
"name": "functions",
|
47
|
+
"value": {
|
48
|
+
"type": "CONSTANT_VALUE",
|
49
|
+
"value": {
|
50
|
+
"type": "JSON",
|
51
|
+
"value": [
|
52
|
+
{
|
53
|
+
"type": "WORKFLOW_DEPLOYMENT",
|
54
|
+
"name": "deployment_1",
|
55
|
+
"description": "Workflow deployment for deployment_1",
|
56
|
+
"deployment": "deployment_1",
|
57
|
+
"release_tag": "LATEST",
|
58
|
+
}
|
59
|
+
],
|
60
|
+
},
|
61
|
+
},
|
62
|
+
}
|