vellum-ai 0.10.1__py3-none-any.whl → 0.10.2__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ class BaseClientWrapper:
17
17
  headers: typing.Dict[str, str] = {
18
18
  "X-Fern-Language": "Python",
19
19
  "X-Fern-SDK-Name": "vellum-ai",
20
- "X-Fern-SDK-Version": "0.10.1",
20
+ "X-Fern-SDK-Version": "0.10.2",
21
21
  }
22
22
  headers["X_API_KEY"] = self.api_key
23
23
  return headers
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vellum-ai
3
- Version: 0.10.1
3
+ Version: 0.10.2
4
4
  Summary:
5
5
  License: MIT
6
6
  Requires-Python: >=3.9,<4.0
@@ -1,12 +1,12 @@
1
- vellum_cli/__init__.py,sha256=i9jXzrSFcTGQJ5SgOv7_BZaMTgX_CSmNr5JoFIaTvJs,2204
1
+ vellum_cli/__init__.py,sha256=t62kIq0vDia8TTJqAmqFpYCo40buWNDQmjIDTOvmwwE,2416
2
2
  vellum_cli/aliased_group.py,sha256=ugW498j0yv4ALJ8vS9MsO7ctDW7Jlir9j6nE_uHAP8c,3363
3
3
  vellum_cli/config.py,sha256=urqMGQUkTntzdx-JV0P32FZVbqRZqgI-yFVmGPVblNI,3613
4
4
  vellum_cli/image_push.py,sha256=lCQhkQu-IlIMHNSynmEl5KUzO_dHW27NTAFWnyvPpcs,4419
5
5
  vellum_cli/logger.py,sha256=PuRFa0WCh4sAGFS5aqWB0QIYpS6nBWwPJrIXpWxugV4,1022
6
- vellum_cli/pull.py,sha256=nIjb0Ejv9IXDzxjTKj-G8J4V6wCh2gyd0AwXH_lW6TE,3065
6
+ vellum_cli/pull.py,sha256=op8HQmtiKa4TlrgEvhLiIac0Zhal6LETW22rhSkNHGE,3483
7
7
  vellum_cli/push.py,sha256=HhXHqLvWKf3CUZJ3yIm-KeoBkgk73EXqVtGgWYcBcVk,5089
8
8
  vellum_cli/tests/test_config.py,sha256=uvKGDc8BoVyT9_H0Z-g8469zVxomn6Oi3Zj-vK7O_wU,2631
9
- vellum_cli/tests/test_pull.py,sha256=osrjSMVs61rsfw6Ui7ZnzxSX4-VI64vKOQS7BY8zfIo,5126
9
+ vellum_cli/tests/test_pull.py,sha256=24sHYWNViS-G_UHmPC_-KXb6l3OOs2AiDGv2kKp4AHY,5815
10
10
  vellum_ee/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  vellum_ee/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  vellum_ee/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -23,7 +23,7 @@ vellum_ee/workflows/display/nodes/utils.py,sha256=sloya5TpXsnot1HURc9L51INwflRqU
23
23
  vellum_ee/workflows/display/nodes/vellum/__init__.py,sha256=WQ_KbMp__S41AUFDHt9dZU6IQLK9AizdGMi2M6eK2_8,1362
24
24
  vellum_ee/workflows/display/nodes/vellum/api_node.py,sha256=5mMO1rKDafoPtnFZciuFGGfbu8Ei-j4zRiEDx9oQG4I,8572
25
25
  vellum_ee/workflows/display/nodes/vellum/code_execution_node.py,sha256=VWFzPYzzNy4dSju0Gyegxx81A9cYjkN-dYqPTK3hCr4,3403
26
- vellum_ee/workflows/display/nodes/vellum/conditional_node.py,sha256=-DoU5wdR4rYYxkCXBGE0re0iOqLTOV-JY4D9UDEYoh8,10130
26
+ vellum_ee/workflows/display/nodes/vellum/conditional_node.py,sha256=3pVtCukiILTSZPUWuYLIwzwXGBSSUV4q--i0zlYxGKQ,10850
27
27
  vellum_ee/workflows/display/nodes/vellum/final_output_node.py,sha256=kR_z9ichhBtK_CLetqGjewmFmIFalfSiG2tQlM2T4yM,2772
