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
@@ -32,6 +32,7 @@ def test_serialize_workflow():
32
32
  "default": None,
33
33
  "required": True,
34
34
  "extensions": {"color": None},
35
+ "schema": {"type": "integer"},
35
36
  }
36
37
  ],
37
38
  input_variables,
@@ -55,122 +56,30 @@ def test_serialize_workflow():
55
56
 
56
57
  # AND its raw data should be what we expect
57
58
  workflow_raw_data = serialized_workflow["workflow_raw_data"]
58
- assert len(workflow_raw_data["edges"]) == 4
59
- assert len(workflow_raw_data["nodes"]) == 5
60
-
61
- # AND each node should be serialized correctly
62
- entrypoint_node = workflow_raw_data["nodes"][0]
63
- assert entrypoint_node == {
64
- "id": "10e90662-e998-421d-a5c9-ec16e37a8de1",
65
- "type": "ENTRYPOINT",
66
- "inputs": [],
67
- "data": {
68
- "label": "Entrypoint Node",
69
- "source_handle_id": "7d86498b-84ed-4feb-8e62-2188058c2c4e",
70
- },
71
- "display_data": {"position": {"x": 0.0, "y": -50.0}},
72
- "base": None,
73
- "definition": None,
74
- }
75
59
 
76
- error_node, error_index = next(
77
- (
78
- (node, index)
79
- for index, node in enumerate(workflow_raw_data["nodes"])
80
- if node.get("data", {}).get("label") == "Fail Node"
81
- ),
82
- (None, None),
83
- )
84
- assert not DeepDiff(
85
- {
86
- "id": "98597c0e-8951-4320-98ed-efd7f79c00cf",
87
- "type": "ERROR",
88
- "inputs": [
89
- {
90
- "id": "f7fc097f-db5b-48c1-8c33-391834678521",
91
- "key": "error_source_input_id",
92
- "value": {
93
- "rules": [
94
- {
95
- "type": "CONSTANT_VALUE",
96
- "data": {"type": "STRING", "value": "Input threshold was too low"},
97
- }
98
- ],
99
- "combinator": "OR",
100
- },
101
- }
102
- ],
103
- "data": {
104
- "label": "Fail Node",
105
- "target_handle_id": "865dcf9c-8fe8-44c0-bf36-2c92eb47927e",
106
- "error_source_input_id": "f7fc097f-db5b-48c1-8c33-391834678521",
107
- },
108
- "display_data": {"position": {"x": 400.0, "y": -175.0}},
109
- "base": {
110
- "name": "ErrorNode",
111
- "module": ["vellum", "workflows", "nodes", "core", "error_node", "node"],
112
- },
113
- "definition": {
114
- "name": "FailNode",
115
- "module": ["tests", "workflows", "basic_error_node", "workflow"],
116
- },
117
- "trigger": {
118
- "id": "865dcf9c-8fe8-44c0-bf36-2c92eb47927e",
119
- "merge_behavior": "AWAIT_ATTRIBUTES",
120
- },
121
- "ports": [],
122
- },
123
- error_node,
124
- ignore_order=True,
125
- )
60
+ # AND the error node should be serialized correctly
61
+ error_node = next(n for n in workflow_raw_data["nodes"] if (n.get("base") or {}).get("name") == "ErrorNode")
62
+
63
+ assert error_node["id"] == "98597c0e-8951-4320-98ed-efd7f79c00cf"
64
+ assert error_node["type"] == "ERROR"
65
+
66
+ assert error_node["base"]["name"] == "ErrorNode"
67
+ assert error_node["base"]["module"] == ["vellum", "workflows", "nodes", "core", "error_node", "node"]
68
+
69
+ assert error_node["definition"]["name"] == "FailNode"
70
+ assert error_node["definition"]["module"] == ["tests", "workflows", "basic_error_node", "workflow"]
71
+
72
+ assert error_node["trigger"]["id"] == "865dcf9c-8fe8-44c0-bf36-2c92eb47927e"
73
+ assert error_node["trigger"]["merge_behavior"] == "AWAIT_ATTRIBUTES"
74
+
75
+ assert error_node["ports"] == []
76
+
77
+ assert error_node["data"]["label"] == "Fail Node"
78
+ assert error_node["data"]["target_handle_id"] == "865dcf9c-8fe8-44c0-bf36-2c92eb47927e"
79
+ assert error_node["data"]["error_source_input_id"] == "f7fc097f-db5b-48c1-8c33-391834678521"
80
+
81
+ assert len(error_node["inputs"]) == 1
82
+ assert error_node["inputs"][0]["key"] == "error_source_input_id"
126
83
 
