vellum-ai 0.13.19__py3-none-any.whl → 0.13.21__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.
Files changed (41) hide show
  1. vellum/__init__.py +2 -0
  2. vellum/client/core/client_wrapper.py +1 -1
  3. vellum/client/resources/test_suites/client.py +44 -8
  4. vellum/client/types/__init__.py +2 -0
  5. vellum/client/types/container_image_container_image_tag.py +21 -0
  6. vellum/client/types/container_image_read.py +2 -1
  7. vellum/types/container_image_container_image_tag.py +3 -0
  8. vellum/workflows/events/workflow.py +7 -7
  9. vellum/workflows/graph/graph.py +6 -0
  10. vellum/workflows/graph/tests/test_graph.py +24 -0
  11. vellum/workflows/nodes/bases/base.py +3 -2
  12. vellum/workflows/nodes/core/inline_subworkflow_node/node.py +52 -7
  13. vellum/workflows/runner/runner.py +3 -3
  14. vellum/workflows/types/generics.py +1 -1
  15. vellum/workflows/workflows/base.py +11 -11
  16. {vellum_ai-0.13.19.dist-info → vellum_ai-0.13.21.dist-info}/METADATA +1 -1
  17. {vellum_ai-0.13.19.dist-info → vellum_ai-0.13.21.dist-info}/RECORD +41 -38
  18. vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +2 -3
  19. vellum_ee/workflows/display/nodes/vellum/utils.py +1 -1
  20. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +9 -30
  21. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +22 -36
  22. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +35 -70
  23. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py +2 -2
  24. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py +2 -2
  25. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +2 -2
  26. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +24 -57
  27. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +4 -4
  28. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +2 -2
  29. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +2 -2
  30. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py +2 -2
  31. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +4 -4
  32. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py +2 -2
  33. vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +2 -2
  34. vellum_ee/workflows/display/utils/vellum.py +7 -2
  35. vellum_ee/workflows/display/vellum.py +0 -2
  36. vellum_ee/workflows/display/workflows/tests/test_workflow_display.py +65 -0
  37. vellum_ee/workflows/display/workflows/vellum_workflow_display.py +11 -15
  38. vellum_ee/workflows/tests/local_workflow/display/workflow.py +0 -2
  39. {vellum_ai-0.13.19.dist-info → vellum_ai-0.13.21.dist-info}/LICENSE +0 -0
  40. {vellum_ai-0.13.19.dist-info → vellum_ai-0.13.21.dist-info}/WHEEL +0 -0
  41. {vellum_ai-0.13.19.dist-info → vellum_ai-0.13.21.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,65 @@
1
+ import pytest
2
+
3
+ from vellum.workflows.nodes.bases.base import BaseNode
4
+ from vellum.workflows.workflows.base import BaseWorkflow
5
+ from vellum_ee.workflows.display.workflows import VellumWorkflowDisplay
6
+ from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
7
+
8
+
9
+ def test_serialize_workflow__node_referenced_in_workflow_outputs_not_in_graph():
10
+ # GIVEN a couple of nodes
11
+ class InNode(BaseNode):
12
+ pass
13
+
14
+ class OutNode(BaseNode):
15
+ class Outputs(BaseNode.Outputs):
16
+ foo: str
17
+
18
+ # AND A workflow that references the OutNode in its outputs but only has the InNode in its graph
19
+ class Workflow(BaseWorkflow):
20
+ graph = InNode
21
+
22
+ class Outputs(BaseWorkflow.Outputs):
23
+ final = OutNode.Outputs.foo
24
+
25
+ # WHEN we serialize it
26
+ workflow_display = get_workflow_display(
27
+ base_display_class=VellumWorkflowDisplay,
28
+ workflow_class=Workflow,
29
+ )
30
+
31
+ # THEN it should raise an error
32
+ with pytest.raises(ValueError) as exc_info:
33
+ workflow_display.serialize()
34
+
35
+ # AND the error message should be user friendly
36
+ assert str(exc_info.value) == "Failed to serialize output 'final': Reference to node 'OutNode' not found in graph."
37
+
38
+
39
+ def test_serialize_workflow__workflow_outputs_reference_non_node_outputs():
40
+ # GIVEN one Workflow
41
+ class FirstWorkflow(BaseWorkflow):
42
+ class Outputs(BaseWorkflow.Outputs):
43
+ foo = "bar"
44
+
45
+ # AND A workflow that references the Outputs of that Workflow
46
+ class Workflow(BaseWorkflow):
47
+ class Outputs(BaseWorkflow.Outputs):
48
+ final = FirstWorkflow.Outputs.foo
49
+
50
+ # WHEN we serialize it
51
+ workflow_display = get_workflow_display(
52
+ base_display_class=VellumWorkflowDisplay,
53
+ workflow_class=Workflow,
54
+ )
55
+
56
+ # THEN it should raise an error
57
+ with pytest.raises(ValueError) as exc_info:
58
+ workflow_display.serialize()
59
+
60
+ # AND the error message should be user friendly
61
+ assert (
62
+ str(exc_info.value)
63
+ == """Failed to serialize output 'final': Reference to outputs \
64
+ 'test_serialize_workflow__workflow_outputs_reference_non_node_outputs.<locals>.FirstWorkflow.Outputs' is invalid."""
65
+ )
@@ -129,14 +129,16 @@ class VellumWorkflowDisplay(
129
129
 
130
130
  if workflow_output.instance not in final_output_node_outputs:
131
131
  # Create a synthetic terminal node only if there is no terminal node for this output
132
- node_input = create_node_input(
133
- final_output_node_id,
134
- "node_input",
135
- # This is currently the wrapper node's output, but we want the wrapped node
136
- workflow_output.instance,
137
- self.display_context,
138
- workflow_output_display.node_input_id,
139
- )
132
+ try:
133
+ node_input = create_node_input(
134
+ final_output_node_id,
135
+ "node_input",
136
+ # This is currently the wrapper node's output, but we want the wrapped node
137
+ workflow_output.instance,
138
+ self.display_context,
139
+ )
140
+ except ValueError as e:
141
+ raise ValueError(f"Failed to serialize output '{workflow_output.name}': {str(e)}") from e
140
142
 
141
143
  source_node_display: Optional[BaseNodeDisplay]
142
144
  first_rule = node_input.value.rules[0]
@@ -182,7 +184,7 @@ class VellumWorkflowDisplay(
182
184
 
183
185
  synthetic_output_edges.append(
184
186
  {
185
- "id": str(workflow_output_display.edge_id),
187
+ "id": str(uuid4_from_hash(f"{self.workflow_id}|edge_id|{workflow_output_display.name}")),
186
188
  "source_node_id": str(source_node_display.node_id),
187
189
  "source_handle_id": str(source_handle_id),
188
190
  "target_node_id": str(workflow_output_display.node_id),
@@ -323,26 +325,20 @@ class VellumWorkflowDisplay(
323
325
  name=overrides.name,
324
326
  label=overrides.label,
325
327
  node_id=overrides.node_id,
326
- node_input_id=overrides.node_input_id,
327
328
  target_handle_id=overrides.target_handle_id,
328
- edge_id=overrides.edge_id,
329
329
  display_data=overrides.display_data,
330
330
  )
331
331
 
332
332
  output_id = uuid4_from_hash(f"{self.workflow_id}|id|{output.name}")
333
- edge_id = uuid4_from_hash(f"{self.workflow_id}|edge_id|{output.name}")
334
333
  node_id = uuid4_from_hash(f"{self.workflow_id}|node_id|{output.name}")
335
- node_input_id = uuid4_from_hash(f"{self.workflow_id}|node_input_id|{output.name}")
336
334
  target_handle_id = uuid4_from_hash(f"{self.workflow_id}|target_handle_id|{output.name}")
337
335
 
338
336
  return WorkflowOutputVellumDisplay(
339
337
  id=output_id,
340
338
  node_id=node_id,
341
- node_input_id=node_input_id,
342
339
  name=output.name,
343
340
  label="Final Output",
344
341
  target_handle_id=target_handle_id,
345
- edge_id=edge_id,
346
342
  display_data=NodeDisplayData(),
347
343
  )
348
344
 
@@ -48,11 +48,9 @@ class WorkflowDisplay(VellumWorkflowDisplay[Workflow]):
48
48
  Workflow.Outputs.final_output: WorkflowOutputVellumDisplayOverrides(
49
49
  id=UUID("5469b810-6ea6-4362-9e79-e360d44a1405"),
50
50
  node_id=UUID("f3ef4b2b-fec9-4026-9cc6-e5eac295307f"),
51
- node_input_id=UUID("fe6cba85-2423-4b5e-8f85-06311a8be5fb"),
52
51
  name="final-output",
53
52
  label="Final Output",
54
53
  target_handle_id=UUID("3ec34f6e-da48-40d5-a65b-a48fefa75763"),
55
54
  display_data=NodeDisplayData(position=NodeDisplayPosition(x=2750, y=210), width=459, height=234),
56
- edge_id=UUID("417c56a4-cdc1-4f9d-a10c-b535163f51e8"),
57
55
  )
58
56
  }