vellum-ai 0.10.9__py3-none-any.whl → 0.11.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/__init__.py +16 -0
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/types/__init__.py +28 -0
- vellum/client/types/test_suite_run_exec_config.py +7 -1
- vellum/client/types/test_suite_run_exec_config_request.py +8 -0
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config.py +31 -0
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data.py +27 -0
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data_request.py +27 -0
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_request.py +31 -0
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config.py +31 -0
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data.py +27 -0
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data_request.py +27 -0
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_request.py +31 -0
- vellum/evaluations/resources.py +7 -12
- vellum/evaluations/utils/env.py +1 -3
- vellum/evaluations/utils/paginator.py +0 -1
- vellum/evaluations/utils/typing.py +1 -1
- vellum/evaluations/utils/uuid.py +1 -1
- vellum/plugins/vellum_mypy.py +3 -1
- vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config.py +3 -0
- vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_data.py +3 -0
- vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_data_request.py +3 -0
- vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_request.py +3 -0
- vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config.py +3 -0
- vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_data.py +3 -0
- vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_data_request.py +3 -0
- vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_request.py +3 -0
- vellum/workflows/context.py +42 -0
- vellum/workflows/events/node.py +7 -6
- vellum/workflows/events/tests/test_event.py +0 -1
- vellum/workflows/events/types.py +0 -1
- vellum/workflows/events/workflow.py +19 -1
- vellum/workflows/nodes/bases/base.py +17 -56
- vellum/workflows/nodes/bases/tests/test_base_node.py +0 -1
- vellum/workflows/nodes/core/inline_subworkflow_node/node.py +13 -7
- vellum/workflows/nodes/core/templating_node/node.py +1 -0
- vellum/workflows/nodes/core/try_node/node.py +2 -2
- vellum/workflows/nodes/core/try_node/tests/test_node.py +1 -3
- vellum/workflows/nodes/displayable/api_node/node.py +3 -2
- vellum/workflows/nodes/displayable/bases/api_node/node.py +1 -1
- vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +0 -1
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +9 -1
- vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +12 -2
- vellum/workflows/nodes/displayable/bases/search_node.py +0 -1
- vellum/workflows/nodes/displayable/code_execution_node/tests/test_code_execution_node.py +0 -1
- vellum/workflows/nodes/displayable/code_execution_node/utils.py +3 -2
- vellum/workflows/nodes/displayable/conditional_node/node.py +1 -1
- vellum/workflows/nodes/displayable/guardrail_node/node.py +0 -1
- vellum/workflows/nodes/displayable/inline_prompt_node/node.py +1 -0
- vellum/workflows/nodes/displayable/prompt_deployment_node/node.py +3 -1
- vellum/workflows/nodes/displayable/search_node/node.py +1 -0
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +13 -3
- vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +10 -7
- vellum/workflows/nodes/displayable/tests/test_search_node_wth_text_output.py +0 -1
- vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +1 -1
- vellum/workflows/outputs/base.py +2 -4
- vellum/workflows/ports/node_ports.py +1 -1
- vellum/workflows/runner/runner.py +167 -202
- vellum/workflows/state/base.py +0 -2
- vellum/workflows/types/core.py +1 -0
- vellum/workflows/types/tests/test_utils.py +1 -0
- vellum/workflows/types/utils.py +0 -1
- vellum/workflows/utils/functions.py +74 -0
- vellum/workflows/utils/tests/test_functions.py +171 -0
- vellum/workflows/utils/tests/test_vellum_variables.py +0 -1
- vellum/workflows/utils/vellum_variables.py +2 -2
- vellum/workflows/workflows/base.py +74 -34
- vellum/workflows/workflows/event_filters.py +7 -12
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/METADATA +1 -1
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/RECORD +122 -99
- vellum_cli/__init__.py +147 -13
- vellum_cli/config.py +0 -1
- vellum_cli/image_push.py +1 -1
- vellum_cli/pull.py +31 -19
- vellum_cli/push.py +9 -10
- vellum_cli/tests/__init__.py +0 -0
- vellum_cli/tests/conftest.py +40 -0
- vellum_cli/tests/test_main.py +11 -0
- vellum_cli/tests/test_pull.py +143 -71
- vellum_cli/tests/test_push.py +173 -0
- vellum_ee/workflows/display/base.py +1 -0
- vellum_ee/workflows/display/nodes/base_node_display.py +3 -2
- vellum_ee/workflows/display/nodes/base_node_vellum_display.py +2 -2
- vellum_ee/workflows/display/nodes/get_node_display_class.py +1 -1
- vellum_ee/workflows/display/nodes/tests/test_base_node_display.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/__init__.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/api_node.py +54 -58
- vellum_ee/workflows/display/nodes/vellum/conditional_node.py +39 -22
- vellum_ee/workflows/display/nodes/vellum/error_node.py +3 -3
- vellum_ee/workflows/display/nodes/vellum/final_output_node.py +0 -2
- vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +4 -2
- vellum_ee/workflows/display/nodes/vellum/map_node.py +11 -5
- vellum_ee/workflows/display/nodes/vellum/merge_node.py +2 -2
- vellum_ee/workflows/display/nodes/vellum/note_node.py +1 -3
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/search_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/templating_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +5 -5
- vellum_ee/workflows/display/nodes/vellum/utils.py +30 -10
- vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +45 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +42 -25
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +13 -39
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +62 -58
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +25 -4
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +2 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +2 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +2 -2
- vellum_ee/workflows/display/types.py +4 -4
- vellum_ee/workflows/display/utils/vellum.py +2 -6
- vellum_ee/workflows/display/vellum.py +1 -1
- vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py +4 -1
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +12 -5
- vellum/workflows/runner/types.py +0 -16
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/LICENSE +0 -0
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/WHEEL +0 -0
- {vellum_ai-0.10.9.dist-info → vellum_ai-0.11.1.dist-info}/entry_points.txt +0 -0
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py
CHANGED
@@ -4,17 +4,18 @@ from uuid import uuid4
|
|
4
4
|
from deepdiff import DeepDiff
|
5
5
|
|
6
6
|
from vellum import WorkspaceSecretRead
|
7
|
-
|
8
|
-
from tests.workflows.basic_vellum_api_node.workflow import SimpleAPIWorkflow
|
9
7
|
from vellum_ee.workflows.display.workflows import VellumWorkflowDisplay
|
10
8
|
from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
|
11
9
|
|
10
|
+
from tests.workflows.basic_vellum_api_node.workflow import SimpleAPIWorkflow
|
11
|
+
|
12
12
|
|
13
13
|
def test_serialize_workflow(vellum_client):
|
14
14
|
# GIVEN a Workflow that uses a vellum API node
|
15
15
|
# AND stubbed out API calls
|
16
|
+
workspace_secret_id = str(uuid4())
|
16
17
|
workspace_secret = WorkspaceSecretRead(
|
17
|
-
id=
|
18
|
+
id=workspace_secret_id,
|
18
19
|
modified=datetime.now(),
|
19
20
|
name="MY_SECRET",
|
20
21
|
label="My Secret",
|
@@ -118,6 +119,16 @@ def test_serialize_workflow(vellum_client):
|
|
118
119
|
"combinator": "OR",
|
119
120
|
},
|
120
121
|
},
|
122
|
+
{
|
123
|
+
"id": "fee5e3c9-442a-4922-ba80-5ee07361cea7",
|
124
|
+
"key": "bearer_token_value",
|
125
|
+
"value": {
|
126
|
+
"rules": [
|
127
|
+
{"type": "WORKSPACE_SECRET", "data": {"type": "STRING", "workspace_secret_id": None}}
|
128
|
+
],
|
129
|
+
"combinator": "OR",
|
130
|
+
},
|
131
|
+
},
|
121
132
|
{
|
122
133
|
"id": "2fcdfbc3-8095-4277-bb4a-a201fd326b54",
|
123
134
|
"key": "api_key_header_key",
|
@@ -133,12 +144,33 @@ def test_serialize_workflow(vellum_client):
|
|
133
144
|
"rules": [
|
134
145
|
{
|
135
146
|
"type": "WORKSPACE_SECRET",
|
136
|
-
"data": {
|
147
|
+
"data": {
|
148
|
+
"type": "STRING",
|
149
|
+
"workspace_secret_id": f"{workspace_secret_id}",
|
150
|
+
},
|
137
151
|
}
|
138
152
|
],
|
139
153
|
"combinator": "OR",
|
140
154
|
},
|
141
155
|
},
|
156
|
+
{
|
157
|
+
"id": "57c31247-998a-430d-bb62-bf50eca7df35",
|
158
|
+
"key": "additional_header_key",
|
159
|
+
"value": {
|
160
|
+
"rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "additional_header"}}],
|
161
|
+
"combinator": "OR",
|
162
|
+
},
|
163
|
+
},
|
164
|
+
{
|
165
|
+
"id": "47b32274-f19b-4c15-b788-55c069c311c5",
|
166
|
+
"key": "additional_header_value",
|
167
|
+
"value": {
|
168
|
+
"rules": [
|
169
|
+
{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "additional header value"}}
|
170
|
+
],
|
171
|
+
"combinator": "OR",
|
172
|
+
},
|
173
|
+
},
|
142
174
|
],
|
143
175
|
"data": {
|
144
176
|
"label": "Simple A P I Node",
|
@@ -149,13 +181,13 @@ def test_serialize_workflow(vellum_client):
|
|
149
181
|
"method_input_id": "fd61b5ac-39f9-4cfe-a839-f8ce78c202df",
|
150
182
|
"body_input_id": "c3a17ceb-e201-4025-b18a-9162aac7705e",
|
151
183
|
"authorization_type_input_id": "3092bf23-3202-4f3e-874c-9a33ccc73459",
|
152
|
-
"bearer_token_value_input_id":
|
184
|
+
"bearer_token_value_input_id": "fee5e3c9-442a-4922-ba80-5ee07361cea7",
|
153
185
|
"api_key_header_key_input_id": "2fcdfbc3-8095-4277-bb4a-a201fd326b54",
|
154
186
|
"api_key_header_value_input_id": "d794bb51-a419-4fd8-be63-dfaf4166e831",
|
155
187
|
"additional_headers": [
|
156
188
|
{
|
157
|
-
"header_key_input_id": "
|
158
|
-
"header_value_input_id": "
|
189
|
+
"header_key_input_id": "57c31247-998a-430d-bb62-bf50eca7df35",
|
190
|
+
"header_value_input_id": "47b32274-f19b-4c15-b788-55c069c311c5",
|
159
191
|
}
|
160
192
|
],
|
161
193
|
"text_output_id": "17342c21-12bb-49ab-88ce-f144e0376b32",
|
@@ -164,26 +196,11 @@ def test_serialize_workflow(vellum_client):
|
|
164
196
|
},
|
165
197
|
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
166
198
|
"definition": {
|
199
|
+
"name": "SimpleAPINode",
|
200
|
+
"module": ["tests", "workflows", "basic_vellum_api_node", "workflow"],
|
167
201
|
"bases": [
|
168
|
-
{
|
169
|
-
"module": [
|
170
|
-
"vellum",
|
171
|
-
"workflows",
|
172
|
-
"nodes",
|
173
|
-
"displayable",
|
174
|
-
"api_node",
|
175
|
-
"node",
|
176
|
-
],
|
177
|
-
"name": "APINode",
|
178
|
-
}
|
179
|
-
],
|
180
|
-
"module": [
|
181
|
-
"tests",
|
182
|
-
"workflows",
|
183
|
-
"basic_vellum_api_node",
|
184
|
-
"workflow",
|
202
|
+
{"name": "APINode", "module": ["vellum", "workflows", "nodes", "displayable", "api_node", "node"]}
|
185
203
|
],
|
186
|
-
"name": "SimpleAPINode",
|
187
204
|
},
|
188
205
|
},
|
189
206
|
api_node,
|
@@ -32,9 +32,7 @@ from tests.workflows.basic_conditional_node.workflow_with_only_one_conditional_n
|
|
32
32
|
def test_serialize_workflow():
|
33
33
|
# GIVEN a Workflow that uses a ConditionalNode
|
34
34
|
# WHEN we serialize it
|
35
|
-
workflow_display = get_workflow_display(
|
36
|
-
base_display_class=VellumWorkflowDisplay, workflow_class=CategoryWorkflow
|
37
|
-
)
|
35
|
+
workflow_display = get_workflow_display(base_display_class=VellumWorkflowDisplay, workflow_class=CategoryWorkflow)
|
38
36
|
|
39
37
|
# TODO: Support serialization of BaseNode
|
40
38
|
# https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
|
@@ -147,9 +145,7 @@ def test_serialize_workflow():
|
|
147
145
|
"rules": [
|
148
146
|
{
|
149
147
|
"type": "INPUT_VARIABLE",
|
150
|
-
"data": {
|
151
|
-
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
|
152
|
-
},
|
148
|
+
"data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
153
149
|
}
|
154
150
|
],
|
155
151
|
"combinator": "OR",
|
@@ -175,9 +171,7 @@ def test_serialize_workflow():
|
|
175
171
|
"rules": [
|
176
172
|
{
|
177
173
|
"type": "INPUT_VARIABLE",
|
178
|
-
"data": {
|
179
|
-
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
|
180
|
-
},
|
174
|
+
"data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
181
175
|
}
|
182
176
|
],
|
183
177
|
"combinator": "OR",
|
@@ -203,9 +197,7 @@ def test_serialize_workflow():
|
|
203
197
|
"rules": [
|
204
198
|
{
|
205
199
|
"type": "INPUT_VARIABLE",
|
206
|
-
"data": {
|
207
|
-
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
|
208
|
-
},
|
200
|
+
"data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
209
201
|
}
|
210
202
|
],
|
211
203
|
"combinator": "OR",
|
@@ -231,9 +223,7 @@ def test_serialize_workflow():
|
|
231
223
|
"rules": [
|
232
224
|
{
|
233
225
|
"type": "INPUT_VARIABLE",
|
234
|
-
"data": {
|
235
|
-
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
|
236
|
-
},
|
226
|
+
"data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
237
227
|
}
|
238
228
|
],
|
239
229
|
"combinator": "OR",
|
@@ -259,9 +249,7 @@ def test_serialize_workflow():
|
|
259
249
|
"rules": [
|
260
250
|
{
|
261
251
|
"type": "INPUT_VARIABLE",
|
262
|
-
"data": {
|
263
|
-
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
|
264
|
-
},
|
252
|
+
"data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
265
253
|
}
|
266
254
|
],
|
267
255
|
"combinator": "OR",
|
@@ -287,9 +275,7 @@ def test_serialize_workflow():
|
|
287
275
|
"rules": [
|
288
276
|
{
|
289
277
|
"type": "INPUT_VARIABLE",
|
290
|
-
"data": {
|
291
|
-
"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"
|
292
|
-
},
|
278
|
+
"data": {"input_variable_id": "eece050a-432e-4a2c-8c87-9480397e4cbf"},
|
293
279
|
}
|
294
280
|
],
|
295
281
|
"combinator": "OR",
|
@@ -926,15 +912,11 @@ def descriptors_with_value_and_start_and_end():
|
|
926
912
|
|
927
913
|
|
928
914
|
@pytest.mark.parametrize("descriptor, operator", descriptors_with_lhs_and_rhs())
|
929
|
-
def test_conditional_node_serialize_all_operators_with_lhs_and_rhs(
|
930
|
-
descriptor, operator
|
931
|
-
):
|
915
|
+
def test_conditional_node_serialize_all_operators_with_lhs_and_rhs(descriptor, operator):
|
932
916
|
# GIVEN a simple workflow with one conditional node
|
933
917
|
workflow_cls = create_simple_workflow(descriptor)
|
934
918
|
|
935
|
-
workflow_display = get_workflow_display(
|
936
|
-
base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls
|
937
|
-
)
|
919
|
+
workflow_display = get_workflow_display(base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls)
|
938
920
|
|
939
921
|
# TODO: Support serialization of BaseNode
|
940
922
|
# https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
|
@@ -1058,9 +1040,7 @@ def test_conditional_node_serialize_all_operators_with_expression(descriptor, op
|
|
1058
1040
|
# GIVEN a simple workflow with one conditional node
|
1059
1041
|
workflow_cls = create_simple_workflow(descriptor)
|
1060
1042
|
|
1061
|
-
workflow_display = get_workflow_display(
|
1062
|
-
base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls
|
1063
|
-
)
|
1043
|
+
workflow_display = get_workflow_display(base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls)
|
1064
1044
|
|
1065
1045
|
# TODO: Support serialization of BaseNode
|
1066
1046
|
# https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
|
@@ -1166,18 +1146,12 @@ def test_conditional_node_serialize_all_operators_with_expression(descriptor, op
|
|
1166
1146
|
)
|
1167
1147
|
|
1168
1148
|
|
1169
|
-
@pytest.mark.parametrize(
|
1170
|
-
|
1171
|
-
)
|
1172
|
-
def test_conditional_node_serialize_all_operators_with_value_and_start_and_end(
|
1173
|
-
descriptor, operator
|
1174
|
-
):
|
1149
|
+
@pytest.mark.parametrize("descriptor, operator", descriptors_with_value_and_start_and_end())
|
1150
|
+
def test_conditional_node_serialize_all_operators_with_value_and_start_and_end(descriptor, operator):
|
1175
1151
|
# GIVEN a simple workflow with one conditional node
|
1176
1152
|
workflow_cls = create_simple_workflow(descriptor)
|
1177
1153
|
|
1178
|
-
workflow_display = get_workflow_display(
|
1179
|
-
base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls
|
1180
|
-
)
|
1154
|
+
workflow_display = get_workflow_display(base_display_class=VellumWorkflowDisplay, workflow_class=workflow_cls)
|
1181
1155
|
|
1182
1156
|
# TODO: Support serialization of BaseNode
|
1183
1157
|
# https://app.shortcut.com/vellum/story/4871/support-serialization-of-base-node
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py
CHANGED
@@ -29,7 +29,7 @@ def test_serialize_workflow():
|
|
29
29
|
"type": "STRING",
|
30
30
|
"required": True,
|
31
31
|
"default": None,
|
32
|
-
"extensions": {
|
32
|
+
"extensions": {"color": None},
|
33
33
|
},
|
34
34
|
{
|
35
35
|
"id": "545ff95e-e86f-4d06-a991-602781e72605",
|
@@ -37,7 +37,7 @@ def test_serialize_workflow():
|
|
37
37
|
"type": "STRING",
|
38
38
|
"required": True,
|
39
39
|
"default": None,
|
40
|
-
"extensions": {
|
40
|
+
"extensions": {"color": None},
|
41
41
|
},
|
42
42
|
],
|
43
43
|
input_variables,
|
@@ -40,7 +40,7 @@ def test_serialize_workflow():
|
|
40
40
|
"type": "STRING",
|
41
41
|
"required": True,
|
42
42
|
"default": None,
|
43
|
-
"extensions": {
|
43
|
+
"extensions": {"color": None},
|
44
44
|
},
|
45
45
|
{
|
46
46
|
"id": "aba1e6e0-dfa7-4c15-a4e6-aec6feebfaca",
|
@@ -48,7 +48,7 @@ def test_serialize_workflow():
|
|
48
48
|
"type": "STRING",
|
49
49
|
"required": True,
|
50
50
|
"default": None,
|
51
|
-
"extensions": {
|
51
|
+
"extensions": {"color": None},
|
52
52
|
},
|
53
53
|
],
|
54
54
|
input_variables,
|
@@ -339,9 +339,13 @@ def test_serialize_workflow():
|
|
339
339
|
ignore_order=True,
|
340
340
|
)
|
341
341
|
|
342
|
-
temperature_terminal_node = next(
|
343
|
-
|
344
|
-
|
342
|
+
temperature_terminal_node = next(
|
343
|
+
node for node in workflow_raw_data["nodes"][2:] if node["data"]["name"] == "temperature"
|
344
|
+
)
|
345
|
+
reasoning_terminal_node = next(
|
346
|
+
node for node in workflow_raw_data["nodes"][2:] if node["data"]["name"] == "reasoning"
|
347
|
+
)
|
348
|
+
|
345
349
|
assert not DeepDiff(
|
346
350
|
{
|
347
351
|
"id": "31b74695-3f1c-47cf-8be8-a4d86cc589e8",
|
@@ -402,70 +406,70 @@ def test_serialize_workflow():
|
|
402
406
|
ignore_order=True,
|
403
407
|
# TODO: Make sure this output ID matches the workflow output ID of the subworkflow node's workflow
|
404
408
|
# https://app.shortcut.com/vellum/story/5660/fix-output-id-in-subworkflow-nodes
|
405
|
-
exclude_regex_paths=r"root\['inputs'\]\[0\]\['value'\]\['rules'\]\[0\]\['data'\]\['output_id'\]"
|
409
|
+
exclude_regex_paths=r"root\['inputs'\]\[0\]\['value'\]\['rules'\]\[0\]\['data'\]\['output_id'\]",
|
406
410
|
)
|
407
411
|
|
408
412
|
assert not DeepDiff(
|
409
413
|
{
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
{
|
415
|
-
"bases": [],
|
416
|
-
"module": [
|
417
|
-
"vellum",
|
418
|
-
"workflows",
|
419
|
-
"nodes",
|
420
|
-
"bases",
|
421
|
-
"base",
|
422
|
-
],
|
423
|
-
"name": "BaseNode",
|
424
|
-
},
|
425
|
-
],
|
426
|
-
"module": [
|
427
|
-
"vellum",
|
428
|
-
"workflows",
|
429
|
-
"nodes",
|
430
|
-
"displayable",
|
431
|
-
"final_output_node",
|
432
|
-
"node",
|
433
|
-
],
|
434
|
-
"name": "FinalOutputNode",
|
435
|
-
},
|
436
|
-
"data": {
|
437
|
-
"label": "Final Output",
|
438
|
-
"name": "temperature",
|
439
|
-
"target_handle_id": "9e077063-c394-4c7b-b0c6-e6686df67984",
|
440
|
-
"output_id": "99afb757-2782-465d-ab55-80ccf50552b9",
|
441
|
-
"output_type": "NUMBER",
|
442
|
-
"node_input_id": "df0d7e0c-2b37-4059-91c1-0419f950b7fe",
|
443
|
-
},
|
444
|
-
"inputs": [
|
414
|
+
"id": "0779b232-82ab-4dbe-a340-6a85e6ab3368",
|
415
|
+
"type": "TERMINAL",
|
416
|
+
"definition": {
|
417
|
+
"bases": [
|
445
418
|
{
|
446
|
-
"
|
447
|
-
"
|
448
|
-
|
449
|
-
"
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
419
|
+
"bases": [],
|
420
|
+
"module": [
|
421
|
+
"vellum",
|
422
|
+
"workflows",
|
423
|
+
"nodes",
|
424
|
+
"bases",
|
425
|
+
"base",
|
426
|
+
],
|
427
|
+
"name": "BaseNode",
|
428
|
+
},
|
429
|
+
],
|
430
|
+
"module": [
|
431
|
+
"vellum",
|
432
|
+
"workflows",
|
433
|
+
"nodes",
|
434
|
+
"displayable",
|
435
|
+
"final_output_node",
|
436
|
+
"node",
|
461
437
|
],
|
462
|
-
"
|
438
|
+
"name": "FinalOutputNode",
|
463
439
|
},
|
440
|
+
"data": {
|
441
|
+
"label": "Final Output",
|
442
|
+
"name": "temperature",
|
443
|
+
"target_handle_id": "9e077063-c394-4c7b-b0c6-e6686df67984",
|
444
|
+
"output_id": "99afb757-2782-465d-ab55-80ccf50552b9",
|
445
|
+
"output_type": "NUMBER",
|
446
|
+
"node_input_id": "df0d7e0c-2b37-4059-91c1-0419f950b7fe",
|
447
|
+
},
|
448
|
+
"inputs": [
|
449
|
+
{
|
450
|
+
"id": "df0d7e0c-2b37-4059-91c1-0419f950b7fe",
|
451
|
+
"key": "node_input",
|
452
|
+
"value": {
|
453
|
+
"rules": [
|
454
|
+
{
|
455
|
+
"type": "NODE_OUTPUT",
|
456
|
+
"data": {
|
457
|
+
"node_id": "080e4343-c7ce-4f82-b9dd-e94c8cc92239",
|
458
|
+
"output_id": "2fc57139-7420-49e5-96a6-dcbb3ff5d622",
|
459
|
+
},
|
460
|
+
}
|
461
|
+
],
|
462
|
+
"combinator": "OR",
|
463
|
+
},
|
464
|
+
}
|
465
|
+
],
|
466
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
467
|
+
},
|
464
468
|
temperature_terminal_node,
|
465
469
|
ignore_order=True,
|
466
470
|
# TODO: Make sure this output ID matches the workflow output ID of the subworkflow node's workflow
|
467
471
|
# https://app.shortcut.com/vellum/story/5660/fix-output-id-in-subworkflow-nodes
|
468
|
-
exclude_regex_paths=r"root\['inputs'\]\[0\]\['value'\]\['rules'\]\[0\]\['data'\]\['output_id'\]"
|
472
|
+
exclude_regex_paths=r"root\['inputs'\]\[0\]\['value'\]\['rules'\]\[0\]\['data'\]\['output_id'\]",
|
469
473
|
)
|
470
474
|
|
471
475
|
# AND each edge should be serialized correctly
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py
CHANGED
@@ -38,7 +38,7 @@ def test_serialize_workflow():
|
|
38
38
|
"type": "JSON",
|
39
39
|
"required": True,
|
40
40
|
"default": None,
|
41
|
-
"extensions": {
|
41
|
+
"extensions": {"color": None},
|
42
42
|
},
|
43
43
|
],
|
44
44
|
input_variables,
|
@@ -228,9 +228,30 @@ def test_serialize_workflow():
|
|
228
228
|
},
|
229
229
|
},
|
230
230
|
"input_variables": [
|
231
|
-
{
|
232
|
-
|
233
|
-
|
231
|
+
{
|
232
|
+
"id": "b29bb546-9bc8-4136-857d-8c7a464ba9d4",
|
233
|
+
"key": "item",
|
234
|
+
"type": "JSON",
|
235
|
+
"required": True,
|
236
|
+
"default": None,
|
237
|
+
"extensions": {"color": None},
|
238
|
+
},
|
239
|
+
{
|
240
|
+
"id": "17e7ca49-668f-450d-a792-e1f97d13db67",
|
241
|
+
"key": "index",
|
242
|
+
"type": "NUMBER",
|
243
|
+
"required": True,
|
244
|
+
"default": None,
|
245
|
+
"extensions": {"color": None},
|
246
|
+
},
|
247
|
+
{
|
248
|
+
"id": "d6fc6c7a-235f-4b98-86f3-e258d1198f93",
|
249
|
+
"key": "items",
|
250
|
+
"type": "JSON",
|
251
|
+
"required": True,
|
252
|
+
"default": None,
|
253
|
+
"extensions": {"color": None},
|
254
|
+
},
|
234
255
|
],
|
235
256
|
"output_variables": [{"id": "2a957315-fae0-4366-8a35-f0b315c5eade", "key": "count", "type": "NUMBER"}],
|
236
257
|
"concurrency": None,
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py
CHANGED
@@ -2,11 +2,12 @@ from unittest import mock
|
|
2
2
|
|
3
3
|
from deepdiff import DeepDiff
|
4
4
|
|
5
|
-
from tests.workflows.basic_merge_node.await_all_workflow import AwaitAllPassingWorkflow
|
6
5
|
from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
|
7
6
|
from vellum_ee.workflows.display.workflows import VellumWorkflowDisplay
|
8
7
|
from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
|
9
8
|
|
9
|
+
from tests.workflows.basic_merge_node.await_all_workflow import AwaitAllPassingWorkflow
|
10
|
+
|
10
11
|
|
11
12
|
def test_serialize_workflow__await_all():
|
12
13
|
# GIVEN a Workflow that uses an await all merge node
|
@@ -48,7 +48,7 @@ def test_serialize_workflow(vellum_client):
|
|
48
48
|
"type": "STRING",
|
49
49
|
"required": True,
|
50
50
|
"default": None,
|
51
|
-
"extensions": {
|
51
|
+
"extensions": {"color": None},
|
52
52
|
},
|
53
53
|
{
|
54
54
|
"id": "aa3ca842-250c-4a3f-853f-23928c28d0f8",
|
@@ -56,7 +56,7 @@ def test_serialize_workflow(vellum_client):
|
|
56
56
|
"type": "STRING",
|
57
57
|
"required": True,
|
58
58
|
"default": None,
|
59
|
-
"extensions": {
|
59
|
+
"extensions": {"color": None},
|
60
60
|
},
|
61
61
|
],
|
62
62
|
input_variables,
|
@@ -48,7 +48,7 @@ def test_serialize_workflow(vellum_client):
|
|
48
48
|
"type": "STRING",
|
49
49
|
"required": True,
|
50
50
|
"default": None,
|
51
|
-
"extensions": {
|
51
|
+
"extensions": {"color": None},
|
52
52
|
},
|
53
53
|
{
|
54
54
|
"id": "19a78824-9a98-4ae8-a1fc-61f81a422a17",
|
@@ -56,7 +56,7 @@ def test_serialize_workflow(vellum_client):
|
|
56
56
|
"type": "STRING",
|
57
57
|
"required": True,
|
58
58
|
"default": None,
|
59
|
-
"extensions": {
|
59
|
+
"extensions": {"color": None},
|
60
60
|
},
|
61
61
|
],
|
62
62
|
input_variables,
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py
CHANGED
@@ -2,11 +2,12 @@ from unittest import mock
|
|
2
2
|
|
3
3
|
from deepdiff import DeepDiff
|
4
4
|
|
5
|
-
from tests.workflows.basic_try_node.workflow import SimpleTryExample
|
6
5
|
from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
|
7
6
|
from vellum_ee.workflows.display.workflows import VellumWorkflowDisplay
|
8
7
|
from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
|
9
8
|
|
9
|
+
from tests.workflows.basic_try_node.workflow import SimpleTryExample
|
10
|
+
|
10
11
|
|
11
12
|
def test_serialize_workflow():
|
12
13
|
# GIVEN a Workflow with a TryNode
|
vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py
CHANGED
@@ -43,7 +43,7 @@ def test_serialize_workflow__missing_final_output_node():
|
|
43
43
|
"type": "STRING",
|
44
44
|
"required": True,
|
45
45
|
"default": None,
|
46
|
-
"extensions": {
|
46
|
+
"extensions": {"color": None},
|
47
47
|
},
|
48
48
|
{
|
49
49
|
"id": "a8b6c5d4-a0e9-4457-834b-46b633c466a6",
|
@@ -51,7 +51,7 @@ def test_serialize_workflow__missing_final_output_node():
|
|
51
51
|
"type": "STRING",
|
52
52
|
"required": True,
|
53
53
|
"default": None,
|
54
|
-
"extensions": {
|
54
|
+
"extensions": {"color": None},
|
55
55
|
},
|
56
56
|
],
|
57
57
|
input_variables,
|
@@ -1,6 +1,10 @@
|
|
1
1
|
from dataclasses import dataclass, field
|
2
2
|
from typing import TYPE_CHECKING, Dict, Generic, Tuple, Type, TypeVar
|
3
3
|
|
4
|
+
from vellum.workflows.descriptors.base import BaseDescriptor
|
5
|
+
from vellum.workflows.nodes import BaseNode
|
6
|
+
from vellum.workflows.ports import Port
|
7
|
+
from vellum.workflows.references import OutputReference, WorkflowInputReference
|
4
8
|
from vellum_ee.workflows.display.base import (
|
5
9
|
EdgeDisplayType,
|
6
10
|
EntrypointDisplayType,
|
@@ -9,10 +13,6 @@ from vellum_ee.workflows.display.base import (
|
|
9
13
|
WorkflowOutputDisplayType,
|
10
14
|
)
|
11
15
|
from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay, PortDisplay
|
12
|
-
from vellum.workflows.descriptors.base import BaseDescriptor
|
13
|
-
from vellum.workflows.nodes import BaseNode
|
14
|
-
from vellum.workflows.ports import Port
|
15
|
-
from vellum.workflows.references import OutputReference, WorkflowInputReference
|
16
16
|
|
17
17
|
if TYPE_CHECKING:
|
18
18
|
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
@@ -4,9 +4,7 @@ import typing
|
|
4
4
|
from typing import Any, List, Union, cast
|
5
5
|
|
6
6
|
from vellum import ChatMessage, SearchResult, SearchResultRequest, VellumVariableType
|
7
|
-
from vellum.client.types.array_vellum_value import ArrayVellumValue
|
8
7
|
from vellum.workflows.descriptors.base import BaseDescriptor
|
9
|
-
from vellum.workflows.nodes.core.map_node.node import MapNodeItemType
|
10
8
|
from vellum.workflows.references import OutputReference, WorkflowInputReference
|
11
9
|
from vellum.workflows.references.execution_count import ExecutionCountReference
|
12
10
|
from vellum.workflows.references.node import NodeReference
|
@@ -48,7 +46,7 @@ def infer_vellum_variable_type(value: Any) -> VellumVariableType:
|
|
48
46
|
f"Expected NodeReference {descriptor.name} to have an instance pointing to a descriptor"
|
49
47
|
)
|
50
48
|
descriptor = descriptor.instance
|
51
|
-
|
49
|
+
|
52
50
|
inferred_type = primitive_type_to_vellum_variable_type(descriptor)
|
53
51
|
else:
|
54
52
|
vellum_variable_value = primitive_to_vellum_value(value)
|
@@ -68,9 +66,7 @@ def create_node_input_value_pointer_rule(
|
|
68
66
|
)
|
69
67
|
if isinstance(value, WorkflowInputReference):
|
70
68
|
workflow_input_display = display_context.workflow_input_displays[value]
|
71
|
-
return InputVariablePointer(
|
72
|
-
data=InputVariableData(input_variable_id=str(workflow_input_display.id))
|
73
|
-
)
|
69
|
+
return InputVariablePointer(data=InputVariableData(input_variable_id=str(workflow_input_display.id)))
|
74
70
|
if isinstance(value, VellumSecretReference):
|
75
71
|
# TODO: Pass through the name instead of retrieving the ID
|
76
72
|
# https://app.shortcut.com/vellum/story/5072
|
@@ -202,7 +202,7 @@ class InputVariablePointer(UniversalBaseModel):
|
|
202
202
|
|
203
203
|
class WorkspaceSecretData(UniversalBaseModel):
|
204
204
|
type: VellumVariableType
|
205
|
-
workspace_secret_id: str
|
205
|
+
workspace_secret_id: Optional[str] = None
|
206
206
|
|
207
207
|
|
208
208
|
class WorkspaceSecretPointer(UniversalBaseModel):
|
@@ -24,4 +24,7 @@ def get_workflow_display(
|
|
24
24
|
except IndexError:
|
25
25
|
return base_display_class(workflow_class)
|
26
26
|
|
27
|
-
return workflow_display_class(
|
27
|
+
return workflow_display_class( # type: ignore[return-value]
|
28
|
+
workflow_class,
|
29
|
+
parent_display_context=parent_display_context,
|
30
|
+
)
|