127
84
  passthrough_nodes = [node for node in workflow_raw_data["nodes"] if node["type"] == "GENERIC"]
128
85
  assert len(passthrough_nodes) == 2
129
-
130
- terminal_node = workflow_raw_data["nodes"][-1]
131
- assert not DeepDiff(
132
- {
133
- "id": "e5fff999-80c7-4cbc-9d99-06c653f3ec77",
134
- "type": "TERMINAL",
135
- "data": {
136
- "label": "Final Output",
137
- "name": "final_value",
138
- "target_handle_id": "b070e9bc-e9b7-46d3-8f5b-0b646bd25cf0",
139
- "output_id": "04c5c6be-f5e1-41b8-b668-39e179790d9e",
140
- "output_type": "NUMBER",
141
- "node_input_id": "c191a5c1-8912-49ad-bf4b-c6d4d58ed482",
142
- },
143
- "inputs": [
144
- {
145
- "id": "c191a5c1-8912-49ad-bf4b-c6d4d58ed482",
146
- "key": "node_input",
147
- "value": {
148
- "rules": [
149
- {
150
- "type": "NODE_OUTPUT",
151
- "data": {
152
- "node_id": "f490ecde-1679-414b-8db5-2b706be25669",
153
- "output_id": "29fbd4af-bb7f-40c3-a5c7-2bb47e12c534",
154
- },
155
- }
156
- ],
157
- "combinator": "OR",
158
- },
159
- }
160
- ],
161
- "display_data": {"position": {"x": 600.0, "y": -50.0}},
162
- "base": {
163
- "name": "FinalOutputNode",
164
- "module": [
165
- "vellum",
166
- "workflows",
167
- "nodes",
168
- "displayable",
169
- "final_output_node",
170
- "node",
171
- ],
172
- },
173
- "definition": None,
174
- },
175
- terminal_node,
176
- )
@@ -32,6 +32,7 @@ def test_serialize_workflow():
32
32
  "default": None,
33
33
  "required": True,
34
34
  "extensions": {"color": None},
35
+ "schema": {"type": "string"},
35
36
  },
36
37
  ],
37
38
  input_variables,
@@ -51,100 +52,10 @@ def test_serialize_workflow():
51
52
 
52
53
  # AND its raw data should be what we expect
53
54
  workflow_raw_data = serialized_workflow["workflow_raw_data"]
54
- assert len(workflow_raw_data["edges"]) == 2
55
- assert len(workflow_raw_data["nodes"]) == 3
56
55
 
