vellum-ai 0.14.61__py3-none-any.whl → 0.14.62__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.
- vellum/client/core/client_wrapper.py +1 -1
- {vellum_ai-0.14.61.dist-info → vellum_ai-0.14.62.dist-info}/METADATA +1 -1
- {vellum_ai-0.14.61.dist-info → vellum_ai-0.14.62.dist-info}/RECORD +8 -8
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +9 -4
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +337 -18
- {vellum_ai-0.14.61.dist-info → vellum_ai-0.14.62.dist-info}/LICENSE +0 -0
- {vellum_ai-0.14.61.dist-info → vellum_ai-0.14.62.dist-info}/WHEEL +0 -0
- {vellum_ai-0.14.61.dist-info → vellum_ai-0.14.62.dist-info}/entry_points.txt +0 -0
@@ -18,7 +18,7 @@ class BaseClientWrapper:
|
|
18
18
|
headers: typing.Dict[str, str] = {
|
19
19
|
"X-Fern-Language": "Python",
|
20
20
|
"X-Fern-SDK-Name": "vellum-ai",
|
21
|
-
"X-Fern-SDK-Version": "0.14.
|
21
|
+
"X-Fern-SDK-Version": "0.14.62",
|
22
22
|
}
|
23
23
|
headers["X-API-KEY"] = self.api_key
|
24
24
|
return headers
|
@@ -45,7 +45,7 @@ vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py,sha256=fQV5o
|
|
45
45
|
vellum_ee/workflows/display/nodes/vellum/map_node.py,sha256=CiklGf5_tDbqE1XQm2mnbtoL01_2JYjcnB4FDTpMImQ,3824
|
46
46
|
vellum_ee/workflows/display/nodes/vellum/merge_node.py,sha256=yBWeN4T_lOsDVnNOKWRiT7JYKu0IR5Fx2z99iq6QKSA,3273
|
47
47
|
vellum_ee/workflows/display/nodes/vellum/note_node.py,sha256=3E0UqmgVYdtbj4nyq8gKju8EpMsRHMCQ0KLrJhug3XU,1084
|
48
|
-
vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py,sha256=
|
48
|
+
vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py,sha256=1NxFddxWCFtMe_je1cutP7qnoASoG94LJqKhRkoQwvw,3535
|
49
49
|
vellum_ee/workflows/display/nodes/vellum/retry_node.py,sha256=X3xnlAU5JisL0jRvaG_V9RvTF7ZlGufTO8tXLLVhGIg,3280
|
50
50
|
vellum_ee/workflows/display/nodes/vellum/search_node.py,sha256=3n1qa-zWIk0p_H94u0hjfDtGkanldC6EXVhg0xgLmE4,9544
|
51
51
|
vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py,sha256=MWLZBXHsmj5vKgqOgI2HHcHAJzLS0sqybn6idhwug8Y,2669
|
@@ -85,7 +85,7 @@ vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_promp
|
|
85
85
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py,sha256=u2nquKoO3o2xIkU_uFPOb_s5YoLmULiq09vb6Ee0Cqw,21415
|
86
86
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py,sha256=3gZuNM8sT6ovVaeoAvd2JoyKwuxokvowlhH8kwDUoZ8,16559
|
87
87
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py,sha256=IIJt7YZBzkhNtbmaMwCX4ENs58QtSIIoBHlMR6OwGU8,8342
|
88
|
-
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py,sha256=
|
88
|
+
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py,sha256=QXiRjwtiTPeMUl40Pvh_geeU99C3mv1aVS85oeIUwY4,21052
|
89
89
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py,sha256=K0mECBUyTNX4I468goeaRf93N7Qfizoc1ctCH5_nNys,12936
|
90
90
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py,sha256=KkYZc_bZuq1lmDcvUz3QxIqJLpQPCZioD1FHUNsMJY8,11211
|
91
91
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py,sha256=aZaqRDrkO3ytcmdM2eKJqHSt60MF070NMj6M2vgzOKc,7711
|
@@ -134,7 +134,7 @@ vellum/client/README.md,sha256=qmaVIP42MnxAu8jV7u-CsgVFfs3-pHQODrXdZdFxtaw,4749
|
|
134
134
|
vellum/client/__init__.py,sha256=AYopGv2ZRVn3zsU8_km6KOvEHDbXiTPCVuYVI7bWvdA,120166
|
135
135
|
vellum/client/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
|
136
136
|
vellum/client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
137
|
-
vellum/client/core/client_wrapper.py,sha256=
|
137
|
+
vellum/client/core/client_wrapper.py,sha256=6Ws3Z7WyEV9P2j-NicrbyppAaPyLzK4wAJ5mxUvUdJ4,1869
|
138
138
|
vellum/client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
139
139
|
vellum/client/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
|
140
140
|
vellum/client/core/http_client.py,sha256=Z77OIxIbL4OAB2IDqjRq_sYa5yNYAWfmdhdCSSvh6Y4,19552
|
@@ -1712,8 +1712,8 @@ vellum/workflows/workflows/event_filters.py,sha256=GSxIgwrX26a1Smfd-6yss2abGCnad
|
|
1712
1712
|
vellum/workflows/workflows/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1713
1713
|
vellum/workflows/workflows/tests/test_base_workflow.py,sha256=fROqff6AZpCIzaSwOKSdtYy4XR0UZQ6ejxL3RJOSJVs,20447
|
1714
1714
|
vellum/workflows/workflows/tests/test_context.py,sha256=VJBUcyWVtMa_lE5KxdhgMu0WYNYnUQUDvTF7qm89hJ0,2333
|
1715
|
-
vellum_ai-0.14.
|
1716
|
-
vellum_ai-0.14.
|
1717
|
-
vellum_ai-0.14.
|
1718
|
-
vellum_ai-0.14.
|
1719
|
-
vellum_ai-0.14.
|
1715
|
+
vellum_ai-0.14.62.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
|
1716
|
+
vellum_ai-0.14.62.dist-info/METADATA,sha256=Bzub_INWkihzZyUxbedAO9QOhQmT-Ci17-6k_8JW5zE,5484
|
1717
|
+
vellum_ai-0.14.62.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
1718
|
+
vellum_ai-0.14.62.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
|
1719
|
+
vellum_ai-0.14.62.dist-info/RECORD,,
|
@@ -1,8 +1,7 @@
|
|
1
1
|
from uuid import UUID
|
2
|
-
from typing import Generic, Optional, TypeVar
|
2
|
+
from typing import Generic, Optional, TypeVar
|
3
3
|
|
4
4
|
from vellum.workflows.nodes.displayable.prompt_deployment_node import PromptDeploymentNode
|
5
|
-
from vellum.workflows.references import OutputReference
|
6
5
|
from vellum.workflows.types.core import JsonObject
|
7
6
|
from vellum_ee.workflows.display.nodes.base_node_display import BaseNodeDisplay
|
8
7
|
from vellum_ee.workflows.display.nodes.utils import raise_if_descriptor
|
@@ -40,8 +39,9 @@ class BasePromptDeploymentNodeDisplay(BaseNodeDisplay[_PromptDeploymentNodeType]
|
|
40
39
|
else []
|
41
40
|
)
|
42
41
|
|
43
|
-
|
44
|
-
|
42
|
+
output_display = self.output_display[node.Outputs.text]
|
43
|
+
array_display = self.output_display[node.Outputs.results]
|
44
|
+
json_display = self.output_display[node.Outputs.json]
|
45
45
|
|
46
46
|
deployment = display_context.client.deployments.retrieve(
|
47
47
|
id=str(raise_if_descriptor(node.deployment)),
|
@@ -68,4 +68,9 @@ class BasePromptDeploymentNodeDisplay(BaseNodeDisplay[_PromptDeploymentNodeType]
|
|
68
68
|
"base": self.get_base().dict(),
|
69
69
|
"definition": self.get_definition().dict(),
|
70
70
|
"ports": self.serialize_ports(display_context),
|
71
|
+
"outputs": [
|
72
|
+
{"id": str(json_display.id), "name": "json", "type": "JSON", "value": None},
|
73
|
+
{"id": str(output_display.id), "name": "text", "type": "STRING", "value": None},
|
74
|
+
{"id": str(array_display.id), "name": "results", "type": "ARRAY", "value": None},
|
75
|
+
],
|
71
76
|
}
|
@@ -7,6 +7,9 @@ from vellum import DeploymentRead
|
|
7
7
|
from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
|
8
8
|
|
9
9
|
from tests.workflows.basic_text_prompt_deployment.workflow import BasicTextPromptDeployment
|
10
|
+
from tests.workflows.basic_text_prompt_deployment.workflow_with_prompt_deployment_json_reference import (
|
11
|
+
WorkflowWithPromptDeploymentJsonReferenceWorkflow,
|
12
|
+
)
|
10
13
|
|
11
14
|
|
12
15
|
def test_serialize_workflow(vellum_client):
|
@@ -103,30 +106,26 @@ def test_serialize_workflow(vellum_client):
|
|
103
106
|
"id": "947d7ead-0fad-4e5f-aa3a-d06029ac94bc",
|
104
107
|
"key": "city",
|
105
108
|
"value": {
|
106
|
-
"combinator": "OR",
|
107
109
|
"rules": [
|
108
110
|
{
|
109
111
|
"type": "INPUT_VARIABLE",
|
110
|
-
"data": {
|
111
|
-
|
112
|
-
},
|
113
|
-
},
|
112
|
+
"data": {"input_variable_id": "52995b50-84c9-465f-8a4b-a4ee2a92e388"},
|
113
|
+
}
|
114
114
|
],
|
115
|
+
"combinator": "OR",
|
115
116
|
},
|
116
117
|
},
|
117
118
|
{
|
118
119
|
"id": "3deebdd7-2900-4d8c-93f2-e5b90649ac42",
|
119
120
|
"key": "date",
|
120
121
|
"value": {
|
121
|
-
"combinator": "OR",
|
122
122
|
"rules": [
|
123
123
|
{
|
124
124
|
"type": "INPUT_VARIABLE",
|
125
|
-
"data": {
|
126
|
-
|
127
|
-
},
|
128
|
-
},
|
125
|
+
"data": {"input_variable_id": "aa3ca842-250c-4a3f-853f-23928c28d0f8"},
|
126
|
+
}
|
129
127
|
],
|
128
|
+
"combinator": "OR",
|
130
129
|
},
|
131
130
|
},
|
132
131
|
],
|
@@ -142,21 +141,21 @@ def test_serialize_workflow(vellum_client):
|
|
142
141
|
"release_tag": "LATEST",
|
143
142
|
"ml_model_fallbacks": ["gpt-4o", "gemini-1.5-pro"],
|
144
143
|
},
|
145
|
-
"display_data": {
|
146
|
-
"position": {
|
147
|
-
"x": 0.0,
|
148
|
-
"y": 0.0,
|
149
|
-
},
|
150
|
-
},
|
144
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
151
145
|
"base": {
|
152
|
-
"module": ["vellum", "workflows", "nodes", "displayable", "prompt_deployment_node", "node"],
|
153
146
|
"name": "PromptDeploymentNode",
|
147
|
+
"module": ["vellum", "workflows", "nodes", "displayable", "prompt_deployment_node", "node"],
|
154
148
|
},
|
155
149
|
"definition": {
|
156
|
-
"module": ["tests", "workflows", "basic_text_prompt_deployment", "workflow"],
|
157
150
|
"name": "ExamplePromptDeploymentNode",
|
151
|
+
"module": ["tests", "workflows", "basic_text_prompt_deployment", "workflow"],
|
158
152
|
},
|
159
153
|
"ports": [{"id": "2f26c7e0-283d-4f04-b639-adebb56bc679", "name": "default", "type": "DEFAULT"}],
|
154
|
+
"outputs": [
|
155
|
+
{"id": "180355a8-e67c-4ce6-9ac3-e5dbb75a6629", "name": "json", "type": "JSON", "value": None},
|
156
|
+
{"id": "4d38b850-79e3-4b85-9158-a41d0c535410", "name": "text", "type": "STRING", "value": None},
|
157
|
+
{"id": "0cf47d33-6d5f-466f-b826-e814f1d0348b", "name": "results", "type": "ARRAY", "value": None},
|
158
|
+
],
|
160
159
|
}
|
161
160
|
|
162
161
|
final_output_node = workflow_raw_data["nodes"][2]
|
@@ -251,3 +250,323 @@ def test_serialize_workflow(vellum_client):
|
|
251
250
|
"workflow",
|
252
251
|
],
|
253
252
|
}
|
253
|
+
|
254
|
+
|
255
|
+
def test_serialize_workflow_with_prompt_and_templating(vellum_client):
|
256
|
+
# GIVEN a Workflow with stubbed out API calls
|
257
|
+
deployment = DeploymentRead(
|
258
|
+
id=str(uuid4()),
|
259
|
+
created=datetime.now(),
|
260
|
+
label="JSON Prompt Deployment",
|
261
|
+
name="json_prompt_deployment",
|
262
|
+
last_deployed_on=datetime.now(),
|
263
|
+
input_variables=[],
|
264
|
+
active_model_version_ids=[],
|
265
|
+
last_deployed_history_item_id=str(uuid4()),
|
266
|
+
)
|
267
|
+
vellum_client.deployments.retrieve.return_value = deployment
|
268
|
+
|
269
|
+
# WHEN we serialize it
|
270
|
+
workflow_display = get_workflow_display(workflow_class=WorkflowWithPromptDeploymentJsonReferenceWorkflow)
|
271
|
+
serialized_workflow: dict = workflow_display.serialize()
|
272
|
+
|
273
|
+
# THEN we should get a serialized representation of the Workflow
|
274
|
+
assert serialized_workflow.keys() == {
|
275
|
+
"workflow_raw_data",
|
276
|
+
"input_variables",
|
277
|
+
"state_variables",
|
278
|
+
"output_variables",
|
279
|
+
}
|
280
|
+
|
281
|
+
# AND its input variables should be what we expect
|
282
|
+
input_variables = serialized_workflow["input_variables"]
|
283
|
+
assert len(input_variables) == 2
|
284
|
+
assert not DeepDiff(
|
285
|
+
[
|
286
|
+
{
|
287
|
+
"id": "ad577aca-0797-4deb-a484-574ef1a1f0c7",
|
288
|
+
"key": "city",
|
289
|
+
"type": "STRING",
|
290
|
+
"default": None,
|
291
|
+
"required": True,
|
292
|
+
"extensions": {"color": None},
|
293
|
+
},
|
294
|
+
{
|
295
|
+
"id": "066124c4-42bd-4764-aa75-6f230dbbed4a",
|
296
|
+
"key": "date",
|
297
|
+
"type": "STRING",
|
298
|
+
"default": None,
|
299
|
+
"required": True,
|
300
|
+
"extensions": {"color": None},
|
301
|
+
},
|
302
|
+
],
|
303
|
+
input_variables,
|
304
|
+
ignore_order=True,
|
305
|
+
)
|
306
|
+
|
307
|
+
# AND its output variables should be what we expect
|
308
|
+
output_variables = serialized_workflow["output_variables"]
|
309
|
+
assert len(output_variables) == 1
|
310
|
+
assert output_variables == [{"id": "a7e4b449-5879-4d0c-8f00-d5d4985eb65c", "key": "text", "type": "STRING"}]
|
311
|
+
|
312
|
+
# AND its raw data should be what we expect
|
313
|
+
workflow_raw_data = serialized_workflow["workflow_raw_data"]
|
314
|
+
assert len(workflow_raw_data["edges"]) == 3
|
315
|
+
assert len(workflow_raw_data["nodes"]) == 4
|
316
|
+
|
317
|
+
# AND each node should be serialized correctly
|
318
|
+
entrypoint_node = workflow_raw_data["nodes"][0]
|
319
|
+
assert entrypoint_node == {
|
320
|
+
"id": "32c7f398-277c-456b-9279-aa1f867fb637",
|
321
|
+
"type": "ENTRYPOINT",
|
322
|
+
"inputs": [],
|
323
|
+
"data": {"label": "Entrypoint Node", "source_handle_id": "cc0f4028-1039-4063-971d-7dacbb01b379"},
|
324
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
325
|
+
"base": None,
|
326
|
+
"definition": None,
|
327
|
+
}
|
328
|
+
|
329
|
+
prompt_node = workflow_raw_data["nodes"][1]
|
330
|
+
assert prompt_node == {
|
331
|
+
"id": "56c74024-19a3-4c0d-a5f5-23e1e9f11b21",
|
332
|
+
"type": "PROMPT",
|
333
|
+
"inputs": [
|
334
|
+
{
|
335
|
+
"id": "947d7ead-0fad-4e5f-aa3a-d06029ac94bc",
|
336
|
+
"key": "city",
|
337
|
+
"value": {
|
338
|
+
"rules": [
|
339
|
+
{
|
340
|
+
"type": "INPUT_VARIABLE",
|
341
|
+
"data": {"input_variable_id": "ad577aca-0797-4deb-a484-574ef1a1f0c7"},
|
342
|
+
}
|
343
|
+
],
|
344
|
+
"combinator": "OR",
|
345
|
+
},
|
346
|
+
},
|
347
|
+
{
|
348
|
+
"id": "3deebdd7-2900-4d8c-93f2-e5b90649ac42",
|
349
|
+
"key": "date",
|
350
|
+
"value": {
|
351
|
+
"rules": [
|
352
|
+
{
|
353
|
+
"type": "INPUT_VARIABLE",
|
354
|
+
"data": {"input_variable_id": "066124c4-42bd-4764-aa75-6f230dbbed4a"},
|
355
|
+
}
|
356
|
+
],
|
357
|
+
"combinator": "OR",
|
358
|
+
},
|
359
|
+
},
|
360
|
+
],
|
361
|
+
"data": {
|
362
|
+
"label": "Example Prompt Deployment Node",
|
363
|
+
"output_id": "4d38b850-79e3-4b85-9158-a41d0c535410",
|
364
|
+
"error_output_id": None,
|
365
|
+
"array_output_id": "0cf47d33-6d5f-466f-b826-e814f1d0348b",
|
366
|
+
"source_handle_id": "2f26c7e0-283d-4f04-b639-adebb56bc679",
|
367
|
+
"target_handle_id": "b7605c48-0937-4ecc-914e-0d1058130e65",
|
368
|
+
"variant": "DEPLOYMENT",
|
369
|
+
"prompt_deployment_id": deployment.id,
|
370
|
+
"release_tag": "LATEST",
|
371
|
+
"ml_model_fallbacks": None,
|
372
|
+
},
|
373
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
374
|
+
"base": {
|
375
|
+
"name": "PromptDeploymentNode",
|
376
|
+
"module": ["vellum", "workflows", "nodes", "displayable", "prompt_deployment_node", "node"],
|
377
|
+
},
|
378
|
+
"definition": {
|
379
|
+
"name": "ExamplePromptDeploymentNode",
|
380
|
+
"module": [
|
381
|
+
"tests",
|
382
|
+
"workflows",
|
383
|
+
"basic_text_prompt_deployment",
|
384
|
+
"workflow_with_prompt_deployment_json_reference",
|
385
|
+
],
|
386
|
+
},
|
387
|
+
"ports": [{"id": "2f26c7e0-283d-4f04-b639-adebb56bc679", "name": "default", "type": "DEFAULT"}],
|
388
|
+
"outputs": [
|
389
|
+
{"id": "180355a8-e67c-4ce6-9ac3-e5dbb75a6629", "name": "json", "type": "JSON", "value": None},
|
390
|
+
{"id": "4d38b850-79e3-4b85-9158-a41d0c535410", "name": "text", "type": "STRING", "value": None},
|
391
|
+
{"id": "0cf47d33-6d5f-466f-b826-e814f1d0348b", "name": "results", "type": "ARRAY", "value": None},
|
392
|
+
],
|
393
|
+
}
|
394
|
+
|
395
|
+
templating_node = workflow_raw_data["nodes"][2]
|
396
|
+
assert templating_node == {
|
397
|
+
"id": "51cbe21d-0232-4362-bc54-5bc283297aa6",
|
398
|
+
"type": "TEMPLATING",
|
399
|
+
"inputs": [
|
400
|
+
{
|
401
|
+
"id": "7c775379-d589-4d79-b876-dcd224d72966",
|
402
|
+
"key": "template",
|
403
|
+
"value": {
|
404
|
+
"rules": [
|
405
|
+
{
|
406
|
+
"type": "CONSTANT_VALUE",
|
407
|
+
"data": {
|
408
|
+
"type": "STRING",
|
409
|
+
"value": "The weather in {{ city }} on {{ date }} is {{ weather }}.",
|
410
|
+
},
|
411
|
+
}
|
412
|
+
],
|
413
|
+
"combinator": "OR",
|
414
|
+
},
|
415
|
+
},
|
416
|
+
{
|
417
|
+
"id": "dec1317a-6900-4858-a5fb-c849254b2c91",
|
418
|
+
"key": "city",
|
419
|
+
"value": {
|
420
|
+
"rules": [
|
421
|
+
{
|
422
|
+
"type": "INPUT_VARIABLE",
|
423
|
+
"data": {"input_variable_id": "ad577aca-0797-4deb-a484-574ef1a1f0c7"},
|
424
|
+
}
|
425
|
+
],
|
426
|
+
"combinator": "OR",
|
427
|
+
},
|
428
|
+
},
|
429
|
+
{
|
430
|
+
"id": "4cc5b9f1-075d-45fd-a978-f530c29c5682",
|
431
|
+
"key": "date",
|
432
|
+
"value": {
|
433
|
+
"rules": [
|
434
|
+
{
|
435
|
+
"type": "INPUT_VARIABLE",
|
436
|
+
"data": {"input_variable_id": "066124c4-42bd-4764-aa75-6f230dbbed4a"},
|
437
|
+
}
|
438
|
+
],
|
439
|
+
"combinator": "OR",
|
440
|
+
},
|
441
|
+
},
|
442
|
+
{
|
443
|
+
"id": "77b352e0-1b77-4d48-9f6f-04ce17fe7286",
|
444
|
+
"key": "weather",
|
445
|
+
"value": {
|
446
|
+
"rules": [
|
447
|
+
{
|
448
|
+
"type": "NODE_OUTPUT",
|
449
|
+
"data": {
|
450
|
+
"node_id": "56c74024-19a3-4c0d-a5f5-23e1e9f11b21",
|
451
|
+
"output_id": "180355a8-e67c-4ce6-9ac3-e5dbb75a6629",
|
452
|
+
},
|
453
|
+
}
|
454
|
+
],
|
455
|
+
"combinator": "OR",
|
456
|
+
},
|
457
|
+
},
|
458
|
+
],
|
459
|
+
"data": {
|
460
|
+
"label": "Example Templating Node",
|
461
|
+
"output_id": "6834cae4-8173-4fa6-88f7-bc09d335bdd1",
|
462
|
+
"error_output_id": None,
|
463
|
+
"source_handle_id": "39317827-df43-4f5a-bfbc-20bffc839748",
|
464
|
+
"target_handle_id": "58427684-3848-498a-8299-c6b0fc70265d",
|
465
|
+
"template_node_input_id": "7c775379-d589-4d79-b876-dcd224d72966",
|
466
|
+
"output_type": "STRING",
|
467
|
+
},
|
468
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
469
|
+
"base": {
|
470
|
+
"name": "TemplatingNode",
|
471
|
+
"module": ["vellum", "workflows", "nodes", "core", "templating_node", "node"],
|
472
|
+
},
|
473
|
+
"definition": {
|
474
|
+
"name": "ExampleTemplatingNode",
|
475
|
+
"module": [
|
476
|
+
"tests",
|
477
|
+
"workflows",
|
478
|
+
"basic_text_prompt_deployment",
|
479
|
+
"workflow_with_prompt_deployment_json_reference",
|
480
|
+
],
|
481
|
+
},
|
482
|
+
"ports": [{"id": "39317827-df43-4f5a-bfbc-20bffc839748", "name": "default", "type": "DEFAULT"}],
|
483
|
+
}
|
484
|
+
|
485
|
+
final_output_node = workflow_raw_data["nodes"][3]
|
486
|
+
assert final_output_node == {
|
487
|
+
"id": "53de824d-a41d-4294-b511-c969932b05af",
|
488
|
+
"type": "TERMINAL",
|
489
|
+
"data": {
|
490
|
+
"label": "Final Output",
|
491
|
+
"name": "text",
|
492
|
+
"target_handle_id": "fee3d395-38c3-485f-ab61-1a0fdf71c4ce",
|
493
|
+
"output_id": "a7e4b449-5879-4d0c-8f00-d5d4985eb65c",
|
494
|
+
"output_type": "STRING",
|
495
|
+
"node_input_id": "cf380f81-c5ee-4bc9-8e26-ecf1307733a9",
|
496
|
+
},
|
497
|
+
"inputs": [
|
498
|
+
{
|
499
|
+
"id": "cf380f81-c5ee-4bc9-8e26-ecf1307733a9",
|
500
|
+
"key": "node_input",
|
501
|
+
"value": {
|
502
|
+
"rules": [
|
503
|
+
{
|
504
|
+
"type": "NODE_OUTPUT",
|
505
|
+
"data": {
|
506
|
+
"node_id": "51cbe21d-0232-4362-bc54-5bc283297aa6",
|
507
|
+
"output_id": "6834cae4-8173-4fa6-88f7-bc09d335bdd1",
|
508
|
+
},
|
509
|
+
}
|
510
|
+
],
|
511
|
+
"combinator": "OR",
|
512
|
+
},
|
513
|
+
}
|
514
|
+
],
|
515
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
516
|
+
"base": {
|
517
|
+
"name": "FinalOutputNode",
|
518
|
+
"module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
|
519
|
+
},
|
520
|
+
"definition": None,
|
521
|
+
}
|
522
|
+
|
523
|
+
# AND each edge should be serialized correctly
|
524
|
+
serialized_edges = workflow_raw_data["edges"]
|
525
|
+
assert serialized_edges == [
|
526
|
+
{
|
527
|
+
"id": "2c49ffa6-7b9a-49a0-a932-009534556480",
|
528
|
+
"source_node_id": "32c7f398-277c-456b-9279-aa1f867fb637",
|
529
|
+
"source_handle_id": "cc0f4028-1039-4063-971d-7dacbb01b379",
|
530
|
+
"target_node_id": "56c74024-19a3-4c0d-a5f5-23e1e9f11b21",
|
531
|
+
"target_handle_id": "b7605c48-0937-4ecc-914e-0d1058130e65",
|
532
|
+
"type": "DEFAULT",
|
533
|
+
},
|
534
|
+
{
|
535
|
+
"id": "a46909ec-9572-43c6-a134-0bd7e2c09f99",
|
536
|
+
"source_node_id": "56c74024-19a3-4c0d-a5f5-23e1e9f11b21",
|
537
|
+
"source_handle_id": "2f26c7e0-283d-4f04-b639-adebb56bc679",
|
538
|
+
"target_node_id": "51cbe21d-0232-4362-bc54-5bc283297aa6",
|
539
|
+
"target_handle_id": "58427684-3848-498a-8299-c6b0fc70265d",
|
540
|
+
"type": "DEFAULT",
|
541
|
+
},
|
542
|
+
{
|
543
|
+
"id": "1f720900-e5e1-49b7-9910-6ede79f6afd2",
|
544
|
+
"source_node_id": "51cbe21d-0232-4362-bc54-5bc283297aa6",
|
545
|
+
"source_handle_id": "39317827-df43-4f5a-bfbc-20bffc839748",
|
546
|
+
"target_node_id": "53de824d-a41d-4294-b511-c969932b05af",
|
547
|
+
"target_handle_id": "fee3d395-38c3-485f-ab61-1a0fdf71c4ce",
|
548
|
+
"type": "DEFAULT",
|
549
|
+
},
|
550
|
+
]
|
551
|
+
|
552
|
+
# AND the display data should be what we expect
|
553
|
+
display_data = workflow_raw_data["display_data"]
|
554
|
+
assert display_data == {
|
555
|
+
"viewport": {
|
556
|
+
"x": 0.0,
|
557
|
+
"y": 0.0,
|
558
|
+
"zoom": 1.0,
|
559
|
+
}
|
560
|
+
}
|
561
|
+
|
562
|
+
# AND the definition should be what we expect
|
563
|
+
definition = workflow_raw_data["definition"]
|
564
|
+
assert definition == {
|
565
|
+
"name": "WorkflowWithPromptDeploymentJsonReferenceWorkflow",
|
566
|
+
"module": [
|
567
|
+
"tests",
|
568
|
+
"workflows",
|
569
|
+
"basic_text_prompt_deployment",
|
570
|
+
"workflow_with_prompt_deployment_json_reference",
|
571
|
+
],
|
572
|
+
}
|
File without changes
|
File without changes
|
File without changes
|