28
28
  vellum_ee/workflows/display/nodes/vellum/guardrail_node.py,sha256=CiGZL1nxgK0KxLUgKilpollRYFIqqGHjSGXtvP1miqs,2168
29
29
  vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py,sha256=NuNoPnvwbdSRkTQA3clLySNSzqkK0nmU4L0zYqgIfFQ,7397
@@ -42,7 +42,7 @@ vellum_ee/workflows/display/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
42
42
  vellum_ee/workflows/display/tests/workflow_serialization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py,sha256=bLdJ0VVwAPDRvwaJMiMf0fRCuIWvvuRjAxKzddGPFyA,16871
44
44
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py,sha256=JnaxdIDMudwgO4zzB0uJlCDYvoD1lZaAxFQ9OYxUFoA,22716
45
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py,sha256=ojMpjIq89GqMN8rDSGgjNDReYOD2WvAofRooKVv7TU8,50681
45
+ vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py,sha256=0NxRo7KM_z8A1vgRgPISjCVFbYyKaeWCkgNldCkF6XY,53075
46
46
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py,sha256=FNmGO1hQjQOOejfSY-ErcMJXxvrxMyR7GZq4UX26UHA,8271
47
47
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py,sha256=2X8MzxZ3rf1lkx_e7Oez-qp4fvPZrdjulGAEOhbCMnY,21546
48
48
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py,sha256=ESalw3PsfGy42w85FJr9VDWg8Rpv9NT25OMHpye27bs,14967
@@ -68,7 +68,7 @@ vellum/client/README.md,sha256=8cKUE1kSuhz-U87n3-clA7o9_zlP0Avr4qKbvRbdT2k,5984
68
68
  vellum/client/__init__.py,sha256=Fu-wzw_MiTtqAQOFhcFcrLKAPkEfUhf6K4ZuFspfKUw,115305
69
69
  vellum/client/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
70
70
  vellum/client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
71
- vellum/client/core/client_wrapper.py,sha256=KTpqKvCVAPkVRUzzAODEnMHWvg_Pq-qDtpBSZW5qBxU,1890
71
+ vellum/client/core/client_wrapper.py,sha256=mQRFKZD2WpUTWabsoFG3brPhS2qJ4398Akys9PcuMV4,1890
72
72
  vellum/client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
73
73
  vellum/client/core/file.py,sha256=X9IbmkZmB2bB_DpmZAO3crWdXagOakAyn6UCOCImCPg,2322
74
74
  vellum/client/core/http_client.py,sha256=R0pQpCppnEtxccGvXl4uJ76s7ro_65Fo_erlNNLp_AI,19228
@@ -1343,8 +1343,8 @@ vellum/workflows/utils/vellum_variables.py,sha256=JA7hhbJ_9m7KEYFaCv5R6FqYeTRWDp
1343
1343
  vellum/workflows/vellum_client.py,sha256=ODrq_TSl-drX2aezXegf7pizpWDVJuTXH-j6528t75s,683
1344
1344
  vellum/workflows/workflows/__init__.py,sha256=KY45TqvavCCvXIkyCFMEc0dc6jTMOUci93U2DUrlZYc,66
1345
1345
  vellum/workflows/workflows/base.py,sha256=NbQ3jR9veKdfK5S9qPkiJvy16l19YyQxzops_Y09wMw,12872