57
- # AND each node should be serialized correctly
58
- entrypoint_node = workflow_raw_data["nodes"][0]
59
- assert entrypoint_node["id"] == "f1e4678f-c470-400b-a40e-c8922cc99a86"
60
- assert entrypoint_node["type"] == "ENTRYPOINT"
61
- assert entrypoint_node["inputs"] == []
62
- assert entrypoint_node["data"] == {
63
- "label": "Entrypoint Node",
64
- "source_handle_id": "40201804-8beb-43ad-8873-a027759512f1",
65
- }
66
- assert entrypoint_node["base"] is None
67
- assert entrypoint_node["definition"] is None
68
-
69
- api_node = workflow_raw_data["nodes"][1]
70
- assert api_node["id"] == "bf98371c-65d3-43c1-99a2-0f5369397847"
71
-
72
- final_output_node = workflow_raw_data["nodes"][2]
73
- assert not DeepDiff(
74
- {
75
- "id": "50e3b446-afcd-4a5d-8c6f-5f05eaf2200e",
76
- "type": "TERMINAL",
77
- "data": {
78
- "label": "Final Output",
79
- "name": "output",
80
- "target_handle_id": "8bd9f4f3-9f66-4d95-8e84-529b0002c531",
81
- "output_id": "2b6389d0-266a-4be4-843e-4e543dd3d727",
82
- "output_type": "STRING",
83
- "node_input_id": "545d6001-cfb5-4ccc-bcdf-3b03ccd67d90",
84
- },
85
- "inputs": [
86
- {
87
- "id": "545d6001-cfb5-4ccc-bcdf-3b03ccd67d90",
88
- "key": "node_input",
89
- "value": {
90
- "rules": [
91
- {
92
- "type": "NODE_OUTPUT",
93
- "data": {
94
- "node_id": "bf98371c-65d3-43c1-99a2-0f5369397847",
95
- "output_id": "83a720ef-d397-429b-8124-1db8286b3b00",
96
- },
97
- }
98
- ],
99
- "combinator": "OR",
100
- },
101
- }
102
- ],
103
- "display_data": {"position": {"x": 400.0, "y": -50.0}},
104
- "base": {
105
- "name": "FinalOutputNode",
106
- "module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
107
- },
108
- "definition": None,
109
- },
110
- final_output_node,
111
- ignore_order=True,
112
- )
113
-
114
- # AND each edge should be serialized correctly
115
- serialized_edges = workflow_raw_data["edges"]
116
- assert not DeepDiff(
117
- [
118
- {
119
- "id": "cd4d1a87-1fa2-46df-89fe-7fed9bb4600c",
120
- "source_node_id": "f1e4678f-c470-400b-a40e-c8922cc99a86",
121
- "source_handle_id": "40201804-8beb-43ad-8873-a027759512f1",
122
- "target_node_id": "bf98371c-65d3-43c1-99a2-0f5369397847",
123
- "target_handle_id": "43d9db30-98f6-4d75-a487-f74f3c660d8a",
124
- "type": "DEFAULT",
125
- },
126
- {
127
- "id": "b741c861-cf67-4649-b9ef-b43a4add72b1",
128
- "source_node_id": "bf98371c-65d3-43c1-99a2-0f5369397847",
129
- "source_handle_id": "f710ef29-a056-420d-9342-8f0ac79ce4ca",
130
- "target_node_id": "50e3b446-afcd-4a5d-8c6f-5f05eaf2200e",
131
- "target_handle_id": "8bd9f4f3-9f66-4d95-8e84-529b0002c531",
132
- "type": "DEFAULT",
133
- },
134
- ],
135
- serialized_edges,
136
- ignore_order=True,
137
- )
138
-
139
- # AND the display data should be what we expect
140
- display_data = workflow_raw_data["display_data"]
141
- assert display_data == {
142
- "viewport": {
143
- "x": 0.0,
144
- "y": 0.0,
145
- "zoom": 1.0,
146
- }
147
- }
56
+ # AND the generic node should be serialized correctly
57
+ generic_node = next(n for n in workflow_raw_data["nodes"] if (n.get("base") or {}).get("name") == "BaseNode")
58
+ assert generic_node["id"] == "bf98371c-65d3-43c1-99a2-0f5369397847"
148
59
 
149
60
  # AND the nodes should have been auto-positioned since they all started at (0,0)
150
61
  nodes = workflow_raw_data["nodes"]
@@ -32,6 +32,7 @@ def test_serialize_workflow():
32
32
  "required": True,
33
33
  "default": None,
34
34
  "extensions": {"color": None},
35
+ "schema": {"type": "string"},
35
36
  },
36
37
  {
37
38
  "id": "545ff95e-e86f-4d06-a991-602781e72605",
@@ -40,6 +41,7 @@ def test_serialize_workflow():
40
41
  "required": True,
41
42
  "default": None,
42
43
  "extensions": {"color": None},
44
+ "schema": {"type": "string"},
43
45
  },
44
46
  ],
45
47
  input_variables,
@@ -53,22 +55,13 @@ def test_serialize_workflow():
53
55
 
