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.
Files changed (245) hide show
  1. vellum/plugins/__init__.py +0 -0
  2. vellum/plugins/pydantic.py +74 -0
  3. vellum/plugins/utils.py +19 -0
  4. vellum/plugins/vellum_mypy.py +639 -3
  5. vellum/workflows/README.md +90 -0
  6. vellum/workflows/__init__.py +5 -0
  7. vellum/workflows/constants.py +43 -0
  8. vellum/workflows/descriptors/__init__.py +0 -0
  9. vellum/workflows/descriptors/base.py +339 -0
  10. vellum/workflows/descriptors/tests/test_utils.py +83 -0
  11. vellum/workflows/descriptors/utils.py +90 -0
  12. vellum/workflows/edges/__init__.py +5 -0
  13. vellum/workflows/edges/edge.py +23 -0
  14. vellum/workflows/emitters/__init__.py +5 -0
  15. vellum/workflows/emitters/base.py +14 -0
  16. vellum/workflows/environment/__init__.py +5 -0
  17. vellum/workflows/environment/environment.py +7 -0
  18. vellum/workflows/errors/__init__.py +6 -0
  19. vellum/workflows/errors/types.py +20 -0
  20. vellum/workflows/events/__init__.py +31 -0
  21. vellum/workflows/events/node.py +125 -0
  22. vellum/workflows/events/tests/__init__.py +0 -0
  23. vellum/workflows/events/tests/test_event.py +216 -0
  24. vellum/workflows/events/types.py +52 -0
  25. vellum/workflows/events/utils.py +5 -0
  26. vellum/workflows/events/workflow.py +139 -0
  27. vellum/workflows/exceptions.py +15 -0
  28. vellum/workflows/expressions/__init__.py +0 -0
  29. vellum/workflows/expressions/accessor.py +52 -0
  30. vellum/workflows/expressions/and_.py +32 -0
  31. vellum/workflows/expressions/begins_with.py +31 -0
  32. vellum/workflows/expressions/between.py +38 -0
  33. vellum/workflows/expressions/coalesce_expression.py +41 -0
  34. vellum/workflows/expressions/contains.py +30 -0
  35. vellum/workflows/expressions/does_not_begin_with.py +31 -0
  36. vellum/workflows/expressions/does_not_contain.py +30 -0
  37. vellum/workflows/expressions/does_not_end_with.py +31 -0
  38. vellum/workflows/expressions/does_not_equal.py +25 -0
  39. vellum/workflows/expressions/ends_with.py +31 -0
  40. vellum/workflows/expressions/equals.py +25 -0
  41. vellum/workflows/expressions/greater_than.py +33 -0
  42. vellum/workflows/expressions/greater_than_or_equal_to.py +33 -0
  43. vellum/workflows/expressions/in_.py +31 -0
  44. vellum/workflows/expressions/is_blank.py +24 -0
  45. vellum/workflows/expressions/is_not_blank.py +24 -0
  46. vellum/workflows/expressions/is_not_null.py +21 -0
  47. vellum/workflows/expressions/is_not_undefined.py +22 -0
  48. vellum/workflows/expressions/is_null.py +21 -0
  49. vellum/workflows/expressions/is_undefined.py +22 -0
  50. vellum/workflows/expressions/less_than.py +33 -0
  51. vellum/workflows/expressions/less_than_or_equal_to.py +33 -0
  52. vellum/workflows/expressions/not_between.py +38 -0
  53. vellum/workflows/expressions/not_in.py +31 -0
  54. vellum/workflows/expressions/or_.py +32 -0
  55. vellum/workflows/graph/__init__.py +3 -0
  56. vellum/workflows/graph/graph.py +131 -0
  57. vellum/workflows/graph/tests/__init__.py +0 -0
  58. vellum/workflows/graph/tests/test_graph.py +437 -0
  59. vellum/workflows/inputs/__init__.py +5 -0
  60. vellum/workflows/inputs/base.py +55 -0
  61. vellum/workflows/logging.py +14 -0
  62. vellum/workflows/nodes/__init__.py +46 -0
  63. vellum/workflows/nodes/bases/__init__.py +7 -0
  64. vellum/workflows/nodes/bases/base.py +332 -0
  65. vellum/workflows/nodes/bases/base_subworkflow_node/__init__.py +5 -0
  66. vellum/workflows/nodes/bases/base_subworkflow_node/node.py +10 -0
  67. vellum/workflows/nodes/bases/tests/__init__.py +0 -0
  68. vellum/workflows/nodes/bases/tests/test_base_node.py +125 -0
  69. vellum/workflows/nodes/core/__init__.py +16 -0
  70. vellum/workflows/nodes/core/error_node/__init__.py +5 -0
  71. vellum/workflows/nodes/core/error_node/node.py +26 -0
  72. vellum/workflows/nodes/core/inline_subworkflow_node/__init__.py +5 -0
  73. vellum/workflows/nodes/core/inline_subworkflow_node/node.py +73 -0
  74. vellum/workflows/nodes/core/map_node/__init__.py +5 -0
  75. vellum/workflows/nodes/core/map_node/node.py +147 -0
  76. vellum/workflows/nodes/core/map_node/tests/__init__.py +0 -0
  77. vellum/workflows/nodes/core/map_node/tests/test_node.py +65 -0
  78. vellum/workflows/nodes/core/retry_node/__init__.py +5 -0
  79. vellum/workflows/nodes/core/retry_node/node.py +106 -0
  80. vellum/workflows/nodes/core/retry_node/tests/__init__.py +0 -0
  81. vellum/workflows/nodes/core/retry_node/tests/test_node.py +93 -0
  82. vellum/workflows/nodes/core/templating_node/__init__.py +5 -0
  83. vellum/workflows/nodes/core/templating_node/custom_filters.py +12 -0
  84. vellum/workflows/nodes/core/templating_node/exceptions.py +2 -0
  85. vellum/workflows/nodes/core/templating_node/node.py +123 -0
  86. vellum/workflows/nodes/core/templating_node/render.py +55 -0
  87. vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py +21 -0
  88. vellum/workflows/nodes/core/try_node/__init__.py +5 -0
  89. vellum/workflows/nodes/core/try_node/node.py +110 -0
  90. vellum/workflows/nodes/core/try_node/tests/__init__.py +0 -0
  91. vellum/workflows/nodes/core/try_node/tests/test_node.py +82 -0
  92. vellum/workflows/nodes/displayable/__init__.py +31 -0
  93. vellum/workflows/nodes/displayable/api_node/__init__.py +5 -0
  94. vellum/workflows/nodes/displayable/api_node/node.py +44 -0
  95. vellum/workflows/nodes/displayable/bases/__init__.py +11 -0
  96. vellum/workflows/nodes/displayable/bases/api_node/__init__.py +5 -0
  97. vellum/workflows/nodes/displayable/bases/api_node/node.py +70 -0
  98. vellum/workflows/nodes/displayable/bases/base_prompt_node/__init__.py +5 -0
  99. vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +60 -0
  100. vellum/workflows/nodes/displayable/bases/inline_prompt_node/__init__.py +5 -0
  101. vellum/workflows/nodes/displayable/bases/inline_prompt_node/constants.py +13 -0
  102. vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +118 -0
  103. vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +98 -0
  104. vellum/workflows/nodes/displayable/bases/search_node.py +90 -0
  105. vellum/workflows/nodes/displayable/code_execution_node/__init__.py +5 -0
  106. vellum/workflows/nodes/displayable/code_execution_node/node.py +197 -0
  107. vellum/workflows/nodes/displayable/code_execution_node/tests/__init__.py +0 -0
  108. vellum/workflows/nodes/displayable/code_execution_node/tests/fixtures/__init__.py +0 -0
  109. vellum/workflows/nodes/displayable/code_execution_node/tests/fixtures/main.py +3 -0
  110. vellum/workflows/nodes/displayable/code_execution_node/tests/test_code_execution_node.py +111 -0
  111. vellum/workflows/nodes/displayable/code_execution_node/utils.py +10 -0
  112. vellum/workflows/nodes/displayable/conditional_node/__init__.py +5 -0
  113. vellum/workflows/nodes/displayable/conditional_node/node.py +25 -0
  114. vellum/workflows/nodes/displayable/final_output_node/__init__.py +5 -0
  115. vellum/workflows/nodes/displayable/final_output_node/node.py +43 -0
  116. vellum/workflows/nodes/displayable/guardrail_node/__init__.py +5 -0
  117. vellum/workflows/nodes/displayable/guardrail_node/node.py +97 -0
  118. vellum/workflows/nodes/displayable/inline_prompt_node/__init__.py +5 -0
  119. vellum/workflows/nodes/displayable/inline_prompt_node/node.py +41 -0
  120. vellum/workflows/nodes/displayable/merge_node/__init__.py +5 -0
  121. vellum/workflows/nodes/displayable/merge_node/node.py +10 -0
  122. vellum/workflows/nodes/displayable/prompt_deployment_node/__init__.py +5 -0
  123. vellum/workflows/nodes/displayable/prompt_deployment_node/node.py +45 -0
  124. vellum/workflows/nodes/displayable/search_node/__init__.py +5 -0
  125. vellum/workflows/nodes/displayable/search_node/node.py +26 -0
  126. vellum/workflows/nodes/displayable/subworkflow_deployment_node/__init__.py +5 -0
  127. vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +156 -0
  128. vellum/workflows/nodes/displayable/tests/__init__.py +0 -0
  129. vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +148 -0
  130. vellum/workflows/nodes/displayable/tests/test_search_node_wth_text_output.py +134 -0
  131. vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +80 -0
  132. vellum/workflows/nodes/utils.py +27 -0
  133. vellum/workflows/outputs/__init__.py +6 -0
  134. vellum/workflows/outputs/base.py +196 -0
  135. vellum/workflows/ports/__init__.py +7 -0
  136. vellum/workflows/ports/node_ports.py +75 -0
  137. vellum/workflows/ports/port.py +75 -0
  138. vellum/workflows/ports/utils.py +40 -0
  139. vellum/workflows/references/__init__.py +17 -0
  140. vellum/workflows/references/environment_variable.py +20 -0
  141. vellum/workflows/references/execution_count.py +20 -0
  142. vellum/workflows/references/external_input.py +49 -0
  143. vellum/workflows/references/input.py +7 -0
  144. vellum/workflows/references/lazy.py +55 -0
  145. vellum/workflows/references/node.py +43 -0
  146. vellum/workflows/references/output.py +78 -0
  147. vellum/workflows/references/state_value.py +23 -0
  148. vellum/workflows/references/vellum_secret.py +15 -0
  149. vellum/workflows/references/workflow_input.py +41 -0
  150. vellum/workflows/resolvers/__init__.py +5 -0
  151. vellum/workflows/resolvers/base.py +15 -0
  152. vellum/workflows/runner/__init__.py +5 -0
  153. vellum/workflows/runner/runner.py +588 -0
  154. vellum/workflows/runner/types.py +18 -0
  155. vellum/workflows/state/__init__.py +5 -0
  156. vellum/workflows/state/base.py +327 -0
  157. vellum/workflows/state/context.py +18 -0
  158. vellum/workflows/state/encoder.py +57 -0
  159. vellum/workflows/state/store.py +28 -0
  160. vellum/workflows/state/tests/__init__.py +0 -0
  161. vellum/workflows/state/tests/test_state.py +113 -0
  162. vellum/workflows/types/__init__.py +0 -0
  163. vellum/workflows/types/core.py +91 -0
  164. vellum/workflows/types/generics.py +14 -0
  165. vellum/workflows/types/stack.py +39 -0
  166. vellum/workflows/types/tests/__init__.py +0 -0
  167. vellum/workflows/types/tests/test_utils.py +76 -0
  168. vellum/workflows/types/utils.py +164 -0
  169. vellum/workflows/utils/__init__.py +0 -0
  170. vellum/workflows/utils/names.py +13 -0
  171. vellum/workflows/utils/tests/__init__.py +0 -0
  172. vellum/workflows/utils/tests/test_names.py +15 -0
  173. vellum/workflows/utils/tests/test_vellum_variables.py +25 -0
  174. vellum/workflows/utils/vellum_variables.py +81 -0
  175. vellum/workflows/vellum_client.py +18 -0
  176. vellum/workflows/workflows/__init__.py +5 -0
  177. vellum/workflows/workflows/base.py +365 -0
  178. {vellum_ai-0.9.16rc2.dist-info → vellum_ai-0.9.16rc4.dist-info}/METADATA +2 -1
  179. {vellum_ai-0.9.16rc2.dist-info → vellum_ai-0.9.16rc4.dist-info}/RECORD +245 -7
  180. vellum_cli/__init__.py +72 -0
  181. vellum_cli/aliased_group.py +103 -0
  182. vellum_cli/config.py +96 -0
  183. vellum_cli/image_push.py +112 -0
  184. vellum_cli/logger.py +36 -0
  185. vellum_cli/pull.py +73 -0
  186. vellum_cli/push.py +121 -0
  187. vellum_cli/tests/test_config.py +100 -0
  188. vellum_cli/tests/test_pull.py +152 -0
  189. vellum_ee/workflows/__init__.py +0 -0
  190. vellum_ee/workflows/display/__init__.py +0 -0
  191. vellum_ee/workflows/display/base.py +73 -0
  192. vellum_ee/workflows/display/nodes/__init__.py +4 -0
  193. vellum_ee/workflows/display/nodes/base_node_display.py +116 -0
  194. vellum_ee/workflows/display/nodes/base_node_vellum_display.py +36 -0
  195. vellum_ee/workflows/display/nodes/get_node_display_class.py +25 -0
  196. vellum_ee/workflows/display/nodes/tests/__init__.py +0 -0
  197. vellum_ee/workflows/display/nodes/tests/test_base_node_display.py +47 -0
  198. vellum_ee/workflows/display/nodes/types.py +18 -0
  199. vellum_ee/workflows/display/nodes/utils.py +33 -0
  200. vellum_ee/workflows/display/nodes/vellum/__init__.py +32 -0
  201. vellum_ee/workflows/display/nodes/vellum/api_node.py +205 -0
  202. vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +71 -0
  203. vellum_ee/workflows/display/nodes/vellum/conditional_node.py +217 -0
  204. vellum_ee/workflows/display/nodes/vellum/final_output_node.py +61 -0
  205. vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +49 -0
  206. vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +170 -0
  207. vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +99 -0
  208. vellum_ee/workflows/display/nodes/vellum/map_node.py +100 -0
  209. vellum_ee/workflows/display/nodes/vellum/merge_node.py +48 -0
  210. vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +68 -0
  211. vellum_ee/workflows/display/nodes/vellum/search_node.py +193 -0
  212. vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +58 -0
  213. vellum_ee/workflows/display/nodes/vellum/templating_node.py +67 -0
  214. vellum_ee/workflows/display/nodes/vellum/tests/__init__.py +0 -0
  215. vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +106 -0
  216. vellum_ee/workflows/display/nodes/vellum/try_node.py +38 -0
  217. vellum_ee/workflows/display/nodes/vellum/utils.py +76 -0
  218. vellum_ee/workflows/display/tests/__init__.py +0 -0
  219. vellum_ee/workflows/display/tests/workflow_serialization/__init__.py +0 -0
  220. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +426 -0
  221. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +607 -0
  222. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +1175 -0
  223. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +235 -0
  224. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +511 -0
  225. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +372 -0
  226. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +272 -0
  227. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +289 -0
  228. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +354 -0
  229. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +123 -0
  230. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +84 -0
  231. vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +233 -0
  232. vellum_ee/workflows/display/types.py +46 -0
  233. vellum_ee/workflows/display/utils/__init__.py +0 -0
  234. vellum_ee/workflows/display/utils/tests/__init__.py +0 -0
  235. vellum_ee/workflows/display/utils/tests/test_uuids.py +16 -0
  236. vellum_ee/workflows/display/utils/uuids.py +24 -0
  237. vellum_ee/workflows/display/utils/vellum.py +121 -0
  238. vellum_ee/workflows/display/vellum.py +357 -0
  239. vellum_ee/workflows/display/workflows/__init__.py +5 -0
  240. vellum_ee/workflows/display/workflows/base_workflow_display.py +302 -0
  241. vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py +32 -0
  242. vellum_ee/workflows/display/workflows/vellum_workflow_display.py +386 -0
  243. {vellum_ai-0.9.16rc2.dist-info → vellum_ai-0.9.16rc4.dist-info}/LICENSE +0 -0
  244. {vellum_ai-0.9.16rc2.dist-info → vellum_ai-0.9.16rc4.dist-info}/WHEEL +0 -0
  245. {vellum_ai-0.9.16rc2.dist-info → vellum_ai-0.9.16rc4.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,511 @@
1
+ from unittest import mock
2
+
3
+ from deepdiff import DeepDiff
4
+
5
+ from tests.workflows.basic_inline_subworkflow.workflow import BasicInlineSubworkflowWorkflow
6
+ from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
7
+ from vellum_ee.workflows.display.workflows import VellumWorkflowDisplay
8
+ from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
9
+
10
+
11
+ def test_serialize_workflow():
12
+ # GIVEN a Workflow
13
+ # WHEN we serialize it
14
+ workflow_display = get_workflow_display(
15
+ base_display_class=VellumWorkflowDisplay, workflow_class=BasicInlineSubworkflowWorkflow
16
+ )
17
+
18
+ # TODO: Support serialization of BaseNode
19
+ # https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
20
+ with mock.patch.object(BaseNodeVellumDisplay, "serialize") as mocked_serialize:
21
+ mocked_serialize.return_value = {"type": "MOCKED"}
22
+ serialized_workflow: dict = workflow_display.serialize()
23
+
24
+ # THEN we should get a serialized representation of the Workflow
25
+ assert serialized_workflow.keys() == {
26
+ "workflow_raw_data",
27
+ "input_variables",
28
+ "output_variables",
29
+ }
30
+
31
+ # AND its input variables should be what we expect
32
+ input_variables = serialized_workflow["input_variables"]
33
+ assert len(input_variables) == 2
34
+ assert not DeepDiff(
35
+ [
36
+ {
37
+ "id": "fa73da37-34c3-47a9-be58-69cc6cdbfca5",
38
+ "key": "city",
39
+ "type": "STRING",
40
+ "required": None,
41
+ "default": None,
42
+ "extensions": None,
43
+ },
44
+ {
45
+ "id": "aba1e6e0-dfa7-4c15-a4e6-aec6feebfaca",
46
+ "key": "date",
47
+ "type": "STRING",
48
+ "required": None,
49
+ "default": None,
50
+ "extensions": None,
51
+ },
52
+ ],
53
+ input_variables,
54
+ ignore_order=True,
55
+ )
56
+
57
+ # AND its output variables should be what we expect
58
+ output_variables = serialized_workflow["output_variables"]
59
+ assert len(output_variables) == 2
60
+ assert not DeepDiff(
61
+ [
62
+ {
63
+ "id": "99afb757-2782-465d-ab55-80ccf50552b9",
64
+ "key": "temperature",
65
+ "type": "NUMBER",
66
+ },
67
+ {
68
+ "id": "7444a019-081a-4e10-a528-3249299159f7",
69
+ "key": "reasoning",
70
+ "type": "STRING",
71
+ },
72
+ ],
73
+ output_variables,
74
+ ignore_order=True,
75
+ )
76
+
77
+ # AND its raw data should be what we expect
78
+ workflow_raw_data = serialized_workflow["workflow_raw_data"]
79
+ assert workflow_raw_data.keys() == {"edges", "nodes", "display_data", "definition"}
80
+ assert len(workflow_raw_data["edges"]) == 3
81
+ assert len(workflow_raw_data["nodes"]) == 4
82
+
83
+ # AND each node should be serialized correctly
84
+ entrypoint_node = workflow_raw_data["nodes"][0]
85
+ assert entrypoint_node == {
86
+ "id": "6358dcfe-b162-4e19-99ca-401d1ada9bdc",
87
+ "type": "ENTRYPOINT",
88
+ "definition": {
89
+ "bases": [],
90
+ "module": [
91
+ "vellum",
92
+ "workflows",
93
+ "nodes",
94
+ "bases",
95
+ "base",
96
+ ],
97
+ "name": "BaseNode",
98
+ },
99
+ "inputs": [],
100
+ "data": {
101
+ "label": "Entrypoint Node",
102
+ "source_handle_id": "c344fdee-282b-40c9-8c97-6dd08830948c",
103
+ },
104
+ "display_data": {
105
+ "position": {"x": 0.0, "y": 0.0},
106
+ },
107
+ }
108
+
109
+ subworkflow_node = workflow_raw_data["nodes"][1]
110
+ assert not DeepDiff(
111
+ {
112
+ "id": "080e4343-c7ce-4f82-b9dd-e94c8cc92239",
113
+ "type": "SUBWORKFLOW",
114
+ "inputs": [
115
+ {
116
+ "id": "704c4640-bfda-44f0-8da3-e9cfc4f21cf2",
117
+ "key": "metro",
118
+ "value": {
119
+ "rules": [
120
+ {
121
+ "type": "INPUT_VARIABLE",
122
+ "data": {"input_variable_id": "fa73da37-34c3-47a9-be58-69cc6cdbfca5"},
123
+ }
124
+ ],
125
+ "combinator": "OR",
126
+ },
127
+ }
128
+ ],
129
+ "data": {
130
+ "label": "Example Inline Subworkflow Node",
131
+ "error_output_id": None,
132
+ "source_handle_id": "cfd831bc-ee7f-44d0-8d76-0ba0cd0277dc",
133
+ "target_handle_id": "859a75a6-1bd2-4350-9509-4af66245e8e4",
134
+ "variant": "INLINE",
135
+ "workflow_raw_data": {
136
+ "nodes": [
137
+ {
138
+ "id": "afa49a0f-db35-4552-9217-5b8f237e84bc",
139
+ "type": "ENTRYPOINT",
140
+ "inputs": [],
141
+ "data": {
142
+ "label": "Entrypoint Node",
143
+ "source_handle_id": "9914a6a0-9a99-430d-8ddd-f7c13847fe1a",
144
+ },
145
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
146
+ "definition": {
147
+ "name": "BaseNode",
148
+ "module": [
149
+ "vellum",
150
+ "workflows",
151
+ "nodes",
152
+ "bases",
153
+ "base",
154
+ ],
155
+ "bases": [],
156
+ },
157
+ },
158
+ {"type": "MOCKED"},
159
+ {
160
+ "id": "a773c3a5-78cb-4250-8d29-7282e8a579d3",
161
+ "type": "TERMINAL",
162
+ "data": {
163
+ "label": "Final Output",
164
+ "name": "temperature",
165
+ "target_handle_id": "804bb543-9cf4-457f-acf1-fb4b8b7d9259",
166
+ "output_id": "2fc57139-7420-49e5-96a6-dcbb3ff5d622",
167
+ "output_type": "NUMBER",
168
+ "node_input_id": "a9dc6e1e-ecbd-4308-93f4-7429483dd07c",
169
+ },
170
+ "inputs": [
171
+ {
172
+ "id": "a9dc6e1e-ecbd-4308-93f4-7429483dd07c",
173
+ "key": "node_input",
174
+ "value": {
175
+ "rules": [
176
+ {
177
+ "type": "NODE_OUTPUT",
178
+ "data": {
179
+ "node_id": "1381c078-efa2-4255-89a1-7b4cb742c7fc",
180
+ "output_id": "3f4c753e-f057-47bb-9748-7968283cc8aa",
181
+ },
182
+ }
183
+ ],
184
+ "combinator": "OR",
185
+ },
186
+ }
187
+ ],
188
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
189
+ "definition": {
190
+ "name": "FinalOutputNode",
191
+ "module": [
192
+ "vellum",
193
+ "workflows",
194
+ "nodes",
195
+ "displayable",
196
+ "final_output_node",
197
+ "node",
198
+ ],
199
+ "bases": [
200
+ {
201
+ "name": "BaseNode",
202
+ "module": [
203
+ "vellum",
204
+ "workflows",
205
+ "nodes",
206
+ "bases",
207
+ "base",
208
+ ],
209
+ "bases": [],
210
+ }
211
+ ],
212
+ },
213
+ },
214
+ {
215
+ "id": "570f4d12-69ff-49f1-ba98-ade6283dd7c2",
216
+ "type": "TERMINAL",
217
+ "data": {
218
+ "label": "Final Output",
219
+ "name": "reasoning",
220
+ "target_handle_id": "6d4c4a14-c388-4c7a-b223-eb39baf5c080",
221
+ "output_id": "fad5dd9f-3328-4e70-ad55-65a5325a4a82",
222
+ "output_type": "STRING",
223
+ "node_input_id": "39c0f9c2-1805-4617-9771-4eb23c76d88e",
224
+ },
225
+ "inputs": [
226
+ {
227
+ "id": "39c0f9c2-1805-4617-9771-4eb23c76d88e",
228
+ "key": "node_input",
229
+ "value": {
230
+ "rules": [
231
+ {
232
+ "type": "NODE_OUTPUT",
233
+ "data": {
234
+ "node_id": "1381c078-efa2-4255-89a1-7b4cb742c7fc",
235
+ "output_id": "2a4a62b3-cd26-4d2c-b3f1-eaa5f9dd22dd",
236
+ },
237
+ }
238
+ ],
239
+ "combinator": "OR",
240
+ },
241
+ }
242
+ ],
243
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
244
+ "definition": {
245
+ "name": "FinalOutputNode",
246
+ "module": [
247
+ "vellum",
248
+ "workflows",
249
+ "nodes",
250
+ "displayable",
251
+ "final_output_node",
252
+ "node",
253
+ ],
254
+ "bases": [
255
+ {
256
+ "name": "BaseNode",
257
+ "module": [
258
+ "vellum",
259
+ "workflows",
260
+ "nodes",
261
+ "bases",
262
+ "base",
263
+ ],
264
+ "bases": [],
265
+ }
266
+ ],
267
+ },
268
+ },
269
+ ],
270
+ "edges": [
271
+ {
272
+ "id": "fb2f58f0-9d49-4658-af78-afa9b94091a6",
273
+ "source_node_id": "afa49a0f-db35-4552-9217-5b8f237e84bc",
274
+ "source_handle_id": "9914a6a0-9a99-430d-8ddd-f7c13847fe1a",
275
+ "target_node_id": "1381c078-efa2-4255-89a1-7b4cb742c7fc",
276
+ "target_handle_id": "6492efcf-4437-4af1-9ad7-269795ccb27a",
277
+ "type": "DEFAULT",
278
+ },
279
+ {
280
+ "id": "6f16dfb8-d794-4be8-8860-6ea34f0b9e7c",
281
+ "source_node_id": "1381c078-efa2-4255-89a1-7b4cb742c7fc",
282
+ "source_handle_id": "1e739e86-a285-4438-9725-a152c15a63e3",
283
+ "target_node_id": "a773c3a5-78cb-4250-8d29-7282e8a579d3",
284
+ "target_handle_id": "804bb543-9cf4-457f-acf1-fb4b8b7d9259",
285
+ "type": "DEFAULT",
286
+ },
287
+ {
288
+ "id": "63b77ff0-5282-46ce-8da9-37ced05ac61c",
289
+ "source_node_id": "1381c078-efa2-4255-89a1-7b4cb742c7fc",
290
+ "source_handle_id": "1e739e86-a285-4438-9725-a152c15a63e3",
291
+ "target_node_id": "570f4d12-69ff-49f1-ba98-ade6283dd7c2",
292
+ "target_handle_id": "6d4c4a14-c388-4c7a-b223-eb39baf5c080",
293
+ "type": "DEFAULT",
294
+ },
295
+ ],
296
+ "display_data": {"viewport": {"x": 0.0, "y": 0.0, "zoom": 1.0}},
297
+ "definition": {
298
+ "name": "NestedWorkflow",
299
+ "module": [
300
+ "tests",
301
+ "workflows",
302
+ "basic_inline_subworkflow",
303
+ "workflow",
304
+ ],
305
+ },
306
+ },
307
+ "input_variables": [{"id": "704c4640-bfda-44f0-8da3-e9cfc4f21cf2", "key": "metro", "type": "STRING"}],
308
+ "output_variables": [
309
+ {"id": "86dd0202-c141-48a3-8382-2da60372e77c", "key": "temperature", "type": "NUMBER"},
310
+ {"id": "0a7192da-5576-4933-bba4-de8adf5d7996", "key": "reasoning", "type": "STRING"},
311
+ ],
312
+ },
313
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
314
+ "definition": {
315
+ "name": "ExampleInlineSubworkflowNode",
316
+ "module": [
317
+ "tests",
318
+ "workflows",
319
+ "basic_inline_subworkflow",
320
+ "workflow",
321
+ ],
322
+ "bases": [
323
+ {
324
+ "name": "InlineSubworkflowNode",
325
+ "module": [
326
+ "vellum",
327
+ "workflows",
328
+ "nodes",
329
+ "core",
330
+ "inline_subworkflow_node",
331
+ "node",
332
+ ],
333
+ }
334
+ ],
335
+ },
336
+ },
337
+ subworkflow_node,
338
+ ignore_order=True,
339
+ )
340
+
341
+ assert not DeepDiff(
342
+ [
343
+ {
344
+ "id": "31b74695-3f1c-47cf-8be8-a4d86cc589e8",
345
+ "type": "TERMINAL",
346
+ "definition": {
347
+ "bases": [
348
+ {
349
+ "bases": [],
350
+ "module": [
351
+ "vellum",
352
+ "workflows",
353
+ "nodes",
354
+ "bases",
355
+ "base",
356
+ ],
357
+ "name": "BaseNode",
358
+ },
359
+ ],
360
+ "module": [
361
+ "vellum",
362
+ "workflows",
363
+ "nodes",
364
+ "displayable",
365
+ "final_output_node",
366
+ "node",
367
+ ],
368
+ "name": "FinalOutputNode",
369
+ },
370
+ "data": {
371
+ "label": "Final Output",
372
+ "name": "reasoning",
373
+ "target_handle_id": "8b525943-6c27-414b-a329-e29c0b217f72",
374
+ "output_id": "7444a019-081a-4e10-a528-3249299159f7",
375
+ "output_type": "STRING",
376
+ "node_input_id": "736473c8-b0b4-4cdd-b743-6453dd5306fc",
377
+ },
378
+ "inputs": [
379
+ {
380
+ "id": "736473c8-b0b4-4cdd-b743-6453dd5306fc",
381
+ "key": "node_input",
382
+ "value": {
383
+ "rules": [
384
+ {
385
+ "type": "NODE_OUTPUT",
386
+ "data": {
387
+ "node_id": "080e4343-c7ce-4f82-b9dd-e94c8cc92239",
388
+ "output_id": "0a7192da-5576-4933-bba4-de8adf5d7996",
389
+ },
390
+ }
391
+ ],
392
+ "combinator": "OR",
393
+ },
394
+ }
395
+ ],
396
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
397
+ },
398
+ {
399
+ "id": "0779b232-82ab-4dbe-a340-6a85e6ab3368",
400
+ "type": "TERMINAL",
401
+ "definition": {
402
+ "bases": [
403
+ {
404
+ "bases": [],
405
+ "module": [
406
+ "vellum",
407
+ "workflows",
408
+ "nodes",
409
+ "bases",
410
+ "base",
411
+ ],
412
+ "name": "BaseNode",
413
+ },
414
+ ],
415
+ "module": [
416
+ "vellum",
417
+ "workflows",
418
+ "nodes",
419
+ "displayable",
420
+ "final_output_node",
421
+ "node",
422
+ ],
423
+ "name": "FinalOutputNode",
424
+ },
425
+ "data": {
426
+ "label": "Final Output",
427
+ "name": "temperature",
428
+ "target_handle_id": "9e077063-c394-4c7b-b0c6-e6686df67984",
429
+ "output_id": "99afb757-2782-465d-ab55-80ccf50552b9",
430
+ "output_type": "NUMBER",
431
+ "node_input_id": "df0d7e0c-2b37-4059-91c1-0419f950b7fe",
432
+ },
433
+ "inputs": [
434
+ {
435
+ "id": "df0d7e0c-2b37-4059-91c1-0419f950b7fe",
436
+ "key": "node_input",
437
+ "value": {
438
+ "rules": [
439
+ {
440
+ "type": "NODE_OUTPUT",
441
+ "data": {
442
+ "node_id": "080e4343-c7ce-4f82-b9dd-e94c8cc92239",
443
+ "output_id": "86dd0202-c141-48a3-8382-2da60372e77c",
444
+ },
445
+ }
446
+ ],
447
+ "combinator": "OR",
448
+ },
449
+ }
450
+ ],
451
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
452
+ },
453
+ ],
454
+ workflow_raw_data["nodes"][2:],
455
+ ignore_order=True,
456
+ )
457
+
458
+ # AND each edge should be serialized correctly
459
+ serialized_edges = workflow_raw_data["edges"]
460
+ assert not DeepDiff(
461
+ [
462
+ {
463
+ "id": "71dd3569-ccf8-4352-ad42-3594be3a6c16",
464
+ "source_node_id": "6358dcfe-b162-4e19-99ca-401d1ada9bdc",
465
+ "source_handle_id": "c344fdee-282b-40c9-8c97-6dd08830948c",
466
+ "target_node_id": "080e4343-c7ce-4f82-b9dd-e94c8cc92239",
467
+ "target_handle_id": "859a75a6-1bd2-4350-9509-4af66245e8e4",
468
+ "type": "DEFAULT",
469
+ },
470
+ {
471
+ "id": "3c5d8990-48f5-42e1-893e-bc8308d2110a",
472
+ "source_node_id": "080e4343-c7ce-4f82-b9dd-e94c8cc92239",
473
+ "source_handle_id": "cfd831bc-ee7f-44d0-8d76-0ba0cd0277dc",
474
+ "target_node_id": "0779b232-82ab-4dbe-a340-6a85e6ab3368",
475
+ "target_handle_id": "9e077063-c394-4c7b-b0c6-e6686df67984",
476
+ "type": "DEFAULT",
477
+ },
478
+ {
479
+ "id": "de0b8090-a26e-4e09-9173-9f7400a5be4c",
480
+ "source_node_id": "080e4343-c7ce-4f82-b9dd-e94c8cc92239",
481
+ "source_handle_id": "cfd831bc-ee7f-44d0-8d76-0ba0cd0277dc",
482
+ "target_node_id": "31b74695-3f1c-47cf-8be8-a4d86cc589e8",
483
+ "target_handle_id": "8b525943-6c27-414b-a329-e29c0b217f72",
484
+ "type": "DEFAULT",
485
+ },
486
+ ],
487
+ serialized_edges,
488
+ ignore_order=True,
489
+ )
490
+
491
+ # AND the display data should be what we expect
492
+ display_data = workflow_raw_data["display_data"]
493
+ assert display_data == {
494
+ "viewport": {
495
+ "x": 0.0,
496
+ "y": 0.0,
497
+ "zoom": 1.0,
498
+ }
499
+ }
500
+
501
+ # AND the definition should be what we expect
502
+ definition = workflow_raw_data["definition"]
503
+ assert definition == {
504
+ "name": "BasicInlineSubworkflowWorkflow",
505
+ "module": [
506
+ "tests",
507
+ "workflows",
508
+ "basic_inline_subworkflow",
509
+ "workflow",
510
+ ],
511
+ }