1346
- vellum_ai-0.10.1.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1347
- vellum_ai-0.10.1.dist-info/METADATA,sha256=O42wdOBlrjLWVYPaen5pKq9eyquqvkNWdl1-m3TjrI4,5011
1348
- vellum_ai-0.10.1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
1349
- vellum_ai-0.10.1.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1350
- vellum_ai-0.10.1.dist-info/RECORD,,
1346
+ vellum_ai-0.10.2.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1347
+ vellum_ai-0.10.2.dist-info/METADATA,sha256=UPsNCcm_oVqPV4zmvlxPX4hSC_VUjpPJ7z5LcCF4rOY,5011
1348
+ vellum_ai-0.10.2.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
1349
+ vellum_ai-0.10.2.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1350
+ vellum_ai-0.10.2.dist-info/RECORD,,
vellum_cli/__init__.py CHANGED
@@ -43,9 +43,10 @@ def push(
43
43
  @main.command()
44
44
  @click.argument("module", required=False)
45
45
  @click.option("--legacy-module", is_flag=True, help="Pull the workflow as a legacy module")
46
- def pull(module: Optional[str], legacy_module: Optional[bool]) -> None:
46
+ @click.option("--include-json", is_flag=True, help="Include the JSON representation of the Workflow in the pull response. Should only be used for debugging purposes.")
47
+ def pull(module: Optional[str], legacy_module: Optional[bool], include_json: Optional[bool]) -> None:
47
48
  """Pull Workflow from Vellum"""
48
- pull_command(module, legacy_module)
49
+ pull_command(module, legacy_module, include_json)
49
50
 
50
51
 
51
52
  @main.group(aliases=["images", "image"])
vellum_cli/pull.py CHANGED
@@ -6,12 +6,14 @@ from typing import Optional
6
6
 
7
7
  from dotenv import load_dotenv
8
8
 
9
+ from vellum.workflows.vellum_client import create_vellum_client
9
10
  from vellum_cli.config import load_vellum_cli_config
10
11
  from vellum_cli.logger import load_cli_logger
11
- from vellum.workflows.vellum_client import create_vellum_client
12
12
 
13
13
 
14
- def pull_command(module: Optional[str], legacy_module: Optional[bool] = None) -> None:
14
+ def pull_command(
15
+ module: Optional[str], legacy_module: Optional[bool] = None, include_json: Optional[bool] = None
16
+ ) -> None:
15
17
  load_dotenv()
16
18
  logger = load_cli_logger()
17
19
  config = load_vellum_cli_config()
@@ -22,7 +24,9 @@ def pull_command(module: Optional[str], legacy_module: Optional[bool] = None) ->
22
24
  if len(config.workflows) > 1 and not module:
23
25
  raise ValueError("Multiple workflows found in project to pull. Pulling only a single workflow is supported.")
24
26
 
25
- workflow_config = next((w for w in config.workflows if w.module == module), None) if module else config.workflows[0]
27
+ workflow_config = (
28
+ next((w for w in config.workflows if w.module == module), None) if module else config.workflows[0]
29
+ )
26
30
  if workflow_config is None:
27
31
  raise ValueError(f"No workflow config for '{module}' found in project to push.")
28
32
 
@@ -31,9 +35,15 @@ def pull_command(module: Optional[str], legacy_module: Optional[bool] = None) ->
31
35
 
32
36
  logger.info(f"Pulling workflow into {workflow_config.module}")
33
37
  client = create_vellum_client()
38
+ query_parameters = {}
39
+ if legacy_module:
40
+ query_parameters["legacyModule"] = legacy_module
41
+ if include_json:
42
+ query_parameters["include_json"] = include_json
43
+
34
44
  response = client.workflows.pull(
35
45
  workflow_config.workflow_sandbox_id,
36
- request_options={"additional_query_parameters": {"legacyModule": legacy_module} if legacy_module else {}},
46
+ request_options={"additional_query_parameters": query_parameters},
37
47
  )
38
48
 
39
49
  zip_bytes = b"".join(response)
@@ -70,4 +80,7 @@ def pull_command(module: Optional[str], legacy_module: Optional[bool] = None) ->
70
80
  logger.info(f"Writing to {target_file}...")
71
81
  target.write(source.read().decode("utf-8"))
72
82
 
83
+ if include_json:
84
+ logger.warning("The pulled JSON representation of the Workflow should be used for debugging purposely only. Its schema should be considered unstable and subject to change at any time.")
85
+
73
86
  logger.info(f"Successfully pulled Workflow into {workflow_config.module}")
@@ -150,3 +150,21 @@ def test_pull__remove_missing_files__ignore_pattern(vellum_client, mock_module):
150
150
 
151
151
  # AND the tests/test_workflow.py file is untouched
152
152
  assert os.path.exists(test_file_path)
153
+
154
+
155
+ def test_pull__include_json(vellum_client, mock_module):
156
+ # GIVEN a module on the user's filesystem
157
+ _, module = mock_module
158
+
159
+ # AND the workflow pull API call returns a zip file
160
+ vellum_client.workflows.pull.return_value = iter(
161
+ [zip_file_map({"workflow.py": "print('hello')", "workflow.json": "{}"})]
162
+ )
163
+
164
+ # WHEN the user runs the pull command
165
+ pull_command(module, include_json=True)
166
+
167
+ # THEN the pull api is called with include_json=True
168
+ vellum_client.workflows.pull.assert_called_once()
169
+ call_args = vellum_client.workflows.pull.call_args.kwargs
170
+ assert call_args["request_options"]["additional_query_parameters"] == {"include_json": True}
@@ -40,10 +40,16 @@ class RuleIdMap:
40
40
  lhs: Optional["RuleIdMap"]
41
41
  rhs: Optional["RuleIdMap"]
42
42
 
43
+ @dataclass
44
+ class ConditionId:
45
+ id: UUID
46
+ rule_group_id: UUID
47
+
43
48
 
44
49
  class BaseConditionalNodeDisplay(BaseNodeVellumDisplay[_ConditionalNodeType], Generic[_ConditionalNodeType]):
45
50
  source_handle_ids: ClassVar[Dict[int, UUID]]
46
51
  rule_ids: ClassVar[List[RuleIdMap]]
52
+ condition_ids: ClassVar[list[ConditionId]]
47
53
 
48
54
  def serialize(self, display_context: WorkflowDisplayContext, **kwargs: Any) -> JsonObject:
49
55
  node = self._node
@@ -51,6 +57,13 @@ class BaseConditionalNodeDisplay(BaseNodeVellumDisplay[_ConditionalNodeType], Ge
51
57
 
52
58
  node_inputs: List[NodeInput] = []
53
59
  source_handle_ids = self._get_source_handle_ids() or {}
60
+ condition_ids = self._get_condition_ids()
61
+
62
+ ports_size = sum(1 for _ in node.Ports)
63
+
64
+ if len(condition_ids) > ports_size:
65
+ raise ValueError(
66
+ f"Too many defined condition ids. Ports are size {ports_size} but the defined conditions have length {len(condition_ids)}")
54
67
 
55
68
  def serialize_rule(
56
69
  descriptor: BaseDescriptor, path: List[int], rule_id_map: Optional[RuleIdMap]
@@ -132,7 +145,9 @@ class BaseConditionalNodeDisplay(BaseNodeVellumDisplay[_ConditionalNodeType], Ge
132
145
  if port._condition is None or port._condition_type is None:
133
146
  continue
134
147
 
135
- condition_id = str(uuid4_from_hash(f"{node_id}|conditions|{idx}"))
148
+
149
+ condition_id = str(condition_ids[idx].id if condition_ids else uuid4_from_hash(f"{node_id}|conditions|{idx}"))
150
+ rule_group_id = str(condition_ids[idx].rule_group_id if condition_ids else uuid4_from_hash(f"{condition_id}|rule_group"))
136
151
  source_handle_id = str(source_handle_ids.get(idx) or uuid4_from_hash(f"{node_id}|handles|{idx}"))
137
152
 
138
153
  rule_ids = self._get_rule_ids()
@@ -145,7 +160,7 @@ class BaseConditionalNodeDisplay(BaseNodeVellumDisplay[_ConditionalNodeType], Ge
145
160
  "type": port._condition_type.value,
146
161
  "source_handle_id": source_handle_id,
147
162
  "data": {
148
- "id": str(uuid4_from_hash(f"{condition_id}|rule_group")),
163
+ "id": rule_group_id,
149
164
  "rules": rules,
150
165
  "combinator": "AND",
151
166
  "negated": False,
@@ -215,3 +230,6 @@ class BaseConditionalNodeDisplay(BaseNodeVellumDisplay[_ConditionalNodeType], Ge
215
230
 
216
231
  def _get_rule_ids(self) -> List[RuleIdMap]:
217
232
  return self._get_explicit_node_display_attr("rule_ids", List[RuleIdMap]) or []
233
+
234
+ def _get_condition_ids(self)-> List[ConditionId]:
235
+ return self._get_explicit_node_display_attr("condition_ids", List[ConditionId]) or []
@@ -4,10 +4,16 @@ from unittest import mock
4
4
  from deepdiff import DeepDiff
5
5
 
6
6
  from tests.workflows.basic_conditional_node.workflow import CategoryWorkflow
7
- from tests.workflows.basic_conditional_node.workflow_with_only_one_conditional_node import create_simple_workflow
8
- from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
7
+ from tests.workflows.basic_conditional_node.workflow_with_only_one_conditional_node import (
8
+ create_simple_workflow,
9
+ )
10
+ from vellum_ee.workflows.display.nodes.base_node_vellum_display import (
11
+ BaseNodeVellumDisplay,
12
+ )
9
13
  from vellum_ee.workflows.display.workflows import VellumWorkflowDisplay
10
- from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
14
+ from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import (
15
+ get_workflow_display,
16
+ )
11
17
  from vellum.workflows.expressions.begins_with import BeginsWithExpression
12
18
  from vellum.workflows.expressions.between import BetweenExpression
13
19
  from vellum.workflows.expressions.contains import ContainsExpression
@@ -18,12 +24,16 @@ from vellum.workflows.expressions.does_not_equal import DoesNotEqualExpression
18
24
  from vellum.workflows.expressions.ends_with import EndsWithExpression
19
25
  from vellum.workflows.expressions.equals import EqualsExpression
20
26
  from vellum.workflows.expressions.greater_than import GreaterThanExpression
21
- from vellum.workflows.expressions.greater_than_or_equal_to import GreaterThanOrEqualToExpression
27
+ from vellum.workflows.expressions.greater_than_or_equal_to import (
28
+ GreaterThanOrEqualToExpression,
29
+ )
22
30
  from vellum.workflows.expressions.in_ import InExpression
23
31
  from vellum.workflows.expressions.is_not_null import IsNotNullExpression
24
32
  from vellum.workflows.expressions.is_null import IsNullExpression
25
33
  from vellum.workflows.expressions.less_than import LessThanExpression
26
- from vellum.workflows.expressions.less_than_or_equal_to import LessThanOrEqualToExpression
34
+ from vellum.workflows.expressions.less_than_or_equal_to import (
35
+ LessThanOrEqualToExpression,
36
+ )
27
37
  from vellum.workflows.expressions.not_between import NotBetweenExpression
28
38
  from vellum.workflows.expressions.not_in import NotInExpression
29
39
 
@@ -31,7 +41,9 @@ from vellum.workflows.expressions.not_in import NotInExpression
31
41
  def test_serialize_workflow():
32
42
  # GIVEN a Workflow that uses a ConditionalNode
33
43
  # WHEN we serialize it
34
- workflow_display = get_workflow_display(base_display_class=VellumWorkflowDisplay, workflow_class=CategoryWorkflow)
44
+ workflow_display = get_workflow_display(
45
+ base_display_class=VellumWorkflowDisplay, workflow_class=CategoryWorkflow
46
+ )
35
47
 
36
48
  # TODO: Support serialization of BaseNode
37
49
  # https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
@@ -69,11 +81,31 @@ def test_serialize_workflow():
69
81
  assert len(output_variables) == 5
70
82
  assert not DeepDiff(
71
83
  [
72
- {"id": "c05f7d96-59a0-4d58-93d7-d451afd3f630", "key": "question", "type": "STRING"},
73
- {"id": "93f2cb75-6fa2-4e46-9488-c0bcd29153c0", "key": "compliment", "type": "STRING"},
74
- {"id": "f936ae31-ba15-4864-8961-86231022a4d7", "key": "complaint", "type": "STRING"},
75
- {"id": "cdbe2adf-9951-409a-b9a8-b8b349037f4f", "key": "statement", "type": "STRING"},
76
- {"id": "62ad462f-f819-4940-99ab-b3f145507f57", "key": "fallthrough", "type": "STRING"},
84
+ {
85
+ "id": "c05f7d96-59a0-4d58-93d7-d451afd3f630",
86
+ "key": "question",
87
+ "type": "STRING",
88
+ },
89
+ {
90
+ "id": "93f2cb75-6fa2-4e46-9488-c0bcd29153c0",
91
+ "key": "compliment",
92
+ "type": "STRING",
93
+ },
94
+ {
95
+ "id": "f936ae31-ba15-4864-8961-86231022a4d7",
96
+ "key": "complaint",
97
+ "type": "STRING",
98
+ },
99
+ {
100
+ "id": "cdbe2adf-9951-409a-b9a8-b8b349037f4f",
101
+ "key": "statement",
102
+ "type": "STRING",
103
+ },
104
+ {
105
+ "id": "62ad462f-f819-4940-99ab-b3f145507f57",
106
+ "key": "fallthrough",
107
+ "type": "STRING",
108
+ },
77
109
  ],
78
110
  output_variables,
79
111
  ignore_order=True,
@@ -124,7 +156,9 @@ def test_serialize_workflow():
124
156
  "rules": [
125
157
  {
126
158
  "type": "INPUT_VARIABLE",
127
- "data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
159
+ "data": {
160
+ "input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
161
+ },
128
162
  }
129
163
  ],
130
164
  "combinator": "OR",
@@ -134,7 +168,12 @@ def test_serialize_workflow():
134
168
  "id": "1fb4cf46-f8b3-418f-be30-f7ec57f92285",
135
169
  "key": "708bb538-4c77-4ae9-8e87-0706346e2947.value",
136
170
  "value": {
137
- "rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "question"}}],
171
+ "rules": [
172
+ {
173
+ "type": "CONSTANT_VALUE",
174
+ "data": {"type": "STRING", "value": "question"},
175
+ }
176
+ ],
138
177
  "combinator": "OR",
139
178
  },
140
179
  },
@@ -145,7 +184,9 @@ def test_serialize_workflow():
145
184
  "rules": [
146
185
  {
147
186
  "type": "INPUT_VARIABLE",
148
- "data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
187
+ "data": {
188
+ "input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
189
+ },
149
190
  }
150
191
  ],
151
192
  "combinator": "OR",
@@ -155,7 +196,12 @@ def test_serialize_workflow():
155
196
  "id": "40957176-de6e-4131-bfa7-55c633312af0",
156
197
  "key": "ddee5d1d-46e9-4ae8-b0a8-311747ebadd4.value",
157
198
  "value": {
158
- "rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "complaint"}}],
199
+ "rules": [
200
+ {
201
+ "type": "CONSTANT_VALUE",
202
+ "data": {"type": "STRING", "value": "complaint"},
203
+ }
204
+ ],
159
205
  "combinator": "OR",
160
206
  },
161
207
  },
@@ -166,7 +212,9 @@ def test_serialize_workflow():
166
212
  "rules": [
167
213
  {
168
214
  "type": "INPUT_VARIABLE",
169
- "data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
215
+ "data": {
216
+ "input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
217
+ },
170
218
  }
171
219
  ],
172
220
  "combinator": "OR",
@@ -176,7 +224,12 @@ def test_serialize_workflow():
176
224
  "id": "93f06582-aff7-4ce5-8c60-f923090ffebc",
177
225
  "key": "73157578-205a-4816-8985-cf726063647c.value",
178
226
  "value": {
179
- "rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "compliment"}}],
227
+ "rules": [
228
+ {
229
+ "type": "CONSTANT_VALUE",
230
+ "data": {"type": "STRING", "value": "compliment"},
231
+ }
232
+ ],
180
233
  "combinator": "OR",
181
234
  },
182
235
  },
@@ -187,7 +240,9 @@ def test_serialize_workflow():
187
240
  "rules": [
188
241
  {
189
242
  "type": "INPUT_VARIABLE",
190
- "data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
243
+ "data": {
244
+ "input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
245
+ },
191
246
  }
192
247
  ],
193
248
  "combinator": "OR",
@@ -197,7 +252,12 @@ def test_serialize_workflow():
197
252
  "id": "e759091b-3609-4581-9014-5f46f438a4c9",
198
253
  "key": "e805add5-7f7f-443d-b9bc-11ad15eeb49c.value",
199
254
  "value": {
200
- "rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "statement"}}],
255
+ "rules": [
256
+ {
257
+ "type": "CONSTANT_VALUE",
258
+ "data": {"type": "STRING", "value": "statement"},
259
+ }
260
+ ],
201
261
  "combinator": "OR",
202
262
  },
203
263
  },
@@ -208,7 +268,9 @@ def test_serialize_workflow():
208
268
  "rules": [
209
269
  {
210
270
  "type": "INPUT_VARIABLE",
211
- "data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
271
+ "data": {
272
+ "input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
273
+ },
212
274
  }
213
275
  ],
214
276
  "combinator": "OR",
@@ -218,7 +280,12 @@ def test_serialize_workflow():
218
280
  "id": "e915cd85-ae55-48be-b31c-f2285db9db10",
219
281
  "key": "f47d72ff-665f-4143-ada3-6fa66f5bda42.value",
220
282
  "value": {
221
- "rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "statement"}}],
283
+ "rules": [
284
+ {
285
+ "type": "CONSTANT_VALUE",
286
+ "data": {"type": "STRING", "value": "statement"},
287
+ }
288
+ ],
222
289
  "combinator": "OR",
223
290
  },
224
291
  },
@@ -229,7 +296,9 @@ def test_serialize_workflow():
229
296
  "rules": [
230
297
  {
231
298
  "type": "INPUT_VARIABLE",
232
- "data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
299
+ "data": {
300
+ "input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
301
+ },
233
302
  }
234
303
  ],
235
304
  "combinator": "OR",
@@ -239,7 +308,12 @@ def test_serialize_workflow():
239
308
  "id": "e5d75ae4-cd46-437e-9695-9df2d79578b4",
240
309
  "key": "d3359d60-9bb4-4c6e-8009-b7ea46ab28a7.value",
241
310
  "value": {
242
- "rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "statement"}}],
311
+ "rules": [
312
+ {
313
+ "type": "CONSTANT_VALUE",
314
+ "data": {"type": "STRING", "value": "statement"},
315
+ }
316
+ ],
243
317
  "combinator": "OR",
244
318
  },
245
319
  },
@@ -377,8 +451,11 @@ def test_serialize_workflow():
377
451
  },
378
452
  "display_data": {"position": {"x": 0.0, "y": 0.0}},
379
453
  "definition": {
454
+ "name": "CategoryConditionalNode",
455
+ "module": ["tests", "workflows", "basic_conditional_node", "workflow"],
380
456
  "bases": [
381
457
  {
458
+ "name": "ConditionalNode",
382
459
  "module": [
383
460
  "vellum",
384
461
  "workflows",
@@ -387,16 +464,8 @@ def test_serialize_workflow():
387
464
  "conditional_node",
388
465
  "node",
389
466
  ],
390
- "name": "ConditionalNode",
391
467
  }
392
468
  ],
393
- "module": [
394
- "tests",
395
- "workflows",
396
- "basic_conditional_node",
397
- "workflow",
398
- ],
399
- "name": "CategoryConditionalNode",
400
469
  },
401
470
  },