54
56
  # AND its raw data is what we expect
55
57
  workflow_raw_data = serialized_workflow["workflow_raw_data"]
56
- assert len(workflow_raw_data["nodes"]) == 3
57
- assert len(workflow_raw_data["edges"]) == 2
58
58
 
59
59
  # AND each node should be serialized correctly
60
- entrypoint_node = workflow_raw_data["nodes"][0]
61
- assert entrypoint_node == {
62
- "id": "54c5c7d0-ab86-4ae9-b0b8-ea9ca7b87c14",
63
- "type": "ENTRYPOINT",
64
- "base": None,
65
- "definition": None,
66
- "inputs": [],
67
- "data": {"label": "Entrypoint Node", "source_handle_id": "41840690-8d85-486e-a864-b0661ccf0f2e"},
68
- "display_data": {"position": {"x": 0.0, "y": -50.0}},
69
- }
70
-
71
- guardrail_node = workflow_raw_data["nodes"][1]
60
+ guardrail_node = next(
61
+ node
62
+ for node in workflow_raw_data["nodes"]
63
+ if node["type"] == "METRIC" and node["data"]["label"] == "Example Guardrail Node"
64
+ )
72
65
  assert guardrail_node == {
73
66
  "id": "7fef2bbc-cdfc-4f66-80eb-2a52ee52da5f",
74
67
  "type": "METRIC",
@@ -124,72 +117,6 @@ def test_serialize_workflow():
124
117
  "ports": [{"id": "baa8baa7-8849-4b96-a90d-c0545a60d3a8", "name": "default", "type": "DEFAULT"}],
125
118
  }
126
119
 
127
- final_output_node = workflow_raw_data["nodes"][2]
128
- assert final_output_node == {
129
- "id": "cbc7197e-67c9-4af5-b781-879c8fd3e4c9",
130
- "type": "TERMINAL",
131
- "base": {
132
- "module": [
133
- "vellum",
134
- "workflows",
135
- "nodes",
136
- "displayable",
137
- "final_output_node",
138
- "node",
139
- ],
140
- "name": "FinalOutputNode",
141
- },
142
- "definition": None,
143
- "data": {
144
- "label": "Final Output",
145
- "name": "score",
146
- "target_handle_id": "001b97f6-2bc8-4d1e-9572-028dcf17df4e",
147
- "output_id": "2abd2b3b-c301-4834-a43f-5db3604f8422",
148
- "output_type": "NUMBER",
149
- "node_input_id": "6321442a-0d0d-4e25-965d-c24ff24712c5",
150
- },
151
- "inputs": [
152
- {
153
- "id": "6321442a-0d0d-4e25-965d-c24ff24712c5",
154
- "key": "node_input",
155
- "value": {
156
- "rules": [
157
- {
158
- "type": "NODE_OUTPUT",
159
- "data": {
160
- "node_id": "7fef2bbc-cdfc-4f66-80eb-2a52ee52da5f",
161
- "output_id": "eb9c8043-4c04-467b-944e-633c54de6876",
162
- },
163
- }
164
- ],
165
- "combinator": "OR",
166
- },
167
- }
168
- ],
169
- "display_data": {"position": {"x": 400.0, "y": -50.0}},
170
- }
171
-
172
- # AND each edge should be serialized correctly
173
- serialized_edges = workflow_raw_data["edges"]
174
- assert serialized_edges == [
175
- {
176
- "id": "4737867f-1967-45a1-966b-a0bda81a583d",
177
- "source_node_id": "54c5c7d0-ab86-4ae9-b0b8-ea9ca7b87c14",
178
- "source_handle_id": "41840690-8d85-486e-a864-b0661ccf0f2e",
179
- "target_node_id": "7fef2bbc-cdfc-4f66-80eb-2a52ee52da5f",
180
- "target_handle_id": "53c299c7-1df2-4d54-bb0d-559a4947c16d",
181
- "type": "DEFAULT",
182
- },
183
- {
184
- "id": "5c456a17-a92b-4dad-9569-306043707c9f",
185
- "source_node_id": "7fef2bbc-cdfc-4f66-80eb-2a52ee52da5f",
186
- "source_handle_id": "baa8baa7-8849-4b96-a90d-c0545a60d3a8",
187
- "target_node_id": "cbc7197e-67c9-4af5-b781-879c8fd3e4c9",
188
- "target_handle_id": "001b97f6-2bc8-4d1e-9572-028dcf17df4e",
189
- "type": "DEFAULT",
190
- },
191
- ]
192
-
193
120
  # AND the display data is what we expect
