vellum-ai 0.13.9__py3-none-any.whl → 0.13.10__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 (44) hide show
  1. vellum/client/core/client_wrapper.py +1 -1
  2. vellum/workflows/descriptors/utils.py +1 -1
  3. vellum/workflows/nodes/bases/base.py +1 -1
  4. vellum/workflows/nodes/displayable/api_node/node.py +4 -1
  5. vellum/workflows/nodes/displayable/bases/api_node/node.py +4 -1
  6. vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +4 -1
  7. vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +4 -0
  8. vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +4 -0
  9. vellum/workflows/nodes/displayable/bases/search_node.py +4 -0
  10. vellum/workflows/nodes/displayable/code_execution_node/node.py +4 -1
  11. vellum/workflows/nodes/displayable/conditional_node/node.py +4 -0
  12. vellum/workflows/nodes/displayable/final_output_node/node.py +4 -0
  13. vellum/workflows/nodes/displayable/guardrail_node/node.py +4 -1
  14. vellum/workflows/nodes/displayable/inline_prompt_node/node.py +4 -0
  15. vellum/workflows/nodes/displayable/merge_node/node.py +3 -1
  16. vellum/workflows/nodes/displayable/note_node/node.py +4 -0
  17. vellum/workflows/nodes/displayable/prompt_deployment_node/node.py +4 -0
  18. vellum/workflows/nodes/displayable/search_node/node.py +4 -0
  19. vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +4 -1
  20. {vellum_ai-0.13.9.dist-info → vellum_ai-0.13.10.dist-info}/METADATA +1 -1
  21. {vellum_ai-0.13.9.dist-info → vellum_ai-0.13.10.dist-info}/RECORD +44 -44
  22. vellum_ee/workflows/display/nodes/base_node_display.py +100 -0
  23. vellum_ee/workflows/display/nodes/vellum/base_node.py +34 -105
  24. vellum_ee/workflows/display/nodes/vellum/conditional_node.py +2 -1
  25. vellum_ee/workflows/display/nodes/vellum/try_node.py +7 -0
  26. vellum_ee/workflows/display/nodes/vellum/utils.py +0 -69
  27. vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +56 -0
  28. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/conftest.py +3 -2
  29. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +143 -26
  30. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +10 -10
  31. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_outputs_serialization.py +6 -6
  32. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +32 -34
  33. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +4 -4
  34. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +5 -5
  35. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py +1 -1
  36. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +6 -3
  37. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +6 -3
  38. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +3 -3
  39. vellum_ee/workflows/display/utils/vellum.py +74 -4
  40. vellum_ee/workflows/display/workflows/base_workflow_display.py +6 -4
  41. vellum_ee/workflows/display/workflows/vellum_workflow_display.py +0 -2
  42. {vellum_ai-0.13.9.dist-info → vellum_ai-0.13.10.dist-info}/LICENSE +0 -0
  43. {vellum_ai-0.13.9.dist-info → vellum_ai-0.13.10.dist-info}/WHEEL +0 -0
  44. {vellum_ai-0.13.9.dist-info → vellum_ai-0.13.10.dist-info}/entry_points.txt +0 -0
@@ -140,9 +140,12 @@ def test_serialize_workflow():
140
140
  "name": "StartNode",
141
141
  "module": ["tests", "workflows", "basic_inline_subworkflow", "workflow"],
142
142
  },
143
- "trigger": {"id": "a95a34f2-e894-4fb6-a2c9-15d12c1e3135", "merge_behavior": "AWAIT_ANY"},
143
+ "trigger": {
144
+ "id": "a95a34f2-e894-4fb6-a2c9-15d12c1e3135",
145
+ "merge_behavior": "AWAIT_ATTRIBUTES",
146
+ },
144
147
  "ports": [
145
- {"id": "4a62dea3-6a4a-4390-88d8-4af5d2c81474", "type": "DEFAULT", "name": "default"}
148
+ {"id": "1e739e86-a285-4438-9725-a152c15a63e3", "type": "DEFAULT", "name": "default"}
146
149
  ],
147
150
  "adornments": None,