402
471
  conditional_node,
@@ -860,11 +929,15 @@ def descriptors_with_value_and_start_and_end():
860
929
 
861
930
 
862
931
  @pytest.mark.parametrize("descriptor, operator", descriptors_with_lhs_and_rhs())
863
- def test_conditional_node_serialize_all_operators_with_lhs_and_rhs(descriptor, operator):
932
+ def test_conditional_node_serialize_all_operators_with_lhs_and_rhs(
933
+ descriptor, operator
934
+ ):
864
935
  # GIVEN a simple workflow with one conditional node
865
936
  workflow_cls = create_simple_workflow(descriptor)
866
937
 
867
- workflow_display = get_workflow_display(base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls)
938
+ workflow_display = get_workflow_display(
939
+ base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls
940
+ )
868
941
 
869
942
  # TODO: Support serialization of BaseNode
870
943
  # https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
@@ -894,7 +967,12 @@ def test_conditional_node_serialize_all_operators_with_lhs_and_rhs(descriptor, o
894
967
  "id": "2262b7b4-a2f2-408b-9d4d-362940ca1ed3",
895
968
  "key": "abe7afac-952f-4cfc-ab07-47b47f34105f.field",
896
969
  "value": {
897
- "rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "123"}}],
970
+ "rules": [
971
+ {
972
+ "type": "CONSTANT_VALUE",
973
+ "data": {"type": "STRING", "value": "123"},
974
+ }
975
+ ],
898
976
  "combinator": "OR",
899
977
  },
900
978
  },