194
121
  display_data = workflow_raw_data["display_data"]
195
122
  assert display_data == {"viewport": {"x": 0.0, "y": 0.0, "zoom": 1.0}}
@@ -39,6 +39,7 @@ def test_serialize_workflow():
39
39
  "default": None,
40
40
  "required": True,
41
41
  "extensions": {"color": None},
42
+ "schema": {"type": "string"},
42
43
  }
43
44
  ],
44
45
  input_variables,
@@ -50,7 +51,7 @@ def test_serialize_workflow():
50
51
  assert len(output_variables) == 2
51
52
  assert not DeepDiff(
52
53
  [
53
- {"id": "15a0ab89-8ed4-43b9-afa2-3c0b29d4dc3e", "key": "results", "type": "JSON"},
54
+ {"id": "15a0ab89-8ed4-43b9-afa2-3c0b29d4dc3e", "key": "results", "type": "ARRAY"},
54
55
  {"id": "0ef1608e-1737-41cc-9b90-a8e124138f70", "key": "json", "type": "JSON"},
55
56
  ],
56
57
  output_variables,
@@ -59,22 +60,10 @@ def test_serialize_workflow():
59
60
 
60
61
  # AND its raw data should be what we expect
61
62
  workflow_raw_data = serialized_workflow["workflow_raw_data"]
62
- assert len(workflow_raw_data["edges"]) == 3
63
- assert len(workflow_raw_data["nodes"]) == 4
64
63
 
65
64
  # AND each node should be serialized correctly
66
- entrypoint_node = workflow_raw_data["nodes"][0]
67
- assert entrypoint_node == {
68
- "id": "382842a3-0490-4dee-b87b-eef86766f07c",
69
- "type": "ENTRYPOINT",
70
- "inputs": [],
71
- "data": {"label": "Entrypoint Node", "source_handle_id": "8294baa6-8bf4-4b54-a56b-407b64851b77"},
72
- "display_data": {"position": {"x": 0.0, "y": -50.0}},
73
- "base": None,
74
- "definition": None,
75
- }
76
65
 
77
- prompt_node = workflow_raw_data["nodes"][1]
66
+ prompt_node = next(n for n in workflow_raw_data["nodes"] if (n.get("base") or {}).get("name") == "InlinePromptNode")
78
67
  assert not DeepDiff(
79
68
  {
80
69
  "id": "f800ecab-fe14-498f-88cf-8f67b3f04338",
@@ -115,7 +104,11 @@ def test_serialize_workflow():
115
104
  "custom_parameters": None,
116
105
  },
117
106
  "input_variables": [
118
- {"id": "15381676-75eb-4688-8ae1-7f9f937d6bb0", "key": "noun", "type": "STRING"}
107
+ {
108
+ "id": "15381676-75eb-4688-8ae1-7f9f937d6bb0",
109
+ "key": "noun",
110
+ "type": "STRING",
111
+ }
119
112
  ],
120
113
  "prompt_template_block_data": {
121
114
  "version": 1,
@@ -278,91 +271,6 @@ def test_serialize_workflow():
278
271
  ignore_order=True,
279
272
  )
280
273
 
281
- final_output_node = workflow_raw_data["nodes"][2]
282
- assert not DeepDiff(
283
- {
284
- "id": "42318326-3ae8-417f-9609-f6d8ae47eafb",
285
- "type": "TERMINAL",
286
- "data": {
287
- "label": "Final Output",
288
- "name": "results",
289
- "target_handle_id": "46c99277-2b4b-477d-851c-ea497aef6b16",
290
- "output_id": "15a0ab89-8ed4-43b9-afa2-3c0b29d4dc3e",
291
- "output_type": "JSON",
292
- "node_input_id": "d7c89dce-765b-494d-a256-aba4bcf87b42",
293
- },
294
- "inputs": [
295
- {
296
- "id": "d7c89dce-765b-494d-a256-aba4bcf87b42",
297
- "key": "node_input",
298
- "value": {
299
- "rules": [
300
- {
301
- "type": "NODE_OUTPUT",
302
- "data": {
303
- "node_id": "f800ecab-fe14-498f-88cf-8f67b3f04338",
304
- "output_id": "f5180d8d-89e4-479d-8baf-f6db8f9defa6",
305
- },
306
- }
307
- ],
308
- "combinator": "OR",
309
- },
310
- }
311
- ],
312
- "display_data": {"position": {"x": 400.0, "y": 75.0}},
313
- "base": {
314
- "name": "FinalOutputNode",
315
- "module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
316
- },
317
- "definition": None,
318
- },
319
- final_output_node,
320
- ignore_order=True,
321
- )
322
-
323
- # AND each edge should be serialized correctly
324
- serialized_edges = workflow_raw_data["edges"]
325
- assert not DeepDiff(
326
- [
327
- {
328
- "id": "bd2af66e-7724-45e1-8ab6-d37d5b2769f5",
329
- "source_node_id": "382842a3-0490-4dee-b87b-eef86766f07c",
330
- "source_handle_id": "8294baa6-8bf4-4b54-a56b-407b64851b77",
331
- "target_node_id": "f800ecab-fe14-498f-88cf-8f67b3f04338",
332
- "target_handle_id": "7040f290-6b61-4519-86f5-d004c38a6905",
333
- "type": "DEFAULT",
334
- },
335
- {
336
- "id": "05ca58fb-e02d-48d4-9207-2dad0833a25b",
337
- "source_node_id": "f800ecab-fe14-498f-88cf-8f67b3f04338",
338
- "source_handle_id": "6fad8947-ecce-498f-8160-46af26b75a81",
339
- "target_node_id": "42318326-3ae8-417f-9609-f6d8ae47eafb",
340
- "target_handle_id": "46c99277-2b4b-477d-851c-ea497aef6b16",
341
- "type": "DEFAULT",
342
- },
343
- {
344
- "id": "0b1a2960-4cd5-4045-844f-42b6c87487aa",
345
- "source_node_id": "f800ecab-fe14-498f-88cf-8f67b3f04338",
346
- "source_handle_id": "6fad8947-ecce-498f-8160-46af26b75a81",
347
- "target_node_id": "1f4e3b7b-6af1-42c8-ab33-05b0f01e2b62",
348
- "target_handle_id": "7d94907f-c840-4ced-b813-ee3b17f2a8a9",
349
- "type": "DEFAULT",
350
- },
351
- ],
352
- serialized_edges,
353
- ignore_order=True,
354
- )
355
-
356
- # AND the display data should be what we expect
357
- display_data = workflow_raw_data["display_data"]
358
- assert display_data == {
359
- "viewport": {
360
- "x": 0.0,
361
- "y": 0.0,
362
- "zoom": 1.0,
363
- }
364
- }
365
-
366
274
  # AND the definition should be what we expect
367
275
  definition = workflow_raw_data["definition"]
368
276
  assert definition == {
@@ -620,7 +528,7 @@ def test_inline_prompt_node__coalesce_expression_serialization():
620
528
  assert chat_history_entry["value"]["operator"] == "coalesce"
621
529
  assert chat_history_entry["value"]["lhs"] == {
622
530
  "type": "WORKFLOW_STATE",
623
- "state_variable_id": "6012a4f7-a8ff-464d-bd62-7c41fde06fa4",
531
+ "state_variable_id": "34dc3ea7-e44e-45ac-af42-8d765c4d3c00",
624
532
  }
625
533
  assert chat_history_entry["value"]["rhs"] == {
626
534
  "type": "CONSTANT_VALUE",