148
151
  "attributes": [
@@ -271,7 +274,7 @@ def test_serialize_workflow():
271
274
  "source_node_id": "afa49a0f-db35-4552-9217-5b8f237e84bc",
272
275
  "source_handle_id": "9914a6a0-9a99-430d-8ddd-f7c13847fe1a",
273
276
  "target_node_id": "1381c078-efa2-4255-89a1-7b4cb742c7fc",
274
- "target_handle_id": "6492efcf-4437-4af1-9ad7-269795ccb27a",
277
+ "target_handle_id": "a95a34f2-e894-4fb6-a2c9-15d12c1e3135",
275
278
  "type": "DEFAULT",
276
279
  },
277
280
  {
@@ -129,9 +129,12 @@ def test_serialize_workflow():
129
129
  "name": "Iteration",
130
130
  "module": ["tests", "workflows", "basic_map_node", "workflow"],
131
131
  },
132
- "trigger": {"id": "01324747-9bc0-4ecd-a8ab-40dca5a94e2e", "merge_behavior": "AWAIT_ANY"},
132
+ "trigger": {
133
+ "id": "01324747-9bc0-4ecd-a8ab-40dca5a94e2e",
134
+ "merge_behavior": "AWAIT_ATTRIBUTES",
135
+ },
133
136
  "ports": [
134
- {"id": "36791877-95b0-4390-a794-10accd8f548e", "type": "DEFAULT", "name": "default"}
137
+ {"id": "71ada606-d791-4a59-a252-0795c5faeeaf", "type": "DEFAULT", "name": "default"}
135
138
  ],
136
139
  "adornments": None,
137
140
  "attributes": [
@@ -211,7 +214,7 @@ def test_serialize_workflow():
211
214
  "source_node_id": "ff9bfe6e-839d-4d40-b8fc-313b3bbd0ab0",
212
215
  "source_handle_id": "520d3616-8369-4e79-9da5-3febae299c2a",
213
216
  "target_node_id": "baf6d316-dc75-41e8-96c0-015aede96309",
214
- "target_handle_id": "551d5528-f4e1-42ea-bde0-9de4b4968253",
217
+ "target_handle_id": "01324747-9bc0-4ecd-a8ab-40dca5a94e2e",
215
218
  "type": "DEFAULT",
216
219
  },
217
220
  {
@@ -145,7 +145,7 @@ def test_serialize_workflow__await_all():
145
145
  "source_node_id": "dc8aecd0-49ba-4464-a45f-29d3bfd686e4",
146
146
  "source_handle_id": "017d40f5-8326-4e42-a409-b08995defaa8",
147
147
  "target_node_id": "59243c65-053f-4ea6-9157-3f3edb1477bf",
148
- "target_handle_id": "e622fe61-3bca-4aff-86e1-25dad7bdf9d4",
148
+ "target_handle_id": "75293c10-d6d8-4fc0-afae-ba6437af982e",
149
149
  "type": "DEFAULT",
150
150
  },
151
151
  {
@@ -153,7 +153,7 @@ def test_serialize_workflow__await_all():
153
153
  "source_node_id": "dc8aecd0-49ba-4464-a45f-29d3bfd686e4",
154
154
  "source_handle_id": "017d40f5-8326-4e42-a409-b08995defaa8",
155
155
  "target_node_id": "127ef456-91bc-43c6-bd8b-1772db5e3cb5",
156
- "target_handle_id": "e5cc41cb-71db-43ec-b3f0-c78706af3351",
156
+ "target_handle_id": "10c7392f-7dc0-4273-8380-ddc3497e6072",
157
157
  "type": "DEFAULT",
158
158
  },
159
159
  {
@@ -177,7 +177,7 @@ def test_serialize_workflow__await_all():
177
177
  "source_node_id": "37c10e8a-771b-432b-a767-31f5007851f0",
178
178
  "source_handle_id": "3bbc469f-0fb0-4b3d-a28b-746fefec2818",
179
179
  "target_node_id": "634f0202-9ea9-4c62-b152-1a58c595cffb",
180
- "target_handle_id": "acd48f48-54fb-4b2b-ab37-96d336f6dfb3",
180
+ "target_handle_id": "c0c993cd-1370-480b-b175-59590735aa46",
181
181
  "type": "DEFAULT",
182
182
  },