@@ -902,7 +980,12 @@ def test_conditional_node_serialize_all_operators_with_lhs_and_rhs(descriptor, o
902
980
  "id": "aadade8a-c253-483a-8620-31fe8171c0fd",
903
981
  "key": "abe7afac-952f-4cfc-ab07-47b47f34105f.value",
904
982
  "value": {
905
- "rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "123"}}],
983
+ "rules": [
984
+ {
985
+ "type": "CONSTANT_VALUE",
986
+ "data": {"type": "STRING", "value": "123"},
987
+ }
988
+ ],
906
989
  "combinator": "OR",
907
990
  },
908
991
  },
@@ -972,7 +1055,9 @@ def test_conditional_node_serialize_all_operators_with_expression(descriptor, op
972
1055
  # GIVEN a simple workflow with one conditional node
973
1056
  workflow_cls = create_simple_workflow(descriptor)
974
1057
 
975
- workflow_display = get_workflow_display(base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls)
1058
+ workflow_display = get_workflow_display(
1059
+ base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls
1060
+ )
976
1061
 
977
1062
  # TODO: Support serialization of BaseNode
978
1063
  # https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
@@ -1002,7 +1087,12 @@ def test_conditional_node_serialize_all_operators_with_expression(descriptor, op
1002
1087
  "id": "2262b7b4-a2f2-408b-9d4d-362940ca1ed3",
1003
1088
  "key": "abe7afac-952f-4cfc-ab07-47b47f34105f.field",
1004
1089
  "value": {
1005
- "rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "123"}}],
1090
+ "rules": [
1091
+ {
1092
+ "type": "CONSTANT_VALUE",
1093
+ "data": {"type": "STRING", "value": "123"},
1094
+ }
1095
+ ],
1006
1096
  "combinator": "OR",
1007
1097
  },
1008
1098
  }
@@ -1067,12 +1157,18 @@ def test_conditional_node_serialize_all_operators_with_expression(descriptor, op
1067
1157
  )
1068
1158
 
1069
1159
 
1070
- @pytest.mark.parametrize("descriptor, operator", descriptors_with_value_and_start_and_end())
1071
- def test_conditional_node_serialize_all_operators_with_value_and_start_and_end(descriptor, operator):
1160
+ @pytest.mark.parametrize(
1161
+ "descriptor, operator", descriptors_with_value_and_start_and_end()
1162
+ )
1163
+ def test_conditional_node_serialize_all_operators_with_value_and_start_and_end(
1164
+ descriptor, operator
1165
+ ):
1072
1166
  # GIVEN a simple workflow with one conditional node
1073
1167
  workflow_cls = create_simple_workflow(descriptor)
1074
1168
 
1075
- workflow_display = get_workflow_display(base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls)
1169
+ workflow_display = get_workflow_display(
1170
+ base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls
1171
+ )
1076
1172
 
1077
1173
  # TODO: Support serialization of BaseNode
1078
1174
  # https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
@@ -1102,7 +1198,12 @@ def test_conditional_node_serialize_all_operators_with_value_and_start_and_end(d
1102
1198
  "id": "2262b7b4-a2f2-408b-9d4d-362940ca1ed3",
1103
1199
  "key": "abe7afac-952f-4cfc-ab07-47b47f34105f.field",
1104
1200
  "value": {
1105
- "rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "123"}}],
1201
+ "rules": [
1202
+ {
1203
+ "type": "CONSTANT_VALUE",
1204
+ "data": {"type": "STRING", "value": "123"},
1205
+ }
1206
+ ],
1106
1207
  "combinator": "OR",
1107
1208
  },
1108
1209
  },
@@ -1110,7 +1211,12 @@ def test_conditional_node_serialize_all_operators_with_value_and_start_and_end(d
1110
1211
  "id": "aadade8a-c253-483a-8620-31fe8171c0fd",
1111
1212
  "key": "abe7afac-952f-4cfc-ab07-47b47f34105f.value",
1112
1213
  "value": {
1113
- "rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "123,123"}}],
1214
+ "rules": [
1215
+ {
1216
+ "type": "CONSTANT_VALUE",
1217
+ "data": {"type": "STRING", "value": "123,123"},
1218
+ }
1219
+ ],
1114
1220
  "combinator": "OR",
1115
1221
  },
1116
1222
  },