vellum-ai 1.11.2__py3-none-any.whl → 1.13.5__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.

Potentially problematic release.


This version of vellum-ai might be problematic. Click here for more details.

Files changed (275) hide show
  1. vellum/__init__.py +18 -0
  2. vellum/client/README.md +1 -1
  3. vellum/client/core/client_wrapper.py +2 -2
  4. vellum/client/core/force_multipart.py +4 -2
  5. vellum/client/core/http_response.py +1 -1
  6. vellum/client/core/pydantic_utilities.py +7 -4
  7. vellum/client/errors/too_many_requests_error.py +1 -2
  8. vellum/client/reference.md +677 -76
  9. vellum/client/resources/container_images/client.py +299 -0
  10. vellum/client/resources/container_images/raw_client.py +286 -0
  11. vellum/client/resources/documents/client.py +20 -10
  12. vellum/client/resources/documents/raw_client.py +20 -10
  13. vellum/client/resources/events/raw_client.py +4 -4
  14. vellum/client/resources/integration_auth_configs/client.py +2 -0
  15. vellum/client/resources/integration_auth_configs/raw_client.py +2 -0
  16. vellum/client/resources/integration_providers/client.py +28 -2
  17. vellum/client/resources/integration_providers/raw_client.py +24 -0
  18. vellum/client/resources/integrations/client.py +52 -4
  19. vellum/client/resources/integrations/raw_client.py +61 -0
  20. vellum/client/resources/workflow_deployments/client.py +156 -0
  21. vellum/client/resources/workflow_deployments/raw_client.py +334 -0
  22. vellum/client/resources/workflows/client.py +212 -8
  23. vellum/client/resources/workflows/raw_client.py +343 -6
  24. vellum/client/types/__init__.py +18 -0
  25. vellum/client/types/api_actor_type_enum.py +1 -1
  26. vellum/client/types/check_workflow_execution_status_error.py +21 -0
  27. vellum/client/types/check_workflow_execution_status_response.py +29 -0
  28. vellum/client/types/code_execution_package_request.py +21 -0
  29. vellum/client/types/composio_execute_tool_request.py +5 -0
  30. vellum/client/types/composio_tool_definition.py +1 -0
  31. vellum/client/types/container_image_build_config.py +1 -0
  32. vellum/client/types/container_image_container_image_tag.py +1 -0
  33. vellum/client/types/dataset_row_push_request.py +3 -0
  34. vellum/client/types/document_document_to_document_index.py +1 -0
  35. vellum/client/types/integration_name.py +24 -0
  36. vellum/client/types/node_execution_fulfilled_body.py +1 -0
  37. vellum/client/types/node_execution_log_body.py +24 -0
  38. vellum/client/types/node_execution_log_event.py +47 -0
  39. vellum/client/types/prompt_deployment_release_prompt_deployment.py +1 -0
  40. vellum/client/types/runner_config_request.py +24 -0
  41. vellum/client/types/severity_enum.py +5 -0
  42. vellum/client/types/slim_composio_tool_definition.py +1 -0
  43. vellum/client/types/slim_document_document_to_document_index.py +2 -0
  44. vellum/client/types/type_checker_enum.py +5 -0
  45. vellum/client/types/vellum_audio.py +5 -1
  46. vellum/client/types/vellum_audio_request.py +5 -1
  47. vellum/client/types/vellum_document.py +5 -1
  48. vellum/client/types/vellum_document_request.py +5 -1
  49. vellum/client/types/vellum_image.py +5 -1
  50. vellum/client/types/vellum_image_request.py +5 -1
  51. vellum/client/types/vellum_node_execution_event.py +2 -0
  52. vellum/client/types/vellum_variable.py +5 -0
  53. vellum/client/types/vellum_variable_extensions.py +1 -0
  54. vellum/client/types/vellum_variable_type.py +1 -0
  55. vellum/client/types/vellum_video.py +5 -1
  56. vellum/client/types/vellum_video_request.py +5 -1
  57. vellum/client/types/workflow_deployment_release_workflow_deployment.py +1 -0
  58. vellum/client/types/workflow_event.py +2 -0
  59. vellum/client/types/workflow_execution_fulfilled_body.py +1 -0
  60. vellum/client/types/workflow_result_event_output_data_array.py +1 -1
  61. vellum/client/types/workflow_result_event_output_data_chat_history.py +1 -1
  62. vellum/client/types/workflow_result_event_output_data_error.py +1 -1
  63. vellum/client/types/workflow_result_event_output_data_function_call.py +1 -1
  64. vellum/client/types/workflow_result_event_output_data_json.py +1 -1
  65. vellum/client/types/workflow_result_event_output_data_number.py +1 -1
  66. vellum/client/types/workflow_result_event_output_data_search_results.py +1 -1
  67. vellum/client/types/workflow_result_event_output_data_string.py +1 -1
  68. vellum/client/types/workflow_sandbox_execute_node_response.py +8 -0
  69. vellum/plugins/vellum_mypy.py +37 -2
  70. vellum/types/check_workflow_execution_status_error.py +3 -0
  71. vellum/types/check_workflow_execution_status_response.py +3 -0
  72. vellum/types/code_execution_package_request.py +3 -0
  73. vellum/types/node_execution_log_body.py +3 -0
  74. vellum/types/node_execution_log_event.py +3 -0
  75. vellum/types/runner_config_request.py +3 -0
  76. vellum/types/severity_enum.py +3 -0
  77. vellum/types/type_checker_enum.py +3 -0
  78. vellum/types/workflow_sandbox_execute_node_response.py +3 -0
  79. vellum/utils/files/mixin.py +26 -0
  80. vellum/utils/files/tests/test_mixin.py +62 -0
  81. vellum/utils/tests/test_vellum_client.py +95 -0
  82. vellum/utils/uuid.py +19 -2
  83. vellum/utils/vellum_client.py +10 -3
  84. vellum/workflows/__init__.py +7 -1
  85. vellum/workflows/descriptors/base.py +86 -0
  86. vellum/workflows/descriptors/tests/test_utils.py +9 -0
  87. vellum/workflows/errors/tests/__init__.py +0 -0
  88. vellum/workflows/errors/tests/test_types.py +52 -0
  89. vellum/workflows/errors/types.py +1 -0
  90. vellum/workflows/events/node.py +24 -0
  91. vellum/workflows/events/tests/test_event.py +123 -0
  92. vellum/workflows/events/types.py +2 -1
  93. vellum/workflows/events/workflow.py +28 -2
  94. vellum/workflows/expressions/add.py +3 -0
  95. vellum/workflows/expressions/tests/test_add.py +24 -0
  96. vellum/workflows/graph/graph.py +26 -5
  97. vellum/workflows/graph/tests/test_graph.py +228 -1
  98. vellum/workflows/inputs/base.py +22 -6
  99. vellum/workflows/inputs/dataset_row.py +121 -16
  100. vellum/workflows/inputs/tests/test_inputs.py +3 -3
  101. vellum/workflows/integrations/tests/test_vellum_integration_service.py +84 -0
  102. vellum/workflows/integrations/vellum_integration_service.py +12 -1
  103. vellum/workflows/loaders/base.py +2 -0
  104. vellum/workflows/nodes/bases/base.py +37 -16
  105. vellum/workflows/nodes/bases/tests/test_base_node.py +104 -1
  106. vellum/workflows/nodes/core/inline_subworkflow_node/node.py +1 -0
  107. vellum/workflows/nodes/core/inline_subworkflow_node/tests/test_node.py +1 -1
  108. vellum/workflows/nodes/core/map_node/node.py +7 -5
  109. vellum/workflows/nodes/core/map_node/tests/test_node.py +33 -0
  110. vellum/workflows/nodes/core/retry_node/node.py +1 -0
  111. vellum/workflows/nodes/core/try_node/node.py +1 -0
  112. vellum/workflows/nodes/displayable/api_node/node.py +3 -2
  113. vellum/workflows/nodes/displayable/api_node/tests/test_api_node.py +38 -0
  114. vellum/workflows/nodes/displayable/bases/api_node/node.py +1 -1
  115. vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +18 -1
  116. vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +109 -2
  117. vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +13 -2
  118. vellum/workflows/nodes/displayable/code_execution_node/node.py +9 -15
  119. vellum/workflows/nodes/displayable/code_execution_node/tests/test_node.py +65 -24
  120. vellum/workflows/nodes/displayable/code_execution_node/utils.py +3 -0
  121. vellum/workflows/nodes/displayable/final_output_node/node.py +24 -69
  122. vellum/workflows/nodes/displayable/final_output_node/tests/test_node.py +53 -3
  123. vellum/workflows/nodes/displayable/note_node/node.py +4 -1
  124. vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +16 -5
  125. vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +47 -0
  126. vellum/workflows/nodes/displayable/tool_calling_node/node.py +74 -34
  127. vellum/workflows/nodes/displayable/tool_calling_node/tests/test_node.py +204 -8
  128. vellum/workflows/nodes/displayable/tool_calling_node/utils.py +92 -71
  129. vellum/workflows/nodes/mocks.py +47 -213
  130. vellum/workflows/nodes/tests/test_mocks.py +0 -177
  131. vellum/workflows/nodes/utils.py +23 -8
  132. vellum/workflows/outputs/base.py +36 -3
  133. vellum/workflows/references/environment_variable.py +1 -11
  134. vellum/workflows/references/lazy.py +8 -0
  135. vellum/workflows/references/state_value.py +24 -1
  136. vellum/workflows/references/tests/test_lazy.py +58 -0
  137. vellum/workflows/references/trigger.py +8 -3
  138. vellum/workflows/references/workflow_input.py +8 -0
  139. vellum/workflows/resolvers/resolver.py +13 -3
  140. vellum/workflows/resolvers/tests/test_resolver.py +31 -0
  141. vellum/workflows/runner/runner.py +159 -14
  142. vellum/workflows/runner/tests/__init__.py +0 -0
  143. vellum/workflows/runner/tests/test_runner.py +170 -0
  144. vellum/workflows/sandbox.py +7 -8
  145. vellum/workflows/state/base.py +89 -30
  146. vellum/workflows/state/context.py +74 -3
  147. vellum/workflows/state/tests/test_state.py +269 -1
  148. vellum/workflows/tests/test_dataset_row.py +8 -7
  149. vellum/workflows/tests/test_sandbox.py +97 -8
  150. vellum/workflows/triggers/__init__.py +2 -1
  151. vellum/workflows/triggers/base.py +160 -28
  152. vellum/workflows/triggers/chat_message.py +141 -0
  153. vellum/workflows/triggers/integration.py +12 -0
  154. vellum/workflows/triggers/manual.py +3 -1
  155. vellum/workflows/triggers/schedule.py +3 -1
  156. vellum/workflows/triggers/tests/test_chat_message.py +257 -0
  157. vellum/workflows/types/core.py +18 -0
  158. vellum/workflows/types/definition.py +6 -13
  159. vellum/workflows/types/generics.py +12 -0
  160. vellum/workflows/types/tests/test_utils.py +12 -0
  161. vellum/workflows/types/utils.py +32 -2
  162. vellum/workflows/types/workflow_metadata.py +124 -0
  163. vellum/workflows/utils/functions.py +152 -16
  164. vellum/workflows/utils/pydantic_schema.py +19 -1
  165. vellum/workflows/utils/tests/test_functions.py +123 -8
  166. vellum/workflows/utils/tests/test_validate.py +79 -0
  167. vellum/workflows/utils/tests/test_vellum_variables.py +62 -2
  168. vellum/workflows/utils/uuids.py +90 -0
  169. vellum/workflows/utils/validate.py +108 -0
  170. vellum/workflows/utils/vellum_variables.py +96 -16
  171. vellum/workflows/workflows/base.py +177 -35
  172. vellum/workflows/workflows/tests/test_base_workflow.py +51 -0
  173. {vellum_ai-1.11.2.dist-info → vellum_ai-1.13.5.dist-info}/METADATA +6 -1
  174. {vellum_ai-1.11.2.dist-info → vellum_ai-1.13.5.dist-info}/RECORD +274 -227
  175. vellum_cli/__init__.py +21 -0
  176. vellum_cli/config.py +16 -2
  177. vellum_cli/pull.py +2 -0
  178. vellum_cli/push.py +23 -10
  179. vellum_cli/tests/conftest.py +8 -13
  180. vellum_cli/tests/test_image_push.py +4 -11
  181. vellum_cli/tests/test_pull.py +83 -68
  182. vellum_cli/tests/test_push.py +251 -2
  183. vellum_ee/assets/node-definitions.json +225 -12
  184. vellum_ee/scripts/generate_node_definitions.py +15 -3
  185. vellum_ee/workflows/display/base.py +4 -3
  186. vellum_ee/workflows/display/nodes/base_node_display.py +44 -11
  187. vellum_ee/workflows/display/nodes/tests/test_base_node_display.py +93 -0
  188. vellum_ee/workflows/display/nodes/types.py +1 -0
  189. vellum_ee/workflows/display/nodes/vellum/__init__.py +0 -2
  190. vellum_ee/workflows/display/nodes/vellum/base_adornment_node.py +5 -2
  191. vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +1 -1
  192. vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +10 -2
  193. vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +17 -14
  194. vellum_ee/workflows/display/nodes/vellum/map_node.py +2 -0
  195. vellum_ee/workflows/display/nodes/vellum/note_node.py +18 -3
  196. vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +37 -14
  197. vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +62 -2
  198. vellum_ee/workflows/display/nodes/vellum/tests/test_final_output_node.py +136 -0
  199. vellum_ee/workflows/display/nodes/vellum/tests/test_note_node.py +44 -7
  200. vellum_ee/workflows/display/nodes/vellum/tests/test_prompt_node.py +5 -13
  201. vellum_ee/workflows/display/nodes/vellum/tests/test_subworkflow_deployment_node.py +27 -17
  202. vellum_ee/workflows/display/nodes/vellum/tests/test_tool_calling_node.py +145 -22
  203. vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +107 -2
  204. vellum_ee/workflows/display/nodes/vellum/utils.py +54 -12
  205. vellum_ee/workflows/display/tests/test_base_workflow_display.py +13 -16
  206. vellum_ee/workflows/display/tests/test_json_schema_validation.py +190 -0
  207. vellum_ee/workflows/display/tests/test_mocks.py +912 -0
  208. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +14 -2
  209. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +109 -0
  210. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_outputs_serialization.py +3 -0
  211. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +187 -1
  212. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +34 -325
  213. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +42 -393
  214. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +13 -315
  215. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_default_state_serialization.py +2 -122
  216. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py +24 -115
  217. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py +4 -93
  218. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +7 -80
  219. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_prompt_node_serialization.py +9 -101
  220. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +77 -308
  221. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +62 -324
  222. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +3 -82
  223. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +4 -142
  224. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py +1 -61
  225. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_set_state_node_serialization.py +4 -4
  226. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +205 -134
  227. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py +34 -146
  228. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +2 -0
  229. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_composio_serialization.py +8 -6
  230. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_inline_workflow_serialization.py +137 -266
  231. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_inline_workflow_tool_wrapper_serialization.py +84 -0
  232. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_mcp_serialization.py +55 -16
  233. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_serialization.py +15 -1
  234. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_tool_wrapper_serialization.py +71 -0
  235. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_vellum_integration_serialization.py +119 -0
  236. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_workflow_deployment_serialization.py +1 -1
  237. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +0 -2
  238. vellum_ee/workflows/display/tests/workflow_serialization/test_chat_message_dict_reference_serialization.py +22 -1
  239. vellum_ee/workflows/display/tests/workflow_serialization/test_chat_message_trigger_serialization.py +412 -0
  240. vellum_ee/workflows/display/tests/workflow_serialization/test_code_tool_node_reference_error.py +106 -0
  241. vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +9 -41
  242. vellum_ee/workflows/display/tests/workflow_serialization/test_duplicate_trigger_name_validation.py +208 -0
  243. vellum_ee/workflows/display/tests/workflow_serialization/test_final_output_node_not_referenced_by_workflow_outputs.py +45 -0
  244. vellum_ee/workflows/display/tests/workflow_serialization/test_infinite_loop_validation.py +66 -0
  245. vellum_ee/workflows/display/tests/workflow_serialization/test_int_input_serialization.py +40 -0
  246. vellum_ee/workflows/display/tests/workflow_serialization/test_integration_trigger_serialization.py +8 -14
  247. vellum_ee/workflows/display/tests/workflow_serialization/test_integration_trigger_validation.py +173 -0
  248. vellum_ee/workflows/display/tests/workflow_serialization/test_integration_trigger_with_entrypoint_node_id.py +16 -13
  249. vellum_ee/workflows/display/tests/workflow_serialization/test_list_vellum_document_serialization.py +5 -1
  250. vellum_ee/workflows/display/tests/workflow_serialization/test_manual_trigger_serialization.py +12 -2
  251. vellum_ee/workflows/display/tests/workflow_serialization/test_multi_trigger_same_node_serialization.py +111 -0
  252. vellum_ee/workflows/display/tests/workflow_serialization/test_no_triggers_no_entrypoint_validation.py +64 -0
  253. vellum_ee/workflows/display/tests/workflow_serialization/test_partial_workflow_meta_display_override.py +55 -0
  254. vellum_ee/workflows/display/tests/workflow_serialization/test_sandbox_dataset_mocks_serialization.py +268 -0
  255. vellum_ee/workflows/display/tests/workflow_serialization/test_sandbox_invalid_pdf_data_url.py +49 -0
  256. vellum_ee/workflows/display/tests/workflow_serialization/test_sandbox_validation_errors.py +112 -0
  257. vellum_ee/workflows/display/tests/workflow_serialization/test_scheduled_trigger_serialization.py +25 -16
  258. vellum_ee/workflows/display/tests/workflow_serialization/test_terminal_node_in_unused_graphs_serialization.py +53 -0
  259. vellum_ee/workflows/display/utils/exceptions.py +34 -0
  260. vellum_ee/workflows/display/utils/expressions.py +463 -52
  261. vellum_ee/workflows/display/utils/metadata.py +98 -33
  262. vellum_ee/workflows/display/utils/tests/test_metadata.py +31 -0
  263. vellum_ee/workflows/display/utils/triggers.py +153 -0
  264. vellum_ee/workflows/display/utils/vellum.py +59 -5
  265. vellum_ee/workflows/display/workflows/base_workflow_display.py +656 -254
  266. vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py +26 -0
  267. vellum_ee/workflows/display/workflows/tests/test_workflow_display.py +77 -29
  268. vellum_ee/workflows/server/namespaces.py +18 -0
  269. vellum_ee/workflows/tests/test_display_meta.py +2 -0
  270. vellum_ee/workflows/tests/test_serialize_module.py +174 -7
  271. vellum_ee/workflows/tests/test_server.py +0 -3
  272. vellum_ee/workflows/display/nodes/vellum/function_node.py +0 -14
  273. {vellum_ai-1.11.2.dist-info → vellum_ai-1.13.5.dist-info}/LICENSE +0 -0
  274. {vellum_ai-1.11.2.dist-info → vellum_ai-1.13.5.dist-info}/WHEEL +0 -0
  275. {vellum_ai-1.11.2.dist-info → vellum_ai-1.13.5.dist-info}/entry_points.txt +0 -0