183
183
  {
@@ -1,7 +1,32 @@
1
- from typing import Any, TypeVar
1
+ from typing import TYPE_CHECKING, Any
2
2
 
3
+ from vellum.client.types.logical_operator import LogicalOperator
3
4
  from vellum.client.types.vellum_variable_type import VellumVariableType
4
5
  from vellum.workflows.descriptors.base import BaseDescriptor
6
+ from vellum.workflows.expressions.and_ import AndExpression
7
+ from vellum.workflows.expressions.begins_with import BeginsWithExpression
8
+ from vellum.workflows.expressions.between import BetweenExpression
9
+ from vellum.workflows.expressions.contains import ContainsExpression
10
+ from vellum.workflows.expressions.does_not_begin_with import DoesNotBeginWithExpression
11
+ from vellum.workflows.expressions.does_not_contain import DoesNotContainExpression
12
+ from vellum.workflows.expressions.does_not_end_with import DoesNotEndWithExpression
13
+ from vellum.workflows.expressions.does_not_equal import DoesNotEqualExpression
14
+ from vellum.workflows.expressions.ends_with import EndsWithExpression
15
+ from vellum.workflows.expressions.equals import EqualsExpression
16
+ from vellum.workflows.expressions.greater_than import GreaterThanExpression
17
+ from vellum.workflows.expressions.greater_than_or_equal_to import GreaterThanOrEqualToExpression
18
+ from vellum.workflows.expressions.in_ import InExpression
19
+ from vellum.workflows.expressions.is_nil import IsNilExpression
20
+ from vellum.workflows.expressions.is_not_nil import IsNotNilExpression
21
+ from vellum.workflows.expressions.is_not_null import IsNotNullExpression
22
+ from vellum.workflows.expressions.is_not_undefined import IsNotUndefinedExpression
23
+ from vellum.workflows.expressions.is_null import IsNullExpression
24
+ from vellum.workflows.expressions.is_undefined import IsUndefinedExpression
25
+ from vellum.workflows.expressions.less_than import LessThanExpression
26
+ from vellum.workflows.expressions.less_than_or_equal_to import LessThanOrEqualToExpression
27
+ from vellum.workflows.expressions.not_between import NotBetweenExpression
28
+ from vellum.workflows.expressions.not_in import NotInExpression
29
+ from vellum.workflows.expressions.or_ import OrExpression
5
30
  from vellum.workflows.nodes.displayable.bases.utils import primitive_to_vellum_value
6
31
  from vellum.workflows.references import OutputReference, WorkflowInputReference
7
32
  from vellum.workflows.references.execution_count import ExecutionCountReference
@@ -9,7 +34,6 @@ from vellum.workflows.references.node import NodeReference
9
34
  from vellum.workflows.references.vellum_secret import VellumSecretReference
10
35
  from vellum.workflows.utils.vellum_variables import primitive_type_to_vellum_variable_type
11
36
  from vellum.workflows.vellum_client import create_vellum_client
12
- from vellum_ee.workflows.display.types import WorkflowDisplayContext
13
37
  from vellum_ee.workflows.display.vellum import (
14
38
  ConstantValuePointer,
15
39
  ExecutionCounterData,
@@ -23,7 +47,8 @@ from vellum_ee.workflows.display.vellum import (
23
47
  WorkspaceSecretPointer,
24
48
  )
25
49
 
26
- _T = TypeVar("_T")
50
+ if TYPE_CHECKING:
51
+ from vellum_ee.workflows.display.types import WorkflowDisplayContext
27
52
 
28
53
 
29
54
  def infer_vellum_variable_type(value: Any) -> VellumVariableType:
@@ -47,7 +72,7 @@ def infer_vellum_variable_type(value: Any) -> VellumVariableType:
47
72
 
48
73
 
49
74
  def create_node_input_value_pointer_rule(
50
- value: Any, display_context: WorkflowDisplayContext
75
+ value: Any, display_context: "WorkflowDisplayContext"
51
76
  ) -> NodeInputValuePointerRule:
52
77
  if isinstance(value, OutputReference):
53
78
  upstream_node, output_display = display_context.global_node_output_displays[value]
@@ -82,3 +107,48 @@ def create_node_input_value_pointer_rule(
82
107
  return ConstantValuePointer(type="CONSTANT_VALUE", data=vellum_value)
83
108
 
84
109
  raise ValueError(f"Unsupported descriptor type: {value.__class__.__name__}")
110
+
111
+
112
+ def convert_descriptor_to_operator(descriptor: BaseDescriptor) -> LogicalOperator:
113
+ if isinstance(descriptor, EqualsExpression):
114
+ return "="
115
+ elif isinstance(descriptor, DoesNotEqualExpression):
116
+ return "!="
117
+ elif isinstance(descriptor, LessThanExpression):
118
+ return "<"
119
+ elif isinstance(descriptor, GreaterThanExpression):
120
+ return ">"
121
+ elif isinstance(descriptor, LessThanOrEqualToExpression):
122
+ return "<="
123
+ elif isinstance(descriptor, GreaterThanOrEqualToExpression):
124
+ return ">="
125
+ elif isinstance(descriptor, ContainsExpression):
126
+ return "contains"
127
+ elif isinstance(descriptor, BeginsWithExpression):
128
+ return "beginsWith"
129
+ elif isinstance(descriptor, EndsWithExpression):
130
+ return "endsWith"
131
+ elif isinstance(descriptor, DoesNotContainExpression):
132
+ return "doesNotContain"
133
+ elif isinstance(descriptor, DoesNotBeginWithExpression):
134
+ return "doesNotBeginWith"
135
+ elif isinstance(descriptor, DoesNotEndWithExpression):
136
+ return "doesNotEndWith"
137
+ elif isinstance(descriptor, (IsNullExpression, IsNilExpression, IsUndefinedExpression)):
138
+ return "null"
139
+ elif isinstance(descriptor, (IsNotNullExpression, IsNotNilExpression, IsNotUndefinedExpression)):
140
+ return "notNull"
141
+ elif isinstance(descriptor, InExpression):
142
+ return "in"
143
+ elif isinstance(descriptor, NotInExpression):
144
+ return "notIn"
145
+ elif isinstance(descriptor, BetweenExpression):
146
+ return "between"
147
+ elif isinstance(descriptor, NotBetweenExpression):
148
+ return "notBetween"
149
+ elif isinstance(descriptor, AndExpression):
150
+ return "and"
151
+ elif isinstance(descriptor, OrExpression):
152
+ return "or"
153
+ else:
154
+ raise ValueError(f"Unsupported descriptor type: {descriptor}")
@@ -207,11 +207,13 @@ class BaseWorkflowDisplay(
207
207
  # TODO: We should still serialize nodes that are in the workflow's directory but aren't used in the graph.
208
208
  # https://app.shortcut.com/vellum/story/5394
209
209
  for node in self._workflow.get_nodes():
210
- if node in global_node_displays:
211
- continue
212
210
  node_display = self._get_node_display(node)
213
- node_displays[node] = node_display
214
- global_node_displays[node] = node_display
211
+
212
+ if node not in node_displays:
213
+ node_displays[node] = node_display
214
+
215
+ if node not in global_node_displays:
216
+ global_node_displays[node] = node_display
215
217
 
216
218
  # Nodes wrapped in a decorator need to be in our node display dictionary for later retrieval
217
219
  inner_node = get_wrapped_node(node)
@@ -352,8 +352,6 @@ class VellumWorkflowDisplay(
352
352
 
353
353
  target_node_display = node_displays[target_node]
354
354
  target_node_id = target_node_display.node_id
355
-
356
- target_handle_id: UUID
357
355
  target_handle_id = target_node_display.get_target_handle_id_by_source_node_id(source_node_id)
358
356
 
359
357
  return self._generate_edge_display_from_source(