vellum-ai 0.9.16rc2__py3-none-any.whl → 0.9.16rc4__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/plugins/__init__.py +0 -0
- vellum/plugins/pydantic.py +74 -0
- vellum/plugins/utils.py +19 -0
- vellum/plugins/vellum_mypy.py +639 -3
- vellum/workflows/README.md +90 -0
- vellum/workflows/__init__.py +5 -0
- vellum/workflows/constants.py +43 -0
- vellum/workflows/descriptors/__init__.py +0 -0
- vellum/workflows/descriptors/base.py +339 -0
- vellum/workflows/descriptors/tests/test_utils.py +83 -0
- vellum/workflows/descriptors/utils.py +90 -0
- vellum/workflows/edges/__init__.py +5 -0
- vellum/workflows/edges/edge.py +23 -0
- vellum/workflows/emitters/__init__.py +5 -0
- vellum/workflows/emitters/base.py +14 -0
- vellum/workflows/environment/__init__.py +5 -0
- vellum/workflows/environment/environment.py +7 -0
- vellum/workflows/errors/__init__.py +6 -0
- vellum/workflows/errors/types.py +20 -0
- vellum/workflows/events/__init__.py +31 -0
- vellum/workflows/events/node.py +125 -0
- vellum/workflows/events/tests/__init__.py +0 -0
- vellum/workflows/events/tests/test_event.py +216 -0
- vellum/workflows/events/types.py +52 -0
- vellum/workflows/events/utils.py +5 -0
- vellum/workflows/events/workflow.py +139 -0
- vellum/workflows/exceptions.py +15 -0
- vellum/workflows/expressions/__init__.py +0 -0
- vellum/workflows/expressions/accessor.py +52 -0
- vellum/workflows/expressions/and_.py +32 -0
- vellum/workflows/expressions/begins_with.py +31 -0
- vellum/workflows/expressions/between.py +38 -0
- vellum/workflows/expressions/coalesce_expression.py +41 -0
- vellum/workflows/expressions/contains.py +30 -0
- vellum/workflows/expressions/does_not_begin_with.py +31 -0
- vellum/workflows/expressions/does_not_contain.py +30 -0
- vellum/workflows/expressions/does_not_end_with.py +31 -0
- vellum/workflows/expressions/does_not_equal.py +25 -0
- vellum/workflows/expressions/ends_with.py +31 -0
- vellum/workflows/expressions/equals.py +25 -0
- vellum/workflows/expressions/greater_than.py +33 -0
- vellum/workflows/expressions/greater_than_or_equal_to.py +33 -0
- vellum/workflows/expressions/in_.py +31 -0
- vellum/workflows/expressions/is_blank.py +24 -0
- vellum/workflows/expressions/is_not_blank.py +24 -0
- vellum/workflows/expressions/is_not_null.py +21 -0
- vellum/workflows/expressions/is_not_undefined.py +22 -0
- vellum/workflows/expressions/is_null.py +21 -0
- vellum/workflows/expressions/is_undefined.py +22 -0
- vellum/workflows/expressions/less_than.py +33 -0
- vellum/workflows/expressions/less_than_or_equal_to.py +33 -0
- vellum/workflows/expressions/not_between.py +38 -0
- vellum/workflows/expressions/not_in.py +31 -0
- vellum/workflows/expressions/or_.py +32 -0
- vellum/workflows/graph/__init__.py +3 -0
- vellum/workflows/graph/graph.py +131 -0
- vellum/workflows/graph/tests/__init__.py +0 -0
- vellum/workflows/graph/tests/test_graph.py +437 -0
- vellum/workflows/inputs/__init__.py +5 -0
- vellum/workflows/inputs/base.py +55 -0
- vellum/workflows/logging.py +14 -0
- vellum/workflows/nodes/__init__.py +46 -0
- vellum/workflows/nodes/bases/__init__.py +7 -0
- vellum/workflows/nodes/bases/base.py +332 -0
- vellum/workflows/nodes/bases/base_subworkflow_node/__init__.py +5 -0
- vellum/workflows/nodes/bases/base_subworkflow_node/node.py +10 -0
- vellum/workflows/nodes/bases/tests/__init__.py +0 -0
- vellum/workflows/nodes/bases/tests/test_base_node.py +125 -0
- vellum/workflows/nodes/core/__init__.py +16 -0
- vellum/workflows/nodes/core/error_node/__init__.py +5 -0
- vellum/workflows/nodes/core/error_node/node.py +26 -0
- vellum/workflows/nodes/core/inline_subworkflow_node/__init__.py +5 -0
- vellum/workflows/nodes/core/inline_subworkflow_node/node.py +73 -0
- vellum/workflows/nodes/core/map_node/__init__.py +5 -0
- vellum/workflows/nodes/core/map_node/node.py +147 -0
- vellum/workflows/nodes/core/map_node/tests/__init__.py +0 -0
- vellum/workflows/nodes/core/map_node/tests/test_node.py +65 -0
- vellum/workflows/nodes/core/retry_node/__init__.py +5 -0
- vellum/workflows/nodes/core/retry_node/node.py +106 -0
- vellum/workflows/nodes/core/retry_node/tests/__init__.py +0 -0
- vellum/workflows/nodes/core/retry_node/tests/test_node.py +93 -0
- vellum/workflows/nodes/core/templating_node/__init__.py +5 -0
- vellum/workflows/nodes/core/templating_node/custom_filters.py +12 -0
- vellum/workflows/nodes/core/templating_node/exceptions.py +2 -0
- vellum/workflows/nodes/core/templating_node/node.py +123 -0
- vellum/workflows/nodes/core/templating_node/render.py +55 -0
- vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py +21 -0
- vellum/workflows/nodes/core/try_node/__init__.py +5 -0
- vellum/workflows/nodes/core/try_node/node.py +110 -0
- vellum/workflows/nodes/core/try_node/tests/__init__.py +0 -0
- vellum/workflows/nodes/core/try_node/tests/test_node.py +82 -0
- vellum/workflows/nodes/displayable/__init__.py +31 -0
- vellum/workflows/nodes/displayable/api_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/api_node/node.py +44 -0
- vellum/workflows/nodes/displayable/bases/__init__.py +11 -0
- vellum/workflows/nodes/displayable/bases/api_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/bases/api_node/node.py +70 -0
- vellum/workflows/nodes/displayable/bases/base_prompt_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +60 -0
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/constants.py +13 -0
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +118 -0
- vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +98 -0
- vellum/workflows/nodes/displayable/bases/search_node.py +90 -0
- vellum/workflows/nodes/displayable/code_execution_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/code_execution_node/node.py +197 -0
- vellum/workflows/nodes/displayable/code_execution_node/tests/__init__.py +0 -0
- vellum/workflows/nodes/displayable/code_execution_node/tests/fixtures/__init__.py +0 -0
- vellum/workflows/nodes/displayable/code_execution_node/tests/fixtures/main.py +3 -0
- vellum/workflows/nodes/displayable/code_execution_node/tests/test_code_execution_node.py +111 -0
- vellum/workflows/nodes/displayable/code_execution_node/utils.py +10 -0
- vellum/workflows/nodes/displayable/conditional_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/conditional_node/node.py +25 -0
- vellum/workflows/nodes/displayable/final_output_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/final_output_node/node.py +43 -0
- vellum/workflows/nodes/displayable/guardrail_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/guardrail_node/node.py +97 -0
- vellum/workflows/nodes/displayable/inline_prompt_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/inline_prompt_node/node.py +41 -0
- vellum/workflows/nodes/displayable/merge_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/merge_node/node.py +10 -0
- vellum/workflows/nodes/displayable/prompt_deployment_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/prompt_deployment_node/node.py +45 -0
- vellum/workflows/nodes/displayable/search_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/search_node/node.py +26 -0
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +156 -0
- vellum/workflows/nodes/displayable/tests/__init__.py +0 -0
- vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +148 -0
- vellum/workflows/nodes/displayable/tests/test_search_node_wth_text_output.py +134 -0
- vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +80 -0
- vellum/workflows/nodes/utils.py +27 -0
- vellum/workflows/outputs/__init__.py +6 -0
- vellum/workflows/outputs/base.py +196 -0
- vellum/workflows/ports/__init__.py +7 -0
- vellum/workflows/ports/node_ports.py +75 -0
- vellum/workflows/ports/port.py +75 -0
- vellum/workflows/ports/utils.py +40 -0
- vellum/workflows/references/__init__.py +17 -0
- vellum/workflows/references/environment_variable.py +20 -0
- vellum/workflows/references/execution_count.py +20 -0
- vellum/workflows/references/external_input.py +49 -0
- vellum/workflows/references/input.py +7 -0
- vellum/workflows/references/lazy.py +55 -0
- vellum/workflows/references/node.py +43 -0
- vellum/workflows/references/output.py +78 -0
- vellum/workflows/references/state_value.py +23 -0
- vellum/workflows/references/vellum_secret.py +15 -0
- vellum/workflows/references/workflow_input.py +41 -0
- vellum/workflows/resolvers/__init__.py +5 -0
- vellum/workflows/resolvers/base.py +15 -0
- vellum/workflows/runner/__init__.py +5 -0
- vellum/workflows/runner/runner.py +588 -0
- vellum/workflows/runner/types.py +18 -0
- vellum/workflows/state/__init__.py +5 -0
- vellum/workflows/state/base.py +327 -0
- vellum/workflows/state/context.py +18 -0
- vellum/workflows/state/encoder.py +57 -0
- vellum/workflows/state/store.py +28 -0
- vellum/workflows/state/tests/__init__.py +0 -0
- vellum/workflows/state/tests/test_state.py +113 -0
- vellum/workflows/types/__init__.py +0 -0
- vellum/workflows/types/core.py +91 -0
- vellum/workflows/types/generics.py +14 -0
- vellum/workflows/types/stack.py +39 -0
- vellum/workflows/types/tests/__init__.py +0 -0
- vellum/workflows/types/tests/test_utils.py +76 -0
- vellum/workflows/types/utils.py +164 -0
- vellum/workflows/utils/__init__.py +0 -0
- vellum/workflows/utils/names.py +13 -0
- vellum/workflows/utils/tests/__init__.py +0 -0
- vellum/workflows/utils/tests/test_names.py +15 -0
- vellum/workflows/utils/tests/test_vellum_variables.py +25 -0
- vellum/workflows/utils/vellum_variables.py +81 -0
- vellum/workflows/vellum_client.py +18 -0
- vellum/workflows/workflows/__init__.py +5 -0
- vellum/workflows/workflows/base.py +365 -0
- {vellum_ai-0.9.16rc2.dist-info → vellum_ai-0.9.16rc4.dist-info}/METADATA +2 -1
- {vellum_ai-0.9.16rc2.dist-info → vellum_ai-0.9.16rc4.dist-info}/RECORD +245 -7
- vellum_cli/__init__.py +72 -0
- vellum_cli/aliased_group.py +103 -0
- vellum_cli/config.py +96 -0
- vellum_cli/image_push.py +112 -0
- vellum_cli/logger.py +36 -0
- vellum_cli/pull.py +73 -0
- vellum_cli/push.py +121 -0
- vellum_cli/tests/test_config.py +100 -0
- vellum_cli/tests/test_pull.py +152 -0
- vellum_ee/workflows/__init__.py +0 -0
- vellum_ee/workflows/display/__init__.py +0 -0
- vellum_ee/workflows/display/base.py +73 -0
- vellum_ee/workflows/display/nodes/__init__.py +4 -0
- vellum_ee/workflows/display/nodes/base_node_display.py +116 -0
- vellum_ee/workflows/display/nodes/base_node_vellum_display.py +36 -0
- vellum_ee/workflows/display/nodes/get_node_display_class.py +25 -0
- vellum_ee/workflows/display/nodes/tests/__init__.py +0 -0
- vellum_ee/workflows/display/nodes/tests/test_base_node_display.py +47 -0
- vellum_ee/workflows/display/nodes/types.py +18 -0
- vellum_ee/workflows/display/nodes/utils.py +33 -0
- vellum_ee/workflows/display/nodes/vellum/__init__.py +32 -0
- vellum_ee/workflows/display/nodes/vellum/api_node.py +205 -0
- vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +71 -0
- vellum_ee/workflows/display/nodes/vellum/conditional_node.py +217 -0
- vellum_ee/workflows/display/nodes/vellum/final_output_node.py +61 -0
- vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +49 -0
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +170 -0
- vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +99 -0
- vellum_ee/workflows/display/nodes/vellum/map_node.py +100 -0
- vellum_ee/workflows/display/nodes/vellum/merge_node.py +48 -0
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +68 -0
- vellum_ee/workflows/display/nodes/vellum/search_node.py +193 -0
- vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +58 -0
- vellum_ee/workflows/display/nodes/vellum/templating_node.py +67 -0
- vellum_ee/workflows/display/nodes/vellum/tests/__init__.py +0 -0
- vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +106 -0
- vellum_ee/workflows/display/nodes/vellum/try_node.py +38 -0
- vellum_ee/workflows/display/nodes/vellum/utils.py +76 -0
- vellum_ee/workflows/display/tests/__init__.py +0 -0
- vellum_ee/workflows/display/tests/workflow_serialization/__init__.py +0 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +426 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +607 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +1175 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +235 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +511 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +372 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +272 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +289 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +354 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +123 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +84 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +233 -0
- vellum_ee/workflows/display/types.py +46 -0
- vellum_ee/workflows/display/utils/__init__.py +0 -0
- vellum_ee/workflows/display/utils/tests/__init__.py +0 -0
- vellum_ee/workflows/display/utils/tests/test_uuids.py +16 -0
- vellum_ee/workflows/display/utils/uuids.py +24 -0
- vellum_ee/workflows/display/utils/vellum.py +121 -0
- vellum_ee/workflows/display/vellum.py +357 -0
- vellum_ee/workflows/display/workflows/__init__.py +5 -0
- vellum_ee/workflows/display/workflows/base_workflow_display.py +302 -0
- vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py +32 -0
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +386 -0
- {vellum_ai-0.9.16rc2.dist-info → vellum_ai-0.9.16rc4.dist-info}/LICENSE +0 -0
- {vellum_ai-0.9.16rc2.dist-info → vellum_ai-0.9.16rc4.dist-info}/WHEEL +0 -0
- {vellum_ai-0.9.16rc2.dist-info → vellum_ai-0.9.16rc4.dist-info}/entry_points.txt +0 -0
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py
ADDED
@@ -0,0 +1,235 @@
|
|
1
|
+
from deepdiff import DeepDiff
|
2
|
+
|
3
|
+
from tests.workflows.basic_guardrail_node.workflow import BasicGuardrailNodeWorkflow
|
4
|
+
from vellum_ee.workflows.display.workflows import VellumWorkflowDisplay
|
5
|
+
from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
|
6
|
+
|
7
|
+
|
8
|
+
def test_serialize_workflow():
|
9
|
+
# GIVEN a workflow that uses a guardrail node
|
10
|
+
# WHEN we serialize it
|
11
|
+
workflow_display = get_workflow_display(
|
12
|
+
base_display_class=VellumWorkflowDisplay, workflow_class=BasicGuardrailNodeWorkflow
|
13
|
+
)
|
14
|
+
|
15
|
+
serialized_workflow: dict = workflow_display.serialize()
|
16
|
+
|
17
|
+
# THEN we should get a serialized representation of the workflow
|
18
|
+
assert serialized_workflow.keys() == {"workflow_raw_data", "input_variables", "output_variables"}
|
19
|
+
|
20
|
+
# AND its input variables should be what we expect
|
21
|
+
input_variables = serialized_workflow["input_variables"]
|
22
|
+
assert len(input_variables) == 2
|
23
|
+
assert not DeepDiff(
|
24
|
+
[
|
25
|
+
{
|
26
|
+
"id": "eb1b1913-9fb8-4b8c-8901-09d9b9edc1c3",
|
27
|
+
"key": "actual",
|
28
|
+
"type": "STRING",
|
29
|
+
"required": None,
|
30
|
+
"default": None,
|
31
|
+
"extensions": None,
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"id": "545ff95e-e86f-4d06-a991-602781e72605",
|
35
|
+
"key": "expected",
|
36
|
+
"type": "STRING",
|
37
|
+
"required": None,
|
38
|
+
"default": None,
|
39
|
+
"extensions": None,
|
40
|
+
},
|
41
|
+
],
|
42
|
+
input_variables,
|
43
|
+
ignore_order=True,
|
44
|
+
)
|
45
|
+
|
46
|
+
# AND its output variables should be what we expect
|
47
|
+
output_variables = serialized_workflow["output_variables"]
|
48
|
+
assert len(output_variables) == 1
|
49
|
+
assert output_variables == [{"id": "2abd2b3b-c301-4834-a43f-5db3604f8422", "key": "score", "type": "NUMBER"}]
|
50
|
+
|
51
|
+
# AND its raw data is what we expect
|
52
|
+
workflow_raw_data = serialized_workflow["workflow_raw_data"]
|
53
|
+
assert workflow_raw_data.keys() == {"nodes", "edges", "display_data", "definition"}
|
54
|
+
assert len(workflow_raw_data["nodes"]) == 3
|
55
|
+
assert len(workflow_raw_data["edges"]) == 2
|
56
|
+
|
57
|
+
# AND each node should be serialized correctly
|
58
|
+
entrypoint_node = workflow_raw_data["nodes"][0]
|
59
|
+
assert entrypoint_node == {
|
60
|
+
"id": "54c5c7d0-ab86-4ae9-b0b8-ea9ca7b87c14",
|
61
|
+
"type": "ENTRYPOINT",
|
62
|
+
"definition": {
|
63
|
+
"bases": [],
|
64
|
+
"module": [
|
65
|
+
"vellum",
|
66
|
+
"workflows",
|
67
|
+
"nodes",
|
68
|
+
"bases",
|
69
|
+
"base",
|
70
|
+
],
|
71
|
+
"name": "BaseNode",
|
72
|
+
},
|
73
|
+
"inputs": [],
|
74
|
+
"data": {"label": "Entrypoint Node", "source_handle_id": "41840690-8d85-486e-a864-b0661ccf0f2e"},
|
75
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
76
|
+
}
|
77
|
+
|
78
|
+
guardrail_node = workflow_raw_data["nodes"][1]
|
79
|
+
assert guardrail_node == {
|
80
|
+
"id": "5573f078-cced-48f3-bafd-782d48e260c7",
|
81
|
+
"type": "METRIC",
|
82
|
+
"inputs": [
|
83
|
+
{
|
84
|
+
"id": "3ec00ee3-c068-4d41-9488-87b7778a649e",
|
85
|
+
"key": "expected",
|
86
|
+
"value": {
|
87
|
+
"rules": [
|
88
|
+
{
|
89
|
+
"type": "INPUT_VARIABLE",
|
90
|
+
"data": {"input_variable_id": "545ff95e-e86f-4d06-a991-602781e72605"},
|
91
|
+
}
|
92
|
+
],
|
93
|
+
"combinator": "OR",
|
94
|
+
},
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"id": "a43ce7ba-1685-4977-a34d-65580c42853f",
|
98
|
+
"key": "actual",
|
99
|
+
"value": {
|
100
|
+
"rules": [
|
101
|
+
{
|
102
|
+
"type": "INPUT_VARIABLE",
|
103
|
+
"data": {"input_variable_id": "eb1b1913-9fb8-4b8c-8901-09d9b9edc1c3"},
|
104
|
+
}
|
105
|
+
],
|
106
|
+
"combinator": "OR",
|
107
|
+
},
|
108
|
+
},
|
109
|
+
],
|
110
|
+
"data": {
|
111
|
+
"label": "Example Guardrail Node",
|
112
|
+
"source_handle_id": "0ed87407-697e-4ae9-ab9b-6c5cc2e57cf7",
|
113
|
+
"target_handle_id": "ce5b85b1-eded-46dd-b4b7-020afcdc67ab",
|
114
|
+
"error_output_id": None,
|
115
|
+
"metric_definition_id": "example_metric_definition",
|
116
|
+
"release_tag": "LATEST",
|
117
|
+
},
|
118
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
119
|
+
"definition": {
|
120
|
+
"bases": [
|
121
|
+
{
|
122
|
+
"module": [
|
123
|
+
"vellum",
|
124
|
+
"workflows",
|
125
|
+
"nodes",
|
126
|
+
"displayable",
|
127
|
+
"guardrail_node",
|
128
|
+
"node",
|
129
|
+
],
|
130
|
+
"name": "GuardrailNode",
|
131
|
+
}
|
132
|
+
],
|
133
|
+
"module": [
|
134
|
+
"tests",
|
135
|
+
"workflows",
|
136
|
+
"basic_guardrail_node",
|
137
|
+
"workflow",
|
138
|
+
],
|
139
|
+
"name": "ExampleGuardrailNode",
|
140
|
+
},
|
141
|
+
}
|
142
|
+
|
143
|
+
final_output_node = workflow_raw_data["nodes"][2]
|
144
|
+
assert final_output_node == {
|
145
|
+
"id": "cbc7197e-67c9-4af5-b781-879c8fd3e4c9",
|
146
|
+
"type": "TERMINAL",
|
147
|
+
"definition": {
|
148
|
+
"bases": [
|
149
|
+
{
|
150
|
+
"bases": [],
|
151
|
+
"module": [
|
152
|
+
"vellum",
|
153
|
+
"workflows",
|
154
|
+
"nodes",
|
155
|
+
"bases",
|
156
|
+
"base",
|
157
|
+
],
|
158
|
+
"name": "BaseNode",
|
159
|
+
},
|
160
|
+
],
|
161
|
+
"module": [
|
162
|
+
"vellum",
|
163
|
+
"workflows",
|
164
|
+
"nodes",
|
165
|
+
"displayable",
|
166
|
+
"final_output_node",
|
167
|
+
"node",
|
168
|
+
],
|
169
|
+
"name": "FinalOutputNode",
|
170
|
+
},
|
171
|
+
"data": {
|
172
|
+
"label": "Final Output",
|
173
|
+
"name": "score",
|
174
|
+
"target_handle_id": "001b97f6-2bc8-4d1e-9572-028dcf17df4e",
|
175
|
+
"output_id": "2abd2b3b-c301-4834-a43f-5db3604f8422",
|
176
|
+
"output_type": "NUMBER",
|
177
|
+
"node_input_id": "6580eb90-2e99-4010-bebe-4b9fc4cf0dfd",
|
178
|
+
},
|
179
|
+
"inputs": [
|
180
|
+
{
|
181
|
+
"id": "6580eb90-2e99-4010-bebe-4b9fc4cf0dfd",
|
182
|
+
"key": "node_input",
|
183
|
+
"value": {
|
184
|
+
"rules": [
|
185
|
+
{
|
186
|
+
"type": "NODE_OUTPUT",
|
187
|
+
"data": {
|
188
|
+
"node_id": "5573f078-cced-48f3-bafd-782d48e260c7",
|
189
|
+
"output_id": "0cce9413-687e-43e9-af04-a488334688fa",
|
190
|
+
},
|
191
|
+
}
|
192
|
+
],
|
193
|
+
"combinator": "OR",
|
194
|
+
},
|
195
|
+
}
|
196
|
+
],
|
197
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
198
|
+
}
|
199
|
+
|
200
|
+
# AND each edge should be serialized correctly
|
201
|
+
serialized_edges = workflow_raw_data["edges"]
|
202
|
+
assert serialized_edges == [
|
203
|
+
{
|
204
|
+
"id": "7bab1cc9-eedd-4e76-8bc1-0437b842c3bd",
|
205
|
+
"source_node_id": "54c5c7d0-ab86-4ae9-b0b8-ea9ca7b87c14",
|
206
|
+
"source_handle_id": "41840690-8d85-486e-a864-b0661ccf0f2e",
|
207
|
+
"target_node_id": "5573f078-cced-48f3-bafd-782d48e260c7",
|
208
|
+
"target_handle_id": "ce5b85b1-eded-46dd-b4b7-020afcdc67ab",
|
209
|
+
"type": "DEFAULT",
|
210
|
+
},
|
211
|
+
{
|
212
|
+
"id": "5c456a17-a92b-4dad-9569-306043707c9f",
|
213
|
+
"source_node_id": "5573f078-cced-48f3-bafd-782d48e260c7",
|
214
|
+
"source_handle_id": "0ed87407-697e-4ae9-ab9b-6c5cc2e57cf7",
|
215
|
+
"target_node_id": "cbc7197e-67c9-4af5-b781-879c8fd3e4c9",
|
216
|
+
"target_handle_id": "001b97f6-2bc8-4d1e-9572-028dcf17df4e",
|
217
|
+
"type": "DEFAULT",
|
218
|
+
},
|
219
|
+
]
|
220
|
+
|
221
|
+
# AND the display data is what we expect
|
222
|
+
display_data = workflow_raw_data["display_data"]
|
223
|
+
assert display_data == {"viewport": {"x": 0.0, "y": 0.0, "zoom": 1.0}}
|
224
|
+
|
225
|
+
# AND the definition is what we expect
|
226
|
+
definition = workflow_raw_data["definition"]
|
227
|
+
assert definition == {
|
228
|
+
"name": "BasicGuardrailNodeWorkflow",
|
229
|
+
"module": [
|
230
|
+
"tests",
|
231
|
+
"workflows",
|
232
|
+
"basic_guardrail_node",
|
233
|
+
"workflow",
|
234
|
+
],
|
235
|
+
}
|