@@ -40,22 +40,12 @@ def test_serialize_workflow_with_filepath():
40
40
 
41
41
  # AND its raw data should be what we expect
42
42
  workflow_raw_data = serialized_workflow["workflow_raw_data"]
43
- assert len(workflow_raw_data["edges"]) == 3
44
- assert len(workflow_raw_data["nodes"]) == 4
45
43
 
46
44
  # AND each node should be serialized correctly
47
- entrypoint_node = workflow_raw_data["nodes"][0]
48
- assert entrypoint_node == {
49
- "id": "bd18f11c-5f7a-45d5-9970-0b1cf10d3761",
50
- "type": "ENTRYPOINT",
51
- "inputs": [],
52
- "data": {"label": "Entrypoint Node", "source_handle_id": "118e4298-aa79-467c-b8b4-2df540905e86"},
53
- "display_data": {"position": {"x": 0.0, "y": -50.0}},
54
- "base": None,
55
- "definition": None,
56
- }
57
45
 
58
- code_execution_node = workflow_raw_data["nodes"][1]
46
+ code_execution_node = next(
47
+ n for n in workflow_raw_data["nodes"] if (n.get("base") or {}).get("name") == "CodeExecutionNode"
48
+ )
59
49
  assert code_execution_node == {
60
50
  "id": "b4a0526b-0e31-4f63-892a-6d5197d09acf",
61
51
  "type": "CODE_EXECUTION",
@@ -115,127 +105,22 @@ def test_serialize_workflow_with_filepath():
115
105
  "merge_behavior": "AWAIT_ANY",
116
106
  },
117
107
  "ports": [{"id": "6aed9e19-9d26-457b-966d-0a9112f84070", "name": "default", "type": "DEFAULT"}],
118
- }
119
- assert not DeepDiff(
120
- [
108
+ "outputs": [
121
109
  {
122
- "id": "994d5c2e-00d2-4dff-9a9d-804766d03698",
123
- "type": "TERMINAL",
124
- "data": {
125
- "label": "Final Output",
126
- "name": "result",
127
- "target_handle_id": "30fb0f4a-61c3-49de-a0aa-7dfdcee6ea07",
128
- "output_id": "f6a3e3e0-f83f-4491-8b7a-b20fddd7160c",
129
- "output_type": "NUMBER",
130
- "node_input_id": "529bdd20-0985-4c99-87dc-590907937c1d",
131
- },
132
- "inputs": [
133
- {
134
- "id": "529bdd20-0985-4c99-87dc-590907937c1d",
135
- "key": "node_input",
136
- "value": {
137
- "rules": [
138
- {
139
- "type": "NODE_OUTPUT",
140
- "data": {
141
- "node_id": "b4a0526b-0e31-4f63-892a-6d5197d09acf",
142
- "output_id": "730c8f17-891c-40b4-b43d-26672bd38eef",
143
- },
144
- }
145
- ],
146
- "combinator": "OR",
147
- },
148
- }
149
- ],
150
- "display_data": {"position": {"x": 400.0, "y": -175.0}},
151
- "base": {
152
- "name": "FinalOutputNode",
153
- "module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
154
- },
155
- "definition": None,
110
+ "id": "730c8f17-891c-40b4-b43d-26672bd38eef",
111
+ "name": "result",
112
+ "schema": {"type": "integer"},
113
+ "type": "NUMBER",
114
+ "value": None,
156
115
  },
157
116
  {
158
- "id": "c6e3aced-1fc9-48d2-ae55-d2a880e359cb",
159
- "type": "TERMINAL",
160
- "data": {
161
- "label": "Final Output",
162
- "name": "log",
163
- "target_handle_id": "1e126004-9de7-42c0-b1e1-87f9eb0642e2",
164
- "output_id": "1cee930f-342f-421c-89fc-ff212b3764bb",
165
- "output_type": "STRING",
166
- "node_input_id": "09501b65-d9b3-4920-81d4-96f93c840667",
167
- },
168
- "inputs": [
169
- {
170
- "id": "09501b65-d9b3-4920-81d4-96f93c840667",
171
- "key": "node_input",
172
- "value": {
173
- "rules": [
174
- {
175
- "type": "NODE_OUTPUT",
176
- "data": {
177
- "node_id": "b4a0526b-0e31-4f63-892a-6d5197d09acf",
178
- "output_id": "8eea2893-1e79-4d1c-ba51-2e045968abfb",
179
- },
180
- }
181
- ],
182
- "combinator": "OR",
183
- },
184
- }
185
- ],
186
- "display_data": {"position": {"x": 400.0, "y": 75.0}},
187
- "base": {
188
- "name": "FinalOutputNode",
189
- "module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
190
- },
191
- "definition": None,
117
+ "id": "8eea2893-1e79-4d1c-ba51-2e045968abfb",
118
+ "name": "log",
119
+ "schema": {"type": "string"},
120
+ "type": "STRING",
121
+ "value": None,
192
122
  },
193
123
  ],
194
- workflow_raw_data["nodes"][2:],
195
- ignore_order=True,
196
- )
197
-
198
- # AND each edge should be serialized correctly
199
- serialized_edges = workflow_raw_data["edges"]
200
- assert not DeepDiff(
201
- [
202
- {
203
- "id": "48e2c971-b780-436a-873a-3f775fc04ab3",
204
- "source_node_id": "bd18f11c-5f7a-45d5-9970-0b1cf10d3761",
205
- "source_handle_id": "118e4298-aa79-467c-b8b4-2df540905e86",
206
- "target_node_id": "b4a0526b-0e31-4f63-892a-6d5197d09acf",
207
- "target_handle_id": "f1ea9f65-e225-49cc-a779-6bd0797ba22a",
208
- "type": "DEFAULT",
209
- },
210
- {
211
- "id": "d1e66711-75b3-41c3-beb6-424894fdd307",
212
- "source_node_id": "b4a0526b-0e31-4f63-892a-6d5197d09acf",
213
- "source_handle_id": "6aed9e19-9d26-457b-966d-0a9112f84070",
214
- "target_node_id": "994d5c2e-00d2-4dff-9a9d-804766d03698",
215
- "target_handle_id": "30fb0f4a-61c3-49de-a0aa-7dfdcee6ea07",
216
- "type": "DEFAULT",
217
- },
218
- {
219
- "id": "67d4c43e-80f9-4875-b6ab-9ecbba19fc7a",
220
- "source_node_id": "b4a0526b-0e31-4f63-892a-6d5197d09acf",
221
- "source_handle_id": "6aed9e19-9d26-457b-966d-0a9112f84070",
222
- "target_node_id": "c6e3aced-1fc9-48d2-ae55-d2a880e359cb",
223
- "target_handle_id": "1e126004-9de7-42c0-b1e1-87f9eb0642e2",
224
- "type": "DEFAULT",
225
- },
226
- ],
227
- serialized_edges,
228
- ignore_order=True,
229
- )
230
-
231
- # AND the display data should be what we expect
232
- display_data = workflow_raw_data["display_data"]
233
- assert display_data == {
234
- "viewport": {
235
- "x": 0.0,
236
- "y": 0.0,
237
- "zoom": 1.0,
238
- }
239
124
  }
240
125
 
241
126
  # AND the definition should be what we expect
@@ -283,22 +168,12 @@ def test_serialize_workflow_with_code():
283
168
 
284
169
  # AND its raw data should be what we expect
285
170
  workflow_raw_data = serialized_workflow["workflow_raw_data"]
286
- assert len(workflow_raw_data["edges"]) == 3
287
- assert len(workflow_raw_data["nodes"]) == 4
288
171
 
289
172
  # AND each node should be serialized correctly
290
- entrypoint_node = workflow_raw_data["nodes"][0]
291
- assert entrypoint_node == {
292
- "id": "22555158-d8ba-41b4-a6fc-87c3b25bd073",
293
- "type": "ENTRYPOINT",
294
- "inputs": [],
295
- "data": {"label": "Entrypoint Node", "source_handle_id": "e82390bb-c68c-48c1-9f87-7fbfff494c45"},
296
- "display_data": {"position": {"x": 0.0, "y": -50.0}},
297
- "base": None,
298
- "definition": None,
299
- }
300
173
 
301
- code_execution_node = workflow_raw_data["nodes"][1]
174
+ code_execution_node = next(
175
+ n for n in workflow_raw_data["nodes"] if (n.get("base") or {}).get("name") == "CodeExecutionNode"
176
+ )
302
177
  assert code_execution_node == {
303
178
  "id": "ae9c5da6-242e-4e0d-abe6-344e2ada3ce3",
304
179
  "type": "CODE_EXECUTION",
@@ -351,127 +226,22 @@ def test_serialize_workflow_with_code():
351
226
  "merge_behavior": "AWAIT_ANY",
352
227
  },
353
228
  "ports": [{"id": "d2560e23-cbb6-4b73-b082-294982da72aa", "name": "default", "type": "DEFAULT"}],
354
- }
355
- assert not DeepDiff(
356
- [
229
+ "outputs": [
357
230
  {
358
- "id": "52f285fe-1f52-4920-b01b-499762b95220",
359
- "type": "TERMINAL",
360
- "data": {
361
- "label": "Final Output",
362
- "name": "result",
363
- "target_handle_id": "de8f2cc2-8c32-4782-87d5-4eb5afcd42e3",
364
- "output_id": "283d6849-f3ed-4beb-b261-cf70f90e8d10",
365
- "output_type": "NUMBER",
366
- "node_input_id": "101d5222-8578-413a-be80-b1acf7559a0d",
367
- },
368
- "inputs": [
369
- {
370
- "id": "101d5222-8578-413a-be80-b1acf7559a0d",
371
- "key": "node_input",
372
- "value": {
373
- "rules": [
374
- {
375
- "type": "NODE_OUTPUT",
376
- "data": {
377
- "node_id": "ae9c5da6-242e-4e0d-abe6-344e2ada3ce3",
378
- "output_id": "9b2b939b-c840-4e01-99c1-43a3418d7fb7",
379
- },
380
- }
381
- ],
382
- "combinator": "OR",
383
- },
384
- }
385
- ],
386
- "display_data": {"position": {"x": 400.0, "y": -175.0}},
387
- "base": {
388
- "name": "FinalOutputNode",
389
- "module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
390
- },
391
- "definition": None,
231
+ "id": "9b2b939b-c840-4e01-99c1-43a3418d7fb7",
232
+ "name": "result",
233
+ "schema": {"type": "integer"},
234
+ "type": "NUMBER",
235
+ "value": None,
392
236
  },
393
237
  {
394
- "id": "eccf97c7-e766-471f-9703-4d2595800e66",
395
- "type": "TERMINAL",
396
- "data": {
397
- "label": "Final Output",
398
- "name": "log",
399
- "target_handle_id": "6b7d7f2c-5cc8-4005-9e66-cdb2c97b1998",
400
- "output_id": "4c136180-050b-4422-a7a4-2a1c6729042c",
401
- "output_type": "STRING",
402
- "node_input_id": "de7ea5c4-da2f-4cfd-9192-0257d0f9ba53",
403
- },
404
- "inputs": [
405
- {
406
- "id": "de7ea5c4-da2f-4cfd-9192-0257d0f9ba53",
407
- "key": "node_input",
408
- "value": {
409
- "rules": [
410
- {
411
- "type": "NODE_OUTPUT",
412
- "data": {
413
- "node_id": "ae9c5da6-242e-4e0d-abe6-344e2ada3ce3",
414
- "output_id": "e3536bf9-cf37-4d16-b835-770a9ee6cc53",
415
- },
416
- }
417
- ],
418
- "combinator": "OR",
419
- },
420
- }
421
- ],
422
- "display_data": {"position": {"x": 400.0, "y": 75.0}},
423
- "base": {
424
- "name": "FinalOutputNode",
425
- "module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
426
- },
427
- "definition": None,
238
+ "id": "e3536bf9-cf37-4d16-b835-770a9ee6cc53",
239
+ "name": "log",
240
+ "schema": {"type": "string"},
241
+ "type": "STRING",
242
+ "value": None,
428
243
  },
429
244
  ],
430
- workflow_raw_data["nodes"][2:],
431
- ignore_order=True,
432
- )
433
-
434
- # AND each edge should be serialized correctly
435
- serialized_edges = workflow_raw_data["edges"]
436
- assert not DeepDiff(
437
- [
438
- {
439
- "id": "22dbd9cd-446a-4053-a815-a9a991f69282",
440
- "source_node_id": "22555158-d8ba-41b4-a6fc-87c3b25bd073",
441
- "source_handle_id": "e82390bb-c68c-48c1-9f87-7fbfff494c45",
442
- "target_node_id": "ae9c5da6-242e-4e0d-abe6-344e2ada3ce3",
443
- "target_handle_id": "e4a738e8-bbcf-47d2-b7c9-6a034dd412f0",
444
- "type": "DEFAULT",
445
- },
446
- {
447
- "id": "2ac757e4-87c3-402c-928f-a3845df10c9f",
448
- "source_node_id": "ae9c5da6-242e-4e0d-abe6-344e2ada3ce3",
449
- "source_handle_id": "d2560e23-cbb6-4b73-b082-294982da72aa",
450
- "target_node_id": "eccf97c7-e766-471f-9703-4d2595800e66",
451
- "target_handle_id": "6b7d7f2c-5cc8-4005-9e66-cdb2c97b1998",
452
- "type": "DEFAULT",
453
- },
454
- {
455
- "id": "fcc6353a-265c-4a65-9e70-4eb92a04e4e1",
456
- "source_node_id": "ae9c5da6-242e-4e0d-abe6-344e2ada3ce3",
457
- "source_handle_id": "d2560e23-cbb6-4b73-b082-294982da72aa",
458
- "target_node_id": "52f285fe-1f52-4920-b01b-499762b95220",
459
- "target_handle_id": "de8f2cc2-8c32-4782-87d5-4eb5afcd42e3",
460
- "type": "DEFAULT",
461
- },
462
- ],
463
- serialized_edges,
464
- ignore_order=True,
465
- )
466
-
467
- # AND the display data should be what we expect
468
- display_data = workflow_raw_data["display_data"]
469
- assert display_data == {
470
- "viewport": {
471
- "x": 0.0,
472
- "y": 0.0,
473
- "zoom": 1.0,
474
- }
475
245
  }
476
246
 
477
247
  # AND the definition should be what we expect
@@ -514,27 +284,12 @@ def test_serialize_workflow__try_wrapped():
514
284
 
515
285
  # AND its raw data should be what we expect
516
286
  workflow_raw_data = serialized_workflow["workflow_raw_data"]
517
- assert len(workflow_raw_data["edges"]) == 3
518
- assert len(workflow_raw_data["nodes"]) == 4
519
287
 
520
288
  # AND each node should be serialized correctly
521
- entrypoint_node = workflow_raw_data["nodes"][0]
522
- assert entrypoint_node == {
523
- "id": "1b300de0-cf41-493f-ab41-6fdadf406f6a",
524
- "type": "ENTRYPOINT",
525
- "inputs": [],
526
- "data": {
527
- "label": "Entrypoint Node",
528
- "source_handle_id": "8cd1e612-39aa-4471-88cf-f7999b713fa6",
529
- },
530
- "base": None,
531
- "definition": None,
532
- "display_data": {
533
- "position": {"x": 0.0, "y": -50.0},
534
- },
535
- }
536
289
 
537
- code_execution_node = workflow_raw_data["nodes"][1]
290
+ code_execution_node = next(
291
+ n for n in workflow_raw_data["nodes"] if (n.get("base") or {}).get("name") == "CodeExecutionNode"
292
+ )
538
293
  assert code_execution_node == {
539
294
  "id": "1c910367-dff1-4466-85bc-6a8ec4ca039d",
540
295
  "type": "CODE_EXECUTION",
@@ -615,128 +370,22 @@ def test_serialize_workflow__try_wrapped():
615
370
  "merge_behavior": "AWAIT_ANY",
616
371
  },
617
372
  "ports": [{"id": "dede45ee-e17a-447c-b1d3-ed0d29ff1057", "name": "default", "type": "DEFAULT"}],
618
- }
619
-
620
- final_output_nodes = workflow_raw_data["nodes"][2:]
621
- assert not DeepDiff(
622
- [
623
- {
624
- "id": "af4fc1ef-7701-43df-b5e7-4f354f707db2",
625
- "type": "TERMINAL",
626
- "data": {
627
- "label": "Final Output",
628
- "name": "log",
629
- "target_handle_id": "d243df8d-46f6-4928-ac31-7c775c5d73a9",
630
- "output_id": "5fbd27a0-9831-49c7-93c8-9c2a28c78696",
631
- "output_type": "STRING",
632
- "node_input_id": "a6ffaacf-1284-4e70-907e-042bb281e6fa",
633
- },
634
- "inputs": [
635
- {
636
- "id": "a6ffaacf-1284-4e70-907e-042bb281e6fa",
637
- "key": "node_input",
638
- "value": {
639
- "rules": [
640
- {
641
- "type": "NODE_OUTPUT",
642
- "data": {
643
- "node_id": "1c910367-dff1-4466-85bc-6a8ec4ca039d",
644
- "output_id": "0022691d-4707-476f-a9f5-4947b5e36f07",
645
- },
646
- }
647
- ],
648
- "combinator": "OR",
649
- },
650
- }
651
- ],
652
- "display_data": {"position": {"x": 400.0, "y": 75.0}},
653
- "base": {
654
- "name": "FinalOutputNode",
655
- "module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
656
- },
657
- "definition": None,
658
- },
373
+ "outputs": [
659
374
  {
660
- "id": "4cbfa5f7-fc12-4ab2-81cb-168c5caef4f0",
661
- "type": "TERMINAL",
662
- "data": {
663
- "label": "Final Output",
664
- "name": "result",
665
- "target_handle_id": "9c43709e-25cb-4548-b840-3fcf6a1c9f3e",
666
- "output_id": "400f9ffe-e700-4204-a810-e06123565947",
667
- "output_type": "NUMBER",
668
- "node_input_id": "2cbb7351-a3e8-4a6b-b33e-204b04da7ad6",
669
- },
670
- "inputs": [
671
- {
672
- "id": "2cbb7351-a3e8-4a6b-b33e-204b04da7ad6",
673
- "key": "node_input",
674
- "value": {
675
- "rules": [
676
- {
677
- "type": "NODE_OUTPUT",
678
- "data": {
679
- "node_id": "1c910367-dff1-4466-85bc-6a8ec4ca039d",
680
- "output_id": "a483823a-e856-4ad3-ab3b-cac3c2961536",
681
- },
682
- }
683
- ],
684
- "combinator": "OR",
685
- },
686
- }
687
- ],
688
- "display_data": {"position": {"x": 400.0, "y": -175.0}},
689
- "base": {
690
- "name": "FinalOutputNode",
691
- "module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
692
- },
693
- "definition": None,
694
- },
695
- ],
696
- sorted(final_output_nodes, key=lambda x: x["id"], reverse=True),
697
- )
698
-
699
- # AND each edge should be serialized correctly
700
- serialized_edges = workflow_raw_data["edges"]
701
- assert not DeepDiff(
702
- [
703
- {
704
- "id": "71c4cd73-1ce9-4261-96a1-dc40b70e62e4",
705
- "source_node_id": "1b300de0-cf41-493f-ab41-6fdadf406f6a",
706
- "source_handle_id": "8cd1e612-39aa-4471-88cf-f7999b713fa6",
707
- "target_node_id": "1c910367-dff1-4466-85bc-6a8ec4ca039d",
708
- "target_handle_id": "f4a58613-628e-4a6d-aeae-4f81cf96bbf4",
709
- "type": "DEFAULT",
375
+ "id": "a483823a-e856-4ad3-ab3b-cac3c2961536",
376
+ "name": "result",
377
+ "schema": {"type": "integer"},
378
+ "type": "NUMBER",
379
+ "value": None,
710
380
  },
711
381
  {
712
- "id": "ac96ad63-d91f-465c-9c52-629877e56492",
713
- "source_node_id": "1c910367-dff1-4466-85bc-6a8ec4ca039d",
714
- "source_handle_id": "dede45ee-e17a-447c-b1d3-ed0d29ff1057",
715
- "target_node_id": "af4fc1ef-7701-43df-b5e7-4f354f707db2",
716
- "target_handle_id": "d243df8d-46f6-4928-ac31-7c775c5d73a9",
717
- "type": "DEFAULT",
718
- },
719
- {
720
- "id": "636f4540-e0e3-4740-af72-45f78b700cf9",
721
- "source_node_id": "1c910367-dff1-4466-85bc-6a8ec4ca039d",
722
- "source_handle_id": "dede45ee-e17a-447c-b1d3-ed0d29ff1057",
723
- "target_node_id": "4cbfa5f7-fc12-4ab2-81cb-168c5caef4f0",
724
- "target_handle_id": "9c43709e-25cb-4548-b840-3fcf6a1c9f3e",
725
- "type": "DEFAULT",
382
+ "id": "0022691d-4707-476f-a9f5-4947b5e36f07",
383
+ "name": "log",
384
+ "schema": {"type": "string"},
385
+ "type": "STRING",
386
+ "value": None,
726
387
  },
727
388
  ],
728
- serialized_edges,
729
- ignore_order=True,
730
- )
731
-
732
- # AND the display data should be what we expect
733
- display_data = workflow_raw_data["display_data"]
734
- assert display_data == {
735
- "viewport": {
736
- "x": 0.0,
737
- "y": 0.0,
738
- "zoom": 1.0,
739
- }
740
389
  }
741
390
 
742
391
  # AND the definition should